diff --git a/README.md b/README.md index be3d60ba..c0d38791 100644 --- a/README.md +++ b/README.md @@ -253,31 +253,35 @@ polymorfa completion fish | source Completion suggests command names, flags, and fixed flag choices from the installed CLI. It does not look up profile names, project IDs, credentials, or other argument values, and it does not contact the API. Add the command for -your shell to its startup file if you want completion in later sessions. +your shell to its startup file if you want completion in later shell sessions. -## Inspect sessions +## Inspect connections -Use an organization API key with `sessions:read` to inspect stored session +Use an organization API key with `connections:read` to inspect stored connection metadata: ```shell -polymorfa session list -polymorfa session list --project PROJECT_ID --json -polymorfa session view SESSION_ID -polymorfa session status SESSION_ID --json +polymorfa connection list +polymorfa connection list --project PROJECT_ID --json +polymorfa connection view CONNECTION_ID +polymorfa connection status CONNECTION_ID --json ``` -`session list` reads every session in the team unless you pass a project UUID. -Use a session ID from the list for `view` or `status`; these commands do not +`connection list` reads every connection in the team unless you pass a project UUID. +Use a connection ID from the list for `view` or `status`; these commands do not accept `--project`. `status` reads the stored status and optional reason from -the session record. It does not probe the device or wait for a connection. +the connection record. It does not probe the device or wait for a connection. +Each Connection has `type: "whatsapp"` and one `method`: `linked_device`, +`cloud_api`, or `hybrid`. Hybrid stays one Connection with one ID and one +billing identity. Meta phone-number IDs remain `phoneNumberId`. + Key metadata listing and revocation are available through `key list` and `key revoke`; the CLI does not mint or rotate organization keys. ## QuickLinks A QuickLink is a persistent hosted link that connects one WhatsApp number to a -new session in a project. Create one from a JSON request with an organization +new connection in a project. Create one from a JSON request with an organization API key that has `quicklink:manage`: ```shell @@ -287,7 +291,7 @@ polymorfa quicklink create \ ``` The request accepts `customerId`, `externalId`, and `configuration`. See -[Guided session creation and configuration](#guided-session-creation-and-configuration) +[Guided connection creation and configuration](#guided-connection-creation-and-configuration) for the configuration fields. Inspect or cancel a link with an organization API key or an exact-project @@ -303,10 +307,10 @@ polymorfa quicklink cancel ql_123 \ ``` Creation prints the hosted URL. Treat it as a credential and share it only with -the person holding the phone. The CLI never retrieves direct session QR payloads +the person holding the phone. The CLI never retrieves direct connection QR payloads or pairing codes. Cancel requires `--yes` and invalidates an unconnected link. For an initial real link, the API returns `202` after accepting cancellation; -Number and session cleanup can continue afterward. Supplementary and test +Connection and connection cleanup can continue afterward. Supplementary and test links return `200` when cancellation completes. Cancellation fails for a link that has already connected. The API does not accept an idempotency key for cancellation. The API exposes no QuickLink list, recovery, @@ -344,10 +348,10 @@ reserve an invitation for one number, pass `--expected-phone` to per-link options. The `customer` commands cover project enablement, list filters and cursors, -profile creation and updates, archive and restore, assigned Numbers, recent -events, pairing-link creation/listing/revocation, and confirmed Number +profile creation and updates, archive and restore, assigned Connections, recent +events, pairing-link creation/listing/revocation, and confirmed Connection transfers. Mutations that require retry identity also require -`--idempotency-key`. Archive, pairing-link revocation, and Number transfer +`--idempotency-key`. Archive, pairing-link revocation, and Connection transfer require explicit confirmation with `--yes`. Pairing-link creation prints the one-time URL in human output. Store it when it @@ -356,13 +360,13 @@ is returned. An idempotent replay returns the link record without the URL. ## Groups The first curated Messaging resource commands are read-only and require an -explicit session: +explicit connection: ```shell -polymorfa group list --session session_123 -polymorfa group view 750000000001 --session session_123 -polymorfa group participants list 750000000001 --session session_123 -polymorfa group invite-link 750000000001 --session session_123 +polymorfa group list --connection session_123 +polymorfa group view 750000000001 --connection session_123 +polymorfa group participants list 750000000001 --connection session_123 +polymorfa group invite-link 750000000001 --connection session_123 ``` Add `--json` for complete resource data and response metadata. Group and @@ -371,19 +375,19 @@ participant lists are unpaged because the source API does not expose cursors. Create and change groups with a server API key that has `groups:manage`: ```shell -polymorfa group create --session session_123 \ +polymorfa group create --connection session_123 \ --name 'Launch team' \ --participant 750000000001 --participant 750000000002 -polymorfa group participants add 750000000009 --session session_123 --participant 750000000003 -polymorfa group participants promote 750000000009 --session session_123 --participant 750000000003 -polymorfa group participants demote 750000000009 --session session_123 --participant 750000000003 -polymorfa group participants remove 750000000009 --session session_123 --participant 750000000003 --yes +polymorfa group participants add 750000000009 --connection session_123 --participant 750000000003 +polymorfa group participants promote 750000000009 --connection session_123 --participant 750000000003 +polymorfa group participants demote 750000000009 --connection session_123 --participant 750000000003 +polymorfa group participants remove 750000000009 --connection session_123 --participant 750000000003 --yes -polymorfa group subject 750000000009 --session session_123 --value 'Launch crew' -polymorfa group description 750000000009 --session session_123 --value '' +polymorfa group subject 750000000009 --connection session_123 --value 'Launch crew' +polymorfa group description 750000000009 --connection session_123 --value '' -polymorfa group settings 750000000009 --session session_123 \ +polymorfa group settings 750000000009 --connection session_123 \ --messaging admins --info-editing admins --member-add all --join-approval on ``` @@ -396,10 +400,10 @@ requires `--yes`. ### Stored group capabilities -Use `polymorfa group capabilities GROUP_ID --session SESSION` to read the -linked number's stored group configuration. Add `--json` for the complete +Use `polymorfa group capabilities GROUP_ID --connection CONNECTION` to read the +linked Connection's stored group configuration. Add `--json` for the complete response. This read requires `groups:read`, current group membership, and -number-capabilities beta enrollment. Unknown configuration stays `unknown`; +connection-capabilities beta enrollment. Unknown configuration stays `unknown`; the command does not open the group chat or fetch its configuration. The keys `polls.endTime`, `polls.hideVoters`, and `polls.creatorEdit` describe @@ -416,26 +420,26 @@ Send text and perform the complete set of source-defined Messaging actions: ```shell polymorfa message send text \ - --session session_123 \ + --connection session_123 \ --to +15551234567 \ --body 'Hello' polymorfa message react 740000000001 \ - --session session_123 \ + --connection session_123 \ --chat +15551234567 \ --emoji '👍' polymorfa message mark-seen 740000000001 \ - --session session_123 \ + --connection session_123 \ --chat +15551234567 polymorfa message typing \ - --session session_123 \ + --connection session_123 \ --chat +15551234567 \ --state typing polymorfa message star 740000000001 \ - --session session_123 \ + --connection session_123 \ --chat +15551234567 ``` @@ -465,7 +469,7 @@ without an explicit key creates a new request and can repeat the write. ```shell # Reuse order-123-shipped only when retrying this exact notification. polymorfa message send text \ - --session session_123 --to +15551234567 \ + --connection session_123 --to +15551234567 \ --body 'Your order shipped.' --idempotency-key order-123-shipped ``` @@ -497,17 +501,17 @@ header. ### Flow drafts and provider lifecycle Flow commands require a project scope and an organization API key or project -token. Reads use `sessions:read`; mutations use `sessions:manage`. +token. Reads use `connections:read`; mutations use `connections:manage`. ```shell polymorfa flow list --project PROJECT_UUID polymorfa flow create --project PROJECT_UUID --input draft.json polymorfa flow get FLOW_UUID --project PROJECT_UUID polymorfa flow update FLOW_UUID --project PROJECT_UUID --input update.json -polymorfa flow upload FLOW_UUID --project PROJECT_UUID --session number_123 --category APPOINTMENT_BOOKING --request-id REQUEST_UUID +polymorfa flow upload FLOW_UUID --project PROJECT_UUID --connection number_123 --category APPOINTMENT_BOOKING --request-id REQUEST_UUID polymorfa flow receipts FLOW_UUID --project PROJECT_UUID -polymorfa flow sync FLOW_UUID --project PROJECT_UUID --session number_123 -polymorfa flow publish FLOW_UUID --project PROJECT_UUID --session number_123 --yes +polymorfa flow sync FLOW_UUID --project PROJECT_UUID --connection number_123 +polymorfa flow publish FLOW_UUID --project PROJECT_UUID --connection number_123 --yes ``` Creation input contains `name` and `definition`, plus an optional `draftId`. @@ -516,7 +520,7 @@ Update input requires the draft's observed `expectedUpdatedAt` and optional Project and Flow identity come from command arguments and cannot be overridden inside the file. -Provider actions are beta and require an eligible Number. `publish`, `deprecate`, +Provider actions are beta and require an eligible Connection. `publish`, `deprecate`, `discard`, and local `delete` require `--yes`. Discard removes a provider draft; local deletion is separate. Writes make one attempt. A successful HTTP response can still carry an `uncertain` operation: read its receipt and use `sync` to @@ -531,45 +535,45 @@ flow key register --phone-number-id PHONE_NUMBER_ID --graph-version v26.0 `business_public_key` as a 2048-bit RSA public key in PEM format. The matching private key stays on your endpoint. Registration affects every dynamic Flow on the phone number, so read the registered key after an uncertain outcome before -submitting another replacement. Reading requires `sessions:read`; registration -requires `sessions:manage`, an eligible Official API Number, and Graph access. -These commands make Polymorfa release its managed key custody for that Number. +submitting another replacement. Reading requires `connections:read`; registration +requires `connections:manage`, an eligible Official API Connection, and Graph access. +These commands make Polymorfa release its managed key custody for that Connection. Polymorfa can also host the data endpoint (beta). It can hold a managed key per -Number, decrypt each WhatsApp request, and either forward it to your HTTPS URL +Connection, decrypt each WhatsApp request, and either forward it to your HTTPS URL or run a deployed Function: ```shell -polymorfa flow key rotate --project PROJECT_UUID --session number_123 --yes -polymorfa flow key custody --project PROJECT_UUID --session number_123 -polymorfa flow endpoint set FLOW_UUID --project PROJECT_UUID --session number_123 --mode forward --url https://example.com/flow -polymorfa flow endpoint set FLOW_UUID --project PROJECT_UUID --session number_123 --mode function --function FUNCTION_UUID -polymorfa flow endpoint set FLOW_UUID --project PROJECT_UUID --session number_123 --mode direct --url https://example.com/flow -polymorfa flow endpoint get FLOW_UUID --project PROJECT_UUID --session number_123 +polymorfa flow key rotate --project PROJECT_UUID --connection number_123 --yes +polymorfa flow key custody --project PROJECT_UUID --connection number_123 +polymorfa flow endpoint set FLOW_UUID --project PROJECT_UUID --connection number_123 --mode forward --url https://example.com/flow +polymorfa flow endpoint set FLOW_UUID --project PROJECT_UUID --connection number_123 --mode function --function FUNCTION_UUID +polymorfa flow endpoint set FLOW_UUID --project PROJECT_UUID --connection number_123 --mode direct --url https://example.com/flow +polymorfa flow endpoint get FLOW_UUID --project PROJECT_UUID --connection number_123 polymorfa flow endpoint receipts FLOW_UUID --project PROJECT_UUID --limit 20 -polymorfa flow endpoint delete FLOW_UUID --project PROJECT_UUID --session number_123 --yes +polymorfa flow endpoint delete FLOW_UUID --project PROJECT_UUID --connection number_123 --yes ``` -`forward` and `function` need a Polymorfa-managed key on the Number. `direct` +`forward` and `function` need a Polymorfa-managed key on the Connection. `direct` needs your own key, registered with `flow key register`. A forward endpoint's signing secret is printed once, when it is created, switched to forward, or rotated with `--rotate-signing-secret`. Verify `X-Polymorfa-Flow-Signature` with the SDK's `verifyFlowForwardSignature`. Configure the endpoint before `flow upload`, which attaches its URI to the Flow. Key rotation affects every -Flow on the Number; the previous managed key decrypts for 24 hours. Rotation +Flow on the Connection; the previous managed key decrypts for 24 hours. Rotation and endpoint writes make one attempt. Receipts are metadata only. ### Submit a project template ```shell -polymorfa template submit TEMPLATE_ID --project-slug support --session number_123 --yes +polymorfa template submit TEMPLATE_ID --project-slug support --connection number_123 --yes ``` This command uses a server API key or project token with `templates:manage`. -The saved project template and Number must belong to the same project. The API +The saved project template and Connection must belong to the same project. The API checks the definition before submitting it to Meta. A successful response -records the submission, not approval. Read the Number's template with -`polymorfa cloud template get NAME --session number_123 --language en_US` to +records the submission, not approval. Read the Connection's template with +`polymorfa cloud template get NAME --connection number_123 --language en_US` to check its status. If the request times out or its response is lost, read the template before choosing whether to submit again. The command makes one network attempt and requires `--yes` because a second submission can create a @@ -581,26 +585,26 @@ linked to another project; the API checks that the credential can access it. The `cloud` commands require an organization API key or a project token with the listed scope. Client tokens cannot use these commands. Server-side feature -access still applies: an installed command does not enroll a Number or enable a +access still applies: an installed command does not enroll a Connection or enable a beta feature. ```shell polymorfa cloud catalog list --waba WABA_ID --graph-version v26.0 --limit 25 polymorfa cloud catalog products --waba WABA_ID --catalog CATALOG_ID --graph-version v26.0 --limit 25 polymorfa cloud marketing status --waba WABA_ID --graph-version v26.0 -polymorfa cloud template list --session number_123 -polymorfa cloud template get order_update --session number_123 --language en_US -polymorfa cloud template create --session number_123 --input template.json --idempotency-key tpl-order-update -polymorfa cloud template edit order_update --session number_123 --language en_US --input components.json -polymorfa cloud template delete order_update --session number_123 --yes -polymorfa cloud service-window +15551234567 --session number_123 -polymorfa cloud pricing --session number_123 --since 2026-09-01T00:00:00Z --until 2026-09-26T00:00:00Z -polymorfa cloud credentials get --session number_123 -polymorfa cloud credentials reauthorize --session number_123 +polymorfa cloud template list --connection number_123 +polymorfa cloud template get order_update --connection number_123 --language en_US +polymorfa cloud template create --connection number_123 --input template.json --idempotency-key tpl-order-update +polymorfa cloud template edit order_update --connection number_123 --language en_US --input components.json +polymorfa cloud template delete order_update --connection number_123 --yes +polymorfa cloud service-window +15551234567 --connection number_123 +polymorfa cloud pricing --connection number_123 --since 2026-09-01T00:00:00Z --until 2026-09-26T00:00:00Z +polymorfa cloud credentials get --connection number_123 +polymorfa cloud credentials reauthorize --connection number_123 ``` `cloud group` commands (beta) manage WhatsApp groups on an Official API -Number. They need team enrollment and a Number whose WhatsApp Business Account +Connection. They need team enrollment and a Connection whose WhatsApp Business Account is an Official Business Account; otherwise the API returns `whatsapp_groups_ineligible`. People join with the invite link and cannot be added; a group holds at most 8 participants besides your business. `create` @@ -610,14 +614,14 @@ returns a `requestId`; the group's conversation ID and invite link arrive in a the API instead of changing the group again. ```bash -polymorfa cloud group create --session number_123 --subject "Order 1042" --join-approval --idempotency-key grp-1042 -polymorfa cloud group list --session number_123 -polymorfa cloud group get GROUP_ID --session number_123 -polymorfa cloud group invite-link GROUP_ID --session number_123 -polymorfa cloud group join-requests list GROUP_ID --session number_123 -polymorfa cloud group join-requests approve GROUP_ID --session number_123 --request JOIN_REQUEST_ID -polymorfa cloud group pin GROUP_ID --session number_123 --message MESSAGE_ID --days 7 -polymorfa cloud group delete GROUP_ID --session number_123 --yes +polymorfa cloud group create --connection number_123 --subject "Order 1042" --join-approval --idempotency-key grp-1042 +polymorfa cloud group list --connection number_123 +polymorfa cloud group get GROUP_ID --connection number_123 +polymorfa cloud group invite-link GROUP_ID --connection number_123 +polymorfa cloud group join-requests list GROUP_ID --connection number_123 +polymorfa cloud group join-requests approve GROUP_ID --connection number_123 --request JOIN_REQUEST_ID +polymorfa cloud group pin GROUP_ID --connection number_123 --message MESSAGE_ID --days 7 +polymorfa cloud group delete GROUP_ID --connection number_123 --yes ``` Template commands use `messages:write` and the connected Meta business template @@ -629,35 +633,35 @@ Deletion requires `--yes`. Create, edit and delete send one request and never retry. Create and delete accept `--idempotency-key`; reuse the same key after a lost response so the retained receipt prevents another execution. Replay data may be unavailable; keep the first response and reconcile uncertain outcomes. List the catalog before resubmitting. The template routes need an active -Official API connection, including on a Hybrid Number; a Number with only a +Official API connection, including on a Hybrid Connection; a Connection with only a Linked Devices connection is rejected. Service-window reads use `chats:read`. They report observed `open`, `closed`, or `unknown` state; missing or interrupted notifications can prevent a reliable -window observation. Pricing reads use `sessions:read` and report Meta's message +window observation. Pricing reads use `connections:read` and report Meta's message classifications and counts, without calculating prices or invoice totals. The optional ISO time range defaults to 30 days and cannot exceed 93 days. -Credential reads use `sessions:read`; reauthorization uses `quicklink:manage`. -`cloud catalog list` reads linked product-catalog IDs and names with `sessions:read` +Credential reads use `connections:read`; reauthorization uses `quicklink:manage`. +`cloud catalog list` reads linked product-catalog IDs and names with `connections:read` and Graph access. Pass the returned opaque cursor using `--after` for another page. Catalog visibility does not grant merchant ownership or permission to sell. `cloud catalog products` reads only IDs, optional retailer IDs, names and availability from one catalog linked to the authenticated WABA. Pass its `paging.cursors.after` value as `--after` to read the next page. The API rejects -unlinked catalogs and simulated Numbers. This read does not send a product or +unlinked catalogs and simulated Connections. This read does not send a product or establish that the merchant may sell it. -`cloud marketing status` uses `sessions:read` to return Meta's raw WABA +`cloud marketing status` uses `connections:read` to return Meta's raw WABA `marketing_messages_lite_api_status` and `marketing_messages_onboarding_status` strings when present. The values do not establish accepted terms, recipient permission, eligibility, or a right to -send. Simulated Numbers and unsupported accounts return API errors; the CLI +send. Simulated Connections and unsupported accounts return API errors; the CLI does not convert status strings into an eligibility decision. Reauthorization creates a QuickLink for a stopped or disconnected standalone -Official Number. It never stops the Number or opens the link automatically. -Running Numbers return a conflict; Hybrid reauthorization is unsupported. +Official Connection. It never stops the Connection or opens the link automatically. +Running Connections return a conflict; Hybrid reauthorization is unsupported. Template writes and credential reauthorization do not retry uncertain provider outcomes. Inspect the catalog or onboarding state before another write. API @@ -665,9 +669,9 @@ access, state, and server failures retain the CLI's exit codes: 3 for forbidden access, 4 for conflicts, and 5 for server failures. Use `--json` to retain the observation fields and structured errors. -For Official Numbers, `message typing` requires `--id` for a message you received +For Official Connections, `message typing` requires `--id` for a message you received and `--state typing`. It marks that message read and shows typing until a reply -is sent or 25 seconds pass. Linked Device Numbers also support `recording` and +is sent or 25 seconds pass. Linked Device Connections also support `recording` and `paused` without an inbound ID. `quicklink view` shows contacts/history request receipts and history-delivery @@ -677,28 +681,28 @@ does not establish that sync completed. ### Typed sends -Every `message send ` command accepts the same `--session`, `--to`, +Every `message send ` command accepts the same `--connection`, `--to`, `--reply-to`, `--mention`, `--forwarded`, and `--idempotency-key` flags as `message send text`: ```shell # Media from a local file (sent inline as base64) or a public URL -polymorfa message send image --session session_123 --to +15551234567 --file ./photo.jpg --caption 'Today' -polymorfa message send video --session session_123 --to +15551234567 --url https://example.com/clip.mp4 -polymorfa message send audio --session session_123 --to +15551234567 --file ./note.ogg --voice -polymorfa message send document --session session_123 --to +15551234567 --file ./invoice.pdf +polymorfa message send image --connection session_123 --to +15551234567 --file ./photo.jpg --caption 'Today' +polymorfa message send video --connection session_123 --to +15551234567 --url https://example.com/clip.mp4 +polymorfa message send audio --connection session_123 --to +15551234567 --file ./note.ogg --voice +polymorfa message send document --connection session_123 --to +15551234567 --file ./invoice.pdf -polymorfa message send template --session session_123 --to +15551234567 \ +polymorfa message send template --connection session_123 --to +15551234567 \ --name order_update --language en_US --components components.json -polymorfa message send location --session session_123 --to +15551234567 \ +polymorfa message send location --connection session_123 --to +15551234567 \ --lat 51.5007 --long=-0.1246 --address 'Westminster' -polymorfa message send contact --session session_123 --to +15551234567 \ +polymorfa message send contact --connection session_123 --to +15551234567 \ --name 'Ada Lovelace' --phone +15557654321 -polymorfa message send poll --session session_123 --to 730000000001 \ +polymorfa message send poll --connection session_123 --to 730000000001 \ --title 'Lunch?' --option Pizza --option Sushi --multi-select -polymorfa message send buttons --session session_123 --to +15551234567 \ +polymorfa message send buttons --connection session_123 --to +15551234567 \ --body 'Confirm your order?' --button reply:yes=Yes --button reply:no=No -polymorfa message send list --session session_123 --to +15551234567 \ +polymorfa message send list --connection session_123 --to +15551234567 \ --title 'Pick a slot' --button-text Choose \ --row 'Morning/am9=9:00' --row 'Afternoon/pm2=14:00|Near the office' ``` @@ -720,14 +724,14 @@ polymorfa message send list --session session_123 --to +15551234567 \ ### Brazil payment orders (beta) -Teams enrolled in the beta can send Brazil orders from Official API Numbers +Teams enrolled in the beta can send Brazil orders from Official API Connections that Meta has made eligible for payments in Brazil. Polymorfa relays the order and payment reports; it does not collect, hold or confirm funds. ```sh -polymorfa message send order --session session_123 --to +5511987654321 \ +polymorfa message send order --connection session_123 --to +5511987654321 \ --order order.json --idempotency-key order-1522 -polymorfa message send order-status --session session_123 --to +5511987654321 \ +polymorfa message send order-status --connection session_123 --to +5511987654321 \ --reference-id order-1522 --body 'Payment received' \ --order-status processing --payment-status captured ``` @@ -752,8 +756,8 @@ The API has no sticker send kind, so the CLI has no `message send sticker`. ### Edit and delete ```shell -polymorfa message edit 740000000001 --session session_123 --chat 730000000001 --body 'Corrected text' -polymorfa message delete 740000000001 --session session_123 --chat 730000000001 --yes +polymorfa message edit 740000000001 --connection session_123 --chat 730000000001 --body 'Corrected text' +polymorfa message delete 740000000001 --connection session_123 --chat 730000000001 --yes ``` Edit and delete require `chats:manage`. Delete asks for confirmation; pass @@ -761,18 +765,18 @@ Edit and delete require `chats:manage`. Delete asks for confirmation; pass ### Stored chat history (beta) -For a Number with hosted message storage (HMS) enabled, an enrolled team can +For a Connection with hosted message storage (HMS) enabled, an enrolled team can read stored chats and messages. An owner or admin enrolls the team on the -Console **Numbers** page. Storage includes only messages sent or received after -HMS was enabled. Test Numbers have no stored history. These read commands +Console **Connections** page. Storage includes only messages sent or received after +HMS was enabled. Test Connections have no stored history. These read commands require a server API key or project token; client tokens cannot read history. ```shell -polymorfa chat list --session NUMBER_ID --limit 20 --kind direct -polymorfa chat view +15550001111 --session NUMBER_ID -polymorfa chat message list +15550001111 --session NUMBER_ID --limit 20 --order desc -polymorfa chat message view +15550001111 739182640518204 --session NUMBER_ID -polymorfa chat message media +15550001111 739182640518204 --session NUMBER_ID --output ./attachment.bin +polymorfa chat list --connection NUMBER_ID --limit 20 --kind direct +polymorfa chat view +15550001111 --connection NUMBER_ID +polymorfa chat message list +15550001111 --connection NUMBER_ID --limit 20 --order desc +polymorfa chat message view +15550001111 739182640518204 --connection NUMBER_ID +polymorfa chat message media +15550001111 739182640518204 --connection NUMBER_ID --output ./attachment.bin ``` Chat reads require `chats:read`; message reads require `messages:read`. Older @@ -786,8 +790,8 @@ include `--kind`, `--active-since`, and `--active-before`. The API defaults to a page of 50 and permits `--limit` from 1 through 100. Without enrollment, the API returns `403 permission_denied`; without HMS on -the Number it returns `404 hms_not_enabled`. `503 service_unavailable` means -the Number's regional history service cannot be reached. No search command is +the Connection it returns `404 hms_not_enabled`. `503 service_unavailable` means +the Connection's regional history service cannot be reached. No search command is available. See the [message history guide](https://docs.polymorfa.com/guides/communicate/message-history) for retention and media download behavior. @@ -847,19 +851,19 @@ not advertise those operations. ## Labels -Labels require a server API key and an explicit Messaging session: +Labels require a server API key and an explicit Messaging connection: ```shell -polymorfa label list --session session_123 -polymorfa label create --session session_123 --name Priority --color 5 -polymorfa label update label_123 --session session_123 --name Urgent -polymorfa label delete label_123 --session session_123 --yes +polymorfa label list --connection session_123 +polymorfa label create --connection session_123 --name Priority --color 5 +polymorfa label update label_123 --connection session_123 --name Urgent +polymorfa label delete label_123 --connection session_123 --yes polymorfa label chat list +15551234567 \ - --session session_123 + --connection session_123 polymorfa label chat replace +15551234567 \ - --session session_123 \ + --connection session_123 \ --label priority \ --label customer ``` @@ -873,24 +877,24 @@ exposes no message-label operation. ## Quick Replies Stored business quick replies require a server API key and an explicit -Messaging session: +Messaging connection: ```shell -polymorfa quick-reply list --session session_123 +polymorfa quick-reply list --connection session_123 polymorfa quick-reply create \ - --session session_123 \ + --connection session_123 \ --shortcut /hours \ --message 'We are open from 09:00 to 17:00.' \ --keyword hours \ --keyword opening polymorfa quick-reply replace reply_123 \ - --session session_123 \ + --connection session_123 \ --shortcut /hours \ --message 'We are open from 08:00 to 18:00.' -polymorfa quick-reply delete reply_123 --session session_123 --yes +polymorfa quick-reply delete reply_123 --connection session_123 --yes ``` `quick-reply replace` replaces the complete shortcut and message rather than @@ -909,19 +913,19 @@ View and update the connected account's Messaging profile with a server API key: ```shell -polymorfa profile view --session session_123 -polymorfa profile name set --session session_123 --name Polymorfa -polymorfa profile status set --session session_123 --status Available +polymorfa profile view --connection session_123 +polymorfa profile name set --connection session_123 --name Polymorfa +polymorfa profile status set --connection session_123 --status Available polymorfa profile picture set \ - --session session_123 \ + --connection session_123 \ --file ./profile.jpg polymorfa profile picture set \ - --session session_123 \ + --connection session_123 \ --url https://example.com/profile.jpg -polymorfa profile picture delete --session session_123 --yes +polymorfa profile picture delete --connection session_123 --yes ``` Picture setting requires exactly one source. `--file` reads at most 50 MiB and @@ -940,15 +944,15 @@ operation. View and change account-level Messaging privacy with a server API key: ```shell -polymorfa privacy view --session session_123 +polymorfa privacy view --connection session_123 polymorfa privacy set \ - --session session_123 \ + --connection session_123 \ --setting online \ --value match_last_seen polymorfa privacy disappearing-timer set \ - --session session_123 \ + --connection session_123 \ --duration 7d ``` @@ -967,14 +971,14 @@ View the remembered self state, change it with a server key, or inspect and renew policy-governed chat observations: ```shell -polymorfa presence view --session session_123 -polymorfa presence set --session session_123 --state available +polymorfa presence view --connection session_123 +polymorfa presence set --connection session_123 --state available polymorfa presence chat view +15551234567 \ - --session session_123 + --connection session_123 polymorfa presence chat subscribe +15551234567 \ - --session session_123 + --connection session_123 ``` `presence view` reports the service's remembered desired and last-sent state; @@ -984,36 +988,36 @@ typing-observation fields. It does not bypass the configured observation policy. Reads and subscription accept either a server API key or an appropriately -scoped, session-bound client token. Changing self presence requires a server +scoped, connection-bound client token. Changing self presence requires a server API key. Repeat `presence chat subscribe` before the returned `expiresAt` to renew the subscription; the API exposes no watch, history, polling helper, or unsubscribe operation. Mutations accept `--idempotency-key`. ## Channels -Channels are connected-session resources and require a server API key: +Channels are connected-connection resources and require a server API key: ```shell -polymorfa channel list --session session_123 -polymorfa channel view 760000000001 --session session_123 +polymorfa channel list --connection session_123 +polymorfa channel view 760000000001 --connection session_123 polymorfa channel create \ - --session session_123 \ + --connection session_123 \ --name 'Product updates' \ --description 'Release announcements' polymorfa channel message list 760000000001 \ - --session session_123 \ + --connection session_123 \ --limit 25 \ --before 951 polymorfa channel message updates 760000000001 \ - --session session_123 \ + --connection session_123 \ --since 1787212800 polymorfa channel live-updates subscribe \ 760000000001 \ - --session session_123 + --connection session_123 ``` Message and update listing return bounded arrays, not cursor pages. `--limit` @@ -1039,24 +1043,24 @@ and groups, and the source has no dedicated channel-send operation. Contacts are Linked Device resources and require a server API key: ```shell -polymorfa contact list --session session_123 +polymorfa contact list --connection session_123 polymorfa contact check \ - --session session_123 \ + --connection session_123 \ --phone +15551234567 \ --phone +15557654321 -polymorfa contact view 750000000001 --session session_123 -polymorfa contact info 750000000001 --session session_123 -polymorfa contact picture 750000000001 --session session_123 -polymorfa contact devices 750000000001 --session session_123 -polymorfa contact business-profile 750000000001 --session session_123 -polymorfa contact blocklist --session session_123 -polymorfa contact block 750000000001 --session session_123 -polymorfa contact unblock 750000000001 --session session_123 +polymorfa contact view 750000000001 --connection session_123 +polymorfa contact info 750000000001 --connection session_123 +polymorfa contact picture 750000000001 --connection session_123 +polymorfa contact devices 750000000001 --connection session_123 +polymorfa contact business-profile 750000000001 --connection session_123 +polymorfa contact blocklist --connection session_123 +polymorfa contact block 750000000001 --connection session_123 +polymorfa contact unblock 750000000001 --connection session_123 ``` -`contact view` reads contact data known to the connected session. `contact info` +`contact view` reads contact data known to the connected connection. `contact info` requests live WhatsApp user metadata. The CLI keeps those sources distinct. `contact picture` returns the service-provided URL and does not download the image. `contact devices` returns the upstream linked-device JIDs without @@ -1070,31 +1074,31 @@ pagination. Block and unblock are reversible actions and accept ## Calls The `calls` commands place, answer, join, decline, leave, and end calls, invite -participants, follow a session's calls, and carry call audio. `calls stats` and +participants, follow a connection's calls, and carry call audio. `calls stats` and `calls export` report on past calls; see [Call statistics and export](#call-statistics-and-export). For example: ```shell -polymorfa calls place +15550100 --session support --exclusive +polymorfa calls place +15550100 --connection support --exclusive polymorfa calls accept call_123 --exclusive --participant agent-7 polymorfa calls reject call_123 polymorfa calls leave call_123 --connection-id conn_0123456789 polymorfa calls end call_123 polymorfa calls invite call_123 +15550101 -polymorfa calls watch --session support --json -polymorfa calls media --session support --place +15550100 \ +polymorfa calls watch --connection support --json +polymorfa calls media --connection support --place +15550100 \ --input prompt.pcm --leave-on-eof --output reply.pcm -polymorfa calls settings get --session support -polymorfa calls settings set --session support --no-conference-mode -polymorfa calls settings set --session support --calls-enabled=false \ +polymorfa calls settings get --connection support +polymorfa calls settings set --connection support --no-conference-mode +polymorfa calls settings set --connection support --calls-enabled=false \ --expected-revision 3 -polymorfa calls settings set --session support \ +polymorfa calls settings set --connection support \ --inbound-route sip_trunk --sip-trunk 6f1c2f0e-1d5b-4d8e-9a55-0d4b8a6c1f10 -polymorfa calls settings set --session support \ +polymorfa calls settings set --connection support \ --simultaneous-calls=true --acknowledge-risk -polymorfa calls settings set --session support --simultaneous-calls=false +polymorfa calls settings set --connection support --simultaneous-calls=false polymorfa calls retention get polymorfa calls retention set --policy compliance --expected-revision 0 @@ -1105,16 +1109,16 @@ polymorfa calls retention set --policy custom --days 14 --expected-revision 1 -- participant again: ```shell -polymorfa calls place-group --session support --to +15550100 --to +15550101 -polymorfa calls place-group --session support --group-id 9007199254740996 +polymorfa calls place-group --connection support --to +15550100 --to +15550101 +polymorfa calls place-group --connection support --group-id 9007199254740996 polymorfa calls ring call_123 +15550101 ``` Group placement accepts 2 to 31 distinct recipients and checks every recipient's calling permissions. Use `--group-id` instead of `--to` to call every remote -member of an existing group using its public ID. The Number must belong to the +member of an existing group using its public ID. The Connection must belong to the group, and it must have 2 to 31 remote members. Membership changes during -placement refuse the call. Group calls require a Linked Device Number. `calls ring` +placement refuse the call. Group calls require a Linked Device Connection. `calls ring` only rings a non-connected participant already in the call roster; successful submission does not mean that the participant answered. @@ -1126,31 +1130,31 @@ never answers or declines on its own. `@`, and `-`) to name it; the API uses `default` otherwise. A client token from `POLYMORFA_CLIENT_TOKEN` acts as its own participant, so the CLI rejects `--participant` with a client token before sending a request. -- **Sessions.** Server API keys name the session with `--session` for +- **Connections.** Server API keys name the connection with `--connection` for `calls place`, `calls watch`, and `calls media`. Client tokens use the - session they are bound to; `calls watch` and `calls media` reject - `--session` with a client token. + connection they are bound to; `calls watch` and `calls media` reject + `--connection` with a client token. - **Claims.** `calls accept --exclusive` claims the call. Other participants then receive `call_claimed`, and the command exits with code 4 and prints `code: "call_claimed"` under `--json`. Without a claim, a later accept joins the answered call. `calls reject` exits with code 4 and `code: "call_not_ringing"` when the call was already answered, declined, or ended. Declining ends the call for every participant. -- **Number restrictions.** When WhatsApp restricts the Number to people it has +- **Connection restrictions.** When WhatsApp restricts the Connection to people it has already chatted with, `calls place` and `calls invite` exit with code 3 and - `code: "number_restricted"` for anyone else; calls to people it has already + `code: "connection_restricted"` for anyone else; calls to people it has already chatted with still work. A call WhatsApp refuses for that reason ends with `reason: "call_restricted"` in `calls watch`. - `polymorfa listen --event session.restriction_updated` reports the + `polymorfa listen --event connection.restriction_updated` reports the restriction starting and ending. - **Connections.** `calls leave` closes one connection, named by an 8 to 64 character ID from `A-Z`, `a-z`, `0-9`, `_`, and `-`. The call continues. `calls end` ends the call for everyone. - **Client token actions.** Client tokens can place, accept, decline, leave, - end, invite, watch, and carry audio when the session's client rules allow + end, invite, watch, and carry audio when the connection's client rules allow it. The API decides; the CLI reports its errors unchanged. - **Settings.** `calls settings` uses the Platform API and requires a server - API key. `--calls-enabled=false` turns calling off for the session: placing, + API key. `--calls-enabled=false` turns calling off for the connection: placing, answering and joining calls then exit with code 3 (`calls_disabled`), incoming calls are declined, and calls in progress continue. Conference mode is on by default: every participant you connect to a call @@ -1160,13 +1164,13 @@ never answers or declines on its own. always hears all of your participants, and nobody hears their own audio. `--inbound-route sip_trunk` with `--sip-trunk` also sends incoming calls to a SIP trunk; `--sip-claim` controls whether the trunk's answer claims the - call. On a Cloud API session, `--host-cloud-api-calls=true` has Polymorfa + call. On a Cloud API connection, `--host-cloud-api-calls=true` has Polymorfa Calls answer incoming calls; with the default `false`, your Graph API integration answers them. `--simultaneous-calls=true` lets a linked-device - number hold any number of calls at once (incoming, placed, and campaign - calls); Cloud API numbers ignore it. WhatsApp's own apps never hold two calls + Connection hold any number of calls at once (incoming, placed, and campaign + calls); Cloud API connections ignore it. WhatsApp's own apps never hold two calls at once. While it is on, and for 30 days after you turn it off, Ban Insurance - does not cover a ban of the number: a claim opens as `denied` with verdict + does not cover a ban of the Connection: a claim opens as `denied` with verdict `simultaneous_calls`. Turning it on requires `--acknowledge-risk`; without it the command exits with code 2 and sends nothing. Only a team API key can turn it on. `--simultaneous-calls=false` needs no acknowledgment. After it @@ -1175,11 +1179,11 @@ never answers or declines on its own. `--json`), until that time passes. Ban Insurance excludes a ban when simultaneous calls were on during the 30 days before it; this timestamp is the cutoff for a new ban from that period. Nothing is printed while the setting is on, and a missing or null - end does not mean the number is covered. + end does not mean the Connection is covered. `calls settings set` sends only the flags you pass; the other settings keep their values. `calls settings get` and `set` print the settings `revision`, which increases on every change and is `0` while the - session uses the defaults. Pass `--expected-revision ` to apply the + connection uses the defaults. Pass `--expected-revision ` to apply the change only if the settings still have that revision; if someone changed them first, the command exits with code 4 (`state_conflict`) and changes nothing. @@ -1203,7 +1207,7 @@ never answers or declines on its own. shortens the period; `--yes` confirms without a prompt, and without a terminal the command exits with code 2 (`confirmation_required`) unless you pass `--yes`. Changing retention requires a team API key with the - `sessions:read` and `sessions:manage` scopes, because the command reads the + `connections:read` and `connections:manage` scopes, because the command reads the setting before it changes it. Project tokens can read the setting; the API refuses their changes, and the command exits with code 3. @@ -1238,7 +1242,7 @@ Convert audio with any tool that writes raw PCM, for example: ```shell sox greeting.wav -t raw -r 16000 -e signed -b 16 -c 1 - | \ - polymorfa calls media --session support --place +15550100 \ + polymorfa calls media --connection support --place +15550100 \ --input - --leave-on-eof > reply.pcm ``` @@ -1291,32 +1295,32 @@ polymorfa calls opt-outs remove 0b9f6a52-8f0e-4a44-9d51-3c1f9d6f2a10 --yes batches were stored; when nothing was stored it exits with the request's own code. -Call permissions apply to Cloud API sessions and need a server API key: +Call permissions apply to Cloud API connections and need a server API key: ```shell -polymorfa calls permission get +14155550123 --session support -polymorfa calls permission request +14155550123 --session support \ +polymorfa calls permission get +14155550123 --connection support +polymorfa calls permission request +14155550123 --connection support \ --body "We would like to call you about order 1522." -polymorfa calls check +14155550123 --session support +polymorfa calls check +14155550123 --connection support ``` - **Read.** `calls permission get` asks WhatsApp on every request and prints the status (`none`, `temporary`, `permanent`, `revoked`), its expiry, and WhatsApp's limits on permission requests and calls. When WhatsApp cannot be - reached it prints the stored state and says so. A linked-device session exits + reached it prints the stored state and says so. A linked-device connection exits with code 4 (`unsupported_for_connection`). - **Ask.** `calls permission request` sends `callPermissionRequest` content through the messages send route, so WhatsApp shows `--body` above its allow and decline buttons and charges it as a message. The answer arrives as a - `call.permission_changed` event. WhatsApp limits how often a number can ask + `call.permission_changed` event. WhatsApp limits how often a Connection can ask the same person: the command then exits with code 5 (`call_permission_request_limited`) and prints the `Retry-After` wait when WhatsApp gives one. A person who already granted permanent permission exits with code 4 (`call_permission_granted`). `--idempotency-key` identifies a retry of the same send. - **Check.** `calls check` runs the checks a placement runs without calling: - the session's calling switch, the do-not-call list and blocked country codes, - and on Cloud API sessions the person's permission and WhatsApp's call limits. + the connection's calling switch, the do-not-call list and blocked country codes, + and on Cloud API connections the person's permission and WhatsApp's call limits. It exits with code 0 whether or not the call is allowed; read `allowed` and `refusal` from the output. `refusal` is `calls_disabled`, `call_recipient_opted_out`, `call_destination_blocked`, @@ -1326,14 +1330,14 @@ polymorfa calls check +14155550123 --session support `calls stats` summarizes calls and `calls export` writes call detail records. Both accept an organization API key or an exact-project token with the -`sessions:read` scope. Pass `--project` to read one project. Without it, an +`connections:read` scope. Pass `--project` to read one project. Without it, an organization API key reads every project in the organization. A project token reads only its own project and requires `--project`. ```shell polymorfa calls stats polymorfa calls stats --project 018f0000-0000-7000-8000-000000000002 \ - --group-by session + --group-by connection polymorfa calls stats --since 2026-09-01T00:00:00Z --until 2026-09-02T00:00:00Z \ --group-by hour --timezone Europe/Lisbon --heatmap @@ -1344,19 +1348,19 @@ polymorfa calls export --since 2026-09-01T00:00:00Z --cursor \ --output rest.csv ``` -Both commands filter with `--session`, `--direction` (`inbound` or +Both commands filter with `--connection`, `--direction` (`inbound` or `outbound`), `--upstream` (`linked_device` or `cloud_api`), `--outcome` (`answered`, `missed`, `declined`, `failed`, or `in_progress`), `--since`, and `--until` (RFC 3339 times; a call matches by its start time). - **Statistics.** The range defaults to the last 7 days. `--group-by` accepts - `day` (the default, up to 366 days), `hour` (up to 31 days), `session`, or + `day` (the default, up to 366 days), `hour` (up to 31 days), `connection`, or `outcome`. Day and hour groups, and the `--heatmap` grid of calls by day of week and hour, use `--timezone`, an IANA name such as `Europe/Lisbon` (UTC by default). Human output prints the totals, with the answer rate as a percentage and durations as hours, minutes, and seconds, and then one row per group. `--json` prints the complete response, including the heatmap. Grouping - by session lists at most 500 numbers; the totals still count every call. + by connection lists at most 500 connections; the totals still count every call. - **Export.** `--format` is `csv` (the default) or `ndjson`. The command requests pages of `--limit` records (1 to 1,000; default 1,000), newest first, until none remain, and writes one CSV header. Records go to standard output, or to @@ -1397,7 +1401,7 @@ passwords never appear in the command line. `create` refuses a body that names `projectId`; use `--project`. A trunk that accepts calls from your PBX, and `rotate-credentials`, print the password once. `update --expected-revision` exits with code 4 when the trunk changed; `delete` exits with code 4 while a -session routes calls to the trunk. +connection routes calls to the trunk. `endpoint` prints the host your PBX sends SIP to, each transport with its port and whether it requires SRTP, and the UDP port range call audio uses. The @@ -1508,54 +1512,54 @@ With `--json`, stderr carries the error code in `error.code`. ### Call usage and limits -When Calls access is enabled for a team, Polymorfa measures the calls its numbers host. Usage is measured, not charged. -Commands require `sessions:read`; a project token reads only its own project's +When Calls access is enabled for a team, Polymorfa measures the calls its connections host. Usage is measured, not charged. +Commands require `connections:read`; a project token reads only its own project's usage and needs `--project` or a project-bound profile. `usage gates` needs a team API key, because gate state covers the whole team. ```shell polymorfa usage summary -polymorfa usage summary --period 2026-09 --session support +polymorfa usage summary --period 2026-09 --connection support polymorfa usage records --call 3EB0C431C26A1916E07A -polymorfa usage records --session support --meter call.duration --limit 50 -polymorfa usage records --session support --cursor -polymorfa usage gates --session support +polymorfa usage records --connection support --meter call.duration --limit 50 +polymorfa usage records --connection support --cursor +polymorfa usage gates --connection support ``` -`usage summary` totals one calendar month (UTC) by meter and by number, and -defaults to the current month; without `--project`, each number row also shows +`usage summary` totals one calendar month (UTC) by meter and by connection, and +defaults to the current month; without `--project`, each Connection row also shows its project. `usage records` lists records newest first with each record's project, and prints the cursor for the next page. `usage gates` shows each gate's mode, limit, usage this month and how often an action went over the limit in the last 30 days: in `record` mode nothing is refused, and in `enforce` mode an action over the limit exits with code 4 (`gate_limit_reached`). -## Session call rejection and stable identities +## Connection call rejection and stable identities -`call reject` is a separate command for the Linked Device session route. It -rejects an incoming call by session, call ID, and caller ID. Use +`call reject` is a separate command for the Linked Device connection route. It +rejects an incoming call by connection, call ID, and caller ID. Use `calls reject` for the unified Calls API. Three focused Linked Device commands -cover the exact session call rejection, LIDs, and Users source tags: +cover the exact connection call rejection, LIDs, and Users source tags: ```shell polymorfa call reject call_123 \ - --session session_123 \ + --connection session_123 \ --from 750000000001 \ --idempotency-key reject_call_123 polymorfa identity resolve \ - --session session_123 \ + --connection session_123 \ --phone-number +15551234567 polymorfa identity resolve \ - --session session_123 \ + --connection session_123 \ --username alice \ --username-key 1234 -polymorfa user security-code 750000000001 --session session_123 +polymorfa user security-code 750000000001 --connection session_123 ``` -All three require a server API key and an active Linked Device session. Call +All three require a server API key and an active Linked Device connection. Call rejection requires the incoming call ID and caller's Polymorfa ID; it is not call accept, placement, history, or streaming. Identity resolution accepts exactly one phone number, decimal Polymorfa user ID, or username. A username @@ -1571,20 +1575,20 @@ history/refresh, or verification-submit operation. ## Business App The complete Linked Device Business App surface requires a server API key and -an active connected session. Its resource tree keeps the account's own profile, +an active connected connection. Its resource tree keeps the account's own profile, catalog, products, collections, orders, compliance, and linked-account state separate: ```shell -polymorfa business profile view --session session_123 -polymorfa business catalog view --session session_123 --id 750000000001 +polymorfa business profile view --connection session_123 +polymorfa business catalog view --connection session_123 --id 750000000001 polymorfa business product view product_123 \ - --session session_123 \ + --connection session_123 \ --id 750000000001 -polymorfa business collection list --session session_123 --id 750000000001 -polymorfa business compliance view --session session_123 -polymorfa business accounts view --session session_123 -polymorfa business eligibility view --session session_123 +polymorfa business collection list --connection session_123 --id 750000000001 +polymorfa business compliance view --connection session_123 +polymorfa business accounts view --connection session_123 +polymorfa business eligibility view --connection session_123 ``` Structurally rich mutations accept one bounded JSON document from a file or @@ -1592,19 +1596,19 @@ standard input, matching the `gh api --input` convention: ```shell polymorfa business profile update \ - --session session_123 \ + --connection session_123 \ --input profile-update.json polymorfa business product create \ - --session session_123 \ + --connection session_123 \ --input product.json polymorfa business product replace product_123 \ - --session session_123 \ + --connection session_123 \ --input product-replacement.json polymorfa business compliance replace \ - --session session_123 \ + --connection session_123 \ --input compliance.json ``` @@ -1627,7 +1631,7 @@ pagination. A single collection accepts an `--after` cursor but its response has no next cursor. Order lookup requires the exact event token and is not an order-history command. The source exposes no catalog-independent list, product or collection search/history, binary upload, resumability, or Business App -support for project credentials, client tokens, or Cloud API sessions. +support for project credentials, client tokens, or Cloud API connections. ## BanSafe @@ -1653,7 +1657,7 @@ polymorfa bansafe finding list --project project_123 --status open polymorfa bansafe enforcement list --project project_123 polymorfa bansafe incident list --project project_123 polymorfa bansafe incident report \ - --session session_123 \ + --connection session_123 \ --idempotency-key customer-incident-123 polymorfa bansafe incident retract incident_123 \ --idempotency-key retract-incident-123 @@ -1702,27 +1706,27 @@ polymorfa key list polymorfa key revoke key_123 --yes --idempotency-key revoke_key_123 polymorfa member list polymorfa audit-log list --action key.revoked --resource api-key --limit 100 -polymorfa session-ban list --active +polymorfa connection-ban list --active polymorfa security-incident list polymorfa security-incident acknowledge incident_123 polymorfa project-token list --project project_123 polymorfa widget view --project project_123 polymorfa widget update --project project_123 --input widget-patch.json -polymorfa session stop session_1 session_2 --project project_123 -polymorfa session delete session_1 session_2 --project project_123 --yes -polymorfa session capabilities support-line +polymorfa connection stop session_1 session_2 --project project_123 +polymorfa connection delete session_1 session_2 --project project_123 --yes +polymorfa connection capabilities support-line ``` -`session capabilities` shows the WhatsApp configuration gates and limits for -one number, as of its last configuration sync. An enabled gate does not prove +`connection capabilities` shows the WhatsApp configuration gates and limits for +one Connection, as of its last configuration sync. An enabled gate does not prove that the feature is usable in a particular client or environment, or that WhatsApp will accept an operation. Each line is the capability key, its value (`enabled`, `off`, a limit, or `unknown`), and its source: `server` (WhatsApp sent the setting), `client_default` (WhatsApp sent none, so its default applies) or `account_type` (the capability does not apply to this kind of account, for example a business-only feature on a -personal number). Before the number's first sync every value is `unknown`. -It is a beta: the team must be enrolled, and it needs `sessions:read`. +personal account). Before the Connection's first sync every value is `unknown`. +It is a beta: the team must be enrolled, and it needs `connections:read`. Key and project-token lists contain metadata only; neither command returns raw bearer material. The API's reported API-key scope mask is retained in JSON but @@ -1736,7 +1740,7 @@ These list operations return complete arrays and expose no cursor. Project-token listing requires one explicit project ID. Follow asynchronous work with the `operation` commands described in [Operations](#operations). -Member invite, role update, and removal remain dashboard-session routes and are +Member invite, role update, and removal remain dashboard-connection routes and are not exposed through server-key commands. The API also exposes no compatible API-key creation, token mint/revoke, incident detail, or cross-project token aggregate in this typed slice. The raw API command is not a credential-boundary @@ -1765,7 +1769,7 @@ phone-change policy. } ``` -Session stop and delete accept 1 through 100 unique UUIDs or stable slugs. The +Connection stop and delete accept 1 through 100 unique UUIDs or stable slugs. The CLI trims IDs and rejects duplicates or oversized batches before transport. Returned counts are matching rows, not the number requested. Stop only requests asynchronous work and does not wait for completion. Delete synchronously removes @@ -1848,7 +1852,7 @@ failed recipients rather than returning the first result. #### Receipt-timed follow-ups (beta) Add `followUp` to the `campaign create` input to send each recipient one more -message from the number that sent the first one: +message from the Connection that sent the first one: ```json { @@ -1891,7 +1895,7 @@ access gets `403 feature_unavailable`. For Messaging campaign creation, use weights add up to 100) and a `blueprint`. Each recipient receives one alternative and keeps it across retries. Every alternative must use the same `{{variable}}` placeholders. Alternatives send only from linked-device - numbers and cannot be combined with `templateId`, composed messages or an + connections and cannot be combined with `templateId`, composed messages or an A/B test. ```json @@ -1961,7 +1965,7 @@ polymorfa campaign recipients list campaign_123 \ One append accepts at most 1,000 entries. `--csv` reads the file locally and sends the rows inline; it does not upload the file. Blank rows are ignored, but a row with other values and an empty phone cell stops the command before -anything is sent, naming the row numbers (the header is row 1). `--input` +anything is sent, naming the row connections (the header is row 1). `--input` entries with an empty phone, and any phone longer than 64 characters, are refused the same way, as is an empty `--input` array, because the API would reject the whole request. JSON variables must use valid names and string values; @@ -2118,17 +2122,17 @@ polymorfa webhook delivery attempt list delivery_123 \ `--phone-offline-start-day` on `webhook create` and `webhook update` sets the first day without the phone, from `7` to `13`, on which the webhook receives -`session.phone_offline`. The API default is `10`. `off` removes that event from +`connection.phone_offline`. The API default is `10`. `off` removes that event from the webhook's event types; `webhook update` reads the saved event types when `--input` has none, and refuses `off` when it would leave no event. `webhook update` accepts the flag without `--input`. See [Phone offline warnings](https://docs.polymorfa.com/api/webhooks#phone-offline-warnings). `webhook test` requires `--event`. Team tests accept that event type only. -Project tests can also read a JSON object with `body` and `sessionId` from +Project tests can also read a JSON object with `body` and `connectionId` from `--input`; supply both fields together. The CLI rejects a team body or an incomplete project body before requesting a delivery. The `body` must be an -exact base64-encoded native event for an HMS-enabled Number in the same +exact base64-encoded native event for an HMS-enabled Connection in the same project. See the [webhook guide](https://docs.polymorfa.com/api/webhooks#send-a-test-delivery). Webhook creation and secret rotation return a signing secret once. JSON and @@ -2234,7 +2238,7 @@ more requests are waiting, and waits for `Retry-After` when the read limit of `--max-events` stops after a fixed number. Ctrl-C stops with exit code 0. Filters: `--status` (codes or classes), `--method`, `--route` (exact pattern -such as `/messaging/:session/messages`), `--source api|mcp`, `--credential` +such as `/messaging/:connection/messages`), `--source api|mcp`, `--credential` (key or token ID), `--request-id` and `--trace-id`. Send a `traceparent` header with your API requests to find them by your own trace ID. @@ -2274,12 +2278,12 @@ require `--forward-secret-out`; the per-run secret is not printed to stdout. ## Trigger test events -`polymorfa trigger` sends a signed test event for a Test number. The event +`polymorfa trigger` sends a signed test event for a Test Connection. The event reaches your webhooks, event history, and a running `polymorfa listen` with -`source: "test"`, and does not change the Test number. Real numbers are +`source: "test"`, and does not change the Test Connection. Real connections are refused. Each project can trigger 30 test events per minute. It requires a server API key with `sandbox:write` (`sandbox:read` for `--list`) and Test -numbers access. +connections access. Run a listener in one terminal: @@ -2291,15 +2295,15 @@ Trigger events in another: ```shell polymorfa trigger --list -polymorfa trigger message.received --session my-test-number --text "hi" -polymorfa trigger message.received --session my-test-number \ +polymorfa trigger message.received --connection my-test-connection --text "hi" +polymorfa trigger message.received --connection my-test-connection \ --override mediaType=image --override caption=look -polymorfa trigger message.ack --session my-test-number --override ackStatus=read -polymorfa trigger message.failed --session my-test-number -polymorfa trigger call.received --project PROJECT_ID --session my-test-number --override video=true -polymorfa trigger session.restriction_updated --project PROJECT_ID --session my-test-number \ +polymorfa trigger message.ack --connection my-test-connection --override ackStatus=read +polymorfa trigger message.failed --connection my-test-connection +polymorfa trigger call.received --project PROJECT_ID --connection my-test-connection --override video=true +polymorfa trigger connection.restriction_updated --project PROJECT_ID --connection my-test-connection \ --override restrictionActive=false -polymorfa trigger template.status --project PROJECT_ID --session my-test-number \ +polymorfa trigger template.status --project PROJECT_ID --connection my-test-connection \ --override templateStatus=REJECTED --override reason=INVALID_FORMAT ``` @@ -2309,13 +2313,13 @@ the same line (`message.received `) when the event arrives; with with `--forward-secret-out ` (JSON forwarding requires the secret file), which writes one JSON line per event. Fixtures are `message.received`, `message.ack`, `message.failed`, `call.received`, -`call.missed`, `call.ended`, `session.status`, `session.restriction_updated`, +`call.missed`, `call.ended`, `connection.status`, `connection.restriction_updated`, and `template.status`. `--override key=value` sets one payload field and can be repeated; `--text` and `--from` are shortcuts. `video` and `restrictionActive` accept only `true` or `false`; `durationSeconds` accepts a whole number. Set `restrictionActive=false` to -test the end of a restriction. `--from-number OTHER_TEST_NUMBER` sends a real simulated text from -another Test number in the project instead, producing an ordinary +test the end of a restriction. `--from-connection OTHER_TEST_NUMBER` sends a real simulated text from +another Test Connection in the project instead, producing an ordinary `message.received` event you can reply to. Use `--json` for one JSON document. ## Local MCP tools @@ -2336,10 +2340,10 @@ They do not create detached daemons. MCP responses contain listener IDs, status, and safe counters, never primary credentials, listener credentials, forwarding secrets, or unrestricted payloads. -`polymorfa_session_list` is a read-only discovery tool for one explicit project -UUID. It uses the selected CLI organization API key with `sessions:read` and -returns session ID, name, stored status, and test-mode flag. It omits phone -numbers, credentials, and message data. The tool does not probe the live device. +`polymorfa_connection_list` is a read-only discovery tool for one explicit project +UUID. It uses the selected CLI organization API key with `connections:read` and +returns connection ID, name, stored status, and test-mode flag. It omits phone +connections, credentials, and message data. The tool does not probe the live device. Project tokens and Messaging client tokens cannot use this tool. A failed read returns a generic error without exposing the credential or API response body. @@ -2470,7 +2474,7 @@ log link, and the documentation link for the error code when the API returned them: ```text -Error: WhatsApp is limiting requests from this number. Follow Retry-After when supplied. +Error: WhatsApp is limiting requests from this Connection. Follow Retry-After when supplied. Request ID: 5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30 Request log: https://www.polymorfa.com/console/acme/support-bot/logs/api?request_id=5f0c2a8e-3b1d-4c6f-9e2a-7d4b1c8f6a30 Docs: https://docs.polymorfa.com/api/errors#whatsapp-rate-limited @@ -2497,43 +2501,43 @@ The verification gate checks formatting, lint, strict TypeScript, tests, production build, npm package contents, and the production dependency audit on Node.js 22 in hosted CI. -### Test-number account modes +### Test Connection account modes The Business commands follow API source `14153ad9d69ddd3bae972594e6b3dc3ddae8e8e4`. `contracts/business-account-modes.json` binds the actual API producer input. This source support does not establish hosted availability or a package release. -A 409 from `testing account-mode` means the Test number is claimed in Inspector or another mode change is pending. +A 409 from `testing account-mode` means the Test Connection is claimed in Inspector or another mode change is pending. The CLI validates this contract and uses the installed SDK's public transport; it does not assume that the registry SDK exports the new typed operation. ```sh polymorfa quicklink create --project PROJECT_UUID --account-type business_app --primary-platform ios -polymorfa testing account-mode TEST_SESSION --account-type meta_cloud --yes --json +polymorfa testing account-mode TEST_CONNECTION --account-type meta_cloud --yes --json ``` The modes are `whatsapp_app`, `business_app`, `meta_cloud` and `meta_coexistence`. Phone modes accept `android` or `ios`. Omit `--primary-platform` for `meta_cloud`. Legacy `personal` and `business` mode names are rejected. A mode change unlinks companions; they must pair again. `--yes` confirms that effect. The operation -requires a server credential and applies only to Test numbers. It never converts -a real WhatsApp account. The API enforces Number, membership and session checks. +requires a server credential and applies only to Test connections. It never converts +a real WhatsApp account. The API enforces Connection, membership and connection checks. QuickLink flags preserve other nested testing configuration. Conflicting input fields fail before a request. `contact business-profile` preserves the optional `encryption` value (`end_to_end`, `hybrid` or `not_end_to_end`) in JSON and plain output. An omitted field stays omitted. -### Guided session creation and configuration +### Guided connection creation and configuration -Create real or simulated sessions with `polymorfa quicklink create --project --input request.json`. +Create real or simulated connections with `polymorfa quicklink create --project --input request.json`. The request accepts `configuration` for connection, phone, history and test simulation. Page copy, appearance, legal links and callbacks belong in saved widget settings. Free-tier real accounts must pair inside the authenticated Console. -Session configuration uses Platform authority and requires a server API key. +Connection configuration uses Platform authority and requires a server API key. Updates reject unknown fields, invalid nested values, and fields listed in both `set` and `reset` before sending a request. Include at least one of `set` or `reset`; the API enforces permissions, consent, and storage eligibility. -Inspect configuration with `polymorfa session configuration get `. -Update it with `polymorfa session configuration update --input update.json`: +Inspect configuration with `polymorfa connection configuration get `. +Update it with `polymorfa connection configuration update --input update.json`: ```json { @@ -2547,7 +2551,7 @@ Update it with `polymorfa session configuration update --input update. Use the revision from the preceding read. Reset removes an override so future defaults continue to apply. A saved update can remain pending until the runtime acknowledges it. -The CLI does not offer direct session creation; QuickLinks preserve onboarding authority. +The CLI does not offer direct connection creation; QuickLinks preserve onboarding authority. Upload simulated history separately from configuration, then use the returned fixture ID in `configuration.testing.configuration.historyFixtureId`: @@ -2558,7 +2562,7 @@ polymorfa testing history-fixture create --project PROJECT_ID --input history.js The file contains `messages`, with up to 100 entries specifying `id`, `senderPhone`, `text`, `timestamp` (Unix seconds), and `fromMe`. Senders must be -existing simulated numbers in the selected project. This command does not enable +existing simulated connections in the selected project. This command does not enable hosted message storage. ## Prepaid billing responses @@ -2573,48 +2577,48 @@ server error. Add credit or resolve the billing restriction in the Console befor retrying. HTTP 409 from an expired tier quote also requires reviewing a new quote; the CLI never creates or confirms a replacement purchase automatically. -### Number tier changes +### Connection tier changes Tier changes use an organization API key. Quote first, review the credit charge and effective time, then confirm that exact quote: ```shell -polymorfa session tier quote support --tier pro -polymorfa session tier confirm support --quote QUOTE_UUID --yes -polymorfa session tier status support QUOTE_UUID +polymorfa connection tier quote support --tier pro +polymorfa connection tier confirm support --quote QUOTE_UUID --yes +polymorfa connection tier status support QUOTE_UUID ``` `--tier inherit` restores the project default tier. A quote does not change the -Number or spend credit. `confirm` requires `--yes` and accepts +Connection or spend credit. `confirm` requires `--yes` and accepts `--idempotency-key`; it never creates a replacement quote. Read `status` until the change is applied or rejected. -A Hybrid Link Number leaving Pro needs a choice. Without one, the quote fails +A Hybrid Link Connection leaving Pro needs a choice. Without one, the quote fails with `hybrid_choice_required` (exit code 4) and the CLI names the flags to add. This includes `--tier inherit` when the project default lacks Hybrid Link. ```shell # Keep one connection; the other is disconnected when Pro ends. -polymorfa session tier quote support --tier standard --keep linked_devices -# Split into two Standard Numbers. This Number keeps the Official API; Linked -# Devices moves to a new Number named support-linked without re-pairing. -polymorfa session tier quote support --tier standard --split --stay official_api --new-number-name support-linked +polymorfa connection tier quote support --tier standard --keep linked_devices +# Split into two Standard Connections. This Connection keeps the Official API; Linked +# Devices moves to a new Connection named support-linked without re-pairing. +polymorfa connection tier quote support --tier standard --split --stay official_api --new-connection-name support-linked ``` The choice runs when the paid Pro window ends. A queued change that is rejected because no choice is recorded shows `rejected (hybrid_choice_required)` in -`session tier status`; quote again with a choice. To merge two Numbers that are the -same WhatsApp Business number into one Hybrid Link Number, list the pairs, then -quote Pro on the Number that keeps its ID: +`connection tier status`; quote again with a choice. To merge two Connections that are the +same WhatsApp Business number into one Hybrid Link Connection, list the pairs, then +quote Pro on the Connection that keeps its ID: ```shell -polymorfa session hybrid-merge-candidates --project PROJECT_UUID -polymorfa session tier quote KEEP_UUID --tier pro --merge-with OTHER_UUID +polymorfa connection hybrid-merge-candidates --project PROJECT_UUID +polymorfa connection tier quote KEEP_UUID --tier pro --merge-with OTHER_UUID ``` -`hybrid-merge-candidates` marks each Number "can be absorbed" or "must be -kept". A Number that uses hosted message storage must be kept, so quote the -merge on it and pass the other Number to `--merge-with`; the output prints that +`hybrid-merge-candidates` marks each Connection "can be absorbed" or "must be +kept". A Connection that uses hosted message storage must be kept, so quote the +merge on it and pass the other Connection to `--merge-with`; the output prints that command for eligible pairs. An ineligible pair shows its reason, such as `pairing_in_progress`, `transition_in_progress` or `hms_enabled`. Listing candidates requires Hybrid Link access; without it the command exits with code 3 @@ -2624,9 +2628,9 @@ candidates requires Hybrid Link access; without it the command exits with code 3 combinations exit with code 2 before any request. The quote, confirm and status output shows the Hybrid Link plan and its status (`scheduled`, `running`, `completed`, `failed` or `cancelled`) separately from the tier change, plus the -new Number ID after a split. When the output says action is required, disconnect +new Connection ID after a split. When the output says action is required, disconnect the Official API in the WhatsApp Business app under Settings > Account > -Business Platform > Disconnect Account. An ineligible Number or pair fails with +Business Platform > Disconnect Account. An ineligible Connection or pair fails with `hybrid_transition_ineligible` (exit code 4) and the API's reason in the message. Merging requires Hybrid Link access, which the API enforces. @@ -2645,23 +2649,23 @@ versions fail without an automatic upgrade or resend. These commands require API-authorized private-preview access. An installed CLI or a transport flag does not enable Hybrid Link. Use a team API key or project token through `POLYMORFA_PROJECT_TOKEN` or a project-token profile. Project tokens -can control only their project and its Numbers; team routing policies require a +can control only their project and its Connections; team routing policies require a team API key. Browser client tokens cannot control Hybrid Link or send through it. ```bash -polymorfa quicklink availability --project PROJECT_UUID --session NUMBER +polymorfa quicklink availability --project PROJECT_UUID --connection CONNECTION polymorfa quicklink create --project PROJECT_UUID --connection-goal hybrid -polymorfa quicklink create --project PROJECT_UUID --purpose add_connection --session NUMBER --add-connection linked_devices -polymorfa message send text --session NUMBER --to +14155550123 --body Hello --transport official_api -polymorfa message operation-status OPERATION_UUID --session NUMBER -polymorfa routing-policy get --scope session --project PROJECT_UUID --session NUMBER -polymorfa routing-policy set --scope session --project PROJECT_UUID --session NUMBER --expected-revision REVISION --prefer linked_devices --allow linked_devices --allow official_api -polymorfa hybrid-link state --session NUMBER -polymorfa hybrid-link pause --session NUMBER --expected-revision REVISION -polymorfa hybrid-link resume --session NUMBER --expected-revision REVISION +polymorfa quicklink create --project PROJECT_UUID --purpose add_method --connection CONNECTION --add-method linked_devices +polymorfa message send text --connection CONNECTION --to +14155550123 --body Hello --transport official_api +polymorfa message operation-status OPERATION_UUID --connection CONNECTION +polymorfa routing-policy get --scope connection --project PROJECT_UUID --connection CONNECTION +polymorfa routing-policy set --scope connection --project PROJECT_UUID --connection CONNECTION --expected-revision REVISION --prefer linked_devices --allow linked_devices --allow official_api +polymorfa hybrid-link state --connection CONNECTION +polymorfa hybrid-link pause --connection CONNECTION --expected-revision REVISION +polymorfa hybrid-link resume --connection CONNECTION --expected-revision REVISION ``` -For project and session routing scopes, `--project`, the nearest linked project, +For project and connection routing scopes, `--project`, the nearest linked project, and the selected profile determine the project in that order. A project-token profile fails when its project differs from the linked directory. Team routing scope uses an organization API key and ignores directory project links. `quicklink @@ -2721,35 +2725,35 @@ Function, deployment, secret and invocation lists accept `--limit 1..100` and `- `calls react CALL --connection-id CONNECTION --emoji '👍'` sends a reaction; `--clear` clears it. `calls hand CALL --connection-id CONNECTION --raised` -raises the Number's hand; omit `--raised` to lower it. A server credential may +raises the Connection's hand; omit `--raised` to lower it. A server credential may name `--participant`; a client token acts as its own participant. The named connection must still be attached to the call. Reactions are transient and are never retried automatically. Hand state is -shared by the Number's clients. +shared by the Connection's clients. ### Call links ```sh -polymorfa calls link create --session support -polymorfa calls link create --session support --video --json -printf '%s' "$CALL_LINK" | polymorfa calls link preview --session support +polymorfa calls link create --connection support +polymorfa calls link create --connection support --video --json +printf '%s' "$CALL_LINK" | polymorfa calls link preview --connection support ``` -`calls link create` creates a WhatsApp call link from a Linked Device Number +`calls link create` creates a WhatsApp call link from a Linked Device Connection and prints its URL. It does not place or join a call. The request is never retried; if the outcome is unknown, check before creating another link. Anyone with the link can use it in WhatsApp, so keep it private. `calls link preview` reads a link without joining the call and prints its creator, whether joining needs approval, and whether WhatsApp reports the -Number as a link administrator. It reads the link, or its bare token, from +Connection as a link administrator. It reads the link, or its bare token, from standard input, so the token stays out of shell history and process listings. A full link sets voice or video; pass `--video` with a bare video-link token. Both commands require a server API key or project token, a Linked Device -Number, and calling enabled for that Number. Client tokens are refused before -a request is sent, and Cloud API-only Numbers are refused by the API. +Connection, and calling enabled for that Connection. Client tokens are refused before +a request is sent, and Cloud API-only Connections are refused by the API. ### Stored call records @@ -2760,7 +2764,7 @@ polymorfa calls view CALL_ID --json ``` `calls list` reads one page through the existing Calls records API. Reuse the -same filters when following a cursor. These reads need `sessions:read` and a +same filters when following a cursor. These reads need `connections:read` and a server credential. Project tokens only read calls originally owned by their project. Human output labels unmeasured duration as `unknown`. @@ -2780,13 +2784,13 @@ polymorfa billing priority list --json Changes require `billing:manage` and Pay-As-You-Go. Supply the observed revision: ```bash -polymorfa billing limits set --scope number --credits 1000 --expected-revision 0 +polymorfa billing limits set --scope connection --credits 1000 --expected-revision 0 polymorfa billing limits set --scope project --unlimited --expected-revision 1 -polymorfa billing priority set --scope number --priority 10 --expected-revision 0 -polymorfa billing priority reorder --scope number --project --ids , --expected-revision 1 +polymorfa billing priority set --scope connection --priority 10 --expected-revision 0 +polymorfa billing priority reorder --scope connection --project --ids , --expected-revision 1 ``` -A reorder includes every active project, customer or real number in the selected +A reorder includes every active project, customer or real Connection in the selected project, highest first. A stale or incomplete order fails without partial changes. Monthly limits reset at 00:00 UTC on the first day; zero blocks new charges and null removes the limit. Existing paid service keeps its window. @@ -2805,25 +2809,25 @@ polymorfa quicklink create --project --limit-credits 250 --priori ``` The combined save is atomic and requires both observed revisions. Project -priority wins first. Numbers inherit customer priority; a higher number -priority overrides it within the project. A customer's assigned numbers share -its monthly cap. Creation controls apply to a real new -number before pairing admission; testing and supplementary connections reject +priority wins first. Connections inherit customer priority; a higher Connection +priority overrides it within the project. A customer's assigned connections share +its monthly cap. Creation controls apply to a new real +Connection before pairing admission; testing and adding a method rejects these fields. Omit them to keep the default unlimited cap and priority zero. -Read one project's funding controls and save its combined customer and number +Read one project's funding controls and save its combined customer and Connection order: ```bash polymorfa billing priority list --project -polymorfa billing priority reorder --scope resource --project --ids number:,customer: --expected-revision 5 +polymorfa billing priority reorder --scope resource --project --ids connection:,customer: --expected-revision 5 ``` -Include every active customer and real number, highest priority first. For +Include every active customer and real Connection, highest priority first. For thousands of resources, put the complete order in a JSON file: ```json -["number:", "customer:"] +["connection:", "customer:"] ``` ```bash @@ -2834,13 +2838,13 @@ Use either `--ids` or `--ids-file`. Funding order never bypasses a spending cap. ### WhatsApp Analytics -Read message and call outcomes, response times, number activity and connection -vitals with a credential carrying `sessions:read`. Enable Analytics in the +Read message and call outcomes, response times, Connection activity and connection +vitals with a credential carrying `connections:read`. Enable Analytics in the Console to collect business data. Project credentials stay within their project. ```bash polymorfa analytics get --project PROJECT_UUID --json -polymorfa analytics get --project PROJECT_UUID --session-id NUMBER_UUID --since 2026-10-01T00:00:00Z --until 2026-10-03T00:00:00Z --json +polymorfa analytics get --project PROJECT_UUID --connection-id CONNECTION_UUID --since 2026-10-01T00:00:00Z --until 2026-10-03T00:00:00Z --json polymorfa analytics metrics --project PROJECT_UUID --window-hours 24 > analytics.prom polymorfa analytics metrics --project PROJECT_UUID --segments --format openmetrics ``` diff --git a/contracts/abprops-capabilities.json b/contracts/abprops-capabilities.json index c3055b60..0bd433f3 100644 --- a/contracts/abprops-capabilities.json +++ b/contracts/abprops-capabilities.json @@ -1,13 +1,13 @@ { "repository": "polymorfa/polymorfa", - "sourceCommit": "2f9efad933b3a7a455f73245a566c827ac004608", + "sourceCommit": "8354399b827d9127210b9759cd055586e967449e", "sourcePath": "apps/api/docs/openapi.json", - "sourceSha256": "53b2c76e344052152b3fc627a478adcd79130b7876d528aac8056b13e555b127", + "sourceSha256": "e84c7ff814c6b59ca7f32c3fda1aedbed3f672e728910adb883f0aa8c6cf3ab7", "published": false, - "scope": "Group capability read and canonical session capability webhook only. Other SDK contracts retain their recorded source revisions.", + "scope": "Group capability read and current Connection capability webhook. Candidate source, unavailable until matching API acceptance and SDK publication.", "openapi": "3.0.3", "paths": { - "/messaging/{session}/groups/{id}/capabilities": { + "/messaging/{connection}/groups/{id}/capabilities": { "get": { "operationId": "getGroupCapabilities", "tags": ["Groups"], @@ -24,7 +24,7 @@ "type": "string" }, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -39,7 +39,7 @@ ], "responses": { "200": { - "description": "Account-bound stored group capabilities. Unknown until successful number and group syncs for the linked account. Requires current group membership and the enrolled number-capabilities beta.", + "description": "Account-bound stored group capabilities. Unknown until successful connection and group syncs for the linked account. Requires current group membership and the enrolled connection-capabilities beta.", "content": { "application/json": { "schema": { @@ -252,9 +252,6 @@ } } }, - "x-mint": { - "content": "Linked Device API groups:read" - }, "x-protocols": ["Linked Device API"], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `groups:read`" } @@ -344,6 +341,7 @@ "invalid_request_error", "authentication_error", "permission_error", + "billing_error", "conflict_error", "rate_limit_error", "api_error", @@ -353,11 +351,16 @@ "code": { "type": "string", "enum": [ + "zero_knowledge_connection", "invalid_parameter", "invalid_credential", "entitlement_required", "cloud_template_authority_restricted", "gate_limit_reached", + "billing_credit_required", + "addon_required", + "safe_mode_not_entitled", + "warmup_plan_not_entitled", "method_not_allowed", "permission_denied", "missing_scope", @@ -370,17 +373,21 @@ "stream_cursor_expired", "stream_connection_limit_reached", "state_conflict", + "team_deletion_scheduled", "hybrid_routing_paused", "hybrid_choice_required", "hybrid_transition_ineligible", "hybrid_automation_unavailable", + "hybrid_group_linked_devices_unavailable", "hybrid_transport_unavailable", "hybrid_target_reference_unavailable", "send_outcome_unknown", + "terms_acceptance_required", + "terms_activation_blocked", "idempotency_conflict", "idempotency_in_progress", - "idempotency_completed", "idempotency_outcome_unknown", + "idempotency_replay_unavailable", "call_claimed", "call_not_ringing", "connection_limit", @@ -395,7 +402,7 @@ "order_status_transition_invalid", "order_cancellation_failed", "call_opt_out_limit", - "number_restricted", + "connection_restricted", "sip_trunk_in_use", "sip_trunk_revision_conflict", "sip_trunk_limit", @@ -413,16 +420,21 @@ "upstream_failure", "service_unavailable", "credential_verification_unavailable", - "session_not_ready", + "connection_not_ready", "command_dispatch_failed", "result_unknown", + "parent_bsuid_not_supported", "recipient_not_on_whatsapp", "conversation_window_closed", "template_not_approved", "media_too_large", "whatsapp_rate_limited", "new_chat_limit_reached", + "marketing_disabled_on_cloud_api", "whatsapp_account_restricted", + "whatsapp_authorization_required", + "whatsapp_payment_method_required", + "whatsapp_number_not_registered", "whatsapp_groups_ineligible", "whatsapp_group_creation_paused", "whatsapp_group_limit_reached", @@ -430,7 +442,7 @@ "whatsapp_group_suspended", "whatsapp_group_has_no_participants", "bansafe_suspended", - "bansafe_org_suspended", + "bansafe_team_suspended", "bansafe_cold_blocked", "bansafe_cold_held", "bansafe_throttled", @@ -458,7 +470,7 @@ "request_log_url": { "type": "string", "format": "uri", - "description": "Console page that shows this request. Returned only to organization and project credentials whose request was logged." + "description": "Console page that shows this request. Returned only to team and project credentials whose request was logged." } }, "required": ["type", "code", "message", "param", "request_id"] @@ -476,40 +488,43 @@ }, "required": ["error", "data", "docs"] }, - "SessionCapabilitiesUpdatedEvent": { + "ConnectionCapabilitiesUpdatedEvent": { "type": "object", "properties": { "id": { "type": "string", - "description": "Unique event identifier" + "description": "Unique event identifier", + "example": "0190f2a4-6c1e-7b9d-9f3a-2e8c4d5b6a71" }, - "session": { + "connection": { "type": "string", - "description": "Session that produced this event" + "description": "Connection that produced this event", + "example": "739182640518203" }, "externalId": { "type": "string", - "description": "Integrator reference from the QuickLink that created this session. Included on session lifecycle events when supplied." + "description": "Integrator reference from the QuickLink that created this connection. Included on connection lifecycle events when supplied." }, "timestamp": { "type": "string", - "description": "ISO 8601 timestamp" + "description": "ISO 8601 timestamp", + "example": "2026-10-19T14:03:22.000Z" }, "event": { "type": "string", - "enum": ["session.capabilities_updated"], + "enum": ["connection.capabilities_updated"], "description": "Event type" }, "payload": { - "$ref": "#/components/schemas/SessionCapabilitiesUpdatedPayload" + "$ref": "#/components/schemas/ConnectionCapabilitiesUpdatedPayload" } }, - "required": ["id", "session", "timestamp", "event", "payload"] + "required": ["id", "connection", "timestamp", "event", "payload"] }, - "SessionCapabilitiesUpdatedPayload": { + "ConnectionCapabilitiesUpdatedPayload": { "type": "object", "properties": { - "session": { + "connection": { "type": "string", "maxLength": 256 }, @@ -588,7 +603,7 @@ } }, "required": [ - "session", + "connection", "projectId", "status", "syncedAt", @@ -599,6 +614,29 @@ ], "additionalProperties": false } + }, + "headers": { + "X-RateLimit-Limit": { + "description": "Team request quota per rolling minute, when the per-team request limiter applies.", + "schema": { + "type": "integer", + "minimum": 1 + } + }, + "X-RateLimit-Remaining": { + "description": "Requests left in the per-team quota; zero when this limiter rejects the request.", + "schema": { + "type": "integer", + "minimum": 0 + } + }, + "X-RateLimit-Reset": { + "description": "Unix timestamp in seconds when the oldest counted request leaves the rolling window, when the per-team request limiter applies. Follow Retry-After on a rejected request.", + "schema": { + "type": "integer", + "minimum": 0 + } + } } }, "family": "messaging" diff --git a/contracts/business-account-modes.json b/contracts/business-account-modes.json index 1c836bc8..86ebdcdc 100644 --- a/contracts/business-account-modes.json +++ b/contracts/business-account-modes.json @@ -1,13 +1,13 @@ { "repository": "polymorfa/polymorfa", - "commit": "14153ad9d69ddd3bae972594e6b3dc3ddae8e8e4", + "commit": "8354399b827d9127210b9759cd055586e967449e", "releaseStatus": "source-only", "sources": { "messaging": { "sourcePath": "apps/api/docs/openapi.json", - "sourceSha256": "44a2cc304483d7cd4e12974b8f31df92a3b7880d21152aa70af0a50948b40cb1", + "sourceSha256": "e84c7ff814c6b59ca7f32c3fda1aedbed3f672e728910adb883f0aa8c6cf3ab7", "paths": { - "/messaging/{session}/contacts/{contactId}/business-profile": { + "/messaging/{connection}/contacts/{contactId}/business-profile": { "get": { "operationId": "getBusinessProfile", "tags": ["Contacts"], @@ -18,7 +18,7 @@ { "schema": {"type": "string"}, "required": true, - "name": "session", + "name": "connection", "in": "path" }, { @@ -201,9 +201,6 @@ } } }, - "x-mint": { - "content": "Linked Device API contacts:read" - }, "x-protocols": ["Linked Device API"], "description": "**Protocols:** Linked Device API\n\n**Required scope:** `contacts:read`" } @@ -213,7 +210,7 @@ "operationId": "createQuickLink", "tags": ["QuickLink"], "summary": "Create a QuickLink", - "description": "**Required scope:** `quicklink:manage`\n\nCreates a persistent hosted link that connects one WhatsApp number to a new session in the project.", + "description": "**Required scope:** `quicklink:manage`\n\nCreates a persistent hosted link that connects one WhatsApp number to a new connection in the project.", "security": [{"BearerAuth": []}], "x-required-scope": "quicklink:manage", "requestBody": { @@ -395,19 +392,16 @@ } } } - }, - "x-mint": { - "content": "quicklink:manage" } } }, - "/messaging/{session}/phone/account-mode": { + "/messaging/{connection}/phone/account-mode": { "put": { "operationId": "setTestingAccountMode", "tags": ["Testing"], "security": [{"BearerAuth": []}], - "summary": "Change a Test number's account type or phone platform", - "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sandbox:write`\n\nChanges how the Test number presents itself. A change unlinks every companion, including the Number's own session, so each must pair again. Repeating the current mode changes nothing.", + "summary": "Change a Test connection's account type or phone platform", + "description": "**Protocols:** Linked Device API\n\n**Required scope:** `sandbox:write`\n\nChanges how the Test connection presents itself. A change unlinks every companion, including the Connection's own connection, so each must pair again. Repeating the current mode changes nothing.", "x-required-scope": "sandbox:write", "parameters": [ { @@ -415,10 +409,10 @@ "type": "string", "minLength": 1, "maxLength": 256, - "description": "The Test number's session ID." + "description": "The Test connection's connection ID." }, "required": true, - "name": "session", + "name": "connection", "in": "path" } ], @@ -485,7 +479,7 @@ } }, "403": { - "description": "Test numbers access required, or a client token was used", + "description": "Test connections access required, or a client token was used", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -545,7 +539,7 @@ } }, "409": { - "description": "The Test number is claimed in Inspector, or another mode change is pending. Unclaim it or retry.", + "description": "The Test connection is claimed in Inspector, or another mode change is pending. Unclaim it or retry.", "headers": { "X-RateLimit-Limit": { "$ref": "#/components/headers/X-RateLimit-Limit" @@ -605,9 +599,6 @@ } } }, - "x-mint": { - "content": "Linked Device API sandbox:write" - }, "x-protocols": ["Linked Device API"] } } @@ -717,7 +708,7 @@ "code": { "type": "string", "enum": [ - "zero_knowledge_session", + "zero_knowledge_connection", "invalid_parameter", "invalid_credential", "entitlement_required", @@ -768,7 +759,7 @@ "order_status_transition_invalid", "order_cancellation_failed", "call_opt_out_limit", - "number_restricted", + "connection_restricted", "sip_trunk_in_use", "sip_trunk_revision_conflict", "sip_trunk_limit", @@ -786,7 +777,7 @@ "upstream_failure", "service_unavailable", "credential_verification_unavailable", - "session_not_ready", + "connection_not_ready", "command_dispatch_failed", "result_unknown", "parent_bsuid_not_supported", @@ -808,7 +799,7 @@ "whatsapp_group_suspended", "whatsapp_group_has_no_participants", "bansafe_suspended", - "bansafe_org_suspended", + "bansafe_team_suspended", "bansafe_cold_blocked", "bansafe_cold_held", "bansafe_throttled", @@ -831,7 +822,7 @@ "request_log_url": { "type": "string", "format": "uri", - "description": "Console page that shows this request. Returned only to organization and project credentials whose request was logged." + "description": "Console page that shows this request. Returned only to team and project credentials whose request was logged." } }, "required": ["type", "code", "message", "param", "request_id"] @@ -852,36 +843,36 @@ "signalMode": { "type": "string", "enum": ["standard", "zero_knowledge"], - "description": "Signal key custody for a new Number. Inherits Customer then Project default; cannot change an existing Number. Customer-owned custody requires beta admission and real Linked Devices." + "description": "Signal key custody for a new Connection. Inherits Customer then Project default; cannot change an existing Connection. Customer-owned custody requires beta admission and real Linked Devices." }, "purpose": { "type": "string", - "enum": ["initial", "add_connection"], - "description": "Initial setup, or add a transport to an existing session without replacing the Number." + "enum": ["initial", "add_method"], + "description": "Initial setup, or add a method to an existing Connection without replacing the Connection." }, "connectionGoal": { "type": "string", "enum": ["single", "hybrid"] }, - "session": { + "connection": { "type": "string", "minLength": 1, "maxLength": 128, - "description": "Existing session name. Required only for add_connection." + "description": "Existing connection name. Required only for add_method." }, - "addConnection": { + "addMethod": { "type": "string", "enum": ["linked_devices", "official_api"] }, "projectId": { "type": "string", "format": "uuid", - "description": "Project that receives the connected number. Required for team keys with more than one project." + "description": "Project that receives the connected connection. Required for team keys with more than one project." }, "customerId": { "type": "string", "format": "uuid", - "description": "Customer that owns the connected number when Customers is enabled for the project." + "description": "Customer that owns the connected connection when Customers is enabled for the project." }, "billingControls": { "type": "object", @@ -900,14 +891,14 @@ }, "required": ["limitCredits", "priority"], "additionalProperties": false, - "description": "Initial monthly spending limit and funding priority for a real Number. Requires a team key with billing:manage or a live team owner/admin on Pay-As-You-Go. Applied atomically before pairing admission." + "description": "Initial monthly spending limit and funding priority for a real Connection. Requires a team key with billing:manage or a live team owner/admin on Pay-As-You-Go. Applied atomically before pairing admission." }, "externalId": { "type": "string", "minLength": 1, "maxLength": 256, "pattern": "^[^\\x00-\\x1f\\x7f]+$", - "description": "Integrator correlation copied to the resulting session. May repeat across invitations; does not grant access." + "description": "Integrator correlation copied to the resulting connection. May repeat across invitations; does not grant access." }, "configuration": { "$ref": "#/components/schemas/QuickLinkConfiguration" @@ -956,7 +947,7 @@ "primaryPlatform": { "type": "string", "enum": ["android", "ios"], - "description": "Primary phone platform the Test number emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", + "description": "Primary phone platform the Test connection emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", "x-enumDescriptions": { "android": "An Android phone.", "ios": "An iPhone." @@ -1007,7 +998,7 @@ "items": {"type": "string", "enum": ["qr", "pairing"]}, "minItems": 1, "maxItems": 2, - "description": "Linked Devices methods offered for this connection." + "description": "Linked Devices methods offered for this method." }, "defaultMethod": { "type": "string", @@ -1120,13 +1111,13 @@ "properties": { "purpose": { "type": "string", - "enum": ["initial", "add_connection", "reauthorization"] + "enum": ["initial", "add_method", "reauthorization"] }, "connectionGoal": { "type": "string", "enum": ["single", "hybrid"] }, - "addConnection": { + "addMethod": { "type": "string", "enum": ["linked_devices", "official_api"] }, @@ -1136,11 +1127,11 @@ }, "url": { "type": "string", - "description": "Hosted connection URL. Share it only with the person holding the phone." + "description": "Hosted method URL. Share it only with the person holding the phone." }, - "session": { + "connection": { "type": "string", - "description": "Session name that receives the connected number." + "description": "Connection name that receives the connected connection." }, "expiresAt": { "type": "string", @@ -1153,7 +1144,7 @@ "connectionGoal", "id", "url", - "session", + "connection", "expiresAt" ] }, @@ -1179,7 +1170,7 @@ "primaryPlatform": { "type": "string", "enum": ["android", "ios"], - "description": "Primary phone platform the Test number emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", + "description": "Primary phone platform the Test connection emulates. Defaults to `android`. Not accepted when `accountType` is `meta_cloud`.", "x-enumDescriptions": { "android": "An Android phone.", "ios": "An iPhone." @@ -1192,7 +1183,7 @@ "TestingAccountMode": { "type": "object", "properties": { - "session": {"type": "string"}, + "connection": {"type": "string"}, "accountType": { "type": "string", "enum": [ @@ -1221,16 +1212,16 @@ }, "changed": { "type": "boolean", - "description": "False when the Test number already used this mode. Nothing was unlinked." + "description": "False when the Test connection already used this mode. Nothing was unlinked." }, "unlinkedDevices": { "type": "array", "items": {"type": "integer"}, - "description": "Companions the phone unlinked. Each must pair again, including Polymorfa's own session." + "description": "Companions the phone unlinked. Each must pair again, including Polymorfa's own connection." } }, "required": [ - "session", + "connection", "accountType", "primaryPlatform", "changed", diff --git a/contracts/cli-reference.json b/contracts/cli-reference.json index 71834b45..93741856 100644 --- a/contracts/cli-reference.json +++ b/contracts/cli-reference.json @@ -59,8 +59,8 @@ }, { "id": "analytics get", - "summary": "Read WhatsApp number analytics.", - "description": "Read WhatsApp number activity, completed 24-hour read and reply rates, response times, call outcomes and connection vitals. Requires sessions:read and Analytics enabled in the Console. Project credentials read only their project.", + "summary": "Read WhatsApp Connection analytics.", + "description": "Read WhatsApp Connection activity, completed 24-hour read and reply rates, response times, call outcomes and connection vitals. Requires connections:read and Analytics enabled in the Console. Project credentials read only their project.", "usage": ["polymorfa analytics get [flags]"], "aliases": [], "hidden": false, @@ -78,6 +78,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection-id", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Limit to one Connection UUID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -150,18 +162,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session-id", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Limit to one number record UUID.", - "env": null, - "helpGroup": null - }, { "name": "since", "char": null, @@ -226,7 +226,7 @@ { "id": "analytics metrics", "summary": "Export collector-compatible analytics metrics.", - "description": "Write Prometheus or OpenMetrics gauges to stdout. Requires sessions:read and Analytics enabled in the Console. Counts cover completed UTC hours and are not monotonic counters. Project credentials read only their project. Disabled Analytics returns only enablement and window metadata. Use --json for a text body and response metadata envelope.", + "description": "Write Prometheus or OpenMetrics gauges to stdout. Requires connections:read and Analytics enabled in the Console. Counts cover completed UTC hours and are not monotonic counters. Project credentials read only their project. Disabled Analytics returns only enablement and window metadata. Use --json for a text body and response metadata envelope.", "usage": ["polymorfa analytics metrics [flags]"], "aliases": [], "hidden": false, @@ -244,6 +244,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection-id", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Limit to one Connection UUID.", + "env": null, + "helpGroup": null + }, { "name": "format", "char": null, @@ -340,18 +352,6 @@ "env": null, "helpGroup": null }, - { - "name": "session-id", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Limit to one number record UUID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -2209,6 +2209,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Match one connection ID or name.", + "env": null, + "helpGroup": null + }, { "name": "cursor", "char": null, @@ -2305,18 +2317,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Match one session ID or name.", - "env": null, - "helpGroup": null - }, { "name": "status", "char": null, @@ -2545,7 +2545,7 @@ "multiple": false, "default": null, "options": [], - "description": "Maximum sessions to return (default 25).", + "description": "Maximum connections to return (default 25).", "env": null, "helpGroup": null }, @@ -2815,6 +2815,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Match one connection ID or name.", + "env": null, + "helpGroup": null + }, { "name": "cursor", "char": null, @@ -2911,18 +2923,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Match one session ID or name.", - "env": null, - "helpGroup": null - }, { "name": "severity", "char": null, @@ -2996,6 +2996,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Match one connection ID or name.", + "env": null, + "helpGroup": null + }, { "name": "cursor", "char": null, @@ -3092,18 +3104,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Match one session ID or name.", - "env": null, - "helpGroup": null - }, { "name": "status", "char": null, @@ -3412,15 +3412,15 @@ }, { "id": "bansafe health history", - "summary": "List recorded BanSafe Health evaluations for one session.", - "description": "List recorded BanSafe Health evaluations for one session.", - "usage": ["polymorfa bansafe health history SESSION [flags]"], + "summary": "List recorded BanSafe Health evaluations for one connection.", + "description": "List recorded BanSafe Health evaluations for one connection.", + "usage": ["polymorfa bansafe health history CONNECTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "session", - "description": "Session ID or name.", + "name": "connection", + "description": "Connection ID or name.", "required": true, "options": [] } @@ -3615,7 +3615,7 @@ "multiple": false, "default": null, "options": [], - "description": "Maximum sessions to return (default 25).", + "description": "Maximum connections to return (default 25).", "env": null, "helpGroup": null }, @@ -3709,15 +3709,15 @@ }, { "id": "bansafe health view", - "summary": "View current BanSafe Health for one session.", - "description": "View current BanSafe Health for one session.", - "usage": ["polymorfa bansafe health view SESSION [flags]"], + "summary": "View current BanSafe Health for one connection.", + "description": "View current BanSafe Health for one connection.", + "usage": ["polymorfa bansafe health view CONNECTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "session", - "description": "Session ID or name.", + "name": "connection", + "description": "Connection ID or name.", "required": true, "options": [] } @@ -3856,6 +3856,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Match one connection ID or name.", + "env": null, + "helpGroup": null + }, { "name": "cursor", "char": null, @@ -3952,18 +3964,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Match one session ID or name.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -4013,6 +4013,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Connection ID or name.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -4121,18 +4133,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Session ID or name.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -4569,15 +4569,15 @@ }, { "id": "bansafe safe-mode update", - "summary": "Update project or session Safe Mode settings.", - "description": "Update project or session Safe Mode settings.", - "usage": ["polymorfa bansafe safe-mode update [SESSION] [flags]"], + "summary": "Update project or connection Safe Mode settings.", + "description": "Update project or connection Safe Mode settings.", + "usage": ["polymorfa bansafe safe-mode update [CONNECTION] [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "session", - "description": "Session ID or name.", + "name": "connection", + "description": "Connection ID or name.", "required": false, "options": [] } @@ -4675,7 +4675,7 @@ "multiple": false, "default": null, "options": [], - "description": "Project ID; required when session is omitted.", + "description": "Project ID; required when connection is omitted.", "env": null, "helpGroup": null }, @@ -4721,15 +4721,15 @@ }, { "id": "bansafe safe-mode view", - "summary": "View project or effective session Safe Mode.", - "description": "View project or effective session Safe Mode.", - "usage": ["polymorfa bansafe safe-mode view [SESSION] [flags]"], + "summary": "View project or effective connection Safe Mode.", + "description": "View project or effective connection Safe Mode.", + "usage": ["polymorfa bansafe safe-mode view [CONNECTION] [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "session", - "description": "Session ID or name.", + "name": "connection", + "description": "Connection ID or name.", "required": false, "options": [] } @@ -4803,7 +4803,7 @@ "multiple": false, "default": null, "options": [], - "description": "Project ID; required when session is omitted.", + "description": "Project ID; required when connection is omitted.", "env": null, "helpGroup": null }, @@ -4970,15 +4970,15 @@ }, { "id": "bansafe telemetry history", - "summary": "List bounded BanSafe telemetry snapshots for one session.", - "description": "List bounded BanSafe telemetry snapshots for one session.", - "usage": ["polymorfa bansafe telemetry history SESSION [flags]"], + "summary": "List bounded BanSafe telemetry snapshots for one connection.", + "description": "List bounded BanSafe telemetry snapshots for one connection.", + "usage": ["polymorfa bansafe telemetry history CONNECTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "session", - "description": "Session ID or name.", + "name": "connection", + "description": "Connection ID or name.", "required": true, "options": [] } @@ -5146,15 +5146,15 @@ }, { "id": "bansafe telemetry view", - "summary": "View the latest bounded BanSafe telemetry for one session.", - "description": "View the latest bounded BanSafe telemetry for one session.", - "usage": ["polymorfa bansafe telemetry view SESSION [flags]"], + "summary": "View the latest bounded BanSafe telemetry for one connection.", + "description": "View the latest bounded BanSafe telemetry for one connection.", + "usage": ["polymorfa bansafe telemetry view CONNECTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "session", - "description": "Session ID or name.", + "name": "connection", + "description": "Connection ID or name.", "required": true, "options": [] } @@ -5645,7 +5645,7 @@ "required": true, "multiple": false, "default": null, - "options": ["project", "customer", "number"], + "options": ["project", "customer", "connection"], "description": "", "env": null, "helpGroup": null @@ -5833,7 +5833,7 @@ "required": true, "multiple": false, "default": null, - "options": ["project", "customer", "number"], + "options": ["project", "customer", "connection"], "description": "", "env": null, "helpGroup": null @@ -5880,8 +5880,8 @@ }, { "id": "billing limits list", - "summary": "Read monthly project and number spending limits.", - "description": "Requires an organization key with billing:read. Use --project to include its number limits. Months reset on the first day at 00:00 UTC.", + "summary": "Read monthly project and Connection spending limits.", + "description": "Requires an organization key with billing:read. Use --project to include its Connection limits. Months reset on the first day at 00:00 UTC.", "usage": ["polymorfa billing limits list [flags]"], "aliases": [], "hidden": false, @@ -6009,7 +6009,7 @@ "args": [ { "name": "id", - "description": "Project or number UUID.", + "description": "Project or Connection UUID.", "required": true, "options": [] } @@ -6130,7 +6130,7 @@ "required": true, "multiple": false, "default": null, - "options": ["project", "customer", "number"], + "options": ["project", "customer", "connection"], "description": "", "env": null, "helpGroup": null @@ -6177,8 +6177,8 @@ }, { "id": "billing priority list", - "summary": "Read project, customer and number funding priorities.", - "description": "Requires an organization key with billing:read. Project priority takes precedence. Numbers inherit customer priority; a higher number priority overrides it. Use --project for its funding controls. Includes the revision used for changes.", + "summary": "Read project, customer and connection funding priorities.", + "description": "Requires an organization key with billing:read. Project priority takes precedence. Connections inherit customer priority; a higher Connection priority overrides it. Use --project for its funding controls. Includes the revision used for changes.", "usage": ["polymorfa billing priority list [flags]"], "aliases": [], "hidden": false, @@ -6299,7 +6299,7 @@ { "id": "billing priority reorder", "summary": "Save a complete funding order atomically.", - "description": "Requires Pay-As-You-Go and an organization key with billing:manage. Pass every active project, customer or real number for its scope. Resource scope mixes all customers and numbers in --project, highest first. Incomplete or stale orders fail without partial changes.", + "description": "Requires Pay-As-You-Go and an organization key with billing:manage. Pass every active project, customer or real connection for its scope. Resource scope mixes all customers and connections in --project, highest first. Incomplete or stale orders fail without partial changes.", "usage": ["polymorfa billing priority reorder [flags]"], "aliases": [], "hidden": false, @@ -6337,7 +6337,7 @@ "multiple": false, "default": null, "options": [], - "description": "UUIDs, highest first. For resource scope use customer:UUID or number:UUID.", + "description": "UUIDs, highest first. For resource scope use customer:UUID or connection:UUID.", "env": null, "helpGroup": null }, @@ -6432,7 +6432,7 @@ "required": true, "multiple": false, "default": null, - "options": ["project", "customer", "number", "resource"], + "options": ["project", "customer", "connection", "resource"], "description": "", "env": null, "helpGroup": null @@ -6467,7 +6467,7 @@ }, { "id": "billing priority set", - "summary": "Set a project or number funding priority.", + "summary": "Set a project or Connection funding priority.", "description": "Requires Pay-As-You-Go and an organization key with billing:manage. Changes future renewal protection and recovery; paid windows keep their expiry.", "usage": ["polymorfa billing priority set ID [flags]"], "aliases": [], @@ -6475,7 +6475,7 @@ "args": [ { "name": "id", - "description": "Project or number UUID.", + "description": "Project or Connection UUID.", "required": true, "options": [] } @@ -6596,7 +6596,7 @@ "required": true, "multiple": false, "default": null, - "options": ["project", "customer", "number"], + "options": ["project", "customer", "connection"], "description": "", "env": null, "helpGroup": null @@ -6650,6 +6650,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -6722,18 +6734,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -6783,6 +6783,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "enabled", "char": null, @@ -6879,18 +6891,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -6940,6 +6940,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -7024,18 +7036,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -7097,6 +7097,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "height", "char": null, @@ -7205,18 +7217,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -7285,6 +7285,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -7381,18 +7393,6 @@ "env": null, "helpGroup": null }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -7442,6 +7442,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -7550,18 +7562,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -7618,6 +7618,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -7702,18 +7714,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -7799,6 +7799,18 @@ "env": null, "helpGroup": null }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "height", "char": null, @@ -7907,18 +7919,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -7980,6 +7980,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -8076,18 +8088,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -8156,6 +8156,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -8264,18 +8276,6 @@ "env": null, "helpGroup": null }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -8344,6 +8344,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "height", "char": null, @@ -8452,18 +8464,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -8525,6 +8525,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -8621,18 +8633,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -8682,6 +8682,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -8754,18 +8766,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -8815,6 +8815,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -8887,18 +8899,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -8955,6 +8955,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -9039,18 +9051,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -9119,6 +9119,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -9215,18 +9227,6 @@ "env": null, "helpGroup": null }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -9276,6 +9276,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -9372,18 +9384,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -9440,6 +9440,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -9524,18 +9536,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -9604,6 +9604,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -9700,18 +9712,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -9768,6 +9768,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "id", "char": null, @@ -9852,18 +9864,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -9920,6 +9920,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "hidden", "char": null, @@ -10016,18 +10028,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -10084,6 +10084,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -10168,18 +10180,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -10241,6 +10241,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "file", "char": null, @@ -10337,18 +10349,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -10410,6 +10410,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -10506,18 +10518,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -10567,6 +10567,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -10639,18 +10651,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -10681,8 +10681,8 @@ }, { "id": "call reject", - "summary": "Reject an incoming call by session and caller.", - "description": "Reject an incoming call through the Linked Device session route, identified by session, call ID, and caller ID. Requires a server API key. To decline a call on the unified Calls API, use calls reject.", + "summary": "Reject an incoming call by connection and caller.", + "description": "Reject an incoming call through the Linked Device connection route, identified by connection, call ID, and caller ID. Requires a server API key. To decline a call on the unified Calls API, use calls reject.", "usage": ["polymorfa call reject CALL [flags]"], "aliases": [], "hidden": false, @@ -10707,6 +10707,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "from", "char": null, @@ -10803,18 +10815,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -11016,7 +11016,7 @@ { "id": "calls check", "summary": "Check whether a call can be placed.", - "description": "Run the checks a call placement runs, without calling: the session’s calling switch, the team’s do-not-call list and blocked country codes, and on Cloud API numbers the person’s call permission and WhatsApp’s call limits. Prints allowed and the first refusal: calls_disabled, call_recipient_opted_out, call_destination_blocked, call_permission_required or call_limit_reached. The command exits with code 0 either way; read allowed from the output. Requires a server API key.", + "description": "Run the checks a call placement runs, without calling: the connection’s calling switch, the team’s do-not-call list and blocked country codes, and on Cloud API connections the person’s call permission and WhatsApp’s call limits. Prints allowed and the first refusal: calls_disabled, call_recipient_opted_out, call_destination_blocked, call_permission_required or call_limit_reached. The command exits with code 0 either way; read allowed from the output. Requires a server API key.", "usage": ["polymorfa calls check TO [flags]"], "aliases": [], "hidden": false, @@ -11041,6 +11041,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Connection that would place the call.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -11113,18 +11125,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Session (number) that would place the call.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -11152,11 +11152,11 @@ ], "examples": [ { - "command": "polymorfa calls check +14155550123 --session support", + "command": "polymorfa calls check +14155550123 --connection support", "description": "" }, { - "command": "polymorfa calls check +14155550123 --session support --json", + "command": "polymorfa calls check +14155550123 --connection support --json", "description": "" } ], @@ -11295,7 +11295,7 @@ { "id": "calls export", "summary": "Export call detail records.", - "description": "Export call detail records as CSV or newline-delimited JSON, newest first.\n\nEach record has callId, projectId, sessionId, direction, upstream, outcome, state, hasVideo, peerRef, startedAt, connectedAt, endedAt, durationSeconds, and endReason. peerRef is a team-specific pseudonym of the other party, never a phone number.\n\nThe command requests every page until no records remain and writes one CSV header. Records go to standard output, or to --output. Progress and the next cursor go to standard error, as JSON lines with --json. --max-pages stops early; resume with --cursor and the same filters. When a page fails, the command reports the cursor that resumes from that page and exits non-zero.\n\nPass --project to read one project. Without it, an organization API key reads every project in the organization. A project token reads only its own project and requires --project. Credentials need the sessions:read scope.", + "description": "Export call detail records as CSV or newline-delimited JSON, newest first.\n\nEach record has callId, projectId, connectionId, direction, upstream, outcome, state, hasVideo, peerRef, startedAt, connectedAt, endedAt, durationSeconds, and endReason. peerRef is a team-specific pseudonym of the other party, never a phone number.\n\nThe command requests every page until no records remain and writes one CSV header. Records go to standard output, or to --output. Progress and the next cursor go to standard error, as JSON lines with --json. --max-pages stops early; resume with --cursor and the same filters. When a page fails, the command reports the cursor that resumes from that page and exits non-zero.\n\nPass --project to read one project. Without it, an organization API key reads every project in the organization. A project token reads only its own project and requires --project. Credentials need the connections:read scope.", "usage": ["polymorfa calls export [flags]"], "aliases": [], "hidden": false, @@ -11313,6 +11313,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Include only calls on this connection.", + "env": null, + "helpGroup": null + }, { "name": "cursor", "char": null, @@ -11487,18 +11499,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Include only calls on this session (number).", - "env": null, - "helpGroup": null - }, { "name": "since", "char": null, @@ -11543,7 +11543,7 @@ "multiple": false, "default": null, "options": ["linked_device", "cloud_api"], - "description": "Include only numbers that connect this way.", + "description": "Include only connections that connect this way.", "env": null, "helpGroup": null }, @@ -11583,7 +11583,7 @@ { "id": "calls hand", "summary": "Raise or lower a call hand.", - "description": "Raise or lower the Number’s hand. The Number has one hand state shared across its application connections.", + "description": "Raise or lower the Connection’s hand. The Connection has one hand state shared across its application connections.", "usage": ["polymorfa calls hand CALLID [flags]"], "aliases": [], "hidden": false, @@ -11752,7 +11752,7 @@ { "id": "calls invite", "summary": "Invite a participant into a call.", - "description": "Ring another WhatsApp user into a call, turning a 1:1 call into a group call. The call must have a live leg. While WhatsApp restricts the number to people it has already chatted with, inviting anyone else exits with code 3 and number_restricted.", + "description": "Ring another WhatsApp user into a call, turning a 1:1 call into a group call. The call must have a live leg. While WhatsApp restricts the Connection to people it has already chatted with, inviting anyone else exits with code 3 and connection_restricted.", "usage": ["polymorfa calls invite CALLID TARGET [flags]"], "aliases": [], "hidden": false, @@ -12048,7 +12048,7 @@ { "id": "calls link create", "summary": "Create a WhatsApp call link.", - "description": "Create a WhatsApp call link from a Linked Device Number. It does not place or join a call. Requires a server API key or project token and calling enabled for the Number; client tokens and Cloud API-only Numbers are refused. The request is never retried: if the outcome is unknown, check before creating another link. Keep the link private.", + "description": "Create a WhatsApp call link from a Linked Device Connection. It does not place or join a call. Requires a server API key or project token and calling enabled for the Connection; client tokens and Cloud API-only Connections are refused. The request is never retried: if the outcome is unknown, check before creating another link. Keep the link private.", "usage": ["polymorfa calls link create [flags]"], "aliases": [], "hidden": false, @@ -12066,6 +12066,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Linked Device connection that owns the link.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -12138,18 +12150,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Linked Device session that owns the link.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -12189,11 +12189,11 @@ ], "examples": [ { - "command": "polymorfa calls link create --session support", + "command": "polymorfa calls link create --connection support", "description": "" }, { - "command": "polymorfa calls link create --session support --video --json", + "command": "polymorfa calls link create --connection support --video --json", "description": "" } ], @@ -12202,7 +12202,7 @@ { "id": "calls link preview", "summary": "Preview a WhatsApp call link.", - "description": "Read a WhatsApp call link through a Linked Device Number without joining the call. Pipe the link, or its token, on standard input so it stays out of shell history and process listings. A full link sets voice or video; pass --video with a bare video-link token. Requires a server API key or project token.", + "description": "Read a WhatsApp call link through a Linked Device Connection without joining the call. Pipe the link, or its token, on standard input so it stays out of shell history and process listings. A full link sets voice or video; pass --video with a bare video-link token. Requires a server API key or project token.", "usage": ["polymorfa calls link preview [flags]"], "aliases": [], "hidden": false, @@ -12220,6 +12220,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Linked Device connection that reads the link.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -12292,18 +12304,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Linked Device session that reads the link.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -12343,11 +12343,11 @@ ], "examples": [ { - "command": "printf '%s' \"$CALL_LINK\" | polymorfa calls link preview --session support", + "command": "printf '%s' \"$CALL_LINK\" | polymorfa calls link preview --connection support", "description": "" }, { - "command": "printf '%s' \"$TOKEN\" | polymorfa calls link preview --session support --video --json", + "command": "printf '%s' \"$TOKEN\" | polymorfa calls link preview --connection support --video --json", "description": "" } ], @@ -12355,8 +12355,8 @@ }, { "id": "calls list", - "summary": "List one page of stored call records, newest first. Requires sessions:read and a server credential. Project tokens read only their original owning project. Reuse the same filters with --cursor.", - "description": "List one page of stored call records, newest first. Requires sessions:read and a server credential. Project tokens read only their original owning project. Reuse the same filters with --cursor.", + "summary": "List one page of stored call records, newest first. Requires connections:read and a server credential. Project tokens read only their original owning project. Reuse the same filters with --cursor.", + "description": "List one page of stored call records, newest first. Requires connections:read and a server credential. Project tokens read only their original owning project. Reuse the same filters with --cursor.", "usage": ["polymorfa calls list [flags]"], "aliases": [], "hidden": false, @@ -12374,6 +12374,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Include only calls on this connection.", + "env": null, + "helpGroup": null + }, { "name": "cursor", "char": null, @@ -12500,18 +12512,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Include only calls on this session (number).", - "env": null, - "helpGroup": null - }, { "name": "since", "char": null, @@ -12556,7 +12556,7 @@ "multiple": false, "default": null, "options": ["linked_device", "cloud_api"], - "description": "Include only numbers that connect this way.", + "description": "Include only connections that connect this way.", "env": null, "helpGroup": null }, @@ -12613,6 +12613,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Connection of the call. Required with a server API key; client tokens use their bound connection.", + "env": null, + "helpGroup": null + }, { "name": "exclusive", "char": null, @@ -12769,18 +12781,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Session of the call. Required with a server API key; client tokens use their bound session.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -12820,15 +12820,15 @@ ], "examples": [ { - "command": "polymorfa calls media --session support --output call.pcm", + "command": "polymorfa calls media --connection support --output call.pcm", "description": "" }, { - "command": "polymorfa calls media --session support --place +15550100 --input prompt.pcm --leave-on-eof --output reply.pcm", + "command": "polymorfa calls media --connection support --place +15550100 --input prompt.pcm --leave-on-eof --output reply.pcm", "description": "" }, { - "command": "sox in.wav -t raw -r 16000 -e signed -b 16 -c 1 - | polymorfa calls media call_123 --session support --input - --exclusive > out.pcm", + "command": "sox in.wav -t raw -r 16000 -e signed -b 16 -c 1 - | polymorfa calls media call_123 --connection support --input - --exclusive > out.pcm", "description": "" } ], @@ -13504,7 +13504,7 @@ { "id": "calls permission get", "summary": "Show a person’s call permission.", - "description": "Show whether a person allows a Cloud API number to call them: none, temporary (until expiresAt), permanent, or revoked. WhatsApp is asked on every request, and the answer includes its limits on permission requests and calls. When WhatsApp cannot be reached, the stored state is shown with fresh false. Linked-device numbers fail with unsupported_for_connection (exit code 4). Requires a server API key.", + "description": "Show whether a person allows a Cloud API Connection to call them: none, temporary (until expiresAt), permanent, or revoked. WhatsApp is asked on every request, and the answer includes its limits on permission requests and calls. When WhatsApp cannot be reached, the stored state is shown with fresh false. Linked-device connections fail with unsupported_for_connection (exit code 4). Requires a server API key.", "usage": ["polymorfa calls permission get TO [flags]"], "aliases": [], "hidden": false, @@ -13529,6 +13529,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Cloud API connection that would call.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -13601,18 +13613,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Cloud API session (number) that would call.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -13640,11 +13640,11 @@ ], "examples": [ { - "command": "polymorfa calls permission get +14155550123 --session support", + "command": "polymorfa calls permission get +14155550123 --connection support", "description": "" }, { - "command": "polymorfa calls permission get +14155550123 --session support --json", + "command": "polymorfa calls permission get +14155550123 --connection support --json", "description": "" } ], @@ -13653,7 +13653,7 @@ { "id": "calls permission request", "summary": "Ask a person for permission to call them.", - "description": "Send a message that asks a person for permission to call them from a Cloud API number. WhatsApp shows --body above its allow and decline buttons, and the reply arrives as a call.permission_changed event. WhatsApp limits how often a number can ask the same person; when the limit is reached the command fails with call_permission_request_limited (exit code 5) and prints the Retry-After wait when WhatsApp gives one. A person who already granted permanent permission fails with call_permission_granted, and linked-device numbers with unsupported_for_connection (exit code 4).", + "description": "Send a message that asks a person for permission to call them from a Cloud API Connection. WhatsApp shows --body above its allow and decline buttons, and the reply arrives as a call.permission_changed event. WhatsApp limits how often a number can ask the same person; when the limit is reached the command fails with call_permission_request_limited (exit code 5) and prints the Retry-After wait when WhatsApp gives one. A person who already granted permanent permission fails with call_permission_granted, and linked-device connections with unsupported_for_connection (exit code 4).", "usage": ["polymorfa calls permission request TO [flags]"], "aliases": [], "hidden": false, @@ -13690,6 +13690,18 @@ "env": null, "helpGroup": null }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Cloud API connection that asks.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -13774,18 +13786,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Cloud API session (number) that asks.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -13813,7 +13813,7 @@ ], "examples": [ { - "command": "polymorfa calls permission request +14155550123 --session support --body \"We would like to call you about your order.\"", + "command": "polymorfa calls permission request +14155550123 --connection support --body \"We would like to call you about your order.\"", "description": "" } ], @@ -13822,7 +13822,7 @@ { "id": "calls place", "summary": "Place a call.", - "description": "Place a WhatsApp call from a session. The placing participant owns the call. Server API keys name the session with --session; client tokens place from the session they are bound to. While WhatsApp restricts the number to people it has already chatted with, a call to anyone else exits with code 3 and number_restricted.", + "description": "Place a WhatsApp call from a connection. The placing participant owns the call. Server API keys name the connection with --connection; client tokens place from the connection they are bound to. While WhatsApp restricts the Connection to people it has already chatted with, a call to anyone else exits with code 3 and connection_restricted.", "usage": ["polymorfa calls place TO [flags]"], "aliases": [], "hidden": false, @@ -13847,6 +13847,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Connection that places the call. Required with a server API key.", + "env": null, + "helpGroup": null + }, { "name": "exclusive", "char": null, @@ -13943,18 +13955,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Session that places the call. Required with a server API key.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -13994,11 +13994,11 @@ ], "examples": [ { - "command": "polymorfa calls place +15550100 --session support", + "command": "polymorfa calls place +15550100 --connection support", "description": "" }, { - "command": "polymorfa calls place +15550100 --session support --video --exclusive --participant agent-7 --json", + "command": "polymorfa calls place +15550100 --connection support --video --exclusive --participant agent-7 --json", "description": "" } ], @@ -14007,7 +14007,7 @@ { "id": "calls place-group", "summary": "Place a WhatsApp group call.", - "description": "Place one WhatsApp group call by public group ID or to 2 to 31 distinct recipients from a Linked Device number. Each recipient must pass the number’s calling restrictions and your team’s destination policy. Cloud API numbers refuse this operation.", + "description": "Place one WhatsApp group call by public group ID or to 2 to 31 distinct recipients from a Linked Device Connection. Each recipient must pass the Connection’s calling restrictions and your team’s destination policy. Cloud API connections refuse this operation.", "usage": ["polymorfa calls place-group [flags]"], "aliases": [], "hidden": false, @@ -14025,6 +14025,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Connection that places the call. Required with a server API key.", + "env": null, + "helpGroup": null + }, { "name": "exclusive", "char": null, @@ -14133,18 +14145,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Session that places the call. Required with a server API key.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -14196,11 +14196,11 @@ ], "examples": [ { - "command": "polymorfa calls place-group --to +15550100 --to +15550101 --session support", + "command": "polymorfa calls place-group --to +15550100 --to +15550101 --connection support", "description": "" }, { - "command": "polymorfa calls place-group --group-id 9007199254740996 --session support", + "command": "polymorfa calls place-group --group-id 9007199254740996 --connection support", "description": "" } ], @@ -14683,7 +14683,7 @@ { "id": "calls reject", "summary": "Decline a ringing call.", - "description": "Decline a ringing call through the unified Calls API. Declining ends the call for every participant. Exits with code 4 when the call is no longer ringing (call_not_ringing). To reject a call through the Linked Device session route with the caller ID, use call reject.", + "description": "Decline a ringing call through the unified Calls API. Declining ends the call for every participant. Exits with code 4 when the call is no longer ringing (call_not_ringing). To reject a call through the Linked Device connection route with the caller ID, use call reject.", "usage": ["polymorfa calls reject CALLID [flags]"], "aliases": [], "hidden": false, @@ -14829,7 +14829,7 @@ { "id": "calls retention get", "summary": "Read team call data retention.", - "description": "Read how long Polymorfa keeps your team’s call data from the Platform API. Deletion of call data older than the period starts on a date Polymorfa announces in its changelog; until then the setting records a choice and nothing is deleted. Teams without a saved setting return the default (extended, 90 days) at revision 0. Pass the revision to `calls retention set --expected-revision` so a change cannot overwrite another one. Requires a team API key or a project token with the sessions:read scope; client tokens are refused.", + "description": "Read how long Polymorfa keeps your team’s call data from the Platform API. Deletion of call data older than the period starts on a date Polymorfa announces in its changelog; until then the setting records a choice and nothing is deleted. Teams without a saved setting return the default (extended, 90 days) at revision 0. Pass the revision to `calls retention set --expected-revision` so a change cannot overwrite another one. Requires a team API key or a project token with the connections:read scope; client tokens are refused.", "usage": ["polymorfa calls retention get [flags]"], "aliases": [], "hidden": false, @@ -14952,7 +14952,7 @@ { "id": "calls retention set", "summary": "Change team call data retention.", - "description": "Change how long Polymorfa keeps your team’s call data through the Platform API. --policy short, standard, extended, or compliance keeps call data for 7, 30, 90, or 365 days; --policy custom keeps it for --days (1 to 2555). Deletion of call data older than the period starts on a date Polymorfa announces in its changelog; until then saving a period deletes nothing. Once deletion runs, a shorter period also applies to call data already stored, and deleted call data cannot be recovered, so the command asks you to confirm a shorter period; pass --yes to confirm without a prompt (required when standard input or error is not a terminal). --expected-revision is required: the command reads the setting first and changes it only if it still has that revision (see `calls retention get`); otherwise it fails with state_conflict (exit code 4) and changes nothing. Requires a team API key with the sessions:read and sessions:manage scopes, because the command reads the setting before it changes it; the API refuses project tokens (exit code 3).", + "description": "Change how long Polymorfa keeps your team’s call data through the Platform API. --policy short, standard, extended, or compliance keeps call data for 7, 30, 90, or 365 days; --policy custom keeps it for --days (1 to 2555). Deletion of call data older than the period starts on a date Polymorfa announces in its changelog; until then saving a period deletes nothing. Once deletion runs, a shorter period also applies to call data already stored, and deleted call data cannot be recovered, so the command asks you to confirm a shorter period; pass --yes to confirm without a prompt (required when standard input or error is not a terminal). --expected-revision is required: the command reads the setting first and changes it only if it still has that revision (see `calls retention get`); otherwise it fails with state_conflict (exit code 4) and changes nothing. Requires a team API key with the connections:read and connections:manage scopes, because the command reads the setting before it changes it; the API refuses project tokens (exit code 3).", "usage": ["polymorfa calls retention set [flags]"], "aliases": [], "hidden": false, @@ -15272,8 +15272,8 @@ }, { "id": "calls settings get", - "summary": "Read session call settings.", - "description": "Read a session’s call settings from the Platform API. Sessions without saved settings return the defaults at revision 0. Pass the revision to `calls settings set --expected-revision` so a change cannot overwrite another one. After simultaneous calls are turned off, it also prints when the Ban Insurance exclusion ends (simultaneousCallsCoverageExcludedUntil), until that time passes. Ban Insurance excludes a ban when simultaneous calls were on during the 30 days before it; this timestamp is the cutoff for a new ban from that period. No end is printed while simultaneous calls are on, and a missing end does not mean the number is covered. Requires a server API key.", + "summary": "Read connection call settings.", + "description": "Read a connection’s call settings from the Platform API. Connections without saved settings return the defaults at revision 0. Pass the revision to `calls settings set --expected-revision` so a change cannot overwrite another one. After simultaneous calls are turned off, it also prints when the Ban Insurance exclusion ends (simultaneousCallsCoverageExcludedUntil), until that time passes. Ban Insurance excludes a ban when simultaneous calls were on during the 30 days before it; this timestamp is the cutoff for a new ban from that period. No end is printed while simultaneous calls are on, and a missing end does not mean the number is covered. Requires a server API key.", "usage": ["polymorfa calls settings get [flags]"], "aliases": [], "hidden": false, @@ -15291,6 +15291,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -15363,18 +15375,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -15402,7 +15402,7 @@ ], "examples": [ { - "command": "polymorfa calls settings get --session support", + "command": "polymorfa calls settings get --connection support", "description": "" } ], @@ -15410,8 +15410,8 @@ }, { "id": "calls settings set", - "summary": "Change session call settings.", - "description": "Change a session’s call settings through the Platform API. Settings you do not pass keep their current values; --inbound-route sip_trunk without --sip-trunk keeps the stored trunk. --calls-enabled=false turns calling off for the session: placing, answering and joining calls fail, incoming calls are declined and SIP trunks cannot call through it, while calls in progress continue. --expected-revision applies the change only if the settings still have that revision (see `calls settings get`); otherwise the command fails with state_conflict (exit code 4) and changes nothing. --conference-mode (on by default) lets every participant you connect to a call (apps, bots and SIP trunk callers) hear the WhatsApp party and each other; --no-conference-mode lets each hear only the WhatsApp party. The WhatsApp party always hears all of your participants, and nobody hears their own audio. --inbound-route sip_trunk also sends incoming calls to --sip-trunk, and --sip-claim controls whether the trunk’s answer claims the call. --host-cloud-api-calls=true has Polymorfa Calls answer a Cloud API session’s incoming calls instead of your Graph API integration. --simultaneous-calls=true lets a linked-device number hold any number of calls at once (incoming, placed and campaign calls); Cloud API numbers ignore it. WhatsApp’s own apps never hold two calls at once, and while it is on, and for 30 days after you turn it off, Ban Insurance does not cover a ban of the number. Turning it on therefore requires --acknowledge-risk, and the command exits with code 2 without changing anything when that flag is missing. After --simultaneous-calls=false, the output shows when the Ban Insurance exclusion ends, from the server’s response. Only a team API key can turn it on; --simultaneous-calls=false needs no acknowledgment. Requires a server API key.", + "summary": "Change connection call settings.", + "description": "Change a connection’s call settings through the Platform API. Settings you do not pass keep their current values; --inbound-route sip_trunk without --sip-trunk keeps the stored trunk. --calls-enabled=false turns calling off for the connection: placing, answering and joining calls fail, incoming calls are declined and SIP trunks cannot call through it, while calls in progress continue. --expected-revision applies the change only if the settings still have that revision (see `calls settings get`); otherwise the command fails with state_conflict (exit code 4) and changes nothing. --conference-mode (on by default) lets every participant you connect to a call (apps, bots and SIP trunk callers) hear the WhatsApp party and each other; --no-conference-mode lets each hear only the WhatsApp party. The WhatsApp party always hears all of your participants, and nobody hears their own audio. --inbound-route sip_trunk also sends incoming calls to --sip-trunk, and --sip-claim controls whether the trunk’s answer claims the call. --host-cloud-api-calls=true has Polymorfa Calls answer a Cloud API connection’s incoming calls instead of your Graph API integration. --simultaneous-calls=true lets a linked-device Connection hold any number of calls at once (incoming, placed and campaign calls); Cloud API connections ignore it. WhatsApp’s own apps never hold two calls at once, and while it is on, and for 30 days after you turn it off, Ban Insurance does not cover a ban of the number. Turning it on therefore requires --acknowledge-risk, and the command exits with code 2 without changing anything when that flag is missing. After --simultaneous-calls=false, the output shows when the Ban Insurance exclusion ends, from the server’s response. Only a team API key can turn it on; --simultaneous-calls=false needs no acknowledgment. Requires a server API key.", "usage": ["polymorfa calls settings set [flags]"], "aliases": [], "hidden": false, @@ -15425,7 +15425,7 @@ "multiple": false, "default": null, "options": [], - "description": "Confirm that turning simultaneous calls on removes Ban Insurance cover for the number. Required with --simultaneous-calls=true.", + "description": "Confirm that turning simultaneous calls on removes Ban Insurance cover for the Connection. Required with --simultaneous-calls=true.", "env": null, "helpGroup": null }, @@ -15449,7 +15449,7 @@ "multiple": false, "default": null, "options": ["true", "false"], - "description": "Allow calls on the session (false turns calling off).", + "description": "Allow calls on the connection (false turns calling off).", "env": null, "helpGroup": null }, @@ -15465,6 +15465,18 @@ "env": null, "helpGroup": null }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "expected-revision", "char": null, @@ -15485,7 +15497,7 @@ "multiple": false, "default": null, "options": ["true", "false"], - "description": "On a Cloud API session, answer incoming calls with Polymorfa Calls (false leaves them to your Graph API integration).", + "description": "On a Cloud API connection, answer incoming calls with Polymorfa Calls (false leaves them to your Graph API integration).", "env": null, "helpGroup": null }, @@ -15573,18 +15585,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Session ID.", - "env": null, - "helpGroup": null - }, { "name": "simultaneous-calls", "char": null, @@ -15593,7 +15593,7 @@ "multiple": false, "default": null, "options": ["true", "false"], - "description": "Let a linked-device number hold any number of calls at once (true requires --acknowledge-risk; false turns it off).", + "description": "Let a linked-device Connection hold any number of calls at once (true requires --acknowledge-risk; false turns it off).", "env": null, "helpGroup": null }, @@ -15648,31 +15648,31 @@ ], "examples": [ { - "command": "polymorfa calls settings set --session support --calls-enabled=false", + "command": "polymorfa calls settings set --connection support --calls-enabled=false", "description": "" }, { - "command": "polymorfa calls settings set --session support --no-conference-mode", + "command": "polymorfa calls settings set --connection support --no-conference-mode", "description": "" }, { - "command": "polymorfa calls settings set --session support --calls-enabled=false --expected-revision 3", + "command": "polymorfa calls settings set --connection support --calls-enabled=false --expected-revision 3", "description": "" }, { - "command": "polymorfa calls settings set --session support --inbound-route sip_trunk --sip-trunk 6f1c2f0e-1d5b-4d8e-9a55-0d4b8a6c1f10", + "command": "polymorfa calls settings set --connection support --inbound-route sip_trunk --sip-trunk 6f1c2f0e-1d5b-4d8e-9a55-0d4b8a6c1f10", "description": "" }, { - "command": "polymorfa calls settings set --session support --inbound-route clients", + "command": "polymorfa calls settings set --connection support --inbound-route clients", "description": "" }, { - "command": "polymorfa calls settings set --session support --simultaneous-calls=true --acknowledge-risk", + "command": "polymorfa calls settings set --connection support --simultaneous-calls=true --acknowledge-risk", "description": "" }, { - "command": "polymorfa calls settings set --session support --simultaneous-calls=false", + "command": "polymorfa calls settings set --connection support --simultaneous-calls=false", "description": "" } ], @@ -15681,7 +15681,7 @@ { "id": "calls stats", "summary": "Summarize call volume, outcomes, and duration.", - "description": "Summarize calls: counts by outcome, answer rate, and connected time, grouped by day, hour, session, or outcome.\n\nThe range defaults to the last 7 days. --group-by day covers at most 366 days and --group-by hour at most 31. Day and hour buckets, and the heatmap, use --timezone (UTC by default).\n\nPass --project to read one project. Without it, an organization API key reads every project in the organization. A project token reads only its own project and requires --project. Credentials need the sessions:read scope.", + "description": "Summarize calls: counts by outcome, answer rate, and connected time, grouped by day, hour, connection, or outcome.\n\nThe range defaults to the last 7 days. --group-by day covers at most 366 days and --group-by hour at most 31. Day and hour buckets, and the heatmap, use --timezone (UTC by default).\n\nPass --project to read one project. Without it, an organization API key reads every project in the organization. A project token reads only its own project and requires --project. Credentials need the connections:read scope.", "usage": ["polymorfa calls stats [flags]"], "aliases": [], "hidden": false, @@ -15699,6 +15699,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Include only calls on this connection.", + "env": null, + "helpGroup": null + }, { "name": "direction", "char": null, @@ -15718,8 +15730,8 @@ "required": false, "multiple": false, "default": "day", - "options": ["day", "hour", "session", "outcome"], - "description": "Group the results by day, hour, session, or outcome.", + "options": ["day", "hour", "connection", "outcome"], + "description": "Group the results by day, hour, connection, or outcome.", "env": null, "helpGroup": null }, @@ -15825,18 +15837,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Include only calls on this session (number).", - "env": null, - "helpGroup": null - }, { "name": "since", "char": null, @@ -15893,7 +15893,7 @@ "multiple": false, "default": null, "options": ["linked_device", "cloud_api"], - "description": "Include only numbers that connect this way.", + "description": "Include only connections that connect this way.", "env": null, "helpGroup": null }, @@ -15913,7 +15913,7 @@ "examples": [ {"command": "polymorfa calls stats", "description": ""}, { - "command": "polymorfa calls stats --project 018f0000-0000-7000-8000-000000000002 --group-by session", + "command": "polymorfa calls stats --project 018f0000-0000-7000-8000-000000000002 --group-by connection", "description": "" }, { @@ -15930,8 +15930,8 @@ }, { "id": "calls view", - "summary": "Read one stored call and its bounded metadata history. Requires sessions:read and a server credential. Use --json for participants, connections and reported diagnostics. No audio, video, event payload or webhook delivery data is returned.", - "description": "Read one stored call and its bounded metadata history. Requires sessions:read and a server credential. Use --json for participants, connections and reported diagnostics. No audio, video, event payload or webhook delivery data is returned.", + "summary": "Read one stored call and its bounded metadata history. Requires connections:read and a server credential. Use --json for participants, connections and reported diagnostics. No audio, video, event payload or webhook delivery data is returned.", + "description": "Read one stored call and its bounded metadata history. Requires connections:read and a server credential. Use --json for participants, connections and reported diagnostics. No audio, video, event payload or webhook delivery data is returned.", "usage": ["polymorfa calls view ID [flags]"], "aliases": [], "hidden": false, @@ -16060,8 +16060,8 @@ }, { "id": "calls watch", - "summary": "Stream call updates for a session.", - "description": "Stream a session’s inbound calls and their progress: ringing, claims, state and participant changes, and endings. Watching never answers or declines a call. With --json, each line is one JSON object. Press Ctrl-C to stop. Exits with code 3 when the API stops authorizing the credential.", + "summary": "Stream call updates for a connection.", + "description": "Stream a connection’s inbound calls and their progress: ringing, claims, state and participant changes, and endings. Watching never answers or declines a call. With --json, each line is one JSON object. Press Ctrl-C to stop. Exits with code 3 when the API stops authorizing the credential.", "usage": ["polymorfa calls watch [flags]"], "aliases": [], "hidden": false, @@ -16079,6 +16079,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Connection to watch. Required with a server API key; client tokens watch their bound connection.", + "env": null, + "helpGroup": null + }, { "name": "count", "char": null, @@ -16175,18 +16187,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Session to watch. Required with a server API key; client tokens watch their bound session.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -16214,11 +16214,11 @@ ], "examples": [ { - "command": "polymorfa calls watch --session support", + "command": "polymorfa calls watch --connection support", "description": "" }, { - "command": "polymorfa calls watch --session support --participant agent-7 --json", + "command": "polymorfa calls watch --connection support --participant agent-7 --json", "description": "" }, { @@ -16733,7 +16733,7 @@ { "id": "campaign create", "summary": "Create a campaign from one JSON object. Optional beta fields include followUp: one receipt-timed follow-up ({delaySeconds, expirySeconds, message: {type: \"text\", text} or {type: \"template\", templateId}}); teams that are not enrolled receive 403 feature_unavailable.", - "description": "Create a campaign from one JSON object. Optional beta fields include followUp: one receipt-timed follow-up ({delaySeconds, expirySeconds, message: {type: \"text\", text} or {type: \"template\", templateId}}); teams that are not enrolled receive 403 feature_unavailable.\n\nFor Messaging campaigns (--project-slug), A/B tests and weighted message variation are betas that require team enrollment and live feature access; a team without access gets 403 feature_unavailable:\n\n- A/B test: \"variants\" (two to four, each with key, label, integer weight from 1 to 99 and blueprint; weights add up to 100) and \"variantStrategy\" (winnerCriterion delivery, read or reply; holdoutPercent; optional testSlicePercent; autoPromote true; testWindowMinutes). View the results with polymorfa campaign analytics.\n- Weighted message variation: \"messageVariations\", two to five alternatives (key, integer weight from 1 to 99, blueprint; weights add up to 100). Each recipient receives one alternative. Linked-device numbers only.\n\nAn A/B test cannot use templateId. messageVariations cannot be combined with templateId, composed messages or an A/B test.", + "description": "Create a campaign from one JSON object. Optional beta fields include followUp: one receipt-timed follow-up ({delaySeconds, expirySeconds, message: {type: \"text\", text} or {type: \"template\", templateId}}); teams that are not enrolled receive 403 feature_unavailable.\n\nFor Messaging campaigns (--project-slug), A/B tests and weighted message variation are betas that require team enrollment and live feature access; a team without access gets 403 feature_unavailable:\n\n- A/B test: \"variants\" (two to four, each with key, label, integer weight from 1 to 99 and blueprint; weights add up to 100) and \"variantStrategy\" (winnerCriterion delivery, read or reply; holdoutPercent; optional testSlicePercent; autoPromote true; testWindowMinutes). View the results with polymorfa campaign analytics.\n- Weighted message variation: \"messageVariations\", two to five alternatives (key, integer weight from 1 to 99, blueprint; weights add up to 100). Each recipient receives one alternative. Linked-device connections only.\n\nAn A/B test cannot use templateId. messageVariations cannot be combined with templateId, composed messages or an A/B test.", "usage": ["polymorfa campaign create [flags]"], "aliases": [], "hidden": false, @@ -21322,6 +21322,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "description", "char": null, @@ -21430,18 +21442,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -21498,6 +21498,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -21582,18 +21594,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -21662,6 +21662,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -21746,18 +21758,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -21788,8 +21788,8 @@ }, { "id": "channel list", - "summary": "List channels for a connected session.", - "description": "List channels for a connected session.", + "summary": "List channels for a connected connection.", + "description": "List channels for a connected connection.", "usage": ["polymorfa channel list [flags]"], "aliases": [], "hidden": false, @@ -21807,6 +21807,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -21879,18 +21891,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -21947,6 +21947,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -22031,18 +22043,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -22111,6 +22111,18 @@ "env": null, "helpGroup": null }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -22195,18 +22207,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -22271,6 +22271,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -22355,18 +22367,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -22429,6 +22429,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -22525,18 +22537,6 @@ "env": null, "helpGroup": null }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -22605,6 +22605,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -22689,18 +22701,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "since", "char": null, @@ -22769,6 +22769,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -22853,18 +22865,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -22921,6 +22921,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -23005,18 +23017,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -23073,6 +23073,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -23158,157 +23170,145 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "timeout", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Fail the request after this many milliseconds.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "verbose", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Explain context and workflow decisions.", + "env": null, + "helpGroup": "GLOBAL" + } + ], + "examples": [], + "state": null + }, + { + "id": "channel view", + "summary": "View one channel.", + "description": "View one channel.", + "usage": ["polymorfa channel view CHANNEL [flags]"], + "aliases": [], + "hidden": false, + "args": [ + { + "name": "channel", + "description": "Channel ID.", + "required": true, + "options": [] + } + ], + "flags": [ + { + "name": "api-version", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Override the API version for this request.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, - { - "name": "timeout", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Fail the request after this many milliseconds.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "verbose", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Explain context and workflow decisions.", - "env": null, - "helpGroup": "GLOBAL" - } - ], - "examples": [], - "state": null - }, - { - "id": "channel view", - "summary": "View one channel.", - "description": "View one channel.", - "usage": ["polymorfa channel view CHANNEL [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "channel", - "description": "Channel ID.", - "required": true, - "options": [] - } - ], - "flags": [ - { - "name": "api-version", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Override the API version for this request.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "json", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Print one JSON document.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "no-color", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Disable color output.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "owner", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "profile", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Use a named authentication profile.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "project", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Use a project other than the active context.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "quiet", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Suppress successful output.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, + { + "name": "json", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Print one JSON document.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "no-color", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Disable color output.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "owner", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "profile", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Use a named authentication profile.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "project", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Use a project other than the active context.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "quiet", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Suppress successful output.", + "env": null, + "helpGroup": "GLOBAL" + }, { "name": "timeout", "char": null, @@ -23339,8 +23339,8 @@ }, { "id": "chat list", - "summary": "List stored chats for an enrolled HMS Number (beta). Requires chats:read.", - "description": "List stored chats for an enrolled HMS Number (beta). Requires chats:read.", + "summary": "List stored chats for an enrolled HMS Connection (beta). Requires chats:read.", + "description": "List stored chats for an enrolled HMS Connection (beta). Requires chats:read.", "usage": ["polymorfa chat list [flags]"], "aliases": [], "hidden": false, @@ -23382,6 +23382,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "cursor", "char": null, @@ -23490,18 +23502,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -23532,8 +23532,8 @@ }, { "id": "chat message list", - "summary": "List stored messages in a chat for an enrolled HMS Number (beta). Requires messages:read.", - "description": "List stored messages in a chat for an enrolled HMS Number (beta). Requires messages:read.", + "summary": "List stored messages in a chat for an enrolled HMS Connection (beta). Requires messages:read.", + "description": "List stored messages in a chat for an enrolled HMS Connection (beta). Requires messages:read.", "usage": ["polymorfa chat message list CONVERSATION [flags]"], "aliases": [], "hidden": false, @@ -23558,6 +23558,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "cursor", "char": null, @@ -23678,18 +23690,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "since", "char": null, @@ -23756,8 +23756,8 @@ }, { "id": "chat message media", - "summary": "Download a stored Official API message media copy for an enrolled HMS Number (beta). Requires messages:read and media:read.", - "description": "Download a stored Official API message media copy for an enrolled HMS Number (beta). Requires messages:read and media:read.", + "summary": "Download a stored Official API message media copy for an enrolled HMS Connection (beta). Requires messages:read and media:read.", + "description": "Download a stored Official API message media copy for an enrolled HMS Connection (beta). Requires messages:read and media:read.", "usage": ["polymorfa chat message media CONVERSATION MESSAGE [flags]"], "aliases": [], "hidden": false, @@ -23788,6 +23788,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "force", "char": null, @@ -23896,18 +23908,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -23935,7 +23935,7 @@ ], "examples": [ { - "command": "polymorfa chat message media +15550001111 739182640518204 --session NUMBER_ID --output ./attachment.bin", + "command": "polymorfa chat message media +15550001111 739182640518204 --connection NUMBER_ID --output ./attachment.bin", "description": "" } ], @@ -23943,8 +23943,8 @@ }, { "id": "chat message view", - "summary": "View one stored message for an enrolled HMS Number (beta). Requires messages:read.", - "description": "View one stored message for an enrolled HMS Number (beta). Requires messages:read.", + "summary": "View one stored message for an enrolled HMS Connection (beta). Requires messages:read.", + "description": "View one stored message for an enrolled HMS Connection (beta). Requires messages:read.", "usage": ["polymorfa chat message view CONVERSATION MESSAGE [flags]"], "aliases": [], "hidden": false, @@ -23975,6 +23975,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -24047,18 +24059,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -24089,8 +24089,8 @@ }, { "id": "chat view", - "summary": "View one stored chat for an enrolled HMS Number (beta). Requires chats:read.", - "description": "View one stored chat for an enrolled HMS Number (beta). Requires chats:read.", + "summary": "View one stored chat for an enrolled HMS Connection (beta). Requires chats:read.", + "description": "View one stored chat for an enrolled HMS Connection (beta). Requires chats:read.", "usage": ["polymorfa chat view CONVERSATION [flags]"], "aliases": [], "hidden": false, @@ -24115,6 +24115,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -24187,18 +24199,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -24229,8 +24229,8 @@ }, { "id": "cloud catalog list", - "summary": "List visible Meta product catalogs for a WhatsApp Business Account. Requires sessions:read and Graph access.", - "description": "List visible Meta product catalogs for a WhatsApp Business Account. Requires sessions:read and Graph access.", + "summary": "List visible Meta product catalogs for a WhatsApp Business Account. Requires connections:read and Graph access.", + "description": "List visible Meta product catalogs for a WhatsApp Business Account. Requires connections:read and Graph access.", "usage": ["polymorfa cloud catalog list [flags]"], "aliases": [], "hidden": false, @@ -24398,8 +24398,8 @@ }, { "id": "cloud catalog products", - "summary": "List products in a catalog linked to an Official API WABA (beta). Requires sessions:read and Graph access.", - "description": "List products in a catalog linked to an Official API WABA (beta). Requires sessions:read and Graph access.", + "summary": "List products in a catalog linked to an Official API WABA (beta). Requires connections:read and Graph access.", + "description": "List products in a catalog linked to an Official API WABA (beta). Requires connections:read and Graph access.", "usage": ["polymorfa cloud catalog products [flags]"], "aliases": [], "hidden": false, @@ -24579,8 +24579,8 @@ }, { "id": "cloud credentials get", - "summary": "Read redacted Meta credential checks for an enrolled Official API Number (beta). Requires sessions:read.", - "description": "Read redacted Meta credential checks for an enrolled Official API Number (beta). Requires sessions:read.", + "summary": "Read redacted Meta credential checks for an enrolled Official API Connection (beta). Requires connections:read.", + "description": "Read redacted Meta credential checks for an enrolled Official API Connection (beta). Requires connections:read.", "usage": ["polymorfa cloud credentials get [flags]"], "aliases": [], "hidden": false, @@ -24598,6 +24598,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -24670,18 +24682,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -24712,8 +24712,8 @@ }, { "id": "cloud credentials reauthorize", - "summary": "Create one reauthorization QuickLink for a stopped or disconnected standalone Official API Number (beta). Requires quicklink:manage. Never stops the Number or retries link creation.", - "description": "Create one reauthorization QuickLink for a stopped or disconnected standalone Official API Number (beta). Requires quicklink:manage. Never stops the Number or retries link creation.", + "summary": "Create one reauthorization QuickLink for a stopped or disconnected standalone Official API Connection (beta). Requires quicklink:manage. Never stops the Connection or retries link creation.", + "description": "Create one reauthorization QuickLink for a stopped or disconnected standalone Official API Connection (beta). Requires quicklink:manage. Never stops the Connection or retries link creation.", "usage": ["polymorfa cloud credentials reauthorize [flags]"], "aliases": [], "hidden": false, @@ -24731,6 +24731,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -24803,18 +24815,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -24864,6 +24864,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "description", "char": null, @@ -24972,18 +24984,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "subject", "char": null, @@ -25052,6 +25052,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -25136,18 +25148,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -25216,6 +25216,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -25288,18 +25300,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -25356,6 +25356,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -25452,18 +25464,6 @@ "env": null, "helpGroup": null }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -25520,6 +25520,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -25616,18 +25628,6 @@ "env": null, "helpGroup": null }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -25708,6 +25708,18 @@ "env": null, "helpGroup": null }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -25780,18 +25792,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -25848,6 +25848,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -25944,18 +25956,6 @@ "env": null, "helpGroup": null }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -25986,8 +25986,8 @@ }, { "id": "cloud group list", - "summary": "List Official groups on an Official API Number (beta). Requires groups:read and team enrollment.", - "description": "List Official groups on an Official API Number (beta). Requires groups:read and team enrollment.", + "summary": "List Official groups on an Official API Connection (beta). Requires groups:read and team enrollment.", + "description": "List Official groups on an Official API Connection (beta). Requires groups:read and team enrollment.", "usage": ["polymorfa cloud group list [flags]"], "aliases": [], "hidden": false, @@ -26029,6 +26029,18 @@ "env": null, "helpGroup": null }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -26113,18 +26125,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -26181,6 +26181,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "days", "char": null, @@ -26289,18 +26301,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -26369,6 +26369,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -26465,18 +26477,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -26533,6 +26533,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "description", "char": null, @@ -26629,18 +26641,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "subject", "char": null, @@ -26683,8 +26683,8 @@ }, { "id": "cloud marketing status", - "summary": "Read raw Marketing Messages WABA status strings (beta). Requires sessions:read and Graph access.", - "description": "Read raw Marketing Messages WABA status strings (beta). Requires sessions:read and Graph access.", + "summary": "Read raw Marketing Messages WABA status strings (beta). Requires connections:read and Graph access.", + "description": "Read raw Marketing Messages WABA status strings (beta). Requires connections:read and Graph access.", "usage": ["polymorfa cloud marketing status [flags]"], "aliases": [], "hidden": false, @@ -26818,7 +26818,7 @@ "multiple": false, "default": null, "options": [], - "description": "WhatsApp Business Account ID from an Official API Number in your project.", + "description": "WhatsApp Business Account ID from an Official API Connection in your project.", "env": null, "helpGroup": null } @@ -26828,8 +26828,8 @@ }, { "id": "cloud pricing", - "summary": "Read Meta-reported message counts (beta), without prices or invoice amounts. Requires sessions:read and service-window enrollment.", - "description": "Read Meta-reported message counts (beta), without prices or invoice amounts. Requires sessions:read and service-window enrollment.", + "summary": "Read Meta-reported message counts (beta), without prices or invoice amounts. Requires connections:read and service-window enrollment.", + "description": "Read Meta-reported message counts (beta), without prices or invoice amounts. Requires connections:read and service-window enrollment.", "usage": ["polymorfa cloud pricing [flags]"], "aliases": [], "hidden": false, @@ -26847,6 +26847,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -26919,18 +26931,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "since", "char": null, @@ -27011,6 +27011,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -27083,18 +27095,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -27144,6 +27144,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -27240,18 +27252,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -27308,6 +27308,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -27392,18 +27404,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -27472,6 +27472,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "input", "char": null, @@ -27568,18 +27580,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -27636,6 +27636,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -27720,18 +27732,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -27762,8 +27762,8 @@ }, { "id": "cloud template list", - "summary": "List the refreshed Meta template catalog for an Official API Number (beta). Requires messages:write.", - "description": "List the refreshed Meta template catalog for an Official API Number (beta). Requires messages:write.", + "summary": "List the refreshed Meta template catalog for an Official API Connection (beta). Requires messages:write.", + "description": "List the refreshed Meta template catalog for an Official API Connection (beta). Requires messages:write.", "usage": ["polymorfa cloud template list [flags]"], "aliases": [], "hidden": false, @@ -27781,6 +27781,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging Connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -27853,18 +27865,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging Number ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -27917,44 +27917,37 @@ "state": null }, { - "id": "contact block", - "summary": "Block a contact.", - "description": "Block a contact.", - "usage": ["polymorfa contact block CONTACT [flags]"], + "id": "connection-ban list", + "summary": "List recorded organization connection bans.", + "description": "List recorded organization connection bans.", + "usage": ["polymorfa connection-ban list [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "contact", - "description": "Polymorfa contact ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { - "name": "api-version", + "name": "active", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Override the API version for this request.", + "description": "Return only active bans.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "idempotency-key", + "name": "api-version", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this block action.", + "description": "Override the API version for this request.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "json", @@ -28029,16 +28022,132 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "timeout", "char": null, "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Fail the request after this many milliseconds.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "verbose", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Explain context and workflow decisions.", + "env": null, + "helpGroup": "GLOBAL" + } + ], + "examples": [], + "state": null + }, + { + "id": "connection capabilities", + "summary": "Show the WhatsApp features and limits WhatsApp has enabled for a Connection, as of the Connection's last configuration sync. Beta: the team must be enrolled.", + "description": "Show the WhatsApp features and limits WhatsApp has enabled for a Connection, as of the Connection's last configuration sync. Beta: the team must be enrolled.", + "usage": ["polymorfa connection capabilities CONNECTION [flags]"], + "aliases": [], + "hidden": false, + "args": [ + { + "name": "connection", + "description": "Connection ID or name.", "required": true, + "options": [] + } + ], + "flags": [ + { + "name": "api-version", + "char": null, + "type": "option", + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Override the API version for this request.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" + }, + { + "name": "json", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Print one JSON document.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "no-color", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Disable color output.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "owner", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "profile", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Use a named authentication profile.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "project", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Use a project other than the active context.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "quiet", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Suppress successful output.", + "env": null, + "helpGroup": "GLOBAL" }, { "name": "timeout", @@ -28065,17 +28174,33 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa connection capabilities support-line", + "description": "" + }, + { + "command": "polymorfa connection capabilities support-line --json", + "description": "" + } + ], "state": null }, { - "id": "contact blocklist", - "summary": "View the account contact blocklist.", - "description": "View the account contact blocklist.", - "usage": ["polymorfa contact blocklist [flags]"], + "id": "connection configuration get", + "summary": "Read effective connection configuration, inheritance sources and revisions.", + "description": "Read effective connection configuration, inheritance sources and revisions.", + "usage": ["polymorfa connection configuration get CONNECTION [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "connection", + "description": "Connection ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -28162,17 +28287,145 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "timeout", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Fail the request after this many milliseconds.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "verbose", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Explain context and workflow decisions.", + "env": null, + "helpGroup": "GLOBAL" + } + ], + "examples": [], + "state": null + }, + { + "id": "connection configuration update", + "summary": "Set configuration overrides or reset them to inherited defaults using a revision.", + "description": "Set configuration overrides or reset them to inherited defaults using a revision.", + "usage": ["polymorfa connection configuration update CONNECTION [flags]"], + "aliases": [], + "hidden": false, + "args": [ + { + "name": "connection", + "description": "Connection ID.", + "required": true, + "options": [] + } + ], + "flags": [ + { + "name": "api-version", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Override the API version for this request.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "input", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "JSON file or stdin (-), containing revision and configuration.set/reset.", "env": null, "helpGroup": null }, + { + "name": "json", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Print one JSON document.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "no-color", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Disable color output.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "owner", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "profile", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Use a named authentication profile.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "project", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Use a project other than the active context.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "quiet", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Suppress successful output.", + "env": null, + "helpGroup": "GLOBAL" + }, { "name": "timeout", "char": null, @@ -28202,16 +28455,16 @@ "state": null }, { - "id": "contact business-profile", - "summary": "Get a contact’s WhatsApp business profile.", - "description": "Get a contact’s WhatsApp business profile.", - "usage": ["polymorfa contact business-profile CONTACT [flags]"], + "id": "connection delete", + "summary": "Permanently remove matching connections from management.", + "description": "Permanently remove matching connections from management.", + "usage": ["polymorfa connection delete CONNECTIONS [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "contact", - "description": "Polymorfa contact ID.", + "name": "connections", + "description": "One to 100 connection UUIDs or stable slugs.", "required": true, "options": [] } @@ -28229,6 +28482,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Identify this attempt (a retry counts only rows still present).", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -28302,50 +28567,50 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "verbose", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "yes", "char": null, "type": "boolean", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Confirm permanent removal of every supplied connection.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null } ], "examples": [], "state": null }, { - "id": "contact check", - "summary": "Check whether one or more phone numbers are registered on WhatsApp.", - "description": "Check whether one or more phone numbers are registered on WhatsApp.", - "usage": ["polymorfa contact check [flags]"], + "id": "connection hybrid-merge-candidates", + "summary": "List same-number Connection pairs that can merge into one Hybrid Link Connection.", + "description": "List same-number Connection pairs that can merge into one Hybrid Link Connection.\n\nEach pair is one Linked Devices Connection and one Official API Connection that shares the number with the WhatsApp Business app. Merge an eligible pair with `connection tier quote KEEP_UUID --tier pro --merge-with OTHER_UUID`. A Connection marked \"must be kept\" uses hosted message storage and cannot be the one merged away. Requires Hybrid Link access.", + "usage": ["polymorfa connection hybrid-merge-candidates [flags]"], "aliases": [], "hidden": false, "args": [], @@ -28398,18 +28663,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "phone", - "char": null, - "type": "option", - "required": true, - "multiple": true, - "default": null, - "options": [], - "description": "Phone number to check; repeat for multiple numbers.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -28446,18 +28699,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -28483,24 +28724,22 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa connection hybrid-merge-candidates --project PROJECT_UUID", + "description": "" + } + ], "state": null }, { - "id": "contact devices", - "summary": "List a contact’s linked devices.", - "description": "List a contact’s linked devices.", - "usage": ["polymorfa contact devices CONTACT [flags]"], + "id": "connection list", + "summary": "List connection metadata for the team or one project. Requires an organization API key with connections:read.", + "description": "List connection metadata for the team or one project. Requires an organization API key with connections:read.", + "usage": ["polymorfa connection list [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "contact", - "description": "Polymorfa contact ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -28586,18 +28825,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -28623,20 +28850,26 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + {"command": "polymorfa connection list", "description": ""}, + { + "command": "polymorfa connection list --project PROJECT_ID --json", + "description": "" + } + ], "state": null }, { - "id": "contact info", - "summary": "Get live WhatsApp metadata for a contact.", - "description": "Get live WhatsApp metadata for a contact.", - "usage": ["polymorfa contact info CONTACT [flags]"], + "id": "connection status", + "summary": "Read the stored connection status and reason. Requires an organization API key with connections:read.", + "description": "Read the stored connection status and reason. Requires an organization API key with connections:read.", + "usage": ["polymorfa connection status CONNECTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "contact", - "description": "Polymorfa contact ID.", + "name": "connection", + "description": "Connection ID.", "required": true, "options": [] } @@ -28726,18 +28959,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -28763,17 +28984,29 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa connection status CONNECTION_ID", + "description": "" + } + ], "state": null }, { - "id": "contact list", - "summary": "List all contacts known to a session.", - "description": "List all contacts known to a session.", - "usage": ["polymorfa contact list [flags]"], + "id": "connection stop", + "summary": "Request asynchronous stops for matching managed connections.", + "description": "Request asynchronous stops for matching managed connections.", + "usage": ["polymorfa connection stop CONNECTIONS [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "connections", + "description": "One to 100 connection UUIDs or stable slugs.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -28787,6 +29020,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Identify this attempt (a retry can enqueue another stop request).", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -28859,18 +29104,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -28900,16 +29133,16 @@ "state": null }, { - "id": "contact picture", - "summary": "Get a contact profile-picture URL.", - "description": "Get a contact profile-picture URL.", - "usage": ["polymorfa contact picture CONTACT [flags]"], + "id": "connection tier confirm", + "summary": "Confirm a reviewed Connection tier quote.", + "description": "Confirm a reviewed Connection tier quote.\n\nThis charges the quoted credits and records any Hybrid Link choice in the quote. The CLI never creates or confirms a replacement quote; after a conflict, review a new quote.", + "usage": ["polymorfa connection tier confirm CONNECTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "contact", - "description": "Polymorfa contact ID.", + "name": "connection", + "description": "Connection UUID or stable slug that was quoted.", "required": true, "options": [] } @@ -28927,6 +29160,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Identify this confirmation attempt.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -29000,14 +29245,14 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "quote", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Quote ID returned by `connection tier quote`.", "env": null, "helpGroup": null }, @@ -29034,22 +29279,39 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" + }, + { + "name": "yes", + "char": null, + "type": "boolean", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Confirm the quoted charge and any Hybrid Link connection change.", + "env": null, + "helpGroup": null + } + ], + "examples": [ + { + "command": "polymorfa connection tier confirm support --quote QUOTE_UUID --yes", + "description": "" } ], - "examples": [], "state": null }, { - "id": "contact unblock", - "summary": "Unblock a contact.", - "description": "Unblock a contact.", - "usage": ["polymorfa contact unblock CONTACT [flags]"], + "id": "connection tier quote", + "summary": "Preview a Connection tier change without changing the Connection or spending credit.", + "description": "Preview a Connection tier change without changing the Connection or spending credit.\n\nA Hybrid Link Connection leaving Pro needs a choice: --keep one method, or --split into two Standard Connections. The choice runs when the paid Pro window ends. An upgrade to Pro can merge a same-number pair with --merge-with.", + "usage": ["polymorfa connection tier quote CONNECTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "contact", - "description": "Polymorfa contact ID.", + "name": "connection", + "description": "Connection UUID or stable slug. For a merge, this Connection keeps its ID.", "required": true, "options": [] } @@ -29068,28 +29330,52 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "json", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Print one JSON document.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "keep", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["linked_devices", "official_api"], + "description": "Hybrid Link Connection leaving Pro: keep this method and disconnect the other.", + "env": null, + "helpGroup": null + }, + { + "name": "merge-with", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this unblock action.", + "description": "With --tier pro: UUID of the same-number Connection to merge into this one. It is removed after its method moves, so it must not use hosted message storage.", "env": null, "helpGroup": null }, { - "name": "json", + "name": "new-connection-name", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "With --split: name of the new Connection.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "no-color", @@ -29152,14 +29438,38 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "split", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Hybrid Link Connection leaving Pro: split into two Standard Connections without re-pairing.", + "env": null, + "helpGroup": null + }, + { + "name": "stay", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["linked_devices", "official_api"], + "description": "With --split: the method that stays on this Connection; the other moves to the new Connection.", + "env": null, + "helpGroup": null + }, + { + "name": "tier", "char": null, "type": "option", "required": true, "multiple": false, "default": null, - "options": [], - "description": "Messaging session ID.", + "options": ["free", "standard", "pro", "inherit"], + "description": "Target tier. \"inherit\" restores the project default tier.", "env": null, "helpGroup": null }, @@ -29188,20 +29498,43 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa connection tier quote support --tier pro", + "description": "" + }, + { + "command": "polymorfa connection tier quote support --tier standard --keep linked_devices", + "description": "" + }, + { + "command": "polymorfa connection tier quote support --tier standard --split --stay official_api --new-connection-name support-linked", + "description": "" + }, + { + "command": "polymorfa connection tier quote CONNECTION_UUID --tier pro --merge-with OTHER_CONNECTION_UUID", + "description": "" + } + ], "state": null }, { - "id": "contact view", - "summary": "View stored contact data known to a session.", - "description": "View stored contact data known to a session.", - "usage": ["polymorfa contact view CONTACT [flags]"], + "id": "connection tier status", + "summary": "Read a Connection tier change and its Hybrid Link transition.", + "description": "Read a Connection tier change and its Hybrid Link transition.\n\nThe tier change is queued until applied or rejected. A Hybrid Link transition reports its own status: scheduled, running, completed, failed or cancelled.", + "usage": ["polymorfa connection tier status CONNECTION QUOTE [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "contact", - "description": "Polymorfa contact ID.", + "name": "connection", + "description": "Connection UUID or stable slug.", + "required": true, + "options": [] + }, + { + "name": "quote", + "description": "Quote ID of the tier change.", "required": true, "options": [] } @@ -29291,18 +29624,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -29328,20 +29649,25 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa connection tier status support QUOTE_UUID", + "description": "" + } + ], "state": null }, { - "id": "customer archive", - "summary": "Archive a non-default Customer.", - "description": "Archive a non-default Customer.", - "usage": ["polymorfa customer archive CUSTOMER [flags]"], + "id": "connection view", + "summary": "Read one connection by its ID. Requires an organization API key with connections:read.", + "description": "Read one connection by its ID. Requires an organization API key with connections:read.", + "usage": ["polymorfa connection view CONNECTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "customer", - "description": "Customer ID.", + "name": "connection", + "description": "Connection ID.", "required": true, "options": [] } @@ -29359,18 +29685,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Identify this archive attempt for safe retries.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -29466,31 +29780,31 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, + } + ], + "examples": [ { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm Customer archival.", - "env": null, - "helpGroup": null + "command": "polymorfa connection view CONNECTION_ID --json", + "description": "" } ], - "examples": [], "state": null }, { - "id": "customer create", - "summary": "Create a Customer.", - "description": "Create a Customer.", - "usage": ["polymorfa customer create [flags]"], + "id": "contact block", + "summary": "Block a contact.", + "description": "Block a contact.", + "usage": ["polymorfa contact block CONTACT [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "contact", + "description": "Polymorfa contact ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -29505,14 +29819,14 @@ "helpGroup": "GLOBAL" }, { - "name": "external-id", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Caller-defined Customer ID.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -29520,11 +29834,11 @@ "name": "idempotency-key", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Identify this create attempt for safe retries.", + "description": "Safely identify retries of this block action.", "env": null, "helpGroup": null }, @@ -29540,18 +29854,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "name", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Customer name.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -29641,10 +29943,10 @@ "state": null }, { - "id": "customer enable", - "summary": "Enable Customers and assign existing Numbers to the default Customer.", - "description": "Enable Customers and assign existing Numbers to the default Customer.", - "usage": ["polymorfa customer enable [flags]"], + "id": "contact blocklist", + "summary": "View the account contact blocklist.", + "description": "View the account contact blocklist.", + "usage": ["polymorfa contact blocklist [flags]"], "aliases": [], "hidden": false, "args": [], @@ -29662,14 +29964,14 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Identify this enablement attempt for safe retries.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -29774,16 +30076,16 @@ "state": null }, { - "id": "customer event list", - "summary": "List recent events for a Customer.", - "description": "List recent events for a Customer.", - "usage": ["polymorfa customer event list CUSTOMER [flags]"], + "id": "contact business-profile", + "summary": "Get a contact’s WhatsApp business profile.", + "description": "Get a contact’s WhatsApp business profile.", + "usage": ["polymorfa contact business-profile CONTACT [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "customer", - "description": "Customer ID.", + "name": "contact", + "description": "Polymorfa contact ID.", "required": true, "options": [] } @@ -29802,28 +30104,28 @@ "helpGroup": "GLOBAL" }, { - "name": "json", + "name": "connection", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Messaging connection ID.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "limit", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Maximum events to return.", + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "no-color", @@ -29914,10 +30216,10 @@ "state": null }, { - "id": "customer list", - "summary": "List Customers in one project.", - "description": "List Customers in one project.", - "usage": ["polymorfa customer list [flags]"], + "id": "contact check", + "summary": "Check whether one or more phone numbers are registered on WhatsApp.", + "description": "Check whether one or more phone numbers are registered on WhatsApp.", + "usage": ["polymorfa contact check [flags]"], "aliases": [], "hidden": false, "args": [], @@ -29935,38 +30237,14 @@ "helpGroup": "GLOBAL" }, { - "name": "cursor", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Continue from this cursor.", - "env": null, - "helpGroup": null - }, - { - "name": "default", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["true", "false"], - "description": "Filter by default-Customer status.", - "env": null, - "helpGroup": null - }, - { - "name": "has-numbers", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["true", "false"], - "description": "Filter by whether a Customer has assigned Numbers.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -29982,30 +30260,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "limit", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Maximum Customers to return.", - "env": null, - "helpGroup": null - }, - { - "name": "needs-attention", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["true", "false"], - "description": "Filter by whether a Customer needs attention.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -30030,6 +30284,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "phone", + "char": null, + "type": "option", + "required": true, + "multiple": true, + "default": null, + "options": [], + "description": "Phone number to check; repeat for multiple phone numbers.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -30066,30 +30332,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "search", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Search Customer profile fields.", - "env": null, - "helpGroup": null - }, - { - "name": "status", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["active", "archiving", "archived", "all"], - "description": "Filter by Customer status.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -30119,16 +30361,16 @@ "state": null }, { - "id": "customer number list", - "summary": "List Numbers assigned to a Customer.", - "description": "List Numbers assigned to a Customer.", - "usage": ["polymorfa customer number list CUSTOMER [flags]"], + "id": "contact devices", + "summary": "List a contact’s linked devices.", + "description": "List a contact’s linked devices.", + "usage": ["polymorfa contact devices CONTACT [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "customer", - "description": "Customer ID.", + "name": "contact", + "description": "Polymorfa contact ID.", "required": true, "options": [] } @@ -30146,6 +30388,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -30247,22 +30501,16 @@ "state": null }, { - "id": "customer number transfer", - "summary": "Transfer a Number between Customers.", - "description": "Transfer a Number between Customers.", - "usage": ["polymorfa customer number transfer CUSTOMER SESSION [flags]"], + "id": "contact info", + "summary": "Get live WhatsApp metadata for a contact.", + "description": "Get live WhatsApp metadata for a contact.", + "usage": ["polymorfa contact info CONTACT [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "customer", - "description": "Destination Customer ID.", - "required": true, - "options": [] - }, - { - "name": "session", - "description": "Number session ID or slug.", + "name": "contact", + "description": "Polymorfa contact ID.", "required": true, "options": [] } @@ -30281,26 +30529,14 @@ "helpGroup": "GLOBAL" }, { - "name": "from", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Source Customer ID.", - "env": null, - "helpGroup": null - }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Identify this transfer attempt for safe retries.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -30399,38 +30635,19 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, - { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm the Number transfer.", - "env": null, - "helpGroup": null } ], "examples": [], "state": null }, { - "id": "customer pairing-link create", - "summary": "Create a Customer pairing link.", - "description": "Create a Customer pairing link.", - "usage": ["polymorfa customer pairing-link create CUSTOMER [flags]"], + "id": "contact list", + "summary": "List all contacts known to a connection.", + "description": "List all contacts known to a connection.", + "usage": ["polymorfa contact list [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "customer", - "description": "Customer ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -30445,38 +30662,14 @@ "helpGroup": "GLOBAL" }, { - "name": "expected-phone", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Expected phone number in E.164 format.", - "env": null, - "helpGroup": null - }, - { - "name": "expires-in", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Link lifetime in seconds.", - "env": null, - "helpGroup": null - }, - { - "name": "idempotency-key", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Identify this pairing-link attempt for safe retries.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -30492,18 +30685,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "method", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": ["qr", "phone"], - "description": "Allowed pairing method.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -30593,16 +30774,16 @@ "state": null }, { - "id": "customer pairing-link list", - "summary": "List pairing links for a Customer.", - "description": "List pairing links for a Customer.", - "usage": ["polymorfa customer pairing-link list CUSTOMER [flags]"], + "id": "contact picture", + "summary": "Get a contact profile-picture URL.", + "description": "Get a contact profile-picture URL.", + "usage": ["polymorfa contact picture CONTACT [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "customer", - "description": "Customer ID.", + "name": "contact", + "description": "Polymorfa contact ID.", "required": true, "options": [] } @@ -30620,6 +30801,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -30721,22 +30914,16 @@ "state": null }, { - "id": "customer pairing-link revoke", - "summary": "Revoke an active Customer pairing link.", - "description": "Revoke an active Customer pairing link.", - "usage": ["polymorfa customer pairing-link revoke CUSTOMER LINK [flags]"], + "id": "contact unblock", + "summary": "Unblock a contact.", + "description": "Unblock a contact.", + "usage": ["polymorfa contact unblock CONTACT [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "customer", - "description": "Customer ID.", - "required": true, - "options": [] - }, - { - "name": "link", - "description": "Pairing-link ID.", + "name": "contact", + "description": "Polymorfa contact ID.", "required": true, "options": [] } @@ -30754,6 +30941,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this unblock action.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -30849,34 +31060,22 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, - { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm pairing-link revocation.", - "env": null, - "helpGroup": null } ], "examples": [], "state": null }, { - "id": "customer restore", - "summary": "Restore an archived Customer.", - "description": "Restore an archived Customer.", - "usage": ["polymorfa customer restore CUSTOMER [flags]"], + "id": "contact view", + "summary": "View stored contact data known to a connection.", + "description": "View stored contact data known to a connection.", + "usage": ["polymorfa contact view CONTACT [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "customer", - "description": "Customer ID.", + "name": "contact", + "description": "Polymorfa contact ID.", "required": true, "options": [] } @@ -30895,14 +31094,14 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Identify this restore attempt for safe retries.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -31007,13 +31206,20 @@ "state": null }, { - "id": "customer status", - "summary": "Check whether Customers is enabled for a project.", - "description": "Check whether Customers is enabled for a project.", - "usage": ["polymorfa customer status [flags]"], + "id": "customer archive", + "summary": "Archive a non-default Customer.", + "description": "Archive a non-default Customer.", + "usage": ["polymorfa customer archive CUSTOMER [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "customer", + "description": "Customer ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -31027,6 +31233,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Identify this archive attempt for safe retries.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -31122,16 +31340,28 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" + }, + { + "name": "yes", + "char": null, + "type": "boolean", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Confirm Customer archival.", + "env": null, + "helpGroup": null } ], "examples": [], "state": null }, { - "id": "customer update", - "summary": "Update Customer profile fields.", - "description": "Update Customer profile fields.", - "usage": ["polymorfa customer update CUSTOMER [flags]"], + "id": "customer connection list", + "summary": "List Connections assigned to a Customer.", + "description": "List Connections assigned to a Customer.", + "usage": ["polymorfa customer connection list CUSTOMER [flags]"], "aliases": [], "hidden": false, "args": [ @@ -31155,42 +31385,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "clear-external-id", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Clear the caller-defined Customer ID.", - "env": null, - "helpGroup": null - }, - { - "name": "clear-name", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Clear the Customer name.", - "env": null, - "helpGroup": null - }, - { - "name": "external-id", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "New caller-defined Customer ID.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -31203,18 +31397,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "name", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "New Customer name.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -31304,16 +31486,24 @@ "state": null }, { - "id": "customer view", - "summary": "View one Customer.", - "description": "View one Customer.", - "usage": ["polymorfa customer view CUSTOMER [flags]"], + "id": "customer connection transfer", + "summary": "Transfer a Connection between Customers.", + "description": "Transfer a Connection between Customers.", + "usage": [ + "polymorfa customer connection transfer CUSTOMER CONNECTION [flags]" + ], "aliases": [], "hidden": false, "args": [ { "name": "customer", - "description": "Customer ID.", + "description": "Destination Customer ID.", + "required": true, + "options": [] + }, + { + "name": "connection", + "description": "Connection ID or slug.", "required": true, "options": [] } @@ -31331,6 +31521,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "from", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Source Customer ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Identify this transfer attempt for safe retries.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -31426,104 +31640,67 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - } - ], - "examples": [], - "state": null - }, - { - "id": "docs open", - "summary": "Open one published Polymorfa documentation page in your browser.", - "description": "Open one published Polymorfa documentation page in your browser.", - "usage": ["polymorfa docs open PAGE [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "page", - "description": "Full page path from docs search, or a unique final path segment.", - "required": true, - "options": [] - } - ], - "flags": [ + }, { - "name": "print", + "name": "yes", "char": null, "type": "boolean", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Print the URL without opening a browser.", + "description": "Confirm the Connection transfer.", "env": null, "helpGroup": null } ], - "examples": [ - {"command": "polymorfa docs open api/rate-limits", "description": ""}, - {"command": "polymorfa docs open quickstart --print", "description": ""} - ], + "examples": [], "state": null }, { - "id": "docs search", - "summary": "Search the published Polymorfa documentation from the terminal.", - "description": "Search the published Polymorfa documentation from the terminal.", - "usage": ["polymorfa docs search QUERY [flags]"], + "id": "customer create", + "summary": "Create a Customer.", + "description": "Create a Customer.", + "usage": ["polymorfa customer create [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "query", - "description": "Words to find in page titles, paths, and descriptions.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { - "name": "json", + "name": "api-version", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print matching pages as JSON.", + "description": "Override the API version for this request.", "env": null, - "helpGroup": null - } - ], - "examples": [ - {"command": "polymorfa docs search webhooks", "description": ""}, - { - "command": "polymorfa docs search \"rate limits\" --json", - "description": "" - } - ], - "state": null - }, - { - "id": "doctor", - "summary": "Check Node.js, config, keyring access, API reachability, and server API key validity. Exits 1 if validation fails or is skipped.", - "description": "Check Node.js, config, keyring access, API reachability, and server API key validity. Exits 1 if validation fails or is skipped.", - "usage": ["polymorfa doctor [flags]"], - "aliases": [], - "hidden": false, - "args": [], - "flags": [ + "helpGroup": "GLOBAL" + }, { - "name": "api-version", + "name": "external-id", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Override the API version for this request.", + "description": "Caller-defined Customer ID.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Identify this create attempt for safe retries.", + "env": null, + "helpGroup": null }, { "name": "json", @@ -31537,6 +31714,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "name", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Customer name.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -31622,17 +31811,14 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - {"command": "polymorfa doctor", "description": ""}, - {"command": "polymorfa doctor --profile work --json", "description": ""} - ], + "examples": [], "state": null }, { - "id": "event list", - "summary": "List retained events for an explicit owner.", - "description": "List retained events for an explicit owner.", - "usage": ["polymorfa event list [flags]"], + "id": "customer enable", + "summary": "Enable Customers and assign existing Connections to the default Customer.", + "description": "Enable Customers and assign existing Connections to the default Customer.", + "usage": ["polymorfa customer enable [flags]"], "aliases": [], "hidden": false, "args": [], @@ -31650,14 +31836,14 @@ "helpGroup": "GLOBAL" }, { - "name": "cursor", + "name": "idempotency-key", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Continue from this opaque cursor.", + "description": "Identify this enablement attempt for safe retries.", "env": null, "helpGroup": null }, @@ -31673,30 +31859,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "limit", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": 25, - "options": [], - "description": "Request this many resources per page.", - "env": null, - "helpGroup": null - }, - { - "name": "max-items", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Stop automatic pagination after this many resources.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -31721,18 +31883,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "paginate", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Request consecutive pages until --max-items resources are collected or no pages remain. Requires --max-items.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -31769,18 +31919,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "since", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Include events at or after this RFC 3339 time.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -31793,30 +31931,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "type", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Filter by one exact event type.", - "env": null, - "helpGroup": null - }, - { - "name": "until", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Include events before this RFC 3339 time.", - "env": null, - "helpGroup": null - }, { "name": "verbose", "char": null, @@ -31834,16 +31948,16 @@ "state": null }, { - "id": "event replay", - "summary": "Replay one retained event to a webhook.", - "description": "Replay one retained event to a webhook.", - "usage": ["polymorfa event replay EVENT [flags]"], + "id": "customer event list", + "summary": "List recent events for a Customer.", + "description": "List recent events for a Customer.", + "usage": ["polymorfa customer event list CUSTOMER [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "event", - "description": "Event ID.", + "name": "customer", + "description": "Customer ID.", "required": true, "options": [] } @@ -31862,28 +31976,28 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use this key to identify retries; one is generated when omitted.", + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "json", + "name": "limit", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Maximum events to return.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "no-color", @@ -31968,65 +32082,65 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, + } + ], + "examples": [], + "state": null + }, + { + "id": "customer list", + "summary": "List Customers in one project.", + "description": "List Customers in one project.", + "usage": ["polymorfa customer list [flags]"], + "aliases": [], + "hidden": false, + "args": [], + "flags": [ { - "name": "webhook", + "name": "api-version", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Destination webhook ID.", + "description": "Override the API version for this request.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "yes", + "name": "cursor", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Confirm the external effect without prompting.", + "description": "Continue from this cursor.", "env": null, "helpGroup": null - } - ], - "examples": [], - "state": null - }, - { - "id": "event stream", - "summary": "Stream a project's events as they happen, with automatic reconnect and resume. Requires events:listen and the Event streams beta.", - "description": "Stream a project's events as they happen, with automatic reconnect and resume. Requires events:listen and the Event streams beta.", - "usage": ["polymorfa event stream [flags]"], - "aliases": [], - "hidden": false, - "args": [], - "flags": [ + }, { - "name": "api-version", + "name": "default", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Override the API version for this request.", + "options": ["true", "false"], + "description": "Filter by default-Customer status.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "from", + "name": "has-connections", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Resume after this cursor from a previous run; valid for 24 hours.", + "options": ["true", "false"], + "description": "Filter by whether a Customer has assigned Connections.", "env": null, "helpGroup": null }, @@ -32043,40 +32157,40 @@ "helpGroup": "GLOBAL" }, { - "name": "max-events", + "name": "limit", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Stop after this many events.", + "description": "Maximum Customers to return.", "env": null, "helpGroup": null }, { - "name": "no-color", + "name": "needs-attention", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Disable color output.", + "options": ["true", "false"], + "description": "Filter by whether a Customer needs attention.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "on-gap", + "name": "no-color", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, - "default": "continue", - "options": ["continue", "stop"], - "description": "Continue or stop when events after --from expired before delivery.", + "default": null, + "options": [], + "description": "Disable color output.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "owner", @@ -32127,29 +32241,41 @@ "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "search", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Search Customer profile fields.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "type", + "name": "status", "char": null, "type": "option", "required": false, - "multiple": true, + "multiple": false, "default": null, - "options": [], - "description": "Stream an event type or trailing-wildcard pattern such as message.*.", + "options": ["active", "archiving", "archived", "all"], + "description": "Filter by Customer status.", "env": null, "helpGroup": null }, + { + "name": "timeout", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Fail the request after this many milliseconds.", + "env": null, + "helpGroup": "GLOBAL" + }, { "name": "verbose", "char": null, @@ -32163,29 +32289,20 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa event stream --owner project --project 11111111-1111-4111-8111-111111111111 --type \"message.*\"", - "description": "" - }, - { - "command": "polymorfa event stream --owner project --project 11111111-1111-4111-8111-111111111111 --from \"$CURSOR\" --json", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "event view", - "summary": "View one retained event.", - "description": "View one retained event.", - "usage": ["polymorfa event view EVENT [flags]"], + "id": "customer pairing-link create", + "summary": "Create a Customer pairing link.", + "description": "Create a Customer pairing link.", + "usage": ["polymorfa customer pairing-link create CUSTOMER [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "event", - "description": "Event ID.", + "name": "customer", + "description": "Customer ID.", "required": true, "options": [] } @@ -32204,14 +32321,38 @@ "helpGroup": "GLOBAL" }, { - "name": "include-payload", + "name": "expected-phone", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Include the retained payload when it is available.", + "description": "Expected phone number in E.164 format.", + "env": null, + "helpGroup": null + }, + { + "name": "expires-in", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Link lifetime in seconds.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Identify this pairing-link attempt for safe retries.", "env": null, "helpGroup": null }, @@ -32227,6 +32368,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "method", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": ["qr", "phone"], + "description": "Allowed pairing method.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -32316,13 +32469,20 @@ "state": null }, { - "id": "flow create", - "summary": "Create a local project Flow draft. Requires sessions:manage.", - "description": "Create a local project Flow draft. Requires sessions:manage.", - "usage": ["polymorfa flow create [flags]"], + "id": "customer pairing-link list", + "summary": "List pairing links for a Customer.", + "description": "List pairing links for a Customer.", + "usage": ["polymorfa customer pairing-link list CUSTOMER [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "customer", + "description": "Customer ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -32336,18 +32496,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "input", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "JSON file or - for stdin. Project and path identity come from command flags.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -32449,16 +32597,22 @@ "state": null }, { - "id": "flow delete", - "summary": "Delete a local Flow draft. Requires sessions:manage.", - "description": "Delete a local Flow draft. Requires sessions:manage.", - "usage": ["polymorfa flow delete FLOW [flags]"], + "id": "customer pairing-link revoke", + "summary": "Revoke an active Customer pairing link.", + "description": "Revoke an active Customer pairing link.", + "usage": ["polymorfa customer pairing-link revoke CUSTOMER LINK [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "flow", - "description": "Flow draft UUID.", + "name": "customer", + "description": "Customer ID.", + "required": true, + "options": [] + }, + { + "name": "link", + "description": "Pairing-link ID.", "required": true, "options": [] } @@ -32580,7 +32734,7 @@ "multiple": false, "default": null, "options": [], - "description": "Confirm this Flow change.", + "description": "Confirm pairing-link revocation.", "env": null, "helpGroup": null } @@ -32589,16 +32743,16 @@ "state": null }, { - "id": "flow deprecate", - "summary": "Deprecate a published WhatsApp Flow (beta). Requires sessions:manage.", - "description": "Deprecate a published WhatsApp Flow (beta). Requires sessions:manage.", - "usage": ["polymorfa flow deprecate FLOW [flags]"], + "id": "customer restore", + "summary": "Restore an archived Customer.", + "description": "Restore an archived Customer.", + "usage": ["polymorfa customer restore CUSTOMER [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "flow", - "description": "Flow draft UUID.", + "name": "customer", + "description": "Customer ID.", "required": true, "options": [] } @@ -32616,6 +32770,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Identify this restore attempt for safe retries.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -32689,80 +32855,165 @@ "helpGroup": "GLOBAL" }, { - "name": "request-id", + "name": "timeout", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "UUID for this exact provider operation. Reuse to inspect the original receipt.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "verbose", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Explain context and workflow decisions.", + "env": null, + "helpGroup": "GLOBAL" + } + ], + "examples": [], + "state": null + }, + { + "id": "customer status", + "summary": "Check whether Customers is enabled for a project.", + "description": "Check whether Customers is enabled for a project.", + "usage": ["polymorfa customer status [flags]"], + "aliases": [], + "hidden": false, + "args": [], + "flags": [ + { + "name": "api-version", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Number name or ID in the same project.", + "description": "Override the API version for this request.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "json", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Print one JSON document.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "no-color", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Disable color output.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "owner", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "profile", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Use a named authentication profile.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "project", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Use a project other than the active context.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "quiet", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Suppress successful output.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "yes", + "name": "timeout", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Fail the request after this many milliseconds.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "verbose", "char": null, "type": "boolean", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Confirm this Flow change.", + "description": "Explain context and workflow decisions.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" } ], "examples": [], "state": null }, { - "id": "flow discard", - "summary": "Delete a draft from WhatsApp (beta). Requires sessions:manage.", - "description": "Delete a draft from WhatsApp (beta). Requires sessions:manage.", - "usage": ["polymorfa flow discard FLOW [flags]"], + "id": "customer update", + "summary": "Update Customer profile fields.", + "description": "Update Customer profile fields.", + "usage": ["polymorfa customer update CUSTOMER [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "flow", - "description": "Flow draft UUID.", + "name": "customer", + "description": "Customer ID.", "required": true, "options": [] } @@ -32780,6 +33031,42 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "clear-external-id", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Clear the caller-defined Customer ID.", + "env": null, + "helpGroup": null + }, + { + "name": "clear-name", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Clear the Customer name.", + "env": null, + "helpGroup": null + }, + { + "name": "external-id", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "New caller-defined Customer ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -32792,6 +33079,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "name", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "New Customer name.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -32852,30 +33151,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "request-id", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "UUID for this exact provider operation. Reuse to inspect the original receipt.", - "env": null, - "helpGroup": null - }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Number name or ID in the same project.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -32899,34 +33174,22 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, - { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm this Flow change.", - "env": null, - "helpGroup": null } ], "examples": [], "state": null }, { - "id": "flow endpoint delete", - "summary": "Remove a Flow's data endpoint on one Number (beta). WhatsApp requests to it are refused afterwards; receipts are kept. Requires sessions:manage.", - "description": "Remove a Flow's data endpoint on one Number (beta). WhatsApp requests to it are refused afterwards; receipts are kept. Requires sessions:manage.", - "usage": ["polymorfa flow endpoint delete FLOW [flags]"], + "id": "customer view", + "summary": "View one Customer.", + "description": "View one Customer.", + "usage": ["polymorfa customer view CUSTOMER [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "flow", - "description": "Flow draft UUID.", + "name": "customer", + "description": "Customer ID.", "required": true, "options": [] } @@ -33016,18 +33279,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Number name or ID in the same project.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -33051,38 +33302,92 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, + } + ], + "examples": [], + "state": null + }, + { + "id": "docs open", + "summary": "Open one published Polymorfa documentation page in your browser.", + "description": "Open one published Polymorfa documentation page in your browser.", + "usage": ["polymorfa docs open PAGE [flags]"], + "aliases": [], + "hidden": false, + "args": [ { - "name": "yes", + "name": "page", + "description": "Full page path from docs search, or a unique final path segment.", + "required": true, + "options": [] + } + ], + "flags": [ + { + "name": "print", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Confirm removing the endpoint.", + "description": "Print the URL without opening a browser.", "env": null, "helpGroup": null } ], - "examples": [], + "examples": [ + {"command": "polymorfa docs open api/rate-limits", "description": ""}, + {"command": "polymorfa docs open quickstart --print", "description": ""} + ], "state": null }, { - "id": "flow endpoint get", - "summary": "Read a Flow's data endpoint on one Number and the Number's encryption custody (beta). Requires sessions:read.", - "description": "Read a Flow's data endpoint on one Number and the Number's encryption custody (beta). Requires sessions:read.", - "usage": ["polymorfa flow endpoint get FLOW [flags]"], + "id": "docs search", + "summary": "Search the published Polymorfa documentation from the terminal.", + "description": "Search the published Polymorfa documentation from the terminal.", + "usage": ["polymorfa docs search QUERY [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "flow", - "description": "Flow draft UUID.", + "name": "query", + "description": "Words to find in page titles, paths, and descriptions.", "required": true, "options": [] } ], + "flags": [ + { + "name": "json", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Print matching pages as JSON.", + "env": null, + "helpGroup": null + } + ], + "examples": [ + {"command": "polymorfa docs search webhooks", "description": ""}, + { + "command": "polymorfa docs search \"rate limits\" --json", + "description": "" + } + ], + "state": null + }, + { + "id": "doctor", + "summary": "Check Node.js, config, keyring access, API reachability, and server API key validity. Exits 1 if validation fails or is skipped.", + "description": "Check Node.js, config, keyring access, API reachability, and server API key validity. Exits 1 if validation fails or is skipped.", + "usage": ["polymorfa doctor [flags]"], + "aliases": [], + "hidden": false, + "args": [], "flags": [ { "name": "api-version", @@ -33168,18 +33473,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Number name or ID in the same project.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -33205,24 +33498,20 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + {"command": "polymorfa doctor", "description": ""}, + {"command": "polymorfa doctor --profile work --json", "description": ""} + ], "state": null }, { - "id": "flow endpoint receipts", - "summary": "Read a Flow's data-exchange receipts, newest first (beta). Metadata only: no form data, Flow token or response. Requires sessions:read.", - "description": "Read a Flow's data-exchange receipts, newest first (beta). Metadata only: no form data, Flow token or response. Requires sessions:read.", - "usage": ["polymorfa flow endpoint receipts FLOW [flags]"], + "id": "event list", + "summary": "List retained events for an explicit owner.", + "description": "List retained events for an explicit owner.", + "usage": ["polymorfa event list [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "flow", - "description": "Flow draft UUID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -33236,6 +33525,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "cursor", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Continue from this opaque cursor.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -33254,9 +33555,21 @@ "type": "option", "required": false, "multiple": false, + "default": 25, + "options": [], + "description": "Request this many resources per page.", + "env": null, + "helpGroup": null + }, + { + "name": "max-items", + "char": null, + "type": "option", + "required": false, + "multiple": false, "default": null, "options": [], - "description": "1 to 100 receipts.", + "description": "Stop automatic pagination after this many resources.", "env": null, "helpGroup": null }, @@ -33284,6 +33597,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "paginate", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Request consecutive pages until --max-items resources are collected or no pages remain. Requires --max-items.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -33321,14 +33646,14 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "since", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Only this Number (name or ID).", + "description": "Include events at or after this RFC 3339 time.", "env": null, "helpGroup": null }, @@ -33344,6 +33669,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "type", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Filter by one exact event type.", + "env": null, + "helpGroup": null + }, + { + "name": "until", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Include events before this RFC 3339 time.", + "env": null, + "helpGroup": null + }, { "name": "verbose", "char": null, @@ -33361,16 +33710,16 @@ "state": null }, { - "id": "flow endpoint set", - "summary": "Create or replace a Flow's data endpoint on one Number (beta). Requires sessions:manage. forward and function need a Polymorfa-managed key; direct needs your own key. A forward signing secret is printed once. Makes one attempt.", - "description": "Create or replace a Flow's data endpoint on one Number (beta). Requires sessions:manage. forward and function need a Polymorfa-managed key; direct needs your own key. A forward signing secret is printed once. Makes one attempt.", - "usage": ["polymorfa flow endpoint set FLOW [flags]"], + "id": "event replay", + "summary": "Replay one retained event to a webhook.", + "description": "Replay one retained event to a webhook.", + "usage": ["polymorfa event replay EVENT [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "flow", - "description": "Flow draft UUID.", + "name": "event", + "description": "Event ID.", "required": true, "options": [] } @@ -33389,50 +33738,14 @@ "helpGroup": "GLOBAL" }, { - "name": "deployment", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Pin an immutable Function deployment UUID.", - "env": null, - "helpGroup": null - }, - { - "name": "disabled", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Save the endpoint disabled; WhatsApp requests are refused.", - "env": null, - "helpGroup": null - }, - { - "name": "expected-revision", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Replace only when the stored revision matches.", - "env": null, - "helpGroup": null - }, - { - "name": "function", + "name": "idempotency-key", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Function UUID for function mode.", + "description": "Use this key to identify retries; one is generated when omitted.", "env": null, "helpGroup": null }, @@ -33448,18 +33761,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "mode", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": ["forward", "function", "direct"], - "description": "forward: Polymorfa decrypts and forwards signed JSON to --url. function: runs --function. direct: WhatsApp calls --url with your own key.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -33521,84 +33822,65 @@ "helpGroup": "GLOBAL" }, { - "name": "rotate-signing-secret", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Issue a new forward signing secret.", - "env": null, - "helpGroup": null - }, - { - "name": "session", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Number name or ID in the same project.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "verbose", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "url", + "name": "webhook", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "HTTPS URL for forward or direct.", + "description": "Destination webhook ID.", "env": null, "helpGroup": null }, { - "name": "verbose", + "name": "yes", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Confirm the external effect without prompting.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null } ], "examples": [], "state": null }, { - "id": "flow get", - "summary": "Read a project Flow draft. Requires sessions:read.", - "description": "Read a project Flow draft. Requires sessions:read.", - "usage": ["polymorfa flow get FLOW [flags]"], + "id": "event stream", + "summary": "Stream a project's events as they happen, with automatic reconnect and resume. Requires events:listen and the Event streams beta.", + "description": "Stream a project's events as they happen, with automatic reconnect and resume. Requires events:listen and the Event streams beta.", + "usage": ["polymorfa event stream [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "flow", - "description": "Flow draft UUID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -33612,6 +33894,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "from", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Resume after this cursor from a previous run; valid for 24 hours.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -33624,6 +33918,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "max-events", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Stop after this many events.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -33636,6 +33942,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "on-gap", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": "continue", + "options": ["continue", "stop"], + "description": "Continue or stop when events after --from expired before delivery.", + "env": null, + "helpGroup": null + }, { "name": "owner", "char": null, @@ -33696,6 +34014,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "type", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Stream an event type or trailing-wildcard pattern such as message.*.", + "env": null, + "helpGroup": null + }, { "name": "verbose", "char": null, @@ -33709,17 +34039,33 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa event stream --owner project --project 11111111-1111-4111-8111-111111111111 --type \"message.*\"", + "description": "" + }, + { + "command": "polymorfa event stream --owner project --project 11111111-1111-4111-8111-111111111111 --from \"$CURSOR\" --json", + "description": "" + } + ], "state": null }, { - "id": "flow key custody", - "summary": "Read whether Polymorfa holds a Number's Flow encryption key (managed) or not (customer), and recent managed keys (beta). Requires sessions:read.", - "description": "Read whether Polymorfa holds a Number's Flow encryption key (managed) or not (customer), and recent managed keys (beta). Requires sessions:read.", - "usage": ["polymorfa flow key custody [flags]"], + "id": "event view", + "summary": "View one retained event.", + "description": "View one retained event.", + "usage": ["polymorfa event view EVENT [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "event", + "description": "Event ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -33733,6 +34079,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "include-payload", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Include the retained payload when it is available.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -33805,18 +34163,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Number name or ID in the project.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -33846,10 +34192,10 @@ "state": null }, { - "id": "flow key get", - "summary": "Read the public Flow encryption key registered to a Meta phone number. Requires sessions:read.", - "description": "Read the public Flow encryption key registered to a Meta phone number. Requires sessions:read.", - "usage": ["polymorfa flow key get [flags]"], + "id": "flow create", + "summary": "Create a local project Flow draft. Requires connections:manage.", + "description": "Create a local project Flow draft. Requires connections:manage.", + "usage": ["polymorfa flow create [flags]"], "aliases": [], "hidden": false, "args": [], @@ -33867,14 +34213,14 @@ "helpGroup": "GLOBAL" }, { - "name": "graph-version", + "name": "input", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Meta Graph version, for example v26.0.", + "description": "JSON file or - for stdin. Project and path identity come from command flags.", "env": null, "helpGroup": null }, @@ -33914,18 +34260,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "phone-number-id", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Meta phone number ID.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -33991,13 +34325,20 @@ "state": null }, { - "id": "flow key register", - "summary": "Replace the public key used by every dynamic Flow on this Meta phone number. Requires sessions:manage; retain the matching private key on your endpoint.", - "description": "Replace the public key used by every dynamic Flow on this Meta phone number. Requires sessions:manage; retain the matching private key on your endpoint.", - "usage": ["polymorfa flow key register [flags]"], + "id": "flow delete", + "summary": "Delete a local Flow draft. Requires connections:manage.", + "description": "Delete a local Flow draft. Requires connections:manage.", + "usage": ["polymorfa flow delete FLOW [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "flow", + "description": "Flow draft UUID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -34011,30 +34352,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "graph-version", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Meta Graph version, for example v26.0.", - "env": null, - "helpGroup": null - }, - { - "name": "input", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "JSON file containing business_public_key, or - for stdin.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -34071,18 +34388,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "phone-number-id", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Meta phone number ID.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -34151,7 +34456,7 @@ "multiple": false, "default": null, "options": [], - "description": "Confirm replacing the public key for every Flow on this phone number.", + "description": "Confirm this Flow change.", "env": null, "helpGroup": null } @@ -34160,13 +34465,20 @@ "state": null }, { - "id": "flow key rotate", - "summary": "Generate and register a new Polymorfa-managed Flow encryption key for a Number (beta). Every dynamic Flow on the Number uses it; the previous managed key decrypts for 24 hours. Requires sessions:manage. Makes one attempt.", - "description": "Generate and register a new Polymorfa-managed Flow encryption key for a Number (beta). Every dynamic Flow on the Number uses it; the previous managed key decrypts for 24 hours. Requires sessions:manage. Makes one attempt.", - "usage": ["polymorfa flow key rotate [flags]"], + "id": "flow deprecate", + "summary": "Deprecate a published WhatsApp Flow (beta). Requires connections:manage.", + "description": "Deprecate a published WhatsApp Flow (beta). Requires connections:manage.", + "usage": ["polymorfa flow deprecate FLOW [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "flow", + "description": "Flow draft UUID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -34180,6 +34492,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Connection name or ID in the same project.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -34253,14 +34577,14 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "request-id", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Number name or ID in the project.", + "description": "UUID for this exact provider operation. Reuse to inspect the original receipt.", "env": null, "helpGroup": null }, @@ -34292,11 +34616,11 @@ "name": "yes", "char": null, "type": "boolean", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Confirm replacing the key for every Flow on this Number.", + "description": "Confirm this Flow change.", "env": null, "helpGroup": null } @@ -34305,13 +34629,20 @@ "state": null }, { - "id": "flow list", - "summary": "List project Flow drafts. Requires sessions:read.", - "description": "List project Flow drafts. Requires sessions:read.", - "usage": ["polymorfa flow list [flags]"], + "id": "flow discard", + "summary": "Delete a draft from WhatsApp (beta). Requires connections:manage.", + "description": "Delete a draft from WhatsApp (beta). Requires connections:manage.", + "usage": ["polymorfa flow discard FLOW [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "flow", + "description": "Flow draft UUID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -34325,6 +34656,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Connection name or ID in the same project.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -34397,6 +34740,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "request-id", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "UUID for this exact provider operation. Reuse to inspect the original receipt.", + "env": null, + "helpGroup": null + }, { "name": "timeout", "char": null, @@ -34420,16 +34775,28 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" + }, + { + "name": "yes", + "char": null, + "type": "boolean", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Confirm this Flow change.", + "env": null, + "helpGroup": null } ], "examples": [], "state": null }, { - "id": "flow publish", - "summary": "Publish a validated Flow to WhatsApp (beta). Requires sessions:manage.", - "description": "Publish a validated Flow to WhatsApp (beta). Requires sessions:manage.", - "usage": ["polymorfa flow publish FLOW [flags]"], + "id": "flow endpoint delete", + "summary": "Remove a Flow's data endpoint on one Connection (beta). WhatsApp requests to it are refused afterwards; receipts are kept. Requires connections:manage.", + "description": "Remove a Flow's data endpoint on one Connection (beta). WhatsApp requests to it are refused afterwards; receipts are kept. Requires connections:manage.", + "usage": ["polymorfa flow endpoint delete FLOW [flags]"], "aliases": [], "hidden": false, "args": [ @@ -34453,6 +34820,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Connection name or ID in the same project.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -34525,30 +34904,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "request-id", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "UUID for this exact provider operation. Reuse to inspect the original receipt.", - "env": null, - "helpGroup": null - }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Number name or ID in the same project.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -34577,11 +34932,11 @@ "name": "yes", "char": null, "type": "boolean", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Confirm this Flow change.", + "description": "Confirm removing the endpoint.", "env": null, "helpGroup": null } @@ -34590,10 +34945,10 @@ "state": null }, { - "id": "flow receipts", - "summary": "Read provider operation receipts, including uncertain outcomes. Requires sessions:read.", - "description": "Read provider operation receipts, including uncertain outcomes. Requires sessions:read.", - "usage": ["polymorfa flow receipts FLOW [flags]"], + "id": "flow endpoint get", + "summary": "Read a Flow's data endpoint on one Connection and the Connection's encryption custody (beta). Requires connections:read.", + "description": "Read a Flow's data endpoint on one Connection and the Connection's encryption custody (beta). Requires connections:read.", + "usage": ["polymorfa flow endpoint get FLOW [flags]"], "aliases": [], "hidden": false, "args": [ @@ -34617,6 +34972,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Connection name or ID in the same project.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -34718,10 +35085,10 @@ "state": null }, { - "id": "flow sync", - "summary": "Reconcile provider status without replaying uncertain writes (beta). Requires sessions:manage.", - "description": "Reconcile provider status without replaying uncertain writes (beta). Requires sessions:manage.", - "usage": ["polymorfa flow sync FLOW [flags]"], + "id": "flow endpoint receipts", + "summary": "Read a Flow's data-exchange receipts, newest first (beta). Metadata only: no form data, Flow token or response. Requires connections:read.", + "description": "Read a Flow's data-exchange receipts, newest first (beta). Metadata only: no form data, Flow token or response. Requires connections:read.", + "usage": ["polymorfa flow endpoint receipts FLOW [flags]"], "aliases": [], "hidden": false, "args": [ @@ -34745,6 +35112,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Only this Connection (name or ID).", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -34757,6 +35136,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "limit", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "1 to 100 receipts.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -34817,30 +35208,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "request-id", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "UUID for this exact provider operation. Reuse to inspect the original receipt.", - "env": null, - "helpGroup": null - }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Number name or ID in the same project.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -34870,10 +35237,10 @@ "state": null }, { - "id": "flow update", - "summary": "Update a local project Flow draft. Requires sessions:manage.", - "description": "Update a local project Flow draft. Requires sessions:manage.", - "usage": ["polymorfa flow update FLOW [flags]"], + "id": "flow endpoint set", + "summary": "Create or replace a Flow's data endpoint on one Connection (beta). Requires connections:manage. forward and function need a Polymorfa-managed key; direct needs your own key. A forward signing secret is printed once. Makes one attempt.", + "description": "Create or replace a Flow's data endpoint on one Connection (beta). Requires connections:manage. forward and function need a Polymorfa-managed key; direct needs your own key. A forward signing secret is printed once. Makes one attempt.", + "usage": ["polymorfa flow endpoint set FLOW [flags]"], "aliases": [], "hidden": false, "args": [ @@ -34898,14 +35265,62 @@ "helpGroup": "GLOBAL" }, { - "name": "input", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "JSON file or - for stdin. Project and path identity come from command flags.", + "description": "Connection name or ID in the same project.", + "env": null, + "helpGroup": null + }, + { + "name": "deployment", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Pin an immutable Function deployment UUID.", + "env": null, + "helpGroup": null + }, + { + "name": "disabled", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Save the endpoint disabled; WhatsApp requests are refused.", + "env": null, + "helpGroup": null + }, + { + "name": "expected-revision", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Replace only when the stored revision matches.", + "env": null, + "helpGroup": null + }, + { + "name": "function", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Function UUID for function mode.", "env": null, "helpGroup": null }, @@ -34921,6 +35336,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "mode", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": ["forward", "function", "direct"], + "description": "forward: Polymorfa decrypts and forwards signed JSON to --url. function: runs --function. direct: WhatsApp calls --url with your own key.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -34981,6 +35408,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "rotate-signing-secret", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Issue a new forward signing secret.", + "env": null, + "helpGroup": null + }, { "name": "timeout", "char": null, @@ -34993,6 +35432,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "url", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "HTTPS URL for forward or direct.", + "env": null, + "helpGroup": null + }, { "name": "verbose", "char": null, @@ -35010,10 +35461,10 @@ "state": null }, { - "id": "flow upload", - "summary": "Upload the Flow to one Number (beta). Requires sessions:manage. Does not retry uncertain writes.", - "description": "Upload the Flow to one Number (beta). Requires sessions:manage. Does not retry uncertain writes.", - "usage": ["polymorfa flow upload FLOW [flags]"], + "id": "flow get", + "summary": "Read a project Flow draft. Requires connections:read.", + "description": "Read a project Flow draft. Requires connections:read.", + "usage": ["polymorfa flow get FLOW [flags]"], "aliases": [], "hidden": false, "args": [ @@ -35037,27 +35488,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "category", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [ - "SIGN_UP", - "SIGN_IN", - "APPOINTMENT_BOOKING", - "LEAD_GENERATION", - "CONTACT_US", - "CUSTOMER_SUPPORT", - "SURVEY", - "OTHER" - ], - "description": "WhatsApp Flow category; repeat for multiple categories.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -35130,30 +35560,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "request-id", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "UUID for this exact provider operation. Reuse to inspect the original receipt.", - "env": null, - "helpGroup": null - }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Number name or ID in the same project.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -35183,10 +35589,10 @@ "state": null }, { - "id": "function create", - "summary": "Create a Function definition from JSON. Include a stable functionId for safe creation retries.", - "description": "Create a Function definition from JSON. Include a stable functionId for safe creation retries.", - "usage": ["polymorfa function create [flags]"], + "id": "flow key custody", + "summary": "Read whether Polymorfa holds a Connection's Flow encryption key (managed) or not (customer), and recent managed keys (beta). Requires connections:read.", + "description": "Read whether Polymorfa holds a Connection's Flow encryption key (managed) or not (customer), and recent managed keys (beta). Requires connections:read.", + "usage": ["polymorfa flow key custody [flags]"], "aliases": [], "hidden": false, "args": [], @@ -35204,14 +35610,14 @@ "helpGroup": "GLOBAL" }, { - "name": "input", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Read one JSON object from a file or stdin (-).", + "description": "Connection name or ID in the project.", "env": null, "helpGroup": null }, @@ -35316,20 +35722,13 @@ "state": null }, { - "id": "function delete", - "summary": "Retire a Function. New invocations stop; running code can finish. Requires the last observed revision.", - "description": "Retire a Function. New invocations stop; running code can finish. Requires the last observed revision.", - "usage": ["polymorfa function delete FUNCTION [flags]"], + "id": "flow key get", + "summary": "Read the public Flow encryption key registered to a Meta phone number. Requires connections:read.", + "description": "Read the public Flow encryption key registered to a Meta phone number. Requires connections:read.", + "usage": ["polymorfa flow key get [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "function", - "description": "Function UUID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -35344,14 +35743,14 @@ "helpGroup": "GLOBAL" }, { - "name": "expected-revision", + "name": "graph-version", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Last observed Function revision.", + "description": "Meta Graph version, for example v26.0.", "env": null, "helpGroup": null }, @@ -35392,157 +35791,17 @@ "helpGroup": "GLOBAL" }, { - "name": "profile", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Use a named authentication profile.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "project", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Use a project other than the active context.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "quiet", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Suppress successful output.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "timeout", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Fail the request after this many milliseconds.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "verbose", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Explain context and workflow decisions.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm the effect described above.", - "env": null, - "helpGroup": null - } - ], - "examples": [], - "state": null - }, - { - "id": "function deployment create", - "summary": "Build an immutable deployment from JSON with deploymentId, source, language, region and compatibilityDate. Optional secretVersionIds and egressOrigins are pinned. Egress entries must be exact HTTPS origins, without credentials, a path, query, fragment or custom port. No packages are installed during execution.", - "description": "Build an immutable deployment from JSON with deploymentId, source, language, region and compatibilityDate. Optional secretVersionIds and egressOrigins are pinned. Egress entries must be exact HTTPS origins, without credentials, a path, query, fragment or custom port. No packages are installed during execution.", - "usage": ["polymorfa function deployment create FUNCTION [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "function", - "description": "Function UUID.", - "required": true, - "options": [] - } - ], - "flags": [ - { - "name": "api-version", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Override the API version for this request.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "input", + "name": "phone-number-id", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Read one JSON object from a file or stdin (-).", + "description": "Meta phone number ID.", "env": null, "helpGroup": null }, - { - "name": "json", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Print one JSON document.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "no-color", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Disable color output.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "owner", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", - "env": null, - "helpGroup": "GLOBAL" - }, { "name": "profile", "char": null, @@ -35608,20 +35867,13 @@ "state": null }, { - "id": "function deployment list", - "summary": "List immutable deployments with pagination.", - "description": "List immutable deployments with pagination.", - "usage": ["polymorfa function deployment list FUNCTION [flags]"], + "id": "flow key register", + "summary": "Replace the public key used by every dynamic Flow on this Meta phone number. Requires connections:manage; retain the matching private key on your endpoint.", + "description": "Replace the public key used by every dynamic Flow on this Meta phone number. Requires connections:manage; retain the matching private key on your endpoint.", + "usage": ["polymorfa flow key register [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "function", - "description": "Function UUID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -35636,40 +35888,40 @@ "helpGroup": "GLOBAL" }, { - "name": "before", + "name": "graph-version", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Continue before this UUID cursor.", + "description": "Meta Graph version, for example v26.0.", "env": null, "helpGroup": null }, { - "name": "json", + "name": "input", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "JSON file containing business_public_key, or - for stdin.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "limit", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Maximum results.", + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "no-color", @@ -35695,6 +35947,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "phone-number-id", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Meta phone number ID.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -35754,34 +36018,31 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" + }, + { + "name": "yes", + "char": null, + "type": "boolean", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Confirm replacing the public key for every Flow on this phone number.", + "env": null, + "helpGroup": null } ], "examples": [], "state": null }, { - "id": "function deployment promote", - "summary": "Promote a deployment for new invocations. Pinned interactions keep their selected version.", - "description": "Promote a deployment for new invocations. Pinned interactions keep their selected version.", - "usage": [ - "polymorfa function deployment promote FUNCTION DEPLOYMENT [flags]" - ], + "id": "flow key rotate", + "summary": "Generate and register a new Polymorfa-managed Flow encryption key for a Connection (beta). Every dynamic Flow on the Connection uses it; the previous managed key decrypts for 24 hours. Requires connections:manage. Makes one attempt.", + "description": "Generate and register a new Polymorfa-managed Flow encryption key for a Connection (beta). Every dynamic Flow on the Connection uses it; the previous managed key decrypts for 24 hours. Requires connections:manage. Makes one attempt.", + "usage": ["polymorfa flow key rotate [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "function", - "description": "Function UUID.", - "required": true, - "options": [] - }, - { - "name": "deployment", - "description": "Deployment UUID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -35796,14 +36057,14 @@ "helpGroup": "GLOBAL" }, { - "name": "expected-revision", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Last observed Function revision.", + "description": "Connection name or ID in the project.", "env": null, "helpGroup": null }, @@ -35902,34 +36163,31 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" + }, + { + "name": "yes", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Confirm replacing the key for every Flow on this Connection.", + "env": null, + "helpGroup": null } ], "examples": [], "state": null }, { - "id": "function deployment view", - "summary": "Read one immutable deployment. Use --json to include its source configuration.", - "description": "Read one immutable deployment. Use --json to include its source configuration.", - "usage": [ - "polymorfa function deployment view FUNCTION DEPLOYMENT [flags]" - ], + "id": "flow list", + "summary": "List project Flow drafts. Requires connections:read.", + "description": "List project Flow drafts. Requires connections:read.", + "usage": ["polymorfa flow list [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "function", - "description": "Function UUID.", - "required": true, - "options": [] - }, - { - "name": "deployment", - "description": "Deployment UUID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -36044,16 +36302,16 @@ "state": null }, { - "id": "function invocation create", - "summary": "Invoke once with a required idempotency key and request JSON. Repeating the key returns metadata without executing again. Unknown or failed outcomes need reconciliation before a new key. Exits 8 when the outcome or response needs attention.", - "description": "Invoke once with a required idempotency key and request JSON. Repeating the key returns metadata without executing again. Unknown or failed outcomes need reconciliation before a new key. Exits 8 when the outcome or response needs attention.", - "usage": ["polymorfa function invocation create FUNCTION [flags]"], + "id": "flow publish", + "summary": "Publish a validated Flow to WhatsApp (beta). Requires connections:manage.", + "description": "Publish a validated Flow to WhatsApp (beta). Requires connections:manage.", + "usage": ["polymorfa flow publish FLOW [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "function", - "description": "Function UUID.", + "name": "flow", + "description": "Flow draft UUID.", "required": true, "options": [] } @@ -36072,26 +36330,14 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Stable identity: 1–128 printable ASCII characters, excluding spaces. Never change it to retry an uncertain effect.", - "env": null, - "helpGroup": null - }, - { - "name": "input", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Read one JSON object from a file or stdin (-).", + "description": "Connection name or ID in the same project.", "env": null, "helpGroup": null }, @@ -36168,204 +36414,68 @@ "helpGroup": "GLOBAL" }, { - "name": "timeout", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Fail the request after this many milliseconds.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "verbose", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Explain context and workflow decisions.", - "env": null, - "helpGroup": "GLOBAL" - } - ], - "examples": [], - "state": null - }, - { - "id": "function invocation list", - "summary": "List invocation metadata without inputs, responses or customer log text.", - "description": "List invocation metadata without inputs, responses or customer log text.", - "usage": ["polymorfa function invocation list FUNCTION [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "function", - "description": "Function UUID.", - "required": true, - "options": [] - } - ], - "flags": [ - { - "name": "api-version", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Override the API version for this request.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "before", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Continue before this UUID cursor.", - "env": null, - "helpGroup": null - }, - { - "name": "json", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Print one JSON document.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "limit", + "name": "request-id", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Maximum results.", + "description": "UUID for this exact provider operation. Reuse to inspect the original receipt.", "env": null, "helpGroup": null }, { - "name": "no-color", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Disable color output.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "owner", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "profile", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Use a named authentication profile.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "project", + "name": "timeout", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a project other than the active context.", + "description": "Fail the request after this many milliseconds.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "quiet", + "name": "verbose", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Suppress successful output.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "timeout", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "yes", "char": null, "type": "boolean", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Confirm this Flow change.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null } ], "examples": [], "state": null }, { - "id": "function invocation view", - "summary": "Read an invocation receipt. Stored receipts contain metadata only.", - "description": "Read an invocation receipt. Stored receipts contain metadata only.", - "usage": [ - "polymorfa function invocation view FUNCTION INVOCATION [flags]" - ], + "id": "flow receipts", + "summary": "Read provider operation receipts, including uncertain outcomes. Requires connections:read.", + "description": "Read provider operation receipts, including uncertain outcomes. Requires connections:read.", + "usage": ["polymorfa flow receipts FLOW [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "function", - "description": "Function UUID.", - "required": true, - "options": [] - }, - { - "name": "invocation", - "description": "Invocation UUID.", + "name": "flow", + "description": "Flow draft UUID.", "required": true, "options": [] } @@ -36484,13 +36594,20 @@ "state": null }, { - "id": "function list", - "summary": "List Functions in one project.", - "description": "List Functions in one project.", - "usage": ["polymorfa function list [flags]"], + "id": "flow sync", + "summary": "Reconcile provider status without replaying uncertain writes (beta). Requires connections:manage.", + "description": "Reconcile provider status without replaying uncertain writes (beta). Requires connections:manage.", + "usage": ["polymorfa flow sync FLOW [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "flow", + "description": "Flow draft UUID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -36505,14 +36622,14 @@ "helpGroup": "GLOBAL" }, { - "name": "before", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Continue before this UUID cursor.", + "description": "Connection name or ID in the same project.", "env": null, "helpGroup": null }, @@ -36528,18 +36645,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "limit", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Maximum results.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -36600,6 +36705,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "request-id", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "UUID for this exact provider operation. Reuse to inspect the original receipt.", + "env": null, + "helpGroup": null + }, { "name": "timeout", "char": null, @@ -36629,16 +36746,16 @@ "state": null }, { - "id": "function secret create", - "summary": "Create a write-only secret version from a JSON file or stdin. Values never belong in command arguments. Existing deployments keep their pinned versions. Polymorfa credentials are refused.", - "description": "Create a write-only secret version from a JSON file or stdin. Values never belong in command arguments. Existing deployments keep their pinned versions. Polymorfa credentials are refused.", - "usage": ["polymorfa function secret create FUNCTION [flags]"], + "id": "flow update", + "summary": "Update a local project Flow draft. Requires connections:manage.", + "description": "Update a local project Flow draft. Requires connections:manage.", + "usage": ["polymorfa flow update FLOW [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "function", - "description": "Function UUID.", + "name": "flow", + "description": "Flow draft UUID.", "required": true, "options": [] } @@ -36664,7 +36781,7 @@ "multiple": false, "default": null, "options": [], - "description": "Read one JSON object from a file or stdin (-).", + "description": "JSON file or - for stdin. Project and path identity come from command flags.", "env": null, "helpGroup": null }, @@ -36769,16 +36886,16 @@ "state": null }, { - "id": "function secret list", - "summary": "List secret version metadata. Values are never returned.", - "description": "List secret version metadata. Values are never returned.", - "usage": ["polymorfa function secret list FUNCTION [flags]"], + "id": "flow upload", + "summary": "Upload the Flow to one Connection (beta). Requires connections:manage. Does not retry uncertain writes.", + "description": "Upload the Flow to one Connection (beta). Requires connections:manage. Does not retry uncertain writes.", + "usage": ["polymorfa flow upload FLOW [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "function", - "description": "Function UUID.", + "name": "flow", + "description": "Flow draft UUID.", "required": true, "options": [] } @@ -36797,40 +36914,49 @@ "helpGroup": "GLOBAL" }, { - "name": "before", + "name": "category", "char": null, "type": "option", "required": false, - "multiple": false, + "multiple": true, "default": null, - "options": [], - "description": "Continue before this UUID cursor.", + "options": [ + "SIGN_UP", + "SIGN_IN", + "APPOINTMENT_BOOKING", + "LEAD_GENERATION", + "CONTACT_US", + "CUSTOMER_SUPPORT", + "SURVEY", + "OTHER" + ], + "description": "WhatsApp Flow category; repeat for multiple categories.", "env": null, "helpGroup": null }, { - "name": "json", + "name": "connection", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Connection name or ID in the same project.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "limit", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Maximum results.", + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "no-color", @@ -36892,6 +37018,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "request-id", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "UUID for this exact provider operation. Reuse to inspect the original receipt.", + "env": null, + "helpGroup": null + }, { "name": "timeout", "char": null, @@ -36921,26 +37059,13 @@ "state": null }, { - "id": "function secret revoke", - "summary": "Revoke one secret version. New invocations using it are blocked; running code can finish.", - "description": "Revoke one secret version. New invocations using it are blocked; running code can finish.", - "usage": ["polymorfa function secret revoke FUNCTION VERSION [flags]"], + "id": "function create", + "summary": "Create a Function definition from JSON. Include a stable functionId for safe creation retries.", + "description": "Create a Function definition from JSON. Include a stable functionId for safe creation retries.", + "usage": ["polymorfa function create [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "function", - "description": "Function UUID.", - "required": true, - "options": [] - }, - { - "name": "version", - "description": "Version UUID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -36954,6 +37079,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "input", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Read one JSON object from a file or stdin (-).", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -37049,28 +37186,16 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, - { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm the effect described above.", - "env": null, - "helpGroup": null } ], "examples": [], "state": null }, { - "id": "function update", - "summary": "Update a Function from JSON containing expectedRevision and name or enabled.", - "description": "Update a Function from JSON containing expectedRevision and name or enabled.", - "usage": ["polymorfa function update FUNCTION [flags]"], + "id": "function delete", + "summary": "Retire a Function. New invocations stop; running code can finish. Requires the last observed revision.", + "description": "Retire a Function. New invocations stop; running code can finish. Requires the last observed revision.", + "usage": ["polymorfa function delete FUNCTION [flags]"], "aliases": [], "hidden": false, "args": [ @@ -37095,14 +37220,14 @@ "helpGroup": "GLOBAL" }, { - "name": "input", + "name": "expected-revision", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Read one JSON object from a file or stdin (-).", + "description": "Last observed Function revision.", "env": null, "helpGroup": null }, @@ -37201,16 +37326,28 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" + }, + { + "name": "yes", + "char": null, + "type": "boolean", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Confirm the effect described above.", + "env": null, + "helpGroup": null } ], "examples": [], "state": null }, { - "id": "function view", - "summary": "Read a Function and its active deployment.", - "description": "Read a Function and its active deployment.", - "usage": ["polymorfa function view FUNCTION [flags]"], + "id": "function deployment create", + "summary": "Build an immutable deployment from JSON with deploymentId, source, language, region and compatibilityDate. Optional secretVersionIds and egressOrigins are pinned. Egress entries must be exact HTTPS origins, without credentials, a path, query, fragment or custom port. No packages are installed during execution.", + "description": "Build an immutable deployment from JSON with deploymentId, source, language, region and compatibilityDate. Optional secretVersionIds and egressOrigins are pinned. Egress entries must be exact HTTPS origins, without credentials, a path, query, fragment or custom port. No packages are installed during execution.", + "usage": ["polymorfa function deployment create FUNCTION [flags]"], "aliases": [], "hidden": false, "args": [ @@ -37234,6 +37371,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "input", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Read one JSON object from a file or stdin (-).", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -37335,16 +37484,16 @@ "state": null }, { - "id": "group capabilities", - "summary": "Read stored WhatsApp group capabilities. Requires current membership and enrollment in the number-capabilities beta.", - "description": "Read stored WhatsApp group capabilities. Requires current membership and enrollment in the number-capabilities beta.", - "usage": ["polymorfa group capabilities GROUP [flags]"], + "id": "function deployment list", + "summary": "List immutable deployments with pagination.", + "description": "List immutable deployments with pagination.", + "usage": ["polymorfa function deployment list FUNCTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "group", - "description": "Polymorfa group identifier.", + "name": "function", + "description": "Function UUID.", "required": true, "options": [] } @@ -37362,6 +37511,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "before", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Continue before this UUID cursor.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -37374,6 +37535,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "limit", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Maximum results.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -37434,18 +37607,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -37471,26 +37632,32 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa group capabilities 9007199254740993 --session support", - "description": "" - }, - { - "command": "polymorfa group capabilities 9007199254740993 --session support --json", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "group create", - "summary": "Create a group with initial participants.", - "description": "Create a group with initial participants.", - "usage": ["polymorfa group create [flags]"], + "id": "function deployment promote", + "summary": "Promote a deployment for new invocations. Pinned interactions keep their selected version.", + "description": "Promote a deployment for new invocations. Pinned interactions keep their selected version.", + "usage": [ + "polymorfa function deployment promote FUNCTION DEPLOYMENT [flags]" + ], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "function", + "description": "Function UUID.", + "required": true, + "options": [] + }, + { + "name": "deployment", + "description": "Deployment UUID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -37505,14 +37672,14 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "expected-revision", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this creation.", + "description": "Last observed Function revision.", "env": null, "helpGroup": null }, @@ -37528,18 +37695,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "name", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Group subject.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -37564,18 +37719,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "participant", - "char": null, - "type": "option", - "required": true, - "multiple": true, - "default": null, - "options": [], - "description": "Polymorfa user ID to add. Repeat for several participants.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -37612,18 +37755,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -37649,25 +37780,28 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa group create --session session_123 --name \"Launch team\" --participant 750000000001 --participant 750000000002", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "group description", - "summary": "Replace a group description. Pass an empty value to clear it.", - "description": "Replace a group description. Pass an empty value to clear it.", - "usage": ["polymorfa group description GROUP [flags]"], + "id": "function deployment view", + "summary": "Read one immutable deployment. Use --json to include its source configuration.", + "description": "Read one immutable deployment. Use --json to include its source configuration.", + "usage": [ + "polymorfa function deployment view FUNCTION DEPLOYMENT [flags]" + ], "aliases": [], "hidden": false, "args": [ { - "name": "group", - "description": "Group identifier.", + "name": "function", + "description": "Function UUID.", + "required": true, + "options": [] + }, + { + "name": "deployment", + "description": "Deployment UUID.", "required": true, "options": [] } @@ -37685,18 +37819,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Safely identify retries of this change.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -37769,18 +37891,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -37793,18 +37903,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "value", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "New description. An empty string clears it.", - "env": null, - "helpGroup": null - }, { "name": "verbose", "char": null, @@ -37818,25 +37916,20 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa group description 750000000009 --session session_123 --value \"Weekly launch coordination\"", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "group invite-link", - "summary": "Print the current invite link for a group.", - "description": "Print the current invite link for a group.", - "usage": ["polymorfa group invite-link GROUP [flags]"], + "id": "function invocation create", + "summary": "Invoke once with a required idempotency key and request JSON. Repeating the key returns metadata without executing again. Unknown or failed outcomes need reconciliation before a new key. Exits 8 when the outcome or response needs attention.", + "description": "Invoke once with a required idempotency key and request JSON. Repeating the key returns metadata without executing again. Unknown or failed outcomes need reconciliation before a new key. Exits 8 when the outcome or response needs attention.", + "usage": ["polymorfa function invocation create FUNCTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "group", - "description": "Group identifier.", + "name": "function", + "description": "Function UUID.", "required": true, "options": [] } @@ -37854,6 +37947,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Stable identity: 1–128 printable ASCII characters, excluding spaces. Never change it to retry an uncertain effect.", + "env": null, + "helpGroup": null + }, + { + "name": "input", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Read one JSON object from a file or stdin (-).", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -37926,18 +38043,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -37967,13 +38072,20 @@ "state": null }, { - "id": "group list", - "summary": "List groups for a Messaging session.", - "description": "List groups for a Messaging session.", - "usage": ["polymorfa group list [flags]"], + "id": "function invocation list", + "summary": "List invocation metadata without inputs, responses or customer log text.", + "description": "List invocation metadata without inputs, responses or customer log text.", + "usage": ["polymorfa function invocation list FUNCTION [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "function", + "description": "Function UUID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -37987,6 +38099,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "before", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Continue before this UUID cursor.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -37999,6 +38123,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "limit", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Maximum results.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -38059,18 +38195,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -38100,16 +38224,24 @@ "state": null }, { - "id": "group participants add", - "summary": "Add participants to a group.", - "description": "Add participants to a group.", - "usage": ["polymorfa group participants add GROUP [flags]"], + "id": "function invocation view", + "summary": "Read an invocation receipt. Stored receipts contain metadata only.", + "description": "Read an invocation receipt. Stored receipts contain metadata only.", + "usage": [ + "polymorfa function invocation view FUNCTION INVOCATION [flags]" + ], "aliases": [], "hidden": false, "args": [ { - "name": "group", - "description": "Group identifier.", + "name": "function", + "description": "Function UUID.", + "required": true, + "options": [] + }, + { + "name": "invocation", + "description": "Invocation UUID.", "required": true, "options": [] } @@ -38127,18 +38259,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Safely identify retries of this change.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -38175,18 +38295,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "participant", - "char": null, - "type": "option", - "required": true, - "multiple": true, - "default": null, - "options": [], - "description": "Polymorfa user ID. Repeat for several participants.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -38223,18 +38331,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -38260,29 +38356,17 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa group participants add 750000000009 --session session_123 --participant 750000000001", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "group participants demote", - "summary": "Demote group admins to regular participants.", - "description": "Demote group admins to regular participants.", - "usage": ["polymorfa group participants demote GROUP [flags]"], + "id": "function list", + "summary": "List Functions in one project.", + "description": "List Functions in one project.", + "usage": ["polymorfa function list [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "group", - "description": "Group identifier.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -38297,14 +38381,14 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "before", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this change.", + "description": "Continue before this UUID cursor.", "env": null, "helpGroup": null }, @@ -38320,6 +38404,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "limit", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Maximum results.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -38344,18 +38440,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "participant", - "char": null, - "type": "option", - "required": true, - "multiple": true, - "default": null, - "options": [], - "description": "Polymorfa user ID. Repeat for several participants.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -38392,18 +38476,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -38429,25 +38501,20 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa group participants demote 750000000009 --session session_123 --participant 750000000001", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "group participants list", - "summary": "List participants in a group.", - "description": "List participants in a group.", - "usage": ["polymorfa group participants list GROUP [flags]"], + "id": "function secret create", + "summary": "Create a write-only secret version from a JSON file or stdin. Values never belong in command arguments. Existing deployments keep their pinned versions. Polymorfa credentials are refused.", + "description": "Create a write-only secret version from a JSON file or stdin. Values never belong in command arguments. Existing deployments keep their pinned versions. Polymorfa credentials are refused.", + "usage": ["polymorfa function secret create FUNCTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "group", - "description": "Group identifier.", + "name": "function", + "description": "Function UUID.", "required": true, "options": [] } @@ -38465,6 +38532,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "input", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Read one JSON object from a file or stdin (-).", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -38537,18 +38616,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -38578,16 +38645,16 @@ "state": null }, { - "id": "group participants promote", - "summary": "Promote participants to group admins.", - "description": "Promote participants to group admins.", - "usage": ["polymorfa group participants promote GROUP [flags]"], + "id": "function secret list", + "summary": "List secret version metadata. Values are never returned.", + "description": "List secret version metadata. Values are never returned.", + "usage": ["polymorfa function secret list FUNCTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "group", - "description": "Group identifier.", + "name": "function", + "description": "Function UUID.", "required": true, "options": [] } @@ -38606,14 +38673,14 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "before", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this change.", + "description": "Continue before this UUID cursor.", "env": null, "helpGroup": null }, @@ -38629,6 +38696,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "limit", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Maximum results.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -38653,18 +38732,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "participant", - "char": null, - "type": "option", - "required": true, - "multiple": true, - "default": null, - "options": [], - "description": "Polymorfa user ID. Repeat for several participants.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -38701,18 +38768,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -38738,25 +38793,26 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa group participants promote 750000000009 --session session_123 --participant 750000000001", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "group participants remove", - "summary": "Remove participants from a group.", - "description": "Remove participants from a group.", - "usage": ["polymorfa group participants remove GROUP [flags]"], + "id": "function secret revoke", + "summary": "Revoke one secret version. New invocations using it are blocked; running code can finish.", + "description": "Revoke one secret version. New invocations using it are blocked; running code can finish.", + "usage": ["polymorfa function secret revoke FUNCTION VERSION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "group", - "description": "Group identifier.", + "name": "function", + "description": "Function UUID.", + "required": true, + "options": [] + }, + { + "name": "version", + "description": "Version UUID.", "required": true, "options": [] } @@ -38774,18 +38830,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Safely identify retries of this change.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -38822,18 +38866,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "participant", - "char": null, - "type": "option", - "required": true, - "multiple": true, - "default": null, - "options": [], - "description": "Polymorfa user ID. Repeat for several participants.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -38870,18 +38902,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -38910,34 +38930,29 @@ "name": "yes", "char": null, "type": "boolean", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Confirm removal without an interactive prompt.", + "description": "Confirm the effect described above.", "env": null, "helpGroup": null } ], - "examples": [ - { - "command": "polymorfa group participants remove 750000000009 --session session_123 --participant 750000000001 --yes", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "group settings", - "summary": "Change who can edit group info, send messages, and add members, and whether joining needs admin approval.", - "description": "Change who can edit group info, send messages, and add members, and whether joining needs admin approval.", - "usage": ["polymorfa group settings GROUP [flags]"], + "id": "function update", + "summary": "Update a Function from JSON containing expectedRevision and name or enabled.", + "description": "Update a Function from JSON containing expectedRevision and name or enabled.", + "usage": ["polymorfa function update FUNCTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "group", - "description": "Group identifier.", + "name": "function", + "description": "Function UUID.", "required": true, "options": [] } @@ -38956,26 +38971,14 @@ "helpGroup": "GLOBAL" }, { - "name": "info-editing", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["admins", "all"], - "description": "Who can edit the subject, description, and picture.", - "env": null, - "helpGroup": null - }, - { - "name": "join-approval", + "name": "input", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, - "options": ["on", "off"], - "description": "Require admin approval for join requests.", + "options": [], + "description": "Read one JSON object from a file or stdin (-).", "env": null, "helpGroup": null }, @@ -38991,30 +38994,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "member-add", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["admins", "all"], - "description": "Who can add members.", - "env": null, - "helpGroup": null - }, - { - "name": "messaging", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["admins", "all"], - "description": "Who can send messages.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -39075,18 +39054,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -39112,25 +39079,20 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa group settings 750000000009 --session session_123 --messaging admins --join-approval on", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "group subject", - "summary": "Rename a group.", - "description": "Rename a group.", - "usage": ["polymorfa group subject GROUP [flags]"], + "id": "function view", + "summary": "Read a Function and its active deployment.", + "description": "Read a Function and its active deployment.", + "usage": ["polymorfa function view FUNCTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "group", - "description": "Group identifier.", + "name": "function", + "description": "Function UUID.", "required": true, "options": [] } @@ -39148,18 +39110,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Safely identify retries of this change.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -39232,18 +39182,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -39256,18 +39194,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "value", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "New group subject.", - "env": null, - "helpGroup": null - }, { "name": "verbose", "char": null, @@ -39281,25 +39207,20 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa group subject 750000000009 --session session_123 --value \"Launch team\"", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "group view", - "summary": "View one group.", - "description": "View one group.", - "usage": ["polymorfa group view GROUP [flags]"], + "id": "group capabilities", + "summary": "Read stored WhatsApp group capabilities. Requires current membership and enrollment in the connection-capabilities beta.", + "description": "Read stored WhatsApp group capabilities. Requires current membership and enrollment in the connection-capabilities beta.", + "usage": ["polymorfa group capabilities GROUP [flags]"], "aliases": [], "hidden": false, "args": [ { "name": "group", - "description": "Group identifier.", + "description": "Polymorfa group identifier.", "required": true, "options": [] } @@ -39317,6 +39238,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -39389,18 +39322,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -39426,14 +39347,23 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa group capabilities 9007199254740993 --connection support", + "description": "" + }, + { + "command": "polymorfa group capabilities 9007199254740993 --connection support --json", + "description": "" + } + ], "state": null }, { - "id": "hybrid-link pause", - "summary": "Pause Hybrid routing at the exact current revision.", - "description": "Pause Hybrid routing at the exact current revision.", - "usage": ["polymorfa hybrid-link pause [flags]"], + "id": "group create", + "summary": "Create a group with initial participants.", + "description": "Create a group with initial participants.", + "usage": ["polymorfa group create [flags]"], "aliases": [], "hidden": false, "args": [], @@ -39451,14 +39381,26 @@ "helpGroup": "GLOBAL" }, { - "name": "expected-revision", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Revision from hybrid-link state.", + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this creation.", "env": null, "helpGroup": null }, @@ -39474,6 +39416,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "name", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Group subject.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -39498,6 +39452,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "participant", + "char": null, + "type": "option", + "required": true, + "multiple": true, + "default": null, + "options": [], + "description": "Polymorfa user ID to add. Repeat for several participants.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -39534,18 +39500,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Number session name.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -39571,17 +39525,29 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa group create --connection connection_123 --name \"Launch team\" --participant 750000000001 --participant 750000000002", + "description": "" + } + ], "state": null }, { - "id": "hybrid-link resume", - "summary": "Resume Hybrid routing at the exact current revision.", - "description": "Resume Hybrid routing at the exact current revision.", - "usage": ["polymorfa hybrid-link resume [flags]"], + "id": "group description", + "summary": "Replace a group description. Pass an empty value to clear it.", + "description": "Replace a group description. Pass an empty value to clear it.", + "usage": ["polymorfa group description GROUP [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "group", + "description": "Group identifier.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -39596,14 +39562,26 @@ "helpGroup": "GLOBAL" }, { - "name": "expected-revision", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Revision from hybrid-link state.", + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this change.", "env": null, "helpGroup": null }, @@ -39680,28 +39658,28 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Number session name.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "value", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "New description. An empty string clears it.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "verbose", @@ -39716,17 +39694,29 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa group description 750000000009 --connection connection_123 --value \"Weekly launch coordination\"", + "description": "" + } + ], "state": null }, { - "id": "hybrid-link state", - "summary": "Read Hybrid Link readiness, pause state, and revision.", - "description": "Read Hybrid Link readiness, pause state, and revision.", - "usage": ["polymorfa hybrid-link state [flags]"], + "id": "group invite-link", + "summary": "Print the current invite link for a group.", + "description": "Print the current invite link for a group.", + "usage": ["polymorfa group invite-link GROUP [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "group", + "description": "Group identifier.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -39740,6 +39730,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -39812,18 +39814,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Number session name.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -39853,10 +39843,10 @@ "state": null }, { - "id": "identity resolve", - "summary": "Resolve one phone number, user ID, or username.", - "description": "Resolve one phone number, user ID, or username.", - "usage": ["polymorfa identity resolve [flags]"], + "id": "group list", + "summary": "List groups for a Messaging connection.", + "description": "List groups for a Messaging connection.", + "usage": ["polymorfa group list [flags]"], "aliases": [], "hidden": false, "args": [], @@ -39874,14 +39864,14 @@ "helpGroup": "GLOBAL" }, { - "name": "id", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Opaque Polymorfa user ID.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -39921,18 +39911,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "phone-number", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Phone digits with an optional leading plus sign.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -39969,18 +39947,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -39993,30 +39959,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "username", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "WhatsApp username containing 3 through 35 characters.", - "env": null, - "helpGroup": null - }, - { - "name": "username-key", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Optional four-digit username resolution key.", - "env": null, - "helpGroup": null - }, { "name": "verbose", "char": null, @@ -40034,25 +39976,20 @@ "state": null }, { - "id": "init", - "summary": "Create a credential-free Node.js and TypeScript starter in the current directory.", - "description": "Create a credential-free Node.js and TypeScript starter in the current directory.", - "usage": ["polymorfa init"], - "aliases": [], - "hidden": false, - "args": [], - "flags": [], - "examples": [{"command": "polymorfa init", "description": ""}], - "state": null - }, - { - "id": "key list", - "summary": "List organization API-key metadata (never raw key material).", - "description": "List organization API-key metadata (never raw key material).", - "usage": ["polymorfa key list [flags]"], + "id": "group participants add", + "summary": "Add participants to a group.", + "description": "Add participants to a group.", + "usage": ["polymorfa group participants add GROUP [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "group", + "description": "Group identifier.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -40066,6 +40003,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this change.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -40102,6 +40063,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "participant", + "char": null, + "type": "option", + "required": true, + "multiple": true, + "default": null, + "options": [], + "description": "Polymorfa user ID. Repeat for several participants.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -40163,20 +40136,25 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa group participants add 750000000009 --connection connection_123 --participant 750000000001", + "description": "" + } + ], "state": null }, { - "id": "key revoke", - "summary": "Revoke an organization API key.", - "description": "Revoke an organization API key.", - "usage": ["polymorfa key revoke KEY [flags]"], + "id": "group participants demote", + "summary": "Demote group admins to regular participants.", + "description": "Demote group admins to regular participants.", + "usage": ["polymorfa group participants demote GROUP [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "key", - "description": "API key ID.", + "name": "group", + "description": "Group identifier.", "required": true, "options": [] } @@ -40194,6 +40172,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -40202,7 +40192,7 @@ "multiple": false, "default": null, "options": [], - "description": "Identify this attempt (a retry after an unseen success may return not found).", + "description": "Safely identify retries of this change.", "env": null, "helpGroup": null }, @@ -40242,6 +40232,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "participant", + "char": null, + "type": "option", + "required": true, + "multiple": true, + "default": null, + "options": [], + "description": "Polymorfa user ID. Repeat for several participants.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -40301,34 +40303,27 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, + } + ], + "examples": [ { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm immediate API-key revocation.", - "env": null, - "helpGroup": null + "command": "polymorfa group participants demote 750000000009 --connection connection_123 --participant 750000000001", + "description": "" } ], - "examples": [], "state": null }, { - "id": "label chat list", - "summary": "List the labels assigned to a chat.", - "description": "List the labels assigned to a chat.", - "usage": ["polymorfa label chat list CHAT [flags]"], + "id": "group participants list", + "summary": "List participants in a group.", + "description": "List participants in a group.", + "usage": ["polymorfa group participants list GROUP [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "chat", - "description": "Polymorfa conversation ID.", + "name": "group", + "description": "Group identifier.", "required": true, "options": [] } @@ -40347,14 +40342,14 @@ "helpGroup": "GLOBAL" }, { - "name": "include-observation", + "name": "connection", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Include observation policy and freshness metadata.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -40430,18 +40425,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -40471,16 +40454,16 @@ "state": null }, { - "id": "label chat replace", - "summary": "Replace a chat's complete label set.", - "description": "Replace a chat's complete label set.", - "usage": ["polymorfa label chat replace CHAT [flags]"], + "id": "group participants promote", + "summary": "Promote participants to group admins.", + "description": "Promote participants to group admins.", + "usage": ["polymorfa group participants promote GROUP [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "chat", - "description": "Polymorfa conversation ID.", + "name": "group", + "description": "Group identifier.", "required": true, "options": [] } @@ -40499,14 +40482,14 @@ "helpGroup": "GLOBAL" }, { - "name": "clear", + "name": "connection", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Detach every label from the chat.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -40518,7 +40501,7 @@ "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this replacement.", + "description": "Safely identify retries of this change.", "env": null, "helpGroup": null }, @@ -40534,18 +40517,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "label", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Label ID. Repeat to assign multiple labels.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -40570,6 +40541,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "participant", + "char": null, + "type": "option", + "required": true, + "multiple": true, + "default": null, + "options": [], + "description": "Polymorfa user ID. Repeat for several participants.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -40606,18 +40589,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -40643,17 +40614,29 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa group participants promote 750000000009 --connection connection_123 --participant 750000000001", + "description": "" + } + ], "state": null }, { - "id": "label create", - "summary": "Create a label.", - "description": "Create a label.", - "usage": ["polymorfa label create [flags]"], + "id": "group participants remove", + "summary": "Remove participants from a group.", + "description": "Remove participants from a group.", + "usage": ["polymorfa group participants remove GROUP [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "group", + "description": "Group identifier.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -40668,14 +40651,14 @@ "helpGroup": "GLOBAL" }, { - "name": "color", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Label color index.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -40687,7 +40670,7 @@ "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this create operation.", + "description": "Safely identify retries of this change.", "env": null, "helpGroup": null }, @@ -40703,18 +40686,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "name", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Label name.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -40739,6 +40710,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "participant", + "char": null, + "type": "option", + "required": true, + "multiple": true, + "default": null, + "options": [], + "description": "Polymorfa user ID. Repeat for several participants.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -40776,56 +40759,61 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "verbose", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "yes", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Confirm removal without an interactive prompt.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null + } + ], + "examples": [ + { + "command": "polymorfa group participants remove 750000000009 --connection connection_123 --participant 750000000001 --yes", + "description": "" } ], - "examples": [], "state": null }, { - "id": "label delete", - "summary": "Delete a label.", - "description": "Delete a label.", - "usage": ["polymorfa label delete LABEL [flags]"], + "id": "group settings", + "summary": "Change who can edit group info, send messages, and add members, and whether joining needs admin approval.", + "description": "Change who can edit group info, send messages, and add members, and whether joining needs admin approval.", + "usage": ["polymorfa group settings GROUP [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "label", - "description": "Label ID.", + "name": "group", + "description": "Group identifier.", "required": true, "options": [] } @@ -40844,14 +40832,38 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this delete operation.", + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "info-editing", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["admins", "all"], + "description": "Who can edit the subject, description, and picture.", + "env": null, + "helpGroup": null + }, + { + "name": "join-approval", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["on", "off"], + "description": "Require admin approval for join requests.", "env": null, "helpGroup": null }, @@ -40867,6 +40879,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "member-add", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["admins", "all"], + "description": "Who can add members.", + "env": null, + "helpGroup": null + }, + { + "name": "messaging", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["admins", "all"], + "description": "Who can send messages.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -40927,18 +40963,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -40962,31 +40986,31 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, + } + ], + "examples": [ { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm permanent label deletion.", - "env": null, - "helpGroup": null + "command": "polymorfa group settings 750000000009 --connection connection_123 --messaging admins --join-approval on", + "description": "" } ], - "examples": [], "state": null }, { - "id": "label list", - "summary": "List labels for a Messaging session.", - "description": "List labels for a Messaging session.", - "usage": ["polymorfa label list [flags]"], + "id": "group subject", + "summary": "Rename a group.", + "description": "Rename a group.", + "usage": ["polymorfa group subject GROUP [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "group", + "description": "Group identifier.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -41001,14 +41025,26 @@ "helpGroup": "GLOBAL" }, { - "name": "include-observation", + "name": "connection", "char": null, - "type": "boolean", + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Include observation policy and freshness metadata.", + "description": "Safely identify retries of this change.", "env": null, "helpGroup": null }, @@ -41085,28 +41121,28 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "value", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "New group subject.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "verbose", @@ -41121,20 +41157,25 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa group subject 750000000009 --connection connection_123 --value \"Launch team\"", + "description": "" + } + ], "state": null }, { - "id": "label update", - "summary": "Update a label.", - "description": "Update a label.", - "usage": ["polymorfa label update LABEL [flags]"], + "id": "group view", + "summary": "View one group.", + "description": "View one group.", + "usage": ["polymorfa group view GROUP [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "label", - "description": "Label ID.", + "name": "group", + "description": "Group identifier.", "required": true, "options": [] } @@ -41153,26 +41194,14 @@ "helpGroup": "GLOBAL" }, { - "name": "color", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "New label color index.", - "env": null, - "helpGroup": null - }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Safely identify retries of this update operation.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -41188,18 +41217,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "name", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "New label name.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -41260,18 +41277,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -41301,10 +41306,10 @@ "state": null }, { - "id": "link", - "summary": "Link the current directory to a project by writing polymorfa.json.", - "description": "Link the current directory to a project by writing polymorfa.json.", - "usage": ["polymorfa link [flags]"], + "id": "hybrid-link pause", + "summary": "Pause Hybrid routing at the exact current revision.", + "description": "Pause Hybrid routing at the exact current revision.", + "usage": ["polymorfa hybrid-link pause [flags]"], "aliases": [], "hidden": false, "args": [], @@ -41322,14 +41327,26 @@ "helpGroup": "GLOBAL" }, { - "name": "force", + "name": "connection", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Replace an existing link to a different project.", + "description": "Connection name.", + "env": null, + "helpGroup": null + }, + { + "name": "expected-revision", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Revision from hybrid-link state.", "env": null, "helpGroup": null }, @@ -41430,37 +41447,18 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - {"command": "polymorfa link --project my-app", "description": ""}, - { - "command": "polymorfa link --project 11111111-1111-4111-8111-111111111111 --force", - "description": "" - }, - {"command": "polymorfa link", "description": ""} - ], + "examples": [], "state": null }, { - "id": "listen", - "summary": "Listen for project events and optionally forward their exact payloads.", - "description": "Listen for project events and optionally forward their exact payloads.", - "usage": ["polymorfa listen [flags]"], + "id": "hybrid-link resume", + "summary": "Resume Hybrid routing at the exact current revision.", + "description": "Resume Hybrid routing at the exact current revision.", + "usage": ["polymorfa hybrid-link resume [flags]"], "aliases": [], "hidden": false, "args": [], "flags": [ - { - "name": "allow-remote-forward", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Allow validated public HTTPS forwarding destinations.", - "env": null, - "helpGroup": null - }, { "name": "api-version", "char": null, @@ -41474,86 +41472,26 @@ "helpGroup": "GLOBAL" }, { - "name": "checkpoint-file", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Resume from and atomically update a private checkpoint.", - "env": null, - "helpGroup": null - }, - { - "name": "event", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": ["*"], - "options": [], - "description": "Listen for an event type or trailing-wildcard pattern.", - "env": null, - "helpGroup": null - }, - { - "name": "follow-redirects", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Follow at most three validated 307 or 308 redirects.", - "env": null, - "helpGroup": null - }, - { - "name": "forward-secret-out", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Write the one-time local forwarding secret to a new mode-0600 file.", + "description": "Connection name.", "env": null, "helpGroup": null }, { - "name": "forward-to", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Forward exact event payloads to this destination.", - "env": null, - "helpGroup": null - }, - { - "name": "from", + "name": "expected-revision", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Resume after this opaque listener cursor.", - "env": null, - "helpGroup": null - }, - { - "name": "header", - "char": "H", - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Add a custom header to forwarded requests (Name: value).", + "description": "Revision from hybrid-link state.", "env": null, "helpGroup": null }, @@ -41569,18 +41507,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "max-buffer", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": 256, - "options": [], - "description": "Bound locally pending events.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -41593,18 +41519,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "on-gap", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": "stop", - "options": ["stop", "continue"], - "description": "Stop safely or continue explicitly after a cursor gap.", - "env": null, - "helpGroup": null - }, { "name": "owner", "char": null, @@ -41637,9 +41551,9 @@ "multiple": false, "default": null, "options": [], - "description": "Use a project UUID; organization API keys may use a unique slug. Defaults to the linked or profile project.", + "description": "Use a project other than the active context.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "quiet", @@ -41653,18 +41567,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "skip-verify", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Accept a self-signed HTTPS certificate from a loopback forwarding destination.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -41694,10 +41596,10 @@ "state": null }, { - "id": "logs list", - "summary": "List a project's API requests from the last 30 days, newest first. Requires logs:read.", - "description": "List a project's API requests from the last 30 days, newest first. Requires logs:read.", - "usage": ["polymorfa logs list [flags]"], + "id": "hybrid-link state", + "summary": "Read Hybrid Link readiness, pause state, and revision.", + "description": "Read Hybrid Link readiness, pause state, and revision.", + "usage": ["polymorfa hybrid-link state [flags]"], "aliases": [], "hidden": false, "args": [], @@ -41715,26 +41617,14 @@ "helpGroup": "GLOBAL" }, { - "name": "credential", + "name": "connection", "char": null, "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Only requests made by this team key or project token ID.", - "env": null, - "helpGroup": null - }, - { - "name": "cursor", - "char": null, - "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Continue from page.nextCursor of an earlier page; keeps its filters.", + "description": "Connection name.", "env": null, "helpGroup": null }, @@ -41750,30 +41640,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "limit", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Requests per page (default 25).", - "env": null, - "helpGroup": null - }, - { - "name": "method", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Only these HTTP methods, for example POST or GET,DELETE.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -41834,66 +41700,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "request-id", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Only the request with this X-Request-Id.", - "env": null, - "helpGroup": null - }, - { - "name": "route", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Only this exact route pattern, for example /messaging/:session/messages.", - "env": null, - "helpGroup": null - }, - { - "name": "since", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Earliest request time (RFC 3339).", - "env": null, - "helpGroup": null - }, - { - "name": "source", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["api", "mcp"], - "description": "Only direct API requests or requests made through MCP.", - "env": null, - "helpGroup": null - }, - { - "name": "status", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Only these status codes or classes, for example 404 or 4xx,5xx.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -41906,30 +41712,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "trace-id", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Only requests with this W3C trace ID (X-Trace-Id).", - "env": null, - "helpGroup": null - }, - { - "name": "until", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Latest request time (RFC 3339).", - "env": null, - "helpGroup": null - }, { "name": "verbose", "char": null, @@ -41943,23 +41725,14 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa logs list --project 11111111-1111-4111-8111-111111111111 --status 4xx,5xx", - "description": "" - }, - { - "command": "polymorfa logs list --project 11111111-1111-4111-8111-111111111111 --trace-id 4bf92f3577b34da6a3ce929d0e0e4736 --json", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "logs tail", - "summary": "Print a project's API requests as they happen. Polls the request log and requires logs:read.", - "description": "Print a project's API requests as they happen. Polls the request log and requires logs:read.", - "usage": ["polymorfa logs tail [flags]"], + "id": "identity resolve", + "summary": "Resolve one phone number, user ID, or username.", + "description": "Resolve one phone number, user ID, or username.", + "usage": ["polymorfa identity resolve [flags]"], "aliases": [], "hidden": false, "args": [], @@ -41977,26 +41750,26 @@ "helpGroup": "GLOBAL" }, { - "name": "backfill", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, - "default": 10, + "default": null, "options": [], - "description": "Print this many recent requests before following.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, { - "name": "credential", + "name": "id", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Only requests made by this team key or project token ID.", + "description": "Opaque Polymorfa user ID.", "env": null, "helpGroup": null }, @@ -42012,30 +41785,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "max-events", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Stop after printing this many requests.", - "env": null, - "helpGroup": null - }, - { - "name": "method", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Only these HTTP methods, for example POST or GET,DELETE.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -42061,14 +41810,14 @@ "helpGroup": "GLOBAL" }, { - "name": "poll-interval", + "name": "phone-number", "char": null, "type": "option", "required": false, "multiple": false, - "default": 2, + "default": null, "options": [], - "description": "Seconds between polls while no new requests arrive.", + "description": "Phone digits with an optional leading plus sign.", "env": null, "helpGroup": null }, @@ -42109,74 +41858,38 @@ "helpGroup": "GLOBAL" }, { - "name": "request-id", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Only the request with this X-Request-Id.", - "env": null, - "helpGroup": null - }, - { - "name": "route", + "name": "timeout", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Only this exact route pattern, for example /messaging/:session/messages.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "source", + "name": "username", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": ["api", "mcp"], - "description": "Only direct API requests or requests made through MCP.", - "env": null, - "helpGroup": null - }, - { - "name": "status", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, "options": [], - "description": "Only these status codes or classes, for example 404 or 4xx,5xx.", + "description": "WhatsApp username containing 3 through 35 characters.", "env": null, "helpGroup": null }, { - "name": "timeout", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Fail the request after this many milliseconds.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "trace-id", + "name": "username-key", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Only requests with this W3C trace ID (X-Trace-Id).", + "description": "Optional four-digit username resolution key.", "env": null, "helpGroup": null }, @@ -42193,27 +41906,26 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa logs tail --project 11111111-1111-4111-8111-111111111111", - "description": "" - }, - { - "command": "polymorfa logs tail --project 11111111-1111-4111-8111-111111111111 --status 4xx,5xx --method POST", - "description": "" - }, - { - "command": "polymorfa logs tail --project 11111111-1111-4111-8111-111111111111 --poll-interval 5 --json", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "mcp doctor", - "summary": "Check the local MCP runtime and listener protocol pin.", - "description": "Check the local MCP runtime and listener protocol pin.", - "usage": ["polymorfa mcp doctor [flags]"], + "id": "init", + "summary": "Create a credential-free Node.js and TypeScript starter in the current directory.", + "description": "Create a credential-free Node.js and TypeScript starter in the current directory.", + "usage": ["polymorfa init"], + "aliases": [], + "hidden": false, + "args": [], + "flags": [], + "examples": [{"command": "polymorfa init", "description": ""}], + "state": null + }, + { + "id": "key list", + "summary": "List organization API-key metadata (never raw key material).", + "description": "List organization API-key metadata (never raw key material).", + "usage": ["polymorfa key list [flags]"], "aliases": [], "hidden": false, "args": [], @@ -42331,18 +42043,18 @@ "state": null }, { - "id": "mcp install", - "summary": "Install the Polymorfa stdio MCP server in a supported client.", - "description": "Install the Polymorfa stdio MCP server in a supported client.", - "usage": ["polymorfa mcp install CLIENT [flags]"], + "id": "key revoke", + "summary": "Revoke an organization API key.", + "description": "Revoke an organization API key.", + "usage": ["polymorfa key revoke KEY [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "client", - "description": "", + "name": "key", + "description": "API key ID.", "required": true, - "options": ["codex", "claude"] + "options": [] } ], "flags": [ @@ -42358,6 +42070,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Identify this attempt (a retry after an unseen success may return not found).", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -42453,19 +42177,38 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" + }, + { + "name": "yes", + "char": null, + "type": "boolean", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Confirm immediate API-key revocation.", + "env": null, + "helpGroup": null } ], "examples": [], "state": null }, { - "id": "mcp serve", - "summary": "Serve local Polymorfa tools over MCP stdio.", - "description": "Serve local Polymorfa tools over MCP stdio.", - "usage": ["polymorfa mcp serve [flags]"], + "id": "label chat list", + "summary": "List the labels assigned to a chat.", + "description": "List the labels assigned to a chat.", + "usage": ["polymorfa label chat list CHAT [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "chat", + "description": "Polymorfa conversation ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -42479,6 +42222,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "include-observation", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Include observation policy and freshness metadata.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -42580,18 +42347,18 @@ "state": null }, { - "id": "mcp status", - "summary": "Inspect Polymorfa MCP configuration in supported clients.", - "description": "Inspect Polymorfa MCP configuration in supported clients.", - "usage": ["polymorfa mcp status [CLIENT] [flags]"], + "id": "label chat replace", + "summary": "Replace a chat's complete label set.", + "description": "Replace a chat's complete label set.", + "usage": ["polymorfa label chat replace CHAT [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "client", - "description": "", - "required": false, - "options": ["codex", "claude"] + "name": "chat", + "description": "Polymorfa conversation ID.", + "required": true, + "options": [] } ], "flags": [ @@ -42607,6 +42374,42 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "clear", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Detach every label from the chat.", + "env": null, + "helpGroup": null + }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this replacement.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -42619,6 +42422,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "label", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Label ID. Repeat to assign multiple labels.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -42708,10 +42523,10 @@ "state": null }, { - "id": "mcp tools", - "summary": "List tools exposed by the local Polymorfa MCP server.", - "description": "List tools exposed by the local Polymorfa MCP server.", - "usage": ["polymorfa mcp tools [flags]"], + "id": "label create", + "summary": "Create a label.", + "description": "Create a label.", + "usage": ["polymorfa label create [flags]"], "aliases": [], "hidden": false, "args": [], @@ -42729,144 +42544,64 @@ "helpGroup": "GLOBAL" }, { - "name": "json", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Print one JSON document.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "no-color", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Disable color output.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "owner", + "name": "color", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", + "options": [], + "description": "Label color index.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "profile", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Use a named authentication profile.", + "description": "Messaging connection ID.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "project", + "name": "idempotency-key", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a project other than the active context.", + "description": "Safely identify retries of this create operation.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "quiet", + "name": "json", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Suppress successful output.", + "description": "Print one JSON document.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "name", "char": null, "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Fail the request after this many milliseconds.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "verbose", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Explain context and workflow decisions.", - "env": null, - "helpGroup": "GLOBAL" - } - ], - "examples": [], - "state": null - }, - { - "id": "mcp uninstall", - "summary": "Remove the Polymorfa MCP server from a supported client.", - "description": "Remove the Polymorfa MCP server from a supported client.", - "usage": ["polymorfa mcp uninstall CLIENT [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "client", - "description": "", "required": true, - "options": ["codex", "claude"] - } - ], - "flags": [ - { - "name": "api-version", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Override the API version for this request.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "json", - "char": null, - "type": "boolean", - "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Label name.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "no-color", @@ -42957,17 +42692,17 @@ "state": null }, { - "id": "media download", - "summary": "Download Messaging media to a local file, print its signed link, or decrypt it from a stored webhook event.", - "description": "Download Messaging media to a local file, print its signed link, or decrypt it from a stored webhook event.", - "usage": ["polymorfa media download [MEDIA] [flags]"], + "id": "label delete", + "summary": "Delete a label.", + "description": "Delete a label.", + "usage": ["polymorfa label delete LABEL [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "media", - "description": "Messaging media ID. Omit it when using --from-event.", - "required": false, + "name": "label", + "description": "Label ID.", + "required": true, "options": [] } ], @@ -42985,26 +42720,26 @@ "helpGroup": "GLOBAL" }, { - "name": "force", + "name": "connection", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Overwrite an existing output file.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, { - "name": "from-event", + "name": "idempotency-key", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Decrypt media from the WhatsApp CDN using a stored message webhook JSON file. The file contains a decryption key.", + "description": "Safely identify retries of this delete operation.", "env": null, "helpGroup": null }, @@ -43020,18 +42755,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "max-bytes", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": 104857600, - "options": [], - "description": "Maximum bytes to download.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -43044,18 +42767,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "output", - "char": "o", - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Destination file path.", - "env": null, - "helpGroup": null - }, { "name": "owner", "char": null, @@ -43117,61 +42828,41 @@ "helpGroup": "GLOBAL" }, { - "name": "url", + "name": "verbose", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print the short-lived signed download link to stdout instead of downloading.", + "description": "Explain context and workflow decisions.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "yes", "char": null, "type": "boolean", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Confirm permanent label deletion.", "env": null, - "helpGroup": "GLOBAL" - } - ], - "examples": [ - { - "command": "polymorfa media download media_123 --output ./attachment.bin", - "description": "" - }, - { - "command": "polymorfa media download media_123 --url", - "description": "" - }, - { - "command": "polymorfa media download --from-event ./message.json -o ./photo.jpg", - "description": "" + "helpGroup": null } ], + "examples": [], "state": null }, { - "id": "media persist", - "summary": "Persist Messaging media to server storage.", - "description": "Persist Messaging media to server storage.", - "usage": ["polymorfa media persist MEDIA [flags]"], + "id": "label list", + "summary": "List labels for a Messaging connection.", + "description": "List labels for a Messaging connection.", + "usage": ["polymorfa label list [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "media", - "description": "Messaging media ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -43186,14 +42877,26 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "connection", "char": null, "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "include-observation", + "char": null, + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this persistence request.", + "description": "Include observation policy and freshness metadata.", "env": null, "helpGroup": null }, @@ -43298,16 +43001,16 @@ "state": null }, { - "id": "media view", - "summary": "View Messaging media metadata.", - "description": "View Messaging media metadata.", - "usage": ["polymorfa media view MEDIA [flags]"], + "id": "label update", + "summary": "Update a label.", + "description": "Update a label.", + "usage": ["polymorfa label update LABEL [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "media", - "description": "Messaging media ID.", + "name": "label", + "description": "Label ID.", "required": true, "options": [] } @@ -43325,6 +43028,42 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "color", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "New label color index.", + "env": null, + "helpGroup": null + }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this update operation.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -43337,6 +43076,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "name", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "New label name.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -43426,10 +43177,10 @@ "state": null }, { - "id": "member list", - "summary": "List organization members.", - "description": "List organization members.", - "usage": ["polymorfa member list [flags]"], + "id": "link", + "summary": "Link the current directory to a project by writing polymorfa.json.", + "description": "Link the current directory to a project by writing polymorfa.json.", + "usage": ["polymorfa link [flags]"], "aliases": [], "hidden": false, "args": [], @@ -43446,6 +43197,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "force", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Replace an existing link to a different project.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -43543,25 +43306,37 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + {"command": "polymorfa link --project my-app", "description": ""}, + { + "command": "polymorfa link --project 11111111-1111-4111-8111-111111111111 --force", + "description": "" + }, + {"command": "polymorfa link", "description": ""} + ], "state": null }, { - "id": "message delete", - "summary": "Delete a message you sent for everyone in the conversation.", - "description": "Delete a message you sent for everyone in the conversation.", - "usage": ["polymorfa message delete MESSAGE [flags]"], + "id": "listen", + "summary": "Listen for project events and optionally forward their exact payloads.", + "description": "Listen for project events and optionally forward their exact payloads.", + "usage": ["polymorfa listen [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "message", - "description": "Message ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ + { + "name": "allow-remote-forward", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Allow validated public HTTPS forwarding destinations.", + "env": null, + "helpGroup": null + }, { "name": "api-version", "char": null, @@ -43575,26 +43350,86 @@ "helpGroup": "GLOBAL" }, { - "name": "chat", + "name": "checkpoint-file", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Conversation that contains the message.", + "description": "Resume from and atomically update a private checkpoint.", "env": null, "helpGroup": null }, { - "name": "idempotency-key", + "name": "event", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": ["*"], + "options": [], + "description": "Listen for an event type or trailing-wildcard pattern.", + "env": null, + "helpGroup": null + }, + { + "name": "follow-redirects", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Follow at most three validated 307 or 308 redirects.", + "env": null, + "helpGroup": null + }, + { + "name": "forward-secret-out", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", + "description": "Write the one-time local forwarding secret to a new mode-0600 file.", + "env": null, + "helpGroup": null + }, + { + "name": "forward-to", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Forward exact event payloads to this destination.", + "env": null, + "helpGroup": null + }, + { + "name": "from", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Resume after this opaque listener cursor.", + "env": null, + "helpGroup": null + }, + { + "name": "header", + "char": "H", + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Add a custom header to forwarded requests (Name: value).", "env": null, "helpGroup": null }, @@ -43610,6 +43445,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "max-buffer", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": 256, + "options": [], + "description": "Bound locally pending events.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -43622,6 +43469,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "on-gap", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": "stop", + "options": ["stop", "continue"], + "description": "Stop safely or continue explicitly after a cursor gap.", + "env": null, + "helpGroup": null + }, { "name": "owner", "char": null, @@ -43654,9 +43513,9 @@ "multiple": false, "default": null, "options": [], - "description": "Use a project other than the active context.", + "description": "Use a project UUID; organization API keys may use a unique slug. Defaults to the linked or profile project.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "quiet", @@ -43671,14 +43530,14 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "skip-verify", "char": null, - "type": "option", - "required": true, + "type": "boolean", + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Accept a self-signed HTTPS certificate from a loopback forwarding destination.", "env": null, "helpGroup": null }, @@ -43694,18 +43553,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "transport", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["auto", "linked_devices", "official_api"], - "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", - "env": null, - "helpGroup": null - }, { "name": "verbose", "char": null, @@ -43717,43 +43564,19 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, - { - "name": "yes", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm deletion without an interactive prompt.", - "env": null, - "helpGroup": null - } - ], - "examples": [ - { - "command": "polymorfa message delete 740000000001 --session session_123 --chat 730000000001 --yes", - "description": "" } ], + "examples": [], "state": null }, { - "id": "message edit", - "summary": "Replace the text of a message you sent.", - "description": "Replace the text of a message you sent.", - "usage": ["polymorfa message edit MESSAGE [flags]"], + "id": "logs list", + "summary": "List a project's API requests from the last 30 days, newest first. Requires logs:read.", + "description": "List a project's API requests from the last 30 days, newest first. Requires logs:read.", + "usage": ["polymorfa logs list [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "message", - "description": "Message ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -43768,52 +43591,64 @@ "helpGroup": "GLOBAL" }, { - "name": "body", + "name": "credential", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Replacement text.", + "description": "Only requests made by this team key or project token ID.", "env": null, "helpGroup": null }, { - "name": "chat", + "name": "cursor", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Conversation that contains the message.", + "description": "Continue from page.nextCursor of an earlier page; keeps its filters.", "env": null, "helpGroup": null }, { - "name": "idempotency-key", + "name": "json", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Print one JSON document.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "limit", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", + "description": "Requests per page (default 25).", "env": null, "helpGroup": null }, { - "name": "json", + "name": "method", "char": null, - "type": "boolean", + "type": "option", "required": false, - "multiple": false, + "multiple": true, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Only these HTTP methods, for example POST or GET,DELETE.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "no-color", @@ -43876,14 +43711,62 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "request-id", "char": null, "type": "option", - "required": true, + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Only the request with this X-Request-Id.", + "env": null, + "helpGroup": null + }, + { + "name": "route", + "char": null, + "type": "option", + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Only this exact route pattern, for example /messaging/:connection/messages.", + "env": null, + "helpGroup": null + }, + { + "name": "since", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Earliest request time (RFC 3339).", + "env": null, + "helpGroup": null + }, + { + "name": "source", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["api", "mcp"], + "description": "Only direct API requests or requests made through MCP.", + "env": null, + "helpGroup": null + }, + { + "name": "status", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Only these status codes or classes, for example 404 or 4xx,5xx.", "env": null, "helpGroup": null }, @@ -43900,14 +43783,26 @@ "helpGroup": "GLOBAL" }, { - "name": "transport", + "name": "trace-id", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": ["auto", "linked_devices", "official_api"], - "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", + "options": [], + "description": "Only requests with this W3C trace ID (X-Trace-Id).", + "env": null, + "helpGroup": null + }, + { + "name": "until", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Latest request time (RFC 3339).", "env": null, "helpGroup": null }, @@ -43926,27 +43821,24 @@ ], "examples": [ { - "command": "polymorfa message edit 740000000001 --session session_123 --chat 730000000001 --body \"Corrected text\"", + "command": "polymorfa logs list --project 11111111-1111-4111-8111-111111111111 --status 4xx,5xx", + "description": "" + }, + { + "command": "polymorfa logs list --project 11111111-1111-4111-8111-111111111111 --trace-id 4bf92f3577b34da6a3ce929d0e0e4736 --json", "description": "" } ], "state": null }, { - "id": "message mark-seen", - "summary": "Mark a message as seen.", - "description": "Mark a message as seen.", - "usage": ["polymorfa message mark-seen MESSAGE [flags]"], + "id": "logs tail", + "summary": "Print a project's API requests as they happen. Polls the request log and requires logs:read.", + "description": "Print a project's API requests as they happen. Polls the request log and requires logs:read.", + "usage": ["polymorfa logs tail [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "message", - "description": "Message ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -43961,26 +43853,26 @@ "helpGroup": "GLOBAL" }, { - "name": "chat", + "name": "backfill", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, - "default": null, + "default": 10, "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", + "description": "Print this many recent requests before following.", "env": null, "helpGroup": null }, { - "name": "idempotency-key", + "name": "credential", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this seen receipt.", + "description": "Only requests made by this team key or project token ID.", "env": null, "helpGroup": null }, @@ -43996,6 +43888,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "max-events", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Stop after printing this many requests.", + "env": null, + "helpGroup": null + }, + { + "name": "method", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Only these HTTP methods, for example POST or GET,DELETE.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -44020,6 +43936,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "poll-interval", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": 2, + "options": [], + "description": "Seconds between polls while no new requests arrive.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -44057,248 +43985,254 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "request-id", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Only the request with this X-Request-Id.", "env": null, "helpGroup": null }, { - "name": "timeout", + "name": "route", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Only this exact route pattern, for example /messaging/:connection/messages.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "verbose", + "name": "source", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Explain context and workflow decisions.", + "options": ["api", "mcp"], + "description": "Only direct API requests or requests made through MCP.", "env": null, - "helpGroup": "GLOBAL" - } - ], - "examples": [], - "state": null - }, - { - "id": "message operation-status", - "summary": "Read the outcome of a message operation without sending again.", - "description": "Read the outcome of a message operation without sending again.", - "usage": ["polymorfa message operation-status OPERATION [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "operation", - "description": "Operation ID from the send response.", - "required": true, - "options": [] - } - ], - "flags": [ + "helpGroup": null + }, { - "name": "api-version", + "name": "status", "char": null, "type": "option", "required": false, - "multiple": false, + "multiple": true, "default": null, "options": [], - "description": "Override the API version for this request.", + "description": "Only these status codes or classes, for example 404 or 4xx,5xx.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "json", + "name": "timeout", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Fail the request after this many milliseconds.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "no-color", + "name": "trace-id", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Disable color output.", + "description": "Only requests with this W3C trace ID (X-Trace-Id).", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "owner", + "name": "verbose", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", + "options": [], + "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" + } + ], + "examples": [ + { + "command": "polymorfa logs tail --project 11111111-1111-4111-8111-111111111111", + "description": "" }, { - "name": "profile", + "command": "polymorfa logs tail --project 11111111-1111-4111-8111-111111111111 --status 4xx,5xx --method POST", + "description": "" + }, + { + "command": "polymorfa logs tail --project 11111111-1111-4111-8111-111111111111 --poll-interval 5 --json", + "description": "" + } + ], + "state": null + }, + { + "id": "mcp doctor", + "summary": "Check the local MCP runtime and listener protocol pin.", + "description": "Check the local MCP runtime and listener protocol pin.", + "usage": ["polymorfa mcp doctor [flags]"], + "aliases": [], + "hidden": false, + "args": [], + "flags": [ + { + "name": "api-version", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a named authentication profile.", + "description": "Override the API version for this request.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "project", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a project other than the active context.", + "description": "Print one JSON document.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "quiet", + "name": "no-color", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Suppress successful output.", + "description": "Disable color output.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "owner", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, - "options": [], - "description": "Number session name.", + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "profile", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Use a named authentication profile.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "project", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Use a project other than the active context.", "env": null, "helpGroup": "GLOBAL" - } - ], - "examples": [], - "state": null - }, - { - "id": "message react", - "summary": "React to a message.", - "description": "React to a message.", - "usage": ["polymorfa message react MESSAGE [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "message", - "description": "Message ID.", - "required": true, - "options": [] - } - ], - "flags": [ + }, { - "name": "api-version", + "name": "quiet", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Override the API version for this request.", + "description": "Suppress successful output.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "chat", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "emoji", + "name": "verbose", "char": null, - "type": "option", - "required": true, + "type": "boolean", + "required": false, "multiple": false, "default": null, "options": [], - "description": "Reaction emoji.", + "description": "Explain context and workflow decisions.", "env": null, - "helpGroup": null - }, + "helpGroup": "GLOBAL" + } + ], + "examples": [], + "state": null + }, + { + "id": "mcp install", + "summary": "Install the Polymorfa stdio MCP server in a supported client.", + "description": "Install the Polymorfa stdio MCP server in a supported client.", + "usage": ["polymorfa mcp install CLIENT [flags]"], + "aliases": [], + "hidden": false, + "args": [ { - "name": "idempotency-key", + "name": "client", + "description": "", + "required": true, + "options": ["codex", "claude"] + } + ], + "flags": [ + { + "name": "api-version", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", + "description": "Override the API version for this request.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "json", @@ -44372,18 +44306,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -44396,18 +44318,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "transport", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["auto", "linked_devices", "official_api"], - "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", - "env": null, - "helpGroup": null - }, { "name": "verbose", "char": null, @@ -44425,10 +44335,10 @@ "state": null }, { - "id": "message send audio", - "summary": "Send audio or a voice note from a local file or URL.", - "description": "Send audio or a voice note from a local file or URL.", - "usage": ["polymorfa message send audio [flags]"], + "id": "mcp serve", + "summary": "Serve local Polymorfa tools over MCP stdio.", + "description": "Serve local Polymorfa tools over MCP stdio.", + "usage": ["polymorfa mcp serve [flags]"], "aliases": [], "hidden": false, "args": [], @@ -44446,362 +44356,393 @@ "helpGroup": "GLOBAL" }, { - "name": "file", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Local file to upload with the message.", + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "forwarded", + "name": "no-color", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Mark the message as forwarded.", + "description": "Disable color output.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "owner", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "json", + "name": "profile", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Use a named authentication profile.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "max-bytes", + "name": "project", "char": null, "type": "option", "required": false, "multiple": false, - "default": 104857600, + "default": null, "options": [], - "description": "Reject local files larger than this many bytes.", + "description": "Use a project other than the active context.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "mention", + "name": "quiet", "char": null, - "type": "option", + "type": "boolean", "required": false, - "multiple": true, + "multiple": false, "default": null, "options": [], - "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", + "description": "Suppress successful output.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "mime-type", + "name": "timeout", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "MIME type. Inferred from the file extension when omitted.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "no-color", + "name": "verbose", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Disable color output.", + "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, + } + ], + "examples": [], + "state": null + }, + { + "id": "mcp status", + "summary": "Inspect Polymorfa MCP configuration in supported clients.", + "description": "Inspect Polymorfa MCP configuration in supported clients.", + "usage": ["polymorfa mcp status [CLIENT] [flags]"], + "aliases": [], + "hidden": false, + "args": [ { - "name": "owner", + "name": "client", + "description": "", + "required": false, + "options": ["codex", "claude"] + } + ], + "flags": [ + { + "name": "api-version", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", + "options": [], + "description": "Override the API version for this request.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "profile", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a named authentication profile.", + "description": "Print one JSON document.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "project", + "name": "no-color", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a project other than the active context.", + "description": "Disable color output.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "quiet", + "name": "owner", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Suppress successful output.", + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "reply-to", + "name": "profile", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Polymorfa message ID to quote in the reply.", + "description": "Use a named authentication profile.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "project", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Use a project other than the active context.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "quiet", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Suppress successful output.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "to", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "transport", + "name": "verbose", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, - "options": ["auto", "linked_devices", "official_api"], - "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", + "options": [], + "description": "Explain context and workflow decisions.", "env": null, - "helpGroup": null - }, + "helpGroup": "GLOBAL" + } + ], + "examples": [], + "state": null + }, + { + "id": "mcp tools", + "summary": "List tools exposed by the local Polymorfa MCP server.", + "description": "List tools exposed by the local Polymorfa MCP server.", + "usage": ["polymorfa mcp tools [flags]"], + "aliases": [], + "hidden": false, + "args": [], + "flags": [ { - "name": "url", + "name": "api-version", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Public http or https URL the API fetches the media from.", + "description": "Override the API version for this request.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "json", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Print one JSON document.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "voice", + "name": "no-color", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Send as a push-to-talk voice note instead of an audio file.", + "description": "Disable color output.", "env": null, - "helpGroup": null - } - ], - "examples": [ - { - "command": "polymorfa message send audio --session session_123 --to +15551234567 --file ./note.ogg", - "description": "" + "helpGroup": "GLOBAL" }, { - "command": "polymorfa message send audio --session session_123 --to +15551234567 --url https://example.com/note.ogg", - "description": "" - } - ], - "state": null - }, - { - "id": "message send buttons", - "summary": "Send an interactive message with reply, URL, call, or copy-code buttons.", - "description": "Send an interactive message with reply, URL, call, or copy-code buttons.", - "usage": ["polymorfa message send buttons [flags]"], - "aliases": [], - "hidden": false, - "args": [], - "flags": [ - { - "name": "api-version", + "name": "owner", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Override the API version for this request.", + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "body", + "name": "profile", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Message body.", + "description": "Use a named authentication profile.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "button", + "name": "project", "char": null, "type": "option", - "required": true, - "multiple": true, + "required": false, + "multiple": false, "default": null, "options": [], - "description": "Button as reply:=, url:=, call:=<+E.164>, or copy:=. Repeat for several buttons.", + "description": "Use a project other than the active context.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "footer", + "name": "quiet", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Footer text.", + "description": "Suppress successful output.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "forwarded", + "name": "timeout", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Mark the message as forwarded.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "verbose", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", + "description": "Explain context and workflow decisions.", "env": null, - "helpGroup": null - }, + "helpGroup": "GLOBAL" + } + ], + "examples": [], + "state": null + }, + { + "id": "mcp uninstall", + "summary": "Remove the Polymorfa MCP server from a supported client.", + "description": "Remove the Polymorfa MCP server from a supported client.", + "usage": ["polymorfa mcp uninstall CLIENT [flags]"], + "aliases": [], + "hidden": false, + "args": [ { - "name": "json", + "name": "client", + "description": "", + "required": true, + "options": ["codex", "claude"] + } + ], + "flags": [ + { + "name": "api-version", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Override the API version for this request.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "mention", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, - "multiple": true, + "multiple": false, "default": null, "options": [], - "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "no-color", @@ -44864,338 +44805,357 @@ "helpGroup": "GLOBAL" }, { - "name": "reply-to", + "name": "timeout", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Polymorfa message ID to quote in the reply.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "verbose", "char": null, - "type": "option", - "required": true, + "type": "boolean", + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Explain context and workflow decisions.", "env": null, - "helpGroup": null - }, + "helpGroup": "GLOBAL" + } + ], + "examples": [], + "state": null + }, + { + "id": "media download", + "summary": "Download Messaging media to a local file, print its signed link, or decrypt it from a stored webhook event.", + "description": "Download Messaging media to a local file, print its signed link, or decrypt it from a stored webhook event.", + "usage": ["polymorfa media download [MEDIA] [flags]"], + "aliases": [], + "hidden": false, + "args": [ { - "name": "timeout", + "name": "media", + "description": "Messaging media ID. Omit it when using --from-event.", + "required": false, + "options": [] + } + ], + "flags": [ + { + "name": "api-version", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Override the API version for this request.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "title", + "name": "force", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Header title.", + "description": "Overwrite an existing output file.", "env": null, "helpGroup": null }, { - "name": "to", + "name": "from-event", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", + "description": "Decrypt media from the WhatsApp CDN using a stored message webhook JSON file. The file contains a decryption key.", "env": null, "helpGroup": null }, { - "name": "transport", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, - "options": ["auto", "linked_devices", "official_api"], - "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", + "options": [], + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "max-bytes", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, - "default": null, + "default": 104857600, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Maximum bytes to download.", "env": null, - "helpGroup": "GLOBAL" - } - ], - "examples": [ - { - "command": "polymorfa message send buttons --session session_123 --to +15551234567 --body \"Confirm your order?\" --button reply:yes=Yes --button reply:no=No", - "description": "" + "helpGroup": null }, { - "command": "polymorfa message send buttons --session session_123 --to +15551234567 --body \"Track it\" --button \"url:Open tracking=https://example.com/t/123\"", - "description": "" - } - ], - "state": null - }, - { - "id": "message send contact", - "summary": "Send a contact card built from flags or read from a vCard file.", - "description": "Send a contact card built from flags or read from a vCard file.", - "usage": ["polymorfa message send contact [flags]"], - "aliases": [], - "hidden": false, - "args": [], - "flags": [ - { - "name": "api-version", + "name": "no-color", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Override the API version for this request.", + "description": "Disable color output.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "forwarded", - "char": null, - "type": "boolean", + "name": "output", + "char": "o", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Mark the message as forwarded.", + "description": "Destination file path.", "env": null, "helpGroup": null }, { - "name": "idempotency-key", + "name": "owner", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "json", + "name": "profile", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Use a named authentication profile.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "mention", + "name": "project", "char": null, "type": "option", "required": false, - "multiple": true, + "multiple": false, "default": null, "options": [], - "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", + "description": "Use a project other than the active context.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "name", + "name": "quiet", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Contact display name.", + "description": "Suppress successful output.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "no-color", + "name": "timeout", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Disable color output.", + "description": "Fail the request after this many milliseconds.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "organization", + "name": "url", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Contact organization.", + "description": "Print the short-lived signed download link to stdout instead of downloading.", "env": null, "helpGroup": null }, { - "name": "owner", + "name": "verbose", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", + "options": [], + "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" + } + ], + "examples": [ + { + "command": "polymorfa media download media_123 --output ./attachment.bin", + "description": "" }, { - "name": "phone", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Contact E.164 phone number. Repeat for several numbers.", - "env": null, - "helpGroup": null + "command": "polymorfa media download media_123 --url", + "description": "" }, { - "name": "profile", + "command": "polymorfa media download --from-event ./message.json -o ./photo.jpg", + "description": "" + } + ], + "state": null + }, + { + "id": "media persist", + "summary": "Persist Messaging media to server storage.", + "description": "Persist Messaging media to server storage.", + "usage": ["polymorfa media persist MEDIA [flags]"], + "aliases": [], + "hidden": false, + "args": [ + { + "name": "media", + "description": "Messaging media ID.", + "required": true, + "options": [] + } + ], + "flags": [ + { + "name": "api-version", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a named authentication profile.", + "description": "Override the API version for this request.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "project", + "name": "idempotency-key", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a project other than the active context.", + "description": "Safely identify retries of this persistence request.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "quiet", + "name": "json", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Suppress successful output.", + "description": "Print one JSON document.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "reply-to", + "name": "no-color", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Polymorfa message ID to quote in the reply.", + "description": "Disable color output.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "owner", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, - "options": [], - "description": "Messaging session ID.", + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "profile", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Use a named authentication profile.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "to", + "name": "project", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", + "description": "Use a project other than the active context.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "transport", + "name": "quiet", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, - "options": ["auto", "linked_devices", "official_api"], - "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", + "options": [], + "description": "Suppress successful output.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "vcard", + "name": "timeout", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Read one vCard from a file.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "verbose", @@ -45210,26 +45170,24 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa message send contact --session session_123 --to +15551234567 --name \"Ada Lovelace\" --phone +15557654321", - "description": "" - }, - { - "command": "polymorfa message send contact --session session_123 --to +15551234567 --vcard ./ada.vcf", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "message send document", - "summary": "Send a document from a local file or URL.", - "description": "Send a document from a local file or URL.", - "usage": ["polymorfa message send document [flags]"], + "id": "media view", + "summary": "View Messaging media metadata.", + "description": "View Messaging media metadata.", + "usage": ["polymorfa media view MEDIA [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "media", + "description": "Messaging media ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -45244,112 +45202,137 @@ "helpGroup": "GLOBAL" }, { - "name": "caption", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Caption sent with the document.", + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "file", + "name": "no-color", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Local file to upload with the message.", + "description": "Disable color output.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "filename", + "name": "owner", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "File name shown to the recipient. Defaults to the local file name.", + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "forwarded", + "name": "profile", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Mark the message as forwarded.", + "description": "Use a named authentication profile.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "project", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", + "description": "Use a project other than the active context.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "json", + "name": "quiet", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Suppress successful output.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "max-bytes", + "name": "timeout", "char": null, "type": "option", "required": false, "multiple": false, - "default": 104857600, + "default": null, "options": [], - "description": "Reject local files larger than this many bytes.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "mention", + "name": "verbose", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Explain context and workflow decisions.", + "env": null, + "helpGroup": "GLOBAL" + } + ], + "examples": [], + "state": null + }, + { + "id": "member list", + "summary": "List organization members.", + "description": "List organization members.", + "usage": ["polymorfa member list [flags]"], + "aliases": [], + "hidden": false, + "args": [], + "flags": [ + { + "name": "api-version", "char": null, "type": "option", "required": false, - "multiple": true, + "multiple": false, "default": null, "options": [], - "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", + "description": "Override the API version for this request.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "mime-type", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "MIME type. Inferred from the file extension when omitted.", + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "no-color", @@ -45411,30 +45394,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "reply-to", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Polymorfa message ID to quote in the reply.", - "env": null, - "helpGroup": null - }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -45447,42 +45406,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "to", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", - "env": null, - "helpGroup": null - }, - { - "name": "transport", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["auto", "linked_devices", "official_api"], - "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", - "env": null, - "helpGroup": null - }, - { - "name": "url", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Public http or https URL the API fetches the media from.", - "env": null, - "helpGroup": null - }, { "name": "verbose", "char": null, @@ -45496,26 +45419,24 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa message send document --session session_123 --to +15551234567 --file ./invoice.pdf", - "description": "" - }, - { - "command": "polymorfa message send document --session session_123 --to +15551234567 --url https://example.com/invoice.pdf", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "message send image", - "summary": "Send an image from a local file or URL.", - "description": "Send an image from a local file or URL.", - "usage": ["polymorfa message send image [flags]"], + "id": "message delete", + "summary": "Delete a message you sent for everyone in the conversation.", + "description": "Delete a message you sent for everyone in the conversation.", + "usage": ["polymorfa message delete MESSAGE [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "message", + "description": "Message ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -45530,38 +45451,26 @@ "helpGroup": "GLOBAL" }, { - "name": "caption", + "name": "chat", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Caption sent with the image.", + "description": "Conversation that contains the message.", "env": null, "helpGroup": null }, { - "name": "file", + "name": "connection", "char": null, "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Local file to upload with the message.", - "env": null, - "helpGroup": null - }, - { - "name": "forwarded", - "char": null, - "type": "boolean", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Mark the message as forwarded.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -45589,42 +45498,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "max-bytes", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": 104857600, - "options": [], - "description": "Reject local files larger than this many bytes.", - "env": null, - "helpGroup": null - }, - { - "name": "mention", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", - "env": null, - "helpGroup": null - }, - { - "name": "mime-type", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "MIME type. Inferred from the file extension when omitted.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -45685,30 +45558,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "reply-to", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Polymorfa message ID to quote in the reply.", - "env": null, - "helpGroup": null - }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -45721,18 +45570,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "to", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", - "env": null, - "helpGroup": null - }, { "name": "transport", "char": null, @@ -45746,50 +45583,53 @@ "helpGroup": null }, { - "name": "url", + "name": "verbose", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Public http or https URL the API fetches the media from.", + "description": "Explain context and workflow decisions.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "yes", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Confirm deletion without an interactive prompt.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null } ], "examples": [ { - "command": "polymorfa message send image --session session_123 --to +15551234567 --file ./photo.jpg", - "description": "" - }, - { - "command": "polymorfa message send image --session session_123 --to +15551234567 --url https://example.com/photo.jpg", + "command": "polymorfa message delete 740000000001 --connection connection_123 --chat 730000000001 --yes", "description": "" } ], "state": null }, { - "id": "message send list", - "summary": "Send an interactive list message with selectable rows.", - "description": "Send an interactive list message with selectable rows.", - "usage": ["polymorfa message send list [flags]"], + "id": "message edit", + "summary": "Replace the text of a message you sent.", + "description": "Replace the text of a message you sent.", + "usage": ["polymorfa message edit MESSAGE [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "message", + "description": "Message ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -45804,50 +45644,38 @@ "helpGroup": "GLOBAL" }, { - "name": "button-text", + "name": "body", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Label of the button that opens the list.", + "description": "Replacement text.", "env": null, "helpGroup": null }, { - "name": "description", + "name": "chat", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Body text above the button.", + "description": "Conversation that contains the message.", "env": null, "helpGroup": null }, { - "name": "footer", + "name": "connection", "char": null, "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Footer text.", - "env": null, - "helpGroup": null - }, - { - "name": "forwarded", - "char": null, - "type": "boolean", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Mark the message as forwarded.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -45875,18 +45703,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "mention", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -45947,42 +45763,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "reply-to", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Polymorfa message ID to quote in the reply.", - "env": null, - "helpGroup": null - }, - { - "name": "row", - "char": null, - "type": "option", - "required": true, - "multiple": true, - "default": null, - "options": [], - "description": "Row as [
/]=[|<description>]. Repeat for several rows; rows with the same section are grouped.", - "env": null, - "helpGroup": null - }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -45995,30 +45775,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "title", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "List title.", - "env": null, - "helpGroup": null - }, - { - "name": "to", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", - "env": null, - "helpGroup": null - }, { "name": "transport", "char": null, @@ -46046,54 +45802,61 @@ ], "examples": [ { - "command": "polymorfa message send list --session session_123 --to +15551234567 --title \"Pick a slot\" --button-text Choose --row \"Morning/am9=9:00\" --row \"Afternoon/pm2=14:00|Near the office\"", + "command": "polymorfa message edit 740000000001 --connection connection_123 --chat 730000000001 --body \"Corrected text\"", "description": "" } ], "state": null }, { - "id": "message send location", - "summary": "Send a location pin.", - "description": "Send a location pin.", - "usage": ["polymorfa message send location [flags]"], + "id": "message mark-seen", + "summary": "Mark a message as seen.", + "description": "Mark a message as seen.", + "usage": ["polymorfa message mark-seen MESSAGE [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "message", + "description": "Message ID.", + "required": true, + "options": [] + } + ], "flags": [ { - "name": "address", + "name": "api-version", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Address shown with the pin.", + "description": "Override the API version for this request.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "api-version", + "name": "chat", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Override the API version for this request.", + "description": "Conversation ID, E.164 phone number, or BSUID.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "forwarded", + "name": "connection", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Mark the message as forwarded.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -46105,7 +45868,7 @@ "multiple": false, "default": null, "options": [], - "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", + "description": "Safely identify retries of this seen receipt.", "env": null, "helpGroup": null }, @@ -46121,42 +45884,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "lat", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Latitude in degrees.", - "env": null, - "helpGroup": null - }, - { - "name": "long", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Longitude in degrees. Use --long=-0.12 for negative values.", - "env": null, - "helpGroup": null - }, - { - "name": "mention", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -46217,30 +45944,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "reply-to", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Polymorfa message ID to quote in the reply.", - "env": null, - "helpGroup": null - }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -46253,30 +45956,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "to", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", - "env": null, - "helpGroup": null - }, - { - "name": "transport", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["auto", "linked_devices", "official_api"], - "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", - "env": null, - "helpGroup": null - }, { "name": "verbose", "char": null, @@ -46290,22 +45969,24 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa message send location --session session_123 --to +15551234567 --lat 51.5007 --long=-0.1246 --address \"Westminster, London\"", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "message send order", - "summary": "Send a Brazil order with Pix, payment link or boleto instructions (beta; Official API Numbers only). Polymorfa relays the order and does not process the payment. Makes one attempt.", - "description": "Send a Brazil order with Pix, payment link or boleto instructions (beta; Official API Numbers only). Polymorfa relays the order and does not process the payment. Makes one attempt.", - "usage": ["polymorfa message send order [flags]"], + "id": "message operation-status", + "summary": "Read the outcome of a message operation without sending again.", + "description": "Read the outcome of a message operation without sending again.", + "usage": ["polymorfa message operation-status OPERATION [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "operation", + "description": "Operation ID from the send response.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -46320,14 +46001,14 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key to check a previous attempt (1-hour retention).", + "description": "Connection name.", "env": null, "helpGroup": null }, @@ -46355,18 +46036,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "order", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Read the orderDetails JSON object (referenceId, type, body, currency, totalAmount, paymentSettings, optional order) from a file or stdin (-).", - "env": null, - "helpGroup": null - }, { "name": "owner", "char": null, @@ -46415,18 +46084,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID of an Official API Number.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -46439,18 +46096,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "to", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID of the buyer.", - "env": null, - "helpGroup": null - }, { "name": "verbose", "char": null, @@ -46464,26 +46109,24 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa message send order --session session_123 --to +5511987654321 --order order.json", - "description": "" - }, - { - "command": "cat order.json | polymorfa message send order --session session_123 --to +5511987654321 --order - --idempotency-key order-1522", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "message send order-status", - "summary": "Update a Brazil order sent with \"message send order\" (beta). Send a payment status only after your payment provider confirms it; captured shows the order as paid. Makes one attempt.", - "description": "Update a Brazil order sent with \"message send order\" (beta). Send a payment status only after your payment provider confirms it; captured shows the order as paid. Makes one attempt.", - "usage": ["polymorfa message send order-status [flags]"], + "id": "message react", + "summary": "React to a message.", + "description": "React to a message.", + "usage": ["polymorfa message react MESSAGE [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "message", + "description": "Message ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -46498,95 +46141,76 @@ "helpGroup": "GLOBAL" }, { - "name": "body", + "name": "chat", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Message text.", + "description": "Conversation ID, E.164 phone number, or BSUID.", "env": null, "helpGroup": null }, { - "name": "footer", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Footer text.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, { - "name": "idempotency-key", + "name": "emoji", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key to check a previous attempt (1-hour retention).", + "description": "Reaction emoji.", "env": null, "helpGroup": null }, { - "name": "json", + "name": "idempotency-key", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "no-color", + "name": "json", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Disable color output.", + "description": "Print one JSON document.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "order-description", + "name": "no-color", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Order status detail, such as a cancellation reason.", - "env": null, - "helpGroup": null - }, - { - "name": "order-status", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [ - "pending", - "processing", - "partially_shipped", - "shipped", - "completed", - "canceled" - ], - "description": "New order status.", + "description": "Disable color output.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "owner", @@ -46600,30 +46224,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "payment-status", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["pending", "captured", "failed"], - "description": "Payment status confirmed by your payment provider.", - "env": null, - "helpGroup": null - }, - { - "name": "payment-timestamp", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Payment time in Unix seconds.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -46660,30 +46260,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "reference-id", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "The referenceId of the order.", - "env": null, - "helpGroup": null - }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID of an Official API Number.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -46697,14 +46273,14 @@ "helpGroup": "GLOBAL" }, { - "name": "to", + "name": "transport", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, - "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID of the buyer.", + "options": ["auto", "linked_devices", "official_api"], + "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", "env": null, "helpGroup": null }, @@ -46721,19 +46297,14 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa message send order-status --session session_123 --to +5511987654321 --reference-id order-1522 --body \"Payment received\" --order-status processing --payment-status captured", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "message send poll", - "summary": "Send a poll.", - "description": "Send a poll.", - "usage": ["polymorfa message send poll [flags]"], + "id": "message send audio", + "summary": "Send audio or a voice note from a local file or URL.", + "description": "Send audio or a voice note from a local file or URL.", + "usage": ["polymorfa message send audio [flags]"], "aliases": [], "hidden": false, "args": [], @@ -46750,6 +46321,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "file", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Local file to upload with the message.", + "env": null, + "helpGroup": null + }, { "name": "forwarded", "char": null, @@ -46786,6 +46381,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "max-bytes", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": 104857600, + "options": [], + "description": "Reject local files larger than this many bytes.", + "env": null, + "helpGroup": null + }, { "name": "mention", "char": null, @@ -46799,14 +46406,14 @@ "helpGroup": null }, { - "name": "multi-select", + "name": "mime-type", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Allow voters to choose more than one option.", + "description": "MIME type. Inferred from the file extension when omitted.", "env": null, "helpGroup": null }, @@ -46822,18 +46429,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "option", - "char": null, - "type": "option", - "required": true, - "multiple": true, - "default": null, - "options": [], - "description": "Poll option. Repeat for 2 to 12 options.", - "env": null, - "helpGroup": null - }, { "name": "owner", "char": null, @@ -46894,18 +46489,6 @@ "env": null, "helpGroup": null }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -46919,38 +46502,38 @@ "helpGroup": "GLOBAL" }, { - "name": "title", + "name": "to", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Poll question.", + "description": "Conversation ID, E.164 phone number, or BSUID.", "env": null, "helpGroup": null }, { - "name": "to", + "name": "transport", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, - "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", + "options": ["auto", "linked_devices", "official_api"], + "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", "env": null, "helpGroup": null }, { - "name": "transport", + "name": "url", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": ["auto", "linked_devices", "official_api"], - "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", + "options": [], + "description": "Public http or https URL the API fetches the media from.", "env": null, "helpGroup": null }, @@ -46965,21 +46548,37 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - } - ], - "examples": [ + }, { - "command": "polymorfa message send poll --session session_123 --to 730000000001 --title \"Lunch?\" --option Pizza --option Sushi", - "description": "" - } - ], - "state": null - }, - { - "id": "message send template", - "summary": "Send an approved message template by name and language.", - "description": "Send an approved message template by name and language.", - "usage": ["polymorfa message send template [flags]"], + "name": "voice", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Send as a push-to-talk voice note instead of an audio file.", + "env": null, + "helpGroup": null + } + ], + "examples": [ + { + "command": "polymorfa message send audio --connection connection_123 --to +15551234567 --file ./note.ogg", + "description": "" + }, + { + "command": "polymorfa message send audio --connection connection_123 --to +15551234567 --url https://example.com/note.ogg", + "description": "" + } + ], + "state": null + }, + { + "id": "message send buttons", + "summary": "Send an interactive message with reply, URL, call, or copy-code buttons.", + "description": "Send an interactive message with reply, URL, call, or copy-code buttons.", + "usage": ["polymorfa message send buttons [flags]"], "aliases": [], "hidden": false, "args": [], @@ -46997,86 +46596,98 @@ "helpGroup": "GLOBAL" }, { - "name": "components", + "name": "body", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Read the template components JSON array from a file or stdin (-).", + "description": "Message body.", "env": null, "helpGroup": null }, { - "name": "forwarded", + "name": "button", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, + "multiple": true, + "default": null, + "options": [], + "description": "Button as reply:<id>=<text>, url:<text>=<url>, call:<text>=<+E.164>, or copy:<text>=<code>. Repeat for several buttons.", + "env": null, + "helpGroup": null + }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Mark the message as forwarded.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, { - "name": "idempotency-key", + "name": "footer", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", + "description": "Footer text.", "env": null, "helpGroup": null }, { - "name": "json", + "name": "forwarded", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Mark the message as forwarded.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "language", + "name": "idempotency-key", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Template language code, such as en_US.", + "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", "env": null, "helpGroup": null }, { - "name": "mention", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, - "multiple": true, + "multiple": false, "default": null, "options": [], - "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "name", + "name": "mention", "char": null, "type": "option", - "required": true, - "multiple": false, + "required": false, + "multiple": true, "default": null, "options": [], - "description": "Template name.", + "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", "env": null, "helpGroup": null }, @@ -47153,28 +46764,28 @@ "helpGroup": null }, { - "name": "session", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "title", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Header title.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "to", @@ -47215,21 +46826,21 @@ ], "examples": [ { - "command": "polymorfa message send template --session session_123 --to +15551234567 --name order_update --language en_US", + "command": "polymorfa message send buttons --connection connection_123 --to +15551234567 --body \"Confirm your order?\" --button reply:yes=Yes --button reply:no=No", "description": "" }, { - "command": "polymorfa message send template --session session_123 --to +15551234567 --name order_update --language en_US --components components.json", + "command": "polymorfa message send buttons --connection connection_123 --to +15551234567 --body \"Track it\" --button \"url:Open tracking=https://example.com/t/123\"", "description": "" } ], "state": null }, { - "id": "message send text", - "summary": "Send a text message.", - "description": "Send a text message.", - "usage": ["polymorfa message send text [flags]"], + "id": "message send contact", + "summary": "Send a contact card built from flags or read from a vCard file.", + "description": "Send a contact card built from flags or read from a vCard file.", + "usage": ["polymorfa message send contact [flags]"], "aliases": [], "hidden": false, "args": [], @@ -47247,14 +46858,14 @@ "helpGroup": "GLOBAL" }, { - "name": "body", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Text to send.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -47306,6 +46917,18 @@ "env": null, "helpGroup": null }, + { + "name": "name", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Contact display name.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -47318,6 +46941,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "organization", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Contact organization.", + "env": null, + "helpGroup": null + }, { "name": "owner", "char": null, @@ -47330,6 +46965,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "phone", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Contact E.164 phone number. Repeat for several phone numbers.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -47378,18 +47025,6 @@ "env": null, "helpGroup": null }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -47426,6 +47061,18 @@ "env": null, "helpGroup": null }, + { + "name": "vcard", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Read one vCard from a file.", + "env": null, + "helpGroup": null + }, { "name": "verbose", "char": null, @@ -47439,14 +47086,23 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa message send contact --connection connection_123 --to +15551234567 --name \"Ada Lovelace\" --phone +15557654321", + "description": "" + }, + { + "command": "polymorfa message send contact --connection connection_123 --to +15551234567 --vcard ./ada.vcf", + "description": "" + } + ], "state": null }, { - "id": "message send video", - "summary": "Send a video from a local file or URL.", - "description": "Send a video from a local file or URL.", - "usage": ["polymorfa message send video [flags]"], + "id": "message send document", + "summary": "Send a document from a local file or URL.", + "description": "Send a document from a local file or URL.", + "usage": ["polymorfa message send document [flags]"], "aliases": [], "hidden": false, "args": [], @@ -47471,7 +47127,19 @@ "multiple": false, "default": null, "options": [], - "description": "Caption sent with the video.", + "description": "Caption sent with the document.", + "env": null, + "helpGroup": null + }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -47487,6 +47155,18 @@ "env": null, "helpGroup": null }, + { + "name": "filename", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "File name shown to the recipient. Defaults to the local file name.", + "env": null, + "helpGroup": null + }, { "name": "forwarded", "char": null, @@ -47631,18 +47311,6 @@ "env": null, "helpGroup": null }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -47706,31 +47374,24 @@ ], "examples": [ { - "command": "polymorfa message send video --session session_123 --to +15551234567 --file ./clip.mp4", + "command": "polymorfa message send document --connection connection_123 --to +15551234567 --file ./invoice.pdf", "description": "" }, { - "command": "polymorfa message send video --session session_123 --to +15551234567 --url https://example.com/clip.mp4", + "command": "polymorfa message send document --connection connection_123 --to +15551234567 --url https://example.com/invoice.pdf", "description": "" } ], "state": null }, { - "id": "message star", - "summary": "Star or unstar a message.", - "description": "Star or unstar a message.", - "usage": ["polymorfa message star MESSAGE [flags]"], + "id": "message send image", + "summary": "Send an image from a local file or URL.", + "description": "Send an image from a local file or URL.", + "usage": ["polymorfa message send image [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "message", - "description": "Message ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -47745,14 +47406,50 @@ "helpGroup": "GLOBAL" }, { - "name": "chat", + "name": "caption", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Caption sent with the image.", + "env": null, + "helpGroup": null + }, + { + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "file", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Local file to upload with the message.", + "env": null, + "helpGroup": null + }, + { + "name": "forwarded", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Mark the message as forwarded.", "env": null, "helpGroup": null }, @@ -47764,7 +47461,7 @@ "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this star update.", + "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", "env": null, "helpGroup": null }, @@ -47780,6 +47477,42 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "max-bytes", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": 104857600, + "options": [], + "description": "Reject local files larger than this many bytes.", + "env": null, + "helpGroup": null + }, + { + "name": "mention", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", + "env": null, + "helpGroup": null + }, + { + "name": "mime-type", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "MIME type. Inferred from the file extension when omitted.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -47841,40 +47574,64 @@ "helpGroup": "GLOBAL" }, { - "name": "remove", + "name": "reply-to", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Remove the existing star.", + "description": "Polymorfa message ID to quote in the reply.", "env": null, "helpGroup": null }, { - "name": "session", + "name": "timeout", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Fail the request after this many milliseconds.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "to", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Conversation ID, E.164 phone number, or BSUID.", "env": null, "helpGroup": null }, { - "name": "timeout", + "name": "transport", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["auto", "linked_devices", "official_api"], + "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", + "env": null, + "helpGroup": null + }, + { + "name": "url", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Public http or https URL the API fetches the media from.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "verbose", @@ -47889,14 +47646,23 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa message send image --connection connection_123 --to +15551234567 --file ./photo.jpg", + "description": "" + }, + { + "command": "polymorfa message send image --connection connection_123 --to +15551234567 --url https://example.com/photo.jpg", + "description": "" + } + ], "state": null }, { - "id": "message typing", - "summary": "Set typing for a chat. Official Numbers require --id and --state typing; the inbound message is marked read.", - "description": "Set typing for a chat. Official Numbers require --id and --state typing; the inbound message is marked read.", - "usage": ["polymorfa message typing [flags]"], + "id": "message send list", + "summary": "Send an interactive list message with selectable rows.", + "description": "Send an interactive list message with selectable rows.", + "usage": ["polymorfa message send list [flags]"], "aliases": [], "hidden": false, "args": [], @@ -47914,26 +47680,62 @@ "helpGroup": "GLOBAL" }, { - "name": "chat", + "name": "button-text", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Conversation ID, E.164 phone number, or BSUID.", + "description": "Label of the button that opens the list.", "env": null, "helpGroup": null }, { - "name": "id", + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "description", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Body text above the button.", + "env": null, + "helpGroup": null + }, + { + "name": "footer", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Inbound message ID. Required on Official Numbers; marks the message read and shows typing for up to 25 seconds.", + "description": "Footer text.", + "env": null, + "helpGroup": null + }, + { + "name": "forwarded", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Mark the message as forwarded.", "env": null, "helpGroup": null }, @@ -47945,7 +47747,7 @@ "multiple": false, "default": null, "options": [], - "description": "Request identifier. The API does not deduplicate typing updates by this header.", + "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", "env": null, "helpGroup": null }, @@ -47961,6 +47763,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "mention", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -48022,26 +47836,26 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "reply-to", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Polymorfa message ID to quote in the reply.", "env": null, "helpGroup": null }, { - "name": "state", + "name": "row", "char": null, "type": "option", "required": true, - "multiple": false, + "multiple": true, "default": null, - "options": ["typing", "recording", "paused"], - "description": "Typing state.", + "options": [], + "description": "Row as [<section>/]<id>=<title>[|<description>]. Repeat for several rows; rows with the same section are grouped.", "env": null, "helpGroup": null }, @@ -48057,6 +47871,42 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "title", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "List title.", + "env": null, + "helpGroup": null + }, + { + "name": "to", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Conversation ID, E.164 phone number, or BSUID.", + "env": null, + "helpGroup": null + }, + { + "name": "transport", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["auto", "linked_devices", "official_api"], + "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", + "env": null, + "helpGroup": null + }, { "name": "verbose", "char": null, @@ -48070,25 +47920,35 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa message send list --connection connection_123 --to +15551234567 --title \"Pick a slot\" --button-text Choose --row \"Morning/am9=9:00\" --row \"Afternoon/pm2=14:00|Near the office\"", + "description": "" + } + ], "state": null }, { - "id": "operation cancel", - "summary": "Request cancellation of a running campaign or production-enrollment operation. The operation moves to cancelling; follow it with operation wait.", - "description": "Request cancellation of a running campaign or production-enrollment operation. The operation moves to cancelling; follow it with operation wait.", - "usage": ["polymorfa operation cancel OPERATION [flags]"], + "id": "message send location", + "summary": "Send a location pin.", + "description": "Send a location pin.", + "usage": ["polymorfa message send location [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "operation", - "description": "Operation ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ + { + "name": "address", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Address shown with the pin.", + "env": null, + "helpGroup": null + }, { "name": "api-version", "char": null, @@ -48101,6 +47961,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "forwarded", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Mark the message as forwarded.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -48109,7 +47993,7 @@ "multiple": false, "default": null, "options": [], - "description": "Use this key to identify retries; one is generated when omitted.", + "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", "env": null, "helpGroup": null }, @@ -48125,6 +48009,42 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "lat", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Latitude in degrees.", + "env": null, + "helpGroup": null + }, + { + "name": "long", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Longitude in degrees. Use --long=-0.12 for negative values.", + "env": null, + "helpGroup": null + }, + { + "name": "mention", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -48185,6 +48105,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "reply-to", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Polymorfa message ID to quote in the reply.", + "env": null, + "helpGroup": null + }, { "name": "timeout", "char": null, @@ -48198,38 +48130,55 @@ "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "to", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Conversation ID, E.164 phone number, or BSUID.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "yes", + "name": "transport", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["auto", "linked_devices", "official_api"], + "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", + "env": null, + "helpGroup": null + }, + { + "name": "verbose", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Confirm the external effect without prompting.", + "description": "Explain context and workflow decisions.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" + } + ], + "examples": [ + { + "command": "polymorfa message send location --connection connection_123 --to +15551234567 --lat 51.5007 --long=-0.1246 --address \"Westminster, London\"", + "description": "" } ], - "examples": [], "state": null }, { - "id": "operation list", - "summary": "List asynchronous operations, newest first. Team owners see team and project operations; project owners see one project.", - "description": "List asynchronous operations, newest first. Team owners see team and project operations; project owners see one project.", - "usage": ["polymorfa operation list [flags]"], + "id": "message send order", + "summary": "Send a Brazil order with Pix, payment link or boleto instructions (beta; Official API Connections only). Polymorfa relays the order and does not process the payment. Makes one attempt.", + "description": "Send a Brazil order with Pix, payment link or boleto instructions (beta; Official API Connections only). Polymorfa relays the order and does not process the payment. Makes one attempt.", + "usage": ["polymorfa message send order [flags]"], "aliases": [], "hidden": false, "args": [], @@ -48247,14 +48196,26 @@ "helpGroup": "GLOBAL" }, { - "name": "cursor", + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID of an Official API Connection.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Continue from this opaque cursor.", + "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key to check a previous attempt (1-hour retention).", "env": null, "helpGroup": null }, @@ -48271,281 +48232,285 @@ "helpGroup": "GLOBAL" }, { - "name": "kind", + "name": "no-color", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Filter by operation kind, for example campaign.", + "description": "Disable color output.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "limit", + "name": "order", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, - "default": 25, + "default": null, "options": [], - "description": "Request this many resources per page.", + "description": "Read the orderDetails JSON object (referenceId, type, body, currency, totalAmount, paymentSettings, optional order) from a file or stdin (-).", "env": null, "helpGroup": null }, { - "name": "max-items", + "name": "owner", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Stop automatic pagination after this many resources.", + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "no-color", + "name": "profile", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Disable color output.", + "description": "Use a named authentication profile.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "owner", + "name": "project", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", + "options": [], + "description": "Use a project other than the active context.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "paginate", + "name": "quiet", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Request consecutive pages until --max-items resources are collected or no pages remain. Requires --max-items.", + "description": "Suppress successful output.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "profile", + "name": "timeout", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a named authentication profile.", + "description": "Fail the request after this many milliseconds.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "project", + "name": "to", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Use a project other than the active context.", + "description": "Conversation ID, E.164 phone number, or BSUID of the buyer.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "quiet", + "name": "verbose", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Suppress successful output.", + "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" + } + ], + "examples": [ + { + "command": "polymorfa message send order --connection connection_123 --to +5511987654321 --order order.json", + "description": "" }, { - "name": "resource-id", + "command": "cat order.json | polymorfa message send order --connection connection_123 --to +5511987654321 --order - --idempotency-key order-1522", + "description": "" + } + ], + "state": null + }, + { + "id": "message send order-status", + "summary": "Update a Brazil order sent with \"message send order\" (beta). Send a payment status only after your payment provider confirms it; captured shows the order as paid. Makes one attempt.", + "description": "Update a Brazil order sent with \"message send order\" (beta). Send a payment status only after your payment provider confirms it; captured shows the order as paid. Makes one attempt.", + "usage": ["polymorfa message send order-status [flags]"], + "aliases": [], + "hidden": false, + "args": [], + "flags": [ + { + "name": "api-version", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Filter by resource ID. Requires --resource-type.", + "description": "Override the API version for this request.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "resource-type", + "name": "body", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Filter by resource type. Requires --resource-id.", + "description": "Message text.", "env": null, "helpGroup": null }, { - "name": "since", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Include operations created at or after this RFC 3339 time.", + "description": "Messaging connection ID of an Official API Connection.", "env": null, "helpGroup": null }, { - "name": "status", + "name": "footer", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": [ - "pending", - "running", - "action_required", - "cancelling", - "succeeded", - "failed", - "cancelled" - ], - "description": "Filter by status.", + "options": [], + "description": "Footer text.", "env": null, "helpGroup": null }, { - "name": "timeout", + "name": "idempotency-key", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key to check a previous attempt (1-hour retention).", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "until", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Include operations created before this RFC 3339 time.", + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "no-color", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Disable color output.", "env": null, "helpGroup": "GLOBAL" - } - ], - "examples": [ - { - "command": "polymorfa operation list --status running", - "description": "" }, { - "command": "polymorfa operation list --resource-type campaign --resource-id <campaign-id> --json", - "description": "" - } - ], - "state": null - }, - { - "id": "operation view", - "summary": "View one asynchronous operation: status, sequence, progress, error, and whether it can be cancelled.", - "description": "View one asynchronous operation: status, sequence, progress, error, and whether it can be cancelled.", - "usage": ["polymorfa operation view OPERATION [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "operation", - "description": "Operation ID.", - "required": true, - "options": [] - } - ], - "flags": [ - { - "name": "api-version", + "name": "order-description", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Override the API version for this request.", + "description": "Order status detail, such as a cancellation reason.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "json", + "name": "order-status", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Print one JSON document.", + "options": [ + "pending", + "processing", + "partially_shipped", + "shipped", + "completed", + "canceled" + ], + "description": "New order status.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "no-color", + "name": "owner", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Disable color output.", + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "owner", + "name": "payment-status", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", + "options": ["pending", "captured", "failed"], + "description": "Payment status confirmed by your payment provider.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null + }, + { + "name": "payment-timestamp", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Payment time in Unix seconds.", + "env": null, + "helpGroup": null }, { "name": "profile", @@ -48583,6 +48548,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "reference-id", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "The referenceId of the order.", + "env": null, + "helpGroup": null + }, { "name": "timeout", "char": null, @@ -48595,6 +48572,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "to", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Conversation ID, E.164 phone number, or BSUID of the buyer.", + "env": null, + "helpGroup": null + }, { "name": "verbose", "char": null, @@ -48608,24 +48597,22 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa message send order-status --connection connection_123 --to +5511987654321 --reference-id order-1522 --body \"Payment received\" --order-status processing --payment-status captured", + "description": "" + } + ], "state": null }, { - "id": "operation wait", - "summary": "Wait until an operation succeeds, fails, or is cancelled. Exits 0 on success, 1 on failure or cancellation, and 8 when --timeout ends first.", - "description": "Wait until an operation succeeds, fails, or is cancelled. Exits 0 on success, 1 on failure or cancellation, and 8 when --timeout ends first.", - "usage": ["polymorfa operation wait OPERATION [flags]"], + "id": "message send poll", + "summary": "Send a poll.", + "description": "Send a poll.", + "usage": ["polymorfa message send poll [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "operation", - "description": "Operation ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -48640,219 +48627,206 @@ "helpGroup": "GLOBAL" }, { - "name": "json", + "name": "connection", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Messaging connection ID.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "no-color", + "name": "forwarded", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Disable color output.", + "description": "Mark the message as forwarded.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "owner", + "name": "idempotency-key", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", + "options": [], + "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "profile", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a named authentication profile.", + "description": "Print one JSON document.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "project", + "name": "mention", "char": null, "type": "option", "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", + "env": null, + "helpGroup": null + }, + { + "name": "multi-select", + "char": null, + "type": "boolean", + "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a project other than the active context.", + "description": "Allow voters to choose more than one option.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "quiet", + "name": "no-color", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Suppress successful output.", + "description": "Disable color output.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "option", "char": null, "type": "option", - "required": false, - "multiple": false, - "default": 300, + "required": true, + "multiple": true, + "default": null, "options": [], - "description": "Stop waiting after this many seconds.", + "description": "Poll option. Repeat for 2 to 12 options.", "env": null, "helpGroup": null }, { - "name": "verbose", + "name": "owner", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Explain context and workflow decisions.", + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", "env": null, "helpGroup": "GLOBAL" - } - ], - "examples": [ - { - "command": "polymorfa operation wait <operation-id> --timeout 600", - "description": "" - } - ], - "state": null - }, - { - "id": "operation watch", - "summary": "Print each status change of an operation until it succeeds, fails, or is cancelled. With --json, prints one JSON document per change. Exits like operation wait.", - "description": "Print each status change of an operation until it succeeds, fails, or is cancelled. With --json, prints one JSON document per change. Exits like operation wait.", - "usage": ["polymorfa operation watch OPERATION [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "operation", - "description": "Operation ID.", - "required": true, - "options": [] - } - ], - "flags": [ + }, { - "name": "api-version", + "name": "profile", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Override the API version for this request.", + "description": "Use a named authentication profile.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "json", + "name": "project", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Use a project other than the active context.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "no-color", + "name": "quiet", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Disable color output.", + "description": "Suppress successful output.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "owner", + "name": "reply-to", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", + "options": [], + "description": "Polymorfa message ID to quote in the reply.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "profile", + "name": "timeout", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a named authentication profile.", + "description": "Fail the request after this many milliseconds.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "project", + "name": "title", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Use a project other than the active context.", + "description": "Poll question.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "quiet", + "name": "to", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Suppress successful output.", + "description": "Conversation ID, E.164 phone number, or BSUID.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "timeout", + "name": "transport", "char": null, "type": "option", "required": false, "multiple": false, - "default": 300, - "options": [], - "description": "Stop waiting after this many seconds.", + "default": null, + "options": ["auto", "linked_devices", "official_api"], + "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", "env": null, "helpGroup": null }, @@ -48869,14 +48843,19 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa message send poll --connection connection_123 --to 730000000001 --title \"Lunch?\" --option Pizza --option Sushi", + "description": "" + } + ], "state": null }, { - "id": "optout settings update", - "summary": "Replace the organization’s STOP and START keyword capture settings. Every field is replaced, so pass the complete keyword set.", - "description": "Replace the organization’s STOP and START keyword capture settings. Every field is replaced, so pass the complete keyword set.", - "usage": ["polymorfa optout settings update [flags]"], + "id": "message send template", + "summary": "Send an approved message template by name and language.", + "description": "Send an approved message template by name and language.", + "usage": ["polymorfa message send template [flags]"], "aliases": [], "hidden": false, "args": [], @@ -48894,14 +48873,38 @@ "helpGroup": "GLOBAL" }, { - "name": "enabled", + "name": "components", "char": null, - "type": "boolean", + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Read the template components JSON array from a file or stdin (-).", + "env": null, + "helpGroup": null + }, + { + "name": "connection", + "char": null, + "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Capture keyword replies. Pass --no-enabled to stop capturing.", + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "forwarded", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Mark the message as forwarded.", "env": null, "helpGroup": null }, @@ -48913,7 +48916,7 @@ "multiple": false, "default": null, "options": [], - "description": "Send this Idempotency-Key header. None is generated when omitted.", + "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", "env": null, "helpGroup": null }, @@ -48930,41 +48933,53 @@ "helpGroup": "GLOBAL" }, { - "name": "no-color", + "name": "language", "char": null, - "type": "boolean", - "required": false, + "type": "option", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Disable color output.", + "description": "Template language code, such as en_US.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "opt-in-keyword", + "name": "mention", "char": null, "type": "option", "required": false, "multiple": true, "default": null, "options": [], - "description": "A keyword that opts a contact back in. Repeatable.", + "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", "env": null, "helpGroup": null }, { - "name": "opt-out-keyword", + "name": "name", "char": null, "type": "option", "required": true, - "multiple": true, + "multiple": false, "default": null, "options": [], - "description": "A keyword that suppresses a contact. Repeatable; at least one is required.", + "description": "Template name.", "env": null, "helpGroup": null }, + { + "name": "no-color", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Disable color output.", + "env": null, + "helpGroup": "GLOBAL" + }, { "name": "owner", "char": null, @@ -49013,6 +49028,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "reply-to", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Polymorfa message ID to quote in the reply.", + "env": null, + "helpGroup": null + }, { "name": "timeout", "char": null, @@ -49025,6 +49052,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "to", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Conversation ID, E.164 phone number, or BSUID.", + "env": null, + "helpGroup": null + }, + { + "name": "transport", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["auto", "linked_devices", "official_api"], + "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", + "env": null, + "helpGroup": null + }, { "name": "verbose", "char": null, @@ -49040,21 +49091,21 @@ ], "examples": [ { - "command": "polymorfa optout settings update --enabled --opt-out-keyword STOP --opt-out-keyword BAJA --opt-in-keyword START", + "command": "polymorfa message send template --connection connection_123 --to +15551234567 --name order_update --language en_US", "description": "" }, { - "command": "polymorfa optout settings update --no-enabled --opt-out-keyword STOP", + "command": "polymorfa message send template --connection connection_123 --to +15551234567 --name order_update --language en_US --components components.json", "description": "" } ], "state": null }, { - "id": "optout settings view", - "summary": "Show the organization’s STOP and START keyword capture settings.", - "description": "Show the organization’s STOP and START keyword capture settings.", - "usage": ["polymorfa optout settings view [flags]"], + "id": "message send text", + "summary": "Send a text message.", + "description": "Send a text message.", + "usage": ["polymorfa message send text [flags]"], "aliases": [], "hidden": false, "args": [], @@ -49071,6 +49122,54 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "body", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Text to send.", + "env": null, + "helpGroup": null + }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "forwarded", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Mark the message as forwarded.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -49083,6 +49182,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "mention", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -49144,224 +49255,197 @@ "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "reply-to", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Polymorfa message ID to quote in the reply.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "verbose", + "name": "timeout", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Fail the request after this many milliseconds.", "env": null, "helpGroup": "GLOBAL" - } - ], - "examples": [], - "state": null - }, - { - "id": "presence chat subscribe", - "summary": "Subscribe to or renew retained presence observations for a chat.", - "description": "Subscribe to or renew retained presence observations for a chat.", - "usage": ["polymorfa presence chat subscribe CHAT [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "chat", - "description": "Polymorfa user ID.", - "required": true, - "options": [] - } - ], - "flags": [ + }, { - "name": "api-version", + "name": "to", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Override the API version for this request.", + "description": "Conversation ID, E.164 phone number, or BSUID.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "idempotency-key", + "name": "transport", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Safely identify retries of this subscription request.", + "options": ["auto", "linked_devices", "official_api"], + "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", "env": null, "helpGroup": null }, { - "name": "json", + "name": "verbose", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, + } + ], + "examples": [], + "state": null + }, + { + "id": "message send video", + "summary": "Send a video from a local file or URL.", + "description": "Send a video from a local file or URL.", + "usage": ["polymorfa message send video [flags]"], + "aliases": [], + "hidden": false, + "args": [], + "flags": [ { - "name": "no-color", + "name": "api-version", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Disable color output.", + "description": "Override the API version for this request.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "owner", + "name": "caption", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", + "options": [], + "description": "Caption sent with the video.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "profile", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Use a named authentication profile.", + "description": "Messaging connection ID.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "project", + "name": "file", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a project other than the active context.", + "description": "Local file to upload with the message.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "quiet", + "name": "forwarded", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Suppress successful output.", + "description": "Mark the message as forwarded.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "session", + "name": "idempotency-key", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).", "env": null, "helpGroup": null }, { - "name": "timeout", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Print one JSON document.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "max-bytes", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, - "default": null, + "default": 104857600, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Reject local files larger than this many bytes.", "env": null, - "helpGroup": "GLOBAL" - } - ], - "examples": [], - "state": null - }, - { - "id": "presence chat view", - "summary": "View retained, policy-governed presence observations for a chat.", - "description": "View retained, policy-governed presence observations for a chat.", - "usage": ["polymorfa presence chat view CHAT [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "chat", - "description": "Polymorfa conversation ID.", - "required": true, - "options": [] - } - ], - "flags": [ + "helpGroup": null + }, { - "name": "api-version", + "name": "mention", "char": null, "type": "option", "required": false, - "multiple": false, + "multiple": true, "default": null, "options": [], - "description": "Override the API version for this request.", + "description": "Mention a Polymorfa user ID. Repeat for multiple recipients.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "json", + "name": "mime-type", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "MIME type. Inferred from the file extension when omitted.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "no-color", @@ -49424,14 +49508,14 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "reply-to", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Polymorfa message ID to quote in the reply.", "env": null, "helpGroup": null }, @@ -49447,6 +49531,42 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "to", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Conversation ID, E.164 phone number, or BSUID.", + "env": null, + "helpGroup": null + }, + { + "name": "transport", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["auto", "linked_devices", "official_api"], + "description": "Send using routing rules (auto), Linked Devices, or Official API. Explicit choices never fall back.", + "env": null, + "helpGroup": null + }, + { + "name": "url", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Public http or https URL the API fetches the media from.", + "env": null, + "helpGroup": null + }, { "name": "verbose", "char": null, @@ -49460,17 +49580,33 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa message send video --connection connection_123 --to +15551234567 --file ./clip.mp4", + "description": "" + }, + { + "command": "polymorfa message send video --connection connection_123 --to +15551234567 --url https://example.com/clip.mp4", + "description": "" + } + ], "state": null }, { - "id": "presence set", - "summary": "Set the connected account presence state.", - "description": "Set the connected account presence state.", - "usage": ["polymorfa presence set [flags]"], + "id": "message star", + "summary": "Star or unstar a message.", + "description": "Star or unstar a message.", + "usage": ["polymorfa message star MESSAGE [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "message", + "description": "Message ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -49484,6 +49620,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "chat", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Conversation ID, E.164 phone number, or BSUID.", + "env": null, + "helpGroup": null + }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "idempotency-key", "char": null, @@ -49492,7 +49652,7 @@ "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this presence update.", + "description": "Safely identify retries of this star update.", "env": null, "helpGroup": null }, @@ -49569,26 +49729,14 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "remove", "char": null, - "type": "option", - "required": true, + "type": "boolean", + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, - { - "name": "state", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": ["available", "unavailable"], - "description": "Connected account presence state.", + "description": "Remove the existing star.", "env": null, "helpGroup": null }, @@ -49621,10 +49769,10 @@ "state": null }, { - "id": "presence view", - "summary": "View remembered self presence state (not a live authoritative query).", - "description": "View remembered self presence state (not a live authoritative query).", - "usage": ["polymorfa presence view [flags]"], + "id": "message typing", + "summary": "Set typing for a chat. Official Connections require --id and --state typing; the inbound message is marked read.", + "description": "Set typing for a chat. Official Connections require --id and --state typing; the inbound message is marked read.", + "usage": ["polymorfa message typing [flags]"], "aliases": [], "hidden": false, "args": [], @@ -49641,6 +49789,54 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "chat", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Conversation ID, E.164 phone number, or BSUID.", + "env": null, + "helpGroup": null + }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "id", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Inbound message ID. Required on Official Connections; marks the message read and shows typing for up to 25 seconds.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Request identifier. The API does not deduplicate typing updates by this header.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -49714,14 +49910,14 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "state", "char": null, "type": "option", "required": true, "multiple": false, "default": null, - "options": [], - "description": "Messaging session ID.", + "options": ["typing", "recording", "paused"], + "description": "Typing state.", "env": null, "helpGroup": null }, @@ -49754,13 +49950,20 @@ "state": null }, { - "id": "privacy disappearing-timer set", - "summary": "Set the account default for new disappearing-message chats.", - "description": "Set the account default for new disappearing-message chats.", - "usage": ["polymorfa privacy disappearing-timer set [flags]"], + "id": "operation cancel", + "summary": "Request cancellation of a running campaign or production-enrollment operation. The operation moves to cancelling; follow it with operation wait.", + "description": "Request cancellation of a running campaign or production-enrollment operation. The operation moves to cancelling; follow it with operation wait.", + "usage": ["polymorfa operation cancel OPERATION [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "operation", + "description": "Operation ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -49774,18 +49977,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "duration", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": ["off", "24h", "7d", "90d"], - "description": "Account-default duration.", - "env": null, - "helpGroup": null - }, { "name": "idempotency-key", "char": null, @@ -49794,7 +49985,7 @@ "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this timer update.", + "description": "Use this key to identify retries; one is generated when omitted.", "env": null, "helpGroup": null }, @@ -49871,50 +50062,50 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "verbose", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "yes", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Confirm the external effect without prompting.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null } ], "examples": [], "state": null }, { - "id": "privacy set", - "summary": "Set one account-level privacy setting.", - "description": "Set one account-level privacy setting.", - "usage": ["polymorfa privacy set [flags]"], + "id": "operation list", + "summary": "List asynchronous operations, newest first. Team owners see team and project operations; project owners see one project.", + "description": "List asynchronous operations, newest first. Team owners see team and project operations; project owners see one project.", + "usage": ["polymorfa operation list [flags]"], "aliases": [], "hidden": false, "args": [], @@ -49932,14 +50123,14 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "cursor", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this privacy update.", + "description": "Continue from this opaque cursor.", "env": null, "helpGroup": null }, @@ -49955,6 +50146,42 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "kind", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Filter by operation kind, for example campaign.", + "env": null, + "helpGroup": null + }, + { + "name": "limit", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": 25, + "options": [], + "description": "Request this many resources per page.", + "env": null, + "helpGroup": null + }, + { + "name": "max-items", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Stop automatic pagination after this many resources.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -49979,6 +50206,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "paginate", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Request consecutive pages until --max-items resources are collected or no pages remain. Requires --max-items.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -50016,26 +50255,58 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "resource-id", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Filter by resource ID. Requires --resource-type.", "env": null, "helpGroup": null }, { - "name": "setting", + "name": "resource-type", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Privacy setting name.", + "description": "Filter by resource type. Requires --resource-id.", + "env": null, + "helpGroup": null + }, + { + "name": "since", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Include operations created at or after this RFC 3339 time.", + "env": null, + "helpGroup": null + }, + { + "name": "status", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [ + "pending", + "running", + "action_required", + "cancelling", + "succeeded", + "failed", + "cancelled" + ], + "description": "Filter by status.", "env": null, "helpGroup": null }, @@ -50052,14 +50323,14 @@ "helpGroup": "GLOBAL" }, { - "name": "value", + "name": "until", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Value allowed for the selected setting.", + "description": "Include operations created before this RFC 3339 time.", "env": null, "helpGroup": null }, @@ -50076,17 +50347,33 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa operation list --status running", + "description": "" + }, + { + "command": "polymorfa operation list --resource-type campaign --resource-id <campaign-id> --json", + "description": "" + } + ], "state": null }, { - "id": "privacy view", - "summary": "View account-level Messaging privacy settings.", - "description": "View account-level Messaging privacy settings.", - "usage": ["polymorfa privacy view [flags]"], + "id": "operation view", + "summary": "View one asynchronous operation: status, sequence, progress, error, and whether it can be cancelled.", + "description": "View one asynchronous operation: status, sequence, progress, error, and whether it can be cancelled.", + "usage": ["polymorfa operation view OPERATION [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "operation", + "description": "Operation ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -50172,18 +50459,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -50213,13 +50488,20 @@ "state": null }, { - "id": "profile name set", - "summary": "Set the connected account profile name.", - "description": "Set the connected account profile name.", - "usage": ["polymorfa profile name set [flags]"], + "id": "operation wait", + "summary": "Wait until an operation succeeds, fails, or is cancelled. Exits 0 on success, 1 on failure or cancellation, and 8 when --timeout ends first.", + "description": "Wait until an operation succeeds, fails, or is cancelled. Exits 0 on success, 1 on failure or cancellation, and 8 when --timeout ends first.", + "usage": ["polymorfa operation wait OPERATION [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "operation", + "description": "Operation ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -50233,18 +50515,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Safely identify retries of this name update.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -50257,18 +50527,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "name", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Complete profile name.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -50329,29 +50587,17 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, "type": "option", "required": false, "multiple": false, - "default": null, + "default": 300, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Stop waiting after this many seconds.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "verbose", @@ -50366,17 +50612,29 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa operation wait <operation-id> --timeout 600", + "description": "" + } + ], "state": null }, { - "id": "profile picture delete", - "summary": "Delete the connected account profile picture.", - "description": "Delete the connected account profile picture.", - "usage": ["polymorfa profile picture delete [flags]"], + "id": "operation watch", + "summary": "Print each status change of an operation until it succeeds, fails, or is cancelled. With --json, prints one JSON document per change. Exits like operation wait.", + "description": "Print each status change of an operation until it succeeds, fails, or is cancelled. With --json, prints one JSON document per change. Exits like operation wait.", + "usage": ["polymorfa operation watch OPERATION [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "operation", + "description": "Operation ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -50390,18 +50648,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Safely identify retries of this picture deletion.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -50474,29 +50720,17 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, "type": "option", "required": false, "multiple": false, - "default": null, + "default": 300, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Stop waiting after this many seconds.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "verbose", @@ -50509,28 +50743,16 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, - { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm permanent profile-picture deletion.", - "env": null, - "helpGroup": null } ], "examples": [], "state": null }, { - "id": "profile picture set", - "summary": "Set the connected account profile picture.", - "description": "Set the connected account profile picture.", - "usage": ["polymorfa profile picture set [flags]"], + "id": "optout settings update", + "summary": "Replace the organization’s STOP and START keyword capture settings. Every field is replaced, so pass the complete keyword set.", + "description": "Replace the organization’s STOP and START keyword capture settings. Every field is replaced, so pass the complete keyword set.", + "usage": ["polymorfa optout settings update [flags]"], "aliases": [], "hidden": false, "args": [], @@ -50548,14 +50770,14 @@ "helpGroup": "GLOBAL" }, { - "name": "file", + "name": "enabled", "char": null, - "type": "option", - "required": false, + "type": "boolean", + "required": true, "multiple": false, "default": null, "options": [], - "description": "Local picture path. Sent as bounded base64 JSON.", + "description": "Capture keyword replies. Pass --no-enabled to stop capturing.", "env": null, "helpGroup": null }, @@ -50567,7 +50789,7 @@ "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this picture update.", + "description": "Send this Idempotency-Key header. None is generated when omitted.", "env": null, "helpGroup": null }, @@ -50595,6 +50817,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "opt-in-keyword", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "A keyword that opts a contact back in. Repeatable.", + "env": null, + "helpGroup": null + }, + { + "name": "opt-out-keyword", + "char": null, + "type": "option", + "required": true, + "multiple": true, + "default": null, + "options": [], + "description": "A keyword that suppresses a contact. Repeatable; at least one is required.", + "env": null, + "helpGroup": null + }, { "name": "owner", "char": null, @@ -50643,18 +50889,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -50667,18 +50901,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "url", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Remote picture URL fetched by the Messaging service.", - "env": null, - "helpGroup": null - }, { "name": "verbose", "char": null, @@ -50692,14 +50914,23 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + { + "command": "polymorfa optout settings update --enabled --opt-out-keyword STOP --opt-out-keyword BAJA --opt-in-keyword START", + "description": "" + }, + { + "command": "polymorfa optout settings update --no-enabled --opt-out-keyword STOP", + "description": "" + } + ], "state": null }, { - "id": "profile status set", - "summary": "Set the connected account profile status.", - "description": "Set the connected account profile status.", - "usage": ["polymorfa profile status set [flags]"], + "id": "optout settings view", + "summary": "Show the organization’s STOP and START keyword capture settings.", + "description": "Show the organization’s STOP and START keyword capture settings.", + "usage": ["polymorfa optout settings view [flags]"], "aliases": [], "hidden": false, "args": [], @@ -50716,18 +50947,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Safely identify retries of this status update.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -50800,30 +51019,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, - { - "name": "status", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Complete profile status.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -50853,13 +51048,20 @@ "state": null }, { - "id": "profile view", - "summary": "View the connected account profile.", - "description": "View the connected account profile.", - "usage": ["polymorfa profile view [flags]"], + "id": "presence chat subscribe", + "summary": "Subscribe to or renew retained presence observations for a chat.", + "description": "Subscribe to or renew retained presence observations for a chat.", + "usage": ["polymorfa presence chat subscribe CHAT [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "chat", + "description": "Polymorfa user ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -50873,6 +51075,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this subscription request.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -50945,18 +51171,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -50986,13 +51200,20 @@ "state": null }, { - "id": "project-token list", - "summary": "List project-token metadata (never raw token material).", - "description": "List project-token metadata (never raw token material).", - "usage": ["polymorfa project-token list [flags]"], + "id": "presence chat view", + "summary": "View retained, policy-governed presence observations for a chat.", + "description": "View retained, policy-governed presence observations for a chat.", + "usage": ["polymorfa presence chat view CHAT [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "chat", + "description": "Polymorfa conversation ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -51006,6 +51227,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -51107,10 +51340,10 @@ "state": null }, { - "id": "project current", - "summary": "Show the project commands use here and where it comes from: --project, a directory link, or the profile.", - "description": "Show the project commands use here and where it comes from: --project, a directory link, or the profile.", - "usage": ["polymorfa project current [flags]"], + "id": "presence set", + "summary": "Set the connected account presence state.", + "description": "Set the connected account presence state.", + "usage": ["polymorfa presence set [flags]"], "aliases": [], "hidden": false, "args": [], @@ -51127,6 +51360,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this presence update.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -51199,6 +51456,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "state", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": ["available", "unavailable"], + "description": "Connected account presence state.", + "env": null, + "helpGroup": null + }, { "name": "timeout", "char": null, @@ -51228,10 +51497,10 @@ "state": null }, { - "id": "project list", - "summary": "List projects available to the current credential and mark the current one.", - "description": "List projects available to the current credential and mark the current one.", - "usage": ["polymorfa project list [flags]"], + "id": "presence view", + "summary": "View remembered self presence state (not a live authoritative query).", + "description": "View remembered self presence state (not a live authoritative query).", + "usage": ["polymorfa presence view [flags]"], "aliases": [], "hidden": false, "args": [], @@ -51248,6 +51517,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -51349,20 +51630,13 @@ "state": null }, { - "id": "project use", - "summary": "Store the default project for the active or selected profile.", - "description": "Store the default project for the active or selected profile.", - "usage": ["polymorfa project use PROJECT [flags]"], + "id": "privacy disappearing-timer set", + "summary": "Set the account default for new disappearing-message chats.", + "description": "Set the account default for new disappearing-message chats.", + "usage": ["polymorfa privacy disappearing-timer set [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "project", - "description": "Project UUID or slug.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -51376,6 +51650,42 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "duration", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": ["off", "24h", "7d", "90d"], + "description": "Account-default duration.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this timer update.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -51473,20 +51783,14 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - {"command": "polymorfa project use my-app", "description": ""}, - { - "command": "polymorfa project use 11111111-1111-4111-8111-111111111111 --profile work", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "quick-reply create", - "summary": "Create a quick reply.", - "description": "Create a quick reply.", - "usage": ["polymorfa quick-reply create [flags]"], + "id": "privacy set", + "summary": "Set one account-level privacy setting.", + "description": "Set one account-level privacy setting.", + "usage": ["polymorfa privacy set [flags]"], "aliases": [], "hidden": false, "args": [], @@ -51504,14 +51808,14 @@ "helpGroup": "GLOBAL" }, { - "name": "count", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Initial source count.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -51523,7 +51827,7 @@ "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this create operation.", + "description": "Safely identify retries of this privacy update.", "env": null, "helpGroup": null }, @@ -51539,30 +51843,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "keyword", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Matching keyword. Repeat to add multiple keywords.", - "env": null, - "helpGroup": null - }, - { - "name": "message", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Complete reply message.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -51624,40 +51904,40 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "setting", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "Messaging session ID.", + "description": "Privacy setting name.", "env": null, "helpGroup": null }, { - "name": "shortcut", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Quick-reply shortcut, such as /hours.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "value", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Value allowed for the selected setting.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "verbose", @@ -51676,20 +51956,13 @@ "state": null }, { - "id": "quick-reply delete", - "summary": "Delete a quick reply.", - "description": "Delete a quick reply.", - "usage": ["polymorfa quick-reply delete QUICK-REPLY [flags]"], + "id": "privacy view", + "summary": "View account-level Messaging privacy settings.", + "description": "View account-level Messaging privacy settings.", + "usage": ["polymorfa privacy view [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "quick-reply", - "description": "Quick-reply ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -51704,14 +51977,14 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this delete operation.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -51787,18 +52060,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -51822,28 +52083,16 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, - { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm permanent quick-reply deletion.", - "env": null, - "helpGroup": null } ], "examples": [], "state": null }, { - "id": "quick-reply list", - "summary": "List observed quick replies for a session.", - "description": "List observed quick replies for a session.", - "usage": ["polymorfa quick-reply list [flags]"], + "id": "profile name set", + "summary": "Set the connected account profile name.", + "description": "Set the connected account profile name.", + "usage": ["polymorfa profile name set [flags]"], "aliases": [], "hidden": false, "args": [], @@ -51860,6 +52109,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this name update.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -51872,6 +52145,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "name", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Complete profile name.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -51932,18 +52217,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -51973,20 +52246,13 @@ "state": null }, { - "id": "quick-reply replace", - "summary": "Replace a complete quick reply.", - "description": "Replace a complete quick reply.", - "usage": ["polymorfa quick-reply replace QUICK-REPLY [flags]"], + "id": "profile picture delete", + "summary": "Delete the connected account profile picture.", + "description": "Delete the connected account profile picture.", + "usage": ["polymorfa profile picture delete [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "quick-reply", - "description": "Quick-reply ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -52001,14 +52267,14 @@ "helpGroup": "GLOBAL" }, { - "name": "count", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Replacement source count.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -52020,7 +52286,7 @@ "multiple": false, "default": null, "options": [], - "description": "Safely identify retries of this replacement.", + "description": "Safely identify retries of this picture deletion.", "env": null, "helpGroup": null }, @@ -52036,30 +52302,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "keyword", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Matching keyword. Repeat to add multiple keywords.", - "env": null, - "helpGroup": null - }, - { - "name": "message", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Complete reply message.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -52121,62 +52363,50 @@ "helpGroup": "GLOBAL" }, { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, - { - "name": "shortcut", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Complete quick-reply shortcut.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "verbose", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "verbose", + "name": "yes", "char": null, "type": "boolean", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Confirm permanent profile-picture deletion.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null } ], "examples": [], "state": null }, { - "id": "quicklink availability", - "summary": "Read a Number’s connections and whether an added connection is available.", - "description": "Read a Number’s connections and whether an added connection is available.", - "usage": ["polymorfa quicklink availability [flags]"], + "id": "profile picture set", + "summary": "Set the connected account profile picture.", + "description": "Set the connected account profile picture.", + "usage": ["polymorfa profile picture set [flags]"], "aliases": [], "hidden": false, "args": [], @@ -52193,6 +52423,42 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "file", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Local picture path. Sent as bounded base64 JSON.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this picture update.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -52266,28 +52532,28 @@ "helpGroup": "GLOBAL" }, { - "name": "session", + "name": "timeout", "char": null, "type": "option", - "required": true, + "required": false, "multiple": false, "default": null, "options": [], - "description": "Existing Number session name.", + "description": "Fail the request after this many milliseconds.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "url", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Remote picture URL fetched by the Messaging service.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "verbose", @@ -52306,20 +52572,13 @@ "state": null }, { - "id": "quicklink cancel", - "summary": "Cancel pending QuickLink setup. Supplementary links preserve the existing Number.", - "description": "Cancel pending QuickLink setup. Supplementary links preserve the existing Number.", - "usage": ["polymorfa quicklink cancel QUICKLINK [flags]"], + "id": "profile status set", + "summary": "Set the connected account profile status.", + "description": "Set the connected account profile status.", + "usage": ["polymorfa profile status set [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "quicklink", - "description": "QuickLink ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -52333,6 +52592,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this status update.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -52406,83 +52689,54 @@ "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "status", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Complete profile status.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "verbose", + "name": "timeout", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Explain context and workflow decisions.", + "description": "Fail the request after this many milliseconds.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "yes", + "name": "verbose", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Confirm QuickLink cancellation.", + "description": "Explain context and workflow decisions.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" } ], "examples": [], "state": null }, { - "id": "quicklink create", - "summary": "Create a persistent real or simulated onboarding QuickLink.", - "description": "Create a persistent real or simulated onboarding QuickLink.", - "usage": ["polymorfa quicklink create [flags]"], + "id": "profile view", + "summary": "View the connected account profile.", + "description": "View the connected account profile.", + "usage": ["polymorfa profile view [flags]"], "aliases": [], "hidden": false, "args": [], "flags": [ - { - "name": "account-type", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [ - "whatsapp_app", - "business_app", - "meta_cloud", - "meta_coexistence" - ], - "description": "Create a Test number in this account mode.", - "env": null, - "helpGroup": null - }, - { - "name": "add-connection", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["linked_devices", "official_api"], - "description": "Missing connection to add.", - "env": null, - "helpGroup": null - }, { "name": "api-version", "char": null, @@ -52496,26 +52750,14 @@ "helpGroup": "GLOBAL" }, { - "name": "connection-goal", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["single", "hybrid"], - "description": "One connection or authorized Hybrid setup.", - "env": null, - "helpGroup": null - }, - { - "name": "input", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "JSON request file or - for stdin. Use configuration for connection, phone, history and simulation.", + "description": "Messaging connection ID.", "env": null, "helpGroup": null }, @@ -52531,18 +52773,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "limit-credits", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Initial monthly limit in credits; team billing:manage credential required.", - "env": null, - "helpGroup": null - }, { "name": "no-color", "char": null, @@ -52567,30 +52797,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "primary-platform", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["android", "ios"], - "description": "Test primary phone platform. Not accepted for Official API mode.", - "env": null, - "helpGroup": null - }, - { - "name": "priority", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Initial number funding priority.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -52615,18 +52821,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "purpose", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["initial", "add_connection"], - "description": "Initial setup or add a connection to an existing Number.", - "env": null, - "helpGroup": null - }, { "name": "quiet", "char": null, @@ -52639,18 +52833,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Existing Number for an added connection.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -52680,20 +52862,13 @@ "state": null }, { - "id": "quicklink view", - "summary": "View the status of one hosted QuickLink.", - "description": "View the status of one hosted QuickLink.", - "usage": ["polymorfa quicklink view QUICKLINK [flags]"], + "id": "project-token list", + "summary": "List project-token metadata (never raw token material).", + "description": "List project-token metadata (never raw token material).", + "usage": ["polymorfa project-token list [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "quicklink", - "description": "QuickLink ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -52808,10 +52983,10 @@ "state": null }, { - "id": "routing-policy get", - "summary": "Read Hybrid routing policy and its revision.", - "description": "Read Hybrid routing policy and its revision.", - "usage": ["polymorfa routing-policy get [flags]"], + "id": "project current", + "summary": "Show the project commands use here and where it comes from: --project, a directory link, or the profile.", + "description": "Show the project commands use here and where it comes from: --project, a directory link, or the profile.", + "usage": ["polymorfa project current [flags]"], "aliases": [], "hidden": false, "args": [], @@ -52900,30 +53075,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "scope", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": ["team", "project", "session"], - "description": "Policy authority to read or update.", - "env": null, - "helpGroup": null - }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Number session name for session scope.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -52953,26 +53104,14 @@ "state": null }, { - "id": "routing-policy set", - "summary": "Update Hybrid routing at the exact revision. Ancestor restrictions still apply.", - "description": "Update Hybrid routing at the exact revision. Ancestor restrictions still apply.", - "usage": ["polymorfa routing-policy set [flags]"], + "id": "project list", + "summary": "List projects available to the current credential and mark the current one.", + "description": "List projects available to the current credential and mark the current one.", + "usage": ["polymorfa project list [flags]"], "aliases": [], "hidden": false, "args": [], "flags": [ - { - "name": "allow", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": ["linked_devices", "official_api"], - "description": "Allowed transport; repeat to allow both.", - "env": null, - "helpGroup": null - }, { "name": "api-version", "char": null, @@ -52985,30 +53124,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "deny-all", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Disallow both transports at this scope.", - "env": null, - "helpGroup": null - }, - { - "name": "expected-revision", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Revision from routing-policy get; default for an unsaved policy.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -53045,18 +53160,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "prefer", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": ["linked_devices", "official_api", "inherit"], - "description": "Preferred transport or inherit.", - "env": null, - "helpGroup": null - }, { "name": "profile", "char": null, @@ -53093,30 +53196,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "scope", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": ["team", "project", "session"], - "description": "Policy authority to read or update.", - "env": null, - "helpGroup": null - }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Number session name for session scope.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -53146,16 +53225,16 @@ "state": null }, { - "id": "security-incident acknowledge", - "summary": "Acknowledge a security incident.", - "description": "Acknowledge a security incident.", - "usage": ["polymorfa security-incident acknowledge INCIDENT [flags]"], + "id": "project use", + "summary": "Store the default project for the active or selected profile.", + "description": "Store the default project for the active or selected profile.", + "usage": ["polymorfa project use PROJECT [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "incident", - "description": "Security incident ID.", + "name": "project", + "description": "Project UUID or slug.", "required": true, "options": [] } @@ -53173,18 +53252,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Identify retries of this repeatable acknowledgement.", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -53282,14 +53349,20 @@ "helpGroup": "GLOBAL" } ], - "examples": [], + "examples": [ + {"command": "polymorfa project use my-app", "description": ""}, + { + "command": "polymorfa project use 11111111-1111-4111-8111-111111111111 --profile work", + "description": "" + } + ], "state": null }, { - "id": "security-incident list", - "summary": "List organization security incidents.", - "description": "List organization security incidents.", - "usage": ["polymorfa security-incident list [flags]"], + "id": "quick-reply create", + "summary": "Create a quick reply.", + "description": "Create a quick reply.", + "usage": ["polymorfa quick-reply create [flags]"], "aliases": [], "hidden": false, "args": [], @@ -53307,149 +53380,76 @@ "helpGroup": "GLOBAL" }, { - "name": "json", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Print one JSON document.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "no-color", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Disable color output.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "owner", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", + "options": [], + "description": "Messaging connection ID.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "profile", + "name": "count", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a named authentication profile.", + "description": "Initial source count.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "project", + "name": "idempotency-key", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a project other than the active context.", + "description": "Safely identify retries of this create operation.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "quiet", + "name": "json", "char": null, "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "Suppress successful output.", + "description": "Print one JSON document.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "timeout", + "name": "keyword", "char": null, "type": "option", "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Fail the request after this many milliseconds.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "verbose", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Explain context and workflow decisions.", - "env": null, - "helpGroup": "GLOBAL" - } - ], - "examples": [], - "state": null - }, - { - "id": "session-ban list", - "summary": "List recorded organization session bans.", - "description": "List recorded organization session bans.", - "usage": ["polymorfa session-ban list [flags]"], - "aliases": [], - "hidden": false, - "args": [], - "flags": [ - { - "name": "active", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, + "multiple": true, "default": null, "options": [], - "description": "Return only active bans.", + "description": "Matching keyword. Repeat to add multiple keywords.", "env": null, "helpGroup": null }, { - "name": "api-version", + "name": "message", "char": null, "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Override the API version for this request.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "json", - "char": null, - "type": "boolean", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Complete reply message.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "no-color", @@ -53511,6 +53511,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "shortcut", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Quick-reply shortcut, such as /hours.", + "env": null, + "helpGroup": null + }, { "name": "timeout", "char": null, @@ -53540,16 +53552,16 @@ "state": null }, { - "id": "session capabilities", - "summary": "Show the WhatsApp features and limits WhatsApp has enabled for a number, as of the number's last configuration sync. Beta: the team must be enrolled.", - "description": "Show the WhatsApp features and limits WhatsApp has enabled for a number, as of the number's last configuration sync. Beta: the team must be enrolled.", - "usage": ["polymorfa session capabilities SESSION [flags]"], + "id": "quick-reply delete", + "summary": "Delete a quick reply.", + "description": "Delete a quick reply.", + "usage": ["polymorfa quick-reply delete QUICK-REPLY [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "session", - "description": "Session ID or name.", + "name": "quick-reply", + "description": "Quick-reply ID.", "required": true, "options": [] } @@ -53567,6 +53579,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this delete operation.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -53662,35 +53698,31 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - } - ], - "examples": [ - { - "command": "polymorfa session capabilities support-line", - "description": "" }, { - "command": "polymorfa session capabilities support-line --json", - "description": "" + "name": "yes", + "char": null, + "type": "boolean", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Confirm permanent quick-reply deletion.", + "env": null, + "helpGroup": null } ], + "examples": [], "state": null }, { - "id": "session configuration get", - "summary": "Read effective session configuration, inheritance sources and revisions.", - "description": "Read effective session configuration, inheritance sources and revisions.", - "usage": ["polymorfa session configuration get SESSION [flags]"], + "id": "quick-reply list", + "summary": "List observed quick replies for a connection.", + "description": "List observed quick replies for a connection.", + "usage": ["polymorfa quick-reply list [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "session", - "description": "Session ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -53704,6 +53736,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -53805,16 +53849,16 @@ "state": null }, { - "id": "session configuration update", - "summary": "Set configuration overrides or reset them to inherited defaults using a revision.", - "description": "Set configuration overrides or reset them to inherited defaults using a revision.", - "usage": ["polymorfa session configuration update SESSION [flags]"], + "id": "quick-reply replace", + "summary": "Replace a complete quick reply.", + "description": "Replace a complete quick reply.", + "usage": ["polymorfa quick-reply replace QUICK-REPLY [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "session", - "description": "Session ID.", + "name": "quick-reply", + "description": "Quick-reply ID.", "required": true, "options": [] } @@ -53833,14 +53877,38 @@ "helpGroup": "GLOBAL" }, { - "name": "input", + "name": "connection", "char": null, "type": "option", "required": true, "multiple": false, "default": null, "options": [], - "description": "JSON file or stdin (-), containing revision and configuration.set/reset.", + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "count", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Replacement source count.", + "env": null, + "helpGroup": null + }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Safely identify retries of this replacement.", "env": null, "helpGroup": null }, @@ -53856,6 +53924,30 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "keyword", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Matching keyword. Repeat to add multiple keywords.", + "env": null, + "helpGroup": null + }, + { + "name": "message", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Complete reply message.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -53916,6 +54008,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "shortcut", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Complete quick-reply shortcut.", + "env": null, + "helpGroup": null + }, { "name": "timeout", "char": null, @@ -53945,20 +54049,13 @@ "state": null }, { - "id": "session delete", - "summary": "Permanently remove matching sessions from management.", - "description": "Permanently remove matching sessions from management.", - "usage": ["polymorfa session delete SESSIONS [flags]"], + "id": "quicklink availability", + "summary": "Read a Connection’s methods and whether another method is available.", + "description": "Read a Connection’s methods and whether another method is available.", + "usage": ["polymorfa quicklink availability [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "sessions", - "description": "One to 100 session UUIDs or stable slugs.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -53973,14 +54070,14 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "connection", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "Identify this attempt (a retry counts only rows still present).", + "description": "Existing Connection name.", "env": null, "helpGroup": null }, @@ -54079,31 +54176,26 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, - { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm permanent removal of every supplied session.", - "env": null, - "helpGroup": null } ], "examples": [], "state": null }, { - "id": "session hybrid-merge-candidates", - "summary": "List same-number Number pairs that can merge into one Hybrid Link Number.", - "description": "List same-number Number pairs that can merge into one Hybrid Link Number.\n\nEach pair is one Linked Devices Number and one Official API Number that shares the number with the WhatsApp Business app. Merge an eligible pair with `session tier quote KEEP_UUID --tier pro --merge-with OTHER_UUID`. A Number marked \"must be kept\" uses hosted message storage and cannot be the one merged away. Requires Hybrid Link access.", - "usage": ["polymorfa session hybrid-merge-candidates [flags]"], + "id": "quicklink cancel", + "summary": "Cancel pending QuickLink setup. Supplementary links preserve the existing Connection.", + "description": "Cancel pending QuickLink setup. Supplementary links preserve the existing Connection.", + "usage": ["polymorfa quicklink cancel QUICKLINK [flags]"], "aliases": [], "hidden": false, - "args": [], + "args": [ + { + "name": "quicklink", + "description": "QuickLink ID.", + "required": true, + "options": [] + } + ], "flags": [ { "name": "api-version", @@ -54212,25 +54304,61 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - } - ], - "examples": [ + }, { - "command": "polymorfa session hybrid-merge-candidates --project PROJECT_UUID", - "description": "" + "name": "yes", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Confirm QuickLink cancellation.", + "env": null, + "helpGroup": null } ], + "examples": [], "state": null }, { - "id": "session list", - "summary": "List session metadata for the team or one project. Requires an organization API key with sessions:read.", - "description": "List session metadata for the team or one project. Requires an organization API key with sessions:read.", - "usage": ["polymorfa session list [flags]"], + "id": "quicklink create", + "summary": "Create a persistent real or simulated onboarding QuickLink.", + "description": "Create a persistent real or simulated onboarding QuickLink.", + "usage": ["polymorfa quicklink create [flags]"], "aliases": [], "hidden": false, "args": [], "flags": [ + { + "name": "account-type", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [ + "whatsapp_app", + "business_app", + "meta_cloud", + "meta_coexistence" + ], + "description": "Create a Test Connection in this account mode.", + "env": null, + "helpGroup": null + }, + { + "name": "add-method", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["linked_devices", "official_api"], + "description": "Missing method to add.", + "env": null, + "helpGroup": null + }, { "name": "api-version", "char": null, @@ -54243,6 +54371,42 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Existing Connection for an added method.", + "env": null, + "helpGroup": null + }, + { + "name": "connection-goal", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["single", "hybrid"], + "description": "One method or authorized Hybrid setup.", + "env": null, + "helpGroup": null + }, + { + "name": "input", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "JSON request file or - for stdin. Use configuration for connection, phone, history and simulation.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -54255,6 +54419,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "limit-credits", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Initial monthly limit in credits; team billing:manage credential required.", + "env": null, + "helpGroup": null + }, { "name": "no-color", "char": null, @@ -54280,162 +54456,64 @@ "helpGroup": "GLOBAL" }, { - "name": "profile", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Use a named authentication profile.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "project", + "name": "primary-platform", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Use a project other than the active context.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "quiet", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Suppress successful output.", + "options": ["android", "ios"], + "description": "Test primary phone platform. Not accepted for Official API mode.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "timeout", + "name": "priority", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Fail the request after this many milliseconds.", + "description": "Initial Connection funding priority.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "verbose", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Explain context and workflow decisions.", - "env": null, - "helpGroup": "GLOBAL" - } - ], - "examples": [ - {"command": "polymorfa session list", "description": ""}, - { - "command": "polymorfa session list --project PROJECT_ID --json", - "description": "" - } - ], - "state": null - }, - { - "id": "session status", - "summary": "Read the stored session status and reason. Requires an organization API key with sessions:read.", - "description": "Read the stored session status and reason. Requires an organization API key with sessions:read.", - "usage": ["polymorfa session status SESSION [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "session", - "description": "Session ID.", - "required": true, - "options": [] - } - ], - "flags": [ - { - "name": "api-version", + "name": "profile", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Override the API version for this request.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "json", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Print one JSON document.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "no-color", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Disable color output.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "owner", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", + "description": "Use a named authentication profile.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "profile", + "name": "project", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Use a named authentication profile.", + "description": "Use a project other than the active context.", "env": null, "helpGroup": "GLOBAL" }, { - "name": "project", + "name": "purpose", "char": null, "type": "option", "required": false, "multiple": false, "default": null, - "options": [], - "description": "Use a project other than the active context.", + "options": ["initial", "add_method"], + "description": "Initial setup or add a method to an existing Connection.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { "name": "quiet", @@ -54474,22 +54552,20 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - {"command": "polymorfa session status SESSION_ID", "description": ""} - ], + "examples": [], "state": null }, { - "id": "session stop", - "summary": "Request asynchronous stops for matching managed sessions.", - "description": "Request asynchronous stops for matching managed sessions.", - "usage": ["polymorfa session stop SESSIONS [flags]"], + "id": "quicklink view", + "summary": "View the status of one hosted QuickLink.", + "description": "View the status of one hosted QuickLink.", + "usage": ["polymorfa quicklink view QUICKLINK [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "sessions", - "description": "One to 100 session UUIDs or stable slugs.", + "name": "quicklink", + "description": "QuickLink ID.", "required": true, "options": [] } @@ -54507,18 +54583,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "idempotency-key", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Identify this attempt (a retry can enqueue another stop request).", - "env": null, - "helpGroup": null - }, { "name": "json", "char": null, @@ -54620,20 +54684,13 @@ "state": null }, { - "id": "session tier confirm", - "summary": "Confirm a reviewed Number tier quote.", - "description": "Confirm a reviewed Number tier quote.\n\nThis charges the quoted credits and records any Hybrid Link choice in the quote. The CLI never creates or confirms a replacement quote; after a conflict, review a new quote.", - "usage": ["polymorfa session tier confirm SESSION [flags]"], + "id": "routing-policy get", + "summary": "Read Hybrid routing policy and its revision.", + "description": "Read Hybrid routing policy and its revision.", + "usage": ["polymorfa routing-policy get [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "session", - "description": "Number session UUID or stable slug that was quoted.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -54648,14 +54705,14 @@ "helpGroup": "GLOBAL" }, { - "name": "idempotency-key", + "name": "connection", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Identify this confirmation attempt.", + "description": "Connection name for connection scope.", "env": null, "helpGroup": null }, @@ -54732,14 +54789,14 @@ "helpGroup": "GLOBAL" }, { - "name": "quote", + "name": "scope", "char": null, "type": "option", "required": true, "multiple": false, "default": null, - "options": [], - "description": "Quote ID returned by `session tier quote`.", + "options": ["team", "project", "connection"], + "description": "Policy authority to read or update.", "env": null, "helpGroup": null }, @@ -54766,44 +54823,32 @@ "description": "Explain context and workflow decisions.", "env": null, "helpGroup": "GLOBAL" - }, - { - "name": "yes", - "char": null, - "type": "boolean", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Confirm the quoted charge and any Hybrid Link connection change.", - "env": null, - "helpGroup": null - } - ], - "examples": [ - { - "command": "polymorfa session tier confirm support --quote QUOTE_UUID --yes", - "description": "" } ], + "examples": [], "state": null }, { - "id": "session tier quote", - "summary": "Preview a Number tier change without changing the Number or spending credit.", - "description": "Preview a Number tier change without changing the Number or spending credit.\n\nA Hybrid Link Number leaving Pro needs a choice: --keep one connection, or --split into two Standard Numbers. The choice runs when the paid Pro window ends. An upgrade to Pro can merge a same-number pair with --merge-with.", - "usage": ["polymorfa session tier quote SESSION [flags]"], + "id": "routing-policy set", + "summary": "Update Hybrid routing at the exact revision. Ancestor restrictions still apply.", + "description": "Update Hybrid routing at the exact revision. Ancestor restrictions still apply.", + "usage": ["polymorfa routing-policy set [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "session", - "description": "Number session UUID or stable slug. For a merge, this Number keeps its ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ + { + "name": "allow", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": ["linked_devices", "official_api"], + "description": "Allowed transport; repeat to allow both.", + "env": null, + "helpGroup": null + }, { "name": "api-version", "char": null, @@ -54817,52 +54862,52 @@ "helpGroup": "GLOBAL" }, { - "name": "json", + "name": "connection", "char": null, - "type": "boolean", + "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Print one JSON document.", + "description": "Connection name for connection scope.", "env": null, - "helpGroup": "GLOBAL" + "helpGroup": null }, { - "name": "keep", + "name": "deny-all", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, - "options": ["linked_devices", "official_api"], - "description": "Hybrid Link Number leaving Pro: keep this connection and disconnect the other.", + "options": [], + "description": "Disallow both transports at this scope.", "env": null, "helpGroup": null }, { - "name": "merge-with", + "name": "expected-revision", "char": null, "type": "option", - "required": false, + "required": true, "multiple": false, "default": null, "options": [], - "description": "With --tier pro: UUID of the same-number Number to merge into this one. It is removed after its connection moves, so it must not use hosted message storage.", + "description": "Revision from routing-policy get; default for an unsaved policy.", "env": null, "helpGroup": null }, { - "name": "new-number-name", + "name": "json", "char": null, - "type": "option", + "type": "boolean", "required": false, "multiple": false, "default": null, "options": [], - "description": "With --split: name of the new Number.", + "description": "Print one JSON document.", "env": null, - "helpGroup": null + "helpGroup": "GLOBAL" }, { "name": "no-color", @@ -54888,6 +54933,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "prefer", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": ["linked_devices", "official_api", "inherit"], + "description": "Preferred transport or inherit.", + "env": null, + "helpGroup": null + }, { "name": "profile", "char": null, @@ -54925,38 +54982,14 @@ "helpGroup": "GLOBAL" }, { - "name": "split", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Hybrid Link Number leaving Pro: split into two Standard Numbers without re-pairing.", - "env": null, - "helpGroup": null - }, - { - "name": "stay", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["linked_devices", "official_api"], - "description": "With --split: the connection that stays on this Number; the other moves to the new Number.", - "env": null, - "helpGroup": null - }, - { - "name": "tier", + "name": "scope", "char": null, "type": "option", "required": true, "multiple": false, "default": null, - "options": ["free", "standard", "pro", "inherit"], - "description": "Target tier. \"inherit\" restores the project default tier.", + "options": ["team", "project", "connection"], + "description": "Policy authority to read or update.", "env": null, "helpGroup": null }, @@ -54985,43 +55018,20 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa session tier quote support --tier pro", - "description": "" - }, - { - "command": "polymorfa session tier quote support --tier standard --keep linked_devices", - "description": "" - }, - { - "command": "polymorfa session tier quote support --tier standard --split --stay official_api --new-number-name support-linked", - "description": "" - }, - { - "command": "polymorfa session tier quote NUMBER_UUID --tier pro --merge-with OTHER_NUMBER_UUID", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "session tier status", - "summary": "Read a Number tier change and its Hybrid Link transition.", - "description": "Read a Number tier change and its Hybrid Link transition.\n\nThe tier change is queued until applied or rejected. A Hybrid Link transition reports its own status: scheduled, running, completed, failed or cancelled.", - "usage": ["polymorfa session tier status SESSION QUOTE [flags]"], + "id": "security-incident acknowledge", + "summary": "Acknowledge a security incident.", + "description": "Acknowledge a security incident.", + "usage": ["polymorfa security-incident acknowledge INCIDENT [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "session", - "description": "Number session UUID or stable slug.", - "required": true, - "options": [] - }, - { - "name": "quote", - "description": "Quote ID of the tier change.", + "name": "incident", + "description": "Security incident ID.", "required": true, "options": [] } @@ -55039,6 +55049,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "idempotency-key", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Identify retries of this repeatable acknowledgement.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -55136,29 +55158,17 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa session tier status support QUOTE_UUID", - "description": "" - } - ], + "examples": [], "state": null }, { - "id": "session view", - "summary": "Read one session by its ID. Requires an organization API key with sessions:read.", - "description": "Read one session by its ID. Requires an organization API key with sessions:read.", - "usage": ["polymorfa session view SESSION [flags]"], + "id": "security-incident list", + "summary": "List organization security incidents.", + "description": "List organization security incidents.", + "usage": ["polymorfa security-incident list [flags]"], "aliases": [], "hidden": false, - "args": [ - { - "name": "session", - "description": "Session ID.", - "required": true, - "options": [] - } - ], + "args": [], "flags": [ { "name": "api-version", @@ -55269,12 +55279,7 @@ "helpGroup": "GLOBAL" } ], - "examples": [ - { - "command": "polymorfa session view SESSION_ID --json", - "description": "" - } - ], + "examples": [], "state": null }, { @@ -55418,7 +55423,7 @@ { "id": "sip-trunk delete", "summary": "Delete a SIP trunk.", - "description": "Delete a SIP trunk and its credentials. Fails with sip_trunk_in_use while a session routes incoming calls to it. Requires a server API key.", + "description": "Delete a SIP trunk and its credentials. Fails with sip_trunk_in_use while a connection routes incoming calls to it. Requires a server API key.", "usage": ["polymorfa sip-trunk delete TRUNK [flags]"], "aliases": [], "hidden": false, @@ -56286,6 +56291,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Official API Connection ID in the same project.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -56370,18 +56387,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Official API Number ID in the same project.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -56424,15 +56429,15 @@ }, { "id": "testing account-mode", - "summary": "Change a Test number account mode. A change unlinks every companion, which must pair again. Fails with a conflict if the number is claimed in Inspector or another change is pending.", - "description": "Change a Test number account mode. A change unlinks every companion, which must pair again. Fails with a conflict if the number is claimed in Inspector or another change is pending.", - "usage": ["polymorfa testing account-mode SESSION [flags]"], + "summary": "Change a Test Connection account mode. A change unlinks every companion, which must pair again. Fails with a conflict if the Connection is claimed in Inspector or another change is pending.", + "description": "Change a Test Connection account mode. A change unlinks every companion, which must pair again. Fails with a conflict if the Connection is claimed in Inspector or another change is pending.", + "usage": ["polymorfa testing account-mode CONNECTION [flags]"], "aliases": [], "hidden": false, "args": [ { - "name": "session", - "description": "The Test number session ID.", + "name": "connection", + "description": "The Test Connection ID.", "required": true, "options": [] } @@ -56697,203 +56702,203 @@ "helpGroup": "GLOBAL" }, { - "name": "timeout", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Fail the request after this many milliseconds.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "verbose", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Explain context and workflow decisions.", - "env": null, - "helpGroup": "GLOBAL" - } - ], - "examples": [], - "state": null - }, - { - "id": "trigger", - "summary": "Send a signed test event for a Test number to your webhooks, event history, and a running `polymorfa listen`. Real numbers are refused.", - "description": "Send a signed test event for a Test number to your webhooks, event history, and a running `polymorfa listen`. Real numbers are refused.", - "usage": ["polymorfa trigger [EVENT] [flags]"], - "aliases": [], - "hidden": false, - "args": [ - { - "name": "event", - "description": "Fixture name; each name is the event type it produces.", - "required": false, - "options": [ - "message.received", - "message.ack", - "message.failed", - "call.received", - "call.missed", - "call.ended", - "session.status", - "session.restriction_updated", - "template.status" - ] - } - ], - "flags": [ - { - "name": "api-version", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Override the API version for this request.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "from", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Shortcut for --override from=<E.164 phone>.", - "env": null, - "helpGroup": null - }, - { - "name": "from-number", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "message.received only: send a simulated message from this other Test number instead of generating an event.", - "env": null, - "helpGroup": null - }, - { - "name": "json", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Print one JSON document.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "list", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "List fixtures and the overrides each accepts.", - "env": null, - "helpGroup": null - }, - { - "name": "no-color", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Disable color output.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "override", - "char": null, - "type": "option", - "required": false, - "multiple": true, - "default": null, - "options": [], - "description": "Override a payload field as key=value, for example ackStatus=read. Repeat for several fields.", - "env": null, - "helpGroup": null - }, - { - "name": "owner", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": ["project", "organization"], - "description": "Select project-owned or organization-owned resources.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "profile", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Use a named authentication profile.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "project", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Use a project other than the active context.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "quiet", - "char": null, - "type": "boolean", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Suppress successful output.", - "env": null, - "helpGroup": "GLOBAL" - }, - { - "name": "session", + "name": "timeout", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Fail the request after this many milliseconds.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "verbose", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Explain context and workflow decisions.", + "env": null, + "helpGroup": "GLOBAL" + } + ], + "examples": [], + "state": null + }, + { + "id": "trigger", + "summary": "Send a signed test event for a Test Connection to your webhooks, event history, and a running `polymorfa listen`. Real connections are refused.", + "description": "Send a signed test event for a Test Connection to your webhooks, event history, and a running `polymorfa listen`. Real connections are refused.", + "usage": ["polymorfa trigger [EVENT] [flags]"], + "aliases": [], + "hidden": false, + "args": [ + { + "name": "event", + "description": "Fixture name; each name is the event type it produces.", + "required": false, + "options": [ + "message.received", + "message.ack", + "message.failed", + "call.received", + "call.missed", + "call.ended", + "connection.status", + "connection.restriction_updated", + "template.status" + ] + } + ], + "flags": [ + { + "name": "api-version", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Override the API version for this request.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Test Connection ID.", + "env": null, + "helpGroup": null + }, + { + "name": "from", "char": null, "type": "option", "required": false, "multiple": false, "default": null, "options": [], - "description": "Test Number ID.", + "description": "Shortcut for --override from=<E.164 phone>.", + "env": null, + "helpGroup": null + }, + { + "name": "from-connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "message.received only: send a simulated message from this other Test Connection instead of generating an event.", + "env": null, + "helpGroup": null + }, + { + "name": "json", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Print one JSON document.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "list", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "List fixtures and the overrides each accepts.", + "env": null, + "helpGroup": null + }, + { + "name": "no-color", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Disable color output.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "override", + "char": null, + "type": "option", + "required": false, + "multiple": true, + "default": null, + "options": [], + "description": "Override a payload field as key=value, for example ackStatus=read. Repeat for several fields.", "env": null, "helpGroup": null }, + { + "name": "owner", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": ["project", "organization"], + "description": "Select project-owned or organization-owned resources.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "profile", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Use a named authentication profile.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "project", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Use a project other than the active context.", + "env": null, + "helpGroup": "GLOBAL" + }, + { + "name": "quiet", + "char": null, + "type": "boolean", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Suppress successful output.", + "env": null, + "helpGroup": "GLOBAL" + }, { "name": "text", "char": null, @@ -56934,15 +56939,15 @@ "examples": [ {"command": "polymorfa trigger --list", "description": ""}, { - "command": "polymorfa trigger message.received --session my-test-number --text \"hi\"", + "command": "polymorfa trigger message.received --connection my-test-connection --text \"hi\"", "description": "" }, { - "command": "polymorfa trigger message.ack --session my-test-number --override ackStatus=read", + "command": "polymorfa trigger message.ack --connection my-test-connection --override ackStatus=read", "description": "" }, { - "command": "polymorfa trigger template.status --session my-test-number --override templateStatus=REJECTED --override reason=INVALID_FORMAT", + "command": "polymorfa trigger template.status --connection my-test-connection --override templateStatus=REJECTED --override reason=INVALID_FORMAT", "description": "" } ], @@ -56951,7 +56956,7 @@ { "id": "usage gates", "summary": "List usage gates and their limits.", - "description": "List your usage gates with their mode, limit, usage this month and how often an action went over the limit in the last 30 days. In record mode a gate never refuses an action; in enforce mode an action over the limit fails with gate_limit_reached. Pass --session to include limits that apply per number. Gate state covers the whole team, so this needs a team API key; project API keys are refused. A limit that cannot be checked fails the action with 503 in either mode.", + "description": "List your usage gates with their mode, limit, usage this month and how often an action went over the limit in the last 30 days. In record mode a gate never refuses an action; in enforce mode an action over the limit fails with gate_limit_reached. Pass --connection to include limits that apply per number. Gate state covers the whole team, so this needs a team API key; project API keys are refused. A limit that cannot be checked fails the action with 503 in either mode.", "usage": ["polymorfa usage gates [flags]"], "aliases": [], "hidden": false, @@ -56969,6 +56974,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Include limits that apply to one Connection (name).", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -57041,18 +57058,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Include limits that apply to one number (session name).", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -57081,7 +57086,7 @@ "examples": [ {"command": "polymorfa usage gates", "description": ""}, { - "command": "polymorfa usage gates --session support --json", + "command": "polymorfa usage gates --connection support --json", "description": "" } ], @@ -57090,7 +57095,7 @@ { "id": "usage records", "summary": "List usage records.", - "description": "List usage records, newest first. Filter by call, number, meter or calendar month. A call has one call.duration record, and an outgoing Cloud API call also a call.cloud_pulses record. Pass the printed cursor to read the next page.", + "description": "List usage records, newest first. Filter by call, Connection, meter or calendar month. A call has one call.duration record, and an outgoing Cloud API call also a call.cloud_pulses record. Pass the printed cursor to read the next page.", "usage": ["polymorfa usage records [flags]"], "aliases": [], "hidden": false, @@ -57120,6 +57125,18 @@ "env": null, "helpGroup": null }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Limit to one Connection (name).", + "env": null, + "helpGroup": null + }, { "name": "cursor", "char": null, @@ -57240,18 +57257,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Limit to one number (session name).", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -57283,7 +57288,7 @@ "description": "" }, { - "command": "polymorfa usage records --session support --meter call.duration --limit 50 --json", + "command": "polymorfa usage records --connection support --meter call.duration --limit 50 --json", "description": "" } ], @@ -57292,7 +57297,7 @@ { "id": "usage summary", "summary": "Show metered usage for a month.", - "description": "Show metered usage for one calendar month (UTC), by meter and by number. Usage is measured, not charged: no credits are deducted for it. Requires sessions:read. A project token reads only its own project.", + "description": "Show metered usage for one calendar month (UTC), by meter and by connection. Usage is measured, not charged: no credits are deducted for it. Requires connections:read. A project token reads only its own project.", "usage": ["polymorfa usage summary [flags]"], "aliases": [], "hidden": false, @@ -57310,6 +57315,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": false, + "multiple": false, + "default": null, + "options": [], + "description": "Limit to one Connection (name).", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -57394,18 +57411,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": false, - "multiple": false, - "default": null, - "options": [], - "description": "Limit to one number (session name).", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -57434,7 +57439,7 @@ "examples": [ {"command": "polymorfa usage summary", "description": ""}, { - "command": "polymorfa usage summary --period 2026-09 --session support --json", + "command": "polymorfa usage summary --period 2026-09 --connection support --json", "description": "" } ], @@ -57468,6 +57473,18 @@ "env": null, "helpGroup": "GLOBAL" }, + { + "name": "connection", + "char": null, + "type": "option", + "required": true, + "multiple": false, + "default": null, + "options": [], + "description": "Messaging connection ID.", + "env": null, + "helpGroup": null + }, { "name": "json", "char": null, @@ -57540,18 +57557,6 @@ "env": null, "helpGroup": "GLOBAL" }, - { - "name": "session", - "char": null, - "type": "option", - "required": true, - "multiple": false, - "default": null, - "options": [], - "description": "Messaging session ID.", - "env": null, - "helpGroup": null - }, { "name": "timeout", "char": null, @@ -59692,7 +59697,7 @@ "multiple": false, "default": null, "options": [], - "description": "First day without the phone on which the webhook receives session.phone_offline (7-13), or off to remove that event. WhatsApp signs the device out on day 14.", + "description": "First day without the phone on which the webhook receives connection.phone_offline (7-13), or off to remove that event. WhatsApp signs the device out on day 14.", "env": null, "helpGroup": null }, @@ -61156,7 +61161,7 @@ "multiple": false, "default": null, "options": [], - "description": "Read optional test input from a file or stdin (-). Project tests accept body and sessionId together; team tests accept only eventType.", + "description": "Read optional test input from a file or stdin (-). Project tests accept body and connectionId together; team tests accept only eventType.", "env": null, "helpGroup": null }, @@ -61356,7 +61361,7 @@ "multiple": false, "default": null, "options": [], - "description": "First day without the phone on which the webhook receives session.phone_offline (7-13), or off to remove that event. WhatsApp signs the device out on day 14.", + "description": "First day without the phone on which the webhook receives connection.phone_offline (7-13), or off to remove that event. WhatsApp signs the device out on day 14.", "env": null, "helpGroup": null }, diff --git a/contracts/connections.json b/contracts/connections.json new file mode 100644 index 00000000..aae137e9 --- /dev/null +++ b/contracts/connections.json @@ -0,0 +1,25 @@ +{ + "repository": "polymorfa/polymorfa", + "sourceCommit": "8354399b827d9127210b9759cd055586e967449e", + "releaseStatus": "source-only", + "polymorfaVersion": "2026-09-22", + "contracts": { + "messaging": { + "sourcePath": "apps/api/docs/openapi.json", + "sha256": "e84c7ff814c6b59ca7f32c3fda1aedbed3f672e728910adb883f0aa8c6cf3ab7" + }, + "platform": { + "sourcePath": "apps/api/docs/openapi.management.json", + "sha256": "2cd45b6a4a919b2c4f93c7438a9439046f82ffc3a1767ccd2dfd5da15450c6f9" + } + }, + "sdk": { + "repository": "polymorfa/sdks", + "sourceCommit": "ef2a629d74e46648cdd613b8126ab63f8e5ee15d", + "documentationExportCommit": "046fae62a1e0a8004e0e8dc48848d1555c78e4c3", + "localArtifactSha256": "0e2c52d9896320904d79ebe17eeb6b56456f1222e85f69800ae0ce1bdab84a8c", + "publishedVersion": null + }, + "dependencyPin": "0.1.0-dev.20261010020302", + "releaseGate": "The checked-in registry dependency predates Connections. Local verification uses the exact source SDK artifact above. Rebind the dependency to a matching accepted and published SDK before release; no registry publication or hosted acceptance is claimed." +} diff --git a/contracts/test-connection-dropin-routes.json b/contracts/test-connection-dropin-routes.json new file mode 100644 index 00000000..262a0ba9 --- /dev/null +++ b/contracts/test-connection-dropin-routes.json @@ -0,0 +1,28 @@ +{ + "repository": "polymorfa/polymorfa", + "commit": "8354399b827d9127210b9759cd055586e967449e", + "sourcePath": "apps/api/docs/openapi.json", + "sourceSha256": "e84c7ff814c6b59ca7f32c3fda1aedbed3f672e728910adb883f0aa8c6cf3ab7", + "operations": [ + { + "command": "trigger --list", + "method": "GET", + "path": "/messaging/test-events/fixtures" + }, + { + "command": "trigger <event> --connection <connectionId> [--from-connection <connectionId>]", + "method": "POST", + "path": "/messaging/{connection}/test-events", + "requestFields": ["event", "overrides", "fromConnection"] + }, + { + "command": "testing history-fixture create --project <projectId>", + "method": "POST", + "path": "/messaging/projects/{projectId}/test-history-fixtures" + } + ], + "sdkTransport": "Matching Connection SDK typed Testing methods; source-only verification does not authorize publication.", + "scopes": ["sandbox:read", "sandbox:write"], + "releaseStatus": "source-only", + "published": false +} diff --git a/contracts/test-number-dropin-routes.json b/contracts/test-number-dropin-routes.json deleted file mode 100644 index edd6e6f0..00000000 --- a/contracts/test-number-dropin-routes.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "repository": "polymorfa/polymorfa", - "commit": "79e62733b1b3d523618232a3794e26df64b7f486", - "sourcePath": "apps/api/docs/openapi.json", - "sourceSha256": "dcbd21ba3dafe0c30e52c260ccef759eaca1c0a11d6cc092f2a3ef68bf50f4d3", - "operations": [ - { - "command": "trigger --list", - "method": "GET", - "path": "/messaging/test-events/fixtures" - }, - { - "command": "trigger <event> --session <numberId> [--from-number <numberId>]", - "method": "POST", - "path": "/messaging/{session}/test-events", - "requestFields": ["event", "overrides", "fromNumber"] - }, - { - "command": "testing history-fixture create --project <projectId>", - "method": "POST", - "path": "/messaging/projects/{projectId}/test-history-fixtures" - } - ], - "sdkTransport": "Released SDK raw.request; no dependency pin or publication required.", - "scopes": ["sandbox:read", "sandbox:write"], - "historicalReferences": [ - "docs/internal/2026-09-22-trigger-fixture-parity.md", - "docs/internal/2026-09-23-trigger-launch-docs.md" - ] -} diff --git a/docs/internal/2026-09-22-trigger-fixture-parity.md b/docs/internal/2026-09-22-trigger-fixture-parity.md deleted file mode 100644 index e8d12af6..00000000 --- a/docs/internal/2026-09-22-trigger-fixture-parity.md +++ /dev/null @@ -1,80 +0,0 @@ -# Trigger fixture parity - -Resolved on 2026-09-23: SDK PR #290 merged as -`2b693964305b91dc34b9092ca5774055c7e47d88` and published -`@polymorfa/sdk@0.1.0-dev.20260923093259`. CLI PR #15 now pins that exact -registry artifact in its manifest and lockfile. A clean install and the full -CLI verification suite passed on the branch merged with current `dev`. -The notes below record the earlier local repair and its then-open dependency. - -Local repair of CLI #15 at `67b1c0f43568c015c779ebf2c6475237f7b980a8`. -Not published or release-ready. The API contract checked is -`polymorfa/polymorfa@63111fec728ac3ebc9a825ea57ebc4c592abdafc`. - -The API lists `session.restriction_updated`, but the CLI's pinned SDK -`0.1.0-dev.20260922102711` omits it from the fixture union. The CLI consequently -refuses an event that `trigger --list` prints. Its override parser also treats -`restrictionActive=false` as a string. This repair types the override as a -boolean and tests both starting and ending a restriction through the command -and HTTP request. - -## SDK dependency - -Companion SDK work is based on `polymorfa/sdks@8392f66b4df0b0fee3403e27e3d2914516b0e243`, -branch `fix/test-event-fixture-contract-20260922`. It adds the fixture, -`restrictionActive?: boolean`, and the API's `call_restricted` member of -`callEndReason`. It stores the four relevant OpenAPI schemas, source commit, -and source hash in `contracts/testing-events.json` and checks the fixture list -against that snapshot. - -CLI validation uses a tarball built from that local SDK source. The package -manifest and lockfile intentionally still pin the published dependency. A -clean install of that old version cannot build this repair because its types -lack `restrictionActive`. Publish and inspect the companion SDK artifact, then -update the CLI's exact dependency and lockfile and repeat normal verification. -Do not replace the dependency with a local alias or invent a registry version. - -The three BanSafe event retirements on monorepo branch -`fix/declared-webhook-events` are not in this API baseline. When that change is -integrated, update this contract, the SDK fixture list, CLI examples, and tests -together. This repair retains the two test fixtures the pinned API accepts. - -## Runtime and authority - -The API mounts trigger and fixture-list routes under `/messaging/testing` -when a simulated Sandbox client is configured. List requires `sandbox:read`; -trigger requires `sandbox:write`. Project/team credentials are accepted by the -API; client tokens are denied. The CLI's existing command specifically uses -its server-API-key path and requires an explicit `--project`. - -Both routes check the live project and unified `test-numbers` feature. -This feature is a beta with release flag `release-test-numbers` and explicit -team enrollment. Missing enrollment, disabled release, or failed authority -does not grant access. No flag, credential, enrollment, or environment setting -changes in this repair. - -Generated events use the test publication path and cannot change number -state. A real number is rejected. `--from-session` only permits -`message.received`, text-only overrides, and a different Test number in the -same project. The API limits triggering to 30 requests per project per minute. - -Errors use the existing CLI mapping: validation/configuration exit 2, -authentication/authorization exit 3, not found/conflict exit 4, and rate limit, -network, timeout, or server failure exit 5. This command passes no idempotency -key, so the SDK does not automatically retry its POST. An uncertain response -must not be described as failed delivery. No new retry behavior is introduced. - -## Impact and release checks - -| Part | State | Evidence or remaining work | -| ---------------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| API | Unaffected | Existing fixture and schema at the pinned revision; no handler, scope, or response change. | -| SDKs | Updated locally; publication blocked | Companion TypeScript catalog and override types, serializer tests, exact schema supplement, README. No new API method or other-language implementation is introduced. | -| CLI | Updated locally; dependency blocked | Boolean parser and command regression tests. Await the inspected published SDK, then update the exact pin and lockfile. | -| Docs | Updated locally | CLI README and SDK README cover the fixture and boolean input. Mintlify `docs/sandbox/test-events.mdx` already documents this existing API behavior. No shipped release announcement is added. Add CLI usage to public docs when the CLI is actually released. | -| Feature releases | Existing authority unchanged; live availability unverified | Existing Test numbers beta, targeting, enrollment and operational controls still apply. No provider or release setting was changed. | -| Admin | Unaffected | Test fixtures add no durable setting or grant. Existing Test numbers release/enrollment and webhook controls remain the authority; generated events cannot create state needing a new staff action. | - -Build and focused tests exercise a local HTTP receiver using the actual packed -SDK. They do not establish deployed beta availability, real webhook delivery, -listener delivery, or package publication. No automated reviews were requested. diff --git a/docs/internal/2026-09-23-trigger-launch-docs.md b/docs/internal/2026-09-23-trigger-launch-docs.md deleted file mode 100644 index ad3e6d3b..00000000 --- a/docs/internal/2026-09-23-trigger-launch-docs.md +++ /dev/null @@ -1,13 +0,0 @@ -# Prepared CLI trigger documentation - -`launch-docs/cli-trigger.mdx` is an internal insertion snippet for `docs/sandbox/test-events.mdx`, after its TypeScript SDK example and before the fixture list. The CLI is unpublished, so do not add the snippet or a CLI changelog entry to public Mintlify until a released CLI artifact includes this command, its installed behavior is checked, and the Test numbers beta audience can use the deployed API path. - -The snippet follows the CLI implementation and README at `polymorfa/cli` PR #15, SDK version `0.1.0-dev.20260923093259` from SDK merge commit `2b693964305b91dc34b9092ca5774055c7e47d88`, and the existing Test events guide. A clean CLI install resolved the exact SDK registry artifact. `npm run verify` passed on the branch merged with CLI `dev`: 635 tests in 73 files, build, typecheck, formatting, lint, pack check, and production audit. Compiled `trigger --help` confirms the snippet's flags and fixture name. The command tests exercise local HTTP requests, including typed `restrictionActive=false`, refusal paths, and no-request validation. No deployed API, webhook, event history, live listener, or released CLI install was exercised. - -At publication, verify the released CLI version and installed `trigger --help`, then insert the snippet into the existing guide. Render the page at mobile and desktop widths, run Mintlify broken-link and validation checks, and date a customer changelog entry for the available release. Confirm the `release-test-numbers` gate, team enrollment, Test number, and deployed API route for the intended audience. No flag or entitlement change is part of PR #15. - -Proposed changelog copy, with date set when customers can use the CLI: - -> The Polymorfa CLI can list Test event fixtures and trigger signed events for a Test number. It also sends a simulated message from another Test number with `--from-session`. See [Trigger test events](/sandbox/test-events). - -API: unchanged by this CLI work; the existing testing route and scopes remain authoritative. SDK: fixture and override types updated in SDK PR #290, then published under the exact version above. CLI: command, README, and tests updated in PR #15. Docs: CLI README and this internal snippet updated; public insertion remains a release gate. Feature releases: existing Test numbers beta access and enrollment remain; live availability is unverified here. Admin: unchanged because this command adds no staff control. diff --git a/docs/internal/2026-10-20-test-number-dropin-routes.md b/docs/internal/2026-10-20-test-number-dropin-routes.md deleted file mode 100644 index 4db2362b..00000000 --- a/docs/internal/2026-10-20-test-number-dropin-routes.md +++ /dev/null @@ -1,26 +0,0 @@ -# Number-scoped test routes - -Source contract: `contracts/test-number-dropin-routes.json`, API PR -https://github.com/polymorfa/polymorfa/pull/792. The API base is #647. - -`trigger` sends the Number ID in the path, never body `session`. The optional -`--from-number` is another Test Number ID, serialized as `fromNumber`; -`--from-session` has no alias. Trigger/list require no project flag. History -fixture creation keeps its project flag because it precedes Number creation. - -These commands use the installed SDK's public `raw.request` transport and keep -its auth, timeout, retries and errors. The existing package pin stays valid; -there is no unpublished SDK dependency. No credential handling changes. - -API: consumed and pinned; no API implementation here. SDK: transport reused, -typed methods updated separately. CLI: commands/help/examples/tests updated. -Docs: README and internal launch sample updated; public docs app handoff stays -with #783. Feature releases: no flag or availability change. Admin: no new -state/action and no direct dependency. Historical September notes remain -evidence of their original snapshot; their old names do not describe aliases. - -Scope names remain `sandbox:read` / `sandbox:write`. Renaming affects CLI README -and internal launch/reference notes, SDK contracts/scope inputs, API scope -parsing and enforcement, Console key pickers and public documentation. No -spelling or numeric scope bit changes are included. No publication or -deployment is performed. diff --git a/docs/internal/launch-docs/cli-trigger.mdx b/docs/internal/launch-docs/cli-trigger.mdx deleted file mode 100644 index e16a76bf..00000000 --- a/docs/internal/launch-docs/cli-trigger.mdx +++ /dev/null @@ -1,16 +0,0 @@ -## Trigger with the CLI - -Use a team key or project token (including a Test key) with `sandbox:write` and a project with Test numbers access. Listing fixtures needs `sandbox:read`. - -```sh -polymorfa trigger --list -polymorfa trigger message.received --session my-test-number --text "hi" -polymorfa trigger session.restriction_updated --session my-test-number \ - --override restrictionActive=false -``` - -The command prints the event type and ID returned by the API. The event also appears in event history and reaches subscribed webhooks with `source: "test"`. A real number is refused without sending an event. - -To send a simulated message from another Test number in the same project, use `--from-number OTHER_TEST_NUMBER` with `message.received`. That sends a message you can reply to; the named fixtures above only generate events. - -The Number ID in `--session` determines the project. Fixture listing is a static catalog and needs no project selector. The trigger sends `fromNumber` as an optional Number ID; body `session` is not sent. Real Numbers return `404 resource_not_found`. diff --git a/package.json b/package.json index 82fefc73..296450eb 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "description": "Manage the business profile cover photo." }, "call": { - "description": "Reject incoming calls through the Linked Device session route." + "description": "Reject incoming calls through the Linked Device connection route." }, "calls": { "description": "Place and manage calls, check consent, carry audio, and report on past calls." @@ -107,7 +107,7 @@ "description": "Manage the team do-not-call list." }, "calls:permission": { - "description": "Inspect and request call permission on Cloud API numbers." + "description": "Inspect and request call permission on Cloud API connections." }, "calls:policy": { "description": "Inspect and replace the team call policy." @@ -116,7 +116,7 @@ "description": "Inspect and change how long Polymorfa keeps your team's call data." }, "calls:settings": { - "description": "Inspect and replace session call settings." + "description": "Inspect and replace connection call settings." }, "campaign": { "description": "Inspect and manage Messaging campaigns." @@ -134,22 +134,22 @@ "description": "Inspect and act on channel messages." }, "chat": { - "description": "Read stored chats on enrolled HMS Numbers (beta)." + "description": "Read stored chats on enrolled HMS Connections (beta)." }, "chat:message": { - "description": "Read stored messages on enrolled HMS Numbers (beta)." + "description": "Read stored messages on enrolled HMS Connections (beta)." }, "contact": { "description": "Inspect contacts and manage the contact blocklist." }, "customer": { - "description": "Manage project Customers, pairing links, and assigned Numbers." + "description": "Manage project Customers, pairing links, and assigned Connections." }, "customer:event": { "description": "Inspect Customer lifecycle events." }, - "customer:number": { - "description": "Inspect and transfer Customer Numbers." + "customer:connection": { + "description": "Inspect and transfer Customer Connections." }, "customer:pairing-link": { "description": "Create, inspect, and revoke Customer pairing links." @@ -164,7 +164,7 @@ "description": "List and change group participants and admins." }, "identity": { - "description": "Resolve phone numbers and usernames to Polymorfa user IDs." + "description": "Resolve phone connections and usernames to Polymorfa user IDs." }, "key": { "description": "Inspect and revoke organization API keys." @@ -235,11 +235,11 @@ "security-incident": { "description": "Inspect and acknowledge organization security incidents." }, - "session": { - "description": "Manage Platform sessions." + "connection": { + "description": "Manage Platform connections." }, - "session-ban": { - "description": "Inspect recorded organization session bans." + "connection-ban": { + "description": "Inspect recorded organization connection bans." }, "voice": { "description": "Voice Automation (beta): audio library and text-to-speech provider credentials." @@ -250,17 +250,17 @@ "voice:credential": { "description": "Store, check, and delete your text-to-speech provider keys (beta)." }, - "session:configuration": { - "description": "Inspect and update inherited session configuration." + "connection:configuration": { + "description": "Inspect and update inherited connection configuration." }, - "session:tier": { + "connection:tier": { "description": "Quote, confirm, and follow Number tier changes, including Hybrid Link choices." }, "sip-trunk": { "description": "Connect a PBX to WhatsApp calls with SIP trunks." }, "testing": { - "description": "Manage simulated session fixtures." + "description": "Manage simulated connection fixtures." }, "testing:history-fixture": { "description": "Upload project-scoped test history." diff --git a/scripts/verify-browser.mjs b/scripts/verify-browser.mjs index 500db3e7..311ca11e 100644 --- a/scripts/verify-browser.mjs +++ b/scripts/verify-browser.mjs @@ -89,7 +89,7 @@ const sent = await actual.runCommand( 'message', 'send', 'text', - '--session', + '--connection', '739182640518203', '--to', '+15550002222', @@ -97,7 +97,7 @@ const sent = await actual.runCommand( 'Hello from Polymorfa', ], { - env: {POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_' + 'fixture'.repeat(6)}, + env: {POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_Zml4dHVyZQ'}, fetch: async (input, init = {}) => { requests.push({ path: new URL(String(input)).pathname, diff --git a/skills/polymorfa-webhooks/SKILL.md b/skills/polymorfa-webhooks/SKILL.md index ae339331..1ed86e23 100644 --- a/skills/polymorfa-webhooks/SKILL.md +++ b/skills/polymorfa-webhooks/SKILL.md @@ -13,8 +13,8 @@ Keep these actions distinct: - `listen` receives the project event stream and may forward locally; it does not create webhook history or alter a delivery. For `webhook test`, pass `--event`. Team tests accept only that event type. -Project tests may also use `--input` with both `body` and `sessionId` for an -exact native event from an HMS-enabled Number in the same project. +Project tests may also use `--input` with both `body` and `connectionId` for an +exact native event from an HMS-enabled Connection in the same project. ## Inspect before changing diff --git a/skills/polymorfa/SKILL.md b/skills/polymorfa/SKILL.md index bdd25c97..7d0fda34 100644 --- a/skills/polymorfa/SKILL.md +++ b/skills/polymorfa/SKILL.md @@ -18,7 +18,7 @@ Organization API keys and exact-project tokens are durable principals. Browser c Voice Automation commands (`polymorfa voice audio`, `polymorfa voice credential`) are a beta for enrolled teams; `voice_not_enabled` (exit 6) means the team is not enrolled and `gate_limit_reached` (exit 7) means a voice limit is reached, so do not retry either. Pass a provider key to `polymorfa voice credential add` only through standard input or the environment variable named by `--key-env`, never as an argument. -Use `polymorfa quicklink create --project PROJECT --input request.json` with an organization API key for standard number pairing. Treat the returned hosted URL as credential material; do not request direct session QR payloads or pairing codes. +Use `polymorfa quicklink create --project PROJECT --input request.json` with an organization API key for standard Connection pairing. Treat the returned hosted URL as credential material; do not request direct connection QR payloads or pairing codes. ## Choose an interface diff --git a/src/base-command.ts b/src/base-command.ts index 16567413..4125c388 100644 --- a/src/base-command.ts +++ b/src/base-command.ts @@ -20,8 +20,8 @@ import {errorEnvelope, type OutputContext} from './output/contracts.js' import {renderValue, type OutputMode} from './output/render.js' import {createMessagingClient, createPlatformClient} from './sdk/client.js' import { - createDeveloperSession, - type DeveloperSession, + createDeveloperConnection, + type DeveloperConnection, } from './developer/client.js' export interface GlobalFlags { @@ -89,16 +89,16 @@ export abstract class BaseCommand extends Command { return 'human' } - protected async developerSession( + protected async developerConnection( flags: GlobalFlags, - ): Promise<DeveloperSession> { - const session = await createDeveloperSession( + ): Promise<DeveloperConnection> { + const connection = await createDeveloperConnection( flags, (secret) => this.registerSecret(secret), () => this.linkedProject(flags), ) - this.errorContext = session.context - return session + this.errorContext = connection.context + return connection } /** @@ -243,7 +243,7 @@ export abstract class BaseCommand extends Command { protected async platformClient( flags: GlobalFlags, - ): Promise<ClientInstance<'organization'>> { + ): Promise<ClientInstance<'team'>> { return createPlatformClient(await this.platformEnvironment(flags)) } diff --git a/src/browser/registry.gen.ts b/src/browser/registry.gen.ts index d8a7eca0..796cd306 100644 --- a/src/browser/registry.gen.ts +++ b/src/browser/registry.gen.ts @@ -255,6 +255,25 @@ export const COMMAND_LOADERS: Readonly< 'cloud template list': () => import('../commands/cloud/template/list.js'), 'completion suggest': () => import('../commands/completion/suggest.js'), completion: () => import('../commands/completion.js'), + 'connection capabilities': () => + import('../commands/connection/capabilities.js'), + 'connection configuration get': () => + import('../commands/connection/configuration/get.js'), + 'connection configuration update': () => + import('../commands/connection/configuration/update.js'), + 'connection delete': () => import('../commands/connection/delete.js'), + 'connection hybrid-merge-candidates': () => + import('../commands/connection/hybrid-merge-candidates.js'), + 'connection list': () => import('../commands/connection/list.js'), + 'connection status': () => import('../commands/connection/status.js'), + 'connection stop': () => import('../commands/connection/stop.js'), + 'connection tier confirm': () => + import('../commands/connection/tier/confirm.js'), + 'connection tier quote': () => import('../commands/connection/tier/quote.js'), + 'connection tier status': () => + import('../commands/connection/tier/status.js'), + 'connection view': () => import('../commands/connection/view.js'), + 'connection-ban list': () => import('../commands/connection-ban/list.js'), 'contact block': () => import('../commands/contact/block.js'), 'contact blocklist': () => import('../commands/contact/blocklist.js'), 'contact business-profile': () => @@ -267,13 +286,14 @@ export const COMMAND_LOADERS: Readonly< 'contact unblock': () => import('../commands/contact/unblock.js'), 'contact view': () => import('../commands/contact/view.js'), 'customer archive': () => import('../commands/customer/archive.js'), + 'customer connection list': () => + import('../commands/customer/connection/list.js'), + 'customer connection transfer': () => + import('../commands/customer/connection/transfer.js'), 'customer create': () => import('../commands/customer/create.js'), 'customer enable': () => import('../commands/customer/enable.js'), 'customer event list': () => import('../commands/customer/event/list.js'), 'customer list': () => import('../commands/customer/list.js'), - 'customer number list': () => import('../commands/customer/number/list.js'), - 'customer number transfer': () => - import('../commands/customer/number/transfer.js'), 'customer pairing-link create': () => import('../commands/customer/pairing-link/create.js'), 'customer pairing-link list': () => @@ -444,22 +464,6 @@ export const COMMAND_LOADERS: Readonly< import('../commands/security-incident/acknowledge.js'), 'security-incident list': () => import('../commands/security-incident/list.js'), - 'session capabilities': () => import('../commands/session/capabilities.js'), - 'session configuration get': () => - import('../commands/session/configuration/get.js'), - 'session configuration update': () => - import('../commands/session/configuration/update.js'), - 'session delete': () => import('../commands/session/delete.js'), - 'session hybrid-merge-candidates': () => - import('../commands/session/hybrid-merge-candidates.js'), - 'session list': () => import('../commands/session/list.js'), - 'session status': () => import('../commands/session/status.js'), - 'session stop': () => import('../commands/session/stop.js'), - 'session tier confirm': () => import('../commands/session/tier/confirm.js'), - 'session tier quote': () => import('../commands/session/tier/quote.js'), - 'session tier status': () => import('../commands/session/tier/status.js'), - 'session view': () => import('../commands/session/view.js'), - 'session-ban list': () => import('../commands/session-ban/list.js'), 'sip-trunk create': () => import('../commands/sip-trunk/create.js'), 'sip-trunk delete': () => import('../commands/sip-trunk/delete.js'), 'sip-trunk endpoint': () => import('../commands/sip-trunk/endpoint.js'), diff --git a/src/commands/analytics/get.ts b/src/commands/analytics/get.ts index 089fdc5b..5f1437b3 100644 --- a/src/commands/analytics/get.ts +++ b/src/commands/analytics/get.ts @@ -7,8 +7,8 @@ import { } from '../../services/analytics.js' export default class AnalyticsGet extends BaseCommand { static override description = - 'Read WhatsApp number activity, completed 24-hour read and reply rates, response times, call outcomes and connection vitals. Requires sessions:read and Analytics enabled in the Console. Project credentials read only their project.' - static override summary = 'Read WhatsApp number analytics.' + 'Read WhatsApp Connection activity, completed 24-hour read and reply rates, response times, call outcomes and connection vitals. Requires connections:read and Analytics enabled in the Console. Project credentials read only their project.' + static override summary = 'Read WhatsApp Connection analytics.' static override examples = [ '<%= config.bin %> analytics get --project PROJECT_ID --json', '<%= config.bin %> analytics get --since 2026-10-01T00:00:00Z --until 2026-10-03T00:00:00Z', @@ -20,8 +20,8 @@ export default class AnalyticsGet extends BaseCommand { until: Flags.string({ description: 'End time in RFC 3339; defaults to now.', }), - 'session-id': Flags.string({ - description: 'Limit to one number record UUID.', + 'connection-id': Flags.string({ + description: 'Limit to one Connection UUID.', }), } async run(): Promise<void> { @@ -29,15 +29,15 @@ export default class AnalyticsGet extends BaseCommand { const query = analyticsQuery({ ...(flags.since === undefined ? {} : {since: flags.since}), ...(flags.until === undefined ? {} : {until: flags.until}), - ...(flags['session-id'] === undefined + ...(flags['connection-id'] === undefined ? {} - : {sessionId: flags['session-id']}), + : {connectionId: flags['connection-id']}), }) - const session = await this.developerSession({ + const connection = await this.developerConnection({ ...flags, owner: flags.owner ?? (flags.project ? 'project' : 'organization'), }) - const result = await getAnalytics(session.client, query) + const result = await getAnalytics(connection.client, query) this.writeValue(result, renderAnalytics(result.data), flags) } } diff --git a/src/commands/analytics/metrics.ts b/src/commands/analytics/metrics.ts index c232297b..7038bd0e 100644 --- a/src/commands/analytics/metrics.ts +++ b/src/commands/analytics/metrics.ts @@ -8,14 +8,14 @@ import { export default class AnalyticsMetrics extends BaseCommand { static override summary = 'Export collector-compatible analytics metrics.' static override description = - 'Write Prometheus or OpenMetrics gauges to stdout. Requires sessions:read and Analytics enabled in the Console. Counts cover completed UTC hours and are not monotonic counters. Project credentials read only their project. Disabled Analytics returns only enablement and window metadata. Use --json for a text body and response metadata envelope.' + 'Write Prometheus or OpenMetrics gauges to stdout. Requires connections:read and Analytics enabled in the Console. Counts cover completed UTC hours and are not monotonic counters. Project credentials read only their project. Disabled Analytics returns only enablement and window metadata. Use --json for a text body and response metadata envelope.' static override examples = [ '<%= config.bin %> analytics metrics --project PROJECT_ID > analytics.prom', '<%= config.bin %> analytics metrics --window-hours 24 --segments --format openmetrics', ] static override flags = { - 'session-id': Flags.string({ - description: 'Limit to one number record UUID.', + 'connection-id': Flags.string({ + description: 'Limit to one Connection UUID.', }), 'window-hours': Flags.integer({ description: 'Completed UTC hours to measure.', @@ -35,16 +35,16 @@ export default class AnalyticsMetrics extends BaseCommand { async run(): Promise<void> { const {flags} = await this.parse(AnalyticsMetrics) const query = analyticsMetricsQuery({ - sessionId: flags['session-id'], + connectionId: flags['connection-id'], windowHours: flags['window-hours'], segments: flags.segments, format: flags.format, }) - const session = await this.developerSession({ + const connection = await this.developerConnection({ ...flags, owner: flags.owner ?? (flags.project ? 'project' : 'organization'), }) - const result = await getAnalyticsMetrics(session.client, query) + const result = await getAnalyticsMetrics(connection.client, query) this.writeValue(result, result.data.trimEnd(), flags) } } diff --git a/src/commands/auth/status.ts b/src/commands/auth/status.ts index e89d48e3..814e6fd9 100644 --- a/src/commands/auth/status.ts +++ b/src/commands/auth/status.ts @@ -4,7 +4,7 @@ import {validateProjectToken} from '../../config/credentials.js' import { PolymorfaConfigurationError, validateMessagingCredential, - validateOrganizationApiKey, + validateTeamApiKey, } from '@polymorfa/sdk' export default class AuthStatus extends BaseCommand { @@ -61,7 +61,7 @@ function environmentStatus( ) } - if (apiKey !== undefined) validateOrganizationApiKey(apiKey) + if (apiKey !== undefined) validateTeamApiKey(apiKey) if (clientToken !== undefined) { validateMessagingCredential({type: 'clientToken', value: clientToken}) } diff --git a/src/commands/bansafe/claim/list.ts b/src/commands/bansafe/claim/list.ts index bd0065c5..b927129d 100644 --- a/src/commands/bansafe/claim/list.ts +++ b/src/commands/bansafe/claim/list.ts @@ -11,7 +11,7 @@ export default class BanSafeClaimList extends BaseCommand { cursor: Flags.string({description: 'Continue from an opaque page cursor.'}), limit: Flags.integer({max: 100, min: 1}), project: Flags.string({description: 'Project ID.', required: true}), - session: Flags.string({description: 'Match one session ID or name.'}), + connection: Flags.string({description: 'Match one connection ID or name.'}), status: Flags.string({ options: [ 'filed', @@ -29,7 +29,7 @@ export default class BanSafeClaimList extends BaseCommand { projectId: flags.project, ...(flags.cursor === undefined ? {} : {cursor: flags.cursor}), ...(flags.limit === undefined ? {} : {limit: flags.limit}), - ...(flags.session === undefined ? {} : {session: flags.session}), + ...(flags.connection === undefined ? {} : {connection: flags.connection}), ...(flags.status === undefined ? {} : {status: flags.status as BanSafeClaimStatus}), diff --git a/src/commands/bansafe/collection/list.ts b/src/commands/bansafe/collection/list.ts index 2e94915d..b15ce585 100644 --- a/src/commands/bansafe/collection/list.ts +++ b/src/commands/bansafe/collection/list.ts @@ -10,7 +10,7 @@ export default class BanSafeCollectionList extends BaseCommand { static override flags = { cursor: Flags.string({description: 'Continue from an opaque page cursor.'}), limit: Flags.integer({ - description: 'Maximum sessions to return (default 25).', + description: 'Maximum connections to return (default 25).', max: 100, min: 1, }), diff --git a/src/commands/bansafe/finding/list.ts b/src/commands/bansafe/finding/list.ts index eedf6b18..6508aa36 100644 --- a/src/commands/bansafe/finding/list.ts +++ b/src/commands/bansafe/finding/list.ts @@ -11,7 +11,7 @@ export default class BanSafeFindingList extends BaseCommand { cursor: Flags.string({description: 'Continue from an opaque page cursor.'}), limit: Flags.integer({max: 100, min: 1}), project: Flags.string({description: 'Project ID.', required: true}), - session: Flags.string({description: 'Match one session ID or name.'}), + connection: Flags.string({description: 'Match one connection ID or name.'}), severity: Flags.string({options: ['info', 'warning', 'critical']}), status: Flags.string({options: ['open', 'acknowledged', 'resolved']}), } @@ -21,7 +21,7 @@ export default class BanSafeFindingList extends BaseCommand { projectId: flags.project, ...(flags.cursor === undefined ? {} : {cursor: flags.cursor}), ...(flags.limit === undefined ? {} : {limit: flags.limit}), - ...(flags.session === undefined ? {} : {session: flags.session}), + ...(flags.connection === undefined ? {} : {connection: flags.connection}), ...(flags.severity === undefined ? {} : {severity: flags.severity as BanSafeFindingSeverity}), diff --git a/src/commands/bansafe/health-action/list.ts b/src/commands/bansafe/health-action/list.ts index 642ec528..3c46a42b 100644 --- a/src/commands/bansafe/health-action/list.ts +++ b/src/commands/bansafe/health-action/list.ts @@ -19,7 +19,7 @@ export default class BanSafeHealthActionList extends BaseCommand { min: 1, }), project: Flags.string({description: 'Project ID.', required: true}), - session: Flags.string({description: 'Match one session ID or name.'}), + connection: Flags.string({description: 'Match one connection ID or name.'}), status: Flags.string({ description: 'Match one action status.', options: ['pending', 'running', 'succeeded', 'failed', 'cancelled'], @@ -32,7 +32,7 @@ export default class BanSafeHealthActionList extends BaseCommand { projectId: flags.project, ...(flags.cursor === undefined ? {} : {cursor: flags.cursor}), ...(flags.limit === undefined ? {} : {limit: flags.limit}), - ...(flags.session === undefined ? {} : {session: flags.session}), + ...(flags.connection === undefined ? {} : {connection: flags.connection}), ...(flags.status === undefined ? {} : {status: flags.status as BanSafeHealthActionStatus}), diff --git a/src/commands/bansafe/health/history.ts b/src/commands/bansafe/health/history.ts index 1db493a3..30fce180 100644 --- a/src/commands/bansafe/health/history.ts +++ b/src/commands/bansafe/health/history.ts @@ -8,10 +8,13 @@ import { export default class BanSafeHealthHistory extends BaseCommand { static override args = { - session: Args.string({description: 'Session ID or name.', required: true}), + connection: Args.string({ + description: 'Connection ID or name.', + required: true, + }), } static override description = - 'List recorded BanSafe Health evaluations for one session.' + 'List recorded BanSafe Health evaluations for one connection.' static override flags = { limit: Flags.integer({ @@ -28,7 +31,7 @@ export default class BanSafeHealthHistory extends BaseCommand { const {args, flags} = await this.parse(BanSafeHealthHistory) const result = await listHealthHistory( await this.platformClient(flags), - args.session, + args.connection, { ...(flags.limit === undefined ? {} : {limit: flags.limit}), ...(flags.since === undefined ? {} : {since: flags.since}), diff --git a/src/commands/bansafe/health/list.ts b/src/commands/bansafe/health/list.ts index 3926f998..8b0a3000 100644 --- a/src/commands/bansafe/health/list.ts +++ b/src/commands/bansafe/health/list.ts @@ -9,7 +9,7 @@ export default class BanSafeHealthList extends BaseCommand { static override flags = { cursor: Flags.string({description: 'Continue from an opaque page cursor.'}), limit: Flags.integer({ - description: 'Maximum sessions to return (default 25).', + description: 'Maximum connections to return (default 25).', max: 100, min: 1, }), diff --git a/src/commands/bansafe/health/view.ts b/src/commands/bansafe/health/view.ts index cac2f026..f65e410c 100644 --- a/src/commands/bansafe/health/view.ts +++ b/src/commands/bansafe/health/view.ts @@ -5,15 +5,19 @@ import {getHealth, renderHealth} from '../../../services/bansafe.js' export default class BanSafeHealthView extends BaseCommand { static override args = { - session: Args.string({description: 'Session ID or name.', required: true}), + connection: Args.string({ + description: 'Connection ID or name.', + required: true, + }), } - static override description = 'View current BanSafe Health for one session.' + static override description = + 'View current BanSafe Health for one connection.' async run(): Promise<void> { const {args, flags} = await this.parse(BanSafeHealthView) const result = await getHealth( await this.platformClient(flags), - args.session, + args.connection, ) this.writeValue(result, renderHealth(result.data), flags) } diff --git a/src/commands/bansafe/incident/list.ts b/src/commands/bansafe/incident/list.ts index 7eb6d132..a567d74a 100644 --- a/src/commands/bansafe/incident/list.ts +++ b/src/commands/bansafe/incident/list.ts @@ -10,7 +10,7 @@ export default class BanSafeIncidentList extends BaseCommand { cursor: Flags.string({description: 'Continue from an opaque page cursor.'}), limit: Flags.integer({max: 100, min: 1}), project: Flags.string({description: 'Project ID.', required: true}), - session: Flags.string({description: 'Match one session ID or name.'}), + connection: Flags.string({description: 'Match one connection ID or name.'}), } async run(): Promise<void> { const {flags} = await this.parse(BanSafeIncidentList) @@ -18,7 +18,7 @@ export default class BanSafeIncidentList extends BaseCommand { projectId: flags.project, ...(flags.cursor === undefined ? {} : {cursor: flags.cursor}), ...(flags.limit === undefined ? {} : {limit: flags.limit}), - ...(flags.session === undefined ? {} : {session: flags.session}), + ...(flags.connection === undefined ? {} : {connection: flags.connection}), }) this.writeValue(result, renderIncidents(result.data), flags) } diff --git a/src/commands/bansafe/incident/report.ts b/src/commands/bansafe/incident/report.ts index 2662f55c..448a90ba 100644 --- a/src/commands/bansafe/incident/report.ts +++ b/src/commands/bansafe/incident/report.ts @@ -12,14 +12,17 @@ export default class BanSafeIncidentReport extends BaseCommand { }), note: Flags.string({description: 'Optional incident context.'}), 'occurred-at': Flags.string({description: 'Observed ISO 8601 instant.'}), - session: Flags.string({description: 'Session ID or name.', required: true}), + connection: Flags.string({ + description: 'Connection ID or name.', + required: true, + }), } async run(): Promise<void> { const {flags} = await this.parse(BanSafeIncidentReport) const result = await reportIncident( await this.platformClient(flags), { - session: flags.session, + connection: flags.connection, ...(flags.note === undefined ? {} : {note: flags.note}), ...(flags['occurred-at'] === undefined ? {} diff --git a/src/commands/bansafe/safe-mode/update.ts b/src/commands/bansafe/safe-mode/update.ts index cb09368e..2ae86b3b 100644 --- a/src/commands/bansafe/safe-mode/update.ts +++ b/src/commands/bansafe/safe-mode/update.ts @@ -5,14 +5,15 @@ import {BaseCommand} from '../../../base-command.js' import { renderSafeMode, updateProjectSafeMode, - updateSessionSafeMode, + updateConnectionSafeMode, } from '../../../services/bansafe.js' export default class BanSafeSafeModeUpdate extends BaseCommand { static override args = { - session: Args.string({description: 'Session ID or name.'}), + connection: Args.string({description: 'Connection ID or name.'}), } - static override description = 'Update project or session Safe Mode settings.' + static override description = + 'Update project or connection Safe Mode settings.' static override flags = { 'idempotency-key': Flags.string({ description: 'Identify retries of this update.', @@ -24,25 +25,30 @@ export default class BanSafeSafeModeUpdate extends BaseCommand { required: true, }), project: Flags.string({ - description: 'Project ID; required when session is omitted.', + description: 'Project ID; required when connection is omitted.', }), } async run(): Promise<void> { const {args, flags} = await this.parse(BanSafeSafeModeUpdate) - if (args.session === undefined && flags.project === undefined) - this.error('Provide a session argument or --project.', {exit: 2}) + if (args.connection === undefined && flags.project === undefined) + this.error('Provide a connection argument or --project.', {exit: 2}) const client = await this.platformClient(flags) const input = await readJsonInput(flags.input) const options = {idempotencyKey: flags['idempotency-key']} const result = - args.session === undefined + args.connection === undefined ? await updateProjectSafeMode( client, flags.project as string, input, options, ) - : await updateSessionSafeMode(client, args.session, input, options) + : await updateConnectionSafeMode( + client, + args.connection, + input, + options, + ) this.writeValue(result, renderSafeMode(result.data), flags) } } diff --git a/src/commands/bansafe/safe-mode/view.ts b/src/commands/bansafe/safe-mode/view.ts index 0f81cc45..d2838306 100644 --- a/src/commands/bansafe/safe-mode/view.ts +++ b/src/commands/bansafe/safe-mode/view.ts @@ -3,33 +3,34 @@ import {Args, Flags} from '@oclif/core' import {BaseCommand} from '../../../base-command.js' import { getProjectSafeMode, - getSessionSafeMode, + getConnectionSafeMode, renderSafeMode, } from '../../../services/bansafe.js' export default class BanSafeSafeModeView extends BaseCommand { static override args = { - session: Args.string({description: 'Session ID or name.'}), + connection: Args.string({description: 'Connection ID or name.'}), } - static override description = 'View project or effective session Safe Mode.' + static override description = + 'View project or effective connection Safe Mode.' static override flags = { project: Flags.string({ - description: 'Project ID; required when session is omitted.', + description: 'Project ID; required when connection is omitted.', }), } async run(): Promise<void> { const {args, flags} = await this.parse(BanSafeSafeModeView) - if (args.session === undefined && flags.project === undefined) - this.error('Provide a session argument or --project.', {exit: 2}) + if (args.connection === undefined && flags.project === undefined) + this.error('Provide a connection argument or --project.', {exit: 2}) const result = - args.session === undefined + args.connection === undefined ? await getProjectSafeMode( await this.platformClient(flags), flags.project as string, ) - : await getSessionSafeMode( + : await getConnectionSafeMode( await this.platformClient(flags), - args.session, + args.connection, ) this.writeValue(result, renderSafeMode(result.data), flags) } diff --git a/src/commands/bansafe/telemetry/history.ts b/src/commands/bansafe/telemetry/history.ts index c8c69ab7..dcecbf40 100644 --- a/src/commands/bansafe/telemetry/history.ts +++ b/src/commands/bansafe/telemetry/history.ts @@ -8,10 +8,13 @@ import { export default class BanSafeTelemetryHistory extends BaseCommand { static override args = { - session: Args.string({description: 'Session ID or name.', required: true}), + connection: Args.string({ + description: 'Connection ID or name.', + required: true, + }), } static override description = - 'List bounded BanSafe telemetry snapshots for one session.' + 'List bounded BanSafe telemetry snapshots for one connection.' static override flags = { cursor: Flags.string({description: 'Continue from an opaque page cursor.'}), @@ -32,7 +35,7 @@ export default class BanSafeTelemetryHistory extends BaseCommand { const {args, flags} = await this.parse(BanSafeTelemetryHistory) const result = await listTelemetryHistory( await this.platformClient(flags), - args.session, + args.connection, { ...(flags.cursor === undefined ? {} : {cursor: flags.cursor}), ...(flags.limit === undefined ? {} : {limit: flags.limit}), diff --git a/src/commands/bansafe/telemetry/view.ts b/src/commands/bansafe/telemetry/view.ts index cd248d4d..05735f94 100644 --- a/src/commands/bansafe/telemetry/view.ts +++ b/src/commands/bansafe/telemetry/view.ts @@ -5,16 +5,19 @@ import {getTelemetry, renderTelemetry} from '../../../services/bansafe.js' export default class BanSafeTelemetryView extends BaseCommand { static override args = { - session: Args.string({description: 'Session ID or name.', required: true}), + connection: Args.string({ + description: 'Connection ID or name.', + required: true, + }), } static override description = - 'View the latest bounded BanSafe telemetry for one session.' + 'View the latest bounded BanSafe telemetry for one connection.' async run(): Promise<void> { const {args, flags} = await this.parse(BanSafeTelemetryView) const result = await getTelemetry( await this.platformClient(flags), - args.session, + args.connection, ) this.writeValue(result, renderTelemetry(result.data), flags) } diff --git a/src/commands/billing/controls/get.ts b/src/commands/billing/controls/get.ts index 8bd6d067..eb708c66 100644 --- a/src/commands/billing/controls/get.ts +++ b/src/commands/billing/controls/get.ts @@ -9,14 +9,14 @@ export default class ControlsGet extends BaseCommand { static override flags = { scope: Flags.string({ required: true, - options: ['project', 'customer', 'number'], + options: ['project', 'customer', 'connection'], }), } async run() { const {args, flags} = await this.parse(ControlsGet) const result = await getResourceControls( await this.platformClient(flags), - flags.scope as 'project' | 'customer' | 'number', + flags.scope as 'project' | 'customer' | 'connection', args.id, ) this.writeValue(result, JSON.stringify(result.data), flags) diff --git a/src/commands/billing/controls/set.ts b/src/commands/billing/controls/set.ts index e1303ae2..1a5abe27 100644 --- a/src/commands/billing/controls/set.ts +++ b/src/commands/billing/controls/set.ts @@ -12,7 +12,7 @@ export default class ControlsSet extends BaseCommand { static override flags = { scope: Flags.string({ required: true, - options: ['project', 'customer', 'number'], + options: ['project', 'customer', 'connection'], }), credits: Flags.string(), unlimited: Flags.boolean({exclusive: ['credits']}), @@ -24,7 +24,7 @@ export default class ControlsSet extends BaseCommand { const {args, flags} = await this.parse(ControlsSet) const result = await setResourceControls( await this.platformClient(flags), - flags.scope as 'project' | 'customer' | 'number', + flags.scope as 'project' | 'customer' | 'connection', args.id, { limitCredits: limitValue(flags.credits, flags.unlimited), diff --git a/src/commands/billing/limits/list.ts b/src/commands/billing/limits/list.ts index 0e2a2f2b..b3d75b7b 100644 --- a/src/commands/billing/limits/list.ts +++ b/src/commands/billing/limits/list.ts @@ -1,9 +1,10 @@ import {BaseCommand} from '../../../base-command.js' import {getLimits, renderLimits} from '../../../services/billing-controls.js' export default class LimitsList extends BaseCommand { - static override summary = 'Read monthly project and number spending limits.' + static override summary = + 'Read monthly project and Connection spending limits.' static override description = - 'Requires an organization key with billing:read. Use --project to include its number limits. Months reset on the first day at 00:00 UTC.' + 'Requires an organization key with billing:read. Use --project to include its Connection limits. Months reset on the first day at 00:00 UTC.' async run(): Promise<void> { const {flags} = await this.parse(LimitsList) const result = await getLimits( diff --git a/src/commands/billing/limits/set.ts b/src/commands/billing/limits/set.ts index 9e321787..78de4d13 100644 --- a/src/commands/billing/limits/set.ts +++ b/src/commands/billing/limits/set.ts @@ -6,11 +6,14 @@ export default class LimitsSet extends BaseCommand { static override description = 'Requires Pay-As-You-Go and an organization key with billing:manage. Zero blocks new charges; already-paid service continues. A stale observed revision fails without overwriting newer settings.' static override args = { - id: Args.string({required: true, description: 'Project or number UUID.'}), + id: Args.string({ + required: true, + description: 'Project or Connection UUID.', + }), } static override flags = { scope: Flags.string({ - options: ['project', 'customer', 'number'], + options: ['project', 'customer', 'connection'], required: true, }), credits: Flags.string({ @@ -31,7 +34,7 @@ export default class LimitsSet extends BaseCommand { const value = limitValue(flags.credits, flags.unlimited) const result = await setLimit( await this.platformClient(flags), - flags.scope as 'project' | 'customer' | 'number', + flags.scope as 'project' | 'customer' | 'connection', args.id, value, flags['expected-revision'], diff --git a/src/commands/billing/priority/list.ts b/src/commands/billing/priority/list.ts index de5a123e..677f187f 100644 --- a/src/commands/billing/priority/list.ts +++ b/src/commands/billing/priority/list.ts @@ -5,9 +5,9 @@ import { } from '../../../services/billing-controls.js' export default class PriorityList extends BaseCommand { static override summary = - 'Read project, customer and number funding priorities.' + 'Read project, customer and connection funding priorities.' static override description = - 'Requires an organization key with billing:read. Project priority takes precedence. Numbers inherit customer priority; a higher number priority overrides it. Use --project for its funding controls. Includes the revision used for changes.' + 'Requires an organization key with billing:read. Project priority takes precedence. Connections inherit customer priority; a higher Connection priority overrides it. Use --project for its funding controls. Includes the revision used for changes.' async run(): Promise<void> { const {flags} = await this.parse(PriorityList) const result = await getPriorities( diff --git a/src/commands/billing/priority/reorder.ts b/src/commands/billing/priority/reorder.ts index 7d9aff3f..cc094cc8 100644 --- a/src/commands/billing/priority/reorder.ts +++ b/src/commands/billing/priority/reorder.ts @@ -6,16 +6,16 @@ import {reorderPriorities} from '../../../services/billing-controls.js' export default class PriorityReorder extends BaseCommand { static override summary = 'Save a complete funding order atomically.' static override description = - 'Requires Pay-As-You-Go and an organization key with billing:manage. Pass every active project, customer or real number for its scope. Resource scope mixes all customers and numbers in --project, highest first. Incomplete or stale orders fail without partial changes.' + 'Requires Pay-As-You-Go and an organization key with billing:manage. Pass every active project, customer or real connection for its scope. Resource scope mixes all customers and connections in --project, highest first. Incomplete or stale orders fail without partial changes.' static override flags = { scope: Flags.string({ - options: ['project', 'customer', 'number', 'resource'], + options: ['project', 'customer', 'connection', 'resource'], required: true, }), ids: Flags.string({ exclusive: ['ids-file'], description: - 'UUIDs, highest first. For resource scope use customer:UUID or number:UUID.', + 'UUIDs, highest first. For resource scope use customer:UUID or connection:UUID.', }), 'ids-file': Flags.string({ exclusive: ['ids'], @@ -41,7 +41,7 @@ export default class PriorityReorder extends BaseCommand { ) const result = await reorderPriorities( await this.platformClient(flags), - flags.scope as 'project' | 'customer' | 'number' | 'resource', + flags.scope as 'project' | 'customer' | 'connection' | 'resource', ids, flags['expected-revision'], flags.project, diff --git a/src/commands/billing/priority/set.ts b/src/commands/billing/priority/set.ts index 4058883e..140353fa 100644 --- a/src/commands/billing/priority/set.ts +++ b/src/commands/billing/priority/set.ts @@ -2,15 +2,18 @@ import {Args, Flags} from '@oclif/core' import {BaseCommand} from '../../../base-command.js' import {setPriority} from '../../../services/billing-controls.js' export default class PrioritySet extends BaseCommand { - static override summary = 'Set a project or number funding priority.' + static override summary = 'Set a project or Connection funding priority.' static override description = 'Requires Pay-As-You-Go and an organization key with billing:manage. Changes future renewal protection and recovery; paid windows keep their expiry.' static override args = { - id: Args.string({required: true, description: 'Project or number UUID.'}), + id: Args.string({ + required: true, + description: 'Project or Connection UUID.', + }), } static override flags = { scope: Flags.string({ - options: ['project', 'customer', 'number'], + options: ['project', 'customer', 'connection'], required: true, }), priority: Flags.integer({required: true, min: 0, max: 1000000}), @@ -20,7 +23,7 @@ export default class PrioritySet extends BaseCommand { const {args, flags} = await this.parse(PrioritySet) const result = await setPriority( await this.platformClient(flags), - flags.scope as 'project' | 'customer' | 'number', + flags.scope as 'project' | 'customer' | 'connection', args.id, flags.priority, flags['expected-revision'], diff --git a/src/commands/business/accounts/view.ts b/src/commands/business/accounts/view.ts index 94a65909..b359ca85 100644 --- a/src/commands/business/accounts/view.ts +++ b/src/commands/business/accounts/view.ts @@ -11,8 +11,8 @@ export default class BusinessAccountsView extends BaseCommand { 'View linked business accounts and ad identities.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -21,7 +21,7 @@ export default class BusinessAccountsView extends BaseCommand { const {flags} = await this.parse(BusinessAccountsView) const result = await viewBusinessLinkedAccounts( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, ) this.writeValue(result, renderJson(result.data), flags) } diff --git a/src/commands/business/catalog/cart/set.ts b/src/commands/business/catalog/cart/set.ts index 0d7d3fd8..1db0b95d 100644 --- a/src/commands/business/catalog/cart/set.ts +++ b/src/commands/business/catalog/cart/set.ts @@ -18,8 +18,8 @@ export default class BusinessCatalogCartSet extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this cart update.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -29,7 +29,7 @@ export default class BusinessCatalogCartSet extends BaseCommand { const enabled = flags.enabled === 'true' const result = await setBusinessCartEnabled( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, enabled, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/business/catalog/create.ts b/src/commands/business/catalog/create.ts index 88f56ff9..1b71bd1f 100644 --- a/src/commands/business/catalog/create.ts +++ b/src/commands/business/catalog/create.ts @@ -13,8 +13,8 @@ export default class BusinessCatalogCreate extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this catalog creation.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -23,7 +23,7 @@ export default class BusinessCatalogCreate extends BaseCommand { const {flags} = await this.parse(BusinessCatalogCreate) const result = await createBusinessCatalog( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, flags['idempotency-key'] === undefined ? {} : {idempotencyKey: flags['idempotency-key']}, diff --git a/src/commands/business/catalog/view.ts b/src/commands/business/catalog/view.ts index 5b2e4ea0..b43151cc 100644 --- a/src/commands/business/catalog/view.ts +++ b/src/commands/business/catalog/view.ts @@ -27,8 +27,8 @@ export default class BusinessCatalogView extends BaseCommand { max: 100, min: 1, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), width: Flags.integer({ @@ -42,7 +42,7 @@ export default class BusinessCatalogView extends BaseCommand { const {flags} = await this.parse(BusinessCatalogView) const result = await viewBusinessCatalog( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, { id: flags.id, ...(flags.after === undefined ? {} : {after: flags.after}), diff --git a/src/commands/business/collection/appeal.ts b/src/commands/business/collection/appeal.ts index aa7dda3e..154dc1ca 100644 --- a/src/commands/business/collection/appeal.ts +++ b/src/commands/business/collection/appeal.ts @@ -21,8 +21,8 @@ export default class BusinessCollectionAppeal extends BaseCommand { description: 'Safely identify retries of this collection appeal.', }), reason: Flags.string({description: 'Appeal reason.', required: true}), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -31,7 +31,7 @@ export default class BusinessCollectionAppeal extends BaseCommand { const {args, flags} = await this.parse(BusinessCollectionAppeal) const result = await appealBusinessCollection( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, args.collection, flags.reason, flags['idempotency-key'] === undefined diff --git a/src/commands/business/collection/create.ts b/src/commands/business/collection/create.ts index 29f3b941..a1c45bf9 100644 --- a/src/commands/business/collection/create.ts +++ b/src/commands/business/collection/create.ts @@ -19,8 +19,8 @@ export default class BusinessCollectionCreate extends BaseCommand { multiple: true, required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -29,7 +29,7 @@ export default class BusinessCollectionCreate extends BaseCommand { const {flags} = await this.parse(BusinessCollectionCreate) const result = await createBusinessCollection( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, {name: flags.name, productIds: flags.product}, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/business/collection/delete.ts b/src/commands/business/collection/delete.ts index 4bbd3e1f..00ecba7b 100644 --- a/src/commands/business/collection/delete.ts +++ b/src/commands/business/collection/delete.ts @@ -20,8 +20,8 @@ export default class BusinessCollectionDelete extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this collection deletion.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), yes: Flags.boolean({ @@ -34,7 +34,7 @@ export default class BusinessCollectionDelete extends BaseCommand { const {args, flags} = await this.parse(BusinessCollectionDelete) const result = await deleteBusinessCollection( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, args.collection, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/business/collection/list.ts b/src/commands/business/collection/list.ts index 770a18e6..6d45856d 100644 --- a/src/commands/business/collection/list.ts +++ b/src/commands/business/collection/list.ts @@ -32,8 +32,8 @@ export default class BusinessCollectionList extends BaseCommand { description: 'Polymorfa business user ID.', required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), width: Flags.integer({ @@ -47,7 +47,7 @@ export default class BusinessCollectionList extends BaseCommand { const {flags} = await this.parse(BusinessCollectionList) const result = await listBusinessCollections( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, { id: flags.id, ...(flags.after === undefined ? {} : {after: flags.after}), diff --git a/src/commands/business/collection/reorder.ts b/src/commands/business/collection/reorder.ts index 64e8a89d..a98d14e3 100644 --- a/src/commands/business/collection/reorder.ts +++ b/src/commands/business/collection/reorder.ts @@ -19,8 +19,8 @@ export default class BusinessCollectionReorder extends BaseCommand { description: 'Read {"moves":[...]} from a file or standard input (-).', required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -29,7 +29,7 @@ export default class BusinessCollectionReorder extends BaseCommand { const {flags} = await this.parse(BusinessCollectionReorder) const result = await reorderBusinessCollections( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, await readJsonInput(flags.input), flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/business/collection/update.ts b/src/commands/business/collection/update.ts index 000abcbd..f57383b7 100644 --- a/src/commands/business/collection/update.ts +++ b/src/commands/business/collection/update.ts @@ -29,8 +29,8 @@ export default class BusinessCollectionUpdate extends BaseCommand { description: 'Product ID to remove. Repeat for multiple products.', multiple: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -39,7 +39,7 @@ export default class BusinessCollectionUpdate extends BaseCommand { const {args, flags} = await this.parse(BusinessCollectionUpdate) const result = await updateBusinessCollection( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, args.collection, { ...(flags.name === undefined ? {} : {name: flags.name}), diff --git a/src/commands/business/collection/view.ts b/src/commands/business/collection/view.ts index 34872bec..185785fd 100644 --- a/src/commands/business/collection/view.ts +++ b/src/commands/business/collection/view.ts @@ -35,8 +35,8 @@ export default class BusinessCollectionView extends BaseCommand { max: 100, min: 1, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), width: Flags.integer({ @@ -50,7 +50,7 @@ export default class BusinessCollectionView extends BaseCommand { const {args, flags} = await this.parse(BusinessCollectionView) const result = await viewBusinessCollection( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, args.collection, { id: flags.id, diff --git a/src/commands/business/compliance/replace.ts b/src/commands/business/compliance/replace.ts index 63030399..5063f7f7 100644 --- a/src/commands/business/compliance/replace.ts +++ b/src/commands/business/compliance/replace.ts @@ -19,8 +19,8 @@ export default class BusinessComplianceReplace extends BaseCommand { 'Read the complete JSON compliance body from a file or standard input (-).', required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -29,7 +29,7 @@ export default class BusinessComplianceReplace extends BaseCommand { const {flags} = await this.parse(BusinessComplianceReplace) const result = await replaceBusinessCompliance( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, await readJsonInput(flags.input), flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/business/compliance/view.ts b/src/commands/business/compliance/view.ts index cf6739f0..78e065ce 100644 --- a/src/commands/business/compliance/view.ts +++ b/src/commands/business/compliance/view.ts @@ -7,8 +7,8 @@ export default class BusinessComplianceView extends BaseCommand { static override description = 'View complete business merchant compliance.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -17,7 +17,7 @@ export default class BusinessComplianceView extends BaseCommand { const {flags} = await this.parse(BusinessComplianceView) const result = await viewBusinessCompliance( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, ) this.writeValue(result, renderJson(result.data), flags) } diff --git a/src/commands/business/eligibility/view.ts b/src/commands/business/eligibility/view.ts index c1e8420a..4140d557 100644 --- a/src/commands/business/eligibility/view.ts +++ b/src/commands/business/eligibility/view.ts @@ -10,8 +10,8 @@ export default class BusinessEligibilityView extends BaseCommand { static override description = 'View business feature eligibility.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -20,7 +20,7 @@ export default class BusinessEligibilityView extends BaseCommand { const {flags} = await this.parse(BusinessEligibilityView) const result = await viewBusinessEligibility( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, ) this.writeValue(result, renderBusinessEligibility(result.data), flags) } diff --git a/src/commands/business/order/view.ts b/src/commands/business/order/view.ts index d18f21ed..a443054e 100644 --- a/src/commands/business/order/view.ts +++ b/src/commands/business/order/view.ts @@ -19,8 +19,8 @@ export default class BusinessOrderView extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this POST lookup.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), token: Flags.string({ @@ -33,7 +33,7 @@ export default class BusinessOrderView extends BaseCommand { const {args, flags} = await this.parse(BusinessOrderView) const result = await viewBusinessOrder( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, args.order, flags.token, flags['idempotency-key'] === undefined diff --git a/src/commands/business/product/appeal.ts b/src/commands/business/product/appeal.ts index 2da685e7..ae36fe0f 100644 --- a/src/commands/business/product/appeal.ts +++ b/src/commands/business/product/appeal.ts @@ -18,8 +18,8 @@ export default class BusinessProductAppeal extends BaseCommand { description: 'Safely identify retries of this product appeal.', }), reason: Flags.string({description: 'Appeal reason.', required: true}), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -28,7 +28,7 @@ export default class BusinessProductAppeal extends BaseCommand { const {args, flags} = await this.parse(BusinessProductAppeal) const result = await appealBusinessProduct( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, args.product, flags.reason, flags['idempotency-key'] === undefined diff --git a/src/commands/business/product/create.ts b/src/commands/business/product/create.ts index facd7bc2..3f69eff9 100644 --- a/src/commands/business/product/create.ts +++ b/src/commands/business/product/create.ts @@ -21,8 +21,8 @@ export default class BusinessProductCreate extends BaseCommand { 'Read the complete JSON product from a file or standard input (-).', required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -31,7 +31,7 @@ export default class BusinessProductCreate extends BaseCommand { const {flags} = await this.parse(BusinessProductCreate) const result = await createBusinessProduct( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, await readJsonInput(flags.input), flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/business/product/delete.ts b/src/commands/business/product/delete.ts index d5bc6a42..f2af5b94 100644 --- a/src/commands/business/product/delete.ts +++ b/src/commands/business/product/delete.ts @@ -17,8 +17,8 @@ export default class BusinessProductDelete extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this product deletion.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), yes: Flags.boolean({ @@ -31,7 +31,7 @@ export default class BusinessProductDelete extends BaseCommand { const {args, flags} = await this.parse(BusinessProductDelete) const result = await deleteBusinessProduct( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, args.product, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/business/product/replace.ts b/src/commands/business/product/replace.ts index e4b3b314..714b788d 100644 --- a/src/commands/business/product/replace.ts +++ b/src/commands/business/product/replace.ts @@ -25,8 +25,8 @@ export default class BusinessProductReplace extends BaseCommand { 'Read the complete JSON replacement from a file or standard input (-).', required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -35,7 +35,7 @@ export default class BusinessProductReplace extends BaseCommand { const {args, flags} = await this.parse(BusinessProductReplace) const result = await replaceBusinessProduct( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, args.product, await readJsonInput(flags.input), flags['idempotency-key'] === undefined diff --git a/src/commands/business/product/view.ts b/src/commands/business/product/view.ts index f4bf73c5..157158d3 100644 --- a/src/commands/business/product/view.ts +++ b/src/commands/business/product/view.ts @@ -18,8 +18,8 @@ export default class BusinessProductView extends BaseCommand { description: 'Polymorfa business user ID.', required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -28,7 +28,7 @@ export default class BusinessProductView extends BaseCommand { const {args, flags} = await this.parse(BusinessProductView) const result = await viewBusinessProduct( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, args.product, {id: flags.id}, ) diff --git a/src/commands/business/product/visibility/set.ts b/src/commands/business/product/visibility/set.ts index 85171b63..db4b73a5 100644 --- a/src/commands/business/product/visibility/set.ts +++ b/src/commands/business/product/visibility/set.ts @@ -22,8 +22,8 @@ export default class BusinessProductVisibilitySet extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this visibility update.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -33,7 +33,7 @@ export default class BusinessProductVisibilitySet extends BaseCommand { const hidden = flags.hidden === 'true' const result = await setBusinessProductVisibility( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, args.product, hidden, flags['idempotency-key'] === undefined diff --git a/src/commands/business/profile/cover/delete.ts b/src/commands/business/profile/cover/delete.ts index 4e0de728..9fb99e19 100644 --- a/src/commands/business/profile/cover/delete.ts +++ b/src/commands/business/profile/cover/delete.ts @@ -20,8 +20,8 @@ export default class BusinessProfileCoverDelete extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this cover-photo deletion.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), yes: Flags.boolean({ @@ -34,7 +34,7 @@ export default class BusinessProfileCoverDelete extends BaseCommand { const {args, flags} = await this.parse(BusinessProfileCoverDelete) const result = await deleteBusinessCoverPhoto( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, args.cover, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/business/profile/cover/set.ts b/src/commands/business/profile/cover/set.ts index 97ffe3ef..324d498c 100644 --- a/src/commands/business/profile/cover/set.ts +++ b/src/commands/business/profile/cover/set.ts @@ -17,8 +17,8 @@ export default class BusinessProfileCoverSet extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this cover-photo update.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), url: Flags.string({ @@ -32,7 +32,7 @@ export default class BusinessProfileCoverSet extends BaseCommand { const {flags} = await this.parse(BusinessProfileCoverSet) const result = await setBusinessCoverPhoto( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, { ...(flags.file === undefined ? {} : {file: flags.file}), ...(flags.url === undefined ? {} : {url: flags.url}), diff --git a/src/commands/business/profile/update.ts b/src/commands/business/profile/update.ts index d7a7eee1..49c27fe2 100644 --- a/src/commands/business/profile/update.ts +++ b/src/commands/business/profile/update.ts @@ -19,8 +19,8 @@ export default class BusinessProfileUpdate extends BaseCommand { 'Read the complete JSON profile update from a file or standard input (-).', required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -29,7 +29,7 @@ export default class BusinessProfileUpdate extends BaseCommand { const {flags} = await this.parse(BusinessProfileUpdate) const result = await updateOwnBusinessProfile( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, await readJsonInput(flags.input), flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/business/profile/view.ts b/src/commands/business/profile/view.ts index 4926373b..51b60436 100644 --- a/src/commands/business/profile/view.ts +++ b/src/commands/business/profile/view.ts @@ -11,8 +11,8 @@ export default class BusinessProfileView extends BaseCommand { "View the connected account's own business profile." static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -21,7 +21,7 @@ export default class BusinessProfileView extends BaseCommand { const {flags} = await this.parse(BusinessProfileView) const result = await viewOwnBusinessProfile( await this.messagingClient(flags, {serverApiKeyOnly: 'Business App'}), - flags.session, + flags.connection, ) this.writeValue(result, renderBusinessProfile(result.data), flags) } diff --git a/src/commands/call/reject.ts b/src/commands/call/reject.ts index 97e186db..dedfc9a0 100644 --- a/src/commands/call/reject.ts +++ b/src/commands/call/reject.ts @@ -4,7 +4,7 @@ import {BaseCommand} from '../../base-command.js' import { rejectCall, renderCallRejection, -} from '../../services/session-identities.js' +} from '../../services/connection-identities.js' export default class CallReject extends BaseCommand { static override args = { @@ -12,9 +12,9 @@ export default class CallReject extends BaseCommand { } static override description = - 'Reject an incoming call through the Linked Device session route, identified by session, call ID, and caller ID. Requires a server API key. To decline a call on the unified Calls API, use calls reject.' + 'Reject an incoming call through the Linked Device connection route, identified by connection, call ID, and caller ID. Requires a server API key. To decline a call on the unified Calls API, use calls reject.' - static override summary = 'Reject an incoming call by session and caller.' + static override summary = 'Reject an incoming call by connection and caller.' static override flags = { from: Flags.string({ @@ -24,8 +24,8 @@ export default class CallReject extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this call rejection.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -34,7 +34,7 @@ export default class CallReject extends BaseCommand { const {args, flags} = await this.parse(CallReject) const result = await rejectCall( await this.messagingClient(flags, {serverApiKeyOnly: 'Call'}), - flags.session, + flags.connection, args.call, flags.from, flags['idempotency-key'] === undefined diff --git a/src/commands/calls/check.ts b/src/commands/calls/check.ts index f144a3bd..b62db01d 100644 --- a/src/commands/calls/check.ts +++ b/src/commands/calls/check.ts @@ -12,16 +12,16 @@ export default class CallsCheck extends BaseCommand { } static override description = - 'Run the checks a call placement runs, without calling: the session’s calling switch, the team’s do-not-call list and blocked country codes, and on Cloud API numbers the person’s call permission and WhatsApp’s call limits. Prints allowed and the first refusal: calls_disabled, call_recipient_opted_out, call_destination_blocked, call_permission_required or call_limit_reached. The command exits with code 0 either way; read allowed from the output. Requires a server API key.' + 'Run the checks a call placement runs, without calling: the connection’s calling switch, the team’s do-not-call list and blocked country codes, and on Cloud API connections the person’s call permission and WhatsApp’s call limits. Prints allowed and the first refusal: calls_disabled, call_recipient_opted_out, call_destination_blocked, call_permission_required or call_limit_reached. The command exits with code 0 either way; read allowed from the output. Requires a server API key.' static override examples = [ - '<%= config.bin %> calls check +14155550123 --session support', - '<%= config.bin %> calls check +14155550123 --session support --json', + '<%= config.bin %> calls check +14155550123 --connection support', + '<%= config.bin %> calls check +14155550123 --connection support --json', ] static override flags = { - session: Flags.string({ - description: 'Session (number) that would place the call.', + connection: Flags.string({ + description: 'Connection that would place the call.', required: true, }), } @@ -32,7 +32,7 @@ export default class CallsCheck extends BaseCommand { const {args, flags} = await this.parse(CallsCheck) const result = await checkCall( await this.messagingClient(flags, {serverApiKeyOnly: 'Call check'}), - flags.session, + flags.connection, args.to, ) this.writeValue(result, renderCallCheck(result.data), flags) diff --git a/src/commands/calls/export.ts b/src/commands/calls/export.ts index 10a74e73..4aa94160 100644 --- a/src/commands/calls/export.ts +++ b/src/commands/calls/export.ts @@ -22,11 +22,11 @@ import { export default class CallsExport extends BaseCommand { static override description = `Export call detail records as CSV or newline-delimited JSON, newest first. -Each record has callId, projectId, sessionId, direction, upstream, outcome, state, hasVideo, peerRef, startedAt, connectedAt, endedAt, durationSeconds, and endReason. peerRef is a team-specific pseudonym of the other party, never a phone number. +Each record has callId, projectId, connectionId, direction, upstream, outcome, state, hasVideo, peerRef, startedAt, connectedAt, endedAt, durationSeconds, and endReason. peerRef is a team-specific pseudonym of the other party, never a phone number. The command requests every page until no records remain and writes one CSV header. Records go to standard output, or to --output. Progress and the next cursor go to standard error, as JSON lines with --json. --max-pages stops early; resume with --cursor and the same filters. When a page fails, the command reports the cursor that resumes from that page and exits non-zero. -Pass --project to read one project. Without it, an organization API key reads every project in the organization. A project token reads only its own project and requires --project. Credentials need the sessions:read scope.` +Pass --project to read one project. Without it, an organization API key reads every project in the organization. A project token reads only its own project and requires --project. Credentials need the connections:read scope.` static override examples = [ '<%= config.bin %> calls export --since 2026-09-01T00:00:00Z --output calls.csv', diff --git a/src/commands/calls/hand.ts b/src/commands/calls/hand.ts index b219706d..8a3b8359 100644 --- a/src/commands/calls/hand.ts +++ b/src/commands/calls/hand.ts @@ -10,7 +10,7 @@ export default class CallsHand extends BaseCommand { } static override description = - 'Raise or lower the Number’s hand. The Number has one hand state shared across its application connections.' + 'Raise or lower the Connection’s hand. The Connection has one hand state shared across its application connections.' static override examples = [ '<%= config.bin %> calls hand call_123 --connection-id conn_0123456789 --raised', diff --git a/src/commands/calls/invite.ts b/src/commands/calls/invite.ts index 7892ff1a..bac45ffd 100644 --- a/src/commands/calls/invite.ts +++ b/src/commands/calls/invite.ts @@ -14,7 +14,7 @@ export default class CallsInvite extends BaseCommand { } static override description = - 'Ring another WhatsApp user into a call, turning a 1:1 call into a group call. The call must have a live leg. While WhatsApp restricts the number to people it has already chatted with, inviting anyone else exits with code 3 and number_restricted.' + 'Ring another WhatsApp user into a call, turning a 1:1 call into a group call. The call must have a live leg. While WhatsApp restricts the Connection to people it has already chatted with, inviting anyone else exits with code 3 and connection_restricted.' static override examples = [ '<%= config.bin %> calls invite call_123 +15550101', diff --git a/src/commands/calls/link/create.ts b/src/commands/calls/link/create.ts index c04b1a7a..0c573810 100644 --- a/src/commands/calls/link/create.ts +++ b/src/commands/calls/link/create.ts @@ -8,16 +8,16 @@ import { export default class CallsLinkCreate extends BaseCommand { static override description = - 'Create a WhatsApp call link from a Linked Device Number. It does not place or join a call. Requires a server API key or project token and calling enabled for the Number; client tokens and Cloud API-only Numbers are refused. The request is never retried: if the outcome is unknown, check before creating another link. Keep the link private.' + 'Create a WhatsApp call link from a Linked Device Connection. It does not place or join a call. Requires a server API key or project token and calling enabled for the Connection; client tokens and Cloud API-only Connections are refused. The request is never retried: if the outcome is unknown, check before creating another link. Keep the link private.' static override examples = [ - '<%= config.bin %> calls link create --session support', - '<%= config.bin %> calls link create --session support --video --json', + '<%= config.bin %> calls link create --connection support', + '<%= config.bin %> calls link create --connection support --video --json', ] static override flags = { - session: Flags.string({ - description: 'Linked Device session that owns the link.', + connection: Flags.string({ + description: 'Linked Device connection that owns the link.', required: true, }), video: Flags.boolean({description: 'Create a video link.'}), @@ -29,7 +29,7 @@ export default class CallsLinkCreate extends BaseCommand { const {flags} = await this.parse(CallsLinkCreate) const result = await createCallLink( await this.messagingClient(flags, {serverCredentialOnly: 'Call link'}), - {session: flags.session, video: flags.video}, + {connection: flags.connection, video: flags.video}, ) this.writeValue(result, renderCreatedCallLink(result.data), flags) } diff --git a/src/commands/calls/link/preview.ts b/src/commands/calls/link/preview.ts index aff86ce4..c53bbc00 100644 --- a/src/commands/calls/link/preview.ts +++ b/src/commands/calls/link/preview.ts @@ -11,16 +11,16 @@ import { export default class CallsLinkPreview extends BaseCommand { static override description = - 'Read a WhatsApp call link through a Linked Device Number without joining the call. Pipe the link, or its token, on standard input so it stays out of shell history and process listings. A full link sets voice or video; pass --video with a bare video-link token. Requires a server API key or project token.' + 'Read a WhatsApp call link through a Linked Device Connection without joining the call. Pipe the link, or its token, on standard input so it stays out of shell history and process listings. A full link sets voice or video; pass --video with a bare video-link token. Requires a server API key or project token.' static override examples = [ - 'printf \'%s\' "$CALL_LINK" | <%= config.bin %> calls link preview --session support', - 'printf \'%s\' "$TOKEN" | <%= config.bin %> calls link preview --session support --video --json', + 'printf \'%s\' "$CALL_LINK" | <%= config.bin %> calls link preview --connection support', + 'printf \'%s\' "$TOKEN" | <%= config.bin %> calls link preview --connection support --video --json', ] static override flags = { - session: Flags.string({ - description: 'Linked Device session that reads the link.', + connection: Flags.string({ + description: 'Linked Device connection that reads the link.', required: true, }), video: Flags.boolean({ @@ -42,7 +42,7 @@ export default class CallsLinkPreview extends BaseCommand { this.registerSecret(link.token) const result = await previewCallLink(client, { link, - session: flags.session, + connection: flags.connection, ...(flags.video ? {video: true} : {}), }) this.writeValue(result, renderPreviewedCallLink(result.data), flags) diff --git a/src/commands/calls/list.ts b/src/commands/calls/list.ts index 795e5b9e..24937b21 100644 --- a/src/commands/calls/list.ts +++ b/src/commands/calls/list.ts @@ -11,7 +11,7 @@ import { export default class CallsList extends BaseCommand { static override description = - 'List one page of stored call records, newest first. Requires sessions:read and a server credential. Project tokens read only their original owning project. Reuse the same filters with --cursor.' + 'List one page of stored call records, newest first. Requires connections:read and a server credential. Project tokens read only their original owning project. Reuse the same filters with --cursor.' static override examples = [ '<%= config.bin %> calls list --outcome missed --limit 25', '<%= config.bin %> calls list --project PROJECT_ID --json', diff --git a/src/commands/calls/media.ts b/src/commands/calls/media.ts index 2bf38f99..d97cd27b 100644 --- a/src/commands/calls/media.ts +++ b/src/commands/calls/media.ts @@ -31,9 +31,9 @@ export default class CallsMedia extends BaseCommand { ].join(' ') static override examples = [ - '<%= config.bin %> calls media --session support --output call.pcm', - '<%= config.bin %> calls media --session support --place +15550100 --input prompt.pcm --leave-on-eof --output reply.pcm', - 'sox in.wav -t raw -r 16000 -e signed -b 16 -c 1 - | <%= config.bin %> calls media call_123 --session support --input - --exclusive > out.pcm', + '<%= config.bin %> calls media --connection support --output call.pcm', + '<%= config.bin %> calls media --connection support --place +15550100 --input prompt.pcm --leave-on-eof --output reply.pcm', + 'sox in.wav -t raw -r 16000 -e signed -b 16 -c 1 - | <%= config.bin %> calls media call_123 --connection support --input - --exclusive > out.pcm', ] static override flags = { @@ -65,9 +65,9 @@ export default class CallsMedia extends BaseCommand { description: 'Place a call to this E.164 number or user ID instead of answering one.', }), - session: Flags.string({ + connection: Flags.string({ description: - 'Session of the call. Required with a server API key; client tokens use their bound session.', + 'Connection of the call. Required with a server API key; client tokens use their bound connection.', }), video: Flags.boolean({ allowNo: true, @@ -181,11 +181,11 @@ export default class CallsMedia extends BaseCommand { output, participant: flags.participant, place: flags.place, - session: flags.session, + connection: flags.connection, signal: halt.signal, video: flags.video, }, - (status) => report(status, renderMediaStatus(status, flags.session)), + (status) => report(status, renderMediaStatus(status, flags.connection)), ) await closeOutput() if (fileError !== undefined) throw outputFailed(flags.output, fileError) @@ -210,14 +210,14 @@ export default class CallsMedia extends BaseCommand { function renderMediaStatus( status: CallMediaStatus, - session: string | undefined, + connection: string | undefined, ): string { switch (status.type) { case 'ready': - return `${renderCallsStatus(status, session)} Waiting for the call.` + return `${renderCallsStatus(status, connection)} Waiting for the call.` case 'disconnected': case 'notice': - return renderCallsStatus(status, session) + return renderCallsStatus(status, connection) case 'connected': return `Connected to call ${status.callId} as connection ${status.connectionId} at ${status.sampleRate} Hz.` case 'placed': diff --git a/src/commands/calls/permission/get.ts b/src/commands/calls/permission/get.ts index 7ea408be..f7490f5d 100644 --- a/src/commands/calls/permission/get.ts +++ b/src/commands/calls/permission/get.ts @@ -15,16 +15,16 @@ export default class CallsPermissionGet extends BaseCommand { } static override description = - 'Show whether a person allows a Cloud API number to call them: none, temporary (until expiresAt), permanent, or revoked. WhatsApp is asked on every request, and the answer includes its limits on permission requests and calls. When WhatsApp cannot be reached, the stored state is shown with fresh false. Linked-device numbers fail with unsupported_for_connection (exit code 4). Requires a server API key.' + 'Show whether a person allows a Cloud API Connection to call them: none, temporary (until expiresAt), permanent, or revoked. WhatsApp is asked on every request, and the answer includes its limits on permission requests and calls. When WhatsApp cannot be reached, the stored state is shown with fresh false. Linked-device connections fail with unsupported_for_connection (exit code 4). Requires a server API key.' static override examples = [ - '<%= config.bin %> calls permission get +14155550123 --session support', - '<%= config.bin %> calls permission get +14155550123 --session support --json', + '<%= config.bin %> calls permission get +14155550123 --connection support', + '<%= config.bin %> calls permission get +14155550123 --connection support --json', ] static override flags = { - session: Flags.string({ - description: 'Cloud API session (number) that would call.', + connection: Flags.string({ + description: 'Cloud API connection that would call.', required: true, }), } @@ -35,7 +35,7 @@ export default class CallsPermissionGet extends BaseCommand { const {args, flags} = await this.parse(CallsPermissionGet) const result = await viewCallPermission( await this.messagingClient(flags, {serverApiKeyOnly: 'Call permission'}), - flags.session, + flags.connection, args.to, ) this.writeValue(result, renderCallPermission(result.data), flags) diff --git a/src/commands/calls/permission/request.ts b/src/commands/calls/permission/request.ts index efaf8c63..b2bd7cfc 100644 --- a/src/commands/calls/permission/request.ts +++ b/src/commands/calls/permission/request.ts @@ -12,10 +12,10 @@ export default class CallsPermissionRequest extends BaseCommand { } static override description = - 'Send a message that asks a person for permission to call them from a Cloud API number. WhatsApp shows --body above its allow and decline buttons, and the reply arrives as a call.permission_changed event. WhatsApp limits how often a number can ask the same person; when the limit is reached the command fails with call_permission_request_limited (exit code 5) and prints the Retry-After wait when WhatsApp gives one. A person who already granted permanent permission fails with call_permission_granted, and linked-device numbers with unsupported_for_connection (exit code 4).' + 'Send a message that asks a person for permission to call them from a Cloud API Connection. WhatsApp shows --body above its allow and decline buttons, and the reply arrives as a call.permission_changed event. WhatsApp limits how often a number can ask the same person; when the limit is reached the command fails with call_permission_request_limited (exit code 5) and prints the Retry-After wait when WhatsApp gives one. A person who already granted permanent permission fails with call_permission_granted, and linked-device connections with unsupported_for_connection (exit code 4).' static override examples = [ - '<%= config.bin %> calls permission request +14155550123 --session support --body "We would like to call you about your order."', + '<%= config.bin %> calls permission request +14155550123 --connection support --body "We would like to call you about your order."', ] static override flags = { @@ -26,8 +26,8 @@ export default class CallsPermissionRequest extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this send operation.', }), - session: Flags.string({ - description: 'Cloud API session (number) that asks.', + connection: Flags.string({ + description: 'Cloud API connection that asks.', required: true, }), } @@ -38,7 +38,7 @@ export default class CallsPermissionRequest extends BaseCommand { const {args, flags} = await this.parse(CallsPermissionRequest) const result = await requestCallPermission( await this.messagingClient(flags), - flags.session, + flags.connection, args.to, flags.body, flags['idempotency-key'] === undefined diff --git a/src/commands/calls/place-group.ts b/src/commands/calls/place-group.ts index 6dae6da8..f8ceb86d 100644 --- a/src/commands/calls/place-group.ts +++ b/src/commands/calls/place-group.ts @@ -7,10 +7,10 @@ import CallsPlace from './place.js' export default class CallsPlaceGroup extends BaseCommand { static override description = - 'Place one WhatsApp group call by public group ID or to 2 to 31 distinct recipients from a Linked Device number. Each recipient must pass the number’s calling restrictions and your team’s destination policy. Cloud API numbers refuse this operation.' + 'Place one WhatsApp group call by public group ID or to 2 to 31 distinct recipients from a Linked Device Connection. Each recipient must pass the Connection’s calling restrictions and your team’s destination policy. Cloud API connections refuse this operation.' static override examples = [ - '<%= config.bin %> calls place-group --to +15550100 --to +15550101 --session support', - '<%= config.bin %> calls place-group --group-id 9007199254740996 --session support', + '<%= config.bin %> calls place-group --to +15550100 --to +15550101 --connection support', + '<%= config.bin %> calls place-group --group-id 9007199254740996 --connection support', ] static override flags = { ...CallsPlace.flags, @@ -37,7 +37,7 @@ export default class CallsPlaceGroup extends BaseCommand { { to: flags.to, groupId: flags['group-id'], - session: flags.session, + connection: flags.connection, video: flags.video, exclusive: flags.exclusive, participant: flags.participant, diff --git a/src/commands/calls/place.ts b/src/commands/calls/place.ts index a0468ba7..f138553c 100644 --- a/src/commands/calls/place.ts +++ b/src/commands/calls/place.ts @@ -13,11 +13,11 @@ export default class CallsPlace extends BaseCommand { } static override description = - 'Place a WhatsApp call from a session. The placing participant owns the call. Server API keys name the session with --session; client tokens place from the session they are bound to. While WhatsApp restricts the number to people it has already chatted with, a call to anyone else exits with code 3 and number_restricted.' + 'Place a WhatsApp call from a connection. The placing participant owns the call. Server API keys name the connection with --connection; client tokens place from the connection they are bound to. While WhatsApp restricts the Connection to people it has already chatted with, a call to anyone else exits with code 3 and connection_restricted.' static override examples = [ - '<%= config.bin %> calls place +15550100 --session support', - '<%= config.bin %> calls place +15550100 --session support --video --exclusive --participant agent-7 --json', + '<%= config.bin %> calls place +15550100 --connection support', + '<%= config.bin %> calls place +15550100 --connection support --video --exclusive --participant agent-7 --json', ] static override flags = { @@ -29,9 +29,9 @@ export default class CallsPlace extends BaseCommand { description: 'Server API keys only: participant that places the call (default "default").', }), - session: Flags.string({ + connection: Flags.string({ description: - 'Session that places the call. Required with a server API key.', + 'Connection that places the call. Required with a server API key.', }), video: Flags.boolean({description: 'Place a video call.'}), } @@ -47,7 +47,7 @@ export default class CallsPlace extends BaseCommand { { exclusive: flags.exclusive, participant: flags.participant, - session: flags.session, + connection: flags.connection, to: args.to, video: flags.video, }, diff --git a/src/commands/calls/reject.ts b/src/commands/calls/reject.ts index 3c2321c2..401d643d 100644 --- a/src/commands/calls/reject.ts +++ b/src/commands/calls/reject.ts @@ -10,7 +10,7 @@ export default class CallsReject extends BaseCommand { } static override description = - 'Decline a ringing call through the unified Calls API. Declining ends the call for every participant. Exits with code 4 when the call is no longer ringing (call_not_ringing). To reject a call through the Linked Device session route with the caller ID, use call reject.' + 'Decline a ringing call through the unified Calls API. Declining ends the call for every participant. Exits with code 4 when the call is no longer ringing (call_not_ringing). To reject a call through the Linked Device connection route with the caller ID, use call reject.' static override examples = [ '<%= config.bin %> calls reject call_123', diff --git a/src/commands/calls/retention/get.ts b/src/commands/calls/retention/get.ts index cb9036f4..2057c4c7 100644 --- a/src/commands/calls/retention/get.ts +++ b/src/commands/calls/retention/get.ts @@ -7,7 +7,7 @@ import { export default class CallsRetentionGet extends BaseCommand { static override description = - 'Read how long Polymorfa keeps your team’s call data from the Platform API. Deletion of call data older than the period starts on a date Polymorfa announces in its changelog; until then the setting records a choice and nothing is deleted. Teams without a saved setting return the default (extended, 90 days) at revision 0. Pass the revision to `calls retention set --expected-revision` so a change cannot overwrite another one. Requires a team API key or a project token with the sessions:read scope; client tokens are refused.' + 'Read how long Polymorfa keeps your team’s call data from the Platform API. Deletion of call data older than the period starts on a date Polymorfa announces in its changelog; until then the setting records a choice and nothing is deleted. Teams without a saved setting return the default (extended, 90 days) at revision 0. Pass the revision to `calls retention set --expected-revision` so a change cannot overwrite another one. Requires a team API key or a project token with the connections:read scope; client tokens are refused.' static override examples = ['<%= config.bin %> calls retention get'] diff --git a/src/commands/calls/retention/set.ts b/src/commands/calls/retention/set.ts index 525e661a..06f093e1 100644 --- a/src/commands/calls/retention/set.ts +++ b/src/commands/calls/retention/set.ts @@ -15,7 +15,7 @@ import { } from '../../../services/calls.js' export default class CallsRetentionSet extends BaseCommand { - static override description = `Change how long Polymorfa keeps your team’s call data through the Platform API. --policy short, standard, extended, or compliance keeps call data for 7, 30, 90, or 365 days; --policy custom keeps it for --days (${MIN_CALL_RETENTION_DAYS} to ${MAX_CALL_RETENTION_DAYS}). Deletion of call data older than the period starts on a date Polymorfa announces in its changelog; until then saving a period deletes nothing. Once deletion runs, a shorter period also applies to call data already stored, and deleted call data cannot be recovered, so the command asks you to confirm a shorter period; pass --yes to confirm without a prompt (required when standard input or error is not a terminal). --expected-revision is required: the command reads the setting first and changes it only if it still has that revision (see \`calls retention get\`); otherwise it fails with state_conflict (exit code 4) and changes nothing. Requires a team API key with the sessions:read and sessions:manage scopes, because the command reads the setting before it changes it; the API refuses project tokens (exit code 3).` + static override description = `Change how long Polymorfa keeps your team’s call data through the Platform API. --policy short, standard, extended, or compliance keeps call data for 7, 30, 90, or 365 days; --policy custom keeps it for --days (${MIN_CALL_RETENTION_DAYS} to ${MAX_CALL_RETENTION_DAYS}). Deletion of call data older than the period starts on a date Polymorfa announces in its changelog; until then saving a period deletes nothing. Once deletion runs, a shorter period also applies to call data already stored, and deleted call data cannot be recovered, so the command asks you to confirm a shorter period; pass --yes to confirm without a prompt (required when standard input or error is not a terminal). --expected-revision is required: the command reads the setting first and changes it only if it still has that revision (see \`calls retention get\`); otherwise it fails with state_conflict (exit code 4) and changes nothing. Requires a team API key with the connections:read and connections:manage scopes, because the command reads the setting before it changes it; the API refuses project tokens (exit code 3).` static override examples = [ '<%= config.bin %> calls retention set --policy compliance --expected-revision 0', diff --git a/src/commands/calls/settings/get.ts b/src/commands/calls/settings/get.ts index dda62d06..47983080 100644 --- a/src/commands/calls/settings/get.ts +++ b/src/commands/calls/settings/get.ts @@ -6,27 +6,27 @@ import {renderCallSettings, viewCallSettings} from '../../../services/calls.js' export default class CallsSettingsGet extends BaseCommand { static override description = - 'Read a session’s call settings from the Platform API. Sessions without saved settings return the defaults at revision 0. Pass the revision to `calls settings set --expected-revision` so a change cannot overwrite another one. After simultaneous calls are turned off, it also prints when the Ban Insurance exclusion ends (simultaneousCallsCoverageExcludedUntil), until that time passes. Ban Insurance excludes a ban when simultaneous calls were on during the 30 days before it; this timestamp is the cutoff for a new ban from that period. No end is printed while simultaneous calls are on, and a missing end does not mean the number is covered. Requires a server API key.' + 'Read a connection’s call settings from the Platform API. Connections without saved settings return the defaults at revision 0. Pass the revision to `calls settings set --expected-revision` so a change cannot overwrite another one. After simultaneous calls are turned off, it also prints when the Ban Insurance exclusion ends (simultaneousCallsCoverageExcludedUntil), until that time passes. Ban Insurance excludes a ban when simultaneous calls were on during the 30 days before it; this timestamp is the cutoff for a new ban from that period. No end is printed while simultaneous calls are on, and a missing end does not mean the number is covered. Requires a server API key.' static override examples = [ - '<%= config.bin %> calls settings get --session support', + '<%= config.bin %> calls settings get --connection support', ] static override flags = { - session: Flags.string({description: 'Session ID.', required: true}), + connection: Flags.string({description: 'Connection ID.', required: true}), } - static override summary = 'Read session call settings.' + static override summary = 'Read connection call settings.' async run(): Promise<void> { const {flags} = await this.parse(CallsSettingsGet) const result = await viewCallSettings( createCallSettingsClient(await this.platformEnvironment(flags)), - flags.session, + flags.connection, ) this.writeValue( result, - renderCallSettings(flags.session, result.data), + renderCallSettings(flags.connection, result.data), flags, ) } diff --git a/src/commands/calls/settings/set.ts b/src/commands/calls/settings/set.ts index 6c8d90b9..50e6ea1b 100644 --- a/src/commands/calls/settings/set.ts +++ b/src/commands/calls/settings/set.ts @@ -9,25 +9,25 @@ import { export default class CallsSettingsSet extends BaseCommand { static override description = - 'Change a session’s call settings through the Platform API. Settings you do not pass keep their current values; --inbound-route sip_trunk without --sip-trunk keeps the stored trunk. --calls-enabled=false turns calling off for the session: placing, answering and joining calls fail, incoming calls are declined and SIP trunks cannot call through it, while calls in progress continue. --expected-revision applies the change only if the settings still have that revision (see `calls settings get`); otherwise the command fails with state_conflict (exit code 4) and changes nothing. --conference-mode (on by default) lets every participant you connect to a call (apps, bots and SIP trunk callers) hear the WhatsApp party and each other; --no-conference-mode lets each hear only the WhatsApp party. The WhatsApp party always hears all of your participants, and nobody hears their own audio. --inbound-route sip_trunk also sends incoming calls to --sip-trunk, and --sip-claim controls whether the trunk’s answer claims the call. --host-cloud-api-calls=true has Polymorfa Calls answer a Cloud API session’s incoming calls instead of your Graph API integration. --simultaneous-calls=true lets a linked-device number hold any number of calls at once (incoming, placed and campaign calls); Cloud API numbers ignore it. WhatsApp’s own apps never hold two calls at once, and while it is on, and for 30 days after you turn it off, Ban Insurance does not cover a ban of the number. Turning it on therefore requires --acknowledge-risk, and the command exits with code 2 without changing anything when that flag is missing. After --simultaneous-calls=false, the output shows when the Ban Insurance exclusion ends, from the server’s response. Only a team API key can turn it on; --simultaneous-calls=false needs no acknowledgment. Requires a server API key.' + 'Change a connection’s call settings through the Platform API. Settings you do not pass keep their current values; --inbound-route sip_trunk without --sip-trunk keeps the stored trunk. --calls-enabled=false turns calling off for the connection: placing, answering and joining calls fail, incoming calls are declined and SIP trunks cannot call through it, while calls in progress continue. --expected-revision applies the change only if the settings still have that revision (see `calls settings get`); otherwise the command fails with state_conflict (exit code 4) and changes nothing. --conference-mode (on by default) lets every participant you connect to a call (apps, bots and SIP trunk callers) hear the WhatsApp party and each other; --no-conference-mode lets each hear only the WhatsApp party. The WhatsApp party always hears all of your participants, and nobody hears their own audio. --inbound-route sip_trunk also sends incoming calls to --sip-trunk, and --sip-claim controls whether the trunk’s answer claims the call. --host-cloud-api-calls=true has Polymorfa Calls answer a Cloud API connection’s incoming calls instead of your Graph API integration. --simultaneous-calls=true lets a linked-device Connection hold any number of calls at once (incoming, placed and campaign calls); Cloud API connections ignore it. WhatsApp’s own apps never hold two calls at once, and while it is on, and for 30 days after you turn it off, Ban Insurance does not cover a ban of the number. Turning it on therefore requires --acknowledge-risk, and the command exits with code 2 without changing anything when that flag is missing. After --simultaneous-calls=false, the output shows when the Ban Insurance exclusion ends, from the server’s response. Only a team API key can turn it on; --simultaneous-calls=false needs no acknowledgment. Requires a server API key.' static override examples = [ - '<%= config.bin %> calls settings set --session support --calls-enabled=false', - '<%= config.bin %> calls settings set --session support --no-conference-mode', - '<%= config.bin %> calls settings set --session support --calls-enabled=false --expected-revision 3', - '<%= config.bin %> calls settings set --session support --inbound-route sip_trunk --sip-trunk 6f1c2f0e-1d5b-4d8e-9a55-0d4b8a6c1f10', - '<%= config.bin %> calls settings set --session support --inbound-route clients', - '<%= config.bin %> calls settings set --session support --simultaneous-calls=true --acknowledge-risk', - '<%= config.bin %> calls settings set --session support --simultaneous-calls=false', + '<%= config.bin %> calls settings set --connection support --calls-enabled=false', + '<%= config.bin %> calls settings set --connection support --no-conference-mode', + '<%= config.bin %> calls settings set --connection support --calls-enabled=false --expected-revision 3', + '<%= config.bin %> calls settings set --connection support --inbound-route sip_trunk --sip-trunk 6f1c2f0e-1d5b-4d8e-9a55-0d4b8a6c1f10', + '<%= config.bin %> calls settings set --connection support --inbound-route clients', + '<%= config.bin %> calls settings set --connection support --simultaneous-calls=true --acknowledge-risk', + '<%= config.bin %> calls settings set --connection support --simultaneous-calls=false', ] static override flags = { 'acknowledge-risk': Flags.boolean({ description: - 'Confirm that turning simultaneous calls on removes Ban Insurance cover for the number. Required with --simultaneous-calls=true.', + 'Confirm that turning simultaneous calls on removes Ban Insurance cover for the Connection. Required with --simultaneous-calls=true.', }), 'calls-enabled': Flags.string({ - description: 'Allow calls on the session (false turns calling off).', + description: 'Allow calls on the connection (false turns calling off).', options: ['true', 'false'], }), 'conference-mode': Flags.boolean({ @@ -42,7 +42,7 @@ export default class CallsSettingsSet extends BaseCommand { }), 'host-cloud-api-calls': Flags.string({ description: - 'On a Cloud API session, answer incoming calls with Polymorfa Calls (false leaves them to your Graph API integration).', + 'On a Cloud API connection, answer incoming calls with Polymorfa Calls (false leaves them to your Graph API integration).', options: ['true', 'false'], }), 'inbound-route': Flags.string({ @@ -50,7 +50,7 @@ export default class CallsSettingsSet extends BaseCommand { 'Where incoming calls ring: clients, or sip_trunk to also send them to a SIP trunk.', options: ['clients', 'sip_trunk'], }), - session: Flags.string({description: 'Session ID.', required: true}), + connection: Flags.string({description: 'Connection ID.', required: true}), 'sip-claim': Flags.string({ description: 'Whether an answer from the SIP trunk claims the call and stops other clients ringing.', @@ -58,7 +58,7 @@ export default class CallsSettingsSet extends BaseCommand { }), 'simultaneous-calls': Flags.string({ description: - 'Let a linked-device number hold any number of calls at once (true requires --acknowledge-risk; false turns it off).', + 'Let a linked-device Connection hold any number of calls at once (true requires --acknowledge-risk; false turns it off).', options: ['true', 'false'], }), 'sip-trunk': Flags.string({ @@ -66,13 +66,13 @@ export default class CallsSettingsSet extends BaseCommand { }), } - static override summary = 'Change session call settings.' + static override summary = 'Change connection call settings.' async run(): Promise<void> { const {flags} = await this.parse(CallsSettingsSet) const result = await updateCallSettings( createCallSettingsClient(await this.platformEnvironment(flags)), - flags.session, + flags.connection, { ...(flags['calls-enabled'] === undefined ? {} @@ -105,7 +105,7 @@ export default class CallsSettingsSet extends BaseCommand { ) this.writeValue( result, - renderCallSettings(flags.session, result.data), + renderCallSettings(flags.connection, result.data), flags, ) } diff --git a/src/commands/calls/stats.ts b/src/commands/calls/stats.ts index f40d1eef..dca470a3 100644 --- a/src/commands/calls/stats.ts +++ b/src/commands/calls/stats.ts @@ -13,15 +13,15 @@ import { } from '../../services/call-analytics.js' export default class CallsStats extends BaseCommand { - static override description = `Summarize calls: counts by outcome, answer rate, and connected time, grouped by day, hour, session, or outcome. + static override description = `Summarize calls: counts by outcome, answer rate, and connected time, grouped by day, hour, connection, or outcome. The range defaults to the last 7 days. --group-by day covers at most 366 days and --group-by hour at most 31. Day and hour buckets, and the heatmap, use --timezone (UTC by default). -Pass --project to read one project. Without it, an organization API key reads every project in the organization. A project token reads only its own project and requires --project. Credentials need the sessions:read scope.` +Pass --project to read one project. Without it, an organization API key reads every project in the organization. A project token reads only its own project and requires --project. Credentials need the connections:read scope.` static override examples = [ '<%= config.bin %> calls stats', - '<%= config.bin %> calls stats --project 018f0000-0000-7000-8000-000000000002 --group-by session', + '<%= config.bin %> calls stats --project 018f0000-0000-7000-8000-000000000002 --group-by connection', '<%= config.bin %> calls stats --since 2026-09-01T00:00:00Z --until 2026-09-02T00:00:00Z --group-by hour --timezone Europe/Lisbon', '<%= config.bin %> calls stats --direction inbound --outcome missed --heatmap', '<%= config.bin %> calls stats --json', @@ -31,7 +31,7 @@ Pass --project to read one project. Without it, an organization API key reads ev ...callFilterFlags, 'group-by': Flags.string({ default: 'day', - description: 'Group the results by day, hour, session, or outcome.', + description: 'Group the results by day, hour, connection, or outcome.', options: [...CALL_STATS_GROUP_BY], }), heatmap: Flags.boolean({ @@ -52,7 +52,7 @@ Pass --project to read one project. Without it, an organization API key reads ev direction: flags.direction, groupBy: flags['group-by'] as CallStatsGroupBy, outcome: flags.outcome, - session: flags.session, + connection: flags.connection, since: flags.since, timezone: flags.timezone, until: flags.until, diff --git a/src/commands/calls/view.ts b/src/commands/calls/view.ts index 6238b486..29e10625 100644 --- a/src/commands/calls/view.ts +++ b/src/commands/calls/view.ts @@ -9,7 +9,7 @@ import { export default class CallsView extends BaseCommand { static override description = - 'Read one stored call and its bounded metadata history. Requires sessions:read and a server credential. Use --json for participants, connections and reported diagnostics. No audio, video, event payload or webhook delivery data is returned.' + 'Read one stored call and its bounded metadata history. Requires connections:read and a server credential. Use --json for participants, connections and reported diagnostics. No audio, video, event payload or webhook delivery data is returned.' static override args = { id: Args.string({required: true, description: 'Call ID from calls list.'}), } diff --git a/src/commands/calls/watch.ts b/src/commands/calls/watch.ts index 4bcd1bbe..b2d574f8 100644 --- a/src/commands/calls/watch.ts +++ b/src/commands/calls/watch.ts @@ -14,11 +14,11 @@ import { export default class CallsWatch extends BaseCommand { static override description = - 'Stream a session’s inbound calls and their progress: ringing, claims, state and participant changes, and endings. Watching never answers or declines a call. With --json, each line is one JSON object. Press Ctrl-C to stop. Exits with code 3 when the API stops authorizing the credential.' + 'Stream a connection’s inbound calls and their progress: ringing, claims, state and participant changes, and endings. Watching never answers or declines a call. With --json, each line is one JSON object. Press Ctrl-C to stop. Exits with code 3 when the API stops authorizing the credential.' static override examples = [ - '<%= config.bin %> calls watch --session support', - '<%= config.bin %> calls watch --session support --participant agent-7 --json', + '<%= config.bin %> calls watch --connection support', + '<%= config.bin %> calls watch --connection support --participant agent-7 --json', 'POLYMORFA_CLIENT_TOKEN=... <%= config.bin %> calls watch --count 1 --json', ] @@ -31,13 +31,13 @@ export default class CallsWatch extends BaseCommand { description: 'Server API keys only: participant that watches (default "default").', }), - session: Flags.string({ + connection: Flags.string({ description: - 'Session to watch. Required with a server API key; client tokens watch their bound session.', + 'Connection to watch. Required with a server API key; client tokens watch their bound connection.', }), } - static override summary = 'Stream call updates for a session.' + static override summary = 'Stream call updates for a connection.' async run(): Promise<void> { const {flags} = await this.parse(CallsWatch) @@ -53,7 +53,7 @@ export default class CallsWatch extends BaseCommand { const status = (value: CallsStatus): void => { if (mode === 'json') line(value, '') else if (mode === 'human') { - process.stderr.write(`${renderCallsStatus(value, flags.session)}\n`) + process.stderr.write(`${renderCallsStatus(value, flags.connection)}\n`) } } @@ -65,7 +65,7 @@ export default class CallsWatch extends BaseCommand { count: flags.count, credential: environment.credential, participant: flags.participant, - session: flags.session, + connection: flags.connection, signal: stop.signal, }, { diff --git a/src/commands/campaign/create.ts b/src/commands/campaign/create.ts index 1c219e84..dcad8c0b 100644 --- a/src/commands/campaign/create.ts +++ b/src/commands/campaign/create.ts @@ -21,7 +21,7 @@ export default class CampaignCreate extends BaseCommand { For Messaging campaigns (--project-slug), A/B tests and weighted message variation are betas that require team enrollment and live feature access; a team without access gets 403 feature_unavailable: - A/B test: "variants" (two to four, each with key, label, integer weight from 1 to 99 and blueprint; weights add up to 100) and "variantStrategy" (winnerCriterion delivery, read or reply; holdoutPercent; optional testSlicePercent; autoPromote true; testWindowMinutes). View the results with polymorfa campaign analytics. -- Weighted message variation: "messageVariations", two to five alternatives (key, integer weight from 1 to 99, blueprint; weights add up to 100). Each recipient receives one alternative. Linked-device numbers only. +- Weighted message variation: "messageVariations", two to five alternatives (key, integer weight from 1 to 99, blueprint; weights add up to 100). Each recipient receives one alternative. Linked-device connections only. An A/B test cannot use templateId. messageVariations cannot be combined with templateId, composed messages or an A/B test.` diff --git a/src/commands/channel/create.ts b/src/commands/channel/create.ts index 301c0cb2..4dc19068 100644 --- a/src/commands/channel/create.ts +++ b/src/commands/channel/create.ts @@ -12,8 +12,8 @@ export default class ChannelCreate extends BaseCommand { description: 'Safely identify retries of this channel creation.', }), name: Flags.string({description: 'Channel name.', required: true}), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -22,7 +22,7 @@ export default class ChannelCreate extends BaseCommand { const {flags} = await this.parse(ChannelCreate) const result = await createChannel( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, { name: flags.name, ...(flags.description === undefined diff --git a/src/commands/channel/delete.ts b/src/commands/channel/delete.ts index 93ba8b23..83ea14c0 100644 --- a/src/commands/channel/delete.ts +++ b/src/commands/channel/delete.ts @@ -14,8 +14,8 @@ export default class ChannelDelete extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this channel deletion.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), yes: Flags.boolean({ @@ -28,7 +28,7 @@ export default class ChannelDelete extends BaseCommand { const {args, flags} = await this.parse(ChannelDelete) const result = await deleteChannel( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, args.channel, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/channel/follow.ts b/src/commands/channel/follow.ts index 080327f8..65afa4a9 100644 --- a/src/commands/channel/follow.ts +++ b/src/commands/channel/follow.ts @@ -12,8 +12,8 @@ export default class ChannelFollow extends BaseCommand { static override flags = { 'idempotency-key': Flags.string({description: 'Safely identify retries.'}), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -22,7 +22,7 @@ export default class ChannelFollow extends BaseCommand { const {args, flags} = await this.parse(ChannelFollow) const result = await followChannel( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, args.channel, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/channel/list.ts b/src/commands/channel/list.ts index 26a76873..f3d825e1 100644 --- a/src/commands/channel/list.ts +++ b/src/commands/channel/list.ts @@ -4,11 +4,11 @@ import {BaseCommand} from '../../base-command.js' import {listChannels, renderChannels} from '../../services/channels.js' export default class ChannelList extends BaseCommand { - static override description = 'List channels for a connected session.' + static override description = 'List channels for a connected connection.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -17,7 +17,7 @@ export default class ChannelList extends BaseCommand { const {flags} = await this.parse(ChannelList) const result = await listChannels( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, ) this.writeValue(result, renderChannels(result.data), flags) } diff --git a/src/commands/channel/live-updates/subscribe.ts b/src/commands/channel/live-updates/subscribe.ts index 28af8903..a642fed9 100644 --- a/src/commands/channel/live-updates/subscribe.ts +++ b/src/commands/channel/live-updates/subscribe.ts @@ -15,8 +15,8 @@ export default class ChannelLiveUpdatesSubscribe extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this subscription request.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -25,7 +25,7 @@ export default class ChannelLiveUpdatesSubscribe extends BaseCommand { const {args, flags} = await this.parse(ChannelLiveUpdatesSubscribe) const result = await subscribeToChannelLiveUpdates( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, args.channel, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/channel/message/list.ts b/src/commands/channel/message/list.ts index 876f75c3..98395dfc 100644 --- a/src/commands/channel/message/list.ts +++ b/src/commands/channel/message/list.ts @@ -23,8 +23,8 @@ export default class ChannelMessageList extends BaseCommand { max: 100, min: 1, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -33,7 +33,7 @@ export default class ChannelMessageList extends BaseCommand { const {args, flags} = await this.parse(ChannelMessageList) const result = await listChannelMessages( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, args.channel, { ...(flags.limit === undefined ? {} : {count: flags.limit}), diff --git a/src/commands/channel/message/mark-viewed.ts b/src/commands/channel/message/mark-viewed.ts index ceedb67f..96b5b991 100644 --- a/src/commands/channel/message/mark-viewed.ts +++ b/src/commands/channel/message/mark-viewed.ts @@ -18,8 +18,8 @@ export default class ChannelMessageMarkViewed extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this viewed action.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -28,7 +28,7 @@ export default class ChannelMessageMarkViewed extends BaseCommand { const {args, flags} = await this.parse(ChannelMessageMarkViewed) const result = await markChannelMessageViewed( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, args.channel, args['message-id'], flags['idempotency-key'] === undefined diff --git a/src/commands/channel/message/react.ts b/src/commands/channel/message/react.ts index 8d725018..1d2d9ad4 100644 --- a/src/commands/channel/message/react.ts +++ b/src/commands/channel/message/react.ts @@ -25,8 +25,8 @@ export default class ChannelMessageReact extends BaseCommand { description: 'Reaction text, at most 32 UTF-8 bytes; empty removes it.', required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -35,7 +35,7 @@ export default class ChannelMessageReact extends BaseCommand { const {args, flags} = await this.parse(ChannelMessageReact) const result = await reactToChannelMessage( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, args.channel, args['message-id'], flags.reaction, diff --git a/src/commands/channel/message/updates.ts b/src/commands/channel/message/updates.ts index 873951cf..598f778c 100644 --- a/src/commands/channel/message/updates.ts +++ b/src/commands/channel/message/updates.ts @@ -24,8 +24,8 @@ export default class ChannelMessageUpdates extends BaseCommand { max: 100, min: 1, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), since: Flags.integer({ @@ -39,7 +39,7 @@ export default class ChannelMessageUpdates extends BaseCommand { const {args, flags} = await this.parse(ChannelMessageUpdates) const result = await listChannelMessageUpdates( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, args.channel, { ...(flags.limit === undefined ? {} : {count: flags.limit}), diff --git a/src/commands/channel/mute.ts b/src/commands/channel/mute.ts index 544792d8..3f101974 100644 --- a/src/commands/channel/mute.ts +++ b/src/commands/channel/mute.ts @@ -12,8 +12,8 @@ export default class ChannelMute extends BaseCommand { static override flags = { 'idempotency-key': Flags.string({description: 'Safely identify retries.'}), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -22,7 +22,7 @@ export default class ChannelMute extends BaseCommand { const {args, flags} = await this.parse(ChannelMute) const result = await muteChannel( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, args.channel, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/channel/unfollow.ts b/src/commands/channel/unfollow.ts index ccf693f2..a52b48a2 100644 --- a/src/commands/channel/unfollow.ts +++ b/src/commands/channel/unfollow.ts @@ -12,8 +12,8 @@ export default class ChannelUnfollow extends BaseCommand { static override flags = { 'idempotency-key': Flags.string({description: 'Safely identify retries.'}), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -22,7 +22,7 @@ export default class ChannelUnfollow extends BaseCommand { const {args, flags} = await this.parse(ChannelUnfollow) const result = await unfollowChannel( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, args.channel, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/channel/unmute.ts b/src/commands/channel/unmute.ts index 53b5677b..f8ef7f79 100644 --- a/src/commands/channel/unmute.ts +++ b/src/commands/channel/unmute.ts @@ -12,8 +12,8 @@ export default class ChannelUnmute extends BaseCommand { static override flags = { 'idempotency-key': Flags.string({description: 'Safely identify retries.'}), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -22,7 +22,7 @@ export default class ChannelUnmute extends BaseCommand { const {args, flags} = await this.parse(ChannelUnmute) const result = await unmuteChannel( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, args.channel, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/channel/view.ts b/src/commands/channel/view.ts index b0668cd9..4f5fb1f1 100644 --- a/src/commands/channel/view.ts +++ b/src/commands/channel/view.ts @@ -11,8 +11,8 @@ export default class ChannelView extends BaseCommand { static override description = 'View one channel.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -21,7 +21,7 @@ export default class ChannelView extends BaseCommand { const {args, flags} = await this.parse(ChannelView) const result = await viewChannel( await this.messagingClient(flags, {serverApiKeyOnly: 'Channel'}), - flags.session, + flags.connection, args.channel, ) this.writeValue(result, renderChannel(result.data), flags) diff --git a/src/commands/chat/list.ts b/src/commands/chat/list.ts index c965c99c..89f71d84 100644 --- a/src/commands/chat/list.ts +++ b/src/commands/chat/list.ts @@ -5,11 +5,11 @@ import {listHistoryChats, renderHistoryChats} from '../../services/history.js' export default class ChatList extends BaseCommand { static override description = - 'List stored chats for an enrolled HMS Number (beta). Requires chats:read.' + 'List stored chats for an enrolled HMS Connection (beta). Requires chats:read.' static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), limit: Flags.integer({ @@ -36,7 +36,7 @@ export default class ChatList extends BaseCommand { const {flags} = await this.parse(ChatList) const result = await listHistoryChats( await this.historyMessagingClient(flags), - flags.session, + flags.connection, { ...(flags.limit === undefined ? {} : {limit: flags.limit}), ...(flags.cursor === undefined ? {} : {cursor: flags.cursor}), diff --git a/src/commands/chat/message/list.ts b/src/commands/chat/message/list.ts index a2eac87e..a12d0153 100644 --- a/src/commands/chat/message/list.ts +++ b/src/commands/chat/message/list.ts @@ -15,11 +15,11 @@ export default class ChatMessageList extends BaseCommand { } static override description = - 'List stored messages in a chat for an enrolled HMS Number (beta). Requires messages:read.' + 'List stored messages in a chat for an enrolled HMS Connection (beta). Requires messages:read.' static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), limit: Flags.integer({ @@ -52,7 +52,7 @@ export default class ChatMessageList extends BaseCommand { const {args, flags} = await this.parse(ChatMessageList) const result = await listHistoryMessages( await this.historyMessagingClient(flags), - flags.session, + flags.connection, args.conversation, { ...(flags.limit === undefined ? {} : {limit: flags.limit}), diff --git a/src/commands/chat/message/media.ts b/src/commands/chat/message/media.ts index 99236827..a1130362 100644 --- a/src/commands/chat/message/media.ts +++ b/src/commands/chat/message/media.ts @@ -20,15 +20,15 @@ export default class ChatMessageMedia extends BaseCommand { } static override description = - 'Download a stored Official API message media copy for an enrolled HMS Number (beta). Requires messages:read and media:read.' + 'Download a stored Official API message media copy for an enrolled HMS Connection (beta). Requires messages:read and media:read.' static override examples = [ - '<%= config.bin %> chat message media +15550001111 739182640518204 --session NUMBER_ID --output ./attachment.bin', + '<%= config.bin %> chat message media +15550001111 739182640518204 --connection NUMBER_ID --output ./attachment.bin', ] static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), output: Flags.string({ @@ -51,7 +51,7 @@ export default class ChatMessageMedia extends BaseCommand { } const result = await downloadHistoryMessageMedia( await this.historyMessagingClient(flags), - flags.session, + flags.connection, args.conversation, args.message, { diff --git a/src/commands/chat/message/view.ts b/src/commands/chat/message/view.ts index 4b76cf69..9c2e76c7 100644 --- a/src/commands/chat/message/view.ts +++ b/src/commands/chat/message/view.ts @@ -19,11 +19,11 @@ export default class ChatMessageView extends BaseCommand { } static override description = - 'View one stored message for an enrolled HMS Number (beta). Requires messages:read.' + 'View one stored message for an enrolled HMS Connection (beta). Requires messages:read.' static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), } @@ -32,7 +32,7 @@ export default class ChatMessageView extends BaseCommand { const {args, flags} = await this.parse(ChatMessageView) const result = await viewHistoryMessage( await this.historyMessagingClient(flags), - flags.session, + flags.connection, args.conversation, args.message, ) diff --git a/src/commands/chat/view.ts b/src/commands/chat/view.ts index 9f0f8549..ca5b780b 100644 --- a/src/commands/chat/view.ts +++ b/src/commands/chat/view.ts @@ -12,11 +12,11 @@ export default class ChatView extends BaseCommand { } static override description = - 'View one stored chat for an enrolled HMS Number (beta). Requires chats:read.' + 'View one stored chat for an enrolled HMS Connection (beta). Requires chats:read.' static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), } @@ -25,7 +25,7 @@ export default class ChatView extends BaseCommand { const {args, flags} = await this.parse(ChatView) const result = await viewHistoryChat( await this.historyMessagingClient(flags), - flags.session, + flags.connection, args.conversation, ) this.writeValue(result, renderHistoryChat(result.data), flags) diff --git a/src/commands/cloud/catalog/list.ts b/src/commands/cloud/catalog/list.ts index c6978f33..99777f53 100644 --- a/src/commands/cloud/catalog/list.ts +++ b/src/commands/cloud/catalog/list.ts @@ -4,7 +4,7 @@ import {BaseCommand} from '../../../base-command.js' export default class CloudCatalogList extends BaseCommand { static override description = - 'List visible Meta product catalogs for a WhatsApp Business Account. Requires sessions:read and Graph access.' + 'List visible Meta product catalogs for a WhatsApp Business Account. Requires connections:read and Graph access.' static override flags = { waba: Flags.string({ description: 'WhatsApp Business Account ID.', diff --git a/src/commands/cloud/catalog/products.ts b/src/commands/cloud/catalog/products.ts index 79c1cd4a..7976d206 100644 --- a/src/commands/cloud/catalog/products.ts +++ b/src/commands/cloud/catalog/products.ts @@ -4,7 +4,7 @@ import {BaseCommand} from '../../../base-command.js' export default class CloudCatalogProducts extends BaseCommand { static override description = - 'List products in a catalog linked to an Official API WABA (beta). Requires sessions:read and Graph access.' + 'List products in a catalog linked to an Official API WABA (beta). Requires connections:read and Graph access.' static override flags = { waba: Flags.string({ diff --git a/src/commands/cloud/credentials/get.ts b/src/commands/cloud/credentials/get.ts index a7ab960d..033cead4 100644 --- a/src/commands/cloud/credentials/get.ts +++ b/src/commands/cloud/credentials/get.ts @@ -4,11 +4,11 @@ import {cloudResult} from '../../../services/cloud.js' export default class CloudCredentialsGet extends BaseCommand { static override description = - 'Read redacted Meta credential checks for an enrolled Official API Number (beta). Requires sessions:read.' + 'Read redacted Meta credential checks for an enrolled Official API Connection (beta). Requires connections:read.' static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), } @@ -18,8 +18,8 @@ export default class CloudCredentialsGet extends BaseCommand { const client = await this.messagingClient(flags, { serverCredentialOnly: 'Official API', }) - const response = await client.sessions.getCloudCredentialHealth( - flags.session, + const response = await client.connections.getCloudCredentialHealth( + flags.connection, ) const result = cloudResult(response) this.writeValue(result, JSON.stringify(result.data, null, 2), flags) diff --git a/src/commands/cloud/credentials/reauthorize.ts b/src/commands/cloud/credentials/reauthorize.ts index 5f6063ec..ac095a1c 100644 --- a/src/commands/cloud/credentials/reauthorize.ts +++ b/src/commands/cloud/credentials/reauthorize.ts @@ -4,11 +4,11 @@ import {cloudResult} from '../../../services/cloud.js' export default class CloudCredentialsReauthorize extends BaseCommand { static override description = - 'Create one reauthorization QuickLink for a stopped or disconnected standalone Official API Number (beta). Requires quicklink:manage. Never stops the Number or retries link creation.' + 'Create one reauthorization QuickLink for a stopped or disconnected standalone Official API Connection (beta). Requires quicklink:manage. Never stops the Connection or retries link creation.' static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), } @@ -18,8 +18,8 @@ export default class CloudCredentialsReauthorize extends BaseCommand { const client = await this.messagingClient(flags, { serverCredentialOnly: 'Official API', }) - const response = await client.sessions.reauthorizeCloudCredentials( - flags.session, + const response = await client.connections.reauthorizeCloudCredentials( + flags.connection, ) const result = cloudResult(response) this.writeValue(result, JSON.stringify(result.data, null, 2), flags) diff --git a/src/commands/cloud/group/create.ts b/src/commands/cloud/group/create.ts index ea3d4546..0ce33b54 100644 --- a/src/commands/cloud/group/create.ts +++ b/src/commands/cloud/group/create.ts @@ -7,8 +7,8 @@ export default class CloudGroupCreate extends BaseCommand { 'Ask WhatsApp to create an Official group (beta). Requires groups:manage, team enrollment and an Official Business Account. Sends once; the group ID and invite link arrive in a group.update event carrying the returned requestId.' static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), subject: Flags.string({ @@ -33,7 +33,7 @@ export default class CloudGroupCreate extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.officialGroups.create( - flags.session, + flags.connection, { subject: flags.subject, ...(flags.description === undefined diff --git a/src/commands/cloud/group/delete.ts b/src/commands/cloud/group/delete.ts index e036a32f..b633c865 100644 --- a/src/commands/cloud/group/delete.ts +++ b/src/commands/cloud/group/delete.ts @@ -13,8 +13,8 @@ export default class CloudGroupDelete extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), yes: Flags.boolean({ @@ -37,7 +37,7 @@ export default class CloudGroupDelete extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.officialGroups.delete( - flags.session, + flags.connection, args.group, requestKey(flags['idempotency-key']), ) diff --git a/src/commands/cloud/group/get.ts b/src/commands/cloud/group/get.ts index df539b07..a587716e 100644 --- a/src/commands/cloud/group/get.ts +++ b/src/commands/cloud/group/get.ts @@ -12,8 +12,8 @@ export default class CloudGroupGet extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), } @@ -23,7 +23,7 @@ export default class CloudGroupGet extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.officialGroups.retrieve( - flags.session, + flags.connection, args.group, ) const result = cloudResult(response) diff --git a/src/commands/cloud/group/invite-link.ts b/src/commands/cloud/group/invite-link.ts index 65aa1eea..feb21195 100644 --- a/src/commands/cloud/group/invite-link.ts +++ b/src/commands/cloud/group/invite-link.ts @@ -13,8 +13,8 @@ export default class CloudGroupInviteLink extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), reset: Flags.boolean({ @@ -39,11 +39,11 @@ export default class CloudGroupInviteLink extends BaseCommand { }) const response = flags.reset ? await client.officialGroups.resetInviteLink( - flags.session, + flags.connection, args.group, requestKey(flags['idempotency-key']), ) - : await client.officialGroups.getInviteLink(flags.session, args.group) + : await client.officialGroups.getInviteLink(flags.connection, args.group) const result = cloudResult(response) this.writeValue(result, JSON.stringify(result.data, null, 2), flags) } diff --git a/src/commands/cloud/group/join-requests/approve.ts b/src/commands/cloud/group/join-requests/approve.ts index 96aafbbf..ec9d8954 100644 --- a/src/commands/cloud/group/join-requests/approve.ts +++ b/src/commands/cloud/group/join-requests/approve.ts @@ -12,8 +12,8 @@ export default class CloudGroupJoinRequestsApprove extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), request: Flags.string({ @@ -32,7 +32,7 @@ export default class CloudGroupJoinRequestsApprove extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.officialGroups.approveJoinRequests( - flags.session, + flags.connection, args.group, flags.request, requestKey(flags['idempotency-key']), diff --git a/src/commands/cloud/group/join-requests/list.ts b/src/commands/cloud/group/join-requests/list.ts index 2807f3c8..7e4674f3 100644 --- a/src/commands/cloud/group/join-requests/list.ts +++ b/src/commands/cloud/group/join-requests/list.ts @@ -12,8 +12,8 @@ export default class CloudGroupJoinRequestsList extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), before: Flags.string({ @@ -30,7 +30,7 @@ export default class CloudGroupJoinRequestsList extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.officialGroups.listJoinRequests( - flags.session, + flags.connection, args.group, { ...(flags.before === undefined ? {} : {before: flags.before}), diff --git a/src/commands/cloud/group/join-requests/reject.ts b/src/commands/cloud/group/join-requests/reject.ts index 45f7c178..ce79fba6 100644 --- a/src/commands/cloud/group/join-requests/reject.ts +++ b/src/commands/cloud/group/join-requests/reject.ts @@ -12,8 +12,8 @@ export default class CloudGroupJoinRequestsReject extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), request: Flags.string({ @@ -32,7 +32,7 @@ export default class CloudGroupJoinRequestsReject extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.officialGroups.rejectJoinRequests( - flags.session, + flags.connection, args.group, flags.request, requestKey(flags['idempotency-key']), diff --git a/src/commands/cloud/group/list.ts b/src/commands/cloud/group/list.ts index 5113087e..bd42663f 100644 --- a/src/commands/cloud/group/list.ts +++ b/src/commands/cloud/group/list.ts @@ -4,11 +4,11 @@ import {cloudResult} from '../../../services/cloud.js' export default class CloudGroupList extends BaseCommand { static override description = - 'List Official groups on an Official API Number (beta). Requires groups:read and team enrollment.' + 'List Official groups on an Official API Connection (beta). Requires groups:read and team enrollment.' static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), limit: Flags.integer({ @@ -29,7 +29,7 @@ export default class CloudGroupList extends BaseCommand { const client = await this.messagingClient(flags, { serverCredentialOnly: 'Official API', }) - const response = await client.officialGroups.list(flags.session, { + const response = await client.officialGroups.list(flags.connection, { ...(flags.limit === undefined ? {} : {limit: flags.limit}), ...(flags.before === undefined ? {} : {before: flags.before}), ...(flags.after === undefined ? {} : {after: flags.after}), diff --git a/src/commands/cloud/group/pin.ts b/src/commands/cloud/group/pin.ts index cb2b1bcd..fd07c2a6 100644 --- a/src/commands/cloud/group/pin.ts +++ b/src/commands/cloud/group/pin.ts @@ -13,8 +13,8 @@ export default class CloudGroupPin extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), message: Flags.string({ @@ -44,7 +44,7 @@ export default class CloudGroupPin extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.officialGroups.pin( - flags.session, + flags.connection, args.group, flags.unpin ? {operation: 'unpin', messageId: flags.message} diff --git a/src/commands/cloud/group/remove-participants.ts b/src/commands/cloud/group/remove-participants.ts index a9a10543..c5b8a843 100644 --- a/src/commands/cloud/group/remove-participants.ts +++ b/src/commands/cloud/group/remove-participants.ts @@ -12,8 +12,8 @@ export default class CloudGroupRemoveParticipants extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), participant: Flags.string({ @@ -33,7 +33,7 @@ export default class CloudGroupRemoveParticipants extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.officialGroups.removeParticipants( - flags.session, + flags.connection, args.group, flags.participant, requestKey(flags['idempotency-key']), diff --git a/src/commands/cloud/group/update.ts b/src/commands/cloud/group/update.ts index faa3132e..e19e2b24 100644 --- a/src/commands/cloud/group/update.ts +++ b/src/commands/cloud/group/update.ts @@ -13,8 +13,8 @@ export default class CloudGroupUpdate extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), subject: Flags.string({description: 'New subject, 1 to 128 characters.'}), @@ -37,7 +37,7 @@ export default class CloudGroupUpdate extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.officialGroups.update( - flags.session, + flags.connection, args.group, { ...(flags.subject === undefined ? {} : {subject: flags.subject}), diff --git a/src/commands/cloud/marketing/status.ts b/src/commands/cloud/marketing/status.ts index 2a257da7..9d90448a 100644 --- a/src/commands/cloud/marketing/status.ts +++ b/src/commands/cloud/marketing/status.ts @@ -4,12 +4,12 @@ import {BaseCommand} from '../../../base-command.js' export default class CloudMarketingStatus extends BaseCommand { static override description = - 'Read raw Marketing Messages WABA status strings (beta). Requires sessions:read and Graph access.' + 'Read raw Marketing Messages WABA status strings (beta). Requires connections:read and Graph access.' static override flags = { waba: Flags.string({ description: - 'WhatsApp Business Account ID from an Official API Number in your project.', + 'WhatsApp Business Account ID from an Official API Connection in your project.', required: true, }), 'graph-version': Flags.string({ diff --git a/src/commands/cloud/pricing.ts b/src/commands/cloud/pricing.ts index 4b2cdc63..90c29bed 100644 --- a/src/commands/cloud/pricing.ts +++ b/src/commands/cloud/pricing.ts @@ -4,11 +4,11 @@ import {cloudResult} from '../../services/cloud.js' export default class CloudPricing extends BaseCommand { static override description = - 'Read Meta-reported message counts (beta), without prices or invoice amounts. Requires sessions:read and service-window enrollment.' + 'Read Meta-reported message counts (beta), without prices or invoice amounts. Requires connections:read and service-window enrollment.' static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), since: Flags.string({ @@ -26,7 +26,7 @@ export default class CloudPricing extends BaseCommand { const client = await this.messagingClient(flags, { serverCredentialOnly: 'Official API', }) - const response = await client.sessions.getMetaPricing(flags.session, { + const response = await client.connections.getMetaPricing(flags.connection, { ...(flags.since === undefined ? {} : {since: flags.since}), ...(flags.until === undefined ? {} : {until: flags.until}), }) diff --git a/src/commands/cloud/service-window.ts b/src/commands/cloud/service-window.ts index 3429f79d..6b1df1ef 100644 --- a/src/commands/cloud/service-window.ts +++ b/src/commands/cloud/service-window.ts @@ -12,8 +12,8 @@ export default class CloudServiceWindow extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), } @@ -24,7 +24,7 @@ export default class CloudServiceWindow extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.chats.getServiceWindow( - flags.session, + flags.connection, args.conversation, ) const result = cloudResult(response) diff --git a/src/commands/cloud/template/create.ts b/src/commands/cloud/template/create.ts index 66efaafe..c99d3c6a 100644 --- a/src/commands/cloud/template/create.ts +++ b/src/commands/cloud/template/create.ts @@ -9,8 +9,8 @@ export default class CloudTemplateCreate extends BaseCommand { 'Submit one Meta template (beta). Requires messages:write. Sends once; pass --idempotency-key so a manual retry cannot submit twice.' static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), input: Flags.string({ @@ -31,7 +31,7 @@ export default class CloudTemplateCreate extends BaseCommand { }) const body = parseCloudTemplate(await readJsonInput(flags.input)) const response = await client.cloudTemplates.create( - flags.session, + flags.connection, body, requestKey(flags['idempotency-key']), ) diff --git a/src/commands/cloud/template/delete.ts b/src/commands/cloud/template/delete.ts index 931079f0..5b3f4367 100644 --- a/src/commands/cloud/template/delete.ts +++ b/src/commands/cloud/template/delete.ts @@ -13,8 +13,8 @@ export default class CloudTemplateDelete extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), yes: Flags.boolean({ @@ -37,7 +37,7 @@ export default class CloudTemplateDelete extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.cloudTemplates.delete( - flags.session, + flags.connection, args.name, requestKey(flags['idempotency-key']), ) diff --git a/src/commands/cloud/template/edit.ts b/src/commands/cloud/template/edit.ts index f63b27b2..1687a93d 100644 --- a/src/commands/cloud/template/edit.ts +++ b/src/commands/cloud/template/edit.ts @@ -10,8 +10,8 @@ export default class CloudTemplateEdit extends BaseCommand { name: Args.string({description: 'Meta template name.', required: true}), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), language: Flags.string({ @@ -29,7 +29,7 @@ export default class CloudTemplateEdit extends BaseCommand { }) const body = parseCloudTemplateEdit(await readJsonInput(flags.input)) const response = await client.cloudTemplates.update( - flags.session, + flags.connection, args.name, body, flags.language === undefined ? {} : {language: flags.language}, diff --git a/src/commands/cloud/template/get.ts b/src/commands/cloud/template/get.ts index 826184ac..7251a3bf 100644 --- a/src/commands/cloud/template/get.ts +++ b/src/commands/cloud/template/get.ts @@ -9,8 +9,8 @@ export default class CloudTemplateGet extends BaseCommand { name: Args.string({description: 'Meta template name.', required: true}), } static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), language: Flags.string({ @@ -24,7 +24,7 @@ export default class CloudTemplateGet extends BaseCommand { serverCredentialOnly: 'Official API', }) const response = await client.cloudTemplates.retrieve( - flags.session, + flags.connection, args.name, flags.language === undefined ? {} : {language: flags.language}, ) diff --git a/src/commands/cloud/template/list.ts b/src/commands/cloud/template/list.ts index 75e72296..e2ad5e8c 100644 --- a/src/commands/cloud/template/list.ts +++ b/src/commands/cloud/template/list.ts @@ -4,11 +4,11 @@ import {cloudResult} from '../../../services/cloud.js' export default class CloudTemplateList extends BaseCommand { static override description = - 'List the refreshed Meta template catalog for an Official API Number (beta). Requires messages:write.' + 'List the refreshed Meta template catalog for an Official API Connection (beta). Requires messages:write.' static override flags = { - session: Flags.string({ - description: 'Messaging Number ID.', + connection: Flags.string({ + description: 'Messaging Connection ID.', required: true, }), } @@ -18,7 +18,7 @@ export default class CloudTemplateList extends BaseCommand { const client = await this.messagingClient(flags, { serverCredentialOnly: 'Official API', }) - const response = await client.cloudTemplates.list(flags.session) + const response = await client.cloudTemplates.list(flags.connection) const result = cloudResult(response) this.writeValue(result, JSON.stringify(result.data, null, 2), flags) } diff --git a/src/commands/connection-ban/list.ts b/src/commands/connection-ban/list.ts new file mode 100644 index 00000000..4bc57903 --- /dev/null +++ b/src/commands/connection-ban/list.ts @@ -0,0 +1,24 @@ +import {Flags} from '@oclif/core' + +import {BaseCommand} from '../../base-command.js' +import { + listConnectionBans, + renderConnectionBans, +} from '../../services/platform-management.js' + +export default class ConnectionBanList extends BaseCommand { + static override description = 'List recorded organization connection bans.' + + static override flags = { + active: Flags.boolean({description: 'Return only active bans.'}), + } + + async run(): Promise<void> { + const {flags} = await this.parse(ConnectionBanList) + const result = await listConnectionBans( + await this.platformClient(flags), + flags.active, + ) + this.writeValue(result, renderConnectionBans(result.data), flags) + } +} diff --git a/src/commands/connection/capabilities.ts b/src/commands/connection/capabilities.ts new file mode 100644 index 00000000..2f3494ef --- /dev/null +++ b/src/commands/connection/capabilities.ts @@ -0,0 +1,33 @@ +import {Args} from '@oclif/core' + +import {BaseCommand} from '../../base-command.js' +import { + getConnectionCapabilities, + renderConnectionCapabilities, +} from '../../services/platform-management.js' + +export default class ConnectionCapabilitiesCommand extends BaseCommand { + static override args = { + connection: Args.string({ + description: 'Connection ID or name.', + required: true, + }), + } + + static override description = + "Show the WhatsApp features and limits WhatsApp has enabled for a Connection, as of the Connection's last configuration sync. Beta: the team must be enrolled." + + static override examples = [ + '<%= config.bin %> connection capabilities support-line', + '<%= config.bin %> connection capabilities support-line --json', + ] + + async run(): Promise<void> { + const {args, flags} = await this.parse(ConnectionCapabilitiesCommand) + const result = await getConnectionCapabilities( + await this.platformClient(flags), + args.connection, + ) + this.writeValue(result, renderConnectionCapabilities(result.data), flags) + } +} diff --git a/src/commands/session/configuration/get.ts b/src/commands/connection/configuration/get.ts similarity index 54% rename from src/commands/session/configuration/get.ts rename to src/commands/connection/configuration/get.ts index e83cdb1c..555c381e 100644 --- a/src/commands/session/configuration/get.ts +++ b/src/commands/connection/configuration/get.ts @@ -1,17 +1,17 @@ import {Args} from '@oclif/core' import {BaseCommand} from '../../../base-command.js' -export default class SessionConfigurationGet extends BaseCommand { +export default class ConnectionConfigurationGet extends BaseCommand { static override description = - 'Read effective session configuration, inheritance sources and revisions.' + 'Read effective connection configuration, inheritance sources and revisions.' static override args = { - session: Args.string({description: 'Session ID.', required: true}), + connection: Args.string({description: 'Connection ID.', required: true}), } async run(): Promise<void> { - const {args, flags} = await this.parse(SessionConfigurationGet) + const {args, flags} = await this.parse(ConnectionConfigurationGet) const response = await ( await this.platformClient(flags) - ).sessions.retrieve(args.session) + ).connections.retrieve(args.connection) const data = response.data.data this.writeValue( {data, metadata: response.metadata}, diff --git a/src/commands/session/configuration/update.ts b/src/commands/connection/configuration/update.ts similarity index 66% rename from src/commands/session/configuration/update.ts rename to src/commands/connection/configuration/update.ts index d12a7bec..954a912b 100644 --- a/src/commands/session/configuration/update.ts +++ b/src/commands/connection/configuration/update.ts @@ -1,13 +1,13 @@ import {Args, Flags} from '@oclif/core' import {readJsonInput} from '../../../api/request.js' import {BaseCommand} from '../../../base-command.js' -import {parseSessionConfigurationUpdate} from '../../../services/session-configuration.js' +import {parseConnectionConfigurationUpdate} from '../../../services/connection-configuration.js' -export default class SessionConfigurationUpdate extends BaseCommand { +export default class ConnectionConfigurationUpdate extends BaseCommand { static override description = 'Set configuration overrides or reset them to inherited defaults using a revision.' static override args = { - session: Args.string({description: 'Session ID.', required: true}), + connection: Args.string({description: 'Connection ID.', required: true}), } static override flags = { input: Flags.string({ @@ -17,13 +17,13 @@ export default class SessionConfigurationUpdate extends BaseCommand { }), } async run(): Promise<void> { - const {args, flags} = await this.parse(SessionConfigurationUpdate) - const input = parseSessionConfigurationUpdate( + const {args, flags} = await this.parse(ConnectionConfigurationUpdate) + const input = parseConnectionConfigurationUpdate( await readJsonInput(flags.input), ) const response = await ( await this.platformClient(flags) - ).sessions.update(args.session, input) + ).connections.update(args.connection, input) this.writeValue( {data: response.data.data, metadata: response.metadata}, 'Configuration saved. Check application status for runtime acknowledgement.', diff --git a/src/commands/session/delete.ts b/src/commands/connection/delete.ts similarity index 61% rename from src/commands/session/delete.ts rename to src/commands/connection/delete.ts index 425672bb..f0cda8a3 100644 --- a/src/commands/session/delete.ts +++ b/src/commands/connection/delete.ts @@ -2,21 +2,21 @@ import {Args, Flags} from '@oclif/core' import {BaseCommand} from '../../base-command.js' import { - deleteSessions, - renderSessionDeletes, + deleteConnections, + renderConnectionDeletes, } from '../../services/platform-management.js' -export default class SessionDelete extends BaseCommand { +export default class ConnectionDelete extends BaseCommand { static override args = { - sessions: Args.string({ - description: 'One to 100 session UUIDs or stable slugs.', + connections: Args.string({ + description: 'One to 100 connection UUIDs or stable slugs.', multiple: true, required: true, }), } static override description = - 'Permanently remove matching sessions from management.' + 'Permanently remove matching connections from management.' static override flags = { 'idempotency-key': Flags.string({ @@ -24,21 +24,21 @@ export default class SessionDelete extends BaseCommand { 'Identify this attempt (a retry counts only rows still present).', }), yes: Flags.boolean({ - description: 'Confirm permanent removal of every supplied session.', + description: 'Confirm permanent removal of every supplied connection.', required: true, }), } async run(): Promise<void> { - const {args, flags} = await this.parse(SessionDelete) - const result = await deleteSessions( + const {args, flags} = await this.parse(ConnectionDelete) + const result = await deleteConnections( await this.platformClient(flags), - args.sessions, + args.connections, flags.project, flags['idempotency-key'] === undefined ? {} : {idempotencyKey: flags['idempotency-key']}, ) - this.writeValue(result, renderSessionDeletes(result.data.removed), flags) + this.writeValue(result, renderConnectionDeletes(result.data.removed), flags) } } diff --git a/src/commands/connection/hybrid-merge-candidates.ts b/src/commands/connection/hybrid-merge-candidates.ts new file mode 100644 index 00000000..5e912e6e --- /dev/null +++ b/src/commands/connection/hybrid-merge-candidates.ts @@ -0,0 +1,32 @@ +import {PolymorfaConfigurationError} from '@polymorfa/sdk' + +import {BaseCommand} from '../../base-command.js' +import { + listHybridMergeCandidates, + renderMergeCandidates, +} from '../../services/connection-tiers.js' + +export default class ConnectionHybridMergeCandidates extends BaseCommand { + static override description = `List same-number Connection pairs that can merge into one Hybrid Link Connection. + +Each pair is one Linked Devices Connection and one Official API Connection that shares the number with the WhatsApp Business app. Merge an eligible pair with \`connection tier quote KEEP_UUID --tier pro --merge-with OTHER_UUID\`. A Connection marked "must be kept" uses hosted message storage and cannot be the one merged away. Requires Hybrid Link access.` + + static override examples = [ + '<%= config.bin %> connection hybrid-merge-candidates --project PROJECT_UUID', + ] + + async run(): Promise<void> { + const {flags} = await this.parse(ConnectionHybridMergeCandidates) + if (flags.project === undefined || flags.project.trim().length === 0) { + throw new PolymorfaConfigurationError( + 'Provide --project with the project ID whose Connections should be checked.', + 'project', + ) + } + const result = await listHybridMergeCandidates( + await this.platformClient(flags), + flags.project.trim(), + ) + this.writeValue(result, renderMergeCandidates(result.data), flags) + } +} diff --git a/src/commands/connection/list.ts b/src/commands/connection/list.ts new file mode 100644 index 00000000..6cc876a8 --- /dev/null +++ b/src/commands/connection/list.ts @@ -0,0 +1,23 @@ +import {BaseCommand} from '../../base-command.js' +import { + listManagedConnections, + renderManagedConnections, +} from '../../services/platform-management.js' + +export default class ConnectionList extends BaseCommand { + static override description = + 'List connection metadata for the team or one project. Requires an organization API key with connections:read.' + static override examples = [ + '<%= config.bin %> connection list', + '<%= config.bin %> connection list --project PROJECT_ID --json', + ] + + async run(): Promise<void> { + const {flags} = await this.parse(ConnectionList) + const result = await listManagedConnections( + await this.platformClient(flags), + flags.project, + ) + this.writeValue(result, renderManagedConnections(result.data), flags) + } +} diff --git a/src/commands/connection/status.ts b/src/commands/connection/status.ts new file mode 100644 index 00000000..af61036e --- /dev/null +++ b/src/commands/connection/status.ts @@ -0,0 +1,42 @@ +import {Args} from '@oclif/core' +import {PolymorfaConfigurationError} from '@polymorfa/sdk' + +import {BaseCommand} from '../../base-command.js' +import {viewManagedConnection} from '../../services/platform-management.js' + +export default class ConnectionStatus extends BaseCommand { + static override description = + 'Read the stored connection status and reason. Requires an organization API key with connections:read.' + static override args = { + connection: Args.string({description: 'Connection ID.', required: true}), + } + static override examples = [ + '<%= config.bin %> connection status CONNECTION_ID', + ] + + async run(): Promise<void> { + const {args, flags} = await this.parse(ConnectionStatus) + if (flags.project !== undefined) { + throw new PolymorfaConfigurationError( + 'connection status identifies a team-unique connection ID; omit --project.', + 'project', + ) + } + const result = await viewManagedConnection( + await this.platformClient(flags), + args.connection, + ) + const status = { + connectionId: result.data.connectionId, + status: result.data.status, + ...(result.data.statusReason === undefined + ? {} + : {statusReason: result.data.statusReason}), + } + this.writeValue( + {data: status, metadata: result.metadata}, + `${status.connectionId}\t${status.status}${status.statusReason === undefined ? '' : `\t${status.statusReason}`}`, + flags, + ) + } +} diff --git a/src/commands/session/stop.ts b/src/commands/connection/stop.ts similarity index 58% rename from src/commands/session/stop.ts rename to src/commands/connection/stop.ts index 1627cdbb..6db6889c 100644 --- a/src/commands/session/stop.ts +++ b/src/commands/connection/stop.ts @@ -2,21 +2,21 @@ import {Args, Flags} from '@oclif/core' import {BaseCommand} from '../../base-command.js' import { - renderSessionStops, - stopSessions, + renderConnectionStops, + stopConnections, } from '../../services/platform-management.js' -export default class SessionStop extends BaseCommand { +export default class ConnectionStop extends BaseCommand { static override args = { - sessions: Args.string({ - description: 'One to 100 session UUIDs or stable slugs.', + connections: Args.string({ + description: 'One to 100 connection UUIDs or stable slugs.', multiple: true, required: true, }), } static override description = - 'Request asynchronous stops for matching managed sessions.' + 'Request asynchronous stops for matching managed connections.' static override flags = { 'idempotency-key': Flags.string({ @@ -26,15 +26,15 @@ export default class SessionStop extends BaseCommand { } async run(): Promise<void> { - const {args, flags} = await this.parse(SessionStop) - const result = await stopSessions( + const {args, flags} = await this.parse(ConnectionStop) + const result = await stopConnections( await this.platformClient(flags), - args.sessions, + args.connections, flags.project, flags['idempotency-key'] === undefined ? {} : {idempotencyKey: flags['idempotency-key']}, ) - this.writeValue(result, renderSessionStops(result.data.stopping), flags) + this.writeValue(result, renderConnectionStops(result.data.stopping), flags) } } diff --git a/src/commands/session/tier/confirm.ts b/src/commands/connection/tier/confirm.ts similarity index 64% rename from src/commands/session/tier/confirm.ts rename to src/commands/connection/tier/confirm.ts index 4df31bda..cb499091 100644 --- a/src/commands/session/tier/confirm.ts +++ b/src/commands/connection/tier/confirm.ts @@ -4,27 +4,27 @@ import {BaseCommand} from '../../../base-command.js' import { confirmTierChange, renderTierChange, -} from '../../../services/number-tiers.js' +} from '../../../services/connection-tiers.js' -export default class SessionTierConfirm extends BaseCommand { +export default class ConnectionTierConfirm extends BaseCommand { static override args = { - session: Args.string({ - description: 'Number session UUID or stable slug that was quoted.', + connection: Args.string({ + description: 'Connection UUID or stable slug that was quoted.', required: true, }), } - static override description = `Confirm a reviewed Number tier quote. + static override description = `Confirm a reviewed Connection tier quote. This charges the quoted credits and records any Hybrid Link choice in the quote. The CLI never creates or confirms a replacement quote; after a conflict, review a new quote.` static override examples = [ - '<%= config.bin %> session tier confirm support --quote QUOTE_UUID --yes', + '<%= config.bin %> connection tier confirm support --quote QUOTE_UUID --yes', ] static override flags = { quote: Flags.string({ - description: 'Quote ID returned by `session tier quote`.', + description: 'Quote ID returned by `connection tier quote`.', required: true, }), 'idempotency-key': Flags.string({ @@ -38,10 +38,10 @@ This charges the quoted credits and records any Hybrid Link choice in the quote. } async run(): Promise<void> { - const {args, flags} = await this.parse(SessionTierConfirm) + const {args, flags} = await this.parse(ConnectionTierConfirm) const result = await confirmTierChange( await this.platformClient(flags), - args.session, + args.connection, flags.quote, flags.project, flags['idempotency-key'] === undefined @@ -52,7 +52,7 @@ This charges the quoted credits and records any Hybrid Link choice in the quote. result, renderTierChange( result.data, - `Follow progress: polymorfa session tier status ${args.session} ${result.data.id}`, + `Follow progress: polymorfa connection tier status ${args.connection} ${result.data.id}`, ), flags, ) diff --git a/src/commands/connection/tier/quote.ts b/src/commands/connection/tier/quote.ts new file mode 100644 index 00000000..87e0181a --- /dev/null +++ b/src/commands/connection/tier/quote.ts @@ -0,0 +1,89 @@ +import {Args, Flags} from '@oclif/core' + +import {BaseCommand} from '../../../base-command.js' +import { + HYBRID_TRANSPORTS, + TIER_CHOICES, + quoteTierChange, + renderTierChange, + tierQuoteRequest, +} from '../../../services/connection-tiers.js' + +export default class ConnectionTierQuote extends BaseCommand { + static override args = { + connection: Args.string({ + description: + 'Connection UUID or stable slug. For a merge, this Connection keeps its ID.', + required: true, + }), + } + + static override description = `Preview a Connection tier change without changing the Connection or spending credit. + +A Hybrid Link Connection leaving Pro needs a choice: --keep one method, or --split into two Standard Connections. The choice runs when the paid Pro window ends. An upgrade to Pro can merge a same-number pair with --merge-with.` + + static override examples = [ + '<%= config.bin %> connection tier quote support --tier pro', + '<%= config.bin %> connection tier quote support --tier standard --keep linked_devices', + '<%= config.bin %> connection tier quote support --tier standard --split --stay official_api --new-connection-name support-linked', + '<%= config.bin %> connection tier quote CONNECTION_UUID --tier pro --merge-with OTHER_CONNECTION_UUID', + ] + + static override flags = { + tier: Flags.string({ + description: 'Target tier. "inherit" restores the project default tier.', + options: [...TIER_CHOICES], + required: true, + }), + keep: Flags.string({ + description: + 'Hybrid Link Connection leaving Pro: keep this method and disconnect the other.', + exclusive: ['split', 'merge-with'], + options: [...HYBRID_TRANSPORTS], + }), + split: Flags.boolean({ + description: + 'Hybrid Link Connection leaving Pro: split into two Standard Connections without re-pairing.', + exclusive: ['keep', 'merge-with'], + }), + stay: Flags.string({ + description: + 'With --split: the method that stays on this Connection; the other moves to the new Connection.', + options: [...HYBRID_TRANSPORTS], + }), + 'new-connection-name': Flags.string({ + description: 'With --split: name of the new Connection.', + }), + 'merge-with': Flags.string({ + description: + 'With --tier pro: UUID of the same-number Connection to merge into this one. It is removed after its method moves, so it must not use hosted message storage.', + exclusive: ['keep', 'split'], + }), + } + + async run(): Promise<void> { + const {args, flags} = await this.parse(ConnectionTierQuote) + const body = tierQuoteRequest({ + tier: flags.tier as (typeof TIER_CHOICES)[number], + projectId: flags.project, + keep: flags.keep as (typeof HYBRID_TRANSPORTS)[number] | undefined, + split: flags.split, + stay: flags.stay as (typeof HYBRID_TRANSPORTS)[number] | undefined, + newConnectionName: flags['new-connection-name'], + mergeWith: flags['merge-with'], + }) + const result = await quoteTierChange( + await this.platformClient(flags), + args.connection, + body, + ) + this.writeValue( + result, + renderTierChange( + result.data, + `Review the charge, then confirm: polymorfa connection tier confirm ${args.connection} --quote ${result.data.id} --yes`, + ), + flags, + ) + } +} diff --git a/src/commands/session/tier/status.ts b/src/commands/connection/tier/status.ts similarity index 61% rename from src/commands/session/tier/status.ts rename to src/commands/connection/tier/status.ts index eb8e4862..b852a3fe 100644 --- a/src/commands/session/tier/status.ts +++ b/src/commands/connection/tier/status.ts @@ -4,12 +4,12 @@ import {BaseCommand} from '../../../base-command.js' import { renderTierChange, retrieveTierChange, -} from '../../../services/number-tiers.js' +} from '../../../services/connection-tiers.js' -export default class SessionTierStatus extends BaseCommand { +export default class ConnectionTierStatus extends BaseCommand { static override args = { - session: Args.string({ - description: 'Number session UUID or stable slug.', + connection: Args.string({ + description: 'Connection UUID or stable slug.', required: true, }), quote: Args.string({ @@ -18,19 +18,19 @@ export default class SessionTierStatus extends BaseCommand { }), } - static override description = `Read a Number tier change and its Hybrid Link transition. + static override description = `Read a Connection tier change and its Hybrid Link transition. The tier change is queued until applied or rejected. A Hybrid Link transition reports its own status: scheduled, running, completed, failed or cancelled.` static override examples = [ - '<%= config.bin %> session tier status support QUOTE_UUID', + '<%= config.bin %> connection tier status support QUOTE_UUID', ] async run(): Promise<void> { - const {args, flags} = await this.parse(SessionTierStatus) + const {args, flags} = await this.parse(ConnectionTierStatus) const result = await retrieveTierChange( await this.platformClient(flags), - args.session, + args.connection, args.quote, ) this.writeValue(result, renderTierChange(result.data), flags) diff --git a/src/commands/connection/view.ts b/src/commands/connection/view.ts new file mode 100644 index 00000000..3ba66df2 --- /dev/null +++ b/src/commands/connection/view.ts @@ -0,0 +1,34 @@ +import {Args} from '@oclif/core' +import {PolymorfaConfigurationError} from '@polymorfa/sdk' + +import {BaseCommand} from '../../base-command.js' +import { + renderManagedConnection, + viewManagedConnection, +} from '../../services/platform-management.js' + +export default class ConnectionView extends BaseCommand { + static override description = + 'Read one connection by its ID. Requires an organization API key with connections:read.' + static override args = { + connection: Args.string({description: 'Connection ID.', required: true}), + } + static override examples = [ + '<%= config.bin %> connection view CONNECTION_ID --json', + ] + + async run(): Promise<void> { + const {args, flags} = await this.parse(ConnectionView) + if (flags.project !== undefined) { + throw new PolymorfaConfigurationError( + 'connection view identifies a team-unique connection ID; omit --project.', + 'project', + ) + } + const result = await viewManagedConnection( + await this.platformClient(flags), + args.connection, + ) + this.writeValue(result, renderManagedConnection(result.data), flags) + } +} diff --git a/src/commands/contact/block.ts b/src/commands/contact/block.ts index 414ee0d7..5db204af 100644 --- a/src/commands/contact/block.ts +++ b/src/commands/contact/block.ts @@ -17,8 +17,8 @@ export default class ContactBlock extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this block action.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -27,7 +27,7 @@ export default class ContactBlock extends BaseCommand { const {args, flags} = await this.parse(ContactBlock) const result = await blockContact( await this.messagingClient(flags, {serverApiKeyOnly: 'Contact'}), - flags.session, + flags.connection, args.contact, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/contact/blocklist.ts b/src/commands/contact/blocklist.ts index d77cb4d2..9f13d39c 100644 --- a/src/commands/contact/blocklist.ts +++ b/src/commands/contact/blocklist.ts @@ -7,8 +7,8 @@ export default class ContactBlocklist extends BaseCommand { static override description = 'View the account contact blocklist.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -17,7 +17,7 @@ export default class ContactBlocklist extends BaseCommand { const {flags} = await this.parse(ContactBlocklist) const result = await viewContactBlocklist( await this.messagingClient(flags, {serverApiKeyOnly: 'Contact'}), - flags.session, + flags.connection, ) this.writeValue(result, renderBlocklist(result.data), flags) } diff --git a/src/commands/contact/business-profile.ts b/src/commands/contact/business-profile.ts index 897539e8..9a89750f 100644 --- a/src/commands/contact/business-profile.ts +++ b/src/commands/contact/business-profile.ts @@ -17,8 +17,8 @@ export default class ContactBusinessProfile extends BaseCommand { static override description = 'Get a contact’s WhatsApp business profile.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -27,7 +27,7 @@ export default class ContactBusinessProfile extends BaseCommand { const {args, flags} = await this.parse(ContactBusinessProfile) const result = await viewContactBusinessProfile( await this.messagingClient(flags, {serverApiKeyOnly: 'Contact'}), - flags.session, + flags.connection, args.contact, ) this.writeValue(result, renderBusinessProfile(result.data), flags) diff --git a/src/commands/contact/check.ts b/src/commands/contact/check.ts index 5f7c4ae8..2a38c8ad 100644 --- a/src/commands/contact/check.ts +++ b/src/commands/contact/check.ts @@ -9,12 +9,12 @@ export default class ContactCheck extends BaseCommand { static override flags = { phone: Flags.string({ - description: 'Phone number to check; repeat for multiple numbers.', + description: 'Phone number to check; repeat for multiple phone numbers.', multiple: true, required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -23,7 +23,7 @@ export default class ContactCheck extends BaseCommand { const {flags} = await this.parse(ContactCheck) const result = await checkContacts( await this.messagingClient(flags, {serverApiKeyOnly: 'Contact'}), - flags.session, + flags.connection, flags.phone, ) this.writeValue(result, renderContactChecks(result.data), flags) diff --git a/src/commands/contact/devices.ts b/src/commands/contact/devices.ts index 39d7f063..8c719721 100644 --- a/src/commands/contact/devices.ts +++ b/src/commands/contact/devices.ts @@ -14,8 +14,8 @@ export default class ContactDevices extends BaseCommand { static override description = 'List a contact’s linked devices.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -24,7 +24,7 @@ export default class ContactDevices extends BaseCommand { const {args, flags} = await this.parse(ContactDevices) const result = await listContactDevices( await this.messagingClient(flags, {serverApiKeyOnly: 'Contact'}), - flags.session, + flags.connection, args.contact, ) this.writeValue( diff --git a/src/commands/contact/info.ts b/src/commands/contact/info.ts index 6fcb9f2c..aa715736 100644 --- a/src/commands/contact/info.ts +++ b/src/commands/contact/info.ts @@ -14,8 +14,8 @@ export default class ContactInfo extends BaseCommand { static override description = 'Get live WhatsApp metadata for a contact.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -24,7 +24,7 @@ export default class ContactInfo extends BaseCommand { const {args, flags} = await this.parse(ContactInfo) const result = await viewContactInfo( await this.messagingClient(flags, {serverApiKeyOnly: 'Contact'}), - flags.session, + flags.connection, args.contact, ) this.writeValue(result, renderContactInfo(result.data), flags) diff --git a/src/commands/contact/list.ts b/src/commands/contact/list.ts index d32c3606..7ad80d5d 100644 --- a/src/commands/contact/list.ts +++ b/src/commands/contact/list.ts @@ -4,11 +4,11 @@ import {BaseCommand} from '../../base-command.js' import {listContacts, renderContacts} from '../../services/contacts.js' export default class ContactList extends BaseCommand { - static override description = 'List all contacts known to a session.' + static override description = 'List all contacts known to a connection.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -17,7 +17,7 @@ export default class ContactList extends BaseCommand { const {flags} = await this.parse(ContactList) const result = await listContacts( await this.messagingClient(flags, {serverApiKeyOnly: 'Contact'}), - flags.session, + flags.connection, ) this.writeValue(result, renderContacts(result.data), flags) } diff --git a/src/commands/contact/picture.ts b/src/commands/contact/picture.ts index b4c7d862..210b98ad 100644 --- a/src/commands/contact/picture.ts +++ b/src/commands/contact/picture.ts @@ -14,8 +14,8 @@ export default class ContactPicture extends BaseCommand { static override description = 'Get a contact profile-picture URL.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -24,7 +24,7 @@ export default class ContactPicture extends BaseCommand { const {args, flags} = await this.parse(ContactPicture) const result = await viewContactPicture( await this.messagingClient(flags, {serverApiKeyOnly: 'Contact'}), - flags.session, + flags.connection, args.contact, ) this.writeValue(result, result.data.url, flags) diff --git a/src/commands/contact/unblock.ts b/src/commands/contact/unblock.ts index 34240e46..18bc7695 100644 --- a/src/commands/contact/unblock.ts +++ b/src/commands/contact/unblock.ts @@ -17,8 +17,8 @@ export default class ContactUnblock extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this unblock action.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -27,7 +27,7 @@ export default class ContactUnblock extends BaseCommand { const {args, flags} = await this.parse(ContactUnblock) const result = await unblockContact( await this.messagingClient(flags, {serverApiKeyOnly: 'Contact'}), - flags.session, + flags.connection, args.contact, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/contact/view.ts b/src/commands/contact/view.ts index 614772ef..960a575d 100644 --- a/src/commands/contact/view.ts +++ b/src/commands/contact/view.ts @@ -11,11 +11,12 @@ export default class ContactView extends BaseCommand { }), } - static override description = 'View stored contact data known to a session.' + static override description = + 'View stored contact data known to a connection.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -24,7 +25,7 @@ export default class ContactView extends BaseCommand { const {args, flags} = await this.parse(ContactView) const result = await viewContact( await this.messagingClient(flags, {serverApiKeyOnly: 'Contact'}), - flags.session, + flags.connection, args.contact, ) this.writeValue(result, renderContact(result.data), flags) diff --git a/src/commands/customer/number/list.ts b/src/commands/customer/connection/list.ts similarity index 51% rename from src/commands/customer/number/list.ts rename to src/commands/customer/connection/list.ts index fbc8a08b..87859039 100644 --- a/src/commands/customer/number/list.ts +++ b/src/commands/customer/connection/list.ts @@ -2,25 +2,25 @@ import {Args} from '@oclif/core' import {BaseCommand} from '../../../base-command.js' import { - listCustomerNumbers, - renderCustomerNumbers, + listCustomerConnections, + renderCustomerConnections, requireCustomerProject, } from '../../../services/customers.js' -export default class CustomerNumberList extends BaseCommand { +export default class CustomerConnectionList extends BaseCommand { static override args = { customer: Args.string({description: 'Customer ID.', required: true}), } - static override description = 'List Numbers assigned to a Customer.' + static override description = 'List Connections assigned to a Customer.' async run(): Promise<void> { - const {args, flags} = await this.parse(CustomerNumberList) - const result = await listCustomerNumbers( + const {args, flags} = await this.parse(CustomerConnectionList) + const result = await listCustomerConnections( await this.platformClient(flags), args.customer, requireCustomerProject(flags.project), ) - this.writeValue(result, renderCustomerNumbers(result.data), flags) + this.writeValue(result, renderCustomerConnections(result.data), flags) } } diff --git a/src/commands/customer/number/transfer.ts b/src/commands/customer/connection/transfer.ts similarity index 64% rename from src/commands/customer/number/transfer.ts rename to src/commands/customer/connection/transfer.ts index c98a6224..756ccbf4 100644 --- a/src/commands/customer/number/transfer.ts +++ b/src/commands/customer/connection/transfer.ts @@ -3,22 +3,22 @@ import {Args, Flags} from '@oclif/core' import {BaseCommand} from '../../../base-command.js' import { requireCustomerProject, - transferCustomerNumber, + transferCustomerConnection, } from '../../../services/customers.js' -export default class CustomerNumberTransfer extends BaseCommand { +export default class CustomerConnectionTransfer extends BaseCommand { static override args = { customer: Args.string({ description: 'Destination Customer ID.', required: true, }), - session: Args.string({ - description: 'Number session ID or slug.', + connection: Args.string({ + description: 'Connection ID or slug.', required: true, }), } - static override description = 'Transfer a Number between Customers.' + static override description = 'Transfer a Connection between Customers.' static override flags = { from: Flags.string({ @@ -30,17 +30,17 @@ export default class CustomerNumberTransfer extends BaseCommand { required: true, }), yes: Flags.boolean({ - description: 'Confirm the Number transfer.', + description: 'Confirm the Connection transfer.', required: true, }), } async run(): Promise<void> { - const {args, flags} = await this.parse(CustomerNumberTransfer) - const result = await transferCustomerNumber( + const {args, flags} = await this.parse(CustomerConnectionTransfer) + const result = await transferCustomerConnection( await this.platformClient(flags), args.customer, - args.session, + args.connection, { confirm: true, projectId: requireCustomerProject(flags.project), @@ -50,7 +50,7 @@ export default class CustomerNumberTransfer extends BaseCommand { ) this.writeValue( result, - `Transferred Number ${result.data.sessionId} to Customer ${args.customer}.`, + `Transferred Connection ${result.data.connectionId} to Customer ${args.customer}.`, flags, ) } diff --git a/src/commands/customer/enable.ts b/src/commands/customer/enable.ts index 08725b3c..70120e46 100644 --- a/src/commands/customer/enable.ts +++ b/src/commands/customer/enable.ts @@ -8,7 +8,7 @@ import { export default class CustomerEnable extends BaseCommand { static override description = - 'Enable Customers and assign existing Numbers to the default Customer.' + 'Enable Customers and assign existing Connections to the default Customer.' static override flags = { 'idempotency-key': Flags.string({ @@ -26,7 +26,7 @@ export default class CustomerEnable extends BaseCommand { ) this.writeValue( result, - `Enabled Customers and assigned ${result.data.migratedNumberCount} existing Numbers.`, + `Enabled Customers and assigned ${result.data.migratedConnectionCount} existing Connections.`, flags, ) } diff --git a/src/commands/customer/list.ts b/src/commands/customer/list.ts index 133207a6..abfd480f 100644 --- a/src/commands/customer/list.ts +++ b/src/commands/customer/list.ts @@ -16,8 +16,8 @@ export default class CustomerList extends BaseCommand { description: 'Filter by default-Customer status.', options: ['true', 'false'], }), - 'has-numbers': Flags.string({ - description: 'Filter by whether a Customer has assigned Numbers.', + 'has-connections': Flags.string({ + description: 'Filter by whether a Customer has assigned Connections.', options: ['true', 'false'], }), limit: Flags.integer({ @@ -51,9 +51,9 @@ export default class CustomerList extends BaseCommand { ...(flags.default === undefined ? {} : {isDefault: flags.default === 'true'}), - ...(flags['has-numbers'] === undefined + ...(flags['has-connections'] === undefined ? {} - : {hasNumbers: flags['has-numbers'] === 'true'}), + : {hasConnections: flags['has-connections'] === 'true'}), ...(flags['needs-attention'] === undefined ? {} : {needsAttention: flags['needs-attention'] === 'true'}), diff --git a/src/commands/event/list.ts b/src/commands/event/list.ts index 9d5540e3..bb4e5f7a 100644 --- a/src/commands/event/list.ts +++ b/src/commands/event/list.ts @@ -32,25 +32,25 @@ export default class EventList extends BaseCommand { flags.until, ]) const time = optionalTimeRange(flags.since, flags.until) - const session = await this.developerSession(flags) + const connection = await this.developerConnection(flags) const result = await listResources( paginationInput(flags), ({cursor, limit}) => - session.client.events.list( + connection.client.events.list( { ...(cursor === undefined ? {} : {cursor}), limit, ...time, ...(flags.type === undefined ? {} : {type: flags.type}), }, - session.requestOptions, + connection.requestOptions, ), ) this.writeValue( developerRead( result.items, result.metadata, - session.context, + connection.context, result.page, ), renderEvents(result.items), diff --git a/src/commands/event/replay.ts b/src/commands/event/replay.ts index 82369135..a4b6d48d 100644 --- a/src/commands/event/replay.ts +++ b/src/commands/event/replay.ts @@ -29,18 +29,18 @@ export default class EventReplay extends BaseCommand { prompt: `Replay event ${args.event} to webhook ${flags.webhook}?`, yes: flags.yes, }) - const session = await this.developerSession(flags) + const connection = await this.developerConnection(flags) const key = idempotencyKey(flags['idempotency-key']) - const response = await session.client.events.replay( + const response = await connection.client.events.replay( args.event, {webhookId: flags.webhook}, - {...session.requestOptions, idempotencyKey: key}, + {...connection.requestOptions, idempotencyKey: key}, ) const receipt = record(response.data, 'Event replay') const deliveryId = stringField(receipt, 'deliveryId') this.writeValue( developerMutation({ - context: session.context, + context: connection.context, metadata: response.metadata, receipt, resource: {id: deliveryId, type: 'webhook_delivery'}, diff --git a/src/commands/event/stream.ts b/src/commands/event/stream.ts index ce7dea4d..1d728342 100644 --- a/src/commands/event/stream.ts +++ b/src/commands/event/stream.ts @@ -38,8 +38,8 @@ export default class EventStream extends BaseCommand { async run(): Promise<void> { const {flags} = await this.parse(EventStream) - const session = await this.developerSession(flags) - if (session.context.owner !== 'project') { + const connection = await this.developerConnection(flags) + if (connection.context.owner !== 'project') { throw new CliConditionError( 'action_required', 'Event streams belong to a project. Pass --owner project and --project.', @@ -66,7 +66,7 @@ export default class EventStream extends BaseCommand { let delivered = 0 let lastCursor: string | undefined = flags.from try { - const stream = session.client.events.stream({ + const stream = connection.client.events.stream({ ...(flags.type === undefined ? {} : {types: flags.type}), ...(flags.from === undefined ? {} : {since: flags.from}), signal: controller.signal, diff --git a/src/commands/event/view.ts b/src/commands/event/view.ts index dd2430d4..c6d6af58 100644 --- a/src/commands/event/view.ts +++ b/src/commands/event/view.ts @@ -19,14 +19,14 @@ export default class EventView extends BaseCommand { async run(): Promise<void> { const {args, flags} = await this.parse(EventView) - const session = await this.developerSession(flags) - const response = await session.client.events.retrieve( + const connection = await this.developerConnection(flags) + const response = await connection.client.events.retrieve( args.event, {includePayload: flags['include-payload']}, - session.requestOptions, + connection.requestOptions, ) this.writeValue( - developerResponse(response, session.context), + developerResponse(response, connection.context), renderEventDetail(response.data, flags['include-payload']), flags, ) diff --git a/src/commands/flow/create.ts b/src/commands/flow/create.ts index 97a50e6b..07c76157 100644 --- a/src/commands/flow/create.ts +++ b/src/commands/flow/create.ts @@ -4,7 +4,7 @@ import {readJsonInput} from '../../api/request.js' import {parseFlowCreate} from '../../services/flows.js' export default class FlowCreate extends FlowsCommand { static override description = - 'Create a local project Flow draft. Requires sessions:manage.' + 'Create a local project Flow draft. Requires connections:manage.' static override flags = { input: Flags.string({ description: diff --git a/src/commands/flow/delete.ts b/src/commands/flow/delete.ts index d4d0badf..219685bf 100644 --- a/src/commands/flow/delete.ts +++ b/src/commands/flow/delete.ts @@ -2,7 +2,7 @@ import {Args, Flags} from '@oclif/core' import {FlowsCommand} from '../../flows/command.js' export default class FlowDelete extends FlowsCommand { static override description = - 'Delete a local Flow draft. Requires sessions:manage.' + 'Delete a local Flow draft. Requires connections:manage.' static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } diff --git a/src/commands/flow/deprecate.ts b/src/commands/flow/deprecate.ts index 9997e8ca..72741a2d 100644 --- a/src/commands/flow/deprecate.ts +++ b/src/commands/flow/deprecate.ts @@ -2,13 +2,13 @@ import {Args, Flags} from '@oclif/core' import {FlowsCommand} from '../../flows/command.js' export default class FlowDeprecate extends FlowsCommand { static override description = - 'Deprecate a published WhatsApp Flow (beta). Requires sessions:manage.' + 'Deprecate a published WhatsApp Flow (beta). Requires connections:manage.' static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } static override flags = { - session: Flags.string({ - description: 'Number name or ID in the same project.', + connection: Flags.string({ + description: 'Connection name or ID in the same project.', required: true, }), 'request-id': Flags.string({ @@ -26,7 +26,7 @@ export default class FlowDeprecate extends FlowsCommand { this.error('Pass --yes to confirm this Flow change.', {exit: 2}) const resource = await this.flows(flags) const result = await resource.deprecate(args.flow, { - sessionId: flags.session, + connectionId: flags.connection, ...(flags['request-id'] === undefined ? {} : {requestId: flags['request-id']}), diff --git a/src/commands/flow/discard.ts b/src/commands/flow/discard.ts index 0b0cdcf7..d77b9528 100644 --- a/src/commands/flow/discard.ts +++ b/src/commands/flow/discard.ts @@ -2,13 +2,13 @@ import {Args, Flags} from '@oclif/core' import {FlowsCommand} from '../../flows/command.js' export default class FlowDiscard extends FlowsCommand { static override description = - 'Delete a draft from WhatsApp (beta). Requires sessions:manage.' + 'Delete a draft from WhatsApp (beta). Requires connections:manage.' static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } static override flags = { - session: Flags.string({ - description: 'Number name or ID in the same project.', + connection: Flags.string({ + description: 'Connection name or ID in the same project.', required: true, }), 'request-id': Flags.string({ @@ -26,7 +26,7 @@ export default class FlowDiscard extends FlowsCommand { this.error('Pass --yes to confirm this Flow change.', {exit: 2}) const resource = await this.flows(flags) const result = await resource.discard(args.flow, { - sessionId: flags.session, + connectionId: flags.connection, ...(flags['request-id'] === undefined ? {} : {requestId: flags['request-id']}), diff --git a/src/commands/flow/endpoint/delete.ts b/src/commands/flow/endpoint/delete.ts index 5b56eef3..03d9d262 100644 --- a/src/commands/flow/endpoint/delete.ts +++ b/src/commands/flow/endpoint/delete.ts @@ -3,13 +3,13 @@ import {PolymorfaConfigurationError} from '@polymorfa/sdk' import {FlowsCommand} from '../../../flows/command.js' export default class FlowEndpointDelete extends FlowsCommand { static override description = - "Remove a Flow's data endpoint on one Number (beta). WhatsApp requests to it are refused afterwards; receipts are kept. Requires sessions:manage." + "Remove a Flow's data endpoint on one Connection (beta). WhatsApp requests to it are refused afterwards; receipts are kept. Requires connections:manage." static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } static override flags = { - session: Flags.string({ - description: 'Number name or ID in the same project.', + connection: Flags.string({ + description: 'Connection name or ID in the same project.', required: true, }), yes: Flags.boolean({description: 'Confirm removing the endpoint.'}), @@ -23,7 +23,7 @@ export default class FlowEndpointDelete extends FlowsCommand { ) const resource = await this.flows(flags) const result = await resource.deleteEndpoint(args.flow, { - sessionId: flags.session, + connectionId: flags.connection, }) this.writeValue(result, JSON.stringify(result.data, null, 2), flags) } diff --git a/src/commands/flow/endpoint/get.ts b/src/commands/flow/endpoint/get.ts index cfb05853..003c57b8 100644 --- a/src/commands/flow/endpoint/get.ts +++ b/src/commands/flow/endpoint/get.ts @@ -2,13 +2,13 @@ import {Args, Flags} from '@oclif/core' import {FlowsCommand} from '../../../flows/command.js' export default class FlowEndpointGet extends FlowsCommand { static override description = - "Read a Flow's data endpoint on one Number and the Number's encryption custody (beta). Requires sessions:read." + "Read a Flow's data endpoint on one Connection and the Connection's encryption custody (beta). Requires connections:read." static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } static override flags = { - session: Flags.string({ - description: 'Number name or ID in the same project.', + connection: Flags.string({ + description: 'Connection name or ID in the same project.', required: true, }), } @@ -16,7 +16,7 @@ export default class FlowEndpointGet extends FlowsCommand { const {args, flags} = await this.parse(FlowEndpointGet) const resource = await this.flows(flags) const result = await resource.endpoint(args.flow, { - sessionId: flags.session, + connectionId: flags.connection, }) this.writeValue(result, JSON.stringify(result.data, null, 2), flags) } diff --git a/src/commands/flow/endpoint/receipts.ts b/src/commands/flow/endpoint/receipts.ts index 30e06d5d..1df0b21e 100644 --- a/src/commands/flow/endpoint/receipts.ts +++ b/src/commands/flow/endpoint/receipts.ts @@ -2,19 +2,23 @@ import {Args, Flags} from '@oclif/core' import {FlowsCommand} from '../../../flows/command.js' export default class FlowEndpointReceipts extends FlowsCommand { static override description = - "Read a Flow's data-exchange receipts, newest first (beta). Metadata only: no form data, Flow token or response. Requires sessions:read." + "Read a Flow's data-exchange receipts, newest first (beta). Metadata only: no form data, Flow token or response. Requires connections:read." static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } static override flags = { - session: Flags.string({description: 'Only this Number (name or ID).'}), + connection: Flags.string({ + description: 'Only this Connection (name or ID).', + }), limit: Flags.integer({description: '1 to 100 receipts.', min: 1, max: 100}), } async run(): Promise<void> { const {args, flags} = await this.parse(FlowEndpointReceipts) const resource = await this.flows(flags) const result = await resource.endpointReceipts(args.flow, { - ...(flags.session === undefined ? {} : {sessionId: flags.session}), + ...(flags.connection === undefined + ? {} + : {connectionId: flags.connection}), ...(flags.limit === undefined ? {} : {limit: flags.limit}), }) this.writeValue(result, JSON.stringify(result.data, null, 2), flags) diff --git a/src/commands/flow/endpoint/set.ts b/src/commands/flow/endpoint/set.ts index b771504b..57dea40d 100644 --- a/src/commands/flow/endpoint/set.ts +++ b/src/commands/flow/endpoint/set.ts @@ -6,13 +6,13 @@ import { import {FlowsCommand} from '../../../flows/command.js' export default class FlowEndpointSet extends FlowsCommand { static override description = - "Create or replace a Flow's data endpoint on one Number (beta). Requires sessions:manage. forward and function need a Polymorfa-managed key; direct needs your own key. A forward signing secret is printed once. Makes one attempt." + "Create or replace a Flow's data endpoint on one Connection (beta). Requires connections:manage. forward and function need a Polymorfa-managed key; direct needs your own key. A forward signing secret is printed once. Makes one attempt." static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } static override flags = { - session: Flags.string({ - description: 'Number name or ID in the same project.', + connection: Flags.string({ + description: 'Connection name or ID in the same project.', required: true, }), mode: Flags.string({ @@ -40,7 +40,7 @@ export default class FlowEndpointSet extends FlowsCommand { async run(): Promise<void> { const {args, flags} = await this.parse(FlowEndpointSet) const common = { - sessionId: flags.session, + connectionId: flags.connection, ...(flags.disabled ? {enabled: false} : {}), ...(flags['expected-revision'] === undefined ? {} diff --git a/src/commands/flow/get.ts b/src/commands/flow/get.ts index 1ce9316d..7ef97342 100644 --- a/src/commands/flow/get.ts +++ b/src/commands/flow/get.ts @@ -2,7 +2,7 @@ import {Args} from '@oclif/core' import {FlowsCommand} from '../../flows/command.js' export default class FlowGet extends FlowsCommand { static override description = - 'Read a project Flow draft. Requires sessions:read.' + 'Read a project Flow draft. Requires connections:read.' static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } diff --git a/src/commands/flow/key/custody.ts b/src/commands/flow/key/custody.ts index 4e597921..4b7ff116 100644 --- a/src/commands/flow/key/custody.ts +++ b/src/commands/flow/key/custody.ts @@ -2,17 +2,19 @@ import {Flags} from '@oclif/core' import {FlowsCommand} from '../../../flows/command.js' export default class FlowKeyCustody extends FlowsCommand { static override description = - "Read whether Polymorfa holds a Number's Flow encryption key (managed) or not (customer), and recent managed keys (beta). Requires sessions:read." + "Read whether Polymorfa holds a Connection's Flow encryption key (managed) or not (customer), and recent managed keys (beta). Requires connections:read." static override flags = { - session: Flags.string({ - description: 'Number name or ID in the project.', + connection: Flags.string({ + description: 'Connection name or ID in the project.', required: true, }), } async run(): Promise<void> { const {flags} = await this.parse(FlowKeyCustody) const resource = await this.flows(flags) - const result = await resource.encryptionKey({sessionId: flags.session}) + const result = await resource.encryptionKey({ + connectionId: flags.connection, + }) this.writeValue(result, JSON.stringify(result.data, null, 2), flags) } } diff --git a/src/commands/flow/key/get.ts b/src/commands/flow/key/get.ts index a0c066ce..43c0ccee 100644 --- a/src/commands/flow/key/get.ts +++ b/src/commands/flow/key/get.ts @@ -3,7 +3,7 @@ import {BaseCommand} from '../../../base-command.js' export default class FlowKeyGet extends BaseCommand { static override description = - 'Read the public Flow encryption key registered to a Meta phone number. Requires sessions:read.' + 'Read the public Flow encryption key registered to a Meta phone number. Requires connections:read.' static override flags = { 'phone-number-id': Flags.string({ description: 'Meta phone number ID.', diff --git a/src/commands/flow/key/register.ts b/src/commands/flow/key/register.ts index 90f5b42f..5a49c884 100644 --- a/src/commands/flow/key/register.ts +++ b/src/commands/flow/key/register.ts @@ -6,7 +6,7 @@ import {readJsonInput} from '../../../api/request.js' export default class FlowKeyRegister extends BaseCommand { static override description = - 'Replace the public key used by every dynamic Flow on this Meta phone number. Requires sessions:manage; retain the matching private key on your endpoint.' + 'Replace the public key used by every dynamic Flow on this Meta phone number. Requires connections:manage; retain the matching private key on your endpoint.' static override flags = { 'phone-number-id': Flags.string({ description: 'Meta phone number ID.', diff --git a/src/commands/flow/key/rotate.ts b/src/commands/flow/key/rotate.ts index bac68fc4..ab5cab0b 100644 --- a/src/commands/flow/key/rotate.ts +++ b/src/commands/flow/key/rotate.ts @@ -3,26 +3,27 @@ import {PolymorfaConfigurationError} from '@polymorfa/sdk' import {FlowsCommand} from '../../../flows/command.js' export default class FlowKeyRotate extends FlowsCommand { static override description = - 'Generate and register a new Polymorfa-managed Flow encryption key for a Number (beta). Every dynamic Flow on the Number uses it; the previous managed key decrypts for 24 hours. Requires sessions:manage. Makes one attempt.' + 'Generate and register a new Polymorfa-managed Flow encryption key for a Connection (beta). Every dynamic Flow on the Connection uses it; the previous managed key decrypts for 24 hours. Requires connections:manage. Makes one attempt.' static override flags = { - session: Flags.string({ - description: 'Number name or ID in the project.', + connection: Flags.string({ + description: 'Connection name or ID in the project.', required: true, }), yes: Flags.boolean({ - description: 'Confirm replacing the key for every Flow on this Number.', + description: + 'Confirm replacing the key for every Flow on this Connection.', }), } async run(): Promise<void> { const {flags} = await this.parse(FlowKeyRotate) if (!flags.yes) throw new PolymorfaConfigurationError( - 'Pass --yes to rotate the Number’s Flow encryption key.', + 'Pass --yes to rotate the Connection’s Flow encryption key.', 'yes', ) const resource = await this.flows(flags) const result = await resource.rotateEncryptionKey({ - sessionId: flags.session, + connectionId: flags.connection, }) this.writeValue(result, JSON.stringify(result.data, null, 2), flags) } diff --git a/src/commands/flow/list.ts b/src/commands/flow/list.ts index de3d81b1..192e7fee 100644 --- a/src/commands/flow/list.ts +++ b/src/commands/flow/list.ts @@ -1,7 +1,7 @@ import {FlowsCommand} from '../../flows/command.js' export default class FlowList extends FlowsCommand { static override description = - 'List project Flow drafts. Requires sessions:read.' + 'List project Flow drafts. Requires connections:read.' async run(): Promise<void> { const {flags} = await this.parse(FlowList) const resource = await this.flows(flags) diff --git a/src/commands/flow/publish.ts b/src/commands/flow/publish.ts index 78271918..dbb91a9f 100644 --- a/src/commands/flow/publish.ts +++ b/src/commands/flow/publish.ts @@ -2,13 +2,13 @@ import {Args, Flags} from '@oclif/core' import {FlowsCommand} from '../../flows/command.js' export default class FlowPublish extends FlowsCommand { static override description = - 'Publish a validated Flow to WhatsApp (beta). Requires sessions:manage.' + 'Publish a validated Flow to WhatsApp (beta). Requires connections:manage.' static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } static override flags = { - session: Flags.string({ - description: 'Number name or ID in the same project.', + connection: Flags.string({ + description: 'Connection name or ID in the same project.', required: true, }), 'request-id': Flags.string({ @@ -26,7 +26,7 @@ export default class FlowPublish extends FlowsCommand { this.error('Pass --yes to confirm this Flow change.', {exit: 2}) const resource = await this.flows(flags) const result = await resource.publish(args.flow, { - sessionId: flags.session, + connectionId: flags.connection, ...(flags['request-id'] === undefined ? {} : {requestId: flags['request-id']}), diff --git a/src/commands/flow/receipts.ts b/src/commands/flow/receipts.ts index 1dedd206..d84d638e 100644 --- a/src/commands/flow/receipts.ts +++ b/src/commands/flow/receipts.ts @@ -2,7 +2,7 @@ import {Args} from '@oclif/core' import {FlowsCommand} from '../../flows/command.js' export default class FlowReceipts extends FlowsCommand { static override description = - 'Read provider operation receipts, including uncertain outcomes. Requires sessions:read.' + 'Read provider operation receipts, including uncertain outcomes. Requires connections:read.' static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } diff --git a/src/commands/flow/sync.ts b/src/commands/flow/sync.ts index 6fd6ca5a..46df0213 100644 --- a/src/commands/flow/sync.ts +++ b/src/commands/flow/sync.ts @@ -2,13 +2,13 @@ import {Args, Flags} from '@oclif/core' import {FlowsCommand} from '../../flows/command.js' export default class FlowSync extends FlowsCommand { static override description = - 'Reconcile provider status without replaying uncertain writes (beta). Requires sessions:manage.' + 'Reconcile provider status without replaying uncertain writes (beta). Requires connections:manage.' static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } static override flags = { - session: Flags.string({ - description: 'Number name or ID in the same project.', + connection: Flags.string({ + description: 'Connection name or ID in the same project.', required: true, }), 'request-id': Flags.string({ @@ -20,7 +20,7 @@ export default class FlowSync extends FlowsCommand { const {args, flags} = await this.parse(FlowSync) const resource = await this.flows(flags) const result = await resource.sync(args.flow, { - sessionId: flags.session, + connectionId: flags.connection, ...(flags['request-id'] === undefined ? {} : {requestId: flags['request-id']}), diff --git a/src/commands/flow/update.ts b/src/commands/flow/update.ts index 8f03e6b7..fc97d26f 100644 --- a/src/commands/flow/update.ts +++ b/src/commands/flow/update.ts @@ -4,7 +4,7 @@ import {readJsonInput} from '../../api/request.js' import {parseFlowUpdate} from '../../services/flows.js' export default class FlowUpdate extends FlowsCommand { static override description = - 'Update a local project Flow draft. Requires sessions:manage.' + 'Update a local project Flow draft. Requires connections:manage.' static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } diff --git a/src/commands/flow/upload.ts b/src/commands/flow/upload.ts index e1d47a92..ac1d18b2 100644 --- a/src/commands/flow/upload.ts +++ b/src/commands/flow/upload.ts @@ -3,13 +3,13 @@ import type {FlowCategory} from '@polymorfa/sdk' import {FlowsCommand} from '../../flows/command.js' export default class FlowUpload extends FlowsCommand { static override description = - 'Upload the Flow to one Number (beta). Requires sessions:manage. Does not retry uncertain writes.' + 'Upload the Flow to one Connection (beta). Requires connections:manage. Does not retry uncertain writes.' static override args = { flow: Args.string({description: 'Flow draft UUID.', required: true}), } static override flags = { - session: Flags.string({ - description: 'Number name or ID in the same project.', + connection: Flags.string({ + description: 'Connection name or ID in the same project.', required: true, }), 'request-id': Flags.string({ @@ -35,7 +35,7 @@ export default class FlowUpload extends FlowsCommand { const {args, flags} = await this.parse(FlowUpload) const resource = await this.flows(flags) const result = await resource.upload(args.flow, { - sessionId: flags.session, + connectionId: flags.connection, ...(flags['request-id'] === undefined ? {} : {requestId: flags['request-id']}), diff --git a/src/commands/group/capabilities.ts b/src/commands/group/capabilities.ts index 7097202f..d9d43c4c 100644 --- a/src/commands/group/capabilities.ts +++ b/src/commands/group/capabilities.ts @@ -13,16 +13,16 @@ export default class GroupCapabilitiesCommand extends BaseCommand { }), } static override description = - 'Read stored WhatsApp group capabilities. Requires current membership and enrollment in the number-capabilities beta.' + 'Read stored WhatsApp group capabilities. Requires current membership and enrollment in the connection-capabilities beta.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } static override examples = [ - '<%= config.bin %> group capabilities 9007199254740993 --session support', - '<%= config.bin %> group capabilities 9007199254740993 --session support --json', + '<%= config.bin %> group capabilities 9007199254740993 --connection support', + '<%= config.bin %> group capabilities 9007199254740993 --connection support --json', ] async run(): Promise<void> { const {args, flags} = await this.parse(GroupCapabilitiesCommand) @@ -30,7 +30,7 @@ export default class GroupCapabilitiesCommand extends BaseCommand { await this.messagingClient(flags, { serverApiKeyOnly: 'Group capabilities', }), - flags.session, + flags.connection, args.group, ) this.writeValue(result, renderGroupCapabilities(result.data), flags) diff --git a/src/commands/group/create.ts b/src/commands/group/create.ts index 0494a7fd..32109480 100644 --- a/src/commands/group/create.ts +++ b/src/commands/group/create.ts @@ -8,7 +8,7 @@ export default class GroupCreate extends BaseCommand { static override description = 'Create a group with initial participants.' static override examples = [ - '<%= config.bin %> group create --session session_123 --name "Launch team" --participant 750000000001 --participant 750000000002', + '<%= config.bin %> group create --connection connection_123 --name "Launch team" --participant 750000000001 --participant 750000000002', ] static override flags = { @@ -21,8 +21,8 @@ export default class GroupCreate extends BaseCommand { multiple: true, required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -31,7 +31,7 @@ export default class GroupCreate extends BaseCommand { const {flags} = await this.parse(GroupCreate) const result = await createGroup( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, flags.name, flags.participant, idempotencyOptions(flags['idempotency-key']), diff --git a/src/commands/group/description.ts b/src/commands/group/description.ts index 8bc69403..61cc1569 100644 --- a/src/commands/group/description.ts +++ b/src/commands/group/description.ts @@ -13,15 +13,15 @@ export default class GroupDescription extends BaseCommand { 'Replace a group description. Pass an empty value to clear it.' static override examples = [ - '<%= config.bin %> group description 750000000009 --session session_123 --value "Weekly launch coordination"', + '<%= config.bin %> group description 750000000009 --connection connection_123 --value "Weekly launch coordination"', ] static override flags = { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this change.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), value: Flags.string({ @@ -34,7 +34,7 @@ export default class GroupDescription extends BaseCommand { const {args, flags} = await this.parse(GroupDescription) const result = await setGroupText( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, args.group, 'description', flags.value, diff --git a/src/commands/group/invite-link.ts b/src/commands/group/invite-link.ts index 067aa865..07a0185b 100644 --- a/src/commands/group/invite-link.ts +++ b/src/commands/group/invite-link.ts @@ -11,8 +11,8 @@ export default class GroupInviteLink extends BaseCommand { static override description = 'Print the current invite link for a group.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -21,7 +21,7 @@ export default class GroupInviteLink extends BaseCommand { const {args, flags} = await this.parse(GroupInviteLink) const result = await getGroupInviteLink( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, args.group, ) this.writeValue(result, result.data.url, flags) diff --git a/src/commands/group/list.ts b/src/commands/group/list.ts index 03237e25..92b97144 100644 --- a/src/commands/group/list.ts +++ b/src/commands/group/list.ts @@ -4,11 +4,11 @@ import {BaseCommand} from '../../base-command.js' import {listGroups} from '../../services/groups.js' export default class GroupList extends BaseCommand { - static override description = 'List groups for a Messaging session.' + static override description = 'List groups for a Messaging connection.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -17,7 +17,7 @@ export default class GroupList extends BaseCommand { const {flags} = await this.parse(GroupList) const result = await listGroups( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, ) const human = result.data.length === 0 diff --git a/src/commands/group/participants/add.ts b/src/commands/group/participants/add.ts index b35d352f..35412a11 100644 --- a/src/commands/group/participants/add.ts +++ b/src/commands/group/participants/add.ts @@ -15,7 +15,7 @@ export default class GroupParticipantsAdd extends BaseCommand { static override description = 'Add participants to a group.' static override examples = [ - '<%= config.bin %> group participants add 750000000009 --session session_123 --participant 750000000001', + '<%= config.bin %> group participants add 750000000009 --connection connection_123 --participant 750000000001', ] static override flags = { @@ -27,8 +27,8 @@ export default class GroupParticipantsAdd extends BaseCommand { multiple: true, required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -38,7 +38,7 @@ export default class GroupParticipantsAdd extends BaseCommand { const participants = participantIds(flags.participant) const result = await changeGroupParticipants( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, args.group, 'add', participants, diff --git a/src/commands/group/participants/demote.ts b/src/commands/group/participants/demote.ts index 4956a700..fc9e67df 100644 --- a/src/commands/group/participants/demote.ts +++ b/src/commands/group/participants/demote.ts @@ -15,7 +15,7 @@ export default class GroupParticipantsDemote extends BaseCommand { static override description = 'Demote group admins to regular participants.' static override examples = [ - '<%= config.bin %> group participants demote 750000000009 --session session_123 --participant 750000000001', + '<%= config.bin %> group participants demote 750000000009 --connection connection_123 --participant 750000000001', ] static override flags = { @@ -27,8 +27,8 @@ export default class GroupParticipantsDemote extends BaseCommand { multiple: true, required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -38,7 +38,7 @@ export default class GroupParticipantsDemote extends BaseCommand { const participants = participantIds(flags.participant) const result = await changeGroupParticipants( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, args.group, 'demote', participants, diff --git a/src/commands/group/participants/list.ts b/src/commands/group/participants/list.ts index 011c995d..3d0815ab 100644 --- a/src/commands/group/participants/list.ts +++ b/src/commands/group/participants/list.ts @@ -11,8 +11,8 @@ export default class GroupParticipantsList extends BaseCommand { static override description = 'List participants in a group.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -21,7 +21,7 @@ export default class GroupParticipantsList extends BaseCommand { const {args, flags} = await this.parse(GroupParticipantsList) const result = await listGroupParticipants( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, args.group, ) const human = diff --git a/src/commands/group/participants/promote.ts b/src/commands/group/participants/promote.ts index c52feafb..a856d42b 100644 --- a/src/commands/group/participants/promote.ts +++ b/src/commands/group/participants/promote.ts @@ -15,7 +15,7 @@ export default class GroupParticipantsPromote extends BaseCommand { static override description = 'Promote participants to group admins.' static override examples = [ - '<%= config.bin %> group participants promote 750000000009 --session session_123 --participant 750000000001', + '<%= config.bin %> group participants promote 750000000009 --connection connection_123 --participant 750000000001', ] static override flags = { @@ -27,8 +27,8 @@ export default class GroupParticipantsPromote extends BaseCommand { multiple: true, required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -38,7 +38,7 @@ export default class GroupParticipantsPromote extends BaseCommand { const participants = participantIds(flags.participant) const result = await changeGroupParticipants( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, args.group, 'promote', participants, diff --git a/src/commands/group/participants/remove.ts b/src/commands/group/participants/remove.ts index 0399fbff..67addc20 100644 --- a/src/commands/group/participants/remove.ts +++ b/src/commands/group/participants/remove.ts @@ -16,7 +16,7 @@ export default class GroupParticipantsRemove extends BaseCommand { static override description = 'Remove participants from a group.' static override examples = [ - '<%= config.bin %> group participants remove 750000000009 --session session_123 --participant 750000000001 --yes', + '<%= config.bin %> group participants remove 750000000009 --connection connection_123 --participant 750000000001 --yes', ] static override flags = { @@ -28,8 +28,8 @@ export default class GroupParticipantsRemove extends BaseCommand { multiple: true, required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), yes: Flags.boolean({ @@ -46,7 +46,7 @@ export default class GroupParticipantsRemove extends BaseCommand { }) const result = await changeGroupParticipants( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, args.group, 'remove', participants, diff --git a/src/commands/group/settings.ts b/src/commands/group/settings.ts index 535641c5..2971d188 100644 --- a/src/commands/group/settings.ts +++ b/src/commands/group/settings.ts @@ -12,7 +12,7 @@ export default class GroupSettings extends BaseCommand { 'Change who can edit group info, send messages, and add members, and whether joining needs admin approval.' static override examples = [ - '<%= config.bin %> group settings 750000000009 --session session_123 --messaging admins --join-approval on', + '<%= config.bin %> group settings 750000000009 --connection connection_123 --messaging admins --join-approval on', ] static override flags = { @@ -32,8 +32,8 @@ export default class GroupSettings extends BaseCommand { description: 'Who can send messages.', options: ['admins', 'all'], }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -42,7 +42,7 @@ export default class GroupSettings extends BaseCommand { const {args, flags} = await this.parse(GroupSettings) const result = await updateGroupSettings( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, args.group, { infoEditing: flags['info-editing'] as 'admins' | 'all' | undefined, diff --git a/src/commands/group/subject.ts b/src/commands/group/subject.ts index 3c1381f2..2386bdb6 100644 --- a/src/commands/group/subject.ts +++ b/src/commands/group/subject.ts @@ -12,15 +12,15 @@ export default class GroupSubject extends BaseCommand { static override description = 'Rename a group.' static override examples = [ - '<%= config.bin %> group subject 750000000009 --session session_123 --value "Launch team"', + '<%= config.bin %> group subject 750000000009 --connection connection_123 --value "Launch team"', ] static override flags = { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this change.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), value: Flags.string({description: 'New group subject.', required: true}), @@ -30,7 +30,7 @@ export default class GroupSubject extends BaseCommand { const {args, flags} = await this.parse(GroupSubject) const result = await setGroupText( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, args.group, 'subject', flags.value, diff --git a/src/commands/group/view.ts b/src/commands/group/view.ts index a65f3e46..e151151b 100644 --- a/src/commands/group/view.ts +++ b/src/commands/group/view.ts @@ -11,8 +11,8 @@ export default class GroupView extends BaseCommand { static override description = 'View one group.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -21,7 +21,7 @@ export default class GroupView extends BaseCommand { const {args, flags} = await this.parse(GroupView) const result = await viewGroup( await this.messagingClient(flags, {serverApiKeyOnly: 'Groups'}), - flags.session, + flags.connection, args.group, ) this.writeValue( diff --git a/src/commands/hybrid-link/pause.ts b/src/commands/hybrid-link/pause.ts index 75428161..1f388a5d 100644 --- a/src/commands/hybrid-link/pause.ts +++ b/src/commands/hybrid-link/pause.ts @@ -5,9 +5,9 @@ export default class HybridLinkPause extends BaseCommand { static override description = 'Pause Hybrid routing at the exact current revision.' static override flags = { - session: Flags.string({ + connection: Flags.string({ required: true, - description: 'Number session name.', + description: 'Connection name.', }), 'expected-revision': Flags.string({ required: true, @@ -19,7 +19,7 @@ export default class HybridLinkPause extends BaseCommand { const client = await this.messagingClient(flags, { serverCredentialOnly: 'Hybrid Link', }) - const response = await client.hybridLink.setPaused(flags.session, { + const response = await client.hybridLink.setPaused(flags.connection, { expectedRevision: flags['expected-revision'], paused: true, }) diff --git a/src/commands/hybrid-link/resume.ts b/src/commands/hybrid-link/resume.ts index 7309b45a..7d994d3e 100644 --- a/src/commands/hybrid-link/resume.ts +++ b/src/commands/hybrid-link/resume.ts @@ -5,9 +5,9 @@ export default class HybridLinkResume extends BaseCommand { static override description = 'Resume Hybrid routing at the exact current revision.' static override flags = { - session: Flags.string({ + connection: Flags.string({ required: true, - description: 'Number session name.', + description: 'Connection name.', }), 'expected-revision': Flags.string({ required: true, @@ -19,7 +19,7 @@ export default class HybridLinkResume extends BaseCommand { const client = await this.messagingClient(flags, { serverCredentialOnly: 'Hybrid Link', }) - const response = await client.hybridLink.setPaused(flags.session, { + const response = await client.hybridLink.setPaused(flags.connection, { expectedRevision: flags['expected-revision'], paused: false, }) diff --git a/src/commands/hybrid-link/state.ts b/src/commands/hybrid-link/state.ts index 1afb2ccb..e18ddc37 100644 --- a/src/commands/hybrid-link/state.ts +++ b/src/commands/hybrid-link/state.ts @@ -5,9 +5,9 @@ export default class HybridLinkState extends BaseCommand { static override description = 'Read Hybrid Link readiness, pause state, and revision.' static override flags = { - session: Flags.string({ + connection: Flags.string({ required: true, - description: 'Number session name.', + description: 'Connection name.', }), } async run(): Promise<void> { @@ -15,7 +15,7 @@ export default class HybridLinkState extends BaseCommand { const client = await this.messagingClient(flags, { serverCredentialOnly: 'Hybrid Link', }) - const response = await client.hybridLink.state(flags.session) + const response = await client.hybridLink.state(flags.connection) const connections = response.data.data.connections .map( ({kind, status, enabled}) => diff --git a/src/commands/identity/resolve.ts b/src/commands/identity/resolve.ts index 007eb784..8f6f25f6 100644 --- a/src/commands/identity/resolve.ts +++ b/src/commands/identity/resolve.ts @@ -4,7 +4,7 @@ import {BaseCommand} from '../../base-command.js' import { renderResolvedIdentity, resolveIdentity, -} from '../../services/session-identities.js' +} from '../../services/connection-identities.js' const IDENTITY_FLAGS = ['phone-number', 'id', 'username'] @@ -21,8 +21,8 @@ export default class IdentityResolve extends BaseCommand { description: 'Phone digits with an optional leading plus sign.', exclusive: IDENTITY_FLAGS.filter((name) => name !== 'phone-number'), }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), username: Flags.string({ @@ -41,7 +41,7 @@ export default class IdentityResolve extends BaseCommand { await this.messagingClient(flags, { serverApiKeyOnly: 'identity resolution', }), - flags.session, + flags.connection, { ...(flags.id === undefined ? {} : {id: flags.id}), ...(flags['phone-number'] === undefined diff --git a/src/commands/label/chat/list.ts b/src/commands/label/chat/list.ts index 2184d318..8777ed98 100644 --- a/src/commands/label/chat/list.ts +++ b/src/commands/label/chat/list.ts @@ -17,8 +17,8 @@ export default class LabelChatList extends BaseCommand { 'include-observation': Flags.boolean({ description: 'Include observation policy and freshness metadata.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -27,7 +27,7 @@ export default class LabelChatList extends BaseCommand { const {args, flags} = await this.parse(LabelChatList) const result = await listChatLabels( await this.messagingClient(flags, {serverApiKeyOnly: 'Label'}), - flags.session, + flags.connection, args.chat, flags['include-observation'], ) diff --git a/src/commands/label/chat/replace.ts b/src/commands/label/chat/replace.ts index 08b27722..74294ca0 100644 --- a/src/commands/label/chat/replace.ts +++ b/src/commands/label/chat/replace.ts @@ -26,8 +26,8 @@ export default class LabelChatReplace extends BaseCommand { exclusive: ['clear'], multiple: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -36,7 +36,7 @@ export default class LabelChatReplace extends BaseCommand { const {args, flags} = await this.parse(LabelChatReplace) const result = await replaceChatLabels( await this.messagingClient(flags, {serverApiKeyOnly: 'Label'}), - flags.session, + flags.connection, args.chat, flags.label, flags.clear, diff --git a/src/commands/label/create.ts b/src/commands/label/create.ts index 29d48718..e9841efa 100644 --- a/src/commands/label/create.ts +++ b/src/commands/label/create.ts @@ -12,8 +12,8 @@ export default class LabelCreate extends BaseCommand { description: 'Safely identify retries of this create operation.', }), name: Flags.string({description: 'Label name.', required: true}), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -22,7 +22,7 @@ export default class LabelCreate extends BaseCommand { const {flags} = await this.parse(LabelCreate) const result = await createLabel( await this.messagingClient(flags, {serverApiKeyOnly: 'Label'}), - flags.session, + flags.connection, { name: flags.name, ...(flags.color === undefined ? {} : {color: flags.color}), diff --git a/src/commands/label/delete.ts b/src/commands/label/delete.ts index 5e02f800..f4389ef3 100644 --- a/src/commands/label/delete.ts +++ b/src/commands/label/delete.ts @@ -14,8 +14,8 @@ export default class LabelDelete extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this delete operation.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), yes: Flags.boolean({ @@ -28,7 +28,7 @@ export default class LabelDelete extends BaseCommand { const {args, flags} = await this.parse(LabelDelete) const result = await deleteLabel( await this.messagingClient(flags, {serverApiKeyOnly: 'Label'}), - flags.session, + flags.connection, args.label, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/label/list.ts b/src/commands/label/list.ts index 0a41a57c..0d15a7c3 100644 --- a/src/commands/label/list.ts +++ b/src/commands/label/list.ts @@ -4,14 +4,14 @@ import {BaseCommand} from '../../base-command.js' import {labelItems, listLabels} from '../../services/labels.js' export default class LabelList extends BaseCommand { - static override description = 'List labels for a Messaging session.' + static override description = 'List labels for a Messaging connection.' static override flags = { 'include-observation': Flags.boolean({ description: 'Include observation policy and freshness metadata.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -20,7 +20,7 @@ export default class LabelList extends BaseCommand { const {flags} = await this.parse(LabelList) const result = await listLabels( await this.messagingClient(flags, {serverApiKeyOnly: 'Label'}), - flags.session, + flags.connection, flags['include-observation'], ) const labels = labelItems(result.data) diff --git a/src/commands/label/update.ts b/src/commands/label/update.ts index 297517dd..0ac2646e 100644 --- a/src/commands/label/update.ts +++ b/src/commands/label/update.ts @@ -16,8 +16,8 @@ export default class LabelUpdate extends BaseCommand { description: 'Safely identify retries of this update operation.', }), name: Flags.string({description: 'New label name.'}), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -26,7 +26,7 @@ export default class LabelUpdate extends BaseCommand { const {args, flags} = await this.parse(LabelUpdate) const result = await updateLabel( await this.messagingClient(flags, {serverApiKeyOnly: 'Label'}), - flags.session, + flags.connection, args.label, { ...(flags.name === undefined ? {} : {name: flags.name}), diff --git a/src/commands/logs/list.ts b/src/commands/logs/list.ts index e49330cc..fec25f0b 100644 --- a/src/commands/logs/list.ts +++ b/src/commands/logs/list.ts @@ -35,12 +35,12 @@ export default class LogsList extends BaseCommand { async run(): Promise<void> { const {flags} = await this.parse(LogsList) - const session = await this.developerSession({ + const connection = await this.developerConnection({ ...flags, owner: flags.owner ?? 'project', }) - const projectId = session.context.projectId - if (session.context.owner !== 'project' || !projectId) { + const projectId = connection.context.projectId + if (connection.context.owner !== 'project' || !projectId) { throw new CliConditionError( 'action_required', 'Request logs belong to a project. Pass --project or use a project token.', @@ -56,7 +56,7 @@ export default class LogsList extends BaseCommand { '--cursor keeps the filters of the page that returned it; do not combine it with filters.', ) } - const page = await listRequestLogs(session.client, projectId, { + const page = await listRequestLogs(connection.client, projectId, { ...filters, ...(flags.since === undefined ? {} : {since: flags.since}), ...(flags.until === undefined ? {} : {until: flags.until}), @@ -76,7 +76,7 @@ export default class LogsList extends BaseCommand { followCursor: page.followCursor, } this.writeValue( - developerRead(page.items, page.metadata, session.context, outputPage), + developerRead(page.items, page.metadata, connection.context, outputPage), page.items.length === 0 ? 'No requests.\n' : `${human}\n`, flags, ) diff --git a/src/commands/logs/tail.ts b/src/commands/logs/tail.ts index 90af9386..ec0450b9 100644 --- a/src/commands/logs/tail.ts +++ b/src/commands/logs/tail.ts @@ -46,12 +46,12 @@ export default class LogsTail extends BaseCommand { async run(): Promise<void> { const {flags} = await this.parse(LogsTail) - const session = await this.developerSession({ + const connection = await this.developerConnection({ ...flags, owner: flags.owner ?? 'project', }) - const projectId = session.context.projectId - if (session.context.owner !== 'project' || !projectId) { + const projectId = connection.context.projectId + if (connection.context.owner !== 'project' || !projectId) { throw new CliConditionError( 'action_required', 'Request logs belong to a project. Pass --project or use a project token.', @@ -79,7 +79,7 @@ export default class LogsTail extends BaseCommand { `Following request logs for project ${projectId}. Press Ctrl-C to stop.\n`, ) } - for await (const log of tailRequestLogs(session.client, projectId, { + for await (const log of tailRequestLogs(connection.client, projectId, { ...requestLogFilters(flags), backfill: flags.backfill, intervalMs: flags['poll-interval'] * 1000, diff --git a/src/commands/message/delete.ts b/src/commands/message/delete.ts index 1ba6abb7..46aae84d 100644 --- a/src/commands/message/delete.ts +++ b/src/commands/message/delete.ts @@ -18,7 +18,7 @@ export default class MessageDelete extends BaseCommand { 'Delete a message you sent for everyone in the conversation.' static override examples = [ - '<%= config.bin %> message delete 740000000001 --session session_123 --chat 730000000001 --yes', + '<%= config.bin %> message delete 740000000001 --connection connection_123 --chat 730000000001 --yes', ] static override flags = { @@ -31,8 +31,8 @@ export default class MessageDelete extends BaseCommand { description: 'Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), yes: Flags.boolean({ @@ -48,7 +48,7 @@ export default class MessageDelete extends BaseCommand { }) const result = await deleteMessage( await this.messagingClient(flags), - flags.session, + flags.connection, flags.chat, args.message, { diff --git a/src/commands/message/edit.ts b/src/commands/message/edit.ts index fd9b5f39..ca2f678f 100644 --- a/src/commands/message/edit.ts +++ b/src/commands/message/edit.ts @@ -16,7 +16,7 @@ export default class MessageEdit extends BaseCommand { static override description = 'Replace the text of a message you sent.' static override examples = [ - '<%= config.bin %> message edit 740000000001 --session session_123 --chat 730000000001 --body "Corrected text"', + '<%= config.bin %> message edit 740000000001 --connection connection_123 --chat 730000000001 --body "Corrected text"', ] static override flags = { @@ -30,8 +30,8 @@ export default class MessageEdit extends BaseCommand { description: 'Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -40,7 +40,7 @@ export default class MessageEdit extends BaseCommand { const {args, flags} = await this.parse(MessageEdit) const result = await editMessage( await this.messagingClient(flags), - flags.session, + flags.connection, flags.chat, args.message, flags.body, diff --git a/src/commands/message/mark-seen.ts b/src/commands/message/mark-seen.ts index 2d1e1d81..4d4c99b7 100644 --- a/src/commands/message/mark-seen.ts +++ b/src/commands/message/mark-seen.ts @@ -19,8 +19,8 @@ export default class MessageMarkSeen extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this seen receipt.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -29,7 +29,7 @@ export default class MessageMarkSeen extends BaseCommand { const {args, flags} = await this.parse(MessageMarkSeen) const result = await markMessageSeen( await this.messagingClient(flags), - flags.session, + flags.connection, {conversation: conversationReference(flags.chat), id: args.message}, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/message/operation-status.ts b/src/commands/message/operation-status.ts index 0ae4613f..8e769f60 100644 --- a/src/commands/message/operation-status.ts +++ b/src/commands/message/operation-status.ts @@ -11,8 +11,8 @@ export default class MessageOperationStatus extends BaseCommand { }), } static override flags = { - session: Flags.string({ - description: 'Number session name.', + connection: Flags.string({ + description: 'Connection name.', required: true, }), } @@ -22,7 +22,7 @@ export default class MessageOperationStatus extends BaseCommand { serverCredentialOnly: 'Message operation status', }) const response = await client.messages.operationStatus( - flags.session, + flags.connection, args.operation, ) const value = response.data.data diff --git a/src/commands/message/react.ts b/src/commands/message/react.ts index 7dd01906..ae8fbad0 100644 --- a/src/commands/message/react.ts +++ b/src/commands/message/react.ts @@ -24,8 +24,8 @@ export default class MessageReact extends BaseCommand { description: 'Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key across process retries (1-hour retention).', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -34,7 +34,7 @@ export default class MessageReact extends BaseCommand { const {args, flags} = await this.parse(MessageReact) const result = await reactToMessage( await this.messagingClient(flags), - flags.session, + flags.connection, { conversation: conversationReference(flags.chat), id: args.message, diff --git a/src/commands/message/send/audio.ts b/src/commands/message/send/audio.ts index f1113a83..242ecd1f 100644 --- a/src/commands/message/send/audio.ts +++ b/src/commands/message/send/audio.ts @@ -17,8 +17,8 @@ export default class MessageSendAudio extends BaseCommand { 'Send audio or a voice note from a local file or URL.' static override examples = [ - '<%= config.bin %> message send audio --session session_123 --to +15551234567 --file ./note.ogg', - '<%= config.bin %> message send audio --session session_123 --to +15551234567 --url https://example.com/note.ogg', + '<%= config.bin %> message send audio --connection connection_123 --to +15551234567 --file ./note.ogg', + '<%= config.bin %> message send audio --connection connection_123 --to +15551234567 --url https://example.com/note.ogg', ] static override flags = { @@ -35,7 +35,7 @@ export default class MessageSendAudio extends BaseCommand { const request = await mediaSendRequest('audio', flags) const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, sendIdempotencyOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/send/buttons.ts b/src/commands/message/send/buttons.ts index 19bfef03..04463880 100644 --- a/src/commands/message/send/buttons.ts +++ b/src/commands/message/send/buttons.ts @@ -15,8 +15,8 @@ export default class MessageSendButtons extends BaseCommand { 'Send an interactive message with reply, URL, call, or copy-code buttons.' static override examples = [ - '<%= config.bin %> message send buttons --session session_123 --to +15551234567 --body "Confirm your order?" --button reply:yes=Yes --button reply:no=No', - '<%= config.bin %> message send buttons --session session_123 --to +15551234567 --body "Track it" --button "url:Open tracking=https://example.com/t/123"', + '<%= config.bin %> message send buttons --connection connection_123 --to +15551234567 --body "Confirm your order?" --button reply:yes=Yes --button reply:no=No', + '<%= config.bin %> message send buttons --connection connection_123 --to +15551234567 --body "Track it" --button "url:Open tracking=https://example.com/t/123"', ] static override flags = { @@ -47,7 +47,7 @@ export default class MessageSendButtons extends BaseCommand { } const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, sendIdempotencyOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/send/contact.ts b/src/commands/message/send/contact.ts index 19da0d26..19c04702 100644 --- a/src/commands/message/send/contact.ts +++ b/src/commands/message/send/contact.ts @@ -20,8 +20,8 @@ export default class MessageSendContact extends BaseCommand { 'Send a contact card built from flags or read from a vCard file.' static override examples = [ - '<%= config.bin %> message send contact --session session_123 --to +15551234567 --name "Ada Lovelace" --phone +15557654321', - '<%= config.bin %> message send contact --session session_123 --to +15551234567 --vcard ./ada.vcf', + '<%= config.bin %> message send contact --connection connection_123 --to +15551234567 --name "Ada Lovelace" --phone +15557654321', + '<%= config.bin %> message send contact --connection connection_123 --to +15551234567 --vcard ./ada.vcf', ] static override flags = { @@ -35,7 +35,8 @@ export default class MessageSendContact extends BaseCommand { exclusive: ['vcard'], }), phone: Flags.string({ - description: 'Contact E.164 phone number. Repeat for several numbers.', + description: + 'Contact E.164 phone number. Repeat for several phone numbers.', exclusive: ['vcard'], multiple: true, }), @@ -69,7 +70,7 @@ export default class MessageSendContact extends BaseCommand { } const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, sendIdempotencyOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/send/document.ts b/src/commands/message/send/document.ts index 388de690..9aeba696 100644 --- a/src/commands/message/send/document.ts +++ b/src/commands/message/send/document.ts @@ -16,8 +16,8 @@ export default class MessageSendDocument extends BaseCommand { static override description = 'Send a document from a local file or URL.' static override examples = [ - '<%= config.bin %> message send document --session session_123 --to +15551234567 --file ./invoice.pdf', - '<%= config.bin %> message send document --session session_123 --to +15551234567 --url https://example.com/invoice.pdf', + '<%= config.bin %> message send document --connection connection_123 --to +15551234567 --file ./invoice.pdf', + '<%= config.bin %> message send document --connection connection_123 --to +15551234567 --url https://example.com/invoice.pdf', ] static override flags = { @@ -35,7 +35,7 @@ export default class MessageSendDocument extends BaseCommand { const request = await mediaSendRequest('document', flags) const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, sendIdempotencyOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/send/image.ts b/src/commands/message/send/image.ts index 9c86fe4f..404fa2cb 100644 --- a/src/commands/message/send/image.ts +++ b/src/commands/message/send/image.ts @@ -16,8 +16,8 @@ export default class MessageSendImage extends BaseCommand { static override description = 'Send an image from a local file or URL.' static override examples = [ - '<%= config.bin %> message send image --session session_123 --to +15551234567 --file ./photo.jpg', - '<%= config.bin %> message send image --session session_123 --to +15551234567 --url https://example.com/photo.jpg', + '<%= config.bin %> message send image --connection connection_123 --to +15551234567 --file ./photo.jpg', + '<%= config.bin %> message send image --connection connection_123 --to +15551234567 --url https://example.com/photo.jpg', ] static override flags = { @@ -31,7 +31,7 @@ export default class MessageSendImage extends BaseCommand { const request = await mediaSendRequest('image', flags) const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, sendIdempotencyOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/send/list.ts b/src/commands/message/send/list.ts index d26d6c1f..34b0555c 100644 --- a/src/commands/message/send/list.ts +++ b/src/commands/message/send/list.ts @@ -15,7 +15,7 @@ export default class MessageSendList extends BaseCommand { 'Send an interactive list message with selectable rows.' static override examples = [ - '<%= config.bin %> message send list --session session_123 --to +15551234567 --title "Pick a slot" --button-text Choose --row "Morning/am9=9:00" --row "Afternoon/pm2=14:00|Near the office"', + '<%= config.bin %> message send list --connection connection_123 --to +15551234567 --title "Pick a slot" --button-text Choose --row "Morning/am9=9:00" --row "Afternoon/pm2=14:00|Near the office"', ] static override flags = { @@ -53,7 +53,7 @@ export default class MessageSendList extends BaseCommand { } const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, sendIdempotencyOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/send/location.ts b/src/commands/message/send/location.ts index ad915957..1e6f41e3 100644 --- a/src/commands/message/send/location.ts +++ b/src/commands/message/send/location.ts @@ -14,7 +14,7 @@ export default class MessageSendLocation extends BaseCommand { static override description = 'Send a location pin.' static override examples = [ - '<%= config.bin %> message send location --session session_123 --to +15551234567 --lat 51.5007 --long=-0.1246 --address "Westminster, London"', + '<%= config.bin %> message send location --connection connection_123 --to +15551234567 --lat 51.5007 --long=-0.1246 --address "Westminster, London"', ] static override flags = { @@ -42,7 +42,7 @@ export default class MessageSendLocation extends BaseCommand { } const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, sendIdempotencyOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/send/order-status.ts b/src/commands/message/send/order-status.ts index 6473eae2..a5ac00a7 100644 --- a/src/commands/message/send/order-status.ts +++ b/src/commands/message/send/order-status.ts @@ -41,7 +41,7 @@ export default class MessageSendOrderStatus extends BaseCommand { 'Update a Brazil order sent with "message send order" (beta). Send a payment status only after your payment provider confirms it; captured shows the order as paid. Makes one attempt.' static override examples = [ - '<%= config.bin %> message send order-status --session session_123 --to +5511987654321 --reference-id order-1522 --body "Payment received" --order-status processing --payment-status captured', + '<%= config.bin %> message send order-status --connection connection_123 --to +5511987654321 --reference-id order-1522 --body "Payment received" --order-status processing --payment-status captured', ] static override flags = { @@ -116,7 +116,7 @@ export default class MessageSendOrderStatus extends BaseCommand { } const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, paymentOrderRequestOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/send/order.ts b/src/commands/message/send/order.ts index 7fc2aaa1..14cd6ddd 100644 --- a/src/commands/message/send/order.ts +++ b/src/commands/message/send/order.ts @@ -25,11 +25,11 @@ const REQUIRED_KEYS = [ export default class MessageSendOrder extends BaseCommand { static override description = - 'Send a Brazil order with Pix, payment link or boleto instructions (beta; Official API Numbers only). Polymorfa relays the order and does not process the payment. Makes one attempt.' + 'Send a Brazil order with Pix, payment link or boleto instructions (beta; Official API Connections only). Polymorfa relays the order and does not process the payment. Makes one attempt.' static override examples = [ - '<%= config.bin %> message send order --session session_123 --to +5511987654321 --order order.json', - 'cat order.json | <%= config.bin %> message send order --session session_123 --to +5511987654321 --order - --idempotency-key order-1522', + '<%= config.bin %> message send order --connection connection_123 --to +5511987654321 --order order.json', + 'cat order.json | <%= config.bin %> message send order --connection connection_123 --to +5511987654321 --order - --idempotency-key order-1522', ] static override flags = { @@ -69,7 +69,7 @@ export default class MessageSendOrder extends BaseCommand { } const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, paymentOrderRequestOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/send/poll.ts b/src/commands/message/send/poll.ts index dbe87930..b339f11e 100644 --- a/src/commands/message/send/poll.ts +++ b/src/commands/message/send/poll.ts @@ -16,7 +16,7 @@ export default class MessageSendPoll extends BaseCommand { static override description = 'Send a poll.' static override examples = [ - '<%= config.bin %> message send poll --session session_123 --to 730000000001 --title "Lunch?" --option Pizza --option Sushi', + '<%= config.bin %> message send poll --connection connection_123 --to 730000000001 --title "Lunch?" --option Pizza --option Sushi', ] static override flags = { @@ -71,7 +71,7 @@ export default class MessageSendPoll extends BaseCommand { } const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, sendIdempotencyOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/send/template.ts b/src/commands/message/send/template.ts index fdd3a327..6eb7e1cf 100644 --- a/src/commands/message/send/template.ts +++ b/src/commands/message/send/template.ts @@ -18,8 +18,8 @@ export default class MessageSendTemplate extends BaseCommand { 'Send an approved message template by name and language.' static override examples = [ - '<%= config.bin %> message send template --session session_123 --to +15551234567 --name order_update --language en_US', - '<%= config.bin %> message send template --session session_123 --to +15551234567 --name order_update --language en_US --components components.json', + '<%= config.bin %> message send template --connection connection_123 --to +15551234567 --name order_update --language en_US', + '<%= config.bin %> message send template --connection connection_123 --to +15551234567 --name order_update --language en_US --components components.json', ] static override flags = { @@ -60,7 +60,7 @@ export default class MessageSendTemplate extends BaseCommand { } const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, sendIdempotencyOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/send/text.ts b/src/commands/message/send/text.ts index 82552ff9..59318828 100644 --- a/src/commands/message/send/text.ts +++ b/src/commands/message/send/text.ts @@ -31,8 +31,8 @@ export default class MessageSendText extends BaseCommand { 'reply-to': Flags.string({ description: 'Polymorfa message ID to quote in the reply.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), to: Flags.string({ @@ -61,7 +61,7 @@ export default class MessageSendText extends BaseCommand { } const result = await sendTextMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, {idempotencyKey: idempotencyKey(flags['idempotency-key'])}, ) diff --git a/src/commands/message/send/video.ts b/src/commands/message/send/video.ts index 53d52a4a..53dd0647 100644 --- a/src/commands/message/send/video.ts +++ b/src/commands/message/send/video.ts @@ -16,8 +16,8 @@ export default class MessageSendVideo extends BaseCommand { static override description = 'Send a video from a local file or URL.' static override examples = [ - '<%= config.bin %> message send video --session session_123 --to +15551234567 --file ./clip.mp4', - '<%= config.bin %> message send video --session session_123 --to +15551234567 --url https://example.com/clip.mp4', + '<%= config.bin %> message send video --connection connection_123 --to +15551234567 --file ./clip.mp4', + '<%= config.bin %> message send video --connection connection_123 --to +15551234567 --url https://example.com/clip.mp4', ] static override flags = { @@ -31,7 +31,7 @@ export default class MessageSendVideo extends BaseCommand { const request = await mediaSendRequest('video', flags) const result = await sendMessage( await this.messagingClient(flags), - flags.session, + flags.connection, request, sendIdempotencyOptions(flags['idempotency-key']), ) diff --git a/src/commands/message/star.ts b/src/commands/message/star.ts index 2a78725b..10f7e96e 100644 --- a/src/commands/message/star.ts +++ b/src/commands/message/star.ts @@ -20,8 +20,8 @@ export default class MessageStar extends BaseCommand { description: 'Safely identify retries of this star update.', }), remove: Flags.boolean({description: 'Remove the existing star.'}), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -30,7 +30,7 @@ export default class MessageStar extends BaseCommand { const {args, flags} = await this.parse(MessageStar) const result = await setMessageStar( await this.messagingClient(flags), - flags.session, + flags.connection, { conversation: conversationReference(flags.chat), id: args.message, diff --git a/src/commands/message/typing.ts b/src/commands/message/typing.ts index 9024c5b4..ec6596c5 100644 --- a/src/commands/message/typing.ts +++ b/src/commands/message/typing.ts @@ -8,7 +8,7 @@ const states = ['typing', 'recording', 'paused'] as const export default class MessageTyping extends BaseCommand { static override description = - 'Set typing for a chat. Official Numbers require --id and --state typing; the inbound message is marked read.' + 'Set typing for a chat. Official Connections require --id and --state typing; the inbound message is marked read.' static override flags = { chat: Flags.string({ @@ -17,14 +17,14 @@ export default class MessageTyping extends BaseCommand { }), id: Flags.string({ description: - 'Inbound message ID. Required on Official Numbers; marks the message read and shows typing for up to 25 seconds.', + 'Inbound message ID. Required on Official Connections; marks the message read and shows typing for up to 25 seconds.', }), 'idempotency-key': Flags.string({ description: 'Request identifier. The API does not deduplicate typing updates by this header.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), state: Flags.option({ @@ -38,7 +38,7 @@ export default class MessageTyping extends BaseCommand { const {flags} = await this.parse(MessageTyping) const result = await setMessageTyping( await this.messagingClient(flags), - flags.session, + flags.connection, { conversation: conversationReference(flags.chat), state: flags.state, diff --git a/src/commands/operation/cancel.ts b/src/commands/operation/cancel.ts index 69d44794..2082d533 100644 --- a/src/commands/operation/cancel.ts +++ b/src/commands/operation/cancel.ts @@ -27,17 +27,17 @@ export default class OperationCancel extends BaseCommand { prompt: `Cancel operation ${args.operation}? This stops the work it performs.`, yes: flags.yes, }) - const session = await this.developerSession(flags) + const connection = await this.developerConnection(flags) const key = idempotencyKey(flags['idempotency-key']) - const response = await operationsFor(session).cancel(args.operation, { - ...session.requestOptions, + const response = await operationsFor(connection).cancel(args.operation, { + ...connection.requestOptions, idempotencyKey: key, }) const receipt = record(response.data, 'Operation cancellation') const operation = record(receipt.operation, 'Operation') this.writeValue( developerMutation({ - context: session.context, + context: connection.context, metadata: response.metadata, receipt, resource: {id: stringField(receipt, 'operationId'), type: 'operation'}, diff --git a/src/commands/operation/list.ts b/src/commands/operation/list.ts index 7514ae41..f4ef6f3b 100644 --- a/src/commands/operation/list.ts +++ b/src/commands/operation/list.ts @@ -60,11 +60,11 @@ export default class OperationList extends BaseCommand { flags.until, ]) const time = optionalTimeRange(flags.since, flags.until) - const session = await this.developerSession(flags) + const connection = await this.developerConnection(flags) const result = await listResources( paginationInput(flags), ({cursor, limit}) => - operationsFor(session).list( + operationsFor(connection).list( { ...(cursor === undefined ? {} : {cursor}), limit, @@ -78,14 +78,14 @@ export default class OperationList extends BaseCommand { resourceType: flags['resource-type'], }), }, - session.requestOptions, + connection.requestOptions, ), ) this.writeValue( developerRead( result.items, result.metadata, - session.context, + connection.context, result.page, ), result.items.length === 0 diff --git a/src/commands/operation/view.ts b/src/commands/operation/view.ts index ac73eb96..2e0ec69d 100644 --- a/src/commands/operation/view.ts +++ b/src/commands/operation/view.ts @@ -15,14 +15,14 @@ export default class OperationView extends BaseCommand { async run(): Promise<void> { const {args, flags} = await this.parse(OperationView) - const session = await this.developerSession(flags) - const response = await operationsFor(session).get( + const connection = await this.developerConnection(flags) + const response = await operationsFor(connection).get( args.operation, {}, - session.requestOptions, + connection.requestOptions, ) this.writeValue( - developerResponse(response, session.context), + developerResponse(response, connection.context), renderOperation(response.data), flags, ) diff --git a/src/commands/operation/wait.ts b/src/commands/operation/wait.ts index ef651110..863e930c 100644 --- a/src/commands/operation/wait.ts +++ b/src/commands/operation/wait.ts @@ -28,14 +28,17 @@ export default class OperationWait extends BaseCommand { const {args, flags} = await this.parse(OperationWait) // --timeout here is the wait budget in seconds. It replaces the global // per-request timeout (milliseconds), so it must not reach the client. - const session = await this.developerSession({...flags, timeout: undefined}) - const response = await operationsFor(session).wait(args.operation, { + const connection = await this.developerConnection({ + ...flags, + timeout: undefined, + }) + const response = await operationsFor(connection).wait(args.operation, { maxWaitMs: flags.timeout * 1000, - requestOptions: session.requestOptions, + requestOptions: connection.requestOptions, }) const operation = response.data this.writeValue( - developerResponse(response, session.context), + developerResponse(response, connection.context), renderOperation(operation), flags, ) diff --git a/src/commands/operation/watch.ts b/src/commands/operation/watch.ts index 432925e0..73d5995c 100644 --- a/src/commands/operation/watch.ts +++ b/src/commands/operation/watch.ts @@ -30,11 +30,14 @@ export default class OperationWatch extends BaseCommand { const {args, flags} = await this.parse(OperationWatch) // --timeout here is the wait budget in seconds. It replaces the global // per-request timeout (milliseconds), so it must not reach the client. - const session = await this.developerSession({...flags, timeout: undefined}) + const connection = await this.developerConnection({ + ...flags, + timeout: undefined, + }) const deadline = Date.now() + flags.timeout * 1000 let afterSequence: number | undefined for (;;) { - const operations = operationsFor(session) + const operations = operationsFor(connection) // The first read reports the current state; later reads long-poll // for the next transition. const response = @@ -42,19 +45,19 @@ export default class OperationWatch extends BaseCommand { ? await this.firstRead( operations, args.operation, - session.requestOptions, + connection.requestOptions, deadline, flags.timeout, ) : await operations.wait(args.operation, { afterSequence, maxWaitMs: Math.max(0, deadline - Date.now()), - requestOptions: session.requestOptions, + requestOptions: connection.requestOptions, }) const operation = response.data if (afterSequence === undefined || operation.sequence > afterSequence) { this.writeValue( - developerResponse(response, session.context), + developerResponse(response, connection.context), renderOperationLine(operation), flags, ) diff --git a/src/commands/presence/chat/subscribe.ts b/src/commands/presence/chat/subscribe.ts index 277df910..e20debc6 100644 --- a/src/commands/presence/chat/subscribe.ts +++ b/src/commands/presence/chat/subscribe.ts @@ -15,8 +15,8 @@ export default class PresenceChatSubscribe extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this subscription request.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -25,7 +25,7 @@ export default class PresenceChatSubscribe extends BaseCommand { const {args, flags} = await this.parse(PresenceChatSubscribe) const result = await subscribeToChatPresence( await this.messagingClient(flags), - flags.session, + flags.connection, args.chat, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/presence/chat/view.ts b/src/commands/presence/chat/view.ts index 958ba21d..c02f3143 100644 --- a/src/commands/presence/chat/view.ts +++ b/src/commands/presence/chat/view.ts @@ -18,8 +18,8 @@ export default class PresenceChatView extends BaseCommand { 'View retained, policy-governed presence observations for a chat.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -28,7 +28,7 @@ export default class PresenceChatView extends BaseCommand { const {args, flags} = await this.parse(PresenceChatView) const result = await viewChatPresence( await this.messagingClient(flags), - flags.session, + flags.connection, args.chat, ) this.writeValue(result, renderChatPresence(result.data), flags) diff --git a/src/commands/presence/set.ts b/src/commands/presence/set.ts index 56f1527b..b433a7cf 100644 --- a/src/commands/presence/set.ts +++ b/src/commands/presence/set.ts @@ -11,8 +11,8 @@ export default class PresenceSet extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this presence update.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), state: Flags.option({ @@ -26,7 +26,7 @@ export default class PresenceSet extends BaseCommand { const {flags} = await this.parse(PresenceSet) const result = await setPresence( await this.messagingClient(flags, {serverApiKeyOnly: 'Presence state'}), - flags.session, + flags.connection, flags.state, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/presence/view.ts b/src/commands/presence/view.ts index 82b342bf..b22ff112 100644 --- a/src/commands/presence/view.ts +++ b/src/commands/presence/view.ts @@ -8,8 +8,8 @@ export default class PresenceView extends BaseCommand { 'View remembered self presence state (not a live authoritative query).' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -18,7 +18,7 @@ export default class PresenceView extends BaseCommand { const {flags} = await this.parse(PresenceView) const result = await viewPresence( await this.messagingClient(flags), - flags.session, + flags.connection, ) this.writeValue(result, renderPresence(result.data), flags) } diff --git a/src/commands/privacy/disappearing-timer/set.ts b/src/commands/privacy/disappearing-timer/set.ts index 8d712fe7..3c2c4ee5 100644 --- a/src/commands/privacy/disappearing-timer/set.ts +++ b/src/commands/privacy/disappearing-timer/set.ts @@ -19,8 +19,8 @@ export default class PrivacyDisappearingTimerSet extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this timer update.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -29,7 +29,7 @@ export default class PrivacyDisappearingTimerSet extends BaseCommand { const {flags} = await this.parse(PrivacyDisappearingTimerSet) const result = await setDefaultDisappearingTimer( await this.messagingClient(flags, {serverApiKeyOnly: 'Privacy'}), - flags.session, + flags.connection, flags.duration as PrivacyTimerDuration, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/privacy/set.ts b/src/commands/privacy/set.ts index 78197135..d56b2982 100644 --- a/src/commands/privacy/set.ts +++ b/src/commands/privacy/set.ts @@ -10,8 +10,8 @@ export default class PrivacySet extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this privacy update.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), setting: Flags.string({ @@ -28,7 +28,7 @@ export default class PrivacySet extends BaseCommand { const {flags} = await this.parse(PrivacySet) const result = await setPrivacy( await this.messagingClient(flags, {serverApiKeyOnly: 'Privacy'}), - flags.session, + flags.connection, flags.setting, flags.value, flags['idempotency-key'] === undefined diff --git a/src/commands/privacy/view.ts b/src/commands/privacy/view.ts index de85dee2..20dda927 100644 --- a/src/commands/privacy/view.ts +++ b/src/commands/privacy/view.ts @@ -7,8 +7,8 @@ export default class PrivacyView extends BaseCommand { static override description = 'View account-level Messaging privacy settings.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -17,7 +17,7 @@ export default class PrivacyView extends BaseCommand { const {flags} = await this.parse(PrivacyView) const result = await viewPrivacy( await this.messagingClient(flags, {serverApiKeyOnly: 'Privacy'}), - flags.session, + flags.connection, ) this.writeValue(result, renderPrivacy(result.data), flags) } diff --git a/src/commands/profile/name/set.ts b/src/commands/profile/name/set.ts index c48323dc..d20d4659 100644 --- a/src/commands/profile/name/set.ts +++ b/src/commands/profile/name/set.ts @@ -11,8 +11,8 @@ export default class ProfileNameSet extends BaseCommand { description: 'Safely identify retries of this name update.', }), name: Flags.string({description: 'Complete profile name.', required: true}), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -21,7 +21,7 @@ export default class ProfileNameSet extends BaseCommand { const {flags} = await this.parse(ProfileNameSet) const result = await setProfileName( await this.messagingClient(flags, {serverApiKeyOnly: 'Profile'}), - flags.session, + flags.connection, flags.name, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/profile/picture/delete.ts b/src/commands/profile/picture/delete.ts index 9318ea29..4f4bc3d3 100644 --- a/src/commands/profile/picture/delete.ts +++ b/src/commands/profile/picture/delete.ts @@ -10,8 +10,8 @@ export default class ProfilePictureDelete extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this picture deletion.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), yes: Flags.boolean({ @@ -24,7 +24,7 @@ export default class ProfilePictureDelete extends BaseCommand { const {flags} = await this.parse(ProfilePictureDelete) const result = await deleteProfilePicture( await this.messagingClient(flags, {serverApiKeyOnly: 'Profile'}), - flags.session, + flags.connection, flags['idempotency-key'] === undefined ? {} : {idempotencyKey: flags['idempotency-key']}, diff --git a/src/commands/profile/picture/set.ts b/src/commands/profile/picture/set.ts index 4c323163..ab15ee77 100644 --- a/src/commands/profile/picture/set.ts +++ b/src/commands/profile/picture/set.ts @@ -14,8 +14,8 @@ export default class ProfilePictureSet extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this picture update.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), url: Flags.string({ @@ -28,7 +28,7 @@ export default class ProfilePictureSet extends BaseCommand { const {flags} = await this.parse(ProfilePictureSet) const result = await setProfilePicture( await this.messagingClient(flags, {serverApiKeyOnly: 'Profile'}), - flags.session, + flags.connection, { ...(flags.file === undefined ? {} : {file: flags.file}), ...(flags.url === undefined ? {} : {url: flags.url}), diff --git a/src/commands/profile/status/set.ts b/src/commands/profile/status/set.ts index e1575819..ab9b0e7b 100644 --- a/src/commands/profile/status/set.ts +++ b/src/commands/profile/status/set.ts @@ -10,8 +10,8 @@ export default class ProfileStatusSet extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this status update.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), status: Flags.string({ @@ -24,7 +24,7 @@ export default class ProfileStatusSet extends BaseCommand { const {flags} = await this.parse(ProfileStatusSet) const result = await setProfileStatus( await this.messagingClient(flags, {serverApiKeyOnly: 'Profile'}), - flags.session, + flags.connection, flags.status, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/profile/view.ts b/src/commands/profile/view.ts index 55f795d7..9160f940 100644 --- a/src/commands/profile/view.ts +++ b/src/commands/profile/view.ts @@ -7,8 +7,8 @@ export default class ProfileView extends BaseCommand { static override description = 'View the connected account profile.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -17,7 +17,7 @@ export default class ProfileView extends BaseCommand { const {flags} = await this.parse(ProfileView) const result = await viewProfile( await this.messagingClient(flags, {serverApiKeyOnly: 'Profile'}), - flags.session, + flags.connection, ) this.writeValue(result, renderProfile(result.data), flags) } diff --git a/src/commands/quick-reply/create.ts b/src/commands/quick-reply/create.ts index 6d2eb307..38f9e9a6 100644 --- a/src/commands/quick-reply/create.ts +++ b/src/commands/quick-reply/create.ts @@ -19,8 +19,8 @@ export default class QuickReplyCreate extends BaseCommand { description: 'Complete reply message.', required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), shortcut: Flags.string({ @@ -33,7 +33,7 @@ export default class QuickReplyCreate extends BaseCommand { const {flags} = await this.parse(QuickReplyCreate) const result = await createQuickReply( await this.messagingClient(flags, {serverApiKeyOnly: 'Quick Reply'}), - flags.session, + flags.connection, { message: flags.message, shortcut: flags.shortcut, diff --git a/src/commands/quick-reply/delete.ts b/src/commands/quick-reply/delete.ts index 328c492f..6c76e86a 100644 --- a/src/commands/quick-reply/delete.ts +++ b/src/commands/quick-reply/delete.ts @@ -17,8 +17,8 @@ export default class QuickReplyDelete extends BaseCommand { 'idempotency-key': Flags.string({ description: 'Safely identify retries of this delete operation.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), yes: Flags.boolean({ @@ -32,7 +32,7 @@ export default class QuickReplyDelete extends BaseCommand { const id = args['quick-reply'] const result = await deleteQuickReply( await this.messagingClient(flags, {serverApiKeyOnly: 'Quick Reply'}), - flags.session, + flags.connection, id, flags['idempotency-key'] === undefined ? {} diff --git a/src/commands/quick-reply/list.ts b/src/commands/quick-reply/list.ts index 15ab8ccf..c69e298e 100644 --- a/src/commands/quick-reply/list.ts +++ b/src/commands/quick-reply/list.ts @@ -4,11 +4,11 @@ import {BaseCommand} from '../../base-command.js' import {listQuickReplies} from '../../services/quick-replies.js' export default class QuickReplyList extends BaseCommand { - static override description = 'List observed quick replies for a session.' + static override description = 'List observed quick replies for a connection.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -17,7 +17,7 @@ export default class QuickReplyList extends BaseCommand { const {flags} = await this.parse(QuickReplyList) const result = await listQuickReplies( await this.messagingClient(flags, {serverApiKeyOnly: 'Quick Reply'}), - flags.session, + flags.connection, ) const replies = result.data.quickReplies const human = diff --git a/src/commands/quick-reply/replace.ts b/src/commands/quick-reply/replace.ts index 1930772a..038ef9b8 100644 --- a/src/commands/quick-reply/replace.ts +++ b/src/commands/quick-reply/replace.ts @@ -26,8 +26,8 @@ export default class QuickReplyReplace extends BaseCommand { description: 'Complete reply message.', required: true, }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), shortcut: Flags.string({ @@ -40,7 +40,7 @@ export default class QuickReplyReplace extends BaseCommand { const {args, flags} = await this.parse(QuickReplyReplace) const result = await replaceQuickReply( await this.messagingClient(flags, {serverApiKeyOnly: 'Quick Reply'}), - flags.session, + flags.connection, args['quick-reply'], { message: flags.message, diff --git a/src/commands/quicklink/availability.ts b/src/commands/quicklink/availability.ts index b38c2150..fc4429fd 100644 --- a/src/commands/quicklink/availability.ts +++ b/src/commands/quicklink/availability.ts @@ -3,10 +3,10 @@ import {BaseCommand} from '../../base-command.js' export default class QuickLinkAvailability extends BaseCommand { static override description = - 'Read a Number’s connections and whether an added connection is available.' + 'Read a Connection’s methods and whether another method is available.' static override flags = { - session: Flags.string({ - description: 'Existing Number session name.', + connection: Flags.string({ + description: 'Existing Connection name.', required: true, }), } @@ -15,10 +15,10 @@ export default class QuickLinkAvailability extends BaseCommand { const {client, projectId} = await this.quickLinksClient(flags) const response = await client.quickLinks.availability({ projectId, - session: flags.session, + connection: flags.connection, }) const data = response.data.data - const connections = data.connections + const methods = data.methods .map( ({kind, status, enabled}) => `${kind}: ${status} (${enabled ? 'enabled' : 'disabled'})`, @@ -27,10 +27,10 @@ export default class QuickLinkAvailability extends BaseCommand { this.writeValue( response, [ - data.allowed && data.addConnection - ? `Available: ${data.addConnection}` - : 'No added connection is available.', - `Connections: ${connections || 'none'}`, + data.allowed && data.addMethod + ? `Available: ${data.addMethod}` + : 'No added method is available.', + `Methods: ${methods || 'none'}`, ...(data.resumeQuickLinkId ? [`Resume QuickLink: ${data.resumeQuickLinkId}`] : []), diff --git a/src/commands/quicklink/cancel.ts b/src/commands/quicklink/cancel.ts index 6008e7d5..801cec69 100644 --- a/src/commands/quicklink/cancel.ts +++ b/src/commands/quicklink/cancel.ts @@ -9,7 +9,7 @@ export default class QuickLinkCancel extends BaseCommand { } static override description = - 'Cancel pending QuickLink setup. Supplementary links preserve the existing Number.' + 'Cancel pending QuickLink setup. Supplementary links preserve the existing Connection.' static override flags = { yes: Flags.boolean({description: 'Confirm QuickLink cancellation.'}), diff --git a/src/commands/quicklink/create.ts b/src/commands/quicklink/create.ts index aa633800..a306209b 100644 --- a/src/commands/quicklink/create.ts +++ b/src/commands/quicklink/create.ts @@ -11,19 +11,19 @@ export default class QuickLinkCreate extends BaseCommand { 'Create a persistent real or simulated onboarding QuickLink.' static override flags = { purpose: Flags.string({ - options: ['initial', 'add_connection'] as const, - description: 'Initial setup or add a connection to an existing Number.', + options: ['initial', 'add_method'] as const, + description: 'Initial setup or add a method to an existing Connection.', }), 'connection-goal': Flags.string({ options: ['single', 'hybrid'] as const, - description: 'One connection or authorized Hybrid setup.', + description: 'One method or authorized Hybrid setup.', }), - session: Flags.string({ - description: 'Existing Number for an added connection.', + connection: Flags.string({ + description: 'Existing Connection for an added method.', }), - 'add-connection': Flags.string({ + 'add-method': Flags.string({ options: ['linked_devices', 'official_api'] as const, - description: 'Missing connection to add.', + description: 'Missing method to add.', }), 'limit-credits': Flags.string({ description: @@ -32,11 +32,11 @@ export default class QuickLinkCreate extends BaseCommand { priority: Flags.integer({ min: 0, max: 1000000, - description: 'Initial number funding priority.', + description: 'Initial Connection funding priority.', }), 'account-type': Flags.string({ options: [...testingAccountTypes], - description: 'Create a Test number in this account mode.', + description: 'Create a Test Connection in this account mode.', }), 'primary-platform': Flags.string({ options: ['android', 'ios'], @@ -61,8 +61,8 @@ export default class QuickLinkCreate extends BaseCommand { for (const [key, value] of Object.entries({ purpose: flags.purpose, connectionGoal: flags['connection-goal'], - session: flags.session, - addConnection: flags['add-connection'], + connection: flags.connection, + addMethod: flags['add-method'], })) { if (value === undefined) continue if (body[key] !== undefined && body[key] !== value) @@ -123,11 +123,11 @@ export default class QuickLinkCreate extends BaseCommand { } } if ( - body.purpose === 'add_connection' && - (!body.session || !body.addConnection || body.connectionGoal === 'single') + body.purpose === 'add_method' && + (!body.connection || !body.addMethod || body.connectionGoal === 'single') ) throw new PolymorfaConfigurationError( - 'Adding a connection requires --session and --add-connection with the hybrid goal.', + 'Adding a method requires --connection and --add-method with the hybrid goal.', 'input', ) const linkedProject = await this.linkedProject(flags) diff --git a/src/commands/quicklink/view.ts b/src/commands/quicklink/view.ts index ddac9296..18aab463 100644 --- a/src/commands/quicklink/view.ts +++ b/src/commands/quicklink/view.ts @@ -15,7 +15,7 @@ export default class QuickLinkView extends BaseCommand { const response = await client.quickLinks.retrieve(args.quicklink) const quickLink = response.data.data const sync = quickLink.onboarding?.sync - const summary = `${quickLink.id}\t${quickLink.status}\t${quickLink.session}` + const summary = `${quickLink.id}\t${quickLink.status}\t${quickLink.connection}` const progress = sync === undefined ? '' diff --git a/src/commands/session-ban/list.ts b/src/commands/session-ban/list.ts deleted file mode 100644 index 0f5f60c9..00000000 --- a/src/commands/session-ban/list.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {Flags} from '@oclif/core' - -import {BaseCommand} from '../../base-command.js' -import { - listSessionBans, - renderSessionBans, -} from '../../services/platform-management.js' - -export default class SessionBanList extends BaseCommand { - static override description = 'List recorded organization session bans.' - - static override flags = { - active: Flags.boolean({description: 'Return only active bans.'}), - } - - async run(): Promise<void> { - const {flags} = await this.parse(SessionBanList) - const result = await listSessionBans( - await this.platformClient(flags), - flags.active, - ) - this.writeValue(result, renderSessionBans(result.data), flags) - } -} diff --git a/src/commands/session/capabilities.ts b/src/commands/session/capabilities.ts deleted file mode 100644 index 5711fc48..00000000 --- a/src/commands/session/capabilities.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {Args} from '@oclif/core' - -import {BaseCommand} from '../../base-command.js' -import { - getSessionCapabilities, - renderSessionCapabilities, -} from '../../services/platform-management.js' - -export default class SessionCapabilitiesCommand extends BaseCommand { - static override args = { - session: Args.string({ - description: 'Session ID or name.', - required: true, - }), - } - - static override description = - "Show the WhatsApp features and limits WhatsApp has enabled for a number, as of the number's last configuration sync. Beta: the team must be enrolled." - - static override examples = [ - '<%= config.bin %> session capabilities support-line', - '<%= config.bin %> session capabilities support-line --json', - ] - - async run(): Promise<void> { - const {args, flags} = await this.parse(SessionCapabilitiesCommand) - const result = await getSessionCapabilities( - await this.platformClient(flags), - args.session, - ) - this.writeValue(result, renderSessionCapabilities(result.data), flags) - } -} diff --git a/src/commands/session/hybrid-merge-candidates.ts b/src/commands/session/hybrid-merge-candidates.ts deleted file mode 100644 index 74d043ea..00000000 --- a/src/commands/session/hybrid-merge-candidates.ts +++ /dev/null @@ -1,32 +0,0 @@ -import {PolymorfaConfigurationError} from '@polymorfa/sdk' - -import {BaseCommand} from '../../base-command.js' -import { - listHybridMergeCandidates, - renderMergeCandidates, -} from '../../services/number-tiers.js' - -export default class SessionHybridMergeCandidates extends BaseCommand { - static override description = `List same-number Number pairs that can merge into one Hybrid Link Number. - -Each pair is one Linked Devices Number and one Official API Number that shares the number with the WhatsApp Business app. Merge an eligible pair with \`session tier quote KEEP_UUID --tier pro --merge-with OTHER_UUID\`. A Number marked "must be kept" uses hosted message storage and cannot be the one merged away. Requires Hybrid Link access.` - - static override examples = [ - '<%= config.bin %> session hybrid-merge-candidates --project PROJECT_UUID', - ] - - async run(): Promise<void> { - const {flags} = await this.parse(SessionHybridMergeCandidates) - if (flags.project === undefined || flags.project.trim().length === 0) { - throw new PolymorfaConfigurationError( - 'Provide --project with the project ID whose Numbers should be checked.', - 'project', - ) - } - const result = await listHybridMergeCandidates( - await this.platformClient(flags), - flags.project.trim(), - ) - this.writeValue(result, renderMergeCandidates(result.data), flags) - } -} diff --git a/src/commands/session/list.ts b/src/commands/session/list.ts deleted file mode 100644 index 0eb5559c..00000000 --- a/src/commands/session/list.ts +++ /dev/null @@ -1,23 +0,0 @@ -import {BaseCommand} from '../../base-command.js' -import { - listManagedSessions, - renderManagedSessions, -} from '../../services/platform-management.js' - -export default class SessionList extends BaseCommand { - static override description = - 'List session metadata for the team or one project. Requires an organization API key with sessions:read.' - static override examples = [ - '<%= config.bin %> session list', - '<%= config.bin %> session list --project PROJECT_ID --json', - ] - - async run(): Promise<void> { - const {flags} = await this.parse(SessionList) - const result = await listManagedSessions( - await this.platformClient(flags), - flags.project, - ) - this.writeValue(result, renderManagedSessions(result.data), flags) - } -} diff --git a/src/commands/session/status.ts b/src/commands/session/status.ts deleted file mode 100644 index 97e308db..00000000 --- a/src/commands/session/status.ts +++ /dev/null @@ -1,40 +0,0 @@ -import {Args} from '@oclif/core' -import {PolymorfaConfigurationError} from '@polymorfa/sdk' - -import {BaseCommand} from '../../base-command.js' -import {viewManagedSession} from '../../services/platform-management.js' - -export default class SessionStatus extends BaseCommand { - static override description = - 'Read the stored session status and reason. Requires an organization API key with sessions:read.' - static override args = { - session: Args.string({description: 'Session ID.', required: true}), - } - static override examples = ['<%= config.bin %> session status SESSION_ID'] - - async run(): Promise<void> { - const {args, flags} = await this.parse(SessionStatus) - if (flags.project !== undefined) { - throw new PolymorfaConfigurationError( - 'session status identifies a team-unique session ID; omit --project.', - 'project', - ) - } - const result = await viewManagedSession( - await this.platformClient(flags), - args.session, - ) - const status = { - sessionId: result.data.sessionId, - status: result.data.status, - ...(result.data.statusReason === undefined - ? {} - : {statusReason: result.data.statusReason}), - } - this.writeValue( - {data: status, metadata: result.metadata}, - `${status.sessionId}\t${status.status}${status.statusReason === undefined ? '' : `\t${status.statusReason}`}`, - flags, - ) - } -} diff --git a/src/commands/session/tier/quote.ts b/src/commands/session/tier/quote.ts deleted file mode 100644 index 87f0af9a..00000000 --- a/src/commands/session/tier/quote.ts +++ /dev/null @@ -1,89 +0,0 @@ -import {Args, Flags} from '@oclif/core' - -import {BaseCommand} from '../../../base-command.js' -import { - HYBRID_TRANSPORTS, - TIER_CHOICES, - quoteTierChange, - renderTierChange, - tierQuoteRequest, -} from '../../../services/number-tiers.js' - -export default class SessionTierQuote extends BaseCommand { - static override args = { - session: Args.string({ - description: - 'Number session UUID or stable slug. For a merge, this Number keeps its ID.', - required: true, - }), - } - - static override description = `Preview a Number tier change without changing the Number or spending credit. - -A Hybrid Link Number leaving Pro needs a choice: --keep one connection, or --split into two Standard Numbers. The choice runs when the paid Pro window ends. An upgrade to Pro can merge a same-number pair with --merge-with.` - - static override examples = [ - '<%= config.bin %> session tier quote support --tier pro', - '<%= config.bin %> session tier quote support --tier standard --keep linked_devices', - '<%= config.bin %> session tier quote support --tier standard --split --stay official_api --new-number-name support-linked', - '<%= config.bin %> session tier quote NUMBER_UUID --tier pro --merge-with OTHER_NUMBER_UUID', - ] - - static override flags = { - tier: Flags.string({ - description: 'Target tier. "inherit" restores the project default tier.', - options: [...TIER_CHOICES], - required: true, - }), - keep: Flags.string({ - description: - 'Hybrid Link Number leaving Pro: keep this connection and disconnect the other.', - exclusive: ['split', 'merge-with'], - options: [...HYBRID_TRANSPORTS], - }), - split: Flags.boolean({ - description: - 'Hybrid Link Number leaving Pro: split into two Standard Numbers without re-pairing.', - exclusive: ['keep', 'merge-with'], - }), - stay: Flags.string({ - description: - 'With --split: the connection that stays on this Number; the other moves to the new Number.', - options: [...HYBRID_TRANSPORTS], - }), - 'new-number-name': Flags.string({ - description: 'With --split: name of the new Number.', - }), - 'merge-with': Flags.string({ - description: - 'With --tier pro: UUID of the same-number Number to merge into this one. It is removed after its connection moves, so it must not use hosted message storage.', - exclusive: ['keep', 'split'], - }), - } - - async run(): Promise<void> { - const {args, flags} = await this.parse(SessionTierQuote) - const body = tierQuoteRequest({ - tier: flags.tier as (typeof TIER_CHOICES)[number], - projectId: flags.project, - keep: flags.keep as (typeof HYBRID_TRANSPORTS)[number] | undefined, - split: flags.split, - stay: flags.stay as (typeof HYBRID_TRANSPORTS)[number] | undefined, - newNumberName: flags['new-number-name'], - mergeWith: flags['merge-with'], - }) - const result = await quoteTierChange( - await this.platformClient(flags), - args.session, - body, - ) - this.writeValue( - result, - renderTierChange( - result.data, - `Review the charge, then confirm: polymorfa session tier confirm ${args.session} --quote ${result.data.id} --yes`, - ), - flags, - ) - } -} diff --git a/src/commands/session/view.ts b/src/commands/session/view.ts deleted file mode 100644 index 2d9e6b51..00000000 --- a/src/commands/session/view.ts +++ /dev/null @@ -1,34 +0,0 @@ -import {Args} from '@oclif/core' -import {PolymorfaConfigurationError} from '@polymorfa/sdk' - -import {BaseCommand} from '../../base-command.js' -import { - renderManagedSession, - viewManagedSession, -} from '../../services/platform-management.js' - -export default class SessionView extends BaseCommand { - static override description = - 'Read one session by its ID. Requires an organization API key with sessions:read.' - static override args = { - session: Args.string({description: 'Session ID.', required: true}), - } - static override examples = [ - '<%= config.bin %> session view SESSION_ID --json', - ] - - async run(): Promise<void> { - const {args, flags} = await this.parse(SessionView) - if (flags.project !== undefined) { - throw new PolymorfaConfigurationError( - 'session view identifies a team-unique session ID; omit --project.', - 'project', - ) - } - const result = await viewManagedSession( - await this.platformClient(flags), - args.session, - ) - this.writeValue(result, renderManagedSession(result.data), flags) - } -} diff --git a/src/commands/sip-trunk/delete.ts b/src/commands/sip-trunk/delete.ts index 523225ad..65ec31a7 100644 --- a/src/commands/sip-trunk/delete.ts +++ b/src/commands/sip-trunk/delete.ts @@ -12,7 +12,7 @@ export default class SipTrunkDelete extends BaseCommand { } static override description = - 'Delete a SIP trunk and its credentials. Fails with sip_trunk_in_use while a session routes incoming calls to it. Requires a server API key.' + 'Delete a SIP trunk and its credentials. Fails with sip_trunk_in_use while a connection routes incoming calls to it. Requires a server API key.' static override flags = { yes: Flags.boolean({ diff --git a/src/commands/template/submit.ts b/src/commands/template/submit.ts index 1fed9740..3d74a585 100644 --- a/src/commands/template/submit.ts +++ b/src/commands/template/submit.ts @@ -19,8 +19,8 @@ export default class TemplateSubmit extends BaseCommand { description: 'Project slug that owns the template.', required: true, }), - session: Flags.string({ - description: 'Official API Number ID in the same project.', + connection: Flags.string({ + description: 'Official API Connection ID in the same project.', required: true, }), yes: Flags.boolean({ @@ -44,7 +44,7 @@ export default class TemplateSubmit extends BaseCommand { const response = await client.templates.submit( flags['project-slug'], args.template, - {session: flags.session}, + {connection: flags.connection}, {maxNetworkRetries: 0}, ) const result = cloudResult(response) diff --git a/src/commands/testing/account-mode.ts b/src/commands/testing/account-mode.ts index 20d914b6..72ebdb6f 100644 --- a/src/commands/testing/account-mode.ts +++ b/src/commands/testing/account-mode.ts @@ -7,11 +7,11 @@ import { export default class TestingAccountMode extends BaseCommand { static override description = - 'Change a Test number account mode. A change unlinks every companion, which must pair again. Fails with a conflict if the number is claimed in Inspector or another change is pending.' + 'Change a Test Connection account mode. A change unlinks every companion, which must pair again. Fails with a conflict if the Connection is claimed in Inspector or another change is pending.' static override args = { - session: Args.string({ + connection: Args.string({ required: true, - description: 'The Test number session ID.', + description: 'The Test Connection ID.', }), } static override flags = { @@ -35,7 +35,7 @@ export default class TestingAccountMode extends BaseCommand { await this.messagingClient(flags, { serverCredentialOnly: 'Testing account mode', }), - args.session, + args.connection, { accountType: flags['account-type'], ...(flags['primary-platform'] === undefined diff --git a/src/commands/testing/history-fixture/create.ts b/src/commands/testing/history-fixture/create.ts index 4f95ee19..80e7d666 100644 --- a/src/commands/testing/history-fixture/create.ts +++ b/src/commands/testing/history-fixture/create.ts @@ -33,11 +33,7 @@ export default class TestingHistoryFixtureCreate extends BaseCommand { ) const response = await ( await this.messagingClient(flags, {serverApiKeyOnly: 'Testing history'}) - ).raw.request<{fixtureId: string}>({ - method: 'POST', - path: `/messaging/projects/${encodeURIComponent(flags.project)}/test-history-fixtures`, - body: input, - }) + ).testing.createHistoryFixture(flags.project, {messages: input.messages}) this.writeValue( {data: response.data, metadata: response.metadata}, response.data.fixtureId, diff --git a/src/commands/trigger.ts b/src/commands/trigger.ts index 5f03e477..e559e698 100644 --- a/src/commands/trigger.ts +++ b/src/commands/trigger.ts @@ -4,8 +4,6 @@ import { TEST_EVENT_FIXTURES, type TestEventFixture, type TestEventOverrides, - type TriggerTestEventResponse, - type TestEventFixtureInfo, } from '@polymorfa/sdk' import {BaseCommand} from '../base-command.js' @@ -17,7 +15,7 @@ const INTEGER_OVERRIDES = new Set<keyof TestEventOverrides>(['durationSeconds']) export default class Trigger extends BaseCommand { static override description = - 'Send a signed test event for a Test number to your webhooks, event history, and a running `polymorfa listen`. Real numbers are refused.' + 'Send a signed test event for a Test Connection to your webhooks, event history, and a running `polymorfa listen`. Real connections are refused.' static override args = { event: Args.string({ description: 'Fixture name; each name is the event type it produces.', @@ -28,10 +26,10 @@ export default class Trigger extends BaseCommand { static override flags = { list: Flags.boolean({ description: 'List fixtures and the overrides each accepts.', - exclusive: ['override', 'session', 'text', 'from', 'from-number'], + exclusive: ['override', 'connection', 'text', 'from', 'from-connection'], }), - session: Flags.string({ - description: 'Test Number ID.', + connection: Flags.string({ + description: 'Test Connection ID.', }), override: Flags.string({ description: @@ -44,16 +42,16 @@ export default class Trigger extends BaseCommand { from: Flags.string({ description: 'Shortcut for --override from=<E.164 phone>.', }), - 'from-number': Flags.string({ + 'from-connection': Flags.string({ description: - 'message.received only: send a simulated message from this other Test number instead of generating an event.', + 'message.received only: send a simulated message from this other Test Connection instead of generating an event.', }), } static override examples = [ '<%= config.bin %> trigger --list', - '<%= config.bin %> trigger message.received --session my-test-number --text "hi"', - '<%= config.bin %> trigger message.ack --session my-test-number --override ackStatus=read', - '<%= config.bin %> trigger template.status --session my-test-number --override templateStatus=REJECTED --override reason=INVALID_FORMAT', + '<%= config.bin %> trigger message.received --connection my-test-connection --text "hi"', + '<%= config.bin %> trigger message.ack --connection my-test-connection --override ackStatus=read', + '<%= config.bin %> trigger template.status --connection my-test-connection --override templateStatus=REJECTED --override reason=INVALID_FORMAT', ] async run(): Promise<void> { @@ -63,9 +61,7 @@ export default class Trigger extends BaseCommand { }) if (flags.list) { - const response = await client.raw.request<{ - fixtures: TestEventFixtureInfo[] - }>({method: 'GET', path: '/messaging/test-events/fixtures'}) + const response = await client.testing.listEventFixtures() const human = response.data.fixtures .map( (fixture) => @@ -89,10 +85,10 @@ export default class Trigger extends BaseCommand { `Name a fixture: ${TEST_EVENT_FIXTURES.join(', ')}. Use --list to see overrides.`, 'event', ) - if (!flags.session) + if (!flags.connection) throw new PolymorfaConfigurationError( - 'Select the Test number with --session.', - 'session', + 'Select the Test Connection with --connection.', + 'connection', ) const overrides = parseOverrides(flags.override ?? []) @@ -111,26 +107,25 @@ export default class Trigger extends BaseCommand { const request: { event: TestEventFixture overrides?: TestEventOverrides - fromNumber?: string + fromConnection?: string } = { event: args.event as TestEventFixture, ...(Object.keys(overrides).length > 0 ? {overrides} : {}), - ...(flags['from-number'] === undefined + ...(flags['from-connection'] === undefined ? {} - : {fromNumber: flags['from-number']}), + : {fromConnection: flags['from-connection']}), } - const response = await client.raw.request<TriggerTestEventResponse>({ - method: 'POST', - path: `/messaging/${encodeURIComponent(flags.session)}/test-events`, - body: request, - }) + const response = await client.testing.triggerEvent( + flags.connection, + request, + ) const result = response.data const human = result.delivery === 'generated' - ? `Triggered ${result.event} ${String(result.eventId)} on ${result.session} (source: test).\n` + + ? `Triggered ${result.event} ${String(result.eventId)} on ${result.connection} (source: test).\n` + `A running \`polymorfa listen${flags.project ? ` --project ${flags.project}` : ''}\` prints it as: ${result.event} ${String(result.eventId)}` - : `Sent a simulated message to ${result.session} from ${String(flags['from-number'])}.\n` + - `The ${result.event} event arrives as Test number activity (source: runtime).` + : `Sent a simulated message to ${result.connection} from ${String(flags['from-connection'])}.\n` + + `The ${result.event} event arrives as Test Connection activity (source: runtime).` this.writeValue({data: result, metadata: response.metadata}, human, flags) } } diff --git a/src/commands/usage/gates.ts b/src/commands/usage/gates.ts index cb7f5687..20091076 100644 --- a/src/commands/usage/gates.ts +++ b/src/commands/usage/gates.ts @@ -9,16 +9,16 @@ import { export default class UsageGates extends BaseCommand { static override description = - 'List your usage gates with their mode, limit, usage this month and how often an action went over the limit in the last 30 days. In record mode a gate never refuses an action; in enforce mode an action over the limit fails with gate_limit_reached. Pass --session to include limits that apply per number. Gate state covers the whole team, so this needs a team API key; project API keys are refused. A limit that cannot be checked fails the action with 503 in either mode.' + 'List your usage gates with their mode, limit, usage this month and how often an action went over the limit in the last 30 days. In record mode a gate never refuses an action; in enforce mode an action over the limit fails with gate_limit_reached. Pass --connection to include limits that apply per number. Gate state covers the whole team, so this needs a team API key; project API keys are refused. A limit that cannot be checked fails the action with 503 in either mode.' static override examples = [ '<%= config.bin %> usage gates', - '<%= config.bin %> usage gates --session support --json', + '<%= config.bin %> usage gates --connection support --json', ] static override flags = { - session: Flags.string({ - description: 'Include limits that apply to one number (session name).', + connection: Flags.string({ + description: 'Include limits that apply to one Connection (name).', }), } @@ -32,7 +32,9 @@ export default class UsageGates extends BaseCommand { ), { ...(flags.project === undefined ? {} : {project: flags.project}), - ...(flags.session === undefined ? {} : {session: flags.session}), + ...(flags.connection === undefined + ? {} + : {connection: flags.connection}), }, ) this.writeValue(result, renderUsageGates(result.data), flags) diff --git a/src/commands/usage/records.ts b/src/commands/usage/records.ts index b60d3914..97e2f508 100644 --- a/src/commands/usage/records.ts +++ b/src/commands/usage/records.ts @@ -9,11 +9,11 @@ import { export default class UsageRecords extends BaseCommand { static override description = - 'List usage records, newest first. Filter by call, number, meter or calendar month. A call has one call.duration record, and an outgoing Cloud API call also a call.cloud_pulses record. Pass the printed cursor to read the next page.' + 'List usage records, newest first. Filter by call, Connection, meter or calendar month. A call has one call.duration record, and an outgoing Cloud API call also a call.cloud_pulses record. Pass the printed cursor to read the next page.' static override examples = [ '<%= config.bin %> usage records --call 3EB0C431C26A1916E07A', - '<%= config.bin %> usage records --session support --meter call.duration --limit 50 --json', + '<%= config.bin %> usage records --connection support --meter call.duration --limit 50 --json', ] static override flags = { @@ -30,7 +30,7 @@ export default class UsageRecords extends BaseCommand { period: Flags.string({ description: 'Calendar month in UTC as YYYY-MM.', }), - session: Flags.string({description: 'Limit to one number (session name).'}), + connection: Flags.string({description: 'Limit to one Connection (name).'}), } static override summary = 'List usage records.' @@ -48,7 +48,9 @@ export default class UsageRecords extends BaseCommand { ...(flags.meter === undefined ? {} : {meter: flags.meter}), ...(flags.period === undefined ? {} : {period: flags.period}), ...(flags.project === undefined ? {} : {project: flags.project}), - ...(flags.session === undefined ? {} : {session: flags.session}), + ...(flags.connection === undefined + ? {} + : {connection: flags.connection}), }, ) this.writeValue(result, renderUsageRecords(result.data), flags) diff --git a/src/commands/usage/summary.ts b/src/commands/usage/summary.ts index a4c003a0..c5947343 100644 --- a/src/commands/usage/summary.ts +++ b/src/commands/usage/summary.ts @@ -9,18 +9,18 @@ import { export default class UsageSummary extends BaseCommand { static override description = - 'Show metered usage for one calendar month (UTC), by meter and by number. Usage is measured, not charged: no credits are deducted for it. Requires sessions:read. A project token reads only its own project.' + 'Show metered usage for one calendar month (UTC), by meter and by connection. Usage is measured, not charged: no credits are deducted for it. Requires connections:read. A project token reads only its own project.' static override examples = [ '<%= config.bin %> usage summary', - '<%= config.bin %> usage summary --period 2026-09 --session support --json', + '<%= config.bin %> usage summary --period 2026-09 --connection support --json', ] static override flags = { period: Flags.string({ description: 'Calendar month in UTC as YYYY-MM. Defaults to this month.', }), - session: Flags.string({description: 'Limit to one number (session name).'}), + connection: Flags.string({description: 'Limit to one Connection (name).'}), } static override summary = 'Show metered usage for a month.' @@ -34,7 +34,9 @@ export default class UsageSummary extends BaseCommand { { ...(flags.period === undefined ? {} : {period: flags.period}), ...(flags.project === undefined ? {} : {project: flags.project}), - ...(flags.session === undefined ? {} : {session: flags.session}), + ...(flags.connection === undefined + ? {} + : {connection: flags.connection}), }, ) this.writeValue(result, renderUsageSummary(result.data), flags) diff --git a/src/commands/user/security-code.ts b/src/commands/user/security-code.ts index 0d787a87..b455caf6 100644 --- a/src/commands/user/security-code.ts +++ b/src/commands/user/security-code.ts @@ -4,7 +4,7 @@ import {BaseCommand} from '../../base-command.js' import { renderUserSecurityCode, viewUserSecurityCode, -} from '../../services/session-identities.js' +} from '../../services/connection-identities.js' export default class UserSecurityCode extends BaseCommand { static override args = { @@ -17,8 +17,8 @@ export default class UserSecurityCode extends BaseCommand { static override description = 'View a user identity verification code.' static override flags = { - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), } @@ -27,7 +27,7 @@ export default class UserSecurityCode extends BaseCommand { const {args, flags} = await this.parse(UserSecurityCode) const result = await viewUserSecurityCode( await this.messagingClient(flags, {serverApiKeyOnly: 'User'}), - flags.session, + flags.connection, args.user, ) this.writeValue(result, renderUserSecurityCode(result.data), flags) diff --git a/src/commands/webhook/create.ts b/src/commands/webhook/create.ts index bcca62f2..f9a69c40 100644 --- a/src/commands/webhook/create.ts +++ b/src/commands/webhook/create.ts @@ -47,10 +47,10 @@ export default class WebhookCreate extends BaseCommand { this.error((error as Error).message, {exit: 2}) } } - const session = await this.developerSession(flags) + const connection = await this.developerConnection(flags) const input = merged as unknown as CreateProjectWebhookInput - const response = await session.client.webhooks.create(input, { - ...session.requestOptions, + const response = await connection.client.webhooks.create(input, { + ...connection.requestOptions, idempotencyKey: idempotencyKey(flags['idempotency-key']), }) const receipt = record(response.data, 'Webhook creation receipt') @@ -66,7 +66,7 @@ export default class WebhookCreate extends BaseCommand { } catch (error) { const reason = error instanceof Error ? error.message : String(error) const output = developerMutation({ - context: session.context, + context: connection.context, metadata: response.metadata, receipt, resource: {id: stringField(webhook, 'id'), type: 'webhook'}, @@ -91,7 +91,7 @@ export default class WebhookCreate extends BaseCommand { ) } const output = developerMutation({ - context: session.context, + context: connection.context, metadata: response.metadata, receipt, resource: {id: stringField(webhook, 'id'), type: 'webhook'}, diff --git a/src/commands/webhook/delete.ts b/src/commands/webhook/delete.ts index e34eefbc..c68c56a2 100644 --- a/src/commands/webhook/delete.ts +++ b/src/commands/webhook/delete.ts @@ -25,15 +25,15 @@ export default class WebhookDelete extends BaseCommand { prompt: `Delete webhook ${args.webhook}?`, yes: flags.yes, }) - const session = await this.developerSession(flags) - const response = await session.client.webhooks.delete(args.webhook, { - ...session.requestOptions, + const connection = await this.developerConnection(flags) + const response = await connection.client.webhooks.delete(args.webhook, { + ...connection.requestOptions, idempotencyKey: idempotencyKey(flags['idempotency-key']), }) const receipt = record(response.data, 'Webhook deletion receipt') const webhookId = stringField(receipt, 'webhookId') const output = developerMutation({ - context: session.context, + context: connection.context, metadata: response.metadata, receipt, resource: {id: webhookId, type: 'webhook'}, diff --git a/src/commands/webhook/delivery/attempt/list.ts b/src/commands/webhook/delivery/attempt/list.ts index 04df1f75..58b330d4 100644 --- a/src/commands/webhook/delivery/attempt/list.ts +++ b/src/commands/webhook/delivery/attempt/list.ts @@ -16,19 +16,19 @@ export default class WebhookDeliveryAttemptList extends BaseCommand { async run(): Promise<void> { const {args, flags} = await this.parse(WebhookDeliveryAttemptList) - const session = await this.developerSession(flags) + const connection = await this.developerConnection(flags) const result = await listResources(paginationInput(flags), (page) => - session.client.webhookDeliveries.listAttempts( + connection.client.webhookDeliveries.listAttempts( args.delivery, page, - session.requestOptions, + connection.requestOptions, ), ) this.writeValue( developerRead( result.items, result.metadata, - session.context, + connection.context, result.page, ), `${result.items.length} delivery attempt(s).`, diff --git a/src/commands/webhook/delivery/attempt/view.ts b/src/commands/webhook/delivery/attempt/view.ts index 3940df7c..79037c3e 100644 --- a/src/commands/webhook/delivery/attempt/view.ts +++ b/src/commands/webhook/delivery/attempt/view.ts @@ -14,14 +14,14 @@ export default class WebhookDeliveryAttemptView extends BaseCommand { async run(): Promise<void> { const {args, flags} = await this.parse(WebhookDeliveryAttemptView) - const session = await this.developerSession(flags) - const response = await session.client.webhookDeliveries.retrieveAttempt( + const connection = await this.developerConnection(flags) + const response = await connection.client.webhookDeliveries.retrieveAttempt( args.delivery, args.attempt, - session.requestOptions, + connection.requestOptions, ) this.writeValue( - developerResponse(response, session.context), + developerResponse(response, connection.context), renderAttemptDetail(response.data), flags, ) diff --git a/src/commands/webhook/delivery/list.ts b/src/commands/webhook/delivery/list.ts index d649e9b1..024128ef 100644 --- a/src/commands/webhook/delivery/list.ts +++ b/src/commands/webhook/delivery/list.ts @@ -39,10 +39,10 @@ export default class WebhookDeliveryList extends BaseCommand { flags.until, flags.webhook, ]) - const session = await this.developerSession(flags) + const connection = await this.developerConnection(flags) const time = optionalTimeRange(flags.since, flags.until) const result = await listResources(paginationInput(flags), (page) => - session.client.webhookDeliveries.list( + connection.client.webhookDeliveries.list( { ...page, ...time, @@ -52,14 +52,14 @@ export default class WebhookDeliveryList extends BaseCommand { : {status: flags.status as WebhookDeliveryStatus}), ...(flags.webhook === undefined ? {} : {webhookId: flags.webhook}), }, - session.requestOptions, + connection.requestOptions, ), ) this.writeValue( developerRead( result.items, result.metadata, - session.context, + connection.context, result.page, ), `${result.items.length} webhook delivery or deliveries.`, diff --git a/src/commands/webhook/delivery/retry.ts b/src/commands/webhook/delivery/retry.ts index 863cd20a..b367a4b5 100644 --- a/src/commands/webhook/delivery/retry.ts +++ b/src/commands/webhook/delivery/retry.ts @@ -26,19 +26,19 @@ export default class WebhookDeliveryRetry extends BaseCommand { prompt: `Retry webhook delivery ${args.delivery}?`, yes: flags.yes, }) - const session = await this.developerSession(flags) - const response = await session.client.webhookDeliveries.retry( + const connection = await this.developerConnection(flags) + const response = await connection.client.webhookDeliveries.retry( args.delivery, {}, { - ...session.requestOptions, + ...connection.requestOptions, idempotencyKey: idempotencyKey(flags['idempotency-key']), }, ) const receipt = record(response.data, 'Webhook delivery retry receipt') const deliveryId = stringField(receipt, 'deliveryId') const output = developerMutation({ - context: session.context, + context: connection.context, metadata: response.metadata, receipt, resource: {id: deliveryId, type: 'webhook_delivery'}, diff --git a/src/commands/webhook/delivery/view.ts b/src/commands/webhook/delivery/view.ts index 9f9cdca0..7f486a4a 100644 --- a/src/commands/webhook/delivery/view.ts +++ b/src/commands/webhook/delivery/view.ts @@ -13,13 +13,13 @@ export default class WebhookDeliveryView extends BaseCommand { async run(): Promise<void> { const {args, flags} = await this.parse(WebhookDeliveryView) - const session = await this.developerSession(flags) - const response = await session.client.webhookDeliveries.retrieve( + const connection = await this.developerConnection(flags) + const response = await connection.client.webhookDeliveries.retrieve( args.delivery, - session.requestOptions, + connection.requestOptions, ) this.writeValue( - developerResponse(response, session.context), + developerResponse(response, connection.context), renderDeliveryDetail(response.data), flags, ) diff --git a/src/commands/webhook/list.ts b/src/commands/webhook/list.ts index 03df6f47..682726c7 100644 --- a/src/commands/webhook/list.ts +++ b/src/commands/webhook/list.ts @@ -10,14 +10,14 @@ export default class WebhookList extends BaseCommand { async run(): Promise<void> { const {flags} = await this.parse(WebhookList) - const session = await this.developerSession(flags) + const connection = await this.developerConnection(flags) const result = await listResources(paginationInput(flags), (page) => - session.client.webhooks.list(page, session.requestOptions), + connection.client.webhooks.list(page, connection.requestOptions), ) const output = developerRead( result.items, result.metadata, - session.context, + connection.context, result.page, ) this.writeValue(output, `${result.items.length} webhook(s).`, flags) diff --git a/src/commands/webhook/secret/rotate.ts b/src/commands/webhook/secret/rotate.ts index 88cb7d89..52956c02 100644 --- a/src/commands/webhook/secret/rotate.ts +++ b/src/commands/webhook/secret/rotate.ts @@ -38,14 +38,14 @@ export default class WebhookSecretRotate extends BaseCommand { json: flags.json === true, ...(flags['secret-out'] === undefined ? {} : {path: flags['secret-out']}), }) - const session = await this.developerSession(flags) - const response = await session.client.webhooks.rotateSecret( + const connection = await this.developerConnection(flags) + const response = await connection.client.webhooks.rotateSecret( args.webhook, flags.overlap === undefined ? {} : {overlapSeconds: parseBoundedDurationSeconds(flags.overlap, 86_400)}, { - ...session.requestOptions, + ...connection.requestOptions, idempotencyKey: idempotencyKey(flags['idempotency-key']), }, ) @@ -62,7 +62,7 @@ export default class WebhookSecretRotate extends BaseCommand { } catch (error) { const reason = error instanceof Error ? error.message : String(error) const output = developerMutation({ - context: session.context, + context: connection.context, metadata: response.metadata, receipt, resource: {id: webhookId, type: 'webhook'}, @@ -87,7 +87,7 @@ export default class WebhookSecretRotate extends BaseCommand { ) } const output = developerMutation({ - context: session.context, + context: connection.context, metadata: response.metadata, receipt, resource: {id: webhookId, type: 'webhook'}, diff --git a/src/commands/webhook/test.ts b/src/commands/webhook/test.ts index 5230b92a..60960ed5 100644 --- a/src/commands/webhook/test.ts +++ b/src/commands/webhook/test.ts @@ -20,13 +20,13 @@ export default class WebhookTest extends BaseCommand { 'idempotency-key': idempotencyFlag, input: Flags.string({ description: - 'Read optional test input from a file or stdin (-). Project tests accept body and sessionId together; team tests accept only eventType.', + 'Read optional test input from a file or stdin (-). Project tests accept body and connectionId together; team tests accept only eventType.', }), } async run(): Promise<void> { const {args, flags} = await this.parse(WebhookTest) - const session = await this.developerSession(flags) + const connection = await this.developerConnection(flags) const input = flags.input === undefined ? {eventType: flags.event} @@ -34,15 +34,19 @@ export default class WebhookTest extends BaseCommand { ...record(await readJsonInput(flags.input), 'Webhook test input'), eventType: flags.event, } - validateTestInput(session.context.owner, input) - const response = await session.client.webhooks.test(args.webhook, input, { - ...session.requestOptions, - idempotencyKey: idempotencyKey(flags['idempotency-key']), - }) + validateTestInput(connection.context.owner, input) + const response = await connection.client.webhooks.test( + args.webhook, + input, + { + ...connection.requestOptions, + idempotencyKey: idempotencyKey(flags['idempotency-key']), + }, + ) const receipt = record(response.data, 'Webhook test receipt') const deliveryId = stringField(receipt, 'deliveryId') const output = developerMutation({ - context: session.context, + context: connection.context, metadata: response.metadata, receipt, resource: {id: deliveryId, type: 'webhook_delivery'}, @@ -58,7 +62,7 @@ function validateTestInput( const allowed = owner === 'organization' ? new Set(['eventType']) - : new Set(['eventType', 'body', 'sessionId']) + : new Set(['eventType', 'body', 'connectionId']) const unexpected = Object.keys(input).find((key) => !allowed.has(key)) if (unexpected !== undefined) { throw new PolymorfaValidationError( @@ -66,9 +70,9 @@ function validateTestInput( {code: 'invalid_parameter'}, ) } - if (owner === 'project' && 'body' in input !== 'sessionId' in input) { + if (owner === 'project' && 'body' in input !== 'connectionId' in input) { throw new PolymorfaValidationError( - 'Project webhook test bodies require sessionId, and sessionId requires a body.', + 'Project webhook test bodies require connectionId, and connectionId requires a body.', {code: 'invalid_parameter'}, ) } diff --git a/src/commands/webhook/update.ts b/src/commands/webhook/update.ts index 4d4f6de7..2c6ef124 100644 --- a/src/commands/webhook/update.ts +++ b/src/commands/webhook/update.ts @@ -37,15 +37,15 @@ export default class WebhookUpdate extends BaseCommand { flags.input === undefined ? {} : record(await readJsonInput(flags.input), 'Webhook input') - const session = await this.developerSession(flags) + const connection = await this.developerConnection(flags) if (startDay !== undefined) { // Off edits the saved event list unless the input already supplies one. const saved = startDay === 'off' && !Array.isArray(body.eventTypes) ? ( - await session.client.webhooks.retrieve( + await connection.client.webhooks.retrieve( args.webhook, - session.requestOptions, + connection.requestOptions, ) ).data.eventTypes : undefined @@ -55,14 +55,18 @@ export default class WebhookUpdate extends BaseCommand { this.error((error as Error).message, {exit: 2}) } } - const response = await session.client.webhooks.update(args.webhook, body, { - ...session.requestOptions, - idempotencyKey: idempotencyKey(flags['idempotency-key']), - }) + const response = await connection.client.webhooks.update( + args.webhook, + body, + { + ...connection.requestOptions, + idempotencyKey: idempotencyKey(flags['idempotency-key']), + }, + ) const receipt = record(response.data, 'Webhook mutation receipt') const webhook = record(receipt.webhook, 'Webhook') const output = developerMutation({ - context: session.context, + context: connection.context, metadata: response.metadata, receipt, resource: {id: stringField(webhook, 'id'), type: 'webhook'}, diff --git a/src/commands/webhook/view.ts b/src/commands/webhook/view.ts index 27ec4c3f..883a990f 100644 --- a/src/commands/webhook/view.ts +++ b/src/commands/webhook/view.ts @@ -13,13 +13,13 @@ export default class WebhookView extends BaseCommand { async run(): Promise<void> { const {args, flags} = await this.parse(WebhookView) - const session = await this.developerSession(flags) - const response = await session.client.webhooks.retrieve( + const connection = await this.developerConnection(flags) + const response = await connection.client.webhooks.retrieve( args.webhook, - session.requestOptions, + connection.requestOptions, ) this.writeValue( - developerResponse(response, session.context), + developerResponse(response, connection.context), renderWebhookDetail(response.data), flags, ) diff --git a/src/context/environment.ts b/src/context/environment.ts index 0f64c622..4bf39bb3 100644 --- a/src/context/environment.ts +++ b/src/context/environment.ts @@ -746,7 +746,7 @@ export async function listProjects( ): Promise<readonly ProjectWithStats[]> { const client = new Client({ baseUrl: input.baseUrl, - credential: {type: 'organizationApiKey', value: input.credential}, + credential: {type: 'teamApiKey', value: input.credential}, ...(input.apiVersion === undefined ? {} : {apiVersion: input.apiVersion}), ...(input.timeoutMs === undefined ? {} : {timeoutMs: input.timeoutMs}), }) diff --git a/src/developer/client.ts b/src/developer/client.ts index d2390950..7204c08e 100644 --- a/src/developer/client.ts +++ b/src/developer/client.ts @@ -16,18 +16,18 @@ export type MetadataLike = ResponseMetadata export type ApiResponseLike<T> = ApiResponse<T> export type CursorPageLike<T> = CursorPage<T> -export interface DeveloperSession { +export interface DeveloperConnection { readonly baseUrl: string readonly client: ClientBase<ClientOwner> readonly context: OutputContext readonly requestOptions: RequestOptions } -export async function createDeveloperSession( +export async function createDeveloperConnection( flags: GlobalFlags, registerSecret?: (secret: string) => void, loadLinkedProject?: () => Promise<string | undefined>, -): Promise<DeveloperSession> { +): Promise<DeveloperConnection> { const environment = await resolveDeveloperEnvironment({ env: process.env, ...(loadLinkedProject === undefined ? {} : {loadLinkedProject}), @@ -59,7 +59,7 @@ export async function createDeveloperSession( : new Client({ baseUrl: environment.baseUrl, credential: { - type: 'organizationApiKey', + type: 'teamApiKey', value: environment.credential, }, ...(environment.apiVersion === undefined @@ -70,7 +70,7 @@ export async function createDeveloperSession( : {timeoutMs: environment.timeoutMs}), }) const client = - environment.context.owner === 'project' && root.owner === 'organization' + environment.context.owner === 'project' && root.owner === 'team' ? root.project(requiredProject(environment.context.projectId)) : root return { diff --git a/src/developer/flags.ts b/src/developer/flags.ts index e5e9ad6f..b01fde5d 100644 --- a/src/developer/flags.ts +++ b/src/developer/flags.ts @@ -39,8 +39,8 @@ export const callFilterFlags = { 'Include only calls with this outcome. answered includes answered calls still in progress; in_progress means still ringing.', options: ['answered', 'missed', 'declined', 'failed', 'in_progress'], }), - session: Flags.string({ - description: 'Include only calls on this session (number).', + connection: Flags.string({ + description: 'Include only calls on this connection.', }), since: Flags.string({ description: 'Include calls that started at or after this RFC 3339 time.', @@ -49,7 +49,7 @@ export const callFilterFlags = { description: 'Include calls that started before this RFC 3339 time.', }), upstream: Flags.string({ - description: 'Include only numbers that connect this way.', + description: 'Include only connections that connect this way.', options: ['linked_device', 'cloud_api'], }), } diff --git a/src/developer/operations.ts b/src/developer/operations.ts index dc549dd7..30502c5f 100644 --- a/src/developer/operations.ts +++ b/src/developer/operations.ts @@ -1,6 +1,6 @@ import type {ApiResponse, CursorPage, RequestOptions} from '@polymorfa/sdk' -import type {DeveloperSession} from './client.js' +import type {DeveloperConnection} from './client.js' import type {OperationLike} from './operation-view.js' export type OperationRecord = OperationLike @@ -23,8 +23,8 @@ export interface OperationWaitOptions { } /** - * The SDK's `client.operations` resource for the session's scope. The - * session client is already bound to the selected project when the context + * The SDK's `client.operations` resource for the connection's scope. The + * connection client is already bound to the selected project when the context * is project-owned, so the SDK resolves the team or project route itself. * * Operation kinds and statuses are passed through as the API spells them, so @@ -50,6 +50,8 @@ export interface OperationsClient { ): Promise<ApiResponse<OperationRecord>> } -export function operationsFor(session: DeveloperSession): OperationsClient { - return session.client.operations as unknown as OperationsClient +export function operationsFor( + connection: DeveloperConnection, +): OperationsClient { + return connection.client.operations as unknown as OperationsClient } diff --git a/src/developer/phone-offline.ts b/src/developer/phone-offline.ts index 1e7ca3c3..4e41e7fc 100644 --- a/src/developer/phone-offline.ts +++ b/src/developer/phone-offline.ts @@ -1,6 +1,6 @@ import {Flags} from '@oclif/core' -export const PHONE_OFFLINE_EVENT = 'session.phone_offline' +export const PHONE_OFFLINE_EVENT = 'connection.phone_offline' const MIN_DAY = 7 const MAX_DAY = 13 diff --git a/src/developer/render.ts b/src/developer/render.ts index e1526fac..d84be288 100644 --- a/src/developer/render.ts +++ b/src/developer/render.ts @@ -40,7 +40,7 @@ function phoneOfflineWarning(webhook: { readonly eventTypes: readonly string[] readonly phoneOfflineStartDay?: number }): string { - if (!webhook.eventTypes.includes('session.phone_offline')) return 'off' + if (!webhook.eventTypes.includes('connection.phone_offline')) return 'off' return webhook.phoneOfflineStartDay === undefined ? 'not reported' : `from day ${webhook.phoneOfflineStartDay}` diff --git a/src/errors/present.ts b/src/errors/present.ts index 6532a864..ed86a8a5 100644 --- a/src/errors/present.ts +++ b/src/errors/present.ts @@ -99,11 +99,11 @@ export function presentError( ? `${message} Read message operation status; do not resend or change transport.` : error instanceof PolymorfaError && error.code === 'hybrid_choice_required' - ? `${message} Choose --keep linked_devices|official_api, or --split --stay linked_devices|official_api --new-number-name NAME, and quote again.` + ? `${message} Choose --keep linked_devices|official_api, or --split --stay linked_devices|official_api --new-connection-name NAME, and quote again.` : error instanceof PolymorfaError && error.code === 'hybrid_transition_ineligible' && /\bhms_enabled$/.test(error.message) - ? `${message} A Number with hosted message storage must be kept: quote the merge on it and pass the other Number to --merge-with.` + ? `${message} A Connection with hosted message storage must be kept: quote the merge on it and pass the other Connection to --merge-with.` : message, ...(error instanceof PolymorfaError && error.metadata?.operationId ? {operationId: redact(error.metadata.operationId, secrets)} diff --git a/src/flows/command.ts b/src/flows/command.ts index f3692861..aa794f7d 100644 --- a/src/flows/command.ts +++ b/src/flows/command.ts @@ -9,7 +9,7 @@ export abstract class FlowsCommand extends BaseCommand { 'Flows are project-owned; use --owner project.', 'owner', ) - const scope = await this.developerSession({...flags, owner: 'project'}) + const scope = await this.developerConnection({...flags, owner: 'project'}) const projectId = scope.context.projectId if (!z.string().uuid().safeParse(projectId).success || !projectId) throw new PolymorfaConfigurationError( diff --git a/src/functions/command.ts b/src/functions/command.ts index 6df12889..1685f3f9 100644 --- a/src/functions/command.ts +++ b/src/functions/command.ts @@ -10,10 +10,15 @@ export abstract class FunctionsCommand extends BaseCommand { 'Functions are project-owned; --owner organization is not supported.', 'owner', ) - const session = await this.developerSession({...flags, owner: 'project'}) + const connection = await this.developerConnection({ + ...flags, + owner: 'project', + }) return { - client: session.client, - projectId: requireFunctionProject(session.context.projectId ?? undefined), + client: connection.client, + projectId: requireFunctionProject( + connection.context.projectId ?? undefined, + ), } } } diff --git a/src/input/hybrid-routing.ts b/src/input/hybrid-routing.ts index 80c3043f..79bf5cab 100644 --- a/src/input/hybrid-routing.ts +++ b/src/input/hybrid-routing.ts @@ -6,18 +6,18 @@ import { export const hybridPolicyFlags = { scope: Flags.string({ - options: ['team', 'project', 'session'] as const, + options: ['team', 'project', 'connection'] as const, required: true, description: 'Policy authority to read or update.', }), - session: Flags.string({ - description: 'Number session name for session scope.', + connection: Flags.string({ + description: 'Connection name for connection scope.', }), } export function hybridPolicyScope( flags: { scope: string - session?: string | undefined + connection?: string | undefined }, projectId?: string, ): HybridRoutingPolicyScope { @@ -28,12 +28,12 @@ export function hybridPolicyScope( 'project', ) if (flags.scope === 'project') return {scope: 'project', projectId} - if (flags.scope !== 'session') + if (flags.scope !== 'connection') throw new PolymorfaConfigurationError('Invalid policy scope.', 'scope') - if (!flags.session) + if (!flags.connection) throw new PolymorfaConfigurationError( - 'Session scope requires --session.', - 'session', + 'Connection scope requires --connection.', + 'connection', ) - return {scope: 'session', projectId, session: flags.session} + return {scope: 'connection', projectId, connection: flags.connection} } diff --git a/src/input/message-send.ts b/src/input/message-send.ts index d1fd3994..d1f71fc2 100644 --- a/src/input/message-send.ts +++ b/src/input/message-send.ts @@ -32,8 +32,8 @@ export const sendContextFlags = { 'reply-to': Flags.string({ description: 'Polymorfa message ID to quote in the reply.', }), - session: Flags.string({ - description: 'Messaging session ID.', + connection: Flags.string({ + description: 'Messaging connection ID.', required: true, }), to: Flags.string({ diff --git a/src/input/payment-order.ts b/src/input/payment-order.ts index 2799904f..dd4c1e45 100644 --- a/src/input/payment-order.ts +++ b/src/input/payment-order.ts @@ -14,8 +14,8 @@ export const paymentOrderFlags = { description: 'Idempotency-Key header. Generated per invocation when omitted; reuse an explicit key to check a previous attempt (1-hour retention).', }), - session: Flags.string({ - description: 'Messaging session ID of an Official API Number.', + connection: Flags.string({ + description: 'Messaging connection ID of an Official API Connection.', required: true, }), to: Flags.string({ diff --git a/src/input/recipients.ts b/src/input/recipients.ts index 59064cec..0410766b 100644 --- a/src/input/recipients.ts +++ b/src/input/recipients.ts @@ -73,7 +73,7 @@ export async function readCsvRecipients( if (record.every((cell) => cell.trim() === '')) continue const phone = (record[phoneIndex] ?? '').trim() if (phone === '') { - // Header is row 1, matching the API's row numbers for file imports. + // Header is row 1, matching the API's row connections for file imports. missingPhoneRows.push(index + 2) continue } diff --git a/src/input/request-log-filters.ts b/src/input/request-log-filters.ts index f2316a8d..df35251d 100644 --- a/src/input/request-log-filters.ts +++ b/src/input/request-log-filters.ts @@ -16,7 +16,7 @@ export const requestLogFilterFlags = { }), route: Flags.string({ description: - 'Only this exact route pattern, for example /messaging/:session/messages.', + 'Only this exact route pattern, for example /messaging/:connection/messages.', }), source: Flags.string({ description: 'Only direct API requests or requests made through MCP.', diff --git a/src/mcp/session-discovery.ts b/src/mcp/connection-discovery.ts similarity index 61% rename from src/mcp/session-discovery.ts rename to src/mcp/connection-discovery.ts index b6feee06..c89b166c 100644 --- a/src/mcp/session-discovery.ts +++ b/src/mcp/connection-discovery.ts @@ -3,25 +3,25 @@ import {PolymorfaConfigurationError} from '@polymorfa/sdk' import {PROJECT_UUID} from '../config/project-link.js' import {resolveCommandEnvironment} from '../context/environment.js' import {createPlatformClient} from '../sdk/client.js' -import {listManagedSessions} from '../services/platform-management.js' +import {listManagedConnections} from '../services/platform-management.js' -export interface McpSessionSummary { - readonly sessionId: string +export interface McpConnectionSummary { + readonly connectionId: string readonly name: string readonly status: string readonly testMode: boolean } -export interface McpSessionList { - readonly sessions: readonly McpSessionSummary[] +export interface McpConnectionList { + readonly connections: readonly McpConnectionSummary[] readonly status: number readonly requestId?: string } -/** Read one project's session metadata without exposing phone or credentials. */ -export async function listMcpSessions( +/** Read one project's connection metadata without exposing phone or credentials. */ +export async function listMcpConnections( projectId: string, -): Promise<McpSessionList> { +): Promise<McpConnectionList> { if (!PROJECT_UUID.test(projectId)) { throw new PolymorfaConfigurationError( 'A project UUID is required.', @@ -34,7 +34,7 @@ export async function listMcpSessions( process.env.POLYMORFA_CLIENT_TOKEN?.trim()) ) { throw new PolymorfaConfigurationError( - 'Select only one organization API key for MCP session discovery.', + 'Select only one organization API key for MCP connection discovery.', 'credential', ) } @@ -42,17 +42,19 @@ export async function listMcpSessions( env: process.env, surface: 'platform', }) - const response = await listManagedSessions( + const response = await listManagedConnections( createPlatformClient(environment), projectId, ) return { - sessions: response.data.map(({sessionId, name, status, testMode}) => ({ - sessionId, - name, - status, - testMode, - })), + connections: response.data.map( + ({connectionId, name, status, testMode}) => ({ + connectionId, + name, + status, + testMode, + }), + ), status: response.metadata.status, ...(response.metadata.requestId === undefined ? {} diff --git a/src/mcp/server.ts b/src/mcp/server.ts index c1ebd143..bd269151 100644 --- a/src/mcp/server.ts +++ b/src/mcp/server.ts @@ -7,21 +7,26 @@ import {z} from 'zod' import {LISTENER_PROJECT_ID_PATTERN} from '../listener/protocol.js' import type {ListenerManager} from './listener-manager.js' -import {listMcpSessions, type McpSessionList} from './session-discovery.js' +import { + listMcpConnections, + type McpConnectionList, +} from './connection-discovery.js' export const MCP_TOOL_NAMES = [ 'polymorfa_listen_start', 'polymorfa_listen_status', 'polymorfa_listen_stop', - 'polymorfa_session_list', + 'polymorfa_connection_list', ] as const -export type McpSessionLister = (projectId: string) => Promise<McpSessionList> +export type McpConnectionLister = ( + projectId: string, +) => Promise<McpConnectionList> export function createMcpServer( manager: ListenerManager, version: string, - sessionLister: McpSessionLister = listMcpSessions, + connectionLister: McpConnectionLister = listMcpConnections, ): McpServer { const server = new McpServer({name: '@polymorfa/cli', version}) server.registerTool( @@ -83,7 +88,7 @@ export function createMcpServer( async ({listenerId}) => result(await manager.stop(listenerId)), ) server.registerTool( - 'polymorfa_session_list', + 'polymorfa_connection_list', { annotations: { destructiveHint: false, @@ -92,20 +97,20 @@ export function createMcpServer( readOnlyHint: true, }, description: - 'List stored session summaries in one project. Requires a CLI organization API key with sessions:read.', + 'List stored connection summaries in one project. Requires a CLI organization API key with connections:read.', inputSchema: z.object({ projectId: z.string().regex(LISTENER_PROJECT_ID_PATTERN), }), - title: 'List Polymorfa project sessions', + title: 'List Polymorfa project connections', }, async ({projectId}) => { try { - return result(await sessionLister(projectId)) + return result(await connectionLister(projectId)) } catch { return { content: [ { - text: 'Could not list project sessions with the selected CLI organization API key.', + text: 'Could not list project connections with the selected CLI organization API key.', type: 'text' as const, }, ], @@ -121,10 +126,10 @@ export function serveMcp( manager: ListenerManager, version: string, transport?: StdioServerTransport, - sessionLister?: McpSessionLister, + connectionLister?: McpConnectionLister, ): {close(): Promise<void>} { const handle = serveStdio( - () => createMcpServer(manager, version, sessionLister), + () => createMcpServer(manager, version, connectionLister), { onerror(error) { process.stderr.write(`MCP error: ${error.message}\n`) diff --git a/src/output/calls.ts b/src/output/calls.ts index f5a3ef0a..a3051ef7 100644 --- a/src/output/calls.ts +++ b/src/output/calls.ts @@ -20,11 +20,11 @@ export function stopOnSignals(): { export function renderCallsStatus( status: CallsStatus, - session: string | undefined, + connection: string | undefined, ): string { switch (status.type) { case 'ready': - return `Following calls${session === undefined ? '' : ` for session ${session}`}${status.participant === undefined ? '' : ` as ${status.participant}`}. Press Ctrl-C to stop.` + return `Following calls${connection === undefined ? '' : ` for connection ${connection}`}${status.participant === undefined ? '' : ` as ${status.participant}`}. Press Ctrl-C to stop.` case 'disconnected': return 'Disconnected from calls; reconnecting.' case 'notice': diff --git a/src/sdk/client.ts b/src/sdk/client.ts index e727749f..566b2455 100644 --- a/src/sdk/client.ts +++ b/src/sdk/client.ts @@ -40,7 +40,7 @@ export function createMessagingClient( } /** - * Session call settings live on the Platform API, but the SDK exposes them on + * Connection call settings live on the Platform API, but the SDK exposes them on * the Messaging client's Calls resource. Build that client from a resolved * Platform environment so the Platform credential rules (server API keys * only) still apply. @@ -50,7 +50,7 @@ export function createCallSettingsClient( ): MessagingClient { if (environment.surface !== 'platform') { throw new PolymorfaConfigurationError( - 'Session call settings require the Platform API surface.', + 'Connection call settings require the Platform API surface.', 'surface', ) } @@ -87,7 +87,7 @@ export function createCallRetentionClient( type: environment.principalType === 'project_token' ? 'projectToken' - : 'organizationApiKey', + : 'teamApiKey', value: environment.credential, }, ...(environment.apiVersion === undefined @@ -106,7 +106,7 @@ export function createCallRetentionClient( export function createPlatformClient( environment: ResolvedEnvironment, -): ClientInstance<'organization'> { +): ClientInstance<'team'> { if (environment.surface !== 'platform') { throw new PolymorfaConfigurationError( 'A typed Platform client requires the Platform API surface.', @@ -116,7 +116,7 @@ export function createPlatformClient( return new Client({ credential: { - type: 'organizationApiKey', + type: 'teamApiKey', value: environment.credential.value, }, ...sharedOptions(environment), diff --git a/src/services/analytics.ts b/src/services/analytics.ts index 6d0c6296..65927dc7 100644 --- a/src/services/analytics.ts +++ b/src/services/analytics.ts @@ -16,10 +16,10 @@ export interface AnalyticsSettings { export function analyticsQuery(input: { since?: string until?: string - sessionId?: string + connectionId?: string }): AnalyticsParams { optionalTimeRange(input.since, input.until) - const query: {start?: number; end?: number; sessionId?: string} = {} + const query: {start?: number; end?: number; connectionId?: string} = {} if (input.since !== undefined) query.start = Date.parse(input.since) if (input.until !== undefined) query.end = Date.parse(input.until) if ( @@ -30,16 +30,16 @@ export function analyticsQuery(input: { throw new PolymorfaValidationError('Choose a range of up to 366 days.', { code: 'invalid_analytics_range', }) - if (input.sessionId !== undefined) { + if (input.connectionId !== undefined) { if ( !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test( - input.sessionId, + input.connectionId, ) ) - throw new PolymorfaValidationError('--session-id must be a UUID.', { + throw new PolymorfaValidationError('--connection-id must be a UUID.', { code: 'invalid_analytics_filter', }) - query.sessionId = input.sessionId + query.connectionId = input.connectionId } return query } @@ -53,7 +53,7 @@ export async function getAnalytics( !data || typeof data.enabled !== 'boolean' || !data.requestVitals || - !Array.isArray(data.numbers) || + !Array.isArray(data.connections) || !Array.isArray(data.series) || !Array.isArray(data.callSeries) || (data.enabled && @@ -109,13 +109,13 @@ export function renderAnalytics(data: WhatsAppAnalytics) { } export function analyticsMetricsQuery(input: { - sessionId?: string | undefined + connectionId?: string | undefined windowHours?: number | undefined segments?: boolean | undefined format?: string | undefined }): AnalyticsMetricsParams { const query = analyticsQuery( - input.sessionId === undefined ? {} : {sessionId: input.sessionId}, + input.connectionId === undefined ? {} : {connectionId: input.connectionId}, ) if ( input.windowHours !== undefined && diff --git a/src/services/audiences.ts b/src/services/audiences.ts index 80975065..4407faf0 100644 --- a/src/services/audiences.ts +++ b/src/services/audiences.ts @@ -27,7 +27,7 @@ export interface AudienceResult<T> { } export async function createAudience( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, body: CreateAudienceRequest, options: RequestOptions = {}, ): Promise<AudienceResult<AudienceImportResult>> { @@ -36,7 +36,7 @@ export async function createAudience( } export async function addAudienceMembers( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, listId: string, members: readonly CampaignRecipientInput[], options: RequestOptions = {}, @@ -46,7 +46,7 @@ export async function addAudienceMembers( } export async function listAudienceMembers( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, listId: string, params: ListAudienceMembersParams, ): Promise<AudienceResult<AudienceMembersEnvelope>> { @@ -55,7 +55,7 @@ export async function listAudienceMembers( } export async function removeAudienceMember( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, listId: string, phone: string, options: RequestOptions = {}, diff --git a/src/services/auth.ts b/src/services/auth.ts index 5ecb0029..a17e4a60 100644 --- a/src/services/auth.ts +++ b/src/services/auth.ts @@ -1,7 +1,7 @@ import { PolymorfaConfigurationError, PolymorfaNotFoundError, - validateOrganizationApiKey, + validateTeamApiKey, } from '@polymorfa/sdk' import { @@ -56,7 +56,7 @@ export class AuthService { readonly profile: string }): Promise<ProfileSummary> { assertProfileName(input.profile) - const apiKey = validateOrganizationApiKey(input.apiKey.trim()) + const apiKey = validateTeamApiKey(input.apiKey.trim()) const config = await this.profiles.load() const previous = config.profiles[input.profile] const previousAccount = previous?.credential.account @@ -206,7 +206,7 @@ export class AuthService { if (metadata.credential.kind === 'projectToken') { validateProjectToken(credential) } else { - validateOrganizationApiKey(credential) + validateTeamApiKey(credential) } credentialFormatValid = true } catch { diff --git a/src/services/bansafe.ts b/src/services/bansafe.ts index f6a194ec..937f057b 100644 --- a/src/services/bansafe.ts +++ b/src/services/bansafe.ts @@ -1,13 +1,13 @@ import { type BanSafeClaim, - type BanSafeCollectionSession, + type BanSafeCollectionConnection, type BanSafeEnforcementSummary, type BanSafeFinding, type BanSafeHealthAction, type BanSafeHealthHistory, type BanSafeIncident, - type BanSafeNumber, - type BanSafeNumberDetail, + type BanSafeConnection, + type BanSafeConnectionDetail, type BanSafeSignalDefinition, type BanSafeTelemetryDetail, type BanSafeTelemetrySnapshot, @@ -30,12 +30,12 @@ import { type ReportBanSafeIncidentRequest, type RequestOptions, type ResponseMetadata, - type SessionSafeMode, + type ConnectionSafeMode, type UpdateProjectHealthPolicyRequest, type UpdateProjectInsuranceEvidenceRequest, type UpdateProjectSafeModeRequest, type UpdateProjectWarmupPlanRequest, - type UpdateSessionSafeModeRequest, + type UpdateConnectionSafeModeRequest, } from '@polymorfa/sdk' export interface BanSafeResult<T> { @@ -57,25 +57,25 @@ interface ResultMetadata { export async function listHealth( client: OrganizationClient, params: ListBanSafeHealthParams, -): Promise<BanSafePageResult<BanSafeNumber>> { +): Promise<BanSafePageResult<BanSafeConnection>> { const response = await client.banSafe.listHealth(params) return pageResult(response.data, response.metadata) } export async function getHealth( client: OrganizationClient, - session: string, -): Promise<BanSafeResult<BanSafeNumberDetail>> { - const response = await client.banSafe.getHealth(session) + connection: string, +): Promise<BanSafeResult<BanSafeConnectionDetail>> { + const response = await client.banSafe.getHealth(connection) return result(response.data.data, response.metadata) } export async function listHealthHistory( client: OrganizationClient, - session: string, + connection: string, params: ListBanSafeHealthHistoryParams, ): Promise<BanSafeResult<BanSafeHealthHistory>> { - const response = await client.banSafe.listHealthHistory(session, params) + const response = await client.banSafe.listHealthHistory(connection, params) return result(response.data.data, response.metadata) } @@ -88,25 +88,25 @@ export async function listSignals( export async function getTelemetry( client: OrganizationClient, - session: string, + connection: string, ): Promise<BanSafeResult<BanSafeTelemetryDetail>> { - const response = await client.banSafe.getTelemetry(session) + const response = await client.banSafe.getTelemetry(connection) return result(response.data.data, response.metadata) } export async function listTelemetryHistory( client: OrganizationClient, - session: string, + connection: string, params: ListBanSafeTelemetryHistoryParams, ): Promise<BanSafePageResult<BanSafeTelemetrySnapshot>> { - const response = await client.banSafe.listTelemetryHistory(session, params) + const response = await client.banSafe.listTelemetryHistory(connection, params) return pageResult(response.data, response.metadata) } export async function listCollection( client: OrganizationClient, params: ListBanSafeCollectionParams, -): Promise<BanSafePageResult<BanSafeCollectionSession>> { +): Promise<BanSafePageResult<BanSafeCollectionConnection>> { const response = await client.banSafe.listCollection(params) return pageResult(response.data, response.metadata) } @@ -191,22 +191,22 @@ export async function updateProjectSafeMode( return result(response.data.data, response.metadata) } -export async function getSessionSafeMode( +export async function getConnectionSafeMode( client: OrganizationClient, - session: string, + connection: string, ) { - const response = await client.sessions.getSafeMode(session) + const response = await client.connections.getSafeMode(connection) return result(response.data.data, response.metadata) } -export async function updateSessionSafeMode( +export async function updateConnectionSafeMode( client: OrganizationClient, - session: string, + connection: string, input: unknown, options: RequestOptions, -): Promise<BanSafeResult<SessionSafeMode>> { - const response = await client.sessions.updateSafeMode( - session, +): Promise<BanSafeResult<ConnectionSafeMode>> { + const response = await client.connections.updateSafeMode( + connection, safeModeInput(input, true), options, ) @@ -287,42 +287,44 @@ export async function updateHealthPolicy( return result(response.data.data, response.metadata) } -export function renderHealthList(numbers: readonly BanSafeNumber[]): string { - if (numbers.length === 0) return 'No BanSafe Health records found.' - return numbers - .map((number) => +export function renderHealthList( + connections: readonly BanSafeConnection[], +): string { + if (connections.length === 0) return 'No BanSafe Health records found.' + return connections + .map((connection) => [ - number.session, - number.phoneNumber, - number.health ?? 'unknown', - number.band, - number.healthSource, + connection.connection, + connection.phoneNumber, + connection.health ?? 'unknown', + connection.band, + connection.healthSource, ].join('\t'), ) .join('\n') } -export function renderHealth(number: BanSafeNumberDetail): string { - const explanation = number.healthExplanation +export function renderHealth(connection: BanSafeConnectionDetail): string { + const explanation = connection.healthExplanation return [ - `Session\t${number.session}`, - `Phone\t${number.phoneNumber}`, - `Health\t${number.health ?? 'unknown'}`, - `Band\t${number.band}`, - `Source\t${number.healthSource}`, - `Estimator\t${number.healthEstimatorVersion ?? ''}`, - `Reliability\t${number.healthReliability}`, - `Coverage\t${number.healthFeatureCoverage ?? 'unknown'}`, - `Observed state\t${number.observedAccountState?.state ?? 'not observed'}`, + `Connection\t${connection.connection}`, + `Phone\t${connection.phoneNumber}`, + `Health\t${connection.health ?? 'unknown'}`, + `Band\t${connection.band}`, + `Source\t${connection.healthSource}`, + `Estimator\t${connection.healthEstimatorVersion ?? ''}`, + `Reliability\t${connection.healthReliability}`, + `Coverage\t${connection.healthFeatureCoverage ?? 'unknown'}`, + `Observed state\t${connection.observedAccountState?.state ?? 'not observed'}`, `Collection groups\t${explanation?.measuredGroups.join(', ') ?? 'unavailable'}`, `Missing groups\t${explanation?.missingGroups.join(', ') ?? 'unavailable'}`, - `Findings\t${number.findings.length}`, + `Findings\t${connection.findings.length}`, ].join('\n') } export function renderHealthHistory(history: BanSafeHealthHistory): string { if (history.points.length === 0) - return `No Health history found for ${history.session}.` + return `No Health history found for ${history.connection}.` return history.points .map((point) => [ @@ -354,7 +356,7 @@ export function renderTelemetry(telemetry: BanSafeTelemetryDetail): string { const measured = snapshot?.signals.filter((signal) => signal.measured).length ?? 0 return [ - `Session\t${telemetry.session}`, + `Connection\t${telemetry.connection}`, `Collection\t${telemetry.collection.state}`, `Latest flush\t${telemetry.collection.latestFlushedAt ?? 'none'}`, `Fresh until\t${telemetry.collection.freshUntil ?? 'none'}`, @@ -384,17 +386,17 @@ export function renderTelemetryHistory( } export function renderCollection( - sessions: readonly BanSafeCollectionSession[], + connections: readonly BanSafeCollectionConnection[], ): string { - if (sessions.length === 0) return 'No project sessions found.' - return sessions - .map((session) => + if (connections.length === 0) return 'No project connections found.' + return connections + .map((connection) => [ - session.session, - session.collection.state, - session.collection.latestFlushedAt ?? '', - session.collection.collectorVersion ?? '', - session.collection.droppedRecords ?? '', + connection.connection, + connection.collection.state, + connection.collection.latestFlushedAt ?? '', + connection.collection.collectorVersion ?? '', + connection.collection.droppedRecords ?? '', ].join('\t'), ) .join('\n') @@ -405,7 +407,7 @@ export function renderFindings(findings: readonly BanSafeFinding[]): string { return findings .map((finding) => [ - finding.session, + finding.connection, finding.key, finding.status, finding.severity ?? '', @@ -423,7 +425,7 @@ export function renderEnforcement( return records .map((record) => [ - record.session, + record.connection, record.rung, record.state, record.health ?? 'unknown', @@ -440,7 +442,7 @@ export function renderIncidents(incidents: readonly BanSafeIncident[]): string { .map((incident) => [ incident.id, - incident.session, + incident.connection, incident.kind, incident.source, incident.startedAt, @@ -456,7 +458,7 @@ export function renderClaims(claims: readonly BanSafeClaim[]): string { .map((claim) => [ claim.id, - claim.session, + claim.connection, claim.status, claim.verdict, claim.amountCents, @@ -469,7 +471,7 @@ export function renderClaims(claims: readonly BanSafeClaim[]): string { export function renderClaim(claim: BanSafeClaim): string { return [ `Claim\t${claim.id}`, - `Session\t${claim.session}`, + `Connection\t${claim.connection}`, `Status\t${claim.status}`, `Verdict\t${claim.verdict}`, `Amount credits\t${claim.amountCents}`, @@ -495,12 +497,12 @@ function simultaneousCallsEvidence(claim: BanSafeClaim): string[] { } export function renderSafeMode( - mode: ProjectSafeMode | SessionSafeMode, + mode: ProjectSafeMode | ConnectionSafeMode, ): string { const settings = 'effective' in mode ? mode.effective : mode.ceiling return [ `Project\t${mode.projectId}`, - ...('session' in mode ? [`Session\t${mode.session}`] : []), + ...('connection' in mode ? [`Connection\t${mode.connection}`] : []), `Presence\t${settings.presence}`, `Typing\t${settings.typing}`, `Reads\t${settings.reads}`, @@ -540,7 +542,7 @@ export function renderHealthActions( .map((action) => [ action.id, - action.session, + action.connection, action.mode, action.action, action.status, @@ -558,7 +560,7 @@ export function renderHealthPolicy(policy: ProjectHealthPolicy): string { `Version\t${policy.version}`, `Enabled\t${policy.enabled}`, `Threshold\t${policy.threshold}`, - `Session action\t${policy.sessionAction}`, + `Connection action\t${policy.connectionAction}`, `Slowdown messages/second\t${policy.slowDownMps ?? 'off'}`, `Email notification\t${policy.emailNotification}`, `Webhook notification\t${policy.webhookNotification}`, @@ -574,7 +576,7 @@ function healthPolicyInput(input: unknown): UpdateProjectHealthPolicyRequest { 'version', 'enabled', 'threshold', - 'sessionAction', + 'connectionAction', 'slowDownMps', 'emailNotification', 'webhookNotification', @@ -604,11 +606,11 @@ function healthPolicyInput(input: unknown): UpdateProjectHealthPolicyRequest { 'Health policy threshold must be an integer from 0 to 100.', ) if ( - typeof input.sessionAction !== 'string' || - !['none', 'stop', 'slow_down', 'log_out'].includes(input.sessionAction) + typeof input.connectionAction !== 'string' || + !['none', 'stop', 'slow_down', 'log_out'].includes(input.connectionAction) ) throw invalidPolicy( - 'Health policy sessionAction must be none, stop, slow_down, or log_out.', + 'Health policy connectionAction must be none, stop, slow_down, or log_out.', ) if ( input.slowDownMps !== null && @@ -617,17 +619,17 @@ function healthPolicyInput(input: unknown): UpdateProjectHealthPolicyRequest { input.slowDownMps <= 0) ) throw invalidPolicy( - 'Health policy slowDownMps must be null or a positive number.', + 'Health policy slowDownMps must be null or a positive connection.', ) - if (input.sessionAction === 'slow_down' && input.slowDownMps === null) + if (input.connectionAction === 'slow_down' && input.slowDownMps === null) throw invalidPolicy('slow_down requires a positive slowDownMps.') - if (input.sessionAction !== 'slow_down' && input.slowDownMps !== null) + if (input.connectionAction !== 'slow_down' && input.slowDownMps !== null) throw invalidPolicy( - 'slowDownMps must be null unless sessionAction is slow_down.', + 'slowDownMps must be null unless connectionAction is slow_down.', ) if ( input.enabled === true && - input.sessionAction === 'none' && + input.connectionAction === 'none' && input.emailNotification === false && input.webhookNotification === false ) @@ -640,7 +642,7 @@ function healthPolicyInput(input: unknown): UpdateProjectHealthPolicyRequest { function safeModeInput( input: unknown, allowInherit: boolean, -): UpdateProjectSafeModeRequest | UpdateSessionSafeModeRequest { +): UpdateProjectSafeModeRequest | UpdateConnectionSafeModeRequest { if (!isRecord(input)) throw invalidInput('Safe Mode input must contain one JSON object.') const allowed = [ diff --git a/src/services/billing-controls.ts b/src/services/billing-controls.ts index 8062a6ec..16d40485 100644 --- a/src/services/billing-controls.ts +++ b/src/services/billing-controls.ts @@ -8,13 +8,13 @@ import {z} from 'zod' const uuid = z.uuid() const revision = z.number().int().min(0).max(2147483646) const priority = z.number().int().min(0).max(1000000) -export const billingScope = z.enum(['project', 'customer', 'number']) +export const billingScope = z.enum(['project', 'customer', 'connection']) const row = z.object({id: uuid, name: z.string(), priority}) const priorities = z.object({ revision, projects: z.array(row), customers: z.array(row.extend({projectId: uuid})), - numbers: z.array(row.extend({projectId: uuid})), + connections: z.array(row.extend({projectId: uuid})), }) const credits = z.number().finite().nonnegative() const limits = z.object({ @@ -75,7 +75,7 @@ export function limitValue( return Number(value) } async function request<T>( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, method: 'GET' | 'PUT', path: string, schema: z.ZodType<T>, @@ -98,10 +98,7 @@ async function request<T>( }) return {data: parsed.data, metadata: response.metadata} } -export function getLimits( - client: ClientInstance<'organization'>, - projectId?: string, -) { +export function getLimits(client: ClientInstance<'team'>, projectId?: string) { return request( client, 'GET', @@ -112,8 +109,8 @@ export function getLimits( ) } export function setLimit( - client: ClientInstance<'organization'>, - scope: 'project' | 'customer' | 'number', + client: ClientInstance<'team'>, + scope: 'project' | 'customer' | 'connection', id: string, credits: number | null, expectedRevision: number, @@ -130,7 +127,7 @@ export function setLimit( ) } export function getPriorities( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, projectId?: string, ) { return request( @@ -143,8 +140,8 @@ export function getPriorities( ) } export function setPriority( - client: ClientInstance<'organization'>, - scope: 'project' | 'customer' | 'number', + client: ClientInstance<'team'>, + scope: 'project' | 'customer' | 'connection', id: string, value: number, expectedRevision: number, @@ -161,8 +158,8 @@ export function setPriority( ) } export function reorderPriorities( - client: ClientInstance<'organization'>, - scope: 'project' | 'customer' | 'number' | 'resource', + client: ClientInstance<'team'>, + scope: 'project' | 'customer' | 'connection' | 'resource', ids: string[], expectedRevision: number, projectId?: string, @@ -170,13 +167,13 @@ export function reorderPriorities( if (scope === 'resource') { if (!projectId) throw new PolymorfaValidationError( - '--project is required for customer and number funding controls.', + '--project is required for customer and connection funding controls.', ) const resources = ids.map((value) => { const [kind, id, ...extra] = value.split(':') - if ((kind !== 'customer' && kind !== 'number') || !id || extra.length) + if ((kind !== 'customer' && kind !== 'connection') || !id || extra.length) throw new PolymorfaValidationError( - 'Use customer:UUID or number:UUID, highest first.', + 'Use customer:UUID or connection:UUID, highest first.', ) return {scope: kind, resourceId: resourceId(id)} }) @@ -202,7 +199,7 @@ export function reorderPriorities( (scope === 'project' && projectId) ) throw new PolymorfaValidationError( - 'Use unique IDs; --project is required for customer or number order.', + 'Use unique IDs; --project is required for customer or connection order.', {code: 'invalid_billing_control'}, ) return request(client, 'PUT', '/platform/billing/priorities', priorities, { @@ -228,9 +225,9 @@ export function renderPriorities(data: BillingPriorities): string { (c) => `customer\t${c.id}\t${c.name}\t${c.priority}\tproject ${c.projectId}`, ), - ...data.numbers.map( + ...data.connections.map( (n) => - `number\t${n.id}\t${n.name}\t${n.priority}\tproject ${n.projectId}`, + `connection\t${n.id}\t${n.name}\t${n.priority}\tproject ${n.projectId}`, ), ].join('\n') } @@ -241,8 +238,8 @@ const resourceControls = z.object({ priorityRevision: revision, }) export function getResourceControls( - client: ClientInstance<'organization'>, - scope: 'project' | 'customer' | 'number', + client: ClientInstance<'team'>, + scope: 'project' | 'customer' | 'connection', id: string, ) { return request( @@ -253,8 +250,8 @@ export function getResourceControls( ) } export function setResourceControls( - client: ClientInstance<'organization'>, - scope: 'project' | 'customer' | 'number', + client: ClientInstance<'team'>, + scope: 'project' | 'customer' | 'connection', id: string, input: { limitCredits: number | null diff --git a/src/services/business.ts b/src/services/business.ts index 44a60944..fa4e6cb3 100644 --- a/src/services/business.ts +++ b/src/services/business.ts @@ -50,20 +50,20 @@ type BusinessMutation<T> = T | AsyncAcceptedData export async function viewOwnBusinessProfile( client: MessagingClient, - session: string, + connection: string, ): Promise<BusinessResult<BusinessProfile>> { - const response = await client.business.getProfile(session) + const response = await client.business.getProfile(connection) return result(response.data.data, response.metadata) } export async function updateOwnBusinessProfile( client: MessagingClient, - session: string, + connection: string, input: unknown, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessProfileStatus>>> { const response = await client.business.updateProfile( - session, + connection, profileUpdate(input), options, ) @@ -72,12 +72,12 @@ export async function updateOwnBusinessProfile( export async function setBusinessCoverPhoto( client: MessagingClient, - session: string, + connection: string, source: {readonly file?: string; readonly url?: string}, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessCoverPhotoResult>>> { const response = await client.business.setCoverPhoto( - session, + connection, await coverPhotoRequest(source), options, ) @@ -86,12 +86,12 @@ export async function setBusinessCoverPhoto( export async function deleteBusinessCoverPhoto( client: MessagingClient, - session: string, + connection: string, coverPhotoId: string, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessProfileStatus>>> { const response = await client.business.deleteCoverPhoto( - session, + connection, coverPhotoId, options, ) @@ -100,30 +100,30 @@ export async function deleteBusinessCoverPhoto( export async function viewBusinessCatalog( client: MessagingClient, - session: string, + connection: string, params: BusinessCatalogParams, ): Promise<BusinessResult<BusinessCatalogPage>> { - const response = await client.business.getCatalog(session, params) + const response = await client.business.getCatalog(connection, params) return result(response.data.data, response.metadata) } export async function createBusinessCatalog( client: MessagingClient, - session: string, + connection: string, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessActionSuccess>>> { - const response = await client.business.createCatalog(session, options) + const response = await client.business.createCatalog(connection, options) return result(response.data.data, response.metadata) } export async function setBusinessCartEnabled( client: MessagingClient, - session: string, + connection: string, enabled: boolean, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessActionSuccess>>> { const response = await client.business.setCartEnabled( - session, + connection, {enabled}, options, ) @@ -132,22 +132,26 @@ export async function setBusinessCartEnabled( export async function viewBusinessProduct( client: MessagingClient, - session: string, + connection: string, productId: string, params: BusinessProductParams, ): Promise<BusinessResult<BusinessProduct>> { - const response = await client.business.getProduct(session, productId, params) + const response = await client.business.getProduct( + connection, + productId, + params, + ) return result(response.data.data, response.metadata) } export async function createBusinessProduct( client: MessagingClient, - session: string, + connection: string, input: unknown, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessProduct>>> { const response = await client.business.createProduct( - session, + connection, await productMutation(input, false), options, ) @@ -156,13 +160,13 @@ export async function createBusinessProduct( export async function replaceBusinessProduct( client: MessagingClient, - session: string, + connection: string, productId: string, input: unknown, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessProduct>>> { const response = await client.business.updateProduct( - session, + connection, productId, await productMutation(input, true), options, @@ -172,12 +176,12 @@ export async function replaceBusinessProduct( export async function deleteBusinessProduct( client: MessagingClient, - session: string, + connection: string, productId: string, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessProductDeleteResult>>> { const response = await client.business.deleteProduct( - session, + connection, productId, options, ) @@ -186,13 +190,13 @@ export async function deleteBusinessProduct( export async function setBusinessProductVisibility( client: MessagingClient, - session: string, + connection: string, productId: string, hidden: boolean, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessActionSuccess>>> { const response = await client.business.setProductVisibility( - session, + connection, productId, {hidden}, options, @@ -202,13 +206,13 @@ export async function setBusinessProductVisibility( export async function appealBusinessProduct( client: MessagingClient, - session: string, + connection: string, productId: string, reason: string, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessActionSuccess>>> { const response = await client.business.appealProduct( - session, + connection, productId, appeal(reason), options, @@ -218,21 +222,21 @@ export async function appealBusinessProduct( export async function listBusinessCollections( client: MessagingClient, - session: string, + connection: string, params: BusinessCollectionsParams, ): Promise<BusinessResult<BusinessCollectionPage>> { - const response = await client.business.listCollections(session, params) + const response = await client.business.listCollections(connection, params) return result(response.data.data, response.metadata) } export async function viewBusinessCollection( client: MessagingClient, - session: string, + connection: string, collectionId: string, params: BusinessCollectionParams, ): Promise<BusinessResult<BusinessCollection>> { const response = await client.business.getCollection( - session, + connection, collectionId, params, ) @@ -241,13 +245,13 @@ export async function viewBusinessCollection( export async function createBusinessCollection( client: MessagingClient, - session: string, + connection: string, input: BusinessCollectionCreateRequest, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessCollectionMutationResult>>> { validateCollectionCreate(input) const response = await client.business.createCollection( - session, + connection, input, options, ) @@ -256,14 +260,14 @@ export async function createBusinessCollection( export async function updateBusinessCollection( client: MessagingClient, - session: string, + connection: string, collectionId: string, input: BusinessCollectionUpdateRequest, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessCollectionMutationResult>>> { validateCollectionUpdate(input) const response = await client.business.updateCollection( - session, + connection, collectionId, input, options, @@ -273,12 +277,12 @@ export async function updateBusinessCollection( export async function deleteBusinessCollection( client: MessagingClient, - session: string, + connection: string, collectionId: string, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessActionSuccess>>> { const response = await client.business.deleteCollection( - session, + connection, collectionId, options, ) @@ -287,12 +291,12 @@ export async function deleteBusinessCollection( export async function reorderBusinessCollections( client: MessagingClient, - session: string, + connection: string, input: unknown, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessActionSuccess>>> { const response = await client.business.reorderCollections( - session, + connection, collectionReorder(input), options, ) @@ -301,13 +305,13 @@ export async function reorderBusinessCollections( export async function appealBusinessCollection( client: MessagingClient, - session: string, + connection: string, collectionId: string, reason: string, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessActionSuccess>>> { const response = await client.business.appealCollection( - session, + connection, collectionId, appeal(reason), options, @@ -317,7 +321,7 @@ export async function appealBusinessCollection( export async function viewBusinessOrder( client: MessagingClient, - session: string, + connection: string, orderId: string, token: string, options: RequestOptions = {}, @@ -329,7 +333,7 @@ export async function viewBusinessOrder( ) } const response = await client.business.getOrder( - session, + connection, orderId, {token}, options, @@ -339,20 +343,20 @@ export async function viewBusinessOrder( export async function viewBusinessCompliance( client: MessagingClient, - session: string, + connection: string, ): Promise<BusinessResult<BusinessMerchantCompliance>> { - const response = await client.business.getMerchantCompliance(session) + const response = await client.business.getMerchantCompliance(connection) return result(response.data.data, response.metadata) } export async function replaceBusinessCompliance( client: MessagingClient, - session: string, + connection: string, input: unknown, options: RequestOptions = {}, ): Promise<BusinessResult<BusinessMutation<BusinessMerchantCompliance>>> { const response = await client.business.setMerchantCompliance( - session, + connection, merchantCompliance(input), options, ) @@ -361,17 +365,17 @@ export async function replaceBusinessCompliance( export async function viewBusinessLinkedAccounts( client: MessagingClient, - session: string, + connection: string, ): Promise<BusinessResult<BusinessLinkedAccounts>> { - const response = await client.business.getLinkedAccounts(session) + const response = await client.business.getLinkedAccounts(connection) return result(response.data.data, response.metadata) } export async function viewBusinessEligibility( client: MessagingClient, - session: string, + connection: string, ): Promise<BusinessResult<BusinessEligibility>> { - const response = await client.business.getEligibility(session) + const response = await client.business.getEligibility(connection) return result(response.data.data, response.metadata) } diff --git a/src/services/call-analytics.ts b/src/services/call-analytics.ts index a6b3e636..bf4f2995 100644 --- a/src/services/call-analytics.ts +++ b/src/services/call-analytics.ts @@ -30,7 +30,7 @@ export const CALL_OUTCOMES = [ export const CALL_STATS_GROUP_BY = [ 'day', 'hour', - 'session', + 'connection', 'outcome', ] as const export const CALL_EXPORT_FORMATS = ['csv', 'ndjson'] as const @@ -43,7 +43,7 @@ const MAX_RANGE_DAYS: Readonly<Record<CallStatsGroupBy, number | undefined>> = { day: 366, hour: 31, outcome: undefined, - session: undefined, + connection: undefined, } /** * An IANA time zone name the runtime recognizes, such as UTC, CET or @@ -64,7 +64,7 @@ export function isTimeZoneName(value: string): boolean { export interface CallFilterInput { readonly direction?: string | undefined readonly outcome?: string | undefined - readonly session?: string | undefined + readonly connection?: string | undefined readonly since?: string | undefined readonly until?: string | undefined readonly upstream?: string | undefined @@ -80,7 +80,7 @@ type Query = Readonly<Record<string, string | number>> export class CallAnalyticsApi { private readonly calls: - PlatformCallsResource<'organization'> | PlatformCallsResource<'project'> + PlatformCallsResource<'team'> | PlatformCallsResource<'project'> constructor( environment: DeveloperEnvironment, @@ -107,7 +107,7 @@ export class CallAnalyticsApi { } else { const root = new Client({ ...options, - credential: {type: 'organizationApiKey', value: environment.credential}, + credential: {type: 'teamApiKey', value: environment.credential}, }) this.calls = environment.context.owner === 'project' && environment.context.projectId @@ -136,7 +136,7 @@ export class CallAnalyticsApi { if ( !data || typeof data.call?.callId !== 'string' || - typeof data.call.sessionId !== 'string' || + typeof data.call.connectionId !== 'string' || typeof data.call.state !== 'string' || typeof data.call.live !== 'boolean' || !Array.isArray(data.history?.events) || @@ -196,12 +196,15 @@ export class CallAnalyticsApi { export function callFilterQuery(input: CallFilterInput): Query { const time = optionalTimeRange(input.since, input.until) - const session = input.session?.trim() - if (session !== undefined && (session.length === 0 || session.length > 128)) { - throw invalid('--session must be 1 to 128 characters.') + const connection = input.connection?.trim() + if ( + connection !== undefined && + (connection.length === 0 || connection.length > 128) + ) { + throw invalid('--connection must be 1 to 128 characters.') } return { - ...(session === undefined ? {} : {sessionId: session}), + ...(connection === undefined ? {} : {connectionId: connection}), ...(input.direction === undefined ? {} : {direction: input.direction}), ...(input.upstream === undefined ? {} : {upstream: input.upstream}), ...(input.outcome === undefined ? {} : {outcome: input.outcome}), @@ -443,7 +446,7 @@ function renderGroups(stats: CallStats): string { day: 'Day', hour: 'Hour', outcome: 'Outcome', - session: 'Session', + connection: 'Connection', }[stats.groupBy] if (stats.groups.length === 0) return `No calls in this range.` const lines = [ @@ -476,7 +479,7 @@ function renderGroups(stats: CallStats): string { ] if (stats.groupsTruncated) { lines.push( - 'Only the 500 numbers with the most calls are listed; totals count every call.', + 'Only the 500 connections with the most calls are listed; totals count every call.', ) } return lines.join('\n') @@ -544,7 +547,7 @@ function invalid(message: string): PolymorfaValidationError { export interface StoredCallDetail { readonly call: { readonly callId: string - readonly sessionId: string + readonly connectionId: string readonly state: string readonly live: boolean } @@ -566,11 +569,11 @@ export function renderCallRecords( records.length === 0 ? ['No call records found.'] : [ - 'Call ID\tNumber\tDirection\tOutcome\tConnected seconds', + 'Call ID\tConnection\tDirection\tOutcome\tConnected seconds', ...records.map((record) => [ record.callId, - record.sessionId, + record.connectionId, record.direction, record.outcome, record.durationSeconds ?? 'unknown', @@ -588,7 +591,7 @@ export function renderCallRecords( export function renderCallDetail(detail: StoredCallDetail): string { return [ `Call\t${terminalText(detail.call.callId)}`, - `Number\t${terminalText(detail.call.sessionId)}`, + `Connection\t${terminalText(detail.call.connectionId)}`, `State\t${terminalText(detail.call.state)}`, `Live\t${detail.call.live ? 'yes' : 'no'}`, ...detail.history.events.map( diff --git a/src/services/call-consent.ts b/src/services/call-consent.ts index 7bfe4ed0..1a40f576 100644 --- a/src/services/call-consent.ts +++ b/src/services/call-consent.ts @@ -20,7 +20,7 @@ import {conversationReference} from './conversation.js' import {validateCallTarget} from './calls.js' import {assertCursorAdvanced} from '../developer/support.js' -type PlatformClient = ClientInstance<'organization'> +type PlatformClient = ClientInstance<'team'> export interface CallConsentResult<T> { readonly data: T @@ -580,16 +580,16 @@ function rejection( } } -// ── Call permissions (Cloud API numbers) ─────────────────────────────────── +// ── Call permissions (Cloud API connections) ─────────────────────────────────── export async function viewCallPermission( client: MessagingClient, - session: string, + connection: string, to: string, ): Promise<CallConsentResult<CallPermission>> { const target = validateCallTarget(to) const response = await client.voip.retrieveCallPermission( - validateSession(session), + validateConnection(connection), target, ) return envelope(response.data.data, response.metadata) @@ -597,11 +597,11 @@ export async function viewCallPermission( export async function checkCall( client: MessagingClient, - session: string, + connection: string, to: string, ): Promise<CallConsentResult<CallCheck>> { const response = await client.voip.check({ - session: validateSession(session), + connection: validateConnection(connection), to: validateCallTarget(to), }) return envelope(response.data.data, response.metadata) @@ -609,7 +609,7 @@ export async function checkCall( export async function requestCallPermission( client: MessagingClient, - session: string, + connection: string, to: string, body: string, options: RequestOptions = {}, @@ -622,7 +622,7 @@ export async function requestCallPermission( ) } const response = await client.messages.send( - validateSession(session), + validateConnection(connection), { content: {callPermissionRequest: {body}}, conversation: conversationReference(to.trim()), @@ -713,7 +713,7 @@ export function renderCallCheck(check: CallCheck): string { `Allowed\t${check.allowed ? 'yes' : 'no'}`, ...(check.refusal === null ? [] : [`Refusal\t${check.refusal}`]), ...(check.permission === null - ? ['Call permission\tnot used on linked-device numbers'] + ? ['Call permission\tnot used on linked-device connections'] : permissionLines(check.permission)), ].join('\n') } @@ -817,12 +817,12 @@ function optOutIdentity( return {} } -function validateSession(session: string): string { - const trimmed = session.trim() +function validateConnection(connection: string): string { + const trimmed = connection.trim() if (trimmed.length === 0 || trimmed.length > 128) { throw new PolymorfaConfigurationError( - 'Session must contain 1 to 128 characters.', - 'session', + 'Connection must contain 1 to 128 characters.', + 'connection', ) } return trimmed diff --git a/src/services/call-links.ts b/src/services/call-links.ts index e913b529..7e87748b 100644 --- a/src/services/call-links.ts +++ b/src/services/call-links.ts @@ -5,7 +5,7 @@ import { type VoipPreviewedCallLink, } from '@polymorfa/sdk' -import {type CallsResult, result, validateSession, yesNo} from './calls.js' +import {type CallsResult, result, validateConnection, yesNo} from './calls.js' // A pasted link may sit in share text and carry a query or fragment; only its // path names the media type and token. @@ -42,10 +42,10 @@ export function parseCallLink(input: string): ParsedCallLink { export async function createCallLink( client: MessagingClient, - input: {readonly session: string; readonly video?: boolean}, + input: {readonly connection: string; readonly video?: boolean}, ): Promise<CallsResult<VoipCreatedCallLink>> { const response = await client.voip.createCallLink({ - session: validateSession(input.session), + connection: validateConnection(input.connection), video: input.video === true, }) return result(response.data.data, response.metadata) @@ -55,7 +55,7 @@ export async function previewCallLink( client: MessagingClient, input: { readonly link: ParsedCallLink - readonly session: string + readonly connection: string readonly video?: boolean }, ): Promise<CallsResult<VoipPreviewedCallLink>> { @@ -70,7 +70,7 @@ export async function previewCallLink( ) } const response = await client.voip.previewCallLink({ - session: validateSession(input.session), + connection: validateConnection(input.connection), token: link.token, video: link.video ?? input.video === true, }) @@ -80,7 +80,7 @@ export async function previewCallLink( export function renderCreatedCallLink(link: VoipCreatedCallLink): string { return [ `Link\t${link.url}`, - `Session\t${link.session}`, + `Connection\t${link.connection}`, `Video\t${yesNo(link.video)}`, 'Anyone with this link can use it in WhatsApp. Keep it private. Creating it did not place or join a call.', ].join('\n') @@ -90,10 +90,10 @@ export function renderPreviewedCallLink(link: VoipPreviewedCallLink): string { const creator = link.creator.phoneNumber ?? link.creator.username ?? link.creator.id return [ - `Session\t${link.session}`, + `Connection\t${link.connection}`, `Video\t${yesNo(link.video)}`, `Creator\t${creator}`, `Approval required\t${yesNo(link.approvalRequired)}`, - `Number is link admin\t${yesNo(link.isAdmin)}`, + `Connection is link admin\t${yesNo(link.isAdmin)}`, ].join('\n') } diff --git a/src/services/calls.ts b/src/services/calls.ts index 0c65b5df..349aabfd 100644 --- a/src/services/calls.ts +++ b/src/services/calls.ts @@ -30,10 +30,10 @@ import { type CallInboundRoute, type MessagingCredential, type ResponseMetadata, - type SessionCallSettings, - type SessionCallSettingsResponse, + type ConnectionCallSettings, + type ConnectionCallSettingsResponse, type SuccessResponse, - type UpdateSessionCallSettingsRequest, + type UpdateConnectionCallSettingsRequest, type VoipAcceptCallResult, type VoipParticipant, type VoipPlaceCallResult, @@ -120,19 +120,22 @@ export function validateParticipant( return participant } -function requireServerSession( +function requireServerConnection( credential: CallsCredential, - session: string | undefined, + connection: string | undefined, action: string, ): string | undefined { - const trimmed = session?.trim() + const trimmed = connection?.trim() if (trimmed !== undefined && trimmed.length === 0) { - throw new PolymorfaConfigurationError('Session cannot be empty.', 'session') + throw new PolymorfaConfigurationError( + 'Connection cannot be empty.', + 'connection', + ) } if (credential.type !== 'clientToken' && trimmed === undefined) { throw new PolymorfaConfigurationError( - `${action} with a server API key requires --session. Client tokens use the session they are bound to.`, - 'session', + `${action} with a server API key requires --connection. Client tokens use the connection they are bound to.`, + 'connection', ) } return trimmed @@ -143,7 +146,7 @@ function requireServerSession( export interface PlaceCallInput { readonly exclusive?: boolean | undefined readonly participant?: string | undefined - readonly session?: string | undefined + readonly connection?: string | undefined readonly to?: string | readonly string[] | undefined readonly groupId?: string | undefined readonly video?: boolean | undefined @@ -178,14 +181,14 @@ export async function placeCall( 'A group call needs 2 to 31 distinct participants.', ) } - const session = requireServerSession( + const connection = requireServerConnection( credential, - input.session, + input.connection, 'Placing a call', ) const participant = validateParticipant(credential, input.participant) const options = { - ...(session === undefined ? {} : {session}), + ...(connection === undefined ? {} : {connection}), ...(input.video === undefined ? {} : {video: input.video}), ...(input.exclusive === undefined ? {} : {exclusive: input.exclusive}), ...(participant === undefined ? {} : {participant}), @@ -299,7 +302,7 @@ export async function ringCallParticipant( * (polymorfa/polymorfa#559). The pinned SDK predates them; delete these * extensions and use the SDK types directly once the pin includes them. */ -export type CallSettings = SessionCallSettings & { +export type CallSettings = ConnectionCallSettings & { readonly simultaneousCalls?: boolean /** * Preparatory, response-only: while simultaneous calls are off, the server's @@ -311,21 +314,21 @@ export type CallSettings = SessionCallSettings & { readonly simultaneousCallsCoverageExcludedUntil?: string | null } -type CallSettingsUpdateBody = UpdateSessionCallSettingsRequest & { +type CallSettingsUpdateBody = UpdateConnectionCallSettingsRequest & { readonly acknowledgeRisk?: boolean readonly simultaneousCalls?: boolean } /** Shown before simultaneous calls turn on, and when the risk is unconfirmed. */ export const SIMULTANEOUS_CALLS_RISK = - 'Simultaneous calls let this number hold any number of calls at once. WhatsApp’s own apps never hold two calls at once, so this is unusual for a WhatsApp account. While it is on, and for 30 days after you turn it off, Ban Insurance does not cover a ban of this number.' + 'Simultaneous calls let this Connection hold any number of calls at once. WhatsApp’s own apps never hold two calls at once, so this is unusual for a WhatsApp account. While it is on, and for 30 days after you turn it off, Ban Insurance does not cover a ban of this number.' export async function viewCallSettings( client: MessagingClient, - session: string, + connection: string, ): Promise<CallsResult<CallSettings>> { const response = await client.voip.retrieveCallSettings( - validateSession(session), + validateConnection(connection), ) return result(response.data.data, response.metadata) } @@ -351,10 +354,10 @@ export interface CallSettingsChanges { */ export async function updateCallSettings( client: MessagingClient, - session: string, + connection: string, changes: CallSettingsChanges, ): Promise<CallsResult<CallSettings>> { - const name = validateSession(session) + const name = validateConnection(connection) const {expectedRevision, acknowledgeRisk, ...settings} = changes if (acknowledgeRisk === true && changes.simultaneousCalls !== true) { throw new PolymorfaConfigurationError( @@ -412,20 +415,20 @@ export async function updateCallSettings( const response = body.simultaneousCalls === undefined ? await client.voip.updateCallSettings(name, body) - : await client.raw.request<SessionCallSettingsResponse>({ + : await client.raw.request<ConnectionCallSettingsResponse>({ method: 'PUT', - path: `/platform/sessions/${encodeURIComponent(name)}/call-settings`, + path: `/platform/connections/${encodeURIComponent(name)}/call-settings`, body, }) return result(response.data.data, response.metadata) } -export function validateSession(session: string): string { - const trimmed = session.trim() +export function validateConnection(connection: string): string { + const trimmed = connection.trim() if (trimmed.length === 0 || trimmed.length > 128) { throw new PolymorfaConfigurationError( - 'Session must contain 1 to 128 characters.', - 'session', + 'Connection must contain 1 to 128 characters.', + 'connection', ) } return trimmed @@ -553,8 +556,8 @@ const retentionConflict = const retentionForbidden = { change: - 'Call retention is a team setting; use a team API key with the sessions:read and sessions:manage scopes to change it (the command reads the setting before it changes it).', - read: 'Call retention is a team setting; use a team API key or project token with the sessions:read scope to read it.', + 'Call retention is a team setting; use a team API key with the connections:read and connections:manage scopes to change it (the command reads the setting before it changes it).', + read: 'Call retention is a team setting; use a team API key or project token with the connections:read scope to read it.', } as const /** Replace the API's generic 403 and 409 text with what the user can do. */ @@ -630,7 +633,7 @@ const conflictMessages: Readonly<Record<string, string>> = { export function renderPlacedCall(call: VoipPlaceCallResult): string { return [ `Call\t${call.callId}`, - `Session\t${call.session}`, + `Connection\t${call.connection}`, `Video\t${yesNo(call.video)}`, 'The call is ringing. Watch it with polymorfa calls watch.', ].join('\n') @@ -676,13 +679,13 @@ function coverageExclusionEnd( } export function renderCallSettings( - session: string, + connection: string, settings: CallSettings, now: number = Date.now(), ): string { const exclusionEnd = coverageExclusionEnd(settings, now) return [ - `Session\t${session}`, + `Connection\t${connection}`, `Calls\t${settings.callsEnabled === false ? 'off' : 'on'}`, `Conference mode\t${settings.conferenceMode === false ? 'off' : 'on'}`, `Incoming calls\t${settings.inboundRoute === 'sip_trunk' ? 'clients and SIP trunk' : 'clients'}`, @@ -693,7 +696,7 @@ export function renderCallSettings( ] : []), `Cloud API calls answered by\t${settings.hostCloudApiCalls === true ? 'Polymorfa Calls' : 'your Graph API integration'}`, - `Simultaneous calls\t${settings.simultaneousCalls === true ? 'on (Ban Insurance does not cover this number)' : 'off'}`, + `Simultaneous calls\t${settings.simultaneousCalls === true ? 'on (Ban Insurance does not cover this Connection)' : 'off'}`, ...(exclusionEnd === null ? [] : [`Ban Insurance exclusion ends\t${exclusionEnd}`]), @@ -738,7 +741,7 @@ export interface CallsClientInput { readonly baseUrl?: string | undefined readonly credential: CallsCredential readonly participant?: string | undefined - readonly session?: string | undefined + readonly connection?: string | undefined /** Injected for runtimes without a global WebSocket, and for tests. */ readonly WebSocket?: typeof globalThis.WebSocket | undefined } @@ -782,11 +785,15 @@ function createCallsClient( input: CallsClientInput, action: string, ): CallsClient { - const session = requireServerSession(input.credential, input.session, action) - if (input.credential.type === 'clientToken' && session !== undefined) { + const connection = requireServerConnection( + input.credential, + input.connection, + action, + ) + if (input.credential.type === 'clientToken' && connection !== undefined) { throw new PolymorfaConfigurationError( - `${action} with a client token uses the session the token is bound to; omit --session.`, - 'session', + `${action} with a client token uses the connection the token is bound to; omit --connection.`, + 'connection', ) } const participant = validateParticipant(input.credential, input.participant) @@ -799,8 +806,8 @@ function createCallsClient( } return new CallsClient({ token: input.credential.value, - // Client tokens are bound to one session and never send it. - session: session ?? '', + // Client tokens are bound to one connection and never send it. + connection: connection ?? '', baseUrl: assertCallsBaseUrl(input.baseUrl ?? DEFAULT_BASE_URL), WebSocket: WebSocketImpl, ...(participant === undefined ? {} : {participant}), @@ -839,14 +846,14 @@ export function callsClientError( } if (error instanceof CallsAuthError) { return new PolymorfaAuthenticationError( - `The credential does not authorize this session${refusal === undefined ? '' : ` (${refusal})`}. Check the credential, its client rules, and the session.`, + `The credential does not authorize this connection${refusal === undefined ? '' : ` (${refusal})`}. Check the credential, its client rules, and the connection.`, {code: refusal ?? error.code, cause: error}, ) } if (error instanceof CallsError) { if (error.code === 'invalid_request') { return new PolymorfaValidationError( - 'The API refused the calls connection. Check the session and participant.', + 'The API refused the calls connection. Check the connection and participant.', {code: error.code, cause: error}, ) } @@ -950,7 +957,7 @@ export interface WatchCallsSummary { } /** - * Follow a session's calls with the Calls client. The client authenticates, + * Follow a connection's calls with the Calls client. The client authenticates, * reconnects with backoff, and never answers or declines on its own. This * resolves on the abort signal or `count` and rejects on a terminal refusal. */ diff --git a/src/services/campaign-conversions.ts b/src/services/campaign-conversions.ts index b4c7e266..a751d9cf 100644 --- a/src/services/campaign-conversions.ts +++ b/src/services/campaign-conversions.ts @@ -10,7 +10,7 @@ import type {CampaignResult} from './campaigns.js' /** Report a conversion for one campaign recipient (beta). */ export async function recordCampaignConversion( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, campaignId: string, body: RecordCampaignConversionRequest, ): Promise<CampaignResult<CampaignConversion>> { @@ -20,7 +20,7 @@ export async function recordCampaignConversion( /** A campaign's conversion counts and per-currency values (beta). */ export async function viewCampaignConversions( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, campaignId: string, projectId: string, ): Promise<CampaignResult<CampaignConversionReport>> { diff --git a/src/services/campaign-frequency-cap.ts b/src/services/campaign-frequency-cap.ts index d2e7a1e1..512b5ecc 100644 --- a/src/services/campaign-frequency-cap.ts +++ b/src/services/campaign-frequency-cap.ts @@ -74,14 +74,14 @@ export function frequencyCapInput( } satisfies CampaignFrequencyCap, } } -export async function getFrequencyCap(client: ClientInstance<'organization'>) { +export async function getFrequencyCap(client: ClientInstance<'team'>) { const response = await client.raw.request<{ data: CampaignFrequencyCapSettings }>({method: 'GET', path: '/platform/campaign-settings/frequency-cap'}) return {data: response.data.data, metadata: response.metadata} } export async function updateFrequencyCap( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, body: UpdateCampaignFrequencyCapInput, ) { const response = await client.raw.request<{ diff --git a/src/services/campaign-segments-drip.ts b/src/services/campaign-segments-drip.ts index 83d02a97..924577cc 100644 --- a/src/services/campaign-segments-drip.ts +++ b/src/services/campaign-segments-drip.ts @@ -88,7 +88,7 @@ export function dripInput( return body } export async function campaignRequest<T>( - client: ClientInstance<'organization'> | MessagingClient, + client: ClientInstance<'team'> | MessagingClient, request: RawRequest, ) { const response = await client.raw.request<{data: T}>({ diff --git a/src/services/channels.ts b/src/services/channels.ts index 16d458b5..aabd5965 100644 --- a/src/services/channels.ts +++ b/src/services/channels.ts @@ -32,24 +32,24 @@ export interface ChannelResult<T> { export async function listChannels( client: MessagingClient, - session: string, + connection: string, ): Promise<ChannelResult<readonly Channel[]>> { - const response = await client.channels.list(session) + const response = await client.channels.list(connection) return result(response.data.data, response.metadata) } export async function viewChannel( client: MessagingClient, - session: string, + connection: string, channel: string, ): Promise<ChannelResult<Channel>> { - const response = await client.channels.retrieve(session, channel) + const response = await client.channels.retrieve(connection, channel) return result(response.data.data, response.metadata) } export async function createChannel( client: MessagingClient, - session: string, + connection: string, input: CreateChannelRequest, options: RequestOptions = {}, ): Promise<ChannelResult<Channel | AsyncAcceptedData>> { @@ -60,38 +60,42 @@ export async function createChannel( ) } - const response = await client.channels.create(session, input, options) + const response = await client.channels.create(connection, input, options) return result(response.data.data, response.metadata) } export async function deleteChannel( client: MessagingClient, - session: string, + connection: string, channel: string, options: RequestOptions = {}, ): Promise<ChannelResult<DeletedChannel | AsyncAcceptedData>> { - const response = await client.channels.delete(session, channel, options) + const response = await client.channels.delete(connection, channel, options) return result(response.data.data, response.metadata) } export async function listChannelMessages( client: MessagingClient, - session: string, + connection: string, channel: string, params: ChannelMessagesParams, ): Promise<ChannelResult<readonly ChannelMessage[]>> { - const response = await client.channels.listMessages(session, channel, params) + const response = await client.channels.listMessages( + connection, + channel, + params, + ) return result(response.data.data, response.metadata) } export async function listChannelMessageUpdates( client: MessagingClient, - session: string, + connection: string, channel: string, params: ChannelMessageUpdatesParams, ): Promise<ChannelResult<readonly ChannelMessage[]>> { const response = await client.channels.listMessageUpdates( - session, + connection, channel, params, ) @@ -100,13 +104,13 @@ export async function listChannelMessageUpdates( export async function markChannelMessageViewed( client: MessagingClient, - session: string, + connection: string, channel: string, messageId: string, options: RequestOptions = {}, ): Promise<ChannelResult<MarkChannelMessageViewedResponse>> { const response = await client.channels.markMessageViewed( - session, + connection, channel, parseMessageId(messageId), options, @@ -116,7 +120,7 @@ export async function markChannelMessageViewed( export async function reactToChannelMessage( client: MessagingClient, - session: string, + connection: string, channel: string, messageId: string, reaction: string, @@ -130,7 +134,7 @@ export async function reactToChannelMessage( } const response = await client.channels.reactToMessage( - session, + connection, channel, parseMessageId(messageId), {reaction}, @@ -141,12 +145,12 @@ export async function reactToChannelMessage( export async function subscribeToChannelLiveUpdates( client: MessagingClient, - session: string, + connection: string, channel: string, options: RequestOptions = {}, ): Promise<ChannelResult<ChannelLiveUpdates | AsyncAcceptedData>> { const response = await client.channels.subscribeToLiveUpdates( - session, + connection, channel, options, ) @@ -155,38 +159,38 @@ export async function subscribeToChannelLiveUpdates( export async function followChannel( client: MessagingClient, - session: string, + connection: string, channel: string, options: RequestOptions = {}, ): Promise<ChannelResult<FollowChannelResponse>> { - return channelAction(client.channels.follow(session, channel, options)) + return channelAction(client.channels.follow(connection, channel, options)) } export async function unfollowChannel( client: MessagingClient, - session: string, + connection: string, channel: string, options: RequestOptions = {}, ): Promise<ChannelResult<UnfollowChannelResponse>> { - return channelAction(client.channels.unfollow(session, channel, options)) + return channelAction(client.channels.unfollow(connection, channel, options)) } export async function muteChannel( client: MessagingClient, - session: string, + connection: string, channel: string, options: RequestOptions = {}, ): Promise<ChannelResult<MuteChannelResponse>> { - return channelAction(client.channels.mute(session, channel, options)) + return channelAction(client.channels.mute(connection, channel, options)) } export async function unmuteChannel( client: MessagingClient, - session: string, + connection: string, channel: string, options: RequestOptions = {}, ): Promise<ChannelResult<UnmuteChannelResponse>> { - return channelAction(client.channels.unmute(session, channel, options)) + return channelAction(client.channels.unmute(connection, channel, options)) } export function renderChannels(channels: readonly Channel[]): string { diff --git a/src/services/session-configuration.ts b/src/services/connection-configuration.ts similarity index 95% rename from src/services/session-configuration.ts rename to src/services/connection-configuration.ts index 393ac775..52e5a9bf 100644 --- a/src/services/session-configuration.ts +++ b/src/services/connection-configuration.ts @@ -1,11 +1,11 @@ import { PolymorfaConfigurationError, - type UpdateSessionRequest, + type UpdateConnectionRequest, } from '@polymorfa/sdk' function invalid(path: string): never { throw new PolymorfaConfigurationError( - `Invalid session configuration at ${path}.`, + `Invalid connection configuration at ${path}.`, 'input', ) } @@ -37,9 +37,9 @@ const resetPaths = [ ] /** Validate the complete JSON boundary before constructing a client or sending a request. */ -export function parseSessionConfigurationUpdate( +export function parseConnectionConfigurationUpdate( input: unknown, -): UpdateSessionRequest { +): UpdateConnectionRequest { const body = object(input, ['revision', 'configuration'], 'input') if (!Number.isSafeInteger(body.revision) || Number(body.revision) < 0) invalid('revision') @@ -159,5 +159,5 @@ export function parseSessionConfigurationUpdate( invalid(`configuration.reset.${path}: also present in set`) } } - return input as UpdateSessionRequest + return input as UpdateConnectionRequest } diff --git a/src/services/session-identities.ts b/src/services/connection-identities.ts similarity index 92% rename from src/services/session-identities.ts rename to src/services/connection-identities.ts index 948b8b46..6ff105a8 100644 --- a/src/services/session-identities.ts +++ b/src/services/connection-identities.ts @@ -9,7 +9,7 @@ import { type UserSecurityCode, } from '@polymorfa/sdk' -export interface SessionIdentityResult<T> { +export interface ConnectionIdentityResult<T> { readonly data: T readonly metadata: { readonly apiVersion?: string @@ -21,11 +21,11 @@ export interface SessionIdentityResult<T> { export async function rejectCall( client: MessagingClient, - session: string, + connection: string, callId: string, from: string, options: RequestOptions = {}, -): Promise<SessionIdentityResult<RejectCallResponse>> { +): Promise<ConnectionIdentityResult<RejectCallResponse>> { if (callId.length === 0) { throw new PolymorfaConfigurationError('Call ID cannot be empty.', 'call') } @@ -43,7 +43,7 @@ export async function rejectCall( } const response = await client.calls.reject( - session, + connection, callId, {from: from.trim()}, options, @@ -53,16 +53,16 @@ export async function rejectCall( export async function resolveIdentity( client: MessagingClient, - session: string, + connection: string, input: { readonly id?: string readonly phoneNumber?: string readonly username?: string readonly usernameKey?: string }, -): Promise<SessionIdentityResult<ResolveIdentityResult>> { +): Promise<ConnectionIdentityResult<ResolveIdentityResult>> { const response = await client.identities.resolve( - session, + connection, identityParams(input), ) return result(response.data.data, response.metadata) @@ -70,11 +70,11 @@ export async function resolveIdentity( export async function viewUserSecurityCode( client: MessagingClient, - session: string, + connection: string, userId: string, -): Promise<SessionIdentityResult<UserSecurityCode>> { +): Promise<ConnectionIdentityResult<UserSecurityCode>> { validateUserId(userId, 'User ID') - const response = await client.users.getSecurityCode(session, userId) + const response = await client.users.getSecurityCode(connection, userId) return result(response.data.data, response.metadata) } @@ -183,7 +183,7 @@ function row(label: string, value: string | undefined): string | undefined { function result<T>( data: T, metadata: ResponseMetadata, -): SessionIdentityResult<T> { +): ConnectionIdentityResult<T> { return { data, metadata: { diff --git a/src/services/number-tiers.ts b/src/services/connection-tiers.ts similarity index 63% rename from src/services/number-tiers.ts rename to src/services/connection-tiers.ts index 33cb9ed5..b09c5b99 100644 --- a/src/services/number-tiers.ts +++ b/src/services/connection-tiers.ts @@ -4,9 +4,9 @@ import { type HybridMergeCandidate, type HybridResolution, type HybridTransport, - type NumberHybridTransition, - type NumberTierChange, - type NumberTierQuoteRequest, + type ConnectionHybridTransition, + type ConnectionTierChange, + type ConnectionTierQuoteRequest, type RequestOptions, type ResponseMetadata, } from '@polymorfa/sdk' @@ -17,8 +17,8 @@ export const TIER_CHOICES = ['free', 'standard', 'pro', 'inherit'] as const export type TierChoice = (typeof TIER_CHOICES)[number] export const HYBRID_TRANSPORTS = ['linked_devices', 'official_api'] as const -/** The API's Number name rule, checked before sending a split. */ -const NUMBER_NAME = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/ +/** The API's Connection name rule, checked before sending a split. */ +const CONNECTION_NAME = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/ const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i export interface TierQuoteInput { @@ -27,14 +27,14 @@ export interface TierQuoteInput { readonly keep?: HybridTransport | undefined readonly split?: boolean | undefined readonly stay?: HybridTransport | undefined - readonly newNumberName?: string | undefined + readonly newConnectionName?: string | undefined readonly mergeWith?: string | undefined } /** Builds the tier quote body, refusing flag combinations the API rejects. */ export function tierQuoteRequest( input: TierQuoteInput, -): NumberTierQuoteRequest { +): ConnectionTierQuoteRequest { const base = { tierOverride: input.tier === 'inherit' ? null : input.tier, ...(input.projectId === undefined ? {} : {projectId: input.projectId}), @@ -43,7 +43,7 @@ export function tierQuoteRequest( if (input.mergeWith !== undefined) { if (resolution !== undefined) { throw new PolymorfaValidationError( - 'Use --merge-with on its own; --keep and --split resolve a Hybrid Link Number leaving Pro.', + 'Use --merge-with on its own; --keep and --split resolve a Hybrid Link Connection leaving Pro.', ) } if (input.tier !== 'pro') { @@ -51,13 +51,13 @@ export function tierQuoteRequest( 'A Hybrid Link merge needs --tier pro.', ) } - const absorbNumberId = input.mergeWith.trim() - if (!UUID.test(absorbNumberId)) { + const absorbConnectionId = input.mergeWith.trim() + if (!UUID.test(absorbConnectionId)) { throw new PolymorfaValidationError( - '--merge-with needs the other Number UUID. List pairs with `polymorfa session hybrid-merge-candidates`.', + '--merge-with needs the other Connection UUID. List pairs with `polymorfa connection hybrid-merge-candidates`.', ) } - return {...base, hybridMerge: {absorbNumberId}} + return {...base, hybridMerge: {absorbConnectionId}} } return resolution === undefined ? base @@ -71,25 +71,25 @@ function hybridResolution(input: TierQuoteInput): HybridResolution | undefined { 'Choose either --keep or --split, not both.', ) } - if (input.stay === undefined || input.newNumberName === undefined) { + if (input.stay === undefined || input.newConnectionName === undefined) { throw new PolymorfaValidationError( - '--split needs --stay <linked_devices|official_api> and --new-number-name <name>.', + '--split needs --stay <linked_devices|official_api> and --new-connection-name <name>.', ) } - if (!NUMBER_NAME.test(input.newNumberName)) { + if (!CONNECTION_NAME.test(input.newConnectionName)) { throw new PolymorfaValidationError( - '--new-number-name must be 1-64 characters: a letter or digit, then letters, digits, ".", "_" or "-".', + '--new-connection-name must be 1-64 characters: a letter or digit, then letters, digits, ".", "_" or "-".', ) } return { action: 'split', - existingNumberTransport: input.stay, - newNumberName: input.newNumberName, + existingConnectionTransport: input.stay, + newConnectionName: input.newConnectionName, } } - if (input.stay !== undefined || input.newNumberName !== undefined) { + if (input.stay !== undefined || input.newConnectionName !== undefined) { throw new PolymorfaValidationError( - '--stay and --new-number-name are used only with --split.', + '--stay and --new-connection-name are used only with --split.', ) } return input.keep === undefined @@ -98,23 +98,23 @@ function hybridResolution(input: TierQuoteInput): HybridResolution | undefined { } export async function quoteTierChange( - client: ClientInstance<'organization'>, - sessionId: string, - body: NumberTierQuoteRequest, -): Promise<PlatformResult<NumberTierChange>> { - const response = await client.sessions.quoteTierChange(sessionId, body) + client: ClientInstance<'team'>, + connectionId: string, + body: ConnectionTierQuoteRequest, +): Promise<PlatformResult<ConnectionTierChange>> { + const response = await client.connections.quoteTierChange(connectionId, body) return result(response.data.data, response.metadata) } export async function confirmTierChange( - client: ClientInstance<'organization'>, - sessionId: string, + client: ClientInstance<'team'>, + connectionId: string, quoteId: string, projectId?: string, options: RequestOptions = {}, -): Promise<PlatformResult<NumberTierChange>> { - const response = await client.sessions.setTierOverride( - sessionId, +): Promise<PlatformResult<ConnectionTierChange>> { + const response = await client.connections.setTierOverride( + connectionId, {quoteId, ...(projectId === undefined ? {} : {projectId})}, options, ) @@ -122,16 +122,19 @@ export async function confirmTierChange( } export async function retrieveTierChange( - client: ClientInstance<'organization'>, - sessionId: string, + client: ClientInstance<'team'>, + connectionId: string, quoteId: string, -): Promise<PlatformResult<NumberTierChange>> { - const response = await client.sessions.retrieveTierChange(sessionId, quoteId) +): Promise<PlatformResult<ConnectionTierChange>> { + const response = await client.connections.retrieveTierChange( + connectionId, + quoteId, + ) return result(response.data.data, response.metadata) } export async function listHybridMergeCandidates( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, projectId: string, ): Promise<PlatformResult<readonly HybridMergeCandidate[]>> { const response = await client.projects.listHybridMergeCandidates(projectId) @@ -139,7 +142,7 @@ export async function listHybridMergeCandidates( } export function renderTierChange( - change: NumberTierChange, + change: ConnectionTierChange, next?: string, ): string { const {quote} = change @@ -156,19 +159,21 @@ export function renderTierChange( change.failureReason === 'hybrid_choice_required' ) lines.push( - 'This Hybrid Link Number needs a choice before leaving Pro. Quote again with --keep linked_devices|official_api, or --split --stay linked_devices|official_api --new-number-name NAME.', + 'This Hybrid Link Connection needs a choice before leaving Pro. Quote again with --keep linked_devices|official_api, or --split --stay linked_devices|official_api --new-connection-name NAME.', ) if (next !== undefined) lines.push(next) return lines.join('\n') } -function renderHybridTransition(transition: NumberHybridTransition): string[] { +function renderHybridTransition( + transition: ConnectionHybridTransition, +): string[] { const plan = transition.action === 'keep' - ? `keep ${transition.keepTransport} on ${transition.survivingNumberId}; the other connection is disconnected` + ? `keep ${transition.keepTransport} on ${transition.survivingConnectionId}; the other method is disconnected` : transition.action === 'split' - ? `split: ${transition.existingNumberTransport} stays on ${transition.survivingNumberId}; the other connection moves to new Number "${transition.newNumberName}"${transition.newNumberId === undefined ? '' : ` (${transition.newNumberId})`}` - : `merge ${transition.absorbNumberId} into ${transition.survivingNumberId}` + ? `split: ${transition.existingConnectionTransport} stays on ${transition.survivingConnectionId}; the other method moves to new Connection "${transition.newConnectionName}"${transition.newConnectionId === undefined ? '' : ` (${transition.newConnectionId})`}` + : `merge ${transition.absorbConnectionId} into ${transition.survivingConnectionId}` const lines = [ `Hybrid Link: ${plan}`, `Hybrid Link status: ${transition.status ?? 'not confirmed'}${transition.failureReason ? ` (${transition.failureReason})` : ''}${transition.effectiveAtMs == null ? '' : `, runs ${isoTime(transition.effectiveAtMs)}`}`, @@ -182,16 +187,16 @@ function renderHybridTransition(transition: NumberHybridTransition): string[] { /** Customer wording for each candidate `ineligibleReason`. */ const MERGE_INELIGIBLE_REASONS: Readonly<Record<string, string>> = { - deletion_in_progress: 'a Number is being deleted', + deletion_in_progress: 'a Connection is being deleted', transition_in_progress: 'a tier or Hybrid Link change is already running', - pairing_in_progress: 'a Number is still pairing', + pairing_in_progress: 'a Connection is still pairing', hms_enabled: - 'both Numbers use hosted message storage; disable it on one Number', + 'both Connections use hosted message storage; disable it on one Connection', not_coexistence: - 'the Official API Number does not share the number with the WhatsApp Business app', - different_customer: 'the Numbers belong to different Customers', + 'the Official API Connection does not share the number with the WhatsApp Business app', + different_customer: 'the Connections belong to different Customers', connection_disabled: 'a connection is disabled', - not_connected: 'both Numbers must be connected', + not_connected: 'both Connections must be connected', } export function renderMergeCandidates( @@ -204,16 +209,18 @@ export function renderMergeCandidates( const verdict = candidate.eligible ? 'eligible' : `ineligible: ${reason === undefined ? 'unknown' : `${reason} (${MERGE_INELIGIBLE_REASONS[reason] ?? 'see the API reason'})`}` - const keep = candidate.numbers.filter((number) => !number.canBeAbsorbed) + const keep = candidate.connections.filter( + (connection) => !connection.canBeAbsorbed, + ) return [ - ...candidate.numbers.map( - (number) => - `${number.id} (${number.name}, ${number.transport}, ${number.status}, ${number.canBeAbsorbed ? 'can be absorbed' : 'must be kept'})`, + ...candidate.connections.map( + (connection) => + `${connection.id} (${connection.name}, ${connection.transport}, ${connection.status}, ${connection.canBeAbsorbed ? 'can be absorbed' : 'must be kept'})`, ), verdict, ...(candidate.eligible && keep.length === 1 ? [ - `merge with: session tier quote ${keep[0]!.id} --tier pro --merge-with ${candidate.numbers.find((number) => number.canBeAbsorbed)!.id}`, + `merge with: connection tier quote ${keep[0]!.id} --tier pro --merge-with ${candidate.connections.find((connection) => connection.canBeAbsorbed)!.id}`, ] : []), ].join('\t') diff --git a/src/services/contacts.ts b/src/services/contacts.ts index f153a873..d2cb0a21 100644 --- a/src/services/contacts.ts +++ b/src/services/contacts.ts @@ -24,54 +24,54 @@ export interface ContactResult<T> { export async function listContacts( client: MessagingClient, - session: string, + connection: string, ): Promise<ContactResult<readonly Contact[]>> { - const response = await client.contacts.list(session) + const response = await client.contacts.list(connection) return result(response.data.data, response.metadata) } export async function checkContacts( client: MessagingClient, - session: string, + connection: string, phones: readonly string[], ): Promise<ContactResult<readonly CheckContactResult[]>> { - const response = await client.contacts.check(session, phones) + const response = await client.contacts.check(connection, phones) return result(response.data.data, response.metadata) } export async function viewContact( client: MessagingClient, - session: string, + connection: string, contact: string, ): Promise<ContactResult<Contact>> { - const response = await client.contacts.retrieve(session, contact) + const response = await client.contacts.retrieve(connection, contact) return result(response.data.data, response.metadata) } export async function viewContactPicture( client: MessagingClient, - session: string, + connection: string, contact: string, ): Promise<ContactResult<ContactProfilePicture>> { - const response = await client.contacts.picture(session, contact) + const response = await client.contacts.picture(connection, contact) return result(response.data.data, response.metadata) } export async function viewContactInfo( client: MessagingClient, - session: string, + connection: string, contact: string, ): Promise<ContactResult<ContactUserInfo>> { - const response = await client.contacts.info(session, contact) + const response = await client.contacts.info(connection, contact) return result(response.data.data, response.metadata) } export async function listContactDevices( client: MessagingClient, - session: string, + connection: string, contact: string, ): Promise<ContactResult<readonly string[]>> { - const response = await client.contacts.devices(session, contact) + const response = await client.contacts.devices(connection, contact) return result(response.data.data, response.metadata) } @@ -81,10 +81,10 @@ export type BusinessProfileView = BusinessProfile & { export async function viewContactBusinessProfile( client: MessagingClient, - session: string, + connection: string, contact: string, ): Promise<ContactResult<BusinessProfileView>> { - const response = await client.contacts.businessProfile(session, contact) + const response = await client.contacts.businessProfile(connection, contact) const profile = response.data.data as BusinessProfile & {encryption?: unknown} if ( 'encryption' in profile && @@ -104,29 +104,29 @@ export async function viewContactBusinessProfile( export async function viewContactBlocklist( client: MessagingClient, - session: string, + connection: string, ): Promise<ContactResult<ContactBlocklist>> { - const response = await client.contacts.blocklist(session) + const response = await client.contacts.blocklist(connection) return result(response.data.data, response.metadata) } export async function blockContact( client: MessagingClient, - session: string, + connection: string, contact: string, options: RequestOptions = {}, ): Promise<ContactResult<SuccessResponse>> { - const response = await client.contacts.block(session, contact, options) + const response = await client.contacts.block(connection, contact, options) return result(response.data, response.metadata) } export async function unblockContact( client: MessagingClient, - session: string, + connection: string, contact: string, options: RequestOptions = {}, ): Promise<ContactResult<SuccessResponse>> { - const response = await client.contacts.unblock(session, contact, options) + const response = await client.contacts.unblock(connection, contact, options) return result(response.data, response.metadata) } diff --git a/src/services/customers.ts b/src/services/customers.ts index eccba578..966fa5cb 100644 --- a/src/services/customers.ts +++ b/src/services/customers.ts @@ -6,7 +6,7 @@ import { type Customer, type CustomerEvent, type CustomerListEnvelope, - type CustomerNumber, + type CustomerConnection, type CustomerPairingLink, type CustomerProjectRequest, type CustomersEnablement, @@ -17,7 +17,7 @@ import { PolymorfaValidationError, type RequestOptions, type ResponseMetadata, - type TransferCustomerNumberRequest, + type TransferCustomerConnectionRequest, type UpdateCustomerRequest, } from '@polymorfa/sdk' @@ -42,7 +42,7 @@ export function requireCustomerProject(projectId?: string): string { } export async function customerStatus( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, projectId: string, ): Promise<CustomerResult<CustomersStatus>> { const response = await client.customers.status(projectId) @@ -50,7 +50,7 @@ export async function customerStatus( } export async function enableCustomers( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, projectId: string, options: RequestOptions, ): Promise<CustomerResult<CustomersEnablement>> { @@ -59,7 +59,7 @@ export async function enableCustomers( } export async function listCustomers( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, params: ListCustomersParams, ): Promise<CustomerResult<CustomerListEnvelope>> { const response = await client.customers.list(params) @@ -67,7 +67,7 @@ export async function listCustomers( } export async function createCustomer( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, body: CreateCustomerRequest, options: RequestOptions, ): Promise<CustomerResult<Customer>> { @@ -76,7 +76,7 @@ export async function createCustomer( } export async function viewCustomer( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, customerId: string, projectId: string, ): Promise<CustomerResult<Customer>> { @@ -85,7 +85,7 @@ export async function viewCustomer( } export async function updateCustomer( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, customerId: string, body: UpdateCustomerRequest, ): Promise<CustomerResult<Customer>> { @@ -100,7 +100,7 @@ export async function updateCustomer( } export async function archiveCustomer( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, customerId: string, body: CustomerProjectRequest, options: RequestOptions, @@ -110,7 +110,7 @@ export async function archiveCustomer( } export async function restoreCustomer( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, customerId: string, body: CustomerProjectRequest, options: RequestOptions, @@ -119,17 +119,17 @@ export async function restoreCustomer( return result(response.data.data, response.metadata) } -export async function listCustomerNumbers( - client: ClientInstance<'organization'>, +export async function listCustomerConnections( + client: ClientInstance<'team'>, customerId: string, projectId: string, -): Promise<CustomerResult<readonly CustomerNumber[]>> { - const response = await client.customers.listNumbers(customerId, projectId) +): Promise<CustomerResult<readonly CustomerConnection[]>> { + const response = await client.customers.listConnections(customerId, projectId) return result(response.data.data, response.metadata) } export async function listCustomerEvents( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, customerId: string, params: ListCustomerEventsParams, ): Promise<CustomerResult<readonly CustomerEvent[]>> { @@ -138,7 +138,7 @@ export async function listCustomerEvents( } export async function createCustomerPairingLink( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, customerId: string, body: CreateCustomerPairingLinkRequest, options: RequestOptions, @@ -152,7 +152,7 @@ export async function createCustomerPairingLink( } export async function listCustomerPairingLinks( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, customerId: string, projectId: string, ): Promise<CustomerResult<readonly CustomerPairingLink[]>> { @@ -164,7 +164,7 @@ export async function listCustomerPairingLinks( } export async function revokeCustomerPairingLink( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, customerId: string, pairingLinkId: string, projectId: string, @@ -177,16 +177,16 @@ export async function revokeCustomerPairingLink( return result(response.data.data, response.metadata) } -export async function transferCustomerNumber( - client: ClientInstance<'organization'>, +export async function transferCustomerConnection( + client: ClientInstance<'team'>, customerId: string, - sessionId: string, - body: TransferCustomerNumberRequest, + connectionId: string, + body: TransferCustomerConnectionRequest, options: RequestOptions, -): Promise<CustomerResult<CustomerNumber>> { - const response = await client.customers.transferNumber( +): Promise<CustomerResult<CustomerConnection>> { + const response = await client.customers.transferConnection( customerId, - sessionId, + connectionId, body, options, ) @@ -202,7 +202,7 @@ export function renderCustomers(customers: CustomerListEnvelope): string { customer.name ?? '', customer.externalCustomerId ?? '', customer.status, - `${customer.connectedNumberCount}/${customer.numberCount} connected`, + `${customer.connectedConnectionCount}/${customer.connectionCount} connected`, customer.needsAttention ? 'needs attention' : '', ].join('\t'), ) @@ -225,14 +225,15 @@ export function renderCustomerStatus(status: CustomersStatus): string { : 'Customers is not enabled for this project.' } -export function renderCustomerNumbers( - numbers: readonly CustomerNumber[], +export function renderCustomerConnections( + connections: readonly CustomerConnection[], ): string { - if (numbers.length === 0) return 'No Numbers are assigned to this Customer.' - return numbers + if (connections.length === 0) + return 'No Connections are assigned to this Customer.' + return connections .map((number) => [ - number.sessionId, + number.connectionId, number.name ?? '', number.phoneMasked ?? '', number.status, diff --git a/src/services/doctor.ts b/src/services/doctor.ts index 35c5cbcf..cec3bca2 100644 --- a/src/services/doctor.ts +++ b/src/services/doctor.ts @@ -256,7 +256,7 @@ async function listProjectsPing(input: { }): Promise<unknown> { return new Client({ baseUrl: input.baseUrl, - credential: {type: 'organizationApiKey', value: input.credential}, + credential: {type: 'teamApiKey', value: input.credential}, maxNetworkRetries: 0, ...(input.timeoutMs === undefined ? {} : {timeoutMs: input.timeoutMs}), }).projects.list() diff --git a/src/services/groups.ts b/src/services/groups.ts index 1a899b7b..14f987fe 100644 --- a/src/services/groups.ts +++ b/src/services/groups.ts @@ -26,36 +26,36 @@ export interface GroupInviteLink { export async function listGroups( client: MessagingClient, - session: string, + connection: string, ): Promise<ResourceResult<readonly Group[]>> { - const response = await client.groups.list(session) + const response = await client.groups.list(connection) return result(response.data.data, response.metadata) } export async function viewGroup( client: MessagingClient, - session: string, + connection: string, group: string, ): Promise<ResourceResult<Group>> { - const response = await client.groups.retrieve(session, group) + const response = await client.groups.retrieve(connection, group) return result(response.data.data, response.metadata) } export async function listGroupParticipants( client: MessagingClient, - session: string, + connection: string, group: string, ): Promise<ResourceResult<readonly GroupParticipant[]>> { - const response = await client.groups.listParticipants(session, group) + const response = await client.groups.listParticipants(connection, group) return result(response.data.data, response.metadata) } export async function getGroupInviteLink( client: MessagingClient, - session: string, + connection: string, group: string, ): Promise<ResourceResult<GroupInviteLink>> { - const response = await client.groups.getInviteCode(session, group) + const response = await client.groups.getInviteCode(connection, group) const code = response.data.data.code return result( {code, url: `https://chat.whatsapp.com/${code}`}, @@ -89,7 +89,7 @@ export function participantIds(values: readonly string[]): string[] { export async function createGroup( client: MessagingClient, - session: string, + connection: string, name: string, participants: readonly string[], options: RequestOptions = {}, @@ -101,7 +101,7 @@ export async function createGroup( ) } const response = await client.groups.create( - session, + connection, {name, participants: participantIds(participants)}, options, ) @@ -110,7 +110,7 @@ export async function createGroup( export async function changeGroupParticipants( client: MessagingClient, - session: string, + connection: string, group: string, action: ParticipantAction, participants: readonly string[], @@ -119,18 +119,23 @@ export async function changeGroupParticipants( const body = {participants: participantIds(participants)} const response = action === 'add' - ? await client.groups.addParticipants(session, group, body, options) + ? await client.groups.addParticipants(connection, group, body, options) : action === 'remove' - ? await client.groups.removeParticipants(session, group, body, options) + ? await client.groups.removeParticipants( + connection, + group, + body, + options, + ) : action === 'promote' ? await client.groups.promoteParticipants( - session, + connection, group, body, options, ) : await client.groups.demoteParticipants( - session, + connection, group, body, options, @@ -140,7 +145,7 @@ export async function changeGroupParticipants( export async function setGroupText( client: MessagingClient, - session: string, + connection: string, group: string, field: 'subject' | 'description', value: string, @@ -154,8 +159,8 @@ export async function setGroupText( } const response = field === 'subject' - ? await client.groups.setSubject(session, group, {value}, options) - : await client.groups.setDescription(session, group, {value}, options) + ? await client.groups.setSubject(connection, group, {value}, options) + : await client.groups.setDescription(connection, group, {value}, options) return result(response.data, response.metadata) } @@ -180,7 +185,7 @@ export interface GroupSettingsResult { */ export async function updateGroupSettings( client: MessagingClient, - session: string, + connection: string, group: string, change: GroupSettingsChange, ): Promise<ResourceResult<GroupSettingsResult>> { @@ -192,14 +197,14 @@ export async function updateGroupSettings( const adminsOnly = change.infoEditing === 'admins' steps.push([ 'info-editing', - () => client.groups.setInfoEditing(session, group, {adminsOnly}), + () => client.groups.setInfoEditing(connection, group, {adminsOnly}), ]) } if (change.messaging !== undefined) { const adminsOnly = change.messaging === 'admins' steps.push([ 'messaging', - () => client.groups.setMessaging(session, group, {adminsOnly}), + () => client.groups.setMessaging(connection, group, {adminsOnly}), ]) } if (change.memberAdd !== undefined) { @@ -207,14 +212,14 @@ export async function updateGroupSettings( change.memberAdd === 'admins' ? 'admin_add' : 'all_member_add' steps.push([ 'member-add', - () => client.groups.setMemberAddMode(session, group, {mode}), + () => client.groups.setMemberAddMode(connection, group, {mode}), ]) } if (change.joinApproval !== undefined) { const required = change.joinApproval steps.push([ 'join-approval', - () => client.groups.setJoinApproval(session, group, {required}), + () => client.groups.setJoinApproval(connection, group, {required}), ]) } if (steps.length === 0) { @@ -272,7 +277,7 @@ export interface GroupCapabilities { } export async function getGroupCapabilities( client: MessagingClient, - session: string, + connection: string, group: string, ): Promise<ResourceResult<GroupCapabilities>> { const response = await client.raw.request<{ @@ -280,7 +285,7 @@ export async function getGroupCapabilities( data: GroupCapabilities }>({ method: 'GET', - path: `/messaging/${encodeURIComponent(session)}/groups/${encodeURIComponent(group)}/capabilities`, + path: `/messaging/${encodeURIComponent(connection)}/groups/${encodeURIComponent(group)}/capabilities`, }) return result(response.data.data, response.metadata) } diff --git a/src/services/history.ts b/src/services/history.ts index ae12ccf1..84b0fd46 100644 --- a/src/services/history.ts +++ b/src/services/history.ts @@ -28,30 +28,30 @@ interface HistoryResult<T> { export async function listHistoryChats( client: MessagingClient, - session: string, + connection: string, params: ListHistoryChatsParams, ): Promise<HistoryResult<HistoryPage<HistoryChat>>> { - const response = await client.chats.list(session, params) + const response = await client.chats.list(connection, params) return result(response.data, response.metadata) } export async function viewHistoryChat( client: MessagingClient, - session: string, + connection: string, conversation: string, ): Promise<HistoryResult<HistoryChat>> { - const response = await client.chats.retrieve(session, conversation) + const response = await client.chats.retrieve(connection, conversation) return result(response.data.data, response.metadata) } export async function listHistoryMessages( client: MessagingClient, - session: string, + connection: string, conversation: string, params: ListHistoryMessagesParams, ): Promise<HistoryResult<HistoryPage<HistoryMessage>>> { const response = await client.chats.listMessages( - session, + connection, conversation, params, ) @@ -60,12 +60,12 @@ export async function listHistoryMessages( export async function viewHistoryMessage( client: MessagingClient, - session: string, + connection: string, conversation: string, messageId: string, ): Promise<HistoryResult<HistoryMessage>> { const response = await client.chats.retrieveMessage( - session, + connection, conversation, messageId, ) @@ -75,7 +75,7 @@ export async function viewHistoryMessage( /** Download a stored Official API message copy through the enrolled history API. */ export async function downloadHistoryMessageMedia( client: MessagingClient, - session: string, + connection: string, conversation: string, messageId: string, options: { @@ -103,7 +103,7 @@ export async function downloadHistoryMessageMedia( } const download = await client.chats.downloadMessageMediaStream( - session, + connection, conversation, messageId, ) diff --git a/src/services/init-starter.ts b/src/services/init-starter.ts index ff3ab164..dd10d381 100644 --- a/src/services/init-starter.ts +++ b/src/services/init-starter.ts @@ -98,7 +98,7 @@ if (!apiKey) { process.exitCode = 1 } else { const client = new Client({ - credential: {type: 'organizationApiKey', value: apiKey}, + credential: {type: 'teamApiKey', value: apiKey}, }) const response = await client.projects.list() for (const project of response.data.data) { diff --git a/src/services/labels.ts b/src/services/labels.ts index 45d5f38d..31dc6712 100644 --- a/src/services/labels.ts +++ b/src/services/labels.ts @@ -22,10 +22,10 @@ export interface LabelResult<T> { export async function listLabels( client: MessagingClient, - session: string, + connection: string, includeObservation: boolean, ): Promise<LabelResult<LabelReadData>> { - const response = await client.labels.list(session, { + const response = await client.labels.list(connection, { ...(includeObservation ? {includeObservation: true} : {}), }) return result(response.data.data, response.metadata) @@ -33,24 +33,24 @@ export async function listLabels( export async function createLabel( client: MessagingClient, - session: string, + connection: string, input: {readonly color?: number; readonly name: string}, options: RequestOptions = {}, ): Promise<LabelResult<Label>> { - const response = await client.labels.create(session, input, options) + const response = await client.labels.create(connection, input, options) return result(response.data.data, response.metadata) } export async function updateLabel( client: MessagingClient, - session: string, + connection: string, labelId: string, input: {readonly color?: number; readonly name?: string}, options: RequestOptions = {}, ): Promise<LabelResult<SuccessResponse>> { const request = updateRequest(input) const response = await client.labels.update( - session, + connection, labelId, request, options, @@ -60,22 +60,22 @@ export async function updateLabel( export async function deleteLabel( client: MessagingClient, - session: string, + connection: string, labelId: string, options: RequestOptions = {}, ): Promise<LabelResult<SuccessResponse>> { - const response = await client.labels.delete(session, labelId, options) + const response = await client.labels.delete(connection, labelId, options) return result(response.data, response.metadata) } export async function listChatLabels( client: MessagingClient, - session: string, + connection: string, chatId: string, includeObservation: boolean, ): Promise<LabelResult<LabelReadData>> { const response = await client.labels.listForChat( - session, + connection, chatId, includeObservation ? {includeObservation: true} : {}, ) @@ -84,7 +84,7 @@ export async function listChatLabels( export async function replaceChatLabels( client: MessagingClient, - session: string, + connection: string, chatId: string, labels: readonly string[] | undefined, clear: boolean, @@ -98,7 +98,7 @@ export async function replaceChatLabels( } const response = await client.labels.replaceForChat( - session, + connection, chatId, {labels: clear ? [] : labels!}, options, diff --git a/src/services/messages.ts b/src/services/messages.ts index cdd16ede..32327a22 100644 --- a/src/services/messages.ts +++ b/src/services/messages.ts @@ -30,7 +30,7 @@ export interface MessageResult<T> { export async function sendTextMessage( client: MessagingClient, - session: string, + connection: string, request: SendTextMessageRequest, options: RequestOptions = {}, ): Promise<MessageResult<MessageResponse>> { @@ -40,24 +40,24 @@ export async function sendTextMessage( 'body', ) } - const response = await client.messages.send(session, request, options) + const response = await client.messages.send(connection, request, options) return result(response.data.data, response.metadata) } /** Send any typed message kind through the SDK's single send method. */ export async function sendMessage( client: MessagingClient, - session: string, + connection: string, request: SendMessageRequest, options: RequestOptions = {}, ): Promise<MessageResult<MessageResponse>> { - const response = await client.messages.send(session, request, options) + const response = await client.messages.send(connection, request, options) return result(response.data.data, response.metadata) } export async function editMessage( client: MessagingClient, - session: string, + connection: string, chat: string, message: string, text: string, @@ -70,7 +70,7 @@ export async function editMessage( ) } const response = await client.chats.editMessage( - session, + connection, chat, message, { @@ -86,13 +86,13 @@ export async function editMessage( export async function deleteMessage( client: MessagingClient, - session: string, + connection: string, chat: string, message: string, options: RequestOptions & {readonly transport?: MessageTransport} = {}, ): Promise<MessageResult<SuccessResponse>> { const response = await client.chats.deleteMessage( - session, + connection, chat, message, options, @@ -102,41 +102,41 @@ export async function deleteMessage( export async function reactToMessage( client: MessagingClient, - session: string, + connection: string, request: ReactRequest, options: RequestOptions = {}, ): Promise<MessageResult<MessageReceipt>> { - const response = await client.messages.react(session, request, options) + const response = await client.messages.react(connection, request, options) return result(response.data.data, response.metadata) } export async function markMessageSeen( client: MessagingClient, - session: string, + connection: string, request: SeenRequest, options: RequestOptions = {}, ): Promise<MessageResult<SuccessResponse>> { - const response = await client.messages.markSeen(session, request, options) + const response = await client.messages.markSeen(connection, request, options) return result(response.data, response.metadata) } export async function setMessageTyping( client: MessagingClient, - session: string, + connection: string, request: TypingRequest, options: RequestOptions = {}, ): Promise<MessageResult<SuccessResponse>> { - const response = await client.messages.setTyping(session, request, options) + const response = await client.messages.setTyping(connection, request, options) return result(response.data, response.metadata) } export async function setMessageStar( client: MessagingClient, - session: string, + connection: string, request: StarRequest, options: RequestOptions = {}, ): Promise<MessageResult<{readonly status: 'OK'}>> { - const response = await client.messages.star(session, request, options) + const response = await client.messages.star(connection, request, options) return result(response.data.data, response.metadata) } diff --git a/src/services/opt-outs.ts b/src/services/opt-outs.ts index 00ed7424..f990b0cc 100644 --- a/src/services/opt-outs.ts +++ b/src/services/opt-outs.ts @@ -21,14 +21,14 @@ export interface OptOutResult<T> { } export async function viewOptOutSettings( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, ): Promise<OptOutResult<OptOutSettings>> { const response = await client.optOuts.getSettings() return result(response.data.data, response.metadata) } export async function updateOptOutSettings( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, body: UpdateOptOutSettingsRequest, options: RequestOptions = {}, ): Promise<OptOutResult<OptOutSettings>> { diff --git a/src/services/platform-management.ts b/src/services/platform-management.ts index af2b706d..e6453150 100644 --- a/src/services/platform-management.ts +++ b/src/services/platform-management.ts @@ -4,26 +4,26 @@ import { type AuditLog, type ClientInstance, type ListAuditLogsParams, - type OrganizationMember, + type TeamMember, PolymorfaValidationError, type ProjectToken, type RequestOptions, type ResponseMetadata, type SecurityIncident, type SecurityIncidentAcknowledgement, - type SessionBan, - type Session, - type SessionBatchRemoveResult, - type SessionBatchRequest, - type SessionBatchStopResult, - type PlatformSession, - type SessionCapabilities, + type ConnectionBan, + type Connection, + type ConnectionBatchRemoveResult, + type ConnectionBatchRequest, + type ConnectionBatchStopResult, + type PlatformConnection, + type ConnectionCapabilities, type UpdateQuickLinkSettingsInput, - type OrganizationQuickLinkSettings, + type TeamQuickLinkSettings, type ProjectQuickLinkSettings, } from '@polymorfa/sdk' -type WidgetSettings = OrganizationQuickLinkSettings | ProjectQuickLinkSettings +type WidgetSettings = TeamQuickLinkSettings | ProjectQuickLinkSettings export interface PlatformResult<T> { readonly data: T @@ -36,14 +36,14 @@ export interface PlatformResult<T> { } export async function listApiKeys( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, ): Promise<PlatformResult<readonly ApiKey[]>> { const response = await client.apiKeys.list() return result(response.data.data, response.metadata) } export async function revokeApiKey( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, keyId: string, options: RequestOptions = {}, ): Promise<PlatformResult<ApiKeyDeactivation>> { @@ -52,39 +52,39 @@ export async function revokeApiKey( } export async function listMembers( - client: ClientInstance<'organization'>, -): Promise<PlatformResult<readonly OrganizationMember[]>> { + client: ClientInstance<'team'>, +): Promise<PlatformResult<readonly TeamMember[]>> { const response = await client.members.list() return result(response.data.data, response.metadata) } export async function listAuditLogs( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, params: ListAuditLogsParams = {}, ): Promise<PlatformResult<readonly AuditLog[]>> { const response = await client.auditLogs.list(params) return result(response.data.data, response.metadata) } -export async function listSessionBans( - client: ClientInstance<'organization'>, +export async function listConnectionBans( + client: ClientInstance<'team'>, activeOnly: boolean, -): Promise<PlatformResult<readonly SessionBan[]>> { +): Promise<PlatformResult<readonly ConnectionBan[]>> { const response = activeOnly - ? await client.sessionBans.listActive() - : await client.sessionBans.list() + ? await client.connectionBans.listActive() + : await client.connectionBans.list() return result(response.data.data, response.metadata) } export async function listSecurityIncidents( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, ): Promise<PlatformResult<readonly SecurityIncident[]>> { const response = await client.securityIncidents.list() return result(response.data.data, response.metadata) } export async function acknowledgeSecurityIncident( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, incidentId: string, options: RequestOptions = {}, ): Promise<PlatformResult<SecurityIncidentAcknowledgement>> { @@ -96,64 +96,65 @@ export async function acknowledgeSecurityIncident( } export async function listProjectTokens( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, projectId: string, ): Promise<PlatformResult<readonly ProjectToken[]>> { const response = await client.projectTokens.list(projectId) return result(response.data.data, response.metadata) } -export async function listManagedSessions( - client: ClientInstance<'organization'>, +export async function listManagedConnections( + client: ClientInstance<'team'>, projectId?: string, -): Promise<PlatformResult<readonly PlatformSession[]>> { - const response = await client.sessions.list( +): Promise<PlatformResult<readonly PlatformConnection[]>> { + const response = await client.connections.list( projectId === undefined ? {} : {projectId}, ) return result(response.data.data, response.metadata) } -export async function viewManagedSession( - client: ClientInstance<'organization'>, - sessionId: string, -): Promise<PlatformResult<Session>> { - const response = await client.sessions.retrieve(sessionId) +export async function viewManagedConnection( + client: ClientInstance<'team'>, + connectionId: string, +): Promise<PlatformResult<Connection>> { + const response = await client.connections.retrieve(connectionId) return result(response.data.data, response.metadata) } -export function renderManagedSessions( - sessions: readonly PlatformSession[], +export function renderManagedConnections( + connections: readonly PlatformConnection[], ): string { - if (sessions.length === 0) return 'No sessions found.' - return sessions - .map((session) => + if (connections.length === 0) return 'No connections found.' + return connections + .map((connection) => [ - session.sessionId, - session.name, - session.status, - session.testMode ? 'test' : 'real', - session.projectId, + connection.connectionId, + connection.name, + connection.status, + connection.testMode ? 'test' : 'real', + connection.projectId, ].join('\t'), ) .join('\n') } -export function renderManagedSession(session: Session): string { +export function renderManagedConnection(connection: Connection): string { return [ - `ID\t${session.sessionId}`, - `Name\t${session.name}`, - `Status\t${session.status}`, - ...(session.statusReason === undefined + `ID\t${connection.connectionId}`, + `Name\t${connection.name}`, + `Status\t${connection.status}`, + ...(connection.statusReason === undefined ? [] - : [`Status reason\t${session.statusReason}`]), - `Connection\t${session.type}`, - `Number\t${session.testMode ? 'test' : 'real'}`, - ...newChatCapLine(session), - `Updated\t${session.updatedAt}`, + : [`Status reason\t${connection.statusReason}`]), + `Type\t${connection.type}`, + `Method\t${connection.method}`, + `Mode\t${connection.testMode ? 'test' : 'real'}`, + ...newChatCapLine(connection), + `Updated\t${connection.updatedAt}`, ].join('\n') } -/** WhatsApp's per-number new-chat cap, as Get session returns it. */ +/** WhatsApp's per-number new-chat cap, as Get connection returns it. */ interface NewChatCapView { readonly enabled: boolean | null readonly capped: boolean @@ -162,9 +163,10 @@ interface NewChatCapView { readonly resetsAt: string | null } -function newChatCapLine(session: Session): string[] { - const cap = (session as Session & {newChatCapping?: NewChatCapView | null}) - .newChatCapping +function newChatCapLine(connection: Connection): string[] { + const cap = ( + connection as Connection & {newChatCapping?: NewChatCapView | null} + ).newChatCapping if (cap === undefined) return [] if (cap === null) return ['New-chat cap\tnot observed yet'] if (cap.enabled === null) return ['New-chat cap\tundetermined'] @@ -176,33 +178,33 @@ function newChatCapLine(session: Session): string[] { return [`New-chat cap\t${cap.used} of ${cap.limit} used${reset}`] } -export async function stopSessions( - client: ClientInstance<'organization'>, - sessionIds: readonly string[], +export async function stopConnections( + client: ClientInstance<'team'>, + connectionIds: readonly string[], projectId?: string, options: RequestOptions = {}, -): Promise<PlatformResult<SessionBatchStopResult>> { - const response = await client.sessions.stopMany( - sessionBatch(sessionIds, projectId), +): Promise<PlatformResult<ConnectionBatchStopResult>> { + const response = await client.connections.stopMany( + connectionBatch(connectionIds, projectId), options, ) return result(response.data.data, response.metadata) } /** WhatsApp features and limits WhatsApp enabled for a number (beta). */ -export async function getSessionCapabilities( - client: ClientInstance<'organization'>, - session: string, -): Promise<PlatformResult<SessionCapabilities>> { - const response = await client.sessions.getCapabilities(session) +export async function getConnectionCapabilities( + client: ClientInstance<'team'>, + connection: string, +): Promise<PlatformResult<ConnectionCapabilities>> { + const response = await client.connections.getCapabilities(connection) return result(response.data.data, response.metadata) } -export function renderSessionCapabilities( - capabilities: SessionCapabilities, +export function renderConnectionCapabilities( + capabilities: ConnectionCapabilities, ): string { const header = [ - `Session\t${capabilities.session}`, + `Connection\t${capabilities.connection}`, `Status\t${capabilities.status}`, `Synced\t${capabilities.syncedAt ?? 'never'}`, `Account\t${capabilities.accountType ?? 'unknown'}`, @@ -221,14 +223,14 @@ export function renderSessionCapabilities( return [...header, '', ...rows].join('\n') } -export async function deleteSessions( - client: ClientInstance<'organization'>, - sessionIds: readonly string[], +export async function deleteConnections( + client: ClientInstance<'team'>, + connectionIds: readonly string[], projectId?: string, options: RequestOptions = {}, -): Promise<PlatformResult<SessionBatchRemoveResult>> { - const response = await client.sessions.deleteMany( - sessionBatch(sessionIds, projectId), +): Promise<PlatformResult<ConnectionBatchRemoveResult>> { + const response = await client.connections.deleteMany( + connectionBatch(connectionIds, projectId), options, ) return result(response.data.data, response.metadata) @@ -248,7 +250,7 @@ export function renderApiKeys(keys: readonly ApiKey[]): string { .join('\n') } -export function renderMembers(members: readonly OrganizationMember[]): string { +export function renderMembers(members: readonly TeamMember[]): string { if (members.length === 0) return 'No organization members found.' return members .map((member) => @@ -272,12 +274,12 @@ export function renderAuditLogs(logs: readonly AuditLog[]): string { .join('\n') } -export function renderSessionBans(bans: readonly SessionBan[]): string { - if (bans.length === 0) return 'No session bans found.' +export function renderConnectionBans(bans: readonly ConnectionBan[]): string { + if (bans.length === 0) return 'No connection bans found.' return bans .map((ban) => [ - ban.sessionName, + ban.connectionName, ban.status, ban.banCode ?? '', ban.banReason ?? '', @@ -318,7 +320,7 @@ export function renderProjectTokens(tokens: readonly ProjectToken[]): string { } export async function viewWidgetSettings( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, projectId?: string, ): Promise<PlatformResult<WidgetSettings | null>> { const response = await ( @@ -328,7 +330,7 @@ export async function viewWidgetSettings( } export async function updateWidgetSettings( - client: ClientInstance<'organization'>, + client: ClientInstance<'team'>, input: unknown, projectId?: string, options: RequestOptions = {}, @@ -367,12 +369,12 @@ export function renderWidgetSettings( ].join('\n') } -export function renderSessionStops(stopping: number): string { - return `Requested stops for ${stopping} matching ${plural(stopping, 'session')}. This does not wait for completion.` +export function renderConnectionStops(stopping: number): string { + return `Requested stops for ${stopping} matching ${plural(stopping, 'connection')}. This does not wait for completion.` } -export function renderSessionDeletes(removed: number): string { - return `Removed ${removed} matching ${plural(removed, 'session')} from management. Device termination is best effort.` +export function renderConnectionDeletes(removed: number): string { + return `Removed ${removed} matching ${plural(removed, 'connection')} from management. Device termination is best effort.` } function result<T>(data: T, metadata: ResponseMetadata): PlatformResult<T> { @@ -415,35 +417,35 @@ function widgetUpdate(input: unknown): UpdateQuickLinkSettingsInput { } } -function sessionBatch( +function connectionBatch( ids: readonly string[], projectId?: string, -): SessionBatchRequest { - const sessionIds = ids.map((id) => id.trim()) - if (sessionIds.length === 0) { - throw new PolymorfaValidationError('Provide at least one session ID.', { - code: 'empty_session_batch', +): ConnectionBatchRequest { + const connectionIds = ids.map((id) => id.trim()) + if (connectionIds.length === 0) { + throw new PolymorfaValidationError('Provide at least one connection ID.', { + code: 'empty_connection_batch', }) } - if (sessionIds.length > 100) { + if (connectionIds.length > 100) { throw new PolymorfaValidationError( - 'Session batches cannot exceed 100 IDs.', - {code: 'session_batch_too_large'}, + 'Connection batches cannot exceed 100 IDs.', + {code: 'connection_batch_too_large'}, ) } - if (sessionIds.some((id) => id.length === 0)) { - throw new PolymorfaValidationError('Session IDs cannot be empty.', { - code: 'empty_session_id', + if (connectionIds.some((id) => id.length === 0)) { + throw new PolymorfaValidationError('Connection IDs cannot be empty.', { + code: 'empty_connection_id', }) } - if (new Set(sessionIds).size !== sessionIds.length) { - throw new PolymorfaValidationError('Session IDs must be unique.', { - code: 'duplicate_session_id', + if (new Set(connectionIds).size !== connectionIds.length) { + throw new PolymorfaValidationError('Connection IDs must be unique.', { + code: 'duplicate_connection_id', }) } return { - sessionIds, + connectionIds, ...(projectId === undefined ? {} : {projectId}), } } diff --git a/src/services/presence.ts b/src/services/presence.ts index 69049069..759bbb27 100644 --- a/src/services/presence.ts +++ b/src/services/presence.ts @@ -22,38 +22,38 @@ export interface PresenceResult<T> { export async function viewPresence( client: MessagingClient, - session: string, + connection: string, ): Promise<PresenceResult<PresenceData>> { - const response = await client.presence.get(session) + const response = await client.presence.get(connection) return result(response.data.data, response.metadata) } export async function setPresence( client: MessagingClient, - session: string, + connection: string, presence: PresenceState, options: RequestOptions = {}, ): Promise<PresenceResult<SetPresenceResponse>> { - const response = await client.presence.set(session, {presence}, options) + const response = await client.presence.set(connection, {presence}, options) return result(response.data, response.metadata) } export async function viewChatPresence( client: MessagingClient, - session: string, + connection: string, chat: string, ): Promise<PresenceResult<ChatPresenceData>> { - const response = await client.presence.getForChat(session, chat) + const response = await client.presence.getForChat(connection, chat) return result(response.data.data, response.metadata) } export async function subscribeToChatPresence( client: MessagingClient, - session: string, + connection: string, chat: string, options: RequestOptions = {}, ): Promise<PresenceResult<PresenceSubscriptionData | AsyncAcceptedData>> { - const response = await client.presence.subscribe(session, chat, options) + const response = await client.presence.subscribe(connection, chat, options) return result(response.data.data, response.metadata) } diff --git a/src/services/privacy.ts b/src/services/privacy.ts index 1bb01fed..17b415f8 100644 --- a/src/services/privacy.ts +++ b/src/services/privacy.ts @@ -32,21 +32,21 @@ export interface PrivacyResult<T> { export async function viewPrivacy( client: MessagingClient, - session: string, + connection: string, ): Promise<PrivacyResult<PrivacySettings>> { - const response = await client.privacy.get(session) + const response = await client.privacy.get(connection) return result(response.data.data, response.metadata) } export async function setPrivacy( client: MessagingClient, - session: string, + connection: string, setting: string, value: string, options: RequestOptions = {}, ): Promise<PrivacyResult<PrivacySettings>> { const response = await client.privacy.set( - session, + connection, privacyMutation(setting, value), options, ) @@ -55,12 +55,12 @@ export async function setPrivacy( export async function setDefaultDisappearingTimer( client: MessagingClient, - session: string, + connection: string, duration: PrivacyTimerDuration, options: RequestOptions = {}, ): Promise<PrivacyResult<SuccessResponse>> { const response = await client.privacy.setDefaultDisappearingTimer( - session, + connection, {durationSeconds: PRIVACY_TIMER_DURATIONS[duration]}, options, ) diff --git a/src/services/profile.ts b/src/services/profile.ts index db48fe34..a1d7f3cd 100644 --- a/src/services/profile.ts +++ b/src/services/profile.ts @@ -22,15 +22,15 @@ export interface ProfileResult<T> { export async function viewProfile( client: MessagingClient, - session: string, + connection: string, ): Promise<ProfileResult<unknown>> { - const response = await client.profile.get(session) + const response = await client.profile.get(connection) return result(response.data.data as unknown, response.metadata) } export async function setProfileName( client: MessagingClient, - session: string, + connection: string, name: string, options: RequestOptions = {}, ): Promise<ProfileResult<SuccessResponse>> { @@ -41,37 +41,37 @@ export async function setProfileName( ) } - const response = await client.profile.setName(session, {name}, options) + const response = await client.profile.setName(connection, {name}, options) return result(response.data, response.metadata) } export async function setProfileStatus( client: MessagingClient, - session: string, + connection: string, status: string, options: RequestOptions = {}, ): Promise<ProfileResult<SuccessResponse>> { - const response = await client.profile.setStatus(session, {status}, options) + const response = await client.profile.setStatus(connection, {status}, options) return result(response.data, response.metadata) } export async function setProfilePicture( client: MessagingClient, - session: string, + connection: string, source: {readonly file?: string; readonly url?: string}, options: RequestOptions = {}, ): Promise<ProfileResult<SuccessResponse>> { const request = await pictureRequest(source) - const response = await client.profile.setPicture(session, request, options) + const response = await client.profile.setPicture(connection, request, options) return result(response.data, response.metadata) } export async function deleteProfilePicture( client: MessagingClient, - session: string, + connection: string, options: RequestOptions = {}, ): Promise<ProfileResult<SuccessResponse>> { - const response = await client.profile.deletePicture(session, options) + const response = await client.profile.deletePicture(connection, options) return result(response.data, response.metadata) } diff --git a/src/services/quick-replies.ts b/src/services/quick-replies.ts index 79c6b0b4..2fadef19 100644 --- a/src/services/quick-replies.ts +++ b/src/services/quick-replies.ts @@ -20,31 +20,31 @@ export interface QuickReplyResult<T> { export async function listQuickReplies( client: MessagingClient, - session: string, + connection: string, ): Promise<QuickReplyResult<BusinessQuickReplyCollection>> { - const response = await client.quickReplies.list(session) + const response = await client.quickReplies.list(connection) return result(response.data.data, response.metadata) } export async function createQuickReply( client: MessagingClient, - session: string, + connection: string, input: BusinessQuickReplyMutation, options: RequestOptions = {}, ): Promise<QuickReplyResult<BusinessQuickReply>> { - const response = await client.quickReplies.create(session, input, options) + const response = await client.quickReplies.create(connection, input, options) return result(response.data.data, response.metadata) } export async function replaceQuickReply( client: MessagingClient, - session: string, + connection: string, quickReplyId: string, input: BusinessQuickReplyMutation, options: RequestOptions = {}, ): Promise<QuickReplyResult<BusinessQuickReply>> { const response = await client.quickReplies.replace( - session, + connection, quickReplyId, input, options, @@ -54,12 +54,12 @@ export async function replaceQuickReply( export async function deleteQuickReply( client: MessagingClient, - session: string, + connection: string, quickReplyId: string, options: RequestOptions = {}, ): Promise<QuickReplyResult<DeletedBusinessQuickReply>> { const response = await client.quickReplies.delete( - session, + connection, quickReplyId, options, ) diff --git a/src/services/quicklinks.ts b/src/services/quicklinks.ts index d1b83560..365df664 100644 --- a/src/services/quicklinks.ts +++ b/src/services/quicklinks.ts @@ -17,8 +17,8 @@ export async function createQuickLink( 'projectId', 'purpose', 'connectionGoal', - 'session', - 'addConnection', + 'connection', + 'addMethod', 'customerId', 'externalId', 'configuration', @@ -50,11 +50,11 @@ export async function createQuickLink( !Number.isInteger(financial.priority) || financial.priority < 0 || financial.priority > 1000000 || - body.purpose === 'add_connection' || + body.purpose === 'add_method' || (body.configuration as {testing?: unknown} | undefined)?.testing ) throw new PolymorfaConfigurationError( - 'Billing controls require a real new number, credits and numeric priority.', + 'Billing controls require a new real Connection, credits and numeric priority.', 'input', ) } diff --git a/src/services/sip-trunks.ts b/src/services/sip-trunks.ts index 1ecd9db3..ae414a04 100644 --- a/src/services/sip-trunks.ts +++ b/src/services/sip-trunks.ts @@ -216,7 +216,7 @@ export function renderSipTrunk(trunk: SipTrunk): string { lines.push( `Inbound username\t${trunk.inbound.username}`, `Realm\t${trunk.inbound.realm}`, - `Calling session\t${trunk.inbound.session ?? 'not set (calls refused)'}`, + `Calling connection\t${trunk.inbound.connection ?? 'not set (calls refused)'}`, `Allowed addresses\t${trunk.inbound.allowedAddresses.join(', ')}`, `Allowed destinations\t${ trunk.inbound.allowedDestinations.length === 0 diff --git a/src/services/testing-account-mode.ts b/src/services/testing-account-mode.ts index 7b76d9b4..33fe6193 100644 --- a/src/services/testing-account-mode.ts +++ b/src/services/testing-account-mode.ts @@ -36,7 +36,7 @@ export type TestingAccountModeInput = z.infer<typeof modeFields> const resultSchema = z .object({ - session: z.string(), + connection: z.string(), accountType: z.enum(testingAccountTypes), primaryPlatform: z.enum(['android', 'ios']).nullable(), changed: z.boolean(), @@ -59,27 +59,27 @@ export function testingAccountModeInput( /** Uses the installed SDK's public transport; the CLI owns this typed contract. */ export async function setTestingAccountMode( client: MessagingClient, - session: string, + connection: string, input: unknown, options: RequestOptions = {}, ) { - if (!session || session.length > 256) + if (!connection || connection.length > 256) throw new PolymorfaValidationError( - 'Provide a session ID of 1 to 256 characters.', - {code: 'invalid_session'}, + 'Provide a connection ID of 1 to 256 characters.', + {code: 'invalid_connection'}, ) const body = testingAccountModeInput(input) const response = await client.raw .request<unknown>({ ...options, method: 'PUT', - path: `/messaging/${encodeURIComponent(session)}/phone/account-mode`, + path: `/messaging/${encodeURIComponent(connection)}/phone/account-mode`, body, }) .catch((error: unknown) => { if (!(error instanceof PolymorfaConflictError)) throw error throw new PolymorfaConflictError( - `The Test number is claimed in Inspector, or another mode change is pending. Unclaim it in Inspector or retry. The API said: ${error.message}`, + `The Test Connection is claimed in Inspector, or another mode change is pending. Unclaim it in Inspector or retry. The API said: ${error.message}`, { cause: error, details: error.details, diff --git a/src/services/usage.ts b/src/services/usage.ts index da0f3fa8..514306a1 100644 --- a/src/services/usage.ts +++ b/src/services/usage.ts @@ -29,7 +29,7 @@ export interface UsageFilters { readonly meter?: string readonly period?: string readonly project?: string - readonly session?: string + readonly connection?: string } const PERIOD = /^\d{4}-(0[1-9]|1[0-2])$/ @@ -62,7 +62,7 @@ export function createUsageResource( } const client = new Client({ ...options, - credential: {type: 'organizationApiKey', value: environment.credential}, + credential: {type: 'teamApiKey', value: environment.credential}, }) return environment.context.owner === 'project' && projectId ? client.project(projectId).usage @@ -88,7 +88,9 @@ export async function getUsageSummary( const response = await usage.summary({ ...(period === undefined ? {} : {period}), ...(filters.project === undefined ? {} : {projectId: filters.project}), - ...(filters.session === undefined ? {} : {session: filters.session}), + ...(filters.connection === undefined + ? {} + : {connection: filters.connection}), }) return result(response.data, response.metadata) } @@ -109,7 +111,9 @@ export async function listUsageRecords( : {meter: filters.meter as UsageMeter}), ...(period === undefined ? {} : {period}), ...(filters.project === undefined ? {} : {projectId: filters.project}), - ...(filters.session === undefined ? {} : {session: filters.session}), + ...(filters.connection === undefined + ? {} + : {connection: filters.connection}), }) return result(response.data, response.metadata) } @@ -120,7 +124,9 @@ export async function listUsageGates( ): Promise<UsageResult<UsageGateList>> { const response = await usage.listGates({ ...(filters.project === undefined ? {} : {projectId: filters.project}), - ...(filters.session === undefined ? {} : {session: filters.session}), + ...(filters.connection === undefined + ? {} + : {connection: filters.connection}), }) return result(response.data, response.metadata) } @@ -129,7 +135,7 @@ export function renderUsageSummary(summary: UsageSummary): string { const lines = [ `Period\t${summary.period}`, `Project\t${summary.projectId ?? 'every project'}`, - `Number\t${summary.session ?? 'every number'}`, + `Connection\t${summary.connection ?? 'every connection'}`, `Charged\t${summary.billingEnabled ? 'yes' : 'no (measured only)'}`, ] lines.push( @@ -142,24 +148,25 @@ export function renderUsageSummary(summary: UsageSummary): string { ) .join('\n'), ) - if (summary.numbers.length > 0) { - // Without a project, numbers from several projects can share a session + if (summary.connections.length > 0) { + // Without a project, connections from several projects can share a connection // name, so each row names its project. const crossProject = summary.projectId === null lines.push( - 'Numbers', - ...summary.numbers.map((number) => + 'Connections', + ...summary.connections.map((connection) => [ - number.session, - ...(crossProject ? [number.projectId ?? '-'] : []), - number.meters + connection.connection, + ...(crossProject ? [connection.projectId ?? '-'] : []), + connection.meters .map((total) => `${total.meter} ${total.quantity} ${total.unit}`) .join(', '), ].join('\t'), ), ) } - if (summary.numbersTruncated) lines.push('More than 100 numbers had usage.') + if (summary.connectionsTruncated) + lines.push('More than 100 connections had usage.') return lines.join('\n') } @@ -170,7 +177,7 @@ export function renderUsageRecords(page: UsageRecordPage): string { record.occurredAt, record.meter, `${record.quantity} ${record.unit}`, - record.session ?? '-', + record.connection ?? '-', record.projectId ?? '-', record.sourceId, record.pricingState, @@ -200,7 +207,7 @@ export function renderUsageGates(list: UsageGateList): string { } function limitLabel(limit: null | number): string { - if (limit === null) return 'per number (pass --session)' + if (limit === null) return 'per Connection (pass --connection)' return limit < 0 ? 'none' : String(limit) } diff --git a/test/browser/run.test.ts b/test/browser/run.test.ts index d81b078a..dee338b1 100644 --- a/test/browser/run.test.ts +++ b/test/browser/run.test.ts @@ -14,10 +14,10 @@ import {EventEmitter as BrowserEmitter} from '../../src/browser/stubs/events.js' import {process as browserProcess} from '../../src/browser/stubs/process.js' import * as browserPath from '../../src/browser/stubs/path.js' -// A client token fixture: the SDK checks only the prefix of client tokens. -const CLIENT_TOKEN = `pmfa_ct_${'fixture'.repeat(6)}` +// Canonical synthetic client token; HTTP fixtures provide the server response. +const CLIENT_TOKEN = 'pmfa_ct_Zml4dHVyZQ' // A well-formed team key fixture for Platform commands. Not a real key. -const API_KEY = `pmfa_${'A'.repeat(72)}` +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const PROJECT = '11111111-1111-4111-8111-111111111111' /** @@ -138,7 +138,7 @@ describe('browser command runner', () => { it('runs the real command and prints what the installed CLI prints', async () => { const result = await run( - 'message send text --session 739182640518203 --to +15550002222 --body "Hello from Polymorfa"', + 'message send text --connection 739182640518203 --to +15550002222 --body "Hello from Polymorfa"', () => json({success: true, data: {id: '3EB0FIXTURE', status: 'sent'}}), ) expect(result).toMatchObject({exitCode: 0, command: 'message send text'}) @@ -155,7 +155,7 @@ describe('browser command runner', () => { it('prints the CLI JSON shape with --json', async () => { const result = await run( - 'message send text --session 739182640518203 --to +15550002222 --body hi --json', + 'message send text --connection 739182640518203 --to +15550002222 --body hi --json', () => json({success: true, data: {id: '3EB0FIXTURE', status: 'sent'}}), ) expect(JSON.parse(result.stdout)).toEqual({ @@ -166,7 +166,7 @@ describe('browser command runner', () => { it('reports usage errors and unknown commands with the CLI exit codes', async () => { const missing = await run( - 'message send text --session 739182640518203', + 'message send text --connection 739182640518203', () => json({}), ) expect(missing.exitCode).toBe(2) @@ -184,11 +184,11 @@ describe('browser command runner', () => { } const [first, second] = await Promise.all([ run( - 'message send text --session 739182640518203 --to +15550002222 --body one', + 'message send text --connection 739182640518203 --to +15550002222 --body one', respond, ), run( - 'message send text --session 739182640518204 --to +15550002222 --body two', + 'message send text --connection 739182640518204 --to +15550002222 --body two', respond, ), ]) @@ -204,7 +204,7 @@ describe('browser command runner', () => { it('calls write callbacks and decodes UTF-8 bytes while a command runs', async () => { let flushed = false const result = await run( - 'message send text --session 739182640518203 --to +15550002222 --body hi', + 'message send text --connection 739182640518203 --to +15550002222 --body hi', () => { process.stdout.write(new TextEncoder().encode('héllo\n'), () => { flushed = true @@ -219,7 +219,7 @@ describe('browser command runner', () => { }) it('refuses a command whose output is binary audio before it runs', async () => { - const result = await run('calls media --session 739182640518203', () => + const result = await run('calls media --connection 739182640518203', () => json({}), ) expect(result).toMatchObject({exitCode: 1, command: 'calls media'}) diff --git a/test/commands/analytics.test.ts b/test/commands/analytics.test.ts index 616f73a3..d4705531 100644 --- a/test/commands/analytics.test.ts +++ b/test/commands/analytics.test.ts @@ -23,7 +23,7 @@ const body = { period: {start: 0, end: 1}, requestVitals: {requests: 20, failures: 1, errorRate: 0.05}, summary: null, - numbers: [], + connections: [], series: [], callSeries: [], } @@ -34,8 +34,7 @@ test('runs the JSON analytics command against the project-confined public route' { POLYMORFA_API_KEY: undefined, POLYMORFA_CLIENT_TOKEN: undefined, - POLYMORFA_PROJECT_TOKEN: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, }, () => @@ -68,8 +67,7 @@ test('rejects an invalid range before making a request', async () => { servers.push(server) const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_PROJECT_TOKEN: undefined, POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_BASE_URL: server.baseUrl, @@ -120,8 +118,7 @@ test('shows call vitals when messaging measurements are unavailable', async () = servers.push(server) const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_PROJECT_TOKEN: undefined, POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_BASE_URL: server.baseUrl, @@ -136,8 +133,7 @@ test('shows call vitals when messaging measurements are unavailable', async () = const json = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_PROJECT_TOKEN: undefined, POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_BASE_URL: server.baseUrl, @@ -165,8 +161,7 @@ test('exports raw collector text through the project-confined SDK transport', as { POLYMORFA_API_KEY: undefined, POLYMORFA_CLIENT_TOKEN: undefined, - POLYMORFA_PROJECT_TOKEN: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, }, () => @@ -199,8 +194,7 @@ test('rejects an HTML response instead of printing it as collector data', async servers.push(server) const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_PROJECT_TOKEN: undefined, POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_BASE_URL: server.baseUrl, diff --git a/test/commands/api-gh.test.ts b/test/commands/api-gh.test.ts index 361800de..3bcf599a 100644 --- a/test/commands/api-gh.test.ts +++ b/test/commands/api-gh.test.ts @@ -8,8 +8,7 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' describe('api gh-style options', () => { let server: TestHttpServer | undefined diff --git a/test/commands/api.test.ts b/test/commands/api.test.ts index a0237750..0032cad3 100644 --- a/test/commands/api.test.ts +++ b/test/commands/api.test.ts @@ -17,7 +17,7 @@ describe('api', () => { test('sends raw Messaging requests with a project token', async () => { server = await startHttpServer({body: {success: true, data: {ready: true}}}) - const projectToken = `pmfa_pt_${'A'.repeat(94)}` + const projectToken = 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const result = await withEnvironment( { POLYMORFA_API_KEY: undefined, @@ -38,9 +38,9 @@ describe('api', () => { server = await startHttpServer({body: {success: true}}) const result = await withEnvironment( { - POLYMORFA_API_KEY: `pmfa_${'A'.repeat(72)}`, + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_CLIENT_TOKEN: undefined, - POLYMORFA_PROJECT_TOKEN: `pmfa_pt_${'A'.repeat(94)}`, + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, }, () => runCommand('api /messaging/health --surface messaging --json'), @@ -57,7 +57,7 @@ describe('api', () => { const previousDirectory = process.cwd() const keyring = vi .spyOn(AsyncEntry.prototype, 'getPassword') - .mockResolvedValue(`pmfa_pt_${'A'.repeat(94)}`) + .mockResolvedValue('pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k') tempDirectories.push(directory) try { await mkdir(configDirectory) @@ -125,7 +125,7 @@ describe('api', () => { process.chdir(directory) const result = await withEnvironment( { - POLYMORFA_API_KEY: `pmfa_${'A'.repeat(72)}`, + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_PROJECT_TOKEN: undefined, POLYMORFA_BASE_URL: server.baseUrl, @@ -145,8 +145,7 @@ describe('api', () => { }) const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -177,14 +176,13 @@ describe('api', () => { }) const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, () => runCommand( - 'api /platform/sessions/number/start --surface platform --method POST --json', + 'api /platform/connections/connection/start --surface platform --method POST --json', ), ) expect(exitCode(result.error)).toBe(4) @@ -218,8 +216,7 @@ describe('api', () => { const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -239,7 +236,7 @@ describe('api', () => { url: '/v1/projects', }) expect(server.requests[0]?.headers.authorization).toBe( - 'Bearer pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'Bearer pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', ) }) @@ -251,8 +248,7 @@ describe('api', () => { const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -281,8 +277,7 @@ describe('api', () => { const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -309,8 +304,7 @@ describe('api', () => { const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -331,8 +325,7 @@ describe('api', () => { test('redacts credentials from API errors and preserves the request ID', async () => { server = await startHttpServer({ body: { - error: - 'Invalid API key pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.', + error: 'Invalid API key pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k.', }, headers: {'request-id': 'req_auth'}, status: 401, @@ -340,8 +333,7 @@ describe('api', () => { const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -360,9 +352,7 @@ describe('api', () => { }, schemaVersion: 1, }) - expect(result.stderr).not.toContain( - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', - ) + expect(result.stderr).not.toContain('pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k') expect(result.stdout).toBe('') }) @@ -371,8 +361,7 @@ describe('api', () => { const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -395,8 +384,7 @@ describe('api', () => { const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -423,8 +411,7 @@ describe('api', () => { const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -457,8 +444,7 @@ describe('api', () => { const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -475,8 +461,7 @@ describe('api', () => { const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -495,8 +480,7 @@ describe('api', () => { const result = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/audience-profiles.test.ts b/test/commands/audience-profiles.test.ts index 8f691b24..625b8a88 100644 --- a/test/commands/audience-profiles.test.ts +++ b/test/commands/audience-profiles.test.ts @@ -57,8 +57,7 @@ describe('campaign profiles commands', () => { function run(command: string, env: Record<string, string | undefined> = {}) { return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server!.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, ...env, diff --git a/test/commands/audiences-optouts.test.ts b/test/commands/audiences-optouts.test.ts index 78763a96..89af9488 100644 --- a/test/commands/audiences-optouts.test.ts +++ b/test/commands/audiences-optouts.test.ts @@ -224,8 +224,7 @@ describe('Audience and opt-out commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/auth.test.ts b/test/commands/auth.test.ts index e06e9277..5df2cdf3 100644 --- a/test/commands/auth.test.ts +++ b/test/commands/auth.test.ts @@ -55,7 +55,7 @@ describe('auth commands', () => { test('logs in from stdin, lists profiles, and switches active profile', async () => { await withConfig(async () => { const login = await withStdin( - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n', + 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k\n', async () => runCommand('auth login --with-api-key --profile work --json'), ) @@ -78,10 +78,8 @@ describe('auth commands', () => { test('reports keyring availability and logs out only the selected profile', async () => { await withConfig(async () => { - await withStdin( - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n', - async () => - runCommand('auth login --with-api-key --profile work --json'), + await withStdin('pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k\n', async () => + runCommand('auth login --with-api-key --profile work --json'), ) const status = await runCommand('auth status --profile work --json') @@ -104,8 +102,7 @@ describe('auth commands', () => { test('reports environment credential validation separately from remote exercise', async () => { await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC', + POLYMORFA_API_KEY: 'pmfa_AgMEBQYHCAkKCwwNDg8QERITFBXd5SUP', POLYMORFA_CLIENT_TOKEN: undefined, }, async () => { @@ -124,7 +121,7 @@ describe('auth commands', () => { test('stores a project-token profile with exact project ownership', async () => { await withConfig(async () => { - const token = `pmfa_pt_${'A'.repeat(94)}\n` + const token = `pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k\n` const login = await withStdin(token, async () => runCommand( 'auth login --with-project-token --profile project --project project_1 --json', @@ -156,7 +153,7 @@ describe('auth commands', () => { }) test('reports an environment project token without exposing it', async () => { - const token = `pmfa_pt_${'A'.repeat(94)}` + const token = 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' await withEnvironment( { POLYMORFA_API_KEY: undefined, diff --git a/test/commands/bansafe.test.ts b/test/commands/bansafe.test.ts index 5dcdd036..89bef7f5 100644 --- a/test/commands/bansafe.test.ts +++ b/test/commands/bansafe.test.ts @@ -37,8 +37,8 @@ describe('BanSafe commands', () => { { body: {data: [], page: {hasMore: false, nextCursor: null}}, command: - 'bansafe health-action list --project project_1 --session session_1 --status failed --json', - path: '/platform/bansafe/health-actions?projectId=project_1&session=session_1&status=failed', + 'bansafe health-action list --project project_1 --connection session_1 --status failed --json', + path: '/platform/bansafe/health-actions?projectId=project_1&connection=session_1&status=failed', }, { body: {data: []}, @@ -64,19 +64,19 @@ describe('BanSafe commands', () => { const result = await platformEnvironment(() => runCommand( - 'bansafe telemetry history session/1 --since 2026-09-01T00:00:00Z --until 2026-09-08T00:00:00Z --cursor next_1 --limit 50 --json', + 'bansafe telemetry history connection/1 --since 2026-09-01T00:00:00Z --until 2026-09-08T00:00:00Z --cursor next_1 --limit 50 --json', ), ) expect(result.error).toBeUndefined() expect(server.requests[0]?.url).toBe( - '/platform/bansafe/telemetry/session%2F1/history?cursor=next_1&limit=50&since=2026-09-01T00%3A00%3A00Z&until=2026-09-08T00%3A00%3A00Z', + '/platform/bansafe/telemetry/connection%2F1/history?cursor=next_1&limit=50&since=2026-09-01T00%3A00%3A00Z&until=2026-09-08T00%3A00%3A00Z', ) }) test('gets Health history without inventing cursor pagination', async () => { server = await startHttpServer({ - body: {data: {points: [], session: 'session_1', sessionId: 'id_1'}}, + body: {data: {points: [], connection: 'session_1', connectionId: 'id_1'}}, }) const result = await platformEnvironment(() => @@ -96,7 +96,7 @@ describe('BanSafe commands', () => { const input = await jsonInput('policy.json', { emailNotification: true, enabled: true, - sessionAction: 'slow_down', + connectionAction: 'slow_down', slowDownMps: 0.5, threshold: 30, version: 4, @@ -116,7 +116,7 @@ describe('BanSafe commands', () => { }) expect(server.requests[0]?.headers['idempotency-key']).toBe('policy_4') expect(JSON.parse(server.requests[0]?.body ?? '')).toMatchObject({ - sessionAction: 'slow_down', + connectionAction: 'slow_down', slowDownMps: 0.5, version: 4, }) @@ -147,8 +147,8 @@ describe('BanSafe commands', () => { phoneNumber: '+1', projectId: 'p1', reason: 'Attributed to Polymorfa.', - session: 's1', - sessionId: 'id1', + connection: 's1', + connectionId: 'id1', status: 'under_review', summary: 'Restricted inside the claim window.', verdict: 'ours', @@ -198,8 +198,8 @@ describe('BanSafe commands', () => { projectId: 'p1', reason: 'Simultaneous calls were on for this number during the 30 days before the ban. Ban Insurance does not cover a number with simultaneous calls on.', - session: 's1', - sessionId: 'id1', + connection: 's1', + connectionId: 'id1', status: 'denied', summary: 'This claim was not approved because simultaneous calls were on for this number.', @@ -250,7 +250,7 @@ describe('BanSafe commands', () => { const input = await jsonInput('invalid-policy.json', { emailNotification: false, enabled: true, - sessionAction: 'slow_down', + connectionAction: 'slow_down', slowDownMps: null, threshold: 30, version: 4, @@ -299,8 +299,8 @@ describe('BanSafe commands', () => { '/platform/bansafe/enforcement?projectId=p1&rung=throttle', ], [ - 'bansafe incident list --project p1 --session s1 --json', - '/platform/bansafe/incidents?projectId=p1&session=s1', + 'bansafe incident list --project p1 --connection s1 --json', + '/platform/bansafe/incidents?projectId=p1&connection=s1', ], [ 'bansafe claim list --project p1 --status paid --json', @@ -325,14 +325,14 @@ describe('BanSafe commands', () => { created: true, incidentId: 'incident_1', occurredAt: '2026-09-08T00:00:00Z', - session: 's1', - sessionId: 'id1', + connection: 's1', + connectionId: 'id1', }, }, }) const report = await platformEnvironment(() => runCommand( - 'bansafe incident report --session s1 --occurred-at 2026-09-08T00:00:00Z --note observed --idempotency-key report_1 --json', + 'bansafe incident report --connection s1 --occurred-at 2026-09-08T00:00:00Z --note observed --idempotency-key report_1 --json', ), ) expect(report.error).toBeUndefined() @@ -344,7 +344,7 @@ describe('BanSafe commands', () => { expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ note: 'observed', occurredAt: '2026-09-08T00:00:00Z', - session: 's1', + connection: 's1', }) await server.close() @@ -362,7 +362,7 @@ describe('BanSafe commands', () => { expect(server.requests[0]?.headers['idempotency-key']).toBe('retract_1') }) - test('gets and updates project and session Safe Mode through separate typed resources', async () => { + test('gets and updates project and connection Safe Mode through separate typed resources', async () => { server = await startHttpServer({body: {data: projectSafeMode()}}) const input = await jsonInput('safe-mode.json', { onlineEnd: 18, @@ -386,20 +386,20 @@ describe('BanSafe commands', () => { }) await server.close() - server = await startHttpServer({body: {data: sessionSafeMode()}}) - const sessionInput = await jsonInput('session-safe-mode.json', { + server = await startHttpServer({body: {data: connectionSafeMode()}}) + const connectionInput = await jsonInput('connection-safe-mode.json', { pacing: 'jittered', presence: 'dark', }) - const session = await platformEnvironment(() => + const connection = await platformEnvironment(() => runCommand( - `bansafe safe-mode update session/1 --input ${sessionInput} --idempotency-key safe_2 --json`, + `bansafe safe-mode update connection/1 --input ${connectionInput} --idempotency-key safe_2 --json`, ), ) - expect(session.error).toBeUndefined() + expect(connection.error).toBeUndefined() expect(server.requests[0]).toMatchObject({ method: 'PUT', - url: '/platform/sessions/session%2F1/safe-mode', + url: '/platform/connections/connection%2F1/safe-mode', }) }) @@ -460,7 +460,7 @@ describe('BanSafe commands', () => { test('invalid mutation arguments stop before any live request', async () => { server = await startHttpServer({body: {data: {}}}) const missingRetryIdentity = await platformEnvironment(() => - runCommand('bansafe incident report --session s1 --json'), + runCommand('bansafe incident report --connection s1 --json'), ) const missingSafeModeTarget = await platformEnvironment(() => runCommand('bansafe safe-mode view --json'), @@ -490,8 +490,7 @@ describe('BanSafe commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -506,7 +505,7 @@ function policy() { enabled: true, integrations: {emailConfigured: true, webhookConfigured: false}, projectId: 'project_1', - sessionAction: 'slow_down', + connectionAction: 'slow_down', slowDownMps: 0.5, threshold: 30, version: 4, @@ -529,8 +528,8 @@ function incident() { projectId: 'p1', reportedBy: 'key_1', resolution: 'open', - session: 's1', - sessionId: 'id1', + connection: 's1', + connectionId: 'id1', source: 'customer', startedAt: '2026-09-08T00:00:00Z', } @@ -556,7 +555,7 @@ function projectSafeMode() { } } -function sessionSafeMode() { +function connectionSafeMode() { return { applied: null, effective: settings(), @@ -571,7 +570,7 @@ function sessionSafeMode() { }, project: settings(), projectId: 'p1', - session: 's1', + connection: 's1', } } diff --git a/test/commands/billing-controls.test.ts b/test/commands/billing-controls.test.ts index 1841264b..eaddb49a 100644 --- a/test/commands/billing-controls.test.ts +++ b/test/commands/billing-controls.test.ts @@ -8,15 +8,14 @@ import { withEnvironment, type TestHttpServer, } from '../helpers/http-server.js' -const key = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const key = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const project = '22222222-2222-4222-8222-222222222222', number = '33333333-3333-4333-8333-333333333333' const priorities = { revision: 5, projects: [{id: project, name: 'Support', priority: 1}], customers: [], - numbers: [{id: number, projectId: project, name: 'Desk', priority: 2}], + connections: [{id: number, projectId: project, name: 'Desk', priority: 2}], } let server: TestHttpServer let directory: string | undefined @@ -64,7 +63,7 @@ test('reads priorities and saves a complete number order with the observed revis 'priority', 'reorder', '--scope', - 'number', + 'connection', '--project', project, '--ids', @@ -77,7 +76,7 @@ test('reads priorities and saves a complete number order with the observed revis ).toBeUndefined() expect(server.requests[0]?.url).toBe('/platform/billing/priorities') expect(JSON.parse(server.requests[1]!.body)).toEqual({ - scope: 'number', + scope: 'connection', projectId: project, resourceIds: [number], expectedRevision: 4, @@ -93,7 +92,7 @@ test('removes a cap explicitly and blocks malformed controls before sending a re 'set', number, '--scope', - 'number', + 'connection', '--unlimited', '--expected-revision', '0', @@ -111,7 +110,7 @@ test('removes a cap explicitly and blocks malformed controls before sending a re 'set', number, '--scope', - 'number', + 'connection', '--credits', '0.0000001', '--expected-revision', @@ -232,7 +231,7 @@ test('reads a selected project and saves mixed customer/number funding controls' '--project', project, '--ids', - `number:${number},customer:${project}`, + `connection:${number},customer:${project}`, '--expected-revision', '5', '--json', @@ -246,7 +245,7 @@ test('reads a selected project and saves mixed customer/number funding controls' scope: 'resource', projectId: project, resources: [ - {scope: 'number', resourceId: number}, + {scope: 'connection', resourceId: number}, {scope: 'customer', resourceId: project}, ], expectedRevision: 5, @@ -262,7 +261,7 @@ test('reads a selected project and saves mixed customer/number funding controls' '--project', project, '--ids', - `number:${number},number:${number}`, + `connection:${number},connection:${number}`, '--expected-revision', '5', ]) @@ -271,7 +270,7 @@ test('reads a selected project and saves mixed customer/number funding controls' expect(server.requests).toHaveLength(2) }) -test('renders customers as well as projects and numbers in human output', async () => { +test('renders customers as well as projects and connections in human output', async () => { server = await startHttpSequenceServer([ { body: { @@ -294,7 +293,7 @@ test('renders customers as well as projects and numbers in human output', async expect(result.error).toBeUndefined() expect(result.stdout).toContain('Revision: 5') expect(result.stdout).toContain(`customer\t${project}\tAcme\t3`) - expect(result.stdout).toContain(`number\t${number}\tDesk\t2`) + expect(result.stdout).toContain(`connection\t${number}\tDesk\t2`) expect(server.requests[0]?.url).toBe( `/platform/billing/priorities?projectId=${project}`, ) @@ -302,7 +301,7 @@ test('renders customers as well as projects and numbers in human output', async test('loads a complete 2,000-resource order from a file into one revision-guarded request', async () => { const resources = Array.from({length: 2000}, (_, index) => ({ - scope: index % 2 === 0 ? 'customer' : 'number', + scope: index % 2 === 0 ? 'customer' : 'connection', resourceId: `00000000-0000-4000-8000-${(index + 1).toString(16).padStart(12, '0')}`, })) const file = await orderFile( @@ -348,9 +347,9 @@ test('rejects malformed, missing, duplicate, or conflicting file inputs before H ] for (const content of [ '{not json', - JSON.stringify({ids: [`number:${number}`]}), + JSON.stringify({ids: [`connection:${number}`]}), JSON.stringify([5]), - JSON.stringify([`number:${number}`, `number:${number}`]), + JSON.stringify([`connection:${number}`, `connection:${number}`]), JSON.stringify([`project:${project}`]), ]) { const file = await orderFile(content) @@ -358,13 +357,13 @@ test('rejects malformed, missing, duplicate, or conflicting file inputs before H expect(result.error, content).toBeDefined() expect(result.stdout).not.toContain('Priority order saved.') } - const file = await orderFile(JSON.stringify([`number:${number}`])) + const file = await orderFile(JSON.stringify([`connection:${number}`])) expect( (await run([...args, '--ids-file', `${file}.missing`])).error, ).toBeDefined() expect((await run(args)).error).toBeDefined() expect( - (await run([...args, '--ids-file', file, '--ids', `number:${number}`])) + (await run([...args, '--ids-file', file, '--ids', `connection:${number}`])) .error, ).toBeDefined() expect(server.requests).toHaveLength(0) diff --git a/test/commands/business-account-modes.test.ts b/test/commands/business-account-modes.test.ts index 650e9ced..34f6cef6 100644 --- a/test/commands/business-account-modes.test.ts +++ b/test/commands/business-account-modes.test.ts @@ -5,7 +5,7 @@ import { withEnvironment, } from '../helpers/http-server.js' -const key = `pmfa_${'A'.repeat(72)}` +const key = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' function environment( baseUrl: string, run: () => Promise<unknown>, @@ -16,7 +16,9 @@ function environment( POLYMORFA_API_KEY: client ? undefined : key, POLYMORFA_BASE_URL: baseUrl, POLYMORFA_PROJECT_TOKEN: undefined, - POLYMORFA_CLIENT_TOKEN: client ? `pmfa_ct_${'A'.repeat(94)}` : undefined, + POLYMORFA_CLIENT_TOKEN: client + ? `pmfa_ct_AAECAwQFBgcICQoLDA0ODxAREhM73f-k` + : undefined, }, run, ) @@ -29,7 +31,7 @@ for (const accountType of [ ]) { test(`changes Test account mode ${accountType} using the installed transport`, async () => { const reply = { - session: 'demo/a', + connection: 'demo/a', accountType, primaryPlatform: accountType === 'meta_cloud' ? null : 'android', changed: true, @@ -65,7 +67,7 @@ test('keeps iOS and a completed unchanged result', async () => { const server = await startHttpSequenceServer([ { body: { - session: 'demo', + connection: 'demo', accountType: 'business_app', primaryPlatform: 'ios', changed: false, @@ -126,7 +128,7 @@ test('rejects client credentials before I/O', async () => { } }) test('rejects malformed mode responses', async () => { - const server = await startHttpSequenceServer([{body: {session: 'demo'}}]) + const server = await startHttpSequenceServer([{body: {connection: 'demo'}}]) try { await environment(server.baseUrl, async () => { const result = await runCommand( @@ -148,7 +150,7 @@ test('creates a Test QuickLink with mode-specific flags', async () => { data: { id: 'ql', url: 'https://example.test/ql', - session: 'demo', + connection: 'demo', expiresAt: null, }, }, diff --git a/test/commands/business.test.ts b/test/commands/business.test.ts index 9bf7cd06..70138a07 100644 --- a/test/commands/business.test.ts +++ b/test/commands/business.test.ts @@ -28,7 +28,7 @@ describe('business commands', () => { server = await startHttpServer({body: {data: {}, success: true}}) const result = await clientTokenEnvironment(() => - runCommand('business profile view --session session_1 --json'), + runCommand('business profile view --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -45,7 +45,7 @@ describe('business commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('business profile view --session session/main --json'), + runCommand('business profile view --connection connection/main --json'), ) expect(result.error).toBeUndefined() @@ -58,7 +58,7 @@ describe('business commands', () => { }, }) expect(server.requests[0]?.url).toBe( - '/messaging/session%2Fmain/business/profile', + '/messaging/connection%2Fmain/business/profile', ) }) @@ -84,7 +84,7 @@ describe('business commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `business profile update --session session_1 --input ${input} --idempotency-key profile_1 --json`, + `business profile update --connection session_1 --input ${input} --idempotency-key profile_1 --json`, ), ) @@ -111,12 +111,12 @@ describe('business commands', () => { const setResult = await apiKeyEnvironment(() => runCommand( - `business profile cover set --session session/main --file ${picture} --idempotency-key cover_set --json`, + `business profile cover set --connection connection/main --file ${picture} --idempotency-key cover_set --json`, ), ) const deleteResult = await apiKeyEnvironment(() => runCommand( - 'business profile cover delete cover/1 --session session/main --yes --idempotency-key cover_delete --json', + 'business profile cover delete cover/1 --connection connection/main --yes --idempotency-key cover_delete --json', ), ) @@ -125,12 +125,12 @@ describe('business commands', () => { base64: '/9j/2Q==', }) expect(server.requests[0]?.url).toBe( - '/messaging/session%2Fmain/business/profile/cover-photo', + '/messaging/connection%2Fmain/business/profile/cover-photo', ) expect(deleteResult.error).toBeUndefined() expect(server.requests[1]).toMatchObject({ method: 'DELETE', - url: '/messaging/session%2Fmain/business/profile/cover-photo/cover%2F1', + url: '/messaging/connection%2Fmain/business/profile/cover-photo/cover%2F1', }) }) @@ -141,7 +141,7 @@ describe('business commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'business catalog view --session session_1 --id 750000000001 --after cursor_1 --limit 25 --width 320 --height 240 --json', + 'business catalog view --connection session_1 --id 750000000001 --after cursor_1 --limit 25 --width 320 --height 240 --json', ), ) @@ -159,12 +159,12 @@ describe('business commands', () => { const createResult = await apiKeyEnvironment(() => runCommand( - 'business catalog create --session session_1 --idempotency-key catalog_create --json', + 'business catalog create --connection session_1 --idempotency-key catalog_create --json', ), ) const cartResult = await apiKeyEnvironment(() => runCommand( - 'business catalog cart set --session session_1 --enabled false --idempotency-key cart_off --json', + 'business catalog cart set --connection session_1 --enabled false --idempotency-key cart_off --json', ), ) @@ -186,13 +186,13 @@ describe('business commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'business product view product/1 --session session/main --id 750000000001 --json', + 'business product view product/1 --connection connection/main --id 750000000001 --json', ), ) expect(result.error).toBeUndefined() expect(server.requests[0]?.url).toBe( - '/messaging/session%2Fmain/business/products/product%2F1?id=750000000001', + '/messaging/connection%2Fmain/business/products/product%2F1?id=750000000001', ) }) @@ -202,7 +202,7 @@ describe('business commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `business product create --session session_1 --input ${input} --idempotency-key product_create --json`, + `business product create --connection session_1 --input ${input} --idempotency-key product_create --json`, ), ) @@ -233,7 +233,7 @@ describe('business commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `business product create --session session_1 --input ${input} --json`, + `business product create --connection session_1 --input ${input} --json`, ), ) @@ -253,7 +253,7 @@ describe('business commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `business product replace product_1 --session session_1 --input ${input} --json`, + `business product replace product_1 --connection session_1 --input ${input} --json`, ), ) @@ -273,12 +273,12 @@ describe('business commands', () => { const replaceResult = await apiKeyEnvironment(() => runCommand( - `business product replace product/1 --session session_1 --input ${input} --idempotency-key product_replace --json`, + `business product replace product/1 --connection session_1 --input ${input} --idempotency-key product_replace --json`, ), ) const deleteResult = await apiKeyEnvironment(() => runCommand( - 'business product delete product/1 --session session_1 --yes --idempotency-key product_delete --json', + 'business product delete product/1 --connection session_1 --yes --idempotency-key product_delete --json', ), ) @@ -302,12 +302,12 @@ describe('business commands', () => { const visibilityResult = await apiKeyEnvironment(() => runCommand( - 'business product visibility set product_1 --session session_1 --hidden true --idempotency-key hidden_1 --json', + 'business product visibility set product_1 --connection session_1 --hidden true --idempotency-key hidden_1 --json', ), ) const appealResult = await apiKeyEnvironment(() => runCommand( - 'business product appeal product_1 --session session_1 --reason "Please review" --idempotency-key appeal_1 --json', + 'business product appeal product_1 --connection session_1 --reason "Please review" --idempotency-key appeal_1 --json', ), ) @@ -332,7 +332,7 @@ describe('business commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'business collection list --session session_1 --id 750000000001 --after next_1 --collection-limit 10 --item-limit 40 --width 128 --height 96 --json', + 'business collection list --connection session_1 --id 750000000001 --after next_1 --collection-limit 10 --item-limit 40 --width 128 --height 96 --json', ), ) @@ -347,7 +347,7 @@ describe('business commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'business collection view collection/1 --session session_1 --id 750000000001 --after product_cursor --limit 20 --width 256 --height 256 --json', + 'business collection view collection/1 --connection session_1 --id 750000000001 --after product_cursor --limit 20 --width 256 --height 256 --json', ), ) @@ -375,12 +375,12 @@ describe('business commands', () => { const createResult = await apiKeyEnvironment(() => runCommand( - 'business collection create --session session_1 --name Featured --product product_1 --product product_2 --idempotency-key collection_create --json', + 'business collection create --connection session_1 --name Featured --product product_1 --product product_2 --idempotency-key collection_create --json', ), ) const updateResult = await apiKeyEnvironment(() => runCommand( - 'business collection update collection_1 --session session_1 --name Updated --add-product product_3 --remove-product product_1 --idempotency-key collection_update --json', + 'business collection update collection_1 --connection session_1 --name Updated --add-product product_3 --remove-product product_1 --idempotency-key collection_update --json', ), ) @@ -410,7 +410,7 @@ describe('business commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'business collection update collection_1 --session session_1 --add-product product_1 --remove-product product_1 --json', + 'business collection update collection_1 --connection session_1 --add-product product_1 --remove-product product_1 --json', ), ) @@ -431,17 +431,17 @@ describe('business commands', () => { const deleteResult = await apiKeyEnvironment(() => runCommand( - 'business collection delete collection/1 --session session_1 --yes --idempotency-key collection_delete --json', + 'business collection delete collection/1 --connection session_1 --yes --idempotency-key collection_delete --json', ), ) const reorderResult = await apiKeyEnvironment(() => runCommand( - `business collection reorder --session session_1 --input ${input} --idempotency-key collection_reorder --json`, + `business collection reorder --connection session_1 --input ${input} --idempotency-key collection_reorder --json`, ), ) const appealResult = await apiKeyEnvironment(() => runCommand( - 'business collection appeal collection/1 --session session_1 --reason "Please review" --idempotency-key collection_appeal --json', + 'business collection appeal collection/1 --connection session_1 --reason "Please review" --idempotency-key collection_appeal --json', ), ) @@ -469,7 +469,7 @@ describe('business commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'business order view order/1 --session session/main --token event_token --idempotency-key order_lookup --json', + 'business order view order/1 --connection connection/main --token event_token --idempotency-key order_lookup --json', ), ) @@ -477,7 +477,7 @@ describe('business commands', () => { expect(server.requests[0]).toMatchObject({ body: JSON.stringify({token: 'event_token'}), method: 'POST', - url: '/messaging/session%2Fmain/business/orders/order%2F1/lookup', + url: '/messaging/connection%2Fmain/business/orders/order%2F1/lookup', }) }) @@ -489,11 +489,11 @@ describe('business commands', () => { ]) const viewResult = await apiKeyEnvironment(() => - runCommand('business compliance view --session session_1 --json'), + runCommand('business compliance view --connection session_1 --json'), ) const replaceResult = await apiKeyEnvironment(() => runCommand( - `business compliance replace --session session_1 --input ${input} --idempotency-key compliance_replace --json`, + `business compliance replace --connection session_1 --input ${input} --idempotency-key compliance_replace --json`, ), ) @@ -523,7 +523,7 @@ describe('business commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand(`business ${command} --session session_1 --json`), + runCommand(`business ${command} --connection session_1 --json`), ) expect(result.error).toBeUndefined() @@ -544,8 +544,7 @@ describe('business commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -559,7 +558,7 @@ describe('business commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, run, ) diff --git a/test/commands/call-analytics.test.ts b/test/commands/call-analytics.test.ts index 7df50f74..2bdc1b60 100644 --- a/test/commands/call-analytics.test.ts +++ b/test/commands/call-analytics.test.ts @@ -14,14 +14,12 @@ import { } from '../helpers/http-server.js' import {temporaryDirectory} from '../support/fs.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' -const PROJECT_TOKEN = - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' +const PROJECT_TOKEN = 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const PROJECT = '11111111-1111-4111-8111-111111111111' const HEADER = - 'callId,projectId,sessionId,direction,upstream,outcome,state,hasVideo,peerRef,startedAt,connectedAt,endedAt,durationSeconds,endReason' + 'callId,projectId,connectionId,direction,upstream,outcome,state,hasVideo,peerRef,startedAt,connectedAt,endedAt,durationSeconds,endReason' function metrics(overrides: Record<string, unknown> = {}) { return { @@ -113,7 +111,7 @@ describe('calls stats', () => { 'stats', '--project', PROJECT, - '--session', + '--connection', 'support', '--direction', 'inbound', @@ -140,7 +138,7 @@ describe('calls stats', () => { groupBy: 'day', outcome: 'answered', projectId: PROJECT, - sessionId: 'support', + connectionId: 'support', since: '2026-09-11T00:00:00Z', timezone: 'Europe/Lisbon', until: '2026-09-18T00:00:00Z', @@ -166,7 +164,7 @@ describe('calls stats', () => { { body: { data: stats({ - groupBy: 'session', + groupBy: 'connection', groups: [{key: 'support', start: null, ...metrics()}], groupsTruncated: true, }), @@ -175,15 +173,17 @@ describe('calls stats', () => { ]) const result = await apiKey(() => - runCommand('calls stats --group-by session --heatmap'), + runCommand('calls stats --group-by connection --heatmap'), ) expect(result.error).toBeUndefined() expect(server.requests[0]?.url).toBe( - '/platform/calls/stats?groupBy=session', + '/platform/calls/stats?groupBy=connection', + ) + expect(result.stdout).toContain('Connection\tCalls') + expect(result.stdout).toContain( + 'Only the 500 connections with the most calls', ) - expect(result.stdout).toContain('Session\tCalls') - expect(result.stdout).toContain('Only the 500 numbers with the most calls') expect(result.stdout).toContain('Calls by hour\t00\t01') expect(result.stdout).toMatch(/\nMon\t(0\t){14}7\t0/) }) @@ -271,7 +271,7 @@ describe('calls stats', () => { body: { error: { code: 'insufficient_scope', - message: 'This credential lacks the sessions:read scope.', + message: 'This credential lacks the connections:read scope.', }, }, headers: {'x-request-id': 'req_denied'}, @@ -282,7 +282,7 @@ describe('calls stats', () => { const result = await apiKey(() => runCommand('calls stats')) expect(exitCode(result.error)).toBe(3) - expect(result.stderr).toContain('sessions:read') + expect(result.stderr).toContain('connections:read') expect(result.stdout).toBe('') }) diff --git a/test/commands/call-consent.test.ts b/test/commands/call-consent.test.ts index d7120986..492a0b75 100644 --- a/test/commands/call-consent.test.ts +++ b/test/commands/call-consent.test.ts @@ -11,9 +11,8 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' -const CLIENT_TOKEN = 'pmfa_ct_browser_token' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' +const CLIENT_TOKEN = 'pmfa_ct_cG1mYV9jdF9icm93c2VyX3Rva2Vu' const OPT_OUT_ID = '0b9f6a52-8f0e-4a44-9d51-3c1f9d6f2a10' const NEXT_CURSOR = '1c9f6a52-8f0e-4a44-9d51-3c1f9d6f2a11' @@ -489,9 +488,9 @@ describe('call consent commands', () => { await writeFile(file, JSON.stringify([{phoneNumber: '+14155550123'}])) const unknownField = join(directory, 'unknown.json') await writeFile(unknownField, JSON.stringify([{phone: '+14155550123'}])) - const noHeader = join(directory, 'numbers.csv') + const noHeader = join(directory, 'connections.csv') await writeFile(noHeader, '+14155550123\n') - const text = join(directory, 'numbers.txt') + const text = join(directory, 'connections.txt') await writeFile(text, '+14155550123\n') const full = await apiKey(() => runCommand(`calls opt-outs import ${file}`)) @@ -529,10 +528,10 @@ describe('call consent commands', () => { ]) const read = await apiKey(() => - runCommand('calls permission get +14155550123 --session support'), + runCommand('calls permission get +14155550123 --connection support'), ) const checked = await apiKey(() => - runCommand('calls check +14155550123 --session support'), + runCommand('calls check +14155550123 --connection support'), ) expect(read.error).toBeUndefined() @@ -550,7 +549,7 @@ describe('call consent commands', () => { 'POST /messaging/voip/calls/check', ]) expect(JSON.parse(server.requests[1]?.body ?? '')).toEqual({ - session: 'support', + connection: 'support', to: '+14155550123', }) }, 30_000) @@ -559,10 +558,10 @@ describe('call consent commands', () => { server = await startHttpServer({body: {success: true}}) const read = await clientToken(() => - runCommand('calls permission get +14155550123 --session support'), + runCommand('calls permission get +14155550123 --connection support'), ) const checked = await clientToken(() => - runCommand('calls check +14155550123 --session support'), + runCommand('calls check +14155550123 --connection support'), ) expect(exitCode(read.error)).toBe(2) @@ -575,7 +574,7 @@ describe('call consent commands', () => { body: { error: { code: 'unsupported_for_connection', - message: 'Call permissions apply to Cloud API numbers only.', + message: 'Call permissions apply to Cloud API connections only.', }, success: false, }, @@ -583,7 +582,9 @@ describe('call consent commands', () => { }) const read = await apiKey(() => - runCommand('calls permission get +14155550123 --session linked --json'), + runCommand( + 'calls permission get +14155550123 --connection linked --json', + ), ) expect(exitCode(read.error)).toBe(4) @@ -622,22 +623,22 @@ describe('call consent commands', () => { const sent = await apiKey(() => runCommand( - 'calls permission request +14155550123 --session support --body "We would like to call you about your order."', + 'calls permission request +14155550123 --connection support --body "We would like to call you about your order."', ), ) const limited = await apiKey(() => runCommand( - 'calls permission request +14155550123 --session support --body Again --json', + 'calls permission request +14155550123 --connection support --body Again --json', ), ) const granted = await apiKey(() => runCommand( - 'calls permission request +14155550123 --session support --body Hi', + 'calls permission request +14155550123 --connection support --body Hi', ), ) const empty = await apiKey(() => runCommand( - 'calls permission request +14155550123 --session support --body " "', + 'calls permission request +14155550123 --connection support --body " "', ), ) diff --git a/test/commands/call-links.test.ts b/test/commands/call-links.test.ts index 457d7771..69536256 100644 --- a/test/commands/call-links.test.ts +++ b/test/commands/call-links.test.ts @@ -10,9 +10,8 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' -const CLIENT_TOKEN = 'pmfa_ct_browser_token' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' +const CLIENT_TOKEN = 'pmfa_ct_cG1mYV9jdF9icm93c2VyX3Rva2Vu' const TOKEN = 'AbCdEf0123456789_link-token' describe('call link commands', () => { @@ -28,7 +27,7 @@ describe('call link commands', () => { body: { success: true, data: { - session: 'support', + connection: 'support', token: TOKEN, url: `https://call.whatsapp.com/voice/${TOKEN}`, video: false, @@ -39,7 +38,7 @@ describe('call link commands', () => { }) const result = await apiKey(() => - runCommand('calls link create --session support'), + runCommand('calls link create --connection support'), ) expect(result.error).toBeUndefined() @@ -54,7 +53,7 @@ describe('call link commands', () => { }) expect(server.requests[0]?.headers['idempotency-key']).toBeUndefined() expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ - session: 'support', + connection: 'support', video: false, }) }) @@ -64,7 +63,7 @@ describe('call link commands', () => { body: { success: true, data: { - session: 'support', + connection: 'support', token: TOKEN, url: `https://call.whatsapp.com/video/${TOKEN}`, video: true, @@ -74,18 +73,18 @@ describe('call link commands', () => { }) const result = await apiKey(() => - runCommand('calls link create --session support --video --json'), + runCommand('calls link create --connection support --video --json'), ) expect(result.error).toBeUndefined() expect((JSON.parse(result.stdout) as {data: unknown}).data).toEqual({ - session: 'support', + connection: 'support', token: TOKEN, url: `https://call.whatsapp.com/video/${TOKEN}`, video: true, }) expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ - session: 'support', + connection: 'support', video: true, }) }) @@ -95,7 +94,7 @@ describe('call link commands', () => { body: { success: true, data: { - session: 'support', + connection: 'support', video: true, creator: {id: '1637209842659371410', phoneNumber: '+15550100'}, approvalRequired: true, @@ -106,7 +105,7 @@ describe('call link commands', () => { const result = await withStdin( `https://call.whatsapp.com/video/${TOKEN}\n`, - () => apiKey(() => runCommand('calls link preview --session support')), + () => apiKey(() => runCommand('calls link preview --connection support')), ) expect(result.error).toBeUndefined() @@ -119,7 +118,7 @@ describe('call link commands', () => { }) expect(server.requests[0]?.url).not.toContain(TOKEN) expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ - session: 'support', + connection: 'support', token: TOKEN, video: true, }) @@ -130,7 +129,7 @@ describe('call link commands', () => { body: { success: true, data: { - session: 'support', + connection: 'support', video: true, creator: {id: '1637209842659371410'}, approvalRequired: false, @@ -141,13 +140,13 @@ describe('call link commands', () => { const result = await withStdin(TOKEN, () => apiKey(() => - runCommand('calls link preview --session support --video --json'), + runCommand('calls link preview --connection support --video --json'), ), ) expect(result.error).toBeUndefined() expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ - session: 'support', + connection: 'support', token: TOKEN, video: true, }) @@ -160,7 +159,7 @@ describe('call link commands', () => { `https://call.whatsapp.com/voice/${TOKEN}`, () => apiKey(() => - runCommand('calls link preview --session support --video'), + runCommand('calls link preview --connection support --video'), ), ) @@ -174,7 +173,7 @@ describe('call link commands', () => { const input = 'https://example.com/not-a-call-link?secret=abc' const result = await withStdin(input, () => - apiKey(() => runCommand('calls link preview --session support')), + apiKey(() => runCommand('calls link preview --connection support')), ) expect(exitCode(result.error)).toBe(2) @@ -187,10 +186,10 @@ describe('call link commands', () => { server = await startHttpServer({body: {success: true}}) const create = await clientToken(() => - runCommand('calls link create --session support'), + runCommand('calls link create --connection support'), ) const preview = await withStdin(TOKEN, () => - clientToken(() => runCommand('calls link preview --session support')), + clientToken(() => runCommand('calls link preview --connection support')), ) expect(exitCode(create.error)).toBe(2) @@ -233,10 +232,10 @@ describe('call link commands', () => { server = await startHttpServer({body: {success: true}}) const terminal = Object.assign(Readable.from([]), {isTTY: true}) const interactive = await withStdinStream(terminal, () => - apiKey(() => runCommand('calls link preview --session support')), + apiKey(() => runCommand('calls link preview --connection support')), ) const empty = await withStdin('', () => - apiKey(() => runCommand('calls link preview --session support')), + apiKey(() => runCommand('calls link preview --connection support')), ) expect(exitCode(interactive.error)).toBe(2) diff --git a/test/commands/call-records.test.ts b/test/commands/call-records.test.ts index fcc74723..345548be 100644 --- a/test/commands/call-records.test.ts +++ b/test/commands/call-records.test.ts @@ -7,13 +7,12 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const PROJECT = '11111111-1111-4111-8111-111111111111' const record = { callId: 'call_1', projectId: PROJECT, - sessionId: 'support', + connectionId: 'support', direction: 'inbound', upstream: 'linked_device', outcome: 'answered', @@ -124,7 +123,7 @@ describe('stored call record commands', () => { renderCallDetail({ call: { callId: 'call_1', - sessionId: '\u001b[31msupport', + connectionId: '\u001b[31msupport', state: 'ended', live: false, }, diff --git a/test/commands/calls-and-identities.test.ts b/test/commands/calls-and-identities.test.ts index ed0c8bee..b90d4af6 100644 --- a/test/commands/calls-and-identities.test.ts +++ b/test/commands/calls-and-identities.test.ts @@ -23,7 +23,7 @@ describe('call and identity commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'call reject call/1 --session session/main --from caller@lid --idempotency-key reject_1 --json', + 'call reject call/1 --connection connection/main --from caller@lid --idempotency-key reject_1 --json', ), ) @@ -35,7 +35,7 @@ describe('call and identity commands', () => { expect(server.requests[0]).toMatchObject({ body: JSON.stringify({from: 'caller@lid'}), method: 'POST', - url: '/messaging/session%2Fmain/calls/call%2F1/reject', + url: '/messaging/connection%2Fmain/calls/call%2F1/reject', }) expect(server.requests[0]?.headers['idempotency-key']).toBe('reject_1') }) @@ -45,12 +45,12 @@ describe('call and identity commands', () => { const clientResult = await clientTokenEnvironment(() => runCommand( - 'call reject call_1 --session session_1 --from caller@lid --json', + 'call reject call_1 --connection session_1 --from caller@lid --json', ), ) const invalidResult = await apiKeyEnvironment(() => runCommand( - `call reject ${'c'.repeat(129)} --session session_1 --from caller@lid --json`, + `call reject ${'c'.repeat(129)} --connection session_1 --from caller@lid --json`, ), ) @@ -75,7 +75,7 @@ describe('call and identity commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'identity resolve --session session_1 --phone-number " +15551234567 " --json', + 'identity resolve --connection session_1 --phone-number " +15551234567 " --json', ), ) @@ -92,7 +92,7 @@ describe('call and identity commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'identity resolve --session session_1 --username alice --username-key 1234 --json', + 'identity resolve --connection session_1 --username alice --username-key 1234 --json', ), ) @@ -106,7 +106,7 @@ describe('call and identity commands', () => { server = await startHttpServer({body: {data: {}, success: true}}) const result = await apiKeyEnvironment(() => - runCommand('identity resolve --session session_1 --json'), + runCommand('identity resolve --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -133,7 +133,9 @@ describe('call and identity commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('user security-code 750000000001 --session session/main'), + runCommand( + 'user security-code 750000000001 --connection connection/main', + ), ) expect(result.error).toBeUndefined() @@ -141,7 +143,7 @@ describe('call and identity commands', () => { expect(result.stdout).toContain(`Numeric code\t${numericCode}`) expect(result.stdout).not.toContain('cHJpdmF0ZS1kaXNwbGF5LXFy') expect(server.requests[0]?.url).toBe( - '/messaging/session%2Fmain/users/750000000001/security-code', + '/messaging/connection%2Fmain/users/750000000001/security-code', ) }) @@ -150,7 +152,7 @@ describe('call and identity commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'user security-code alice@s.whatsapp.net --session session_1 --json', + 'user security-code alice@s.whatsapp.net --connection session_1 --json', ), ) @@ -163,8 +165,7 @@ describe('call and identity commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -178,7 +179,7 @@ describe('call and identity commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, run, ) diff --git a/test/commands/calls-sockets.test.ts b/test/commands/calls-sockets.test.ts index a4abe603..45393c6f 100644 --- a/test/commands/calls-sockets.test.ts +++ b/test/commands/calls-sockets.test.ts @@ -25,8 +25,8 @@ import { } from '../helpers/calls-server.js' import {withEnvironment} from '../helpers/http-server.js' -const API_KEY = 'pmfa_socket_test_key_0123456789' -const CLIENT_TOKEN = 'pmfa_ct_socket_test_token' +const API_KEY = 'pmfa_BAUGBwgJCgsMDQ4PEBESExQVFhfgvFaM' +const CLIENT_TOKEN = 'pmfa_ct_cG1mYV9jdF9zb2NrZXRfdGVzdF90b2tlbg' const TIMESTAMP = '2026-09-16T10:00:00.000Z' describe('calls watch and media', () => { @@ -49,7 +49,7 @@ describe('calls watch and media', () => { await socket.next() socket.sendJson({ participant: 'server:agent-7', - session: 'support', + connection: 'support', type: 'ready', }) sendEvent(socket, 'call.received', 'call_1', { @@ -74,7 +74,7 @@ describe('calls watch and media', () => { const result = await apiKey(() => runCommand( - 'calls watch --session support --participant agent-7 --count 4 --json', + 'calls watch --connection support --participant agent-7 --count 4 --json', ), ) @@ -109,7 +109,7 @@ describe('calls watch and media', () => { {activities: 4, stoppedBy: 'count', type: 'stopped'}, ]) const [socket] = server.sockets - expect(socket?.path).toBe('/voip/ws?session=support&participant=agent-7') + expect(socket?.path).toBe('/voip/ws?connection=support&participant=agent-7') expect(socket?.path).not.toContain(API_KEY) expect(JSON.parse(String(socket?.messages[0]))).toEqual({ token: API_KEY, @@ -130,7 +130,7 @@ describe('calls watch and media', () => { }) const result = await apiKey(() => - runCommand('calls watch --session support --count 1'), + runCommand('calls watch --connection support --count 1'), ) expect(result.error).toBeUndefined() @@ -138,7 +138,7 @@ describe('calls watch and media', () => { 'incoming\tcall_1\tfrom=+15550100\tvideo=false\n', ) expect(result.stderr).toContain( - 'Following calls for session support as server:default.', + 'Following calls for connection support as server:default.', ) }) @@ -156,7 +156,7 @@ describe('calls watch and media', () => { }) const result = await apiKey(() => - runCommand('calls watch --session support --count 2 --json'), + runCommand('calls watch --connection support --count 2 --json'), ) expect(result.error).toBeUndefined() expect(result.stdout).toContain('"reason":"call_restricted"') @@ -176,7 +176,7 @@ describe('calls watch and media', () => { }) const result = await apiKey(() => - runCommand('calls watch --session support --json'), + runCommand('calls watch --connection support --json'), ) expect(exitCode(result.error)).toBe(3) @@ -188,13 +188,13 @@ describe('calls watch and media', () => { expect(server.sockets).toHaveLength(1) }) - test('watches a client token’s bound session without query parameters', async () => { + test('watches a client token’s bound connection without query parameters', async () => { server = await startCallsServer({ onSocket: async (socket) => { await socket.next() socket.sendJson({ participant: 'client:web-1', - session: 'support', + connection: 'support', type: 'ready', }) sendEvent(socket, 'call.received', 'call_2', {from: '+15550100'}) @@ -213,14 +213,14 @@ describe('calls watch and media', () => { }) }) - test('validates watch credentials, session, and base URL before connecting', async () => { + test('validates watch credentials, connection, and base URL before connecting', async () => { server = await startCallsServer({}) const participant = await clientToken(() => runCommand('calls watch --participant agent-7 --json'), ) - const session = await clientToken(() => - runCommand('calls watch --session support --json'), + const connection = await clientToken(() => + runCommand('calls watch --connection support --json'), ) const missing = await apiKey(() => runCommand('calls watch --json')) const insecure = await withEnvironment( @@ -229,17 +229,17 @@ describe('calls watch and media', () => { POLYMORFA_BASE_URL: 'http://api.example.com', POLYMORFA_CLIENT_TOKEN: undefined, }, - () => runCommand('calls watch --session support --json'), + () => runCommand('calls watch --connection support --json'), ) expect(exitCode(participant.error)).toBe(2) expect(participant.stderr).toContain( '--participant requires a server API key', ) - expect(exitCode(session.error)).toBe(2) - expect(session.stderr).toContain('omit --session') + expect(exitCode(connection.error)).toBe(2) + expect(connection.stderr).toContain('omit --connection') expect(exitCode(missing.error)).toBe(2) - expect(missing.stderr).toContain('requires --session') + expect(missing.stderr).toContain('requires --connection') expect(exitCode(insecure.error)).toBe(2) expect(insecure.stderr).toContain('HTTPS POLYMORFA_BASE_URL') expect(server.sockets).toHaveLength(0) @@ -258,7 +258,7 @@ describe('calls watch and media', () => { { baseUrl: server.baseUrl, credential: {type: 'apiKey', value: API_KEY}, - session: 'support', + connection: 'support', signal: controller.signal, }, { @@ -285,7 +285,7 @@ describe('calls watch and media', () => { { baseUrl, credential: {type: 'apiKey', value: API_KEY}, - session: 'support', + connection: 'support', signal: controller.signal, }, { @@ -348,7 +348,7 @@ describe('calls watch and media', () => { }, rest: () => ({ body: { - data: {callId: 'call_9', session: 'support', video: false}, + data: {callId: 'call_9', connection: 'support', video: false}, success: true, }, status: 201, @@ -357,7 +357,7 @@ describe('calls watch and media', () => { const result = await apiKey(() => runCommand( - `calls media --session support --place +15550100 --input ${inputPath} --output ${outputPath} --leave-on-eof --json`, + `calls media --connection support --place +15550100 --input ${inputPath} --output ${outputPath} --leave-on-eof --json`, ), ) @@ -398,7 +398,7 @@ describe('calls watch and media', () => { }) expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ exclusive: false, - session: 'support', + connection: 'support', to: '+15550100', video: false, }) @@ -419,7 +419,7 @@ describe('calls watch and media', () => { await delay(100) return { body: { - data: {callId: 'call_8', session: 'support', video: false}, + data: {callId: 'call_8', connection: 'support', video: false}, success: true, }, status: 201, @@ -433,7 +433,7 @@ describe('calls watch and media', () => { credential: {type: 'apiKey', value: API_KEY}, output: () => undefined, place: '+15550100', - session: 'support', + connection: 'support', signal: AbortSignal.timeout(2_000), }, () => undefined, @@ -459,7 +459,7 @@ describe('calls watch and media', () => { await delay(100) return { body: { - data: {callId: 'call_7', session: 'support', video: false}, + data: {callId: 'call_7', connection: 'support', video: false}, success: true, }, status: 201, @@ -476,7 +476,7 @@ describe('calls watch and media', () => { credential: {type: 'apiKey', value: API_KEY}, output: () => undefined, place: '+15550100', - session: 'support', + connection: 'support', signal: controller.signal, }, (status) => statuses.push(status.type), @@ -503,7 +503,7 @@ describe('calls watch and media', () => { await delay(100) return { body: { - data: {callId: 'call_7', session: 'support', video: false}, + data: {callId: 'call_7', connection: 'support', video: false}, success: true, }, status: 201, @@ -529,7 +529,7 @@ describe('calls watch and media', () => { credential: {type: 'apiKey', value: API_KEY}, output: () => undefined, place: '+15550100', - session: 'support', + connection: 'support', signal: controller.signal, }, () => undefined, @@ -581,7 +581,7 @@ describe('calls watch and media', () => { try { const result = await apiKey(() => runCommand( - `calls media call_4 --session support --input - --output ${join(directory, 'out.pcm')} --json`, + `calls media call_4 --connection support --input - --output ${join(directory, 'out.pcm')} --json`, ), ) @@ -633,7 +633,7 @@ describe('calls watch and media', () => { 'calls', 'media', 'call_2', - '--session', + '--connection', 'support', '--input', '-', @@ -722,7 +722,7 @@ describe('calls watch and media', () => { credential: {type: 'apiKey', value: API_KEY}, exclusive: true, output: () => undefined, - session: 'support', + connection: 'support', signal: controller.signal, }, () => undefined, @@ -762,7 +762,7 @@ describe('calls watch and media', () => { const result = await apiKey(() => runCommand( - `calls media call_1 --session support --participant agent-7 --exclusive --output ${outputPath} --json`, + `calls media call_1 --connection support --participant agent-7 --exclusive --output ${outputPath} --json`, ), ) @@ -780,7 +780,7 @@ describe('calls watch and media', () => { }) }) - test('exits with an authorization error when calling is turned off for the session', async () => { + test('exits with an authorization error when calling is turned off for the connection', async () => { const directory = await mkdtemp(join(tmpdir(), 'polymorfa-calls-off-')) const outputPath = join(directory, 'out.pcm') try { @@ -809,7 +809,7 @@ describe('calls watch and media', () => { const result = await apiKey(() => runCommand( - `calls media call_4 --session support --output ${outputPath} --json`, + `calls media call_4 --connection support --output ${outputPath} --json`, ), ) @@ -841,7 +841,7 @@ describe('calls watch and media', () => { const result = await apiKey(() => runCommand( - `calls media --session support --output ${join(tmpdir(), 'polymorfa-missing-dir', 'nested', 'out.pcm')} --json`, + `calls media --connection support --output ${join(tmpdir(), 'polymorfa-missing-dir', 'nested', 'out.pcm')} --json`, ), ) @@ -870,7 +870,7 @@ describe('calls watch and media', () => { ]) { const result = await apiKey(() => runCommand( - `calls media --session support --input ${inputPath} --output ${output} --json`, + `calls media --connection support --input ${inputPath} --output ${output} --json`, ), ) @@ -886,7 +886,7 @@ describe('calls watch and media', () => { const result = await apiKey(() => runCommand( - `calls media --session support --input ${join(directory, 'missing.pcm')} --output ${join(directory, 'out.pcm')} --json`, + `calls media --connection support --input ${join(directory, 'missing.pcm')} --output ${join(directory, 'out.pcm')} --json`, ), ) @@ -929,7 +929,7 @@ describe('calls watch and media', () => { const result = await apiKey(() => runCommand( - `calls media call_6 --session support --input ${unreadable} --output ${join(directory, 'out.pcm')} --json`, + `calls media call_6 --connection support --input ${unreadable} --output ${join(directory, 'out.pcm')} --json`, ), ) @@ -976,7 +976,7 @@ describe('calls watch and media', () => { credential: {type: 'apiKey', value: API_KEY}, input: Readable.from([pcm(16_000)]), output: () => undefined, - session: 'support', + connection: 'support', signal: controller.signal, }, (status) => { @@ -999,7 +999,7 @@ describe('calls watch and media', () => { const result = await apiKey(() => runCommand( - `calls media --session support --leave-on-eof --output ${join(directory, 'out.pcm')}`, + `calls media --connection support --leave-on-eof --output ${join(directory, 'out.pcm')}`, ), ) diff --git a/test/commands/calls.test.ts b/test/commands/calls.test.ts index 0a942890..6c24805d 100644 --- a/test/commands/calls.test.ts +++ b/test/commands/calls.test.ts @@ -13,11 +13,9 @@ import { type CallSettings, } from '../../src/services/calls.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' -const CLIENT_TOKEN = 'pmfa_ct_browser_token' -const PROJECT_TOKEN = - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' +const CLIENT_TOKEN = 'pmfa_ct_cG1mYV9jdF9icm93c2VyX3Rva2Vu' +const PROJECT_TOKEN = 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const TRUNK_ID = '6f1c2f0e-1d5b-4d8e-9a55-0d4b8a6c1f10' const DEFAULT_RETENTION = { appliesTo: ['call_records', 'call_events', 'client_reports'], @@ -40,7 +38,7 @@ describe('unified calls commands', () => { { body: { success: true, - data: {callId: 'group_1', session: 'support', video: false}, + data: {callId: 'group_1', connection: 'support', video: false}, }, status: 201, }, @@ -48,12 +46,12 @@ describe('unified calls commands', () => { ]) const group = await apiKey(() => runCommand( - 'calls place-group --to +15550100 --to +15550101 --session support --json', + 'calls place-group --to +15550100 --to +15550101 --connection support --json', ), ) expect(group.error).toBeUndefined() expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ - session: 'support', + connection: 'support', participants: ['+15550100', '+15550101'], }) const ring = await apiKey(() => @@ -73,18 +71,18 @@ describe('unified calls commands', () => { server = await startHttpServer({ body: { success: true, - data: {callId: 'stored-group', session: 'support', video: false}, + data: {callId: 'stored-group', connection: 'support', video: false}, }, status: 201, }) const result = await apiKey(() => runCommand( - 'calls place-group --group-id 9007199254740996 --session support --json', + 'calls place-group --group-id 9007199254740996 --connection support --json', ), ) expect(result.error).toBeUndefined() expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ - session: 'support', + connection: 'support', groupId: '9007199254740996', }) expect(server.requests).toHaveLength(1) @@ -98,7 +96,7 @@ describe('unified calls commands', () => { '', ]) { const denied = await apiKey(() => - runCommand(`calls place-group ${args} --session support --json`), + runCommand(`calls place-group ${args} --connection support --json`), ) expect(exitCode(denied.error)).toBe(2) } @@ -112,7 +110,9 @@ describe('unified calls commands', () => { '--to +15550100 --to +15550100', ]) { const response = await apiKey(() => - runCommand(`calls place-group ${recipients} --session support --json`), + runCommand( + `calls place-group ${recipients} --connection support --json`, + ), ) expect(exitCode(response.error)).toBe(2) } @@ -148,10 +148,10 @@ describe('unified calls commands', () => { }) }) - test('places a call from a named session with a claim and participant', async () => { + test('places a call from a named connection with a claim and participant', async () => { server = await startHttpServer({ body: { - data: {callId: 'call_1', session: 'support', video: true}, + data: {callId: 'call_1', connection: 'support', video: true}, success: true, }, headers: {'request-id': 'req_place'}, @@ -160,13 +160,13 @@ describe('unified calls commands', () => { const result = await apiKey(() => runCommand( - 'calls place " +15550100 " --session support --video --exclusive --participant agent-7 --json', + 'calls place " +15550100 " --connection support --video --exclusive --participant agent-7 --json', ), ) expect(result.error).toBeUndefined() expect(JSON.parse(result.stdout)).toEqual({ - data: {callId: 'call_1', session: 'support', video: true}, + data: {callId: 'call_1', connection: 'support', video: true}, metadata: {attempts: 1, requestId: 'req_place', status: 201}, }) expect(server.requests[0]).toMatchObject({ @@ -176,17 +176,17 @@ describe('unified calls commands', () => { expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ exclusive: true, participant: 'agent-7', - session: 'support', + connection: 'support', to: '+15550100', video: true, }) expect(server.requests[0]?.headers.authorization).toBe(`Bearer ${API_KEY}`) }) - test('places a call with a client token from its bound session', async () => { + test('places a call with a client token from its bound connection', async () => { server = await startHttpServer({ body: { - data: {callId: 'call_2', session: 'support', video: false}, + data: {callId: 'call_2', connection: 'support', video: false}, success: true, }, status: 201, @@ -196,7 +196,7 @@ describe('unified calls commands', () => { expect(result.error).toBeUndefined() expect(result.stdout).toContain('Call\tcall_2') - expect(result.stdout).toContain('Session\tsupport') + expect(result.stdout).toContain('Connection\tsupport') expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ to: '15550100', }) @@ -208,23 +208,23 @@ describe('unified calls commands', () => { test('validates placement input before transport', async () => { server = await startHttpServer({body: {success: true}}) - const noSession = await apiKey(() => + const noConnection = await apiKey(() => runCommand('calls place +15550100 --json'), ) const participant = await clientToken(() => runCommand('calls place +15550100 --participant agent-7 --json'), ) const target = await apiKey(() => - runCommand('calls place 0555 --session support --json'), + runCommand('calls place 0555 --connection support --json'), ) const badParticipant = await apiKey(() => runCommand( - 'calls place +15550100 --session support --participant "agent 7" --json', + 'calls place +15550100 --connection support --participant "agent 7" --json', ), ) - expect(exitCode(noSession.error)).toBe(2) - expect(noSession.stderr).toContain('requires --session') + expect(exitCode(noConnection.error)).toBe(2) + expect(noConnection.stderr).toContain('requires --connection') expect(exitCode(participant.error)).toBe(2) expect(participant.stderr).toContain( '--participant requires a server API key', @@ -312,14 +312,14 @@ describe('unified calls commands', () => { server = await startHttpServer( apiError( 403, - 'number_restricted', + 'connection_restricted', 'This number can call only people it has already chatted with.', 'req_restricted', ), ) for (const command of [ - 'calls place +15550100 --session support', + 'calls place +15550100 --connection support', 'calls invite call_1 +15550101', ]) { const human = await apiKey(() => runCommand(command)) @@ -332,7 +332,7 @@ describe('unified calls commands', () => { expect(JSON.parse(json.stderr)).toMatchObject({ error: { category: 'authorization', - code: 'number_restricted', + code: 'connection_restricted', requestId: 'req_restricted', }, }) @@ -473,7 +473,7 @@ describe('unified calls commands', () => { expect(server.requests).toHaveLength(1) }) - test('reads and replaces session call settings with a server API key', async () => { + test('reads and replaces connection call settings with a server API key', async () => { server = await startHttpServer({ body: { data: {conferenceMode: false, updatedAt: '2026-09-16T10:00:00.000Z'}, @@ -482,17 +482,17 @@ describe('unified calls commands', () => { }) const viewed = await apiKey(() => - runCommand('calls settings get --session support/main'), + runCommand('calls settings get --connection support/main'), ) const updated = await apiKey(() => runCommand( - 'calls settings set --session support/main --no-conference-mode --json', + 'calls settings set --connection support/main --no-conference-mode --json', ), ) expect(viewed.error).toBeUndefined() expect(viewed.stdout).toBe( - 'Session\tsupport/main\nCalls\ton\nConference mode\toff\nIncoming calls\tclients\nCloud API calls answered by\tyour Graph API integration\nSimultaneous calls\toff\nRevision\t0\nUpdated\t2026-09-16T10:00:00.000Z\n', + 'Connection\tsupport/main\nCalls\ton\nConference mode\toff\nIncoming calls\tclients\nCloud API calls answered by\tyour Graph API integration\nSimultaneous calls\toff\nRevision\t0\nUpdated\t2026-09-16T10:00:00.000Z\n', ) expect(updated.error).toBeUndefined() expect(jsonData(updated.stdout)).toEqual({ @@ -500,8 +500,8 @@ describe('unified calls commands', () => { updatedAt: '2026-09-16T10:00:00.000Z', }) expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ - 'GET /platform/sessions/support%2Fmain/call-settings', - 'PUT /platform/sessions/support%2Fmain/call-settings', + 'GET /platform/connections/support%2Fmain/call-settings', + 'PUT /platform/connections/support%2Fmain/call-settings', ]) expect(JSON.parse(server.requests[1]?.body ?? '')).toEqual({ conferenceMode: false, @@ -520,35 +520,35 @@ describe('unified calls commands', () => { server = await startHttpServer({body: {data: routed, success: true}}) const conference = await apiKey(() => - runCommand('calls settings set --session support --conference-mode'), + runCommand('calls settings set --connection support --conference-mode'), ) const trunk = await apiKey(() => runCommand( - `calls settings set --session support --sip-trunk ${TRUNK_ID}`, + `calls settings set --connection support --sip-trunk ${TRUNK_ID}`, ), ) const back = await apiKey(() => runCommand( - 'calls settings set --session support --inbound-route clients --sip-claim=false', + 'calls settings set --connection support --inbound-route clients --sip-claim=false', ), ) const keepTrunk = await apiKey(() => runCommand( - 'calls settings set --session support --inbound-route sip_trunk', + 'calls settings set --connection support --inbound-route sip_trunk', ), ) const hosting = await apiKey(() => runCommand( - 'calls settings set --session support --host-cloud-api-calls=true', + 'calls settings set --connection support --host-cloud-api-calls=true', ), ) const conflicting = await apiKey(() => runCommand( - `calls settings set --session support --inbound-route clients --sip-trunk ${TRUNK_ID}`, + `calls settings set --connection support --inbound-route clients --sip-trunk ${TRUNK_ID}`, ), ) const empty = await apiKey(() => - runCommand('calls settings set --session support'), + runCommand('calls settings set --connection support'), ) for (const ok of [conference, trunk, back, keepTrunk, hosting]) { @@ -606,32 +606,32 @@ describe('unified calls commands', () => { const unacknowledged = await apiKey(() => runCommand( - 'calls settings set --session support --simultaneous-calls=true --json', + 'calls settings set --connection support --simultaneous-calls=true --json', ), ) const stray = await apiKey(() => runCommand( - 'calls settings set --session support --conference-mode --acknowledge-risk', + 'calls settings set --connection support --conference-mode --acknowledge-risk', ), ) const offWithAck = await apiKey(() => runCommand( - 'calls settings set --session support --simultaneous-calls=false --acknowledge-risk', + 'calls settings set --connection support --simultaneous-calls=false --acknowledge-risk', ), ) const acknowledged = await apiKey(() => runCommand( - 'calls settings set --session support --simultaneous-calls=true --acknowledge-risk', + 'calls settings set --connection support --simultaneous-calls=true --acknowledge-risk', ), ) const json = await apiKey(() => runCommand( - 'calls settings set --session support --conference-mode --simultaneous-calls=true --acknowledge-risk --expected-revision 1 --json', + 'calls settings set --connection support --conference-mode --simultaneous-calls=true --acknowledge-risk --expected-revision 1 --json', ), ) const off = await apiKey(() => runCommand( - 'calls settings set --session support --simultaneous-calls=false', + 'calls settings set --connection support --simultaneous-calls=false', ), ) @@ -647,7 +647,7 @@ describe('unified calls commands', () => { expect(exitCode(offWithAck.error)).toBe(2) expect(acknowledged.error).toBeUndefined() expect(acknowledged.stdout).toContain( - 'Simultaneous calls\ton (Ban Insurance does not cover this number)', + 'Simultaneous calls\ton (Ban Insurance does not cover this Connection)', ) expect(json.error).toBeUndefined() expect(jsonData(json.stdout)).toMatchObject({simultaneousCalls: true}) @@ -675,12 +675,12 @@ describe('unified calls commands', () => { const denied = await apiKey(() => runCommand( - 'calls settings set --session support/main --simultaneous-calls=true --acknowledge-risk --json', + 'calls settings set --connection support/main --simultaneous-calls=true --acknowledge-risk --json', ), ) const stale = await apiKey(() => runCommand( - 'calls settings set --session support/main --simultaneous-calls=false --expected-revision 2 --json', + 'calls settings set --connection support/main --simultaneous-calls=false --expected-revision 2 --json', ), ) @@ -701,12 +701,12 @@ describe('unified calls commands', () => { ).toEqual([ { method: 'PUT', - url: '/platform/sessions/support%2Fmain/call-settings', + url: '/platform/connections/support%2Fmain/call-settings', authorization: `Bearer ${API_KEY}`, }, { method: 'PUT', - url: '/platform/sessions/support%2Fmain/call-settings', + url: '/platform/connections/support%2Fmain/call-settings', authorization: `Bearer ${API_KEY}`, }, ]) @@ -788,7 +788,7 @@ describe('unified calls commands', () => { }, ]) - const get = 'calls settings get --session support/main' + const get = 'calls settings get --connection support/main' const dated = await apiKey(() => runCommand(get)) const noEnd = await apiKey(() => runCommand(get)) const on = await apiKey(() => runCommand(get)) @@ -798,7 +798,7 @@ describe('unified calls commands', () => { const expired = await apiKey(() => runCommand(get)) const turnedOff = await apiKey(() => runCommand( - 'calls settings set --session support/main --simultaneous-calls=false', + 'calls settings set --connection support/main --simultaneous-calls=false', ), ) @@ -815,14 +815,14 @@ describe('unified calls commands', () => { expect(run.error, run.stderr).toBeUndefined() } expect(dated.stdout).toBe( - `Session\tsupport/main\nCalls\ton\nConference mode\toff\nIncoming calls\tclients\nCloud API calls answered by\tyour Graph API integration\nSimultaneous calls\toff\nBan Insurance exclusion ends\t${until}\nRevision\t3\nUpdated\t2026-10-21T08:00:00.000Z\n`, + `Connection\tsupport/main\nCalls\ton\nConference mode\toff\nIncoming calls\tclients\nCloud API calls answered by\tyour Graph API integration\nSimultaneous calls\toff\nBan Insurance exclusion ends\t${until}\nRevision\t3\nUpdated\t2026-10-21T08:00:00.000Z\n`, ) for (const run of [noEnd, legacy, expired]) { expect(run.stdout).toContain('Simultaneous calls\toff\nRevision\t3\n') expect(run.stdout).not.toMatch(/exclusion|cover/i) } expect(on.stdout).toContain( - 'Simultaneous calls\ton (Ban Insurance does not cover this number)\nRevision\t3\n', + 'Simultaneous calls\ton (Ban Insurance does not cover this Connection)\nRevision\t3\n', ) expect(on.stdout).not.toContain('exclusion ends') expect(jsonData(jsonDated.stdout)).toMatchObject({ @@ -837,9 +837,9 @@ describe('unified calls commands', () => { expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ ...Array.from( {length: 7}, - () => 'GET /platform/sessions/support%2Fmain/call-settings', + () => 'GET /platform/connections/support%2Fmain/call-settings', ), - 'PUT /platform/sessions/support%2Fmain/call-settings', + 'PUT /platform/connections/support%2Fmain/call-settings', ]) expect(JSON.parse(server.requests[7]?.body ?? '')).toEqual({ simultaneousCalls: false, @@ -903,21 +903,23 @@ describe('unified calls commands', () => { const guarded = await apiKey(() => runCommand( - 'calls settings set --session support --calls-enabled=false --expected-revision 3', + 'calls settings set --connection support --calls-enabled=false --expected-revision 3', ), ) const stale = await apiKey(() => runCommand( - 'calls settings set --session support --calls-enabled=true --expected-revision 3 --json', + 'calls settings set --connection support --calls-enabled=true --expected-revision 3 --json', ), ) const negative = await apiKey(() => runCommand( - 'calls settings set --session support --calls-enabled=true --expected-revision -1', + 'calls settings set --connection support --calls-enabled=true --expected-revision -1', ), ) const alone = await apiKey(() => - runCommand('calls settings set --session support --expected-revision 3'), + runCommand( + 'calls settings set --connection support --expected-revision 3', + ), ) expect(guarded.error).toBeUndefined() @@ -957,10 +959,12 @@ describe('unified calls commands', () => { ]) const off = await apiKey(() => - runCommand('calls settings set --session support --calls-enabled=false'), + runCommand( + 'calls settings set --connection support --calls-enabled=false', + ), ) const place = await apiKey(() => - runCommand('calls place +15550100 --session support'), + runCommand('calls place +15550100 --connection support'), ) expect(off.error).toBeUndefined() @@ -983,7 +987,7 @@ describe('unified calls commands', () => { const result = await apiKey(() => runCommand( - 'calls settings set --session support --inbound-route sip_trunk', + 'calls settings set --connection support --inbound-route sip_trunk', ), ) @@ -995,16 +999,16 @@ describe('unified calls commands', () => { server = await startHttpServer({body: {success: true}}) const token = await clientToken(() => - runCommand('calls settings get --session support --json'), + runCommand('calls settings get --connection support --json'), ) const value = await apiKey(() => runCommand( - 'calls settings set --session support --conference-mode=yes --json', + 'calls settings set --connection support --conference-mode=yes --json', ), ) const retired = await apiKey(() => runCommand( - 'calls settings set --session support --include-self-audio=true --json', + 'calls settings set --connection support --include-self-audio=true --json', ), ) @@ -1281,9 +1285,9 @@ describe('unified calls commands', () => { ) }) - test('explains that changing call retention also needs sessions:read for the first read', async () => { + test('explains that changing call retention also needs connections:read for the first read', async () => { server = await startHttpSequenceServer([ - apiError(403, 'missing_scope', 'This action requires sessions:read.'), + apiError(403, 'missing_scope', 'This action requires connections:read.'), ]) const result = await apiKey(() => @@ -1298,10 +1302,10 @@ describe('unified calls commands', () => { } expect(envelope.error.category).toBe('authorization') expect(envelope.error.message).toContain( - 'use a team API key with the sessions:read and sessions:manage scopes to change it', + 'use a team API key with the connections:read and connections:manage scopes to change it', ) expect(envelope.error.message).toContain( - 'This action requires sessions:read.', + 'This action requires connections:read.', ) expect(server.requests.map(({method}) => method)).toEqual(['GET']) }) @@ -1341,7 +1345,7 @@ describe('unified calls commands', () => { } }) - test('distinguishes the unified and session-route reject commands in help', async () => { + test('distinguishes the unified and connection-route reject commands in help', async () => { const unified = await runCommand('calls reject --help') const legacy = await runCommand('call reject --help') diff --git a/test/commands/campaign-conversions.test.ts b/test/commands/campaign-conversions.test.ts index 1628e216..1df8d3a1 100644 --- a/test/commands/campaign-conversions.test.ts +++ b/test/commands/campaign-conversions.test.ts @@ -118,8 +118,7 @@ describe('Campaign conversion commands (beta)', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/campaign-experiments.test.ts b/test/commands/campaign-experiments.test.ts index c24156ad..d7b77383 100644 --- a/test/commands/campaign-experiments.test.ts +++ b/test/commands/campaign-experiments.test.ts @@ -7,8 +7,7 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' describe('campaign A/B test and weighted variation output (beta)', () => { let server: TestHttpServer | undefined @@ -286,6 +285,7 @@ const BASE_CAMPAIGN_LINES = [ 'ID\tcampaign_1', 'Name\tOctober offer', 'Status\trunning', + 'Template\t', 'Recipients\t1000', 'Sent\t160', 'Delivered\t150', diff --git a/test/commands/campaign-follow-ups.test.ts b/test/commands/campaign-follow-ups.test.ts index 5fbb5c67..7bdd4652 100644 --- a/test/commands/campaign-follow-ups.test.ts +++ b/test/commands/campaign-follow-ups.test.ts @@ -178,8 +178,7 @@ describe('campaign follow-up output (beta)', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/campaign-frequency-cap.test.ts b/test/commands/campaign-frequency-cap.test.ts index eef9d455..8453fab4 100644 --- a/test/commands/campaign-frequency-cap.test.ts +++ b/test/commands/campaign-frequency-cap.test.ts @@ -31,7 +31,7 @@ const settings = { function run(command: string) { return withEnvironment( { - POLYMORFA_API_KEY: `pmfa_${'A'.repeat(72)}`, + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server!.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/campaign-recipients.test.ts b/test/commands/campaign-recipients.test.ts index f8bcfe7a..0b1959b7 100644 --- a/test/commands/campaign-recipients.test.ts +++ b/test/commands/campaign-recipients.test.ts @@ -414,8 +414,7 @@ describe('Campaign recipient commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/campaign-segments-drip.test.ts b/test/commands/campaign-segments-drip.test.ts index 7ea0a588..05150bad 100644 --- a/test/commands/campaign-segments-drip.test.ts +++ b/test/commands/campaign-segments-drip.test.ts @@ -85,8 +85,7 @@ async function run(command: string) { if (!server) throw Error('No server') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/campaigns.test.ts b/test/commands/campaigns.test.ts index c8a91970..bfa69215 100644 --- a/test/commands/campaigns.test.ts +++ b/test/commands/campaigns.test.ts @@ -50,7 +50,7 @@ describe('Messaging campaign commands', () => { const input = await jsonInput('campaign.json', { name: 'September launch', recipientListId: 'recipients_1', - senderConfig: {session: 'session_1'}, + senderConfig: {connection: 'session_1'}, templateId: 'template_1', variableMapping: {firstName: {source: 'name', fallback: 'friend'}}, }) @@ -66,7 +66,7 @@ describe('Messaging campaign commands', () => { expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ name: 'September launch', recipientListId: 'recipients_1', - senderConfig: {session: 'session_1'}, + senderConfig: {connection: 'session_1'}, templateId: 'template_1', variableMapping: {firstName: {source: 'name', fallback: 'friend'}}, frequencyCap: {maxPer24Hours: 2, maxPer7Days: null}, @@ -341,8 +341,7 @@ describe('Messaging campaign commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -356,7 +355,7 @@ describe('Messaging campaign commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, run, ) diff --git a/test/commands/channels.test.ts b/test/commands/channels.test.ts index 3c1f5035..45f94418 100644 --- a/test/commands/channels.test.ts +++ b/test/commands/channels.test.ts @@ -15,14 +15,14 @@ describe('channel commands', () => { server = undefined }) - test('lists complete unpaged channels for an encoded session', async () => { + test('lists complete unpaged channels for an encoded connection', async () => { server = await startHttpServer({ body: {data: [channel()], success: true}, headers: {'request-id': 'req_channels'}, }) const result = await apiKeyEnvironment(() => - runCommand('channel list --session session/main --json'), + runCommand('channel list --connection connection/main --json'), ) expect(result.error).toBeUndefined() @@ -30,7 +30,9 @@ describe('channel commands', () => { data: [channel()], metadata: {attempts: 1, requestId: 'req_channels', status: 200}, }) - expect(server.requests[0]?.url).toBe('/messaging/session%2Fmain/channels') + expect(server.requests[0]?.url).toBe( + '/messaging/connection%2Fmain/channels', + ) }) test('renders optional channel metadata without assuming every field exists', async () => { @@ -39,7 +41,7 @@ describe('channel commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('channel view 760000000001 --session session_1'), + runCommand('channel view 760000000001 --connection session_1'), ) expect(result.error).toBeUndefined() @@ -56,7 +58,7 @@ describe('channel commands', () => { server = await startHttpServer({body: {data: [], success: true}}) const result = await clientTokenEnvironment(() => - runCommand('channel list --session session_1 --json'), + runCommand('channel list --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -69,7 +71,7 @@ describe('channel commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'channel create --session session_1 --name "Polymorfa updates" --description "Product news" --idempotency-key channel_create_1 --json', + 'channel create --connection session_1 --name "Polymorfa updates" --description "Product news" --idempotency-key channel_create_1 --json', ), ) @@ -92,7 +94,7 @@ describe('channel commands', () => { server = await startHttpServer({body: {success: true}}) const result = await apiKeyEnvironment(() => - runCommand('channel create --session session_1 --name "" --json'), + runCommand('channel create --connection session_1 --name "" --json'), ) expect(exitCode(result.error)).toBe(2) @@ -107,7 +109,7 @@ describe('channel commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'channel delete 760000000001 --session session_1 --yes --idempotency-key channel_delete_1 --json', + 'channel delete 760000000001 --connection session_1 --yes --idempotency-key channel_delete_1 --json', ), ) @@ -133,7 +135,7 @@ describe('channel commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'channel message list 760000000001 --session session/main --limit 25 --before 951 --json', + 'channel message list 760000000001 --connection connection/main --limit 25 --before 951 --json', ), ) @@ -147,7 +149,7 @@ describe('channel commands', () => { }, }) expect(server.requests[0]?.url).toBe( - '/messaging/session%2Fmain/channels/760000000001/messages?count=25&before=951', + '/messaging/connection%2Fmain/channels/760000000001/messages?count=25&before=951', ) }) @@ -159,7 +161,7 @@ describe('channel commands', () => { }) const result = await apiKeyEnvironment(() => runCommand( - `channel message ${command} 760000000001 --session session_1`, + `channel message ${command} 760000000001 --connection session_1`, ), ) expect(result.error).toBeUndefined() @@ -174,7 +176,7 @@ describe('channel commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'channel message updates 760000000001 --session session_1 --limit 10 --since 1787212800 --after 951 --json', + 'channel message updates 760000000001 --connection session_1 --limit 10 --since 1787212800 --after 951 --json', ), ) @@ -193,7 +195,7 @@ describe('channel commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'channel message list 760000000001 --session session_1 --limit 101 --json', + 'channel message list 760000000001 --connection session_1 --limit 101 --json', ), ) @@ -211,7 +213,7 @@ describe('channel commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'channel message mark-viewed 760000000001 951 --session session_1 --idempotency-key viewed_951 --json', + 'channel message mark-viewed 760000000001 951 --connection session_1 --idempotency-key viewed_951 --json', ), ) @@ -233,7 +235,7 @@ describe('channel commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'channel message mark-viewed 760000000001 0 --session session_1 --json', + 'channel message mark-viewed 760000000001 0 --connection session_1 --json', ), ) @@ -251,7 +253,7 @@ describe('channel commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'channel message react 760000000001 951 --session session_1 --reaction 👍 --idempotency-key reaction_951 --json', + 'channel message react 760000000001 951 --connection session_1 --reaction 👍 --idempotency-key reaction_951 --json', ), ) @@ -272,7 +274,7 @@ describe('channel commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `channel message react 760000000001 951 --session session_1 --reaction ${'👍'.repeat(9)} --json`, + `channel message react 760000000001 951 --connection session_1 --reaction ${'👍'.repeat(9)} --json`, ), ) @@ -291,7 +293,7 @@ describe('channel commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'channel live-updates subscribe 760000000001 --session session/main --idempotency-key live_1', + 'channel live-updates subscribe 760000000001 --connection connection/main --idempotency-key live_1', ), ) @@ -303,7 +305,7 @@ describe('channel commands', () => { expect(server.requests[0]).toMatchObject({ body: '', method: 'POST', - url: '/messaging/session%2Fmain/channels/760000000001/live-updates', + url: '/messaging/connection%2Fmain/channels/760000000001/live-updates', }) expect(server.requests[0]?.headers['idempotency-key']).toBe('live_1') }) @@ -322,7 +324,7 @@ describe('channel commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `channel ${action} 760000000001 --session session_1 --idempotency-key ${action}_1 --json`, + `channel ${action} 760000000001 --connection session_1 --idempotency-key ${action}_1 --json`, ), ) @@ -344,8 +346,7 @@ describe('channel commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -359,7 +360,7 @@ describe('channel commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, run, ) diff --git a/test/commands/cloud-group.test.ts b/test/commands/cloud-group.test.ts index d20b8e44..3a54d8a2 100644 --- a/test/commands/cloud-group.test.ts +++ b/test/commands/cloud-group.test.ts @@ -18,10 +18,12 @@ describe('Official group commands (beta)', () => { return withEnvironment( { POLYMORFA_API_KEY: - kind === 'api' ? `pmfa_${'A'.repeat(72)}` : undefined, + kind === 'api' ? 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' : undefined, POLYMORFA_PROJECT_TOKEN: undefined, POLYMORFA_CLIENT_TOKEN: - kind === 'client' ? `pmfa_ct_${'A'.repeat(94)}` : undefined, + kind === 'client' + ? `pmfa_ct_AAECAwQFBgcICQoLDA0ODxAREhM73f-k` + : undefined, POLYMORFA_BASE_URL: server.baseUrl, }, () => runCommand(command), @@ -33,73 +35,73 @@ describe('Official group commands (beta)', () => { const base = '/messaging/number%2Feu/official-groups' const cases: Array<[string, string, string, unknown?]> = [ [ - 'cloud group list --session number/eu --limit 10 --after QUZ', + 'cloud group list --connection number/eu --limit 10 --after QUZ', 'GET', `${base}?limit=10&after=QUZ`, ], [ - 'cloud group create --session number/eu --subject Orders --join-approval', + 'cloud group create --connection number/eu --subject Orders --join-approval', 'POST', base, {subject: 'Orders', joinApprovalRequired: true}, ], [ - 'cloud group get 739182640518203 --session number/eu', + 'cloud group get 739182640518203 --connection number/eu', 'GET', `${base}/739182640518203`, ], [ - 'cloud group update 739182640518203 --session number/eu --description Hi', + 'cloud group update 739182640518203 --connection number/eu --description Hi', 'PATCH', `${base}/739182640518203`, {description: 'Hi'}, ], [ - 'cloud group delete 739182640518203 --session number/eu --yes', + 'cloud group delete 739182640518203 --connection number/eu --yes', 'DELETE', `${base}/739182640518203`, ], [ - 'cloud group invite-link 739182640518203 --session number/eu', + 'cloud group invite-link 739182640518203 --connection number/eu', 'GET', `${base}/739182640518203/invite-link`, ], [ - 'cloud group invite-link 739182640518203 --session number/eu --reset', + 'cloud group invite-link 739182640518203 --connection number/eu --reset', 'POST', `${base}/739182640518203/invite-link/reset`, ], [ - 'cloud group remove-participants 739182640518203 --session number/eu --participant +15550001111 --participant 123', + 'cloud group remove-participants 739182640518203 --connection number/eu --participant +15550001111 --participant 123', 'POST', `${base}/739182640518203/participants/remove`, {participants: ['+15550001111', '123']}, ], [ - 'cloud group join-requests list 739182640518203 --session number/eu', + 'cloud group join-requests list 739182640518203 --connection number/eu', 'GET', `${base}/739182640518203/join-requests`, ], [ - 'cloud group join-requests approve 739182640518203 --session number/eu --request MTY0', + 'cloud group join-requests approve 739182640518203 --connection number/eu --request MTY0', 'POST', `${base}/739182640518203/join-requests/approve`, {joinRequestIds: ['MTY0']}, ], [ - 'cloud group join-requests reject 739182640518203 --session number/eu --request MTY0', + 'cloud group join-requests reject 739182640518203 --connection number/eu --request MTY0', 'POST', `${base}/739182640518203/join-requests/reject`, {joinRequestIds: ['MTY0']}, ], [ - 'cloud group pin 739182640518203 --session number/eu --message 42 --days 7', + 'cloud group pin 739182640518203 --connection number/eu --message 42 --days 7', 'POST', `${base}/739182640518203/pins`, {operation: 'pin', messageId: '42', expirationDays: 7}, ], [ - 'cloud group pin 739182640518203 --session number/eu --message 42 --unpin', + 'cloud group pin 739182640518203 --connection number/eu --message 42 --unpin', 'POST', `${base}/739182640518203/pins`, {operation: 'unpin', messageId: '42'}, @@ -130,7 +132,7 @@ describe('Official group commands (beta)', () => { }, }) const result = await run( - 'cloud group create --session number --subject Orders --idempotency-key grp-1 --json', + 'cloud group create --connection number --subject Orders --idempotency-key grp-1 --json', ) expect(result.error).toBeDefined() expect(server.requests).toHaveLength(1) @@ -143,14 +145,14 @@ describe('Official group commands (beta)', () => { test('refuses invalid local input and client tokens before any request', async () => { server = await startHttpServer({body: {success: true, data: {}}}) for (const command of [ - 'cloud group update 1 --session number', - 'cloud group pin 1 --session number --message 42', - 'cloud group invite-link 1 --session number --idempotency-key k', + 'cloud group update 1 --connection number', + 'cloud group pin 1 --connection number --message 42', + 'cloud group invite-link 1 --connection number --idempotency-key k', ]) { expect((await run(command)).error, command).toBeDefined() } expect( - (await run('cloud group list --session number', 'client')).error, + (await run('cloud group list --connection number', 'client')).error, ).toBeDefined() expect(server.requests).toHaveLength(0) }) diff --git a/test/commands/cloud.test.ts b/test/commands/cloud.test.ts index bf7477fd..210d58f0 100644 --- a/test/commands/cloud.test.ts +++ b/test/commands/cloud.test.ts @@ -31,7 +31,7 @@ describe('Official API commands', () => { ] server = await startHttpServer({body: {success: true, data}}) const result = await credential(() => - runCommand('cloud template list --session number/eu --json'), + runCommand('cloud template list --connection number/eu --json'), ) expect(result.error).toBeUndefined() expect((JSON.parse(result.stdout) as {data: unknown}).data).toEqual(data) @@ -44,7 +44,7 @@ describe('Official API commands', () => { }) const result = await credential(() => runCommand( - 'cloud template get order/update --session number/eu --language pt_BR --json', + 'cloud template get order/update --connection number/eu --language pt_BR --json', ), ) expect(result.error).toBeUndefined() @@ -74,7 +74,7 @@ describe('Official API commands', () => { }) const result = await credential(() => runCommand( - `cloud template create --session number --input ${path} --idempotency-key tpl-1 --json`, + `cloud template create --connection number --input ${path} --idempotency-key tpl-1 --json`, ), ) expect(exitCode(result.error)).toBe(5) @@ -113,7 +113,7 @@ describe('Official API commands', () => { ) const keyring = vi .spyOn(AsyncEntry.prototype, 'getPassword') - .mockResolvedValue(`pmfa_pt_${'A'.repeat(94)}`) + .mockResolvedValue('pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k') server = await startHttpServer({ status: 202, body: {success: true, data: {accepted: true}}, @@ -131,7 +131,7 @@ describe('Official API commands', () => { }, () => runCommand( - 'template submit template_123 --project-slug support --session number_123 --yes --json', + 'template submit template_123 --project-slug support --connection number_123 --yes --json', ), ) expect(result.error, result.stderr).toBeUndefined() @@ -161,7 +161,7 @@ describe('Official API commands', () => { }) const result = await credential(() => runCommand( - `cloud template edit order/update --session number --language pt_BR --input ${path} --json`, + `cloud template edit order/update --connection number --language pt_BR --input ${path} --json`, ), ) expect(result.error).toBeUndefined() @@ -183,7 +183,7 @@ describe('Official API commands', () => { server = await startHttpServer({body: {success: true}}) const result = await credential(() => runCommand( - `cloud template edit order --session number --input ${path} --json`, + `cloud template edit order --connection number --input ${path} --json`, ), ) expect(exitCode(result.error)).toBe(2) @@ -197,7 +197,7 @@ describe('Official API commands', () => { data: { id: 'ql_1', status: 'connected', - session: 'number', + connection: 'number', purpose: 'reauthorization', onboarding: { sync: { @@ -235,7 +235,7 @@ describe('Official API commands', () => { }) const result = await credential(() => runCommand( - 'message typing --session number --chat 730000000001 --id 740000000001 --state typing --json', + 'message typing --connection number --chat 730000000001 --id 740000000001 --state typing --json', ), ) expect(result.error).toBeUndefined() @@ -253,13 +253,15 @@ describe('Official API commands', () => { test('requires deletion confirmation before any request', async () => { server = await startHttpServer({body: {success: true}}) const refused = await credential(() => - runCommand('cloud template delete order_update --session number --json'), + runCommand( + 'cloud template delete order_update --connection number --json', + ), ) expect(refused.error).toBeDefined() expect(server.requests).toHaveLength(0) const confirmed = await credential(() => runCommand( - 'cloud template delete order_update --session number --yes --json', + 'cloud template delete order_update --connection number --yes --json', ), ) expect(confirmed.error).toBeUndefined() @@ -282,7 +284,7 @@ describe('Official API commands', () => { const result = await credential( () => runCommand( - 'cloud service-window +5511999999999 --session number --json', + 'cloud service-window +5511999999999 --connection number --json', ), 'project', ) @@ -310,7 +312,7 @@ describe('Official API commands', () => { server = await startHttpServer({body: {success: true, data}}) const result = await credential(() => runCommand( - 'cloud pricing --session number --since 2026-09-01T00:00:00Z --until 2026-09-26T00:00:00Z --json', + 'cloud pricing --connection number --since 2026-09-01T00:00:00Z --until 2026-09-26T00:00:00Z --json', ), ) expect(result.error).toBeUndefined() @@ -328,7 +330,7 @@ describe('Official API commands', () => { }, }) const result = await credential(() => - runCommand('cloud credentials get --session number --json'), + runCommand('cloud credentials get --connection number --json'), ) expect(result.error).toBeUndefined() expect(server.requests).toHaveLength(1) @@ -338,13 +340,13 @@ describe('Official API commands', () => { }) }) - test('does not retry an uncertain reauthorization or stop the Number', async () => { + test('does not retry an uncertain reauthorization or stop the Connection', async () => { server = await startHttpServer({ status: 502, body: {error: {code: 'upstream_failure', message: 'Unknown'}}, }) const result = await credential(() => - runCommand('cloud credentials reauthorize --session number --json'), + runCommand('cloud credentials reauthorize --connection number --json'), ) expect(exitCode(result.error)).toBe(5) expect(server.requests).toHaveLength(1) @@ -357,7 +359,7 @@ describe('Official API commands', () => { test('rejects client tokens before request dispatch', async () => { server = await startHttpServer({body: {success: true, data: {}}}) const result = await credential( - () => runCommand('cloud credentials get --session number --json'), + () => runCommand('cloud credentials get --connection number --json'), 'client', ) expect(exitCode(result.error)).toBe(2) @@ -384,7 +386,7 @@ describe('Official API commands', () => { }, }) const result = await credential(() => - runCommand('cloud credentials reauthorize --session number --json'), + runCommand('cloud credentials reauthorize --connection number --json'), ) expect(exitCode(result.error)).toBe(expected) expect(result.stdout).not.toContain('"success":true') @@ -466,11 +468,15 @@ describe('Official API commands', () => { return withEnvironment( { POLYMORFA_API_KEY: - kind === 'api' ? `pmfa_${'A'.repeat(72)}` : undefined, + kind === 'api' ? 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' : undefined, POLYMORFA_PROJECT_TOKEN: - kind === 'project' ? `pmfa_pt_${'A'.repeat(94)}` : undefined, + kind === 'project' + ? 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' + : undefined, POLYMORFA_CLIENT_TOKEN: - kind === 'client' ? `pmfa_ct_${'A'.repeat(94)}` : undefined, + kind === 'client' + ? `pmfa_ct_AAECAwQFBgcICQoLDA0ODxAREhM73f-k` + : undefined, POLYMORFA_BASE_URL: server.baseUrl, }, run, diff --git a/test/commands/number-tiers.test.ts b/test/commands/connection-tiers.test.ts similarity index 78% rename from test/commands/number-tiers.test.ts rename to test/commands/connection-tiers.test.ts index d16b61a8..5ac1dbc0 100644 --- a/test/commands/number-tiers.test.ts +++ b/test/commands/connection-tiers.test.ts @@ -36,7 +36,7 @@ function tierChange( } } -describe('session tier commands', () => { +describe('connection tier commands', () => { let server: TestHttpServer | undefined afterEach(async () => { @@ -55,19 +55,19 @@ describe('session tier commands', () => { }, ], [ - '--tier standard --split --stay official_api --new-number-name support-linked', + '--tier standard --split --stay official_api --new-connection-name support-linked', { tierOverride: 'standard', hybridResolution: { action: 'split', - existingNumberTransport: 'official_api', - newNumberName: 'support-linked', + existingConnectionTransport: 'official_api', + newConnectionName: 'support-linked', }, }, ], [ `--tier pro --merge-with ${ABSORBED}`, - {tierOverride: 'pro', hybridMerge: {absorbNumberId: ABSORBED}}, + {tierOverride: 'pro', hybridMerge: {absorbConnectionId: ABSORBED}}, ], [ `--tier free --keep official_api --project ${PROJECT}`, @@ -80,12 +80,12 @@ describe('session tier commands', () => { ])('quote %s sends the exact request body', async (flags, body) => { server = await startHttpSequenceServer([{body: {data: tierChange()}}]) const result = await platform(() => - runCommand(`session tier quote ${SURVIVOR} ${flags} --json`), + runCommand(`connection tier quote ${SURVIVOR} ${flags} --json`), ) expect(result.stderr).toBe('') expect(result.error).toBeUndefined() expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ - `POST /platform/sessions/${SURVIVOR}/tier-quotes`, + `POST /platform/connections/${SURVIVOR}/tier-quotes`, ]) expect(JSON.parse(server.requests[0]!.body)).toEqual(body) expect(JSON.parse(result.stdout)).toMatchObject({data: {id: QUOTE}}) @@ -103,21 +103,21 @@ describe('session tier commands', () => { ['--tier standard --split', '--split needs --stay'], ['--tier standard --split --stay official_api', '--split needs --stay'], [ - '--tier standard --split --stay official_api --new-number-name -bad', - '--new-number-name must be 1-64 characters', + '--tier standard --split --stay official_api --new-connection-name -bad', + '--new-connection-name must be 1-64 characters', ], ['--tier standard --stay official_api', 'used only with --split'], [ - '--tier standard --keep linked_devices --new-number-name x', + '--tier standard --keep linked_devices --new-connection-name x', 'used only with --split', ], [`--tier standard --merge-with ${ABSORBED}`, 'needs --tier pro'], - ['--tier pro --merge-with support', 'Number UUID'], + ['--tier pro --merge-with support', 'Connection UUID'], ['--tier standard --keep both', 'Expected --keep=both to be one of'], ])('quote %s fails before sending', async (flags, message) => { server = await startHttpSequenceServer([{body: {data: tierChange()}}]) const result = await platform(() => - runCommand(`session tier quote ${SURVIVOR} ${flags}`), + runCommand(`connection tier quote ${SURVIVOR} ${flags}`), ) expect(exitCode(result.error)).toBe(2) expect(result.stderr).toContain(message) @@ -130,9 +130,9 @@ describe('session tier commands', () => { body: { data: tierChange({ action: 'split', - existingNumberTransport: 'official_api', - newNumberName: 'support-linked', - survivingNumberId: SURVIVOR, + existingConnectionTransport: 'official_api', + newConnectionName: 'support-linked', + survivingConnectionId: SURVIVOR, effectiveAtMs: 1_800_000_000_000, }), }, @@ -140,16 +140,16 @@ describe('session tier commands', () => { ]) const result = await platform(() => runCommand( - `session tier quote support --tier standard --split --stay official_api --new-number-name support-linked`, + `connection tier quote support --tier standard --split --stay official_api --new-connection-name support-linked`, ), ) expect(result.error).toBeUndefined() expect(result.stdout).toContain( - `Hybrid Link: split: official_api stays on ${SURVIVOR}; the other connection moves to new Number "support-linked"`, + `Hybrid Link: split: official_api stays on ${SURVIVOR}; the other method moves to new Connection "support-linked"`, ) expect(result.stdout).toContain('Hybrid Link status: not confirmed') expect(result.stdout).toContain( - `polymorfa session tier confirm support --quote ${QUOTE} --yes`, + `polymorfa connection tier confirm support --quote ${QUOTE} --yes`, ) }) @@ -157,20 +157,20 @@ describe('session tier commands', () => { server = await startHttpSequenceServer([ conflict( 'hybrid_choice_required', - 'choose which Hybrid Link connection to keep, or split the Number, before leaving Pro', + 'choose which Hybrid Link connection to keep, or split the Connection, before leaving Pro', ), ]) const human = await platform(() => - runCommand(`session tier quote support --tier standard`), + runCommand(`connection tier quote support --tier standard`), ) expect(exitCode(human.error)).toBe(4) expect(human.stderr).toContain( - 'Choose --keep linked_devices|official_api, or --split --stay linked_devices|official_api --new-number-name NAME, and quote again.', + 'Choose --keep linked_devices|official_api, or --split --stay linked_devices|official_api --new-connection-name NAME, and quote again.', ) expect(human.stderr).toContain('Request ID: req_hybrid') const json = await platform(() => - runCommand(`session tier quote support --tier inherit --json`), + runCommand(`connection tier quote support --tier inherit --json`), ) expect(exitCode(json.error)).toBe(4) expect(JSON.parse(json.stderr)).toMatchObject({ @@ -192,7 +192,7 @@ describe('session tier commands', () => { ]) const result = await platform(() => runCommand( - `session tier quote ${SURVIVOR} --tier pro --merge-with ${ABSORBED} --json`, + `connection tier quote ${SURVIVOR} --tier pro --merge-with ${ABSORBED} --json`, ), ) expect(exitCode(result.error)).toBe(4) @@ -212,7 +212,7 @@ describe('session tier commands', () => { { action: 'keep', keepTransport: 'linked_devices', - survivingNumberId: SURVIVOR, + survivingConnectionId: SURVIVOR, status: 'scheduled', failureReason: null, metaDisconnectRequired: false, @@ -224,7 +224,7 @@ describe('session tier commands', () => { }, ]) const refused = await platform(() => - runCommand(`session tier confirm support --quote ${QUOTE}`), + runCommand(`connection tier confirm support --quote ${QUOTE}`), ) expect(exitCode(refused.error)).toBe(2) expect(refused.stderr).toContain('Missing required flag yes') @@ -232,12 +232,12 @@ describe('session tier commands', () => { const confirmed = await platform(() => runCommand( - `session tier confirm support --quote ${QUOTE} --yes --idempotency-key confirm-1`, + `connection tier confirm support --quote ${QUOTE} --yes --idempotency-key confirm-1`, ), ) expect(confirmed.error).toBeUndefined() expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ - 'PATCH /platform/sessions/support', + 'PATCH /platform/connections/support', ]) expect(JSON.parse(server.requests[0]!.body)).toEqual({quoteId: QUOTE}) expect(server.requests[0]!.headers['idempotency-key']).toBe('confirm-1') @@ -246,21 +246,21 @@ describe('session tier commands', () => { ) expect(confirmed.stdout).toContain('Hybrid Link status: scheduled') expect(confirmed.stdout).toContain( - `polymorfa session tier status support ${QUOTE}`, + `polymorfa connection tier status support ${QUOTE}`, ) }) - test('status shows a completed split, the new Number and the disconnect instruction', async () => { + test('status shows a completed split, the new Connection and the disconnect instruction', async () => { server = await startHttpSequenceServer([ { body: { data: tierChange( { action: 'split', - existingNumberTransport: 'linked_devices', - newNumberName: 'support-cloud', - survivingNumberId: SURVIVOR, - newNumberId: CREATED, + existingConnectionTransport: 'linked_devices', + newConnectionName: 'support-cloud', + survivingConnectionId: SURVIVOR, + newConnectionId: CREATED, status: 'completed', failureReason: null, metaDisconnectRequired: true, @@ -272,11 +272,11 @@ describe('session tier commands', () => { }, ]) const result = await platform(() => - runCommand(`session tier status support ${QUOTE}`), + runCommand(`connection tier status support ${QUOTE}`), ) expect(result.error).toBeUndefined() expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ - `GET /platform/sessions/support/tier-quotes/${QUOTE}`, + `GET /platform/connections/support/tier-quotes/${QUOTE}`, ]) expect(result.stdout).toContain(`Tier change ${QUOTE}: applied`) expect(result.stdout).toContain(`(${CREATED})`) @@ -293,7 +293,7 @@ describe('session tier commands', () => { } server = await startHttpSequenceServer([{body: {data: rejected}}]) const human = await platform(() => - runCommand(`session tier status support ${QUOTE}`), + runCommand(`connection tier status support ${QUOTE}`), ) expect(human.error).toBeUndefined() expect(human.stdout).toContain( @@ -308,8 +308,8 @@ describe('session tier commands', () => { const failed = tierChange( { action: 'merge', - absorbNumberId: ABSORBED, - survivingNumberId: SURVIVOR, + absorbConnectionId: ABSORBED, + survivingConnectionId: SURVIVOR, status: 'failed', failureReason: 'hybrid_transition.runtime_unconfirmed', metaDisconnectRequired: false, @@ -319,14 +319,14 @@ describe('session tier commands', () => { ) server = await startHttpSequenceServer([{body: {data: failed}}]) const human = await platform(() => - runCommand(`session tier status support ${QUOTE}`), + runCommand(`connection tier status support ${QUOTE}`), ) expect(human.stdout).toContain(`merge ${ABSORBED} into ${SURVIVOR}`) expect(human.stdout).toContain( 'Hybrid Link status: failed (hybrid_transition.runtime_unconfirmed)', ) const json = await platform(() => - runCommand(`session tier status support ${QUOTE} --json`), + runCommand(`connection tier status support ${QUOTE} --json`), ) expect(JSON.parse(json.stdout)).toMatchObject({data: failed}) }) @@ -334,7 +334,7 @@ describe('session tier commands', () => { test('lists merge candidates for an explicit project', async () => { const candidates = [ { - numbers: [ + connections: [ { id: SURVIVOR, name: 'support', @@ -353,7 +353,7 @@ describe('session tier commands', () => { eligible: true, }, { - numbers: [ + connections: [ { id: CREATED, name: 'sales', @@ -375,33 +375,35 @@ describe('session tier commands', () => { ] server = await startHttpSequenceServer([{body: {data: candidates}}]) const missing = await platform(() => - runCommand('session hybrid-merge-candidates'), + runCommand('connection hybrid-merge-candidates'), ) expect(exitCode(missing.error)).toBe(2) expect(missing.stderr).toContain('Provide --project') expect(server.requests).toHaveLength(0) const human = await platform(() => - runCommand(`session hybrid-merge-candidates --project ${PROJECT}`), + runCommand(`connection hybrid-merge-candidates --project ${PROJECT}`), ) expect(human.error).toBeUndefined() expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ `GET /platform/projects/${PROJECT}/hybrid-merge-candidates`, ]) expect(human.stdout).toContain( - `${SURVIVOR} (support, linked_devices, connected, must be kept)\t${ABSORBED} (support-cloud, official_api, connected, can be absorbed)\teligible\tmerge with: session tier quote ${SURVIVOR} --tier pro --merge-with ${ABSORBED}`, + `${SURVIVOR} (support, linked_devices, connected, must be kept)\t${ABSORBED} (support-cloud, official_api, connected, can be absorbed)\teligible\tmerge with: connection tier quote ${SURVIVOR} --tier pro --merge-with ${ABSORBED}`, ) expect(human.stdout).toContain( - 'ineligible: pairing_in_progress (a Number is still pairing)', + 'ineligible: pairing_in_progress (a Connection is still pairing)', ) const json = await platform(() => - runCommand(`session hybrid-merge-candidates --project ${PROJECT} --json`), + runCommand( + `connection hybrid-merge-candidates --project ${PROJECT} --json`, + ), ) expect(JSON.parse(json.stdout)).toMatchObject({data: candidates}) }) - test('explains a merge that would absorb a hosted-storage Number', async () => { + test('explains a merge that would absorb a hosted-storage Connection', async () => { server = await startHttpSequenceServer([ conflict( 'hybrid_transition_ineligible', @@ -410,12 +412,12 @@ describe('session tier commands', () => { ]) const result = await platform(() => runCommand( - `session tier quote ${SURVIVOR} --tier pro --merge-with ${ABSORBED}`, + `connection tier quote ${SURVIVOR} --tier pro --merge-with ${ABSORBED}`, ), ) expect(exitCode(result.error)).toBe(4) expect(result.stderr).toContain( - 'A Number with hosted message storage must be kept: quote the merge on it and pass the other Number to --merge-with.', + 'A Connection with hosted message storage must be kept: quote the merge on it and pass the other Connection to --merge-with.', ) }) @@ -438,7 +440,9 @@ describe('session tier commands', () => { }, ]) const result = await platform(() => - runCommand(`session hybrid-merge-candidates --project ${PROJECT} --json`), + runCommand( + `connection hybrid-merge-candidates --project ${PROJECT} --json`, + ), ) expect(exitCode(result.error)).toBe(3) expect(JSON.parse(result.stderr)).toMatchObject({ @@ -451,8 +455,7 @@ describe('session tier commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_PROJECT_TOKEN: undefined, diff --git a/test/commands/contacts.test.ts b/test/commands/contacts.test.ts index f11f19be..46495ef8 100644 --- a/test/commands/contacts.test.ts +++ b/test/commands/contacts.test.ts @@ -15,14 +15,14 @@ describe('contact commands', () => { server = undefined }) - test('lists complete unpaged session contacts as JSON', async () => { + test('lists complete unpaged connection contacts as JSON', async () => { server = await startHttpServer({ body: {data: [contact()], success: true}, headers: {'request-id': 'req_contacts'}, }) const result = await apiKeyEnvironment(() => - runCommand('contact list --session session/main --json'), + runCommand('contact list --connection connection/main --json'), ) expect(result.error).toBeUndefined() @@ -30,7 +30,9 @@ describe('contact commands', () => { data: [contact()], metadata: {attempts: 1, requestId: 'req_contacts', status: 200}, }) - expect(server.requests[0]?.url).toBe('/messaging/session%2Fmain/contacts') + expect(server.requests[0]?.url).toBe( + '/messaging/connection%2Fmain/contacts', + ) }) test('checks multiple phone numbers in one exact registration query', async () => { @@ -46,7 +48,7 @@ describe('contact commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'contact check --session session_1 --phone +15551234567 --phone +15557654321 --json', + 'contact check --connection session_1 --phone +15551234567 --phone +15557654321 --json', ), ) @@ -63,7 +65,7 @@ describe('contact commands', () => { server = await startHttpServer({body: {data: [], success: true}}) const result = await clientTokenEnvironment(() => - runCommand('contact list --session session_1 --json'), + runCommand('contact list --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -71,11 +73,11 @@ describe('contact commands', () => { expect(server.requests).toHaveLength(0) }) - test('views one stored session contact through an encoded LID', async () => { + test('views one stored connection contact through an encoded LID', async () => { server = await startHttpServer({body: {data: contact(), success: true}}) const result = await apiKeyEnvironment(() => - runCommand('contact view 750000000001 --session session/main'), + runCommand('contact view 750000000001 --connection connection/main'), ) expect(result.error).toBeUndefined() @@ -83,7 +85,7 @@ describe('contact commands', () => { expect(result.stdout).toContain('ID\t750000000001') expect(result.stdout).toContain('Phone\t+15551234567') expect(server.requests[0]?.url).toBe( - '/messaging/session%2Fmain/contacts/750000000001', + '/messaging/connection%2Fmain/contacts/750000000001', ) }) @@ -93,7 +95,7 @@ describe('contact commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('contact picture 750000000001 --session session_1'), + runCommand('contact picture 750000000001 --connection session_1'), ) expect(result.error).toBeUndefined() @@ -110,7 +112,7 @@ describe('contact commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('contact info 750000000001 --session session_1 --json'), + runCommand('contact info 750000000001 --connection session_1 --json'), ) expect(result.error).toBeUndefined() @@ -132,7 +134,7 @@ describe('contact commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('contact devices 750000000001 --session session_1'), + runCommand('contact devices 750000000001 --connection session_1'), ) expect(result.error).toBeUndefined() @@ -150,7 +152,9 @@ describe('contact commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('contact business-profile 750000000001 --session session_1'), + runCommand( + 'contact business-profile 750000000001 --connection session_1', + ), ) expect(result.error).toBeUndefined() @@ -177,7 +181,7 @@ describe('contact commands', () => { server = await startHttpServer({body: {success: true, data: profile}}) const result = await apiKeyEnvironment(() => runCommand( - 'contact business-profile 750000000001 --session session_1 --json', + 'contact business-profile 750000000001 --connection session_1 --json', ), ) expect(result.error, result.stderr).toBeUndefined() @@ -185,7 +189,9 @@ describe('contact commands', () => { data: profile, }) const plain = await apiKeyEnvironment(() => - runCommand('contact business-profile 750000000001 --session session_1'), + runCommand( + 'contact business-profile 750000000001 --connection session_1', + ), ) expect(plain.error, plain.stderr).toBeUndefined() if (encryption === undefined) @@ -203,7 +209,7 @@ describe('contact commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('contact blocklist --session session_1 --json'), + runCommand('contact blocklist --connection session_1 --json'), ) expect(result.error).toBeUndefined() @@ -225,7 +231,7 @@ describe('contact commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `contact ${action} 750000000001 --session session/main --idempotency-key ${action}_alice --json`, + `contact ${action} 750000000001 --connection connection/main --idempotency-key ${action}_alice --json`, ), ) @@ -237,7 +243,7 @@ describe('contact commands', () => { expect(server.requests[0]).toMatchObject({ body: '', method: 'POST', - url: `/messaging/session%2Fmain/contacts/750000000001/${action}`, + url: `/messaging/connection%2Fmain/contacts/750000000001/${action}`, }) expect(server.requests[0]?.headers['idempotency-key']).toBe( `${action}_alice`, @@ -249,8 +255,7 @@ describe('contact commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -264,7 +269,7 @@ describe('contact commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, run, ) diff --git a/test/commands/customers.test.ts b/test/commands/customers.test.ts index 682a6272..30ac22cb 100644 --- a/test/commands/customers.test.ts +++ b/test/commands/customers.test.ts @@ -35,7 +35,7 @@ describe('Customer commands', () => { enabled: true, enabledAt: 1_725_000_000_000, enabledBy: 'user_1', - migratedNumberCount: 2, + migratedConnectionCount: 2, }, }, }, @@ -69,13 +69,13 @@ describe('Customer commands', () => { const result = await environment(() => runCommand( - 'customer list --project project/1 --cursor cursor/1 --limit 20 --search Ada --status active --default false --has-numbers true --needs-attention false --json', + 'customer list --project project/1 --cursor cursor/1 --limit 20 --search Ada --status active --default false --has-connections true --needs-attention false --json', ), ) expect(result.error).toBeUndefined() expect(server.requests[0]?.url).toBe( - '/platform/customers?projectId=project%2F1&cursor=cursor%2F1&limit=20&search=Ada&status=active&isDefault=false&hasNumbers=true&needsAttention=false', + '/platform/customers?projectId=project%2F1&cursor=cursor%2F1&limit=20&search=Ada&status=active&isDefault=false&hasConnections=true&needsAttention=false', ) expect(JSON.parse(result.stdout)).toEqual({ data: { @@ -83,7 +83,7 @@ describe('Customer commands', () => { { activePairingLinkState: 'active', archivedAt: null, - connectedNumberCount: 1, + connectedConnectionCount: 1, createdAt: 1_725_000_000_000, externalCustomerId: 'crm/1', id: 'customer/1', @@ -91,7 +91,7 @@ describe('Customer commands', () => { lastActivityAt: 1_725_000_000_000, name: 'Ada', needsAttention: false, - numberCount: 1, + connectionCount: 1, orgId: 'org_1', projectId: 'project/1', status: 'active', @@ -173,15 +173,17 @@ describe('Customer commands', () => { ).toEqual(['archive_1', 'restore_1']) }) - test('lists Customer Numbers, events, and pairing links', async () => { + test('lists Customer Connections, events, and pairing links', async () => { server = await startHttpSequenceServer([ {body: {data: [number()]}}, {body: {data: [event()]}}, {body: {data: [pairingLink()]}}, ]) - const numbers = await environment(() => - runCommand('customer number list customer/1 --project project/1 --json'), + const connections = await environment(() => + runCommand( + 'customer connection list customer/1 --project project/1 --json', + ), ) const events = await environment(() => runCommand( @@ -194,17 +196,17 @@ describe('Customer commands', () => { ), ) - expect(numbers.error).toBeUndefined() + expect(connections.error).toBeUndefined() expect(events.error).toBeUndefined() expect(links.error).toBeUndefined() expect(server.requests.map(({url}) => url)).toEqual([ - '/platform/customers/customer%2F1/numbers?projectId=project%2F1', + '/platform/customers/customer%2F1/connections?projectId=project%2F1', '/platform/customers/customer%2F1/events?projectId=project%2F1&limit=25', '/platform/customers/customer%2F1/pairing-links?projectId=project%2F1', ]) }) - test('creates and revokes a pairing link, then transfers a Number', async () => { + test('creates and revokes a pairing link, then transfers a Connection', async () => { server = await startHttpSequenceServer([ {body: {data: {...pairingLink(), url: 'https://pair.example/link'}}}, {body: {data: {...pairingLink(), status: 'revoked'}}}, @@ -223,7 +225,7 @@ describe('Customer commands', () => { ) const transferred = await environment(() => runCommand( - 'customer number transfer customer/1 session/1 --from customer/source --project project/1 --yes --idempotency-key transfer_1 --json', + 'customer connection transfer customer/1 connection/1 --from customer/source --project project/1 --yes --idempotency-key transfer_1 --json', ), ) @@ -233,7 +235,7 @@ describe('Customer commands', () => { expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ 'POST /platform/customers/customer%2F1/pairing-links', 'DELETE /platform/customers/customer%2F1/pairing-links/link%2F1?projectId=project%2F1', - 'POST /platform/customers/customer%2F1/numbers/session%2F1/transfer', + 'POST /platform/customers/customer%2F1/connections/connection%2F1/transfer', ]) expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ expectedPhone: '+15551234567', @@ -302,8 +304,7 @@ describe('Customer commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -331,10 +332,10 @@ function customerSummary() { return { ...customer(), activePairingLinkState: 'active', - connectedNumberCount: 1, + connectedConnectionCount: 1, lastActivityAt: 1_725_000_000_000, needsAttention: false, - numberCount: 1, + connectionCount: 1, } } @@ -346,7 +347,7 @@ function number() { id: 'number_1', name: 'Support', phoneMasked: '+1•••4567', - sessionId: 'session/1', + connectionId: 'connection/1', status: 'connected', } } @@ -359,7 +360,7 @@ function event() { metadata: {fields: ['name']}, occurredAt: 1_725_000_000_000, pairingLinkId: null, - sessionId: null, + connectionId: null, toStatus: 'active', } } @@ -384,7 +385,7 @@ function pairingLink() { methods: ['qr', 'phone'], openedAt: null, orgId: 'org_1', - pendingSessionId: null, + pendingConnectionId: null, phoneMismatchCount: 0, projectId: 'project/1', reservedAt: null, diff --git a/test/commands/developer-webhooks.test.ts b/test/commands/developer-webhooks.test.ts index b79c1e4c..1e602861 100644 --- a/test/commands/developer-webhooks.test.ts +++ b/test/commands/developer-webhooks.test.ts @@ -376,7 +376,7 @@ describe('developer webhook commands', () => { await writeFile( input, JSON.stringify({ - eventTypes: ['session.phone_offline'], + eventTypes: ['connection.phone_offline'], url: 'https://example.test/hook', }), ) @@ -399,7 +399,7 @@ describe('developer webhook commands', () => { ]), ) expect(findCall('webhooks.create').args[0]).toEqual({ - eventTypes: ['session.phone_offline'], + eventTypes: ['connection.phone_offline'], phoneOfflineStartDay: 8, url: 'https://example.test/hook', }) @@ -426,7 +426,7 @@ describe('developer webhook commands', () => { }) test('turns warnings off by removing the event from the saved event types', async () => { - state.savedEventTypes = ['message.received', 'session.phone_offline'] + state.savedEventTypes = ['message.received', 'connection.phone_offline'] stdout() await developerEnvironment(() => WebhookUpdate.run([ @@ -448,7 +448,7 @@ describe('developer webhook commands', () => { }) test('refuses off when it would leave no events', async () => { - state.savedEventTypes = ['session.phone_offline'] + state.savedEventTypes = ['connection.phone_offline'] const stderr = vi .spyOn(process.stderr, 'write') .mockImplementation(() => true) @@ -550,7 +550,7 @@ describe('developer webhook commands', () => { contentType: 'application/json', data: 'e30=', }, - sessionId: 'session_1', + connectionId: 'session_1', }), ) vi.spyOn(process.stderr, 'write').mockImplementation(() => true) @@ -574,7 +574,7 @@ describe('developer webhook commands', () => { ) }) - test('requires a project session ID with a supplied test body', async () => { + test('requires a project connection ID with a supplied test body', async () => { const directory = await mkdtemp(join(tmpdir(), 'polymorfa-command-')) directories.push(directory) const input = join(directory, 'test.json') @@ -606,7 +606,7 @@ describe('developer webhook commands', () => { false, ) - await writeFile(input, JSON.stringify({body, sessionId: 'session_1'})) + await writeFile(input, JSON.stringify({body, connectionId: 'session_1'})) stdout() await developerEnvironment(() => WebhookTest.run([ @@ -625,7 +625,7 @@ describe('developer webhook commands', () => { expect(findCall('webhooks.test').args[1]).toEqual({ body, eventType: 'message.received', - sessionId: 'session_1', + connectionId: 'session_1', }) }) @@ -881,8 +881,7 @@ function findCall(method: string) { function developerEnvironment<T>(run: () => Promise<T>): Promise<T> { return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: 'https://api.example.test', POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_PROJECT_TOKEN: undefined, diff --git a/test/commands/doctor.test.ts b/test/commands/doctor.test.ts index 5a005d20..70d5a08f 100644 --- a/test/commands/doctor.test.ts +++ b/test/commands/doctor.test.ts @@ -18,8 +18,7 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' describe('doctor command exit status', () => { let server: TestHttpServer diff --git a/test/commands/event-stream.test.ts b/test/commands/event-stream.test.ts index 26f215fc..a01857e1 100644 --- a/test/commands/event-stream.test.ts +++ b/test/commands/event-stream.test.ts @@ -70,14 +70,14 @@ describe('event stream', () => { '--type', 'message.*', '--type', - 'session.connected', + 'connection.connected', '--from', 'c0', '--json', ]), ) expect(sdk.params[0]).toMatchObject({ - types: ['message.*', 'session.connected'], + types: ['message.*', 'connection.connected'], since: 'c0', }) const lines = output.mock.calls.map( @@ -239,7 +239,7 @@ function item(id: string, cursor: string, withBody = true) { webhook: withBody ? { id, - session: 'support', + connection: 'support', timestamp: '2026-09-18T10:00:00.000Z', event: 'message.received', payload: {text: 'hi'}, @@ -251,8 +251,7 @@ function item(id: string, cursor: string, withBody = true) { function environment<T>(run: () => Promise<T>): Promise<T> { return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: 'https://api.example.test', POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_PROJECT_TOKEN: undefined, diff --git a/test/commands/events.test.ts b/test/commands/events.test.ts index 7fcd2097..c01533f5 100644 --- a/test/commands/events.test.ts +++ b/test/commands/events.test.ts @@ -295,8 +295,7 @@ function replayReceipt() { function environment<T>(run: () => Promise<T>): Promise<T> { return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: 'https://api.example.test', POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_PROJECT_TOKEN: undefined, diff --git a/test/commands/flow-endpoints.test.ts b/test/commands/flow-endpoints.test.ts index 3362c8f6..421652ce 100644 --- a/test/commands/flow-endpoints.test.ts +++ b/test/commands/flow-endpoints.test.ts @@ -18,27 +18,27 @@ describe('dynamic Flow endpoint commands', () => { return withEnvironment( { POLYMORFA_API_KEY: undefined, - POLYMORFA_PROJECT_TOKEN: `pmfa_pt_${'A'.repeat(94)}`, + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_BASE_URL: server!.baseUrl, }, () => runCommand(command), ) } - test('reads the endpoint, receipts and custody for one Number', async () => { + test('reads the endpoint, receipts and custody for one Connection', async () => { server = await startHttpServer({body: {data: {endpoint: null}}}) for (const command of [ - `flow endpoint get ${flow} --session support`, - `flow endpoint receipts ${flow} --session support --limit 5`, - `flow key custody --session support`, + `flow endpoint get ${flow} --connection support`, + `flow endpoint receipts ${flow} --connection support --limit 5`, + `flow key custody --connection support`, ]) { const result = await run(`${command} --project ${project} --json`) expect(result.error).toBeUndefined() } expect(server.requests.map((r) => `${r.method} ${r.url}`)).toEqual([ - `GET /platform/flows/${flow}/endpoint?sessionId=support&projectId=${project}`, - `GET /platform/flows/${flow}/endpoint/receipts?sessionId=support&limit=5&projectId=${project}`, - `GET /platform/flow-encryption-keys?sessionId=support&projectId=${project}`, + `GET /platform/flows/${flow}/endpoint?connectionId=support&projectId=${project}`, + `GET /platform/flows/${flow}/endpoint/receipts?connectionId=support&limit=5&projectId=${project}`, + `GET /platform/flow-encryption-keys?connectionId=support&projectId=${project}`, ]) }) test('sets each mode with exactly its fields and prints the secret once', async () => { @@ -48,7 +48,7 @@ describe('dynamic Flow endpoint commands', () => { }, }) const forward = await run( - `flow endpoint set ${flow} --project ${project} --session support --mode forward --url https://example.com/flow --rotate-signing-secret --expected-revision 2 --json`, + `flow endpoint set ${flow} --project ${project} --connection support --mode forward --url https://example.com/flow --rotate-signing-secret --expected-revision 2 --json`, ) expect(forward.error).toBeUndefined() expect( @@ -56,14 +56,14 @@ describe('dynamic Flow endpoint commands', () => { .signingSecret, ).toBe('pfes_x') await run( - `flow endpoint set ${flow} --project ${project} --session support --mode function --function ${fn} --json`, + `flow endpoint set ${flow} --project ${project} --connection support --mode function --function ${fn} --json`, ) await run( - `flow endpoint set ${flow} --project ${project} --session support --mode direct --url https://example.com/direct --disabled --json`, + `flow endpoint set ${flow} --project ${project} --connection support --mode direct --url https://example.com/direct --disabled --json`, ) expect(server.requests.map((r) => JSON.parse(r.body) as unknown)).toEqual([ { - sessionId: 'support', + connectionId: 'support', expectedRevision: 2, mode: 'forward', url: 'https://example.com/flow', @@ -71,13 +71,13 @@ describe('dynamic Flow endpoint commands', () => { projectId: project, }, { - sessionId: 'support', + connectionId: 'support', mode: 'function', functionId: fn, projectId: project, }, { - sessionId: 'support', + connectionId: 'support', enabled: false, mode: 'direct', url: 'https://example.com/direct', @@ -94,14 +94,14 @@ describe('dynamic Flow endpoint commands', () => { ])('refuses mismatched flags (%s) before dispatch', async (flags) => { server = await startHttpServer({body: {data: {}}}) const result = await run( - `flow endpoint set ${flow} --project ${project} --session support ${flags} --json`, + `flow endpoint set ${flow} --project ${project} --connection support ${flags} --json`, ) expect(result.error).toBeDefined() expect(server.requests).toHaveLength(0) }) test.each([ - `flow endpoint delete ${flow} --session support`, - 'flow key rotate --session support', + `flow endpoint delete ${flow} --connection support`, + 'flow key rotate --connection support', ])('requires confirmation: %s', async (command) => { server = await startHttpServer({body: {data: {ok: true}}}) const result = await run(`${command} --project ${project} --json`) @@ -114,7 +114,7 @@ describe('dynamic Flow endpoint commands', () => { body: {error: {code: 'service_unavailable', message: 'Unknown outcome'}}, }) const result = await run( - `flow key rotate --project ${project} --session support --yes --json`, + `flow key rotate --project ${project} --connection support --yes --json`, ) expect(result.error).toBeDefined() expect(server.requests).toHaveLength(1) diff --git a/test/commands/flows.test.ts b/test/commands/flows.test.ts index 48bcaf3c..be1726f1 100644 --- a/test/commands/flows.test.ts +++ b/test/commands/flows.test.ts @@ -25,9 +25,13 @@ describe('project Flow commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_PROJECT_TOKEN: - kind === 'project' ? `pmfa_pt_${'A'.repeat(94)}` : undefined, + kind === 'project' + ? 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' + : undefined, POLYMORFA_CLIENT_TOKEN: - kind === 'client' ? `pmfa_ct_${'A'.repeat(94)}` : undefined, + kind === 'client' + ? `pmfa_ct_AAECAwQFBgcICQoLDA0ODxAREhM73f-k` + : undefined, POLYMORFA_BASE_URL: server!.baseUrl, }, () => runCommand(command), @@ -49,14 +53,14 @@ describe('project Flow commands', () => { } server = await startHttpServer({body: {data}}) const result = await run( - `flow upload ${flow} --project ${project} --session support --category APPOINTMENT_BOOKING --request-id ${request} --json`, + `flow upload ${flow} --project ${project} --connection support --category APPOINTMENT_BOOKING --request-id ${request} --json`, ) expect(result.error).toBeUndefined() expect(JSON.parse(result.stdout)).toMatchObject({data}) expect(server.requests).toHaveLength(1) expect(JSON.parse(server.requests[0]!.body)).toEqual({ projectId: project, - sessionId: 'support', + connectionId: 'support', categories: ['APPOINTMENT_BOOKING'], requestId: request, }) @@ -66,7 +70,7 @@ describe('project Flow commands', () => { async (action) => { server = await startHttpServer({body: {data: {ok: true}}}) const result = await run( - `flow ${action} ${flow} --project ${project}${action === 'delete' ? '' : ' --session support'} --json`, + `flow ${action} ${flow} --project ${project}${action === 'delete' ? '' : ' --connection support'} --json`, ) expect(result.error).toBeDefined() expect(server.requests).toHaveLength(0) @@ -78,7 +82,7 @@ describe('project Flow commands', () => { body: {error: {code: 'service_unavailable', message: 'Unknown outcome'}}, }) const result = await run( - `flow publish ${flow} --project ${project} --session support --yes --json`, + `flow publish ${flow} --project ${project} --connection support --yes --json`, ) expect(result.error).toBeDefined() expect(server.requests).toHaveLength(1) diff --git a/test/commands/functions.test.ts b/test/commands/functions.test.ts index 69bc63da..909ab2be 100644 --- a/test/commands/functions.test.ts +++ b/test/commands/functions.test.ts @@ -9,8 +9,7 @@ import { withEnvironment, type TestHttpServer, } from '../helpers/http-server.js' -const KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const PROJECT = '018f0000-0000-7000-8000-000000000001', FN = '018f0000-0000-7000-8000-000000000002', DEPLOY = '018f0000-0000-7000-8000-000000000003', @@ -395,7 +394,7 @@ describe('Function commands', () => { server = await startHttpServer({ body: {data: {items: [], nextCursor: null}}, }) - const token = 'pmfa_pt_' + 'A'.repeat(94) + const token = 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const result = await withEnvironment( { POLYMORFA_API_KEY: undefined, diff --git a/test/commands/group-mutations.test.ts b/test/commands/group-mutations.test.ts index 840e247b..51f15f86 100644 --- a/test/commands/group-mutations.test.ts +++ b/test/commands/group-mutations.test.ts @@ -8,8 +8,7 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' describe('group mutation commands', () => { let server: TestHttpServer | undefined @@ -33,7 +32,7 @@ describe('group mutation commands', () => { }) const result = await run( - 'group create --session session_1 --name "Launch team" --participant 750000000001 --participant 750000000001 --participant 750000000002 --idempotency-key grp_1', + 'group create --connection session_1 --name "Launch team" --participant 750000000001 --participant 750000000001 --participant 750000000002 --idempotency-key grp_1', ) expect(result.error).toBeUndefined() @@ -53,7 +52,7 @@ describe('group mutation commands', () => { server = await startHttpServer({body: {success: true}}) const result = await run( - 'group create --session session_1 --name Team --participant +15551234567 --json', + 'group create --connection session_1 --name Team --participant +15551234567 --json', ) expect(exitCode(result.error)).toBe(2) @@ -69,7 +68,7 @@ describe('group mutation commands', () => { server = await startHttpServer({body: {success: true}}) const result = await run( - `group participants ${action} 750000000009 --session session_1 --participant 750000000001 --json`, + `group participants ${action} 750000000009 --connection session_1 --participant 750000000001 --json`, ) expect(result.error).toBeUndefined() @@ -84,13 +83,13 @@ describe('group mutation commands', () => { server = await startHttpServer({body: {success: true}}) const refused = await run( - 'group participants remove 750000000009 --session session_1 --participant 750000000001 --json', + 'group participants remove 750000000009 --connection session_1 --participant 750000000001 --json', ) expect(exitCode(refused.error)).toBe(2) expect(server.requests).toHaveLength(0) const result = await run( - 'group participants remove 750000000009 --session session_1 --participant 750000000001 --yes --json', + 'group participants remove 750000000009 --connection session_1 --participant 750000000001 --yes --json', ) expect(result.error).toBeUndefined() expect(server.requests[0]?.url).toBe( @@ -102,10 +101,10 @@ describe('group mutation commands', () => { server = await startHttpServer({body: {success: true}}) const subject = await run( - 'group subject 750000000009 --session session_1 --value "New name" --json', + 'group subject 750000000009 --connection session_1 --value "New name" --json', ) const description = await run( - 'group description 750000000009 --session session_1 --value "" --json', + 'group description 750000000009 --connection session_1 --value "" --json', ) expect(subject.error).toBeUndefined() @@ -134,7 +133,7 @@ describe('group mutation commands', () => { server = await startHttpServer({body: {success: true}}) const result = await run( - 'group settings 750000000009 --session session_1 --info-editing all --messaging admins --member-add admins --join-approval on --json', + 'group settings 750000000009 --connection session_1 --info-editing all --messaging admins --member-add admins --join-approval on --json', ) expect(result.error).toBeUndefined() @@ -172,7 +171,7 @@ describe('group mutation commands', () => { ]) const result = await run( - 'group settings 750000000009 --session session_1 --info-editing admins --messaging admins', + 'group settings 750000000009 --connection session_1 --info-editing admins --messaging admins', ) expect(result.error).toBeDefined() @@ -183,7 +182,7 @@ describe('group mutation commands', () => { server = await startHttpServer({body: {success: true}}) const result = await run( - 'group settings 750000000009 --session session_1 --json', + 'group settings 750000000009 --connection session_1 --json', ) expect(exitCode(result.error)).toBe(2) diff --git a/test/commands/groups.test.ts b/test/commands/groups.test.ts index ee3946ff..ab12cd0d 100644 --- a/test/commands/groups.test.ts +++ b/test/commands/groups.test.ts @@ -15,7 +15,7 @@ describe('group commands', () => { server = undefined }) - test('lists groups from the explicitly selected session as JSON', async () => { + test('lists groups from the explicitly selected connection as JSON', async () => { server = await startHttpServer({ body: { data: [ @@ -34,7 +34,7 @@ describe('group commands', () => { }) const result = await environment(() => - runCommand('group list --session session_1 --json'), + runCommand('group list --connection session_1 --json'), ) expect(result.error).toBeUndefined() @@ -71,7 +71,7 @@ describe('group commands', () => { server = await startHttpServer({body: {success: true, data}}) const result = await environment(() => runCommand( - 'group capabilities 9007199254740993 --session session_1 --json', + 'group capabilities 9007199254740993 --connection session_1 --json', ), ) expect(result.error).toBeUndefined() @@ -81,12 +81,12 @@ describe('group commands', () => { ) }) - test('requires explicit session scope before making a request', async () => { + test('requires explicit connection scope before making a request', async () => { const result = await runCommand('group list --json') expect(exitCode(result.error)).toBe(2) expect(result.stdout).toBe('') - expect(result.stderr).toContain('Missing required flag session') + expect(result.stderr).toContain('Missing required flag connection') }) test('rejects a Messaging client token before a Groups request', async () => { @@ -96,9 +96,9 @@ describe('group commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, - () => runCommand('group list --session session_1 --json'), + () => runCommand('group list --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -122,7 +122,7 @@ describe('group commands', () => { }) const result = await environment(() => - runCommand('group view 123@g.us --session session_1 --json'), + runCommand('group view 123@g.us --connection session_1 --json'), ) expect(result.error).toBeUndefined() @@ -150,7 +150,9 @@ describe('group commands', () => { }) const result = await environment(() => - runCommand('group participants list 123@g.us --session session_1 --json'), + runCommand( + 'group participants list 123@g.us --connection session_1 --json', + ), ) expect(result.error).toBeUndefined() @@ -165,7 +167,7 @@ describe('group commands', () => { }) const result = await environment(() => - runCommand('group invite-link 123@g.us --session session_1'), + runCommand('group invite-link 123@g.us --connection session_1'), ) expect(result.error).toBeUndefined() @@ -176,8 +178,7 @@ describe('group commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/history.test.ts b/test/commands/history.test.ts index ac4ee258..8df9ad3d 100644 --- a/test/commands/history.test.ts +++ b/test/commands/history.test.ts @@ -51,7 +51,7 @@ describe('stored chat history commands', () => { }) const result = await apiKey(() => runCommand( - 'chat list --session number/one --limit 20 --kind direct --active-since 2026-09-01T00:00:00Z --cursor page_1 --json', + 'chat list --connection number/one --limit 20 --kind direct --active-since 2026-09-01T00:00:00Z --cursor page_1 --json', ), ) @@ -72,7 +72,7 @@ describe('stored chat history commands', () => { test('reads a chat by E.164 number', async () => { server = await startHttpServer({body: {success: true, data: chat}}) const result = await apiKey(() => - runCommand('chat view +15550001111 --session number_1'), + runCommand('chat view +15550001111 --connection number_1'), ) expect(result.error).toBeUndefined() expect(result.stdout).toContain('Conversation\t739182640518203') @@ -81,16 +81,17 @@ describe('stored chat history commands', () => { ) }) - test('allows a project token for its own Number', async () => { + test('allows a project token for its own Connection', async () => { server = await startHttpServer({body: {success: true, data: chat}}) const result = await withEnvironment( { POLYMORFA_API_KEY: undefined, - POLYMORFA_PROJECT_TOKEN: `pmfa_pt_${'A'.repeat(94)}`, + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_BASE_URL: server.baseUrl, }, - () => runCommand('chat view 739182640518203 --session number_1 --json'), + () => + runCommand('chat view 739182640518203 --connection number_1 --json'), ) expect(result.error).toBeUndefined() expect(server.requests[0]?.url).toBe( @@ -110,7 +111,7 @@ describe('stored chat history commands', () => { }) const result = await apiKey(() => runCommand( - 'chat message list +15550001111 --session number_1 --limit 10 --cursor page_2 --order asc --since 2026-09-01T00:00:00Z --until 2026-09-20T00:00:00Z --direction inbound --types text,image', + 'chat message list +15550001111 --connection number_1 --limit 10 --cursor page_2 --order asc --since 2026-09-01T00:00:00Z --until 2026-09-20T00:00:00Z --direction inbound --types text,image', ), ) expect(result.error).toBeUndefined() @@ -125,7 +126,7 @@ describe('stored chat history commands', () => { server = await startHttpServer({body: {success: true, data: message}}) const result = await apiKey(() => runCommand( - 'chat message view +15550001111 739182640518204 --session number_1 --json', + 'chat message view +15550001111 739182640518204 --connection number_1 --json', ), ) expect(result.error).toBeUndefined() @@ -140,10 +141,10 @@ describe('stored chat history commands', () => { const result = await withEnvironment( { POLYMORFA_API_KEY: undefined, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', POLYMORFA_BASE_URL: server.baseUrl, }, - () => runCommand('chat list --session number_1 --json'), + () => runCommand('chat list --connection number_1 --json'), ) expect(result.error).toBeDefined() expect(result.stderr).toContain( @@ -162,7 +163,7 @@ describe('stored chat history commands', () => { body: {success: false, error: {code, message: 'History unavailable.'}}, }) const result = await apiKey(() => - runCommand('chat list --session number_1 --json'), + runCommand('chat list --connection number_1 --json'), ) expect(result.error).toBeDefined() expect(result.stderr).toContain(code) @@ -181,7 +182,7 @@ describe('stored chat history commands', () => { const output = join(directory, 'photo.jpg') const result = await apiKey(() => runCommand( - `chat message media +15550001111 739182640518204 --session number/one --output ${output} --json`, + `chat message media +15550001111 739182640518204 --connection number/one --output ${output} --json`, ), ) expect(result.error).toBeUndefined() @@ -194,7 +195,7 @@ describe('stored chat history commands', () => { await writeFile(output, 'keep') const refused = await apiKey(() => runCommand( - `chat message media +15550001111 739182640518204 --session number/one --output ${output}`, + `chat message media +15550001111 739182640518204 --connection number/one --output ${output}`, ), ) expect(refused.error).toBeDefined() @@ -209,8 +210,7 @@ describe('stored chat history commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_BASE_URL: server.baseUrl, }, diff --git a/test/commands/hybrid-credentials.test.ts b/test/commands/hybrid-credentials.test.ts index 1fa6818f..c9e0ddd4 100644 --- a/test/commands/hybrid-credentials.test.ts +++ b/test/commands/hybrid-credentials.test.ts @@ -10,25 +10,25 @@ import { } from '../helpers/http-server.js' const project = '11111111-1111-4111-8111-111111111111' -const apiKey = `pmfa_${'A'.repeat(72)}` -const projectToken = `pmfa_pt_${'A'.repeat(94)}` +const apiKey = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' +const projectToken = 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const cases = [ { - command: 'hybrid-link state --session existing', + command: 'hybrid-link state --connection existing', method: 'GET', path: '/messaging/existing/hybrid-link', data: {revision: 'revision-1', paused: true, connections: []}, }, { command: - 'hybrid-link pause --session existing --expected-revision revision-1', + 'hybrid-link pause --connection existing --expected-revision revision-1', method: 'PUT', path: '/messaging/existing/hybrid-link', data: {revision: 'revision-2', paused: true}, }, { command: - 'hybrid-link resume --session existing --expected-revision revision-2', + 'hybrid-link resume --connection existing --expected-revision revision-2', method: 'PUT', path: '/messaging/existing/hybrid-link', data: {revision: 'revision-3', paused: false}, @@ -45,41 +45,41 @@ const cases = [ }, }, { - command: `routing-policy set --scope session --project ${project} --session existing --expected-revision default --prefer inherit --deny-all`, + command: `routing-policy set --scope connection --project ${project} --connection existing --expected-revision default --prefer inherit --deny-all`, method: 'PUT', - path: `/messaging/routing/hybrid?scope=session&projectId=${project}&session=existing`, + path: `/messaging/routing/hybrid?scope=connection&projectId=${project}&connection=existing`, data: { - scope: 'session', + scope: 'connection', revision: 'revision-4', prefer: null, allowedTransports: [], }, }, { - command: 'message operation-status op-1 --session existing', + command: 'message operation-status op-1 --connection existing', method: 'GET', path: '/messaging/existing/operations/op-1', data: {operationId: 'op-1', status: 'unknown'}, }, { - command: `quicklink create --project ${project} --purpose add_connection --session existing --add-connection linked_devices`, + command: `quicklink create --project ${project} --purpose add_method --connection existing --add-method linked_devices`, method: 'POST', path: '/messaging/quicklinks', data: { id: 'ql_1', - session: 'existing', + connection: 'existing', url: 'https://example.test/quicklink/1', expiresAt: null, }, }, { - command: `quicklink availability --project ${project} --session existing`, + command: `quicklink availability --project ${project} --connection existing`, method: 'GET', - path: `/messaging/quicklinks/availability?projectId=${project}&session=existing`, + path: `/messaging/quicklinks/availability?projectId=${project}&connection=existing`, data: { allowed: false, - addConnection: null, - connections: [], + addMethod: null, + methods: [], resumeQuickLinkId: null, }, }, @@ -155,9 +155,9 @@ test.each(credentials)( ).toBe(true) expect(JSON.parse(server.requests[6]!.body)).toEqual({ projectId: project, - purpose: 'add_connection', - session: 'existing', - addConnection: 'linked_devices', + purpose: 'add_method', + connection: 'existing', + addMethod: 'linked_devices', }) if (source === 'environment') expect(keyring).not.toHaveBeenCalled() else expect(keyring).toHaveBeenCalledTimes(cases.length) @@ -214,7 +214,7 @@ test('Hybrid mutation refuses a project-token profile in a different linked dire }, async () => { const result = await runCommand( - 'hybrid-link pause --session existing --expected-revision prior --json', + 'hybrid-link pause --connection existing --expected-revision prior --json', ) expect(result.error).toBeDefined() expect(result.stderr).toContain('This directory is linked to project') @@ -230,13 +230,13 @@ test('Hybrid mutation refuses a project-token profile in a different linked dire } }) -test('session policy uses the project bound to the selected profile', async () => { +test('connection policy uses the project bound to the selected profile', async () => { const server = await startHttpSequenceServer([ { body: { success: true, data: { - scope: 'session', + scope: 'connection', revision: 'default', prefer: null, allowedTransports: ['linked_devices'], @@ -275,13 +275,13 @@ test('session policy uses the project bound to the selected profile', async () = }, async () => { const result = await runCommand( - 'routing-policy get --scope session --session existing --json', + 'routing-policy get --scope connection --connection existing --json', ) expect(result.error, result.stderr).toBeUndefined() }, ) expect(server.requests.map(({url}) => url)).toEqual([ - `/messaging/routing/hybrid?scope=session&projectId=${project}&session=existing`, + `/messaging/routing/hybrid?scope=connection&projectId=${project}&connection=existing`, ]) expect(keyring).toHaveBeenCalledOnce() } finally { @@ -301,7 +301,7 @@ test.each(cases)( POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_API_KEY: undefined, POLYMORFA_PROJECT_TOKEN: undefined, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, async () => { const result = await runCommand(`${command} --json`) @@ -309,7 +309,7 @@ test.each(cases)( expect(JSON.parse(result.stderr)).toMatchObject({ error: {category: 'configuration'}, }) - expect(result.stderr).not.toContain('pmfa_ct_browser') + expect(result.stderr).not.toContain('pmfa_ct_cG1mYV9jdF9icm93c2Vy') }, ) expect(server.requests).toEqual([]) @@ -359,10 +359,10 @@ test('invalid project-token format is rejected before transport', async () => { }, async () => { const result = await runCommand( - 'hybrid-link state --session existing --json', + 'hybrid-link state --connection existing --json', ) expect(result.error).toBeDefined() - expect(result.stderr).toContain('canonical pmfa_pt_ v1 format') + expect(result.stderr).toContain('canonical [REDACTED] opaque format') expect(result.stderr).not.toContain('pmfa_pt_invalid') }, ) @@ -389,7 +389,7 @@ test('a server scope refusal is surfaced once without changing credentials', asy }, async () => { const result = await runCommand( - 'hybrid-link state --session another-project --json', + 'hybrid-link state --connection another-project --json', ) expect(result.error).toBeDefined() expect(JSON.parse(result.stderr)).toMatchObject({ @@ -430,7 +430,7 @@ test('an explicit retired API revision is sent and rejected without automatic up }, async () => { const result = await runCommand( - 'hybrid-link state --session existing --api-version 2026-08-19 --json', + 'hybrid-link state --connection existing --api-version 2026-08-19 --json', ) expect(result.error).toBeDefined() expect(JSON.parse(result.stderr)).toMatchObject({ diff --git a/test/commands/hybrid-link.test.ts b/test/commands/hybrid-link.test.ts index 37fc4a14..df474686 100644 --- a/test/commands/hybrid-link.test.ts +++ b/test/commands/hybrid-link.test.ts @@ -9,7 +9,7 @@ import { } from '../helpers/http-server.js' const project = '11111111-1111-4111-8111-111111111111' const env = (url: string) => ({ - POLYMORFA_API_KEY: `pmfa_${'A'.repeat(72)}`, + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: url, POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_PROJECT_TOKEN: undefined, @@ -32,7 +32,7 @@ test('state output shows both connection readiness and enablement', async () => ]) try { await withEnvironment(env(server.baseUrl), async () => { - const result = await runCommand('hybrid-link state --session existing') + const result = await runCommand('hybrid-link state --connection existing') expect(result.error, result.stderr).toBeUndefined() expect(result.stdout).toContain('pair-4\tactive') expect(result.stdout).toContain('linked_devices: connected (enabled)') @@ -151,7 +151,7 @@ test('flag-only QuickLink creation uses the linked project', async () => { success: true, data: { id: 'ql-1', - session: 'existing', + connection: 'existing', url: 'https://example.test/ql-1', expiresAt: null, }, @@ -168,16 +168,16 @@ test('flag-only QuickLink creation uses the linked project', async () => { process.chdir(directory) await withEnvironment(env(server.baseUrl), async () => { const result = await runCommand( - 'quicklink create --purpose add_connection --session existing --add-connection official_api --json', + 'quicklink create --purpose add_method --connection existing --add-method official_api --json', ) expect(result.error, result.stderr).toBeUndefined() }) expect(server.requests).toHaveLength(1) expect(JSON.parse(server.requests[0]!.body)).toMatchObject({ projectId: project, - purpose: 'add_connection', - session: 'existing', - addConnection: 'official_api', + purpose: 'add_method', + connection: 'existing', + addMethod: 'official_api', }) } finally { process.chdir(previousDirectory) @@ -207,7 +207,7 @@ test('QuickLink creation accepts a project slug from the input file', async () = success: true, data: { id: 'ql-1', - session: 'existing', + connection: 'existing', url: 'https://example.test/ql-1', expiresAt: null, }, @@ -247,8 +247,8 @@ test('availability output names existing connections and resumable QuickLink', a success: true, data: { allowed: false, - addConnection: null, - connections: [ + addMethod: null, + methods: [ {kind: 'linked_devices', status: 'connected', enabled: true}, {kind: 'official_api', status: 'pending', enabled: false}, ], @@ -260,10 +260,10 @@ test('availability output names existing connections and resumable QuickLink', a try { await withEnvironment(env(server.baseUrl), async () => { const result = await runCommand( - `quicklink availability --project ${project} --session existing`, + `quicklink availability --project ${project} --connection existing`, ) expect(result.error, result.stderr).toBeUndefined() - expect(result.stdout).toContain('No added connection is available.') + expect(result.stdout).toContain('No added method is available.') expect(result.stdout).toContain('linked_devices: connected (enabled)') expect(result.stdout).toContain('official_api: pending (disabled)') expect(result.stdout).toContain('Resume QuickLink: ql_pending') @@ -272,14 +272,14 @@ test('availability output names existing connections and resumable QuickLink', a await server.close() } }) -test('supplementary QuickLink flags preserve the Number and availability scope', async () => { +test('supplementary QuickLink flags preserve the Connection and availability scope', async () => { const server = await startHttpSequenceServer([ { body: { success: true, data: { id: 'ql_1', - session: 'existing', + connection: 'existing', url: 'https://example.test/quicklink/1', expiresAt: null, }, @@ -290,8 +290,8 @@ test('supplementary QuickLink flags preserve the Number and availability scope', success: true, data: { allowed: false, - addConnection: null, - connections: [], + addMethod: null, + methods: [], resumeQuickLinkId: null, }, }, @@ -302,26 +302,26 @@ test('supplementary QuickLink flags preserve the Number and availability scope', expect( ( await runCommand( - `quicklink create --project ${project} --purpose add_connection --session existing --add-connection linked_devices --json`, + `quicklink create --project ${project} --purpose add_method --connection existing --add-method linked_devices --json`, ) ).error, ).toBeUndefined() expect( ( await runCommand( - `quicklink availability --project ${project} --session existing --json`, + `quicklink availability --project ${project} --connection existing --json`, ) ).error, ).toBeUndefined() }) expect(JSON.parse(server.requests[0]!.body)).toEqual({ projectId: project, - purpose: 'add_connection', - session: 'existing', - addConnection: 'linked_devices', + purpose: 'add_method', + connection: 'existing', + addMethod: 'linked_devices', }) expect(server.requests[1]!.url).toBe( - `/messaging/quicklinks/availability?projectId=${project}&session=existing`, + `/messaging/quicklinks/availability?projectId=${project}&connection=existing`, ) } finally { await server.close() @@ -333,7 +333,7 @@ test('policy and pause writes retain exact revision guards', async () => { body: { success: true, data: { - scope: 'session', + scope: 'connection', revision: 'new', prefer: 'official_api', allowedTransports: ['official_api'], @@ -345,11 +345,11 @@ test('policy and pause writes retain exact revision guards', async () => { try { await withEnvironment(env(server.baseUrl), async () => { const policy = await runCommand( - `routing-policy set --scope session --project ${project} --session existing --expected-revision default --prefer official_api --allow official_api --json`, + `routing-policy set --scope connection --project ${project} --connection existing --expected-revision default --prefer official_api --allow official_api --json`, ) expect(policy.error, policy.stderr).toBeUndefined() const pause = await runCommand( - 'hybrid-link pause --session existing --expected-revision revision-1 --json', + 'hybrid-link pause --connection existing --expected-revision revision-1 --json', ) expect(pause.error, pause.stderr).toBeUndefined() }) @@ -393,13 +393,13 @@ test('unknown outcome is printed with its operation ID and never resends', async try { await withEnvironment(env(server.baseUrl), async () => { const send = await runCommand( - 'message send text --session existing --to +14155550123 --body hello --transport official_api --json', + 'message send text --connection existing --to +14155550123 --body hello --transport official_api --json', ) expect(send.error).toBeDefined() expect(send.stdout + send.stderr).toContain('op-1') expect(send.stdout + send.stderr).toContain('do not resend') const status = await runCommand( - 'message operation-status op-1 --session existing', + 'message operation-status op-1 --connection existing', ) expect(status.error, status.stderr).toBeUndefined() expect(status.stdout).toContain('do not resend') @@ -429,7 +429,7 @@ test('proven pre-send rejection is terminal and does not advise polling', async try { await withEnvironment(env(server.baseUrl), async () => { const result = await runCommand( - 'message operation-status op-rejected --session existing', + 'message operation-status op-rejected --connection existing', ) expect(result.error, result.stderr).toBeUndefined() expect(result.stdout).toContain('Rejected before provider send') diff --git a/test/commands/labels.test.ts b/test/commands/labels.test.ts index 6b8ebf43..0fa11318 100644 --- a/test/commands/labels.test.ts +++ b/test/commands/labels.test.ts @@ -15,14 +15,14 @@ describe('label commands', () => { server = undefined }) - test('lists unpaged labels for an explicit encoded session', async () => { + test('lists unpaged labels for an explicit encoded connection', async () => { server = await startHttpServer({ body: {data: [label()], success: true}, headers: {'request-id': 'req_labels'}, }) const result = await apiKeyEnvironment(() => - runCommand('label list --session session/main --json'), + runCommand('label list --connection connection/main --json'), ) expect(result.error).toBeUndefined() @@ -30,7 +30,7 @@ describe('label commands', () => { data: [label()], metadata: {attempts: 1, requestId: 'req_labels', status: 200}, }) - expect(server.requests[0]?.url).toBe('/messaging/session%2Fmain/labels') + expect(server.requests[0]?.url).toBe('/messaging/connection%2Fmain/labels') }) test('preserves the observation envelope only when requested', async () => { @@ -46,7 +46,9 @@ describe('label commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('label list --session session_1 --include-observation --json'), + runCommand( + 'label list --connection session_1 --include-observation --json', + ), ) expect(result.error).toBeUndefined() @@ -63,9 +65,9 @@ describe('label commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, - () => runCommand('label list --session session_1 --json'), + () => runCommand('label list --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -80,7 +82,7 @@ describe('label commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'label create --session session_1 --name Priority --color 5 --idempotency-key create_priority --json', + 'label create --connection session_1 --name Priority --color 5 --idempotency-key create_priority --json', ), ) @@ -103,7 +105,7 @@ describe('label commands', () => { server = await startHttpServer({body: {success: true}}) const result = await apiKeyEnvironment(() => - runCommand('label update label_1 --session session_1 --json'), + runCommand('label update label_1 --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -116,7 +118,7 @@ describe('label commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'label update label/1 --session session_1 --name Urgent --color 7 --json', + 'label update label/1 --connection session_1 --name Urgent --color 7 --json', ), ) @@ -133,7 +135,7 @@ describe('label commands', () => { test('requires explicit yes before deleting a label', async () => { const result = await runCommand( - 'label delete label_1 --session session_1 --json', + 'label delete label_1 --connection session_1 --json', ) expect(exitCode(result.error)).toBe(2) @@ -145,7 +147,7 @@ describe('label commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'label delete label/1 --session session_1 --yes --idempotency-key delete_1 --json', + 'label delete label/1 --connection session_1 --yes --idempotency-key delete_1 --json', ), ) @@ -164,12 +166,14 @@ describe('label commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('label chat list 120363@g.us --session session/main --json'), + runCommand( + 'label chat list 120363@g.us --connection connection/main --json', + ), ) expect(result.error).toBeUndefined() expect(server.requests[0]?.url).toBe( - '/messaging/session%2Fmain/labels/chats/120363%40g.us', + '/messaging/connection%2Fmain/labels/chats/120363%40g.us', ) }) @@ -178,7 +182,7 @@ describe('label commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'label chat replace 120363@g.us --session session_1 --label priority --label customer --idempotency-key replace_1 --json', + 'label chat replace 120363@g.us --connection session_1 --label priority --label customer --idempotency-key replace_1 --json', ), ) @@ -195,7 +199,7 @@ describe('label commands', () => { server = await startHttpServer({body: {success: true}}) const result = await apiKeyEnvironment(() => - runCommand('label chat replace chat_1 --session session_1 --json'), + runCommand('label chat replace chat_1 --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -208,7 +212,7 @@ describe('label commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'label chat replace chat_1 --session session_1 --clear --json', + 'label chat replace chat_1 --connection session_1 --clear --json', ), ) @@ -220,8 +224,7 @@ describe('label commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/listen.test.ts b/test/commands/listen.test.ts index cc3e9284..b3cc3f83 100644 --- a/test/commands/listen.test.ts +++ b/test/commands/listen.test.ts @@ -42,8 +42,7 @@ describe('listen', () => { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, - POLYMORFA_PROJECT_TOKEN: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, () => runCommand(`listen --project ${PROJECT} --event message.* --json`), ) @@ -122,8 +121,7 @@ describe('listen', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_CLIENT_TOKEN: undefined, - POLYMORFA_PROJECT_TOKEN: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, () => runCommand( @@ -158,8 +156,7 @@ describe('listen', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_CLIENT_TOKEN: undefined, - POLYMORFA_PROJECT_TOKEN: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, () => runCommand( @@ -176,8 +173,7 @@ describe('listen', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_CLIENT_TOKEN: undefined, - POLYMORFA_PROJECT_TOKEN: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, () => runCommand( @@ -193,8 +189,7 @@ describe('listen', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_CLIENT_TOKEN: undefined, - POLYMORFA_PROJECT_TOKEN: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, () => runCommand( diff --git a/test/commands/media.test.ts b/test/commands/media.test.ts index 43b3b2b0..bb3ea5c3 100644 --- a/test/commands/media.test.ts +++ b/test/commands/media.test.ts @@ -52,7 +52,7 @@ describe('media commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, () => runCommand('media view media_1 --json'), ) @@ -449,8 +449,7 @@ describe('media commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -467,7 +466,7 @@ function mediaInfo() { mimeType: 'image/png', persisted: false, s3Url: null, - session: 'session_1', + connection: 'session_1', } } @@ -494,7 +493,7 @@ function whatsAppFixture(plaintext: Buffer): { .subarray(0, 10) const encrypted = Buffer.concat([ciphertext, mac]) const url = 'https://mmg.whatsapp.net/v/t62.7118-24/fixture.enc?ccb=11-4' - // ImageMessage field numbers: URL 1, fileSHA256 4, mediaKey 8, fileEncSHA256 9. + // ImageMessage field connections: URL 1, fileSHA256 4, mediaKey 8, fileEncSHA256 9. const field = (number: number, value: Buffer): Buffer => Buffer.concat([Buffer.from([(number << 3) | 2, value.length]), value]) const media = Buffer.concat([ diff --git a/test/commands/message-sends.test.ts b/test/commands/message-sends.test.ts index e474ea9b..85741df4 100644 --- a/test/commands/message-sends.test.ts +++ b/test/commands/message-sends.test.ts @@ -11,8 +11,7 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' describe('typed message send commands', () => { let server: TestHttpServer | undefined @@ -37,7 +36,7 @@ describe('typed message send commands', () => { 'message', 'send', 'image', - '--session', + '--connection', 'session_1', '--to', '+15551234567', @@ -65,7 +64,7 @@ describe('typed message send commands', () => { 'message', 'send', 'video', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -90,7 +89,7 @@ describe('typed message send commands', () => { 'message', 'send', 'audio', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -115,7 +114,7 @@ describe('typed message send commands', () => { 'message', 'send', 'document', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -145,7 +144,7 @@ describe('typed message send commands', () => { 'message', 'send', 'image', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -166,7 +165,7 @@ describe('typed message send commands', () => { 'message', 'send', 'image', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -196,7 +195,7 @@ describe('typed message send commands', () => { 'message', 'send', 'template', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -232,7 +231,7 @@ describe('typed message send commands', () => { 'message', 'send', 'template', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -266,7 +265,7 @@ describe('typed message send commands', () => { 'message', 'send', 'order', - '--session', + '--connection', 'session_1', '--to', '+5511987654321', @@ -295,7 +294,7 @@ describe('typed message send commands', () => { 'message', 'send', 'order', - '--session', + '--connection', 'session_1', '--to', '+5511987654321', @@ -315,7 +314,7 @@ describe('typed message send commands', () => { 'message', 'send', 'order-status', - '--session', + '--connection', 'session_1', '--to', '+5511987654321', @@ -353,7 +352,7 @@ describe('typed message send commands', () => { 'message', 'send', 'order-status', - '--session', + '--connection', 'session_1', '--to', '+5511987654321', @@ -403,7 +402,7 @@ describe('typed message send commands', () => { 'message', 'send', 'order', - '--session', + '--connection', 'session_1', '--to', '+5511987654321', @@ -430,7 +429,7 @@ describe('typed message send commands', () => { 'message', 'send', 'order', - '--session', + '--connection', 'session_1', '--to', '+5511987654321', @@ -449,7 +448,7 @@ describe('typed message send commands', () => { 'message', 'send', 'order-status', - '--session', + '--connection', 'session_1', '--to', '+5511987654321', @@ -471,7 +470,7 @@ describe('typed message send commands', () => { 'message', 'send', 'location', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -498,7 +497,7 @@ describe('typed message send commands', () => { 'message', 'send', 'location', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -521,7 +520,7 @@ describe('typed message send commands', () => { 'message', 'send', 'contact', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -552,7 +551,7 @@ describe('typed message send commands', () => { 'message', 'send', 'contact', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -576,7 +575,7 @@ describe('typed message send commands', () => { 'message', 'send', 'poll', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -605,7 +604,7 @@ describe('typed message send commands', () => { 'message', 'send', 'poll', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -619,7 +618,7 @@ describe('typed message send commands', () => { 'message', 'send', 'poll', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -644,7 +643,7 @@ describe('typed message send commands', () => { 'message', 'send', 'buttons', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -687,7 +686,7 @@ describe('typed message send commands', () => { 'message', 'send', 'buttons', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -710,7 +709,7 @@ describe('typed message send commands', () => { 'message', 'send', 'list', - '--session', + '--connection', 'session_1', '--to', '730000000001', @@ -755,7 +754,7 @@ describe('typed message send commands', () => { 'message', 'edit', '740000000001', - '--session', + '--connection', 'session_1', '--chat', '730000000001', @@ -782,7 +781,7 @@ describe('typed message send commands', () => { 'message', 'delete', '740000000001', - '--session', + '--connection', 'session_1', '--chat', '730000000001', @@ -795,7 +794,7 @@ describe('typed message send commands', () => { 'message', 'delete', '740000000001', - '--session', + '--connection', 'session_1', '--chat', '730000000001', diff --git a/test/commands/messages.test.ts b/test/commands/messages.test.ts index ff13d345..29798946 100644 --- a/test/commands/messages.test.ts +++ b/test/commands/messages.test.ts @@ -15,12 +15,12 @@ describe('message commands', () => { server = undefined }) - test('sends text through the explicitly selected session as JSON', async () => { + test('sends text through the explicitly selected connection as JSON', async () => { server = await messageServer('req_message') const result = await apiKeyEnvironment(() => runCommand( - 'message send text --session session/main --to +15551234567 --body Hello --json', + 'message send text --connection connection/main --to +15551234567 --body Hello --json', ), ) @@ -35,7 +35,7 @@ describe('message commands', () => { content: {text: 'Hello'}, }), method: 'POST', - url: '/messaging/session%2Fmain/messages/send', + url: '/messaging/connection%2Fmain/messages/send', }) expect(server.requests[0]?.headers['idempotency-key']).toMatch( /^pmfa_cli_[0-9a-f-]{36}$/, @@ -58,7 +58,7 @@ describe('message commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `message send ${kind} --session session_1 --to +15551234567 --json`, + `message send ${kind} --connection session_1 --to +15551234567 --json`, ), ) @@ -73,7 +73,7 @@ describe('message commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'message send text --session session_1 --to +15551234567 --body Hello --idempotency-key " " --json', + 'message send text --connection session_1 --to +15551234567 --body Hello --idempotency-key " " --json', ), ) @@ -86,7 +86,7 @@ describe('message commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'message send text --session session_1 --to 730000000001 --body Reply --reply-to 740000000001 --forwarded --mention 750000000001 --mention 750000000002 --idempotency-key send_1 --json', + 'message send text --connection session_1 --to 730000000001 --body Reply --reply-to 740000000001 --forwarded --mention 750000000001 --mention 750000000002 --idempotency-key send_1 --json', ), ) @@ -102,14 +102,14 @@ describe('message commands', () => { expect(server.requests[0]?.url).toBe('/messaging/session_1/messages/send') }) - test('requires explicit session scope before sending', async () => { + test('requires explicit connection scope before sending', async () => { const result = await runCommand( 'message send text --to +15551234567 --body Hello --json', ) expect(exitCode(result.error)).toBe(2) expect(result.stdout).toBe('') - expect(result.stderr).toContain('Missing required flag session') + expect(result.stderr).toContain('Missing required flag connection') }) test('rejects an empty text body before transport', async () => { @@ -117,7 +117,7 @@ describe('message commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'message send text --session session_1 --to +15551234567 --body "" --json', + 'message send text --connection session_1 --to +15551234567 --body "" --json', ), ) @@ -134,11 +134,11 @@ describe('message commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, () => runCommand( - 'message send text --session session_1 --to +15551234567 --body Hello --json', + 'message send text --connection session_1 --to +15551234567 --body Hello --json', ), ) @@ -153,7 +153,7 @@ describe('message commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `message react 740000000001 --session session/main --chat 730000000001 --emoji 👍 ${key === undefined ? '' : `--idempotency-key ${key}`} --json`, + `message react 740000000001 --connection connection/main --chat 730000000001 --emoji 👍 ${key === undefined ? '' : `--idempotency-key ${key}`} --json`, ), ) @@ -169,7 +169,7 @@ describe('message commands', () => { reaction: '👍', }), method: 'POST', - url: '/messaging/session%2Fmain/messages/react', + url: '/messaging/connection%2Fmain/messages/react', }) if (key === undefined) { expect(server.requests[0]?.headers['idempotency-key']).toMatch( @@ -186,7 +186,7 @@ describe('message commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'message mark-seen 740000000001 --session session_1 --chat 730000000001 --json', + 'message mark-seen 740000000001 --connection session_1 --chat 730000000001 --json', ), ) @@ -210,7 +210,7 @@ describe('message commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'message typing --session session_1 --chat 730000000001 --state recording --json', + 'message typing --connection session_1 --chat 730000000001 --state recording --json', ), ) @@ -233,7 +233,7 @@ describe('message commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'message star 740000000001 --session session_1 --chat 730000000001 --remove --json', + 'message star 740000000001 --connection session_1 --chat 730000000001 --remove --json', ), ) @@ -256,8 +256,7 @@ describe('message commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/newsletter-observations.test.ts b/test/commands/newsletter-observations.test.ts index 6c1d854f..258c9a87 100644 --- a/test/commands/newsletter-observations.test.ts +++ b/test/commands/newsletter-observations.test.ts @@ -33,6 +33,13 @@ const fixture = JSON.parse( 'utf8', ), ) as {readonly events: readonly FixtureEnvelope[]} +// Keep historical retained bytes unchanged. The current stream fixture changes +// only the API-owned account envelope; native newsletter payloads stay exact. +const currentEvents = fixture.events.map(({session, ...event}) => ({ + ...event, + connection: session, +})) +type CurrentEnvelope = (typeof currentEvents)[number] const channel = JSON.parse( readFileSync( new URL( @@ -43,7 +50,11 @@ const channel = JSON.parse( ), ) as Record<string, unknown> const PROJECT = '11111111-1111-4111-8111-111111111111' -const metadata = (index: number, includePayload: boolean) => ({ +const metadata = ( + index: number, + includePayload: boolean, + events: readonly (FixtureEnvelope | CurrentEnvelope)[] = fixture.events, +) => ({ id: fixture.events[index]!.id, organizationId: 'org_1', projectId: PROJECT, @@ -56,9 +67,7 @@ const metadata = (index: number, includePayload: boolean) => ({ ? { encoding: 'base64', contentType: 'application/json', - data: Buffer.from(JSON.stringify(fixture.events[index])).toString( - 'base64', - ), + data: Buffer.from(JSON.stringify(events[index])).toString('base64'), } : null, replayableUntil: null, @@ -73,8 +82,7 @@ describe('newsletter observation consumers', () => { const environment = <T>(run: () => Promise<T>) => withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server!.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_PROJECT_TOKEN: undefined, @@ -87,7 +95,7 @@ describe('newsletter observation consumers', () => { server = await startHttpServer({body: {success: true, data: [channel]}}) const result = await environment(() => runCommand( - `channel message ${command} ${fixture.events[0]!.payload.id} --session number_1 --json`, + `channel message ${command} ${fixture.events[0]!.payload.id} --connection number_1 --json`, ), ) expect(result.error).toBeUndefined() @@ -123,7 +131,7 @@ describe('newsletter observation consumers', () => { ) expect(server.requests[1]?.url).toContain('includePayload=true') }) - test('preserves native live, milestone and legacy payloads through real SDK SSE into NDJSON', async () => { + test('preserves native newsletter payloads in the current Connection envelope through SDK SSE into NDJSON', async () => { const ready = { v: 1, type: 'ready', @@ -131,10 +139,10 @@ describe('newsletter observation consumers', () => { sequence: 1, heartbeatIntervalMs: 15000, } - const frames = fixture.events + const frames = currentEvents .map( (_: unknown, index: number) => - `id: c${index}\nevent: event\ndata: ${JSON.stringify({v: 1, type: 'event', streamId: 's', sequence: index + 2, sentAt: fixture.events[index]!.timestamp, cursor: `c${index}`, event: metadata(index, true)})}\n\n`, + `id: c${index}\nevent: event\ndata: ${JSON.stringify({v: 1, type: 'event', streamId: 's', sequence: index + 2, sentAt: fixture.events[index]!.timestamp, cursor: `c${index}`, event: metadata(index, true, currentEvents)})}\n\n`, ) .join('') server = await startHttpSequenceServer([ @@ -153,9 +161,9 @@ describe('newsletter observation consumers', () => { const lines = result.stdout .trim() .split('\n') - .map((line) => JSON.parse(line) as {webhook: FixtureEnvelope}) + .map((line) => JSON.parse(line) as {webhook: CurrentEnvelope}) expect(lines).toHaveLength(3) - expect(lines.map((line) => line.webhook)).toEqual(fixture.events) + expect(lines.map((line) => line.webhook)).toEqual(currentEvents) expect(lines[0]?.webhook.payload.messages?.[0]?.forwards).toBe(0) expect(lines[0]?.webhook.payload.messages?.[0]?.reactionCounts).toEqual({}) expect(lines[0]?.webhook.payload.messages?.[1]).toEqual({position: 124}) diff --git a/test/commands/operations.test.ts b/test/commands/operations.test.ts index bccea36e..c732811c 100644 --- a/test/commands/operations.test.ts +++ b/test/commands/operations.test.ts @@ -329,8 +329,7 @@ function operation(status: string, sequence: number) { function environment<T>(run: () => Promise<T>): Promise<T> { return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: api.url, POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_PROJECT_TOKEN: undefined, diff --git a/test/commands/platform-management.test.ts b/test/commands/platform-management.test.ts index 2eafd47a..795da89e 100644 --- a/test/commands/platform-management.test.ts +++ b/test/commands/platform-management.test.ts @@ -23,7 +23,7 @@ describe('Platform management commands', () => { directory = undefined }) - test('lists team sessions and filters by exact project ID', async () => { + test('lists team connections and filters by exact project ID', async () => { server = await startHttpServer({ body: { data: [ @@ -31,7 +31,7 @@ describe('Platform management commands', () => { _id: 'row_1', _creationTime: 1_723_000_000_000, projectId: 'project_1', - sessionId: 'session_1', + connectionId: 'session_1', name: 'Support', phone: null, platform: 'android', @@ -45,12 +45,12 @@ describe('Platform management commands', () => { }, ], }, - headers: {'request-id': 'req_sessions'}, + headers: {'request-id': 'req_connections'}, }) - const all = await platformEnvironment(() => runCommand('session list')) + const all = await platformEnvironment(() => runCommand('connection list')) const project = await platformEnvironment(() => - runCommand('session list --project project_1 --json'), + runCommand('connection list --project project_1 --json'), ) expect(all.error).toBeUndefined() @@ -59,28 +59,84 @@ describe('Platform management commands', () => { ) expect(project.error).toBeUndefined() expect(JSON.parse(project.stdout)).toMatchObject({ - data: [{sessionId: 'session_1', status: 'CONNECTED'}], - metadata: {requestId: 'req_sessions', status: 200}, + data: [{connectionId: 'session_1', status: 'CONNECTED'}], + metadata: {requestId: 'req_connections', status: 200}, }) expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ - 'GET /platform/sessions', - 'GET /platform/sessions?projectId=project_1', + 'GET /platform/connections', + 'GET /platform/connections?projectId=project_1', ]) }) - test('views a session and reports only its stored status in the status command', async () => { + test.each(['linked_device', 'cloud_api', 'hybrid'])( + 'keeps one root and reports type and scalar method for %s', + async (method) => { + const root = { + connectionId: 'stable-session-id', + name: 'Support', + tenantId: 'team_1', + type: 'whatsapp', + method, + phoneNumberId: '12345678901234567890', + testMode: false, + status: 'CONNECTED', + createdAt: '2026-11-16T00:00:00.000Z', + updatedAt: '2026-11-16T00:00:00.000Z', + } + server = await startHttpServer({body: {success: true, data: root}}) + const structured = await platformEnvironment(() => + runCommand('connection view stable-session-id --json'), + ) + const human = await platformEnvironment(() => + runCommand('connection view stable-session-id'), + ) + expect(structured.error, structured.stderr).toBeUndefined() + expect((JSON.parse(structured.stdout) as {data: unknown}).data).toEqual( + root, + ) + expect(human.error, human.stderr).toBeUndefined() + expect(human.stdout).toContain('Type\twhatsapp') + expect(human.stdout).toContain(`Method\t${method}`) + expect(human.stdout).toContain('ID\tstable-session-id') + expect(server.requests.map(({url}) => url)).toEqual([ + '/platform/connections/stable-session-id', + '/platform/connections/stable-session-id', + ]) + }, + ) + + test.each([ + 'session list', + 'session-ban list', + 'customer number list customer_1 --project project_1', + 'connection tier quote support --tier standard --split --stay linked_devices --new-number-name other', + 'quicklink create --project project_1 --purpose add_method --connection support --add-connection linked_devices', + 'trigger message.received --connection support --from-number other', + 'connection view support --session support', + ])( + 'refuses retired account command syntax before HTTP: %s', + async (command) => { + server = await startHttpServer({body: {data: []}}) + const result = await platformEnvironment(() => runCommand(command)) + expect(result.error).toBeDefined() + expect(server.requests).toHaveLength(0) + }, + ) + + test('views a connection and reports only its stored status in the status command', async () => { server = await startHttpServer({ body: { success: true, data: { - sessionId: 'session_1', + connectionId: 'session_1', name: 'Support', tenantId: 'org_1', - type: 'linked_device', + type: 'whatsapp', + method: 'linked_device', testMode: false, status: 'DISCONNECTED', statusReason: 'PHONE_OFFLINE', - configuration: {revisions: {team: 1, project: 2, session: 3}}, + configuration: {revisions: {team: 1, project: 2, connection: 3}}, createdAt: '2026-09-26T00:00:00.000Z', updatedAt: '2026-09-27T00:00:00.000Z', }, @@ -88,23 +144,23 @@ describe('Platform management commands', () => { }) const view = await platformEnvironment(() => - runCommand('session view session_1 --json'), + runCommand('connection view session_1 --json'), ) const status = await platformEnvironment(() => - runCommand('session status session_1 --json'), + runCommand('connection status session_1 --json'), ) const human = await platformEnvironment(() => - runCommand('session status session_1'), + runCommand('connection status session_1'), ) expect(view.error).toBeUndefined() expect(JSON.parse(view.stdout)).toMatchObject({ - data: {sessionId: 'session_1', status: 'DISCONNECTED'}, + data: {connectionId: 'session_1', status: 'DISCONNECTED'}, }) expect(status.error).toBeUndefined() expect(JSON.parse(status.stdout)).toMatchObject({ data: { - sessionId: 'session_1', + connectionId: 'session_1', status: 'DISCONNECTED', statusReason: 'PHONE_OFFLINE', }, @@ -113,18 +169,18 @@ describe('Platform management commands', () => { expect(statusJson).not.toHaveProperty('data.configuration') expect(human.stdout).toBe('session_1\tDISCONNECTED\tPHONE_OFFLINE\n') expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ - 'GET /platform/sessions/session_1', - 'GET /platform/sessions/session_1', - 'GET /platform/sessions/session_1', + 'GET /platform/connections/session_1', + 'GET /platform/connections/session_1', + 'GET /platform/connections/session_1', ]) }) - test('rejects a project filter on session view and status before transport', async () => { + test('rejects a project filter on connection view and status before transport', async () => { server = await startHttpServer({body: {success: true, data: {}}}) for (const command of ['view', 'status']) { const result = await platformEnvironment(() => - runCommand(`session ${command} session_1 --project project_1`), + runCommand(`connection ${command} session_1 --project project_1`), ) expect(exitCode(result.error)).toBe(2) expect(result.stderr).toContain('omit --project') @@ -132,15 +188,15 @@ describe('Platform management commands', () => { expect(server.requests).toHaveLength(0) }) - test('rejects a project token for team session reads before transport', async () => { + test('rejects a project token for team connection reads before transport', async () => { server = await startHttpServer({body: {data: []}}) const result = await withEnvironment( { POLYMORFA_API_KEY: undefined, - POLYMORFA_PROJECT_TOKEN: `pmfa_pt_${'A'.repeat(94)}`, + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, }, - () => runCommand('session list --json'), + () => runCommand('connection list --json'), ) expect(exitCode(result.error)).toBe(2) expect(result.stderr).toContain( @@ -149,27 +205,27 @@ describe('Platform management commands', () => { expect(server.requests).toHaveLength(0) }) - test('does not turn a missing session into a disconnected status', async () => { + test('does not turn a missing connection into a disconnected status', async () => { server = await startHttpServer({ status: 404, body: { error: { type: 'not_found_error', code: 'not_found', - message: 'session not found', + message: 'connection not found', }, }, }) const result = await platformEnvironment(() => - runCommand('session status missing'), + runCommand('connection status missing'), ) expect(result.error).toBeDefined() expect(result.stdout).not.toContain('DISCONNECTED') expect(server.requests).toHaveLength(1) }) - test('reads and updates session configuration using Platform authority', async () => { + test('reads and updates connection configuration using Platform authority', async () => { server = await startHttpServer({ body: {success: true, data: {name: 'support', configuration: {}}}, }) @@ -178,18 +234,18 @@ describe('Platform management commands', () => { configuration: {reset: ['historySync.mode']}, }) const read = await platformEnvironment(() => - runCommand('session configuration get support --json'), + runCommand('connection configuration get support --json'), ) expect(read.error).toBeUndefined() const update = await platformEnvironment(() => runCommand( - `session configuration update support --input ${input} --json`, + `connection configuration update support --input ${input} --json`, ), ) expect(update.error).toBeUndefined() expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ - 'GET /platform/sessions/support', - 'PUT /platform/sessions/support', + 'GET /platform/connections/support', + 'PUT /platform/connections/support', ]) expect(JSON.parse(server.requests[1]!.body)).toEqual({ revision: 2, @@ -234,7 +290,7 @@ describe('Platform management commands', () => { }) const result = await platformEnvironment(() => runCommand( - `session configuration update support --input ${input} --json`, + `connection configuration update support --input ${input} --json`, ), ) expect(result.error).toBeDefined() @@ -258,7 +314,7 @@ describe('Platform management commands', () => { const input = await jsonInput('configuration.json', payload) const result = await platformEnvironment(() => runCommand( - `session configuration update support --input ${input} --json`, + `connection configuration update support --input ${input} --json`, ), ) expect(result.error).toBeUndefined() @@ -390,12 +446,12 @@ describe('Platform management commands', () => { }) test.each([ - {command: 'session-ban list --json', path: '/platform/bans'}, + {command: 'connection-ban list --json', path: '/platform/bans'}, { - command: 'session-ban list --active --json', + command: 'connection-ban list --active --json', path: '/platform/bans/active', }, - ])('lists session bans from $path', async ({command, path}) => { + ])('lists connection bans from $path', async ({command, path}) => { server = await startHttpServer({body: {data: []}}) const result = await platformEnvironment(() => runCommand(command)) @@ -444,10 +500,10 @@ describe('Platform management commands', () => { createdAt: '2026-08-20T00:00:00Z', error: null, id: 'operation/1', - kind: 'session.stop', + kind: 'connection.stop', progress: null, projectId: 'project_1', - resource: {id: 'session_1', type: 'session'}, + resource: {id: 'session_1', type: 'connection'}, status: 'running', updatedAt: '2026-08-20T00:00:01Z', }, @@ -491,7 +547,7 @@ describe('Platform management commands', () => { server = await startHttpServer({ body: { data: { - session: 'support/line', + connection: 'support/line', projectId: 'project_1', status: 'synced', syncedAt: '2026-09-24T10:00:00.000Z', @@ -525,13 +581,13 @@ describe('Platform management commands', () => { }) const result = await platformEnvironment(() => - runCommand('session capabilities support/line'), + runCommand('connection capabilities support/line'), ) expect(result.error, result.stderr).toBeUndefined() expect(server.requests[0]).toMatchObject({ method: 'GET', - url: '/platform/sessions/support%2Fline/capabilities', + url: '/platform/connections/support%2Fline/capabilities', }) expect(result.stdout).toContain('Status\tsynced') expect(result.stdout).toContain('channels\tenabled\tserver') @@ -541,77 +597,81 @@ describe('Platform management commands', () => { expect(result.stdout).toContain('metaAi\tunknown\t-') }) - test('requests asynchronous stops for a bounded session batch', async () => { + test('requests asynchronous stops for a bounded connection batch', async () => { server = await startHttpServer({body: {data: {stopping: 1}}}) const result = await platformEnvironment(() => runCommand( - 'session stop session_1 " session_2 " --project project_1 --idempotency-key stop_batch', + 'connection stop session_1 " session_2 " --project project_1 --idempotency-key stop_batch', ), ) expect(result.error).toBeUndefined() - expect(result.stdout).toContain('Requested stops for 1 matching session.') + expect(result.stdout).toContain( + 'Requested stops for 1 matching connection.', + ) expect(result.stdout).toContain('This does not wait for completion.') expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ projectId: 'project_1', - sessionIds: ['session_1', 'session_2'], + connectionIds: ['session_1', 'session_2'], }) expect(server.requests[0]).toMatchObject({ method: 'POST', - url: '/platform/sessions/stop', + url: '/platform/connections/stop', }) expect(server.requests[0]?.headers['idempotency-key']).toBe('stop_batch') }) - test('rejects duplicate and oversized session batches before transport', async () => { + test('rejects duplicate and oversized connection batches before transport', async () => { server = await startHttpServer({body: {data: {stopping: 0}}}) const duplicate = await platformEnvironment(() => - runCommand('session stop session_1 session_1 --json'), + runCommand('connection stop session_1 session_1 --json'), ) const oversizedIds = Array.from( {length: 101}, - (_, index) => `session_${index}`, + (_, index) => `connection_${index}`, ).join(' ') const oversized = await platformEnvironment(() => - runCommand(`session stop ${oversizedIds} --json`), + runCommand(`connection stop ${oversizedIds} --json`), ) expect(exitCode(duplicate.error)).toBe(2) - expect(duplicate.stderr).toContain('Session IDs must be unique') + expect(duplicate.stderr).toContain('Connection IDs must be unique') expect(exitCode(oversized.error)).toBe(2) - expect(oversized.stderr).toContain('Session batches cannot exceed 100 IDs') + expect(oversized.stderr).toContain( + 'Connection batches cannot exceed 100 IDs', + ) expect(server.requests).toHaveLength(0) }) - test('permanently removes matching sessions only with confirmation', async () => { + test('permanently removes matching connections only with confirmation', async () => { server = await startHttpServer({body: {data: {removed: 2}}}) const result = await platformEnvironment(() => runCommand( - 'session delete session_1 session_2 --project project_1 --yes --idempotency-key delete_batch', + 'connection delete session_1 session_2 --project project_1 --yes --idempotency-key delete_batch', ), ) expect(result.error).toBeUndefined() expect(result.stdout).toContain( - 'Removed 2 matching sessions from management.', + 'Removed 2 matching connections from management.', ) expect(result.stdout).toContain('Device termination is best effort.') expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ projectId: 'project_1', - sessionIds: ['session_1', 'session_2'], + connectionIds: ['session_1', 'session_2'], }) - expect(server.requests[0]?.url).toBe('/platform/sessions/delete') + expect(server.requests[0]?.url).toBe('/platform/connections/delete') expect(server.requests[0]?.headers['idempotency-key']).toBe('delete_batch') }) - test('refuses batch session deletion without --yes before transport', async () => { + test('refuses batch connection deletion without --yes before transport', async () => { server = await startHttpServer({body: {data: {removed: 1}}}) const result = await platformEnvironment(() => - runCommand('session delete session_1 --json'), + runCommand('connection delete session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -738,8 +798,7 @@ describe('Platform management commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/presence.test.ts b/test/commands/presence.test.ts index d005f98d..cdcdffc3 100644 --- a/test/commands/presence.test.ts +++ b/test/commands/presence.test.ts @@ -22,7 +22,7 @@ describe('presence commands', () => { }) const result = await clientTokenEnvironment(() => - runCommand('presence view --session session/main'), + runCommand('presence view --connection connection/main'), ) expect(result.error).toBeUndefined() @@ -30,7 +30,9 @@ describe('presence commands', () => { expect(result.stdout).toContain('Last sent\tavailable') expect(result.stdout).toContain('Authoritative\tno') expect(result.stdout).not.toContain('live') - expect(server.requests[0]?.url).toBe('/messaging/session%2Fmain/presence') + expect(server.requests[0]?.url).toBe( + '/messaging/connection%2Fmain/presence', + ) }) test('preserves self presence and response metadata as JSON', async () => { @@ -40,7 +42,7 @@ describe('presence commands', () => { }) const result = await clientTokenEnvironment(() => - runCommand('presence view --session session_1 --json'), + runCommand('presence view --connection session_1 --json'), ) expect(result.error).toBeUndefined() @@ -57,7 +59,7 @@ describe('presence commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'presence set --session session_1 --state unavailable --idempotency-key presence_1 --json', + 'presence set --connection session_1 --state unavailable --idempotency-key presence_1 --json', ), ) @@ -78,7 +80,9 @@ describe('presence commands', () => { server = await startHttpServer({body: {success: true}}) const result = await clientTokenEnvironment(() => - runCommand('presence set --session session_1 --state available --json'), + runCommand( + 'presence set --connection session_1 --state available --json', + ), ) expect(exitCode(result.error)).toBe(2) @@ -92,7 +96,9 @@ describe('presence commands', () => { server = await startHttpServer({body: {success: true}}) const result = await apiKeyEnvironment(() => - runCommand('presence set --session session_1 --state composing --json'), + runCommand( + 'presence set --connection session_1 --state composing --json', + ), ) expect(exitCode(result.error)).toBe(2) @@ -108,7 +114,7 @@ describe('presence commands', () => { const result = await clientTokenEnvironment(() => runCommand( - 'presence chat view 120363@g.us --session session/main --json', + 'presence chat view 120363@g.us --connection connection/main --json', ), ) @@ -122,7 +128,7 @@ describe('presence commands', () => { }, }) expect(server.requests[0]?.url).toBe( - '/messaging/session%2Fmain/presence/120363%40g.us', + '/messaging/connection%2Fmain/presence/120363%40g.us', ) }) @@ -132,7 +138,7 @@ describe('presence commands', () => { }) const result = await clientTokenEnvironment(() => - runCommand('presence chat view member@lid --session session_1'), + runCommand('presence chat view member@lid --connection session_1'), ) expect(result.error).toBeUndefined() @@ -157,7 +163,7 @@ describe('presence commands', () => { const result = await clientTokenEnvironment(() => runCommand( - 'presence chat subscribe member@lid --session session/main --idempotency-key presence_sub_1 --json', + 'presence chat subscribe member@lid --connection connection/main --idempotency-key presence_sub_1 --json', ), ) @@ -172,7 +178,7 @@ describe('presence commands', () => { expect(server.requests[0]).toMatchObject({ body: '', method: 'POST', - url: '/messaging/session%2Fmain/presence/member%40lid/subscribe', + url: '/messaging/connection%2Fmain/presence/member%40lid/subscribe', }) expect(server.requests[0]?.headers['idempotency-key']).toBe( 'presence_sub_1', @@ -183,8 +189,7 @@ describe('presence commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, @@ -198,7 +203,7 @@ describe('presence commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, run, ) diff --git a/test/commands/privacy.test.ts b/test/commands/privacy.test.ts index 12f44985..41a29877 100644 --- a/test/commands/privacy.test.ts +++ b/test/commands/privacy.test.ts @@ -15,14 +15,14 @@ describe('privacy commands', () => { server = undefined }) - test('views every typed privacy setting for an encoded session', async () => { + test('views every typed privacy setting for an encoded connection', async () => { server = await startHttpServer({ body: {data: privacySettings(), success: true}, headers: {'request-id': 'req_privacy'}, }) const result = await apiKeyEnvironment(() => - runCommand('privacy view --session session/main --json'), + runCommand('privacy view --connection connection/main --json'), ) expect(result.error).toBeUndefined() @@ -30,7 +30,7 @@ describe('privacy commands', () => { data: privacySettings(), metadata: {attempts: 1, requestId: 'req_privacy', status: 200}, }) - expect(server.requests[0]?.url).toBe('/messaging/session%2Fmain/privacy') + expect(server.requests[0]?.url).toBe('/messaging/connection%2Fmain/privacy') }) test('renders privacy settings as a readable setting matrix', async () => { @@ -39,7 +39,7 @@ describe('privacy commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('privacy view --session session_1'), + runCommand('privacy view --connection session_1'), ) expect(result.error).toBeUndefined() @@ -57,9 +57,9 @@ describe('privacy commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, - () => runCommand('privacy view --session session_1 --json'), + () => runCommand('privacy view --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -77,7 +77,7 @@ describe('privacy commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'privacy set --session session_1 --setting online --value match_last_seen --idempotency-key privacy_online_1 --json', + 'privacy set --connection session_1 --setting online --value match_last_seen --idempotency-key privacy_online_1 --json', ), ) @@ -100,7 +100,7 @@ describe('privacy commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'privacy set --session session_1 --setting location --value all --json', + 'privacy set --connection session_1 --setting location --value all --json', ), ) @@ -115,7 +115,7 @@ describe('privacy commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'privacy set --session session_1 --setting readreceipts --value contacts --json', + 'privacy set --connection session_1 --setting readreceipts --value contacts --json', ), ) @@ -140,7 +140,7 @@ describe('privacy commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `privacy disappearing-timer set --session session_1 --duration ${duration} --idempotency-key timer_${duration} --json`, + `privacy disappearing-timer set --connection session_1 --duration ${duration} --idempotency-key timer_${duration} --json`, ), ) @@ -164,8 +164,7 @@ describe('privacy commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/profile.test.ts b/test/commands/profile.test.ts index 1db44ec7..3445dcce 100644 --- a/test/commands/profile.test.ts +++ b/test/commands/profile.test.ts @@ -33,7 +33,7 @@ describe('profile commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('profile view --session session/main --json'), + runCommand('profile view --connection connection/main --json'), ) expect(result.error).toBeUndefined() @@ -41,7 +41,7 @@ describe('profile commands', () => { data: declaredProfile(), metadata: {attempts: 1, requestId: 'req_profile', status: 200}, }) - expect(server.requests[0]?.url).toBe('/messaging/session%2Fmain/profile') + expect(server.requests[0]?.url).toBe('/messaging/connection%2Fmain/profile') }) test('renders the live runner profile shape without assuming declared fields', async () => { @@ -61,7 +61,7 @@ describe('profile commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('profile view --session session_1'), + runCommand('profile view --connection session_1'), ) expect(result.error).toBeUndefined() @@ -83,9 +83,9 @@ describe('profile commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, - () => runCommand('profile view --session session_1 --json'), + () => runCommand('profile view --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -97,7 +97,7 @@ describe('profile commands', () => { server = await startHttpServer({body: {success: true}}) const result = await apiKeyEnvironment(() => - runCommand('profile name set --session session_1 --name "" --json'), + runCommand('profile name set --connection session_1 --name "" --json'), ) expect(exitCode(result.error)).toBe(2) @@ -112,7 +112,7 @@ describe('profile commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'profile name set --session session_1 --name Polymorfa --idempotency-key name_1 --json', + 'profile name set --connection session_1 --name Polymorfa --idempotency-key name_1 --json', ), ) @@ -136,7 +136,7 @@ describe('profile commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'profile status set --session session_1 --status Available --json', + 'profile status set --connection session_1 --status Available --json', ), ) @@ -155,7 +155,7 @@ describe('profile commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'profile picture set --session session_1 --url https://example.test/profile.jpg --json', + 'profile picture set --connection session_1 --url https://example.test/profile.jpg --json', ), ) @@ -176,7 +176,7 @@ describe('profile commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `profile picture set --session session/main --file ${input} --idempotency-key picture_1 --json`, + `profile picture set --connection connection/main --file ${input} --idempotency-key picture_1 --json`, ), ) @@ -184,7 +184,7 @@ describe('profile commands', () => { expect(server.requests[0]).toMatchObject({ body: JSON.stringify({base64: '/9j/2Q=='}), method: 'PUT', - url: '/messaging/session%2Fmain/profile/picture', + url: '/messaging/connection%2Fmain/profile/picture', }) expect(server.requests[0]?.headers['idempotency-key']).toBe('picture_1') }) @@ -193,7 +193,7 @@ describe('profile commands', () => { server = await startHttpServer({body: {success: true}}) const result = await apiKeyEnvironment(() => - runCommand('profile picture set --session session_1 --json'), + runCommand('profile picture set --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -208,7 +208,7 @@ describe('profile commands', () => { const result = await apiKeyEnvironment(() => runCommand( - `profile picture set --session session_1 --file ${input} --url https://example.test/profile.jpg --json`, + `profile picture set --connection session_1 --file ${input} --url https://example.test/profile.jpg --json`, ), ) @@ -224,7 +224,7 @@ describe('profile commands', () => { server = await startHttpServer({body: {success: true}}) const result = await apiKeyEnvironment(() => - runCommand(`profile picture set --session session_1 --file ${input}`), + runCommand(`profile picture set --connection session_1 --file ${input}`), ) expect(exitCode(result.error)).toBe(2) @@ -236,7 +236,7 @@ describe('profile commands', () => { test('requires explicit confirmation before deleting the profile picture', async () => { const result = await runCommand( - 'profile picture delete --session session_1 --json', + 'profile picture delete --connection session_1 --json', ) expect(exitCode(result.error)).toBe(2) @@ -250,7 +250,7 @@ describe('profile commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'profile picture delete --session session_1 --yes --idempotency-key picture_delete_1 --json', + 'profile picture delete --connection session_1 --yes --idempotency-key picture_delete_1 --json', ), ) @@ -273,8 +273,7 @@ describe('profile commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/project-context.test.ts b/test/commands/project-context.test.ts index 9092e7a4..3e734776 100644 --- a/test/commands/project-context.test.ts +++ b/test/commands/project-context.test.ts @@ -11,8 +11,7 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const APP = '11111111-1111-4111-8111-111111111111' describe('link and project commands', () => { diff --git a/test/commands/quick-replies.test.ts b/test/commands/quick-replies.test.ts index 13e0ca80..0a4aadcf 100644 --- a/test/commands/quick-replies.test.ts +++ b/test/commands/quick-replies.test.ts @@ -15,7 +15,7 @@ describe('quick-reply commands', () => { server = undefined }) - test('lists the complete observed quick-reply collection for an encoded session', async () => { + test('lists the complete observed quick-reply collection for an encoded connection', async () => { const collection = { observedAt: '2026-08-19T22:00:00.000Z', policy: 'cache', @@ -28,7 +28,7 @@ describe('quick-reply commands', () => { }) const result = await apiKeyEnvironment(() => - runCommand('quick-reply list --session session/main --json'), + runCommand('quick-reply list --connection connection/main --json'), ) expect(result.error).toBeUndefined() @@ -41,7 +41,7 @@ describe('quick-reply commands', () => { }, }) expect(server.requests[0]?.url).toBe( - '/messaging/session%2Fmain/business/quick-replies', + '/messaging/connection%2Fmain/business/quick-replies', ) }) @@ -54,9 +54,9 @@ describe('quick-reply commands', () => { { POLYMORFA_API_KEY: undefined, POLYMORFA_BASE_URL: server.baseUrl, - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, - () => runCommand('quick-reply list --session session_1 --json'), + () => runCommand('quick-reply list --connection session_1 --json'), ) expect(exitCode(result.error)).toBe(2) @@ -75,7 +75,7 @@ describe('quick-reply commands', () => { runCommand([ 'quick-reply', 'create', - '--session', + '--connection', 'session_1', '--shortcut', '/hours', @@ -110,7 +110,7 @@ describe('quick-reply commands', () => { test('requires the complete shortcut and message when replacing', async () => { const result = await runCommand( - 'quick-reply replace reply_1 --session session_1 --shortcut /hours --json', + 'quick-reply replace reply_1 --connection session_1 --shortcut /hours --json', ) expect(exitCode(result.error)).toBe(2) @@ -127,8 +127,8 @@ describe('quick-reply commands', () => { 'quick-reply', 'replace', 'reply/1', - '--session', - 'session/main', + '--connection', + 'connection/main', '--shortcut', '/hours', '--message', @@ -142,7 +142,7 @@ describe('quick-reply commands', () => { expect(result.error).toBeUndefined() expect(server.requests[0]).toMatchObject({ method: 'PUT', - url: '/messaging/session%2Fmain/business/quick-replies/reply%2F1', + url: '/messaging/connection%2Fmain/business/quick-replies/reply%2F1', }) expect(JSON.parse(server.requests[0]?.body ?? '')).toEqual({ keywords: ['hours'], @@ -153,7 +153,7 @@ describe('quick-reply commands', () => { test('requires explicit yes before deleting a quick reply', async () => { const result = await runCommand( - 'quick-reply delete reply_1 --session session_1 --json', + 'quick-reply delete reply_1 --connection session_1 --json', ) expect(exitCode(result.error)).toBe(2) @@ -167,7 +167,7 @@ describe('quick-reply commands', () => { const result = await apiKeyEnvironment(() => runCommand( - 'quick-reply delete reply/1 --session session_1 --yes --idempotency-key delete_reply_1 --json', + 'quick-reply delete reply/1 --connection session_1 --yes --idempotency-key delete_reply_1 --json', ), ) @@ -186,8 +186,7 @@ describe('quick-reply commands', () => { if (server === undefined) throw new Error('Test server was not started.') return withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, }, diff --git a/test/commands/quicklinks.test.ts b/test/commands/quicklinks.test.ts index 5e9430f7..c33cf49d 100644 --- a/test/commands/quicklinks.test.ts +++ b/test/commands/quicklinks.test.ts @@ -16,7 +16,7 @@ test('creates a QuickLink and uploads separate test history with exact project s data: { id: 'ql_test', url: 'https://example.test/connect/test', - session: 'reserved', + connection: 'reserved', expiresAt: null, }, }, @@ -35,7 +35,7 @@ test('creates a QuickLink and uploads separate test history with exact project s try { await withEnvironment( { - POLYMORFA_API_KEY: `pmfa_${'A'.repeat(72)}`, + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: server.baseUrl, POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_PROJECT_TOKEN: undefined, @@ -69,8 +69,8 @@ test('creates a QuickLink and uploads separate test history with exact project s }) const projectId = '11111111-1111-4111-8111-111111111111' -const apiKey = `pmfa_${'A'.repeat(72)}` -const projectToken = `pmfa_pt_${'A'.repeat(94)}` +const apiKey = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' +const projectToken = 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' test('retrieves QuickLink status with an exact-project token and encoded ID', async () => { const server = await startHttpSequenceServer([ @@ -84,7 +84,7 @@ test('retrieves QuickLink status with an exact-project token and encoded ID', as id: 'ql/123', openedAt: null, phone: null, - session: 'quicklink-123', + connection: 'quicklink-123', status: 'pending', }, }, @@ -205,7 +205,7 @@ test('includes initial number financial controls and rejects invalid precision b data: { id: 'ql_budget', url: 'https://example.test/connect/budget', - session: 'reserved', + connection: 'reserved', expiresAt: null, }, }, diff --git a/test/commands/request-logs.test.ts b/test/commands/request-logs.test.ts index 1043d7d7..ddbebe58 100644 --- a/test/commands/request-logs.test.ts +++ b/test/commands/request-logs.test.ts @@ -7,8 +7,7 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const key = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const key = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const project = '22222222-2222-4222-8222-222222222222' let server: TestHttpServer @@ -18,7 +17,7 @@ function log(id: string, createdAt: string) { projectId: project, createdAt, method: 'POST', - route: '/messaging/:session/messages', + route: '/messaging/:connection/messages', status: 422, durationMs: 41, result: 'failure', @@ -84,7 +83,7 @@ test('lists filtered requests newest first and prints the older-page cursor', as traceId: '4bf92f3577b34da6a3ce929d0e0e4736', }) expect(result.stdout).toContain( - 'POST\t/messaging/:session/messages\t422\t41ms\tinvalid_recipient', + 'POST\t/messaging/:connection/messages\t422\t41ms\tinvalid_recipient', ) expect(result.stdout).toContain('Older requests: --cursor older-1') }) diff --git a/test/commands/sip-trunks.test.ts b/test/commands/sip-trunks.test.ts index 95c75fb1..fb1f984c 100644 --- a/test/commands/sip-trunks.test.ts +++ b/test/commands/sip-trunks.test.ts @@ -15,8 +15,7 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const PROJECT = '018f0000-0000-7000-8000-000000000002' const TRUNK_ID = '6f1c2f0e-1d5b-4d8e-9a55-0d4b8a6c1f10' @@ -36,7 +35,7 @@ const trunk = { inbound: { username: 'pmfa_abc', realm: 'sip.example.test', - session: null, + connection: null, allowedAddresses: ['203.0.113.10/32'], allowedDestinations: [], }, @@ -95,7 +94,9 @@ describe('sip-trunk commands', () => { ) expect(viewed.stdout).toContain('Password stored\tyes') expect(viewed.stdout).toContain('From user\tcaller identity (automatic)') - expect(viewed.stdout).toContain('Calling session\tnot set (calls refused)') + expect(viewed.stdout).toContain( + 'Calling connection\tnot set (calls refused)', + ) expect(viewed.stdout).toContain('Allowed destinations\tany') expect(viewed.stdout).toContain('Revision\t3') expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ diff --git a/test/commands/trigger.test.ts b/test/commands/trigger.test.ts index 785c0502..5b9290c2 100644 --- a/test/commands/trigger.test.ts +++ b/test/commands/trigger.test.ts @@ -7,7 +7,7 @@ import { } from '../helpers/http-server.js' const projectId = '11111111-1111-4111-8111-111111111111' -const apiKey = `pmfa_${'A'.repeat(72)}` +const apiKey = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const eventId = '0199f1c2-7a4e-7c55-9d1e-3f0b8a2c6d10' async function run( @@ -33,13 +33,13 @@ async function run( test('triggers message.received with text and typed overrides', async () => { const {result, requests} = await run( - `trigger message.received --project ${projectId} --session test-a --text hi --override pushName=Ada`, + `trigger message.received --project ${projectId} --connection test-a --text hi --override pushName=Ada`, [ { status: 202, body: { event: 'message.received', - session: 'test-a', + connection: 'test-a', delivery: 'generated', eventId, source: 'test', @@ -61,15 +61,15 @@ test('triggers message.received with text and typed overrides', async () => { }) }) -test('sends a simulated message with --from-number and prints JSON', async () => { +test('sends a simulated message with --from-connection and prints JSON', async () => { const {result, requests} = await run( - `trigger message.received --project ${projectId} --session test-a --from-number test-b --json`, + `trigger message.received --project ${projectId} --connection test-a --from-connection test-b --json`, [ { status: 202, body: { event: 'message.received', - session: 'test-a', + connection: 'test-a', delivery: 'simulated', eventId: null, source: 'runtime', @@ -83,7 +83,7 @@ test('sends a simulated message with --from-number and prints JSON', async () => }) expect(JSON.parse(requests[0]!.body)).toEqual({ event: 'message.received', - fromNumber: 'test-b', + fromConnection: 'test-b', }) }) @@ -110,7 +110,7 @@ test('lists fixtures', async () => { test.each(['true', 'false'])( 'triggers the listed restriction fixture with restrictionActive=%s', async (active) => { - const fixture = 'session.restriction_updated' + const fixture = 'connection.restriction_updated' const listed = await run(`trigger --list`, [ { body: { @@ -127,13 +127,13 @@ test.each(['true', 'false'])( expect(listed.result.stdout).toContain(fixture) const {result, requests} = await run( - `trigger ${fixture} --project ${projectId} --session test-a --override restrictionActive=${active}`, + `trigger ${fixture} --project ${projectId} --connection test-a --override restrictionActive=${active}`, [ { status: 202, body: { event: fixture, - session: 'test-a', + connection: 'test-a', delivery: 'generated', eventId, source: 'test', @@ -150,9 +150,9 @@ test.each(['true', 'false'])( }, ) -test('reports a real-session refusal without retrying', async () => { +test('reports a real-connection refusal without retrying', async () => { const {result, requests} = await run( - `trigger call.received --project ${projectId} --session real-number`, + `trigger call.received --project ${projectId} --connection real-number`, [ { status: 400, @@ -161,7 +161,7 @@ test('reports a real-session refusal without retrying', async () => { type: 'invalid_request_error', code: 'invalid_parameter', message: - 'Test events are available only for Test numbers. This session is not a Test number in the project, or it does not exist.', + 'Test events are available only for Test connections. This connection is not a Test Connection in the project, or it does not exist.', param: null, }, data: null, @@ -169,16 +169,19 @@ test('reports a real-session refusal without retrying', async () => { }, ], ) - expect(result.stderr).toMatch(/only for Test numbers/) + expect(result.stderr).toMatch(/only for Test connections/) expect(requests).toHaveLength(1) }) -test('requires a session and a fixture before any request', async () => { - const noSession = await run(`trigger call.missed --project ${projectId}`, []) - expect(noSession.result.stderr).toMatch(/--session/) - expect(noSession.requests).toHaveLength(0) +test('requires a connection and a fixture before any request', async () => { + const noConnection = await run( + `trigger call.missed --project ${projectId}`, + [], + ) + expect(noConnection.result.stderr).toMatch(/--connection/) + expect(noConnection.requests).toHaveLength(0) const unknown = await run( - `trigger message.sent --project ${projectId} --session test-a`, + `trigger message.sent --project ${projectId} --connection test-a`, [], ) expect(unknown.result.error).toBeDefined() @@ -191,13 +194,13 @@ test.each([ 'bansafe.enforcement', ])('rejects retired %s test fixtures before any request', async (fixture) => { const {result, requests} = await run( - `trigger ${fixture} --project ${projectId} --session test-a`, + `trigger ${fixture} --project ${projectId} --connection test-a`, [ { status: 202, body: { event: fixture, - session: 'test-a', + connection: 'test-a', delivery: 'generated', eventId, source: 'test', @@ -231,7 +234,7 @@ test('rejects a shortcut that repeats an explicit override', async () => { '--override from=+15550001111 --from +15550002222', ]) { const collision = await run( - `trigger message.received --project ${projectId} --session test-a ${flags}`, + `trigger message.received --project ${projectId} --connection test-a ${flags}`, [], ) expect(collision.result.error).toBeDefined() diff --git a/test/commands/usage.test.ts b/test/commands/usage.test.ts index 1aa474c1..7357d9c2 100644 --- a/test/commands/usage.test.ts +++ b/test/commands/usage.test.ts @@ -7,10 +7,8 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' -const PROJECT_TOKEN = - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' +const PROJECT_TOKEN = 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const PROJECT_A = '22222222-2222-4222-8222-222222222222' const PROJECT_B = '33333333-3333-4333-8333-333333333333' @@ -26,14 +24,14 @@ const summary = { billingEnabled: false, end: '2026-10-01T00:00:00.000Z', meters: [meterTotal], - numbers: [ - {meters: [meterTotal], projectId: PROJECT_A, session: 'support'}, - {meters: [meterTotal], projectId: PROJECT_B, session: 'support'}, + connections: [ + {meters: [meterTotal], projectId: PROJECT_A, connection: 'support'}, + {meters: [meterTotal], projectId: PROJECT_B, connection: 'support'}, ], - numbersTruncated: false, + connectionsTruncated: false, period: '2026-09', projectId: null, - session: null, + connection: null, start: '2026-09-01T00:00:00.000Z', } const record = { @@ -55,7 +53,7 @@ const record = { projectId: PROJECT_A, quantity: 42, revision: 1, - session: 'support', + connection: 'support', sourceId: 'CALL-1', sourceKind: 'call', unit: 'second', @@ -87,7 +85,7 @@ const gates = { used: null, }, ], - session: 'support', + connection: 'support', } describe('usage commands', () => { @@ -144,8 +142,12 @@ describe('usage commands', () => { body: { data: { ...summary, - numbers: [ - {meters: [meterTotal], projectId: PROJECT_A, session: 'support'}, + connections: [ + { + meters: [meterTotal], + projectId: PROJECT_A, + connection: 'support', + }, ], projectId: PROJECT_A, }, @@ -201,7 +203,7 @@ describe('usage commands', () => { ]) const listed = await apiKey(() => - runCommand('usage gates --session support'), + runCommand('usage gates --connection support'), ) expect(listed.error).toBeUndefined() @@ -210,7 +212,7 @@ describe('usage commands', () => { ) expect(listed.stdout).toContain('voice.flows\trecord\tnot checked yet') expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ - 'GET /platform/gates?session=support', + 'GET /platform/gates?connection=support', ]) }) diff --git a/test/commands/voice-wait-timeout.test.ts b/test/commands/voice-wait-timeout.test.ts index 032d06d5..2fe357fa 100644 --- a/test/commands/voice-wait-timeout.test.ts +++ b/test/commands/voice-wait-timeout.test.ts @@ -7,8 +7,7 @@ import {expect, test} from 'vitest' import {temporaryDirectory} from '../support/fs.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const ASSET_ID = '6f1c2f0e-1d5b-4d8e-9a55-0d4b8a6c1f10' const PROJECT = '018f0000-0000-7000-8000-000000000002' diff --git a/test/commands/voice.test.ts b/test/commands/voice.test.ts index 7f3109da..a6f6a1ae 100644 --- a/test/commands/voice.test.ts +++ b/test/commands/voice.test.ts @@ -11,8 +11,7 @@ import { type TestHttpServer, } from '../helpers/http-server.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const PROVIDER_KEY = 'sk-provider-secret-0123456789' const PROJECT = '018f0000-0000-7000-8000-000000000002' const ASSET_ID = '6f1c2f0e-1d5b-4d8e-9a55-0d4b8a6c1f10' diff --git a/test/context/environment.test.ts b/test/context/environment.test.ts index 0d6a8518..271c65ba 100644 --- a/test/context/environment.test.ts +++ b/test/context/environment.test.ts @@ -16,8 +16,7 @@ describe('resolveEnvironment', () => { resolveListenerEnvironment({ env: { POLYMORFA_BASE_URL: 'http://127.0.0.1:4567', - POLYMORFA_PROJECT_TOKEN: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, apiVersion: '2026-09-01', project: PROJECT, @@ -26,8 +25,7 @@ describe('resolveEnvironment', () => { ).resolves.toMatchObject({ apiVersion: '2026-09-01', baseUrl: 'http://127.0.0.1:4567', - credential: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + credential: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', principalType: 'project_token', projectId: PROJECT, timeoutMs: 4321, @@ -38,8 +36,7 @@ describe('resolveEnvironment', () => { await expect( resolveListenerEnvironment({ env: { - POLYMORFA_API_KEY: - 'pmfa_DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD', + POLYMORFA_API_KEY: 'pmfa_AwQFBgcICQoLDA0ODxAREhMUFRYcof0T', POLYMORFA_PROJECT_TOKEN: 'pmfa_pt', }, project: 'project_1', @@ -67,9 +64,7 @@ describe('resolveEnvironment', () => { resolveDeveloperEnvironment( {env: {}, profile: 'project'}, {load: () => Promise.resolve(profile), save: () => Promise.resolve()}, - fakeCredentials( - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', - ), + fakeCredentials('pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k'), ), ).resolves.toMatchObject({ context: { @@ -78,8 +73,7 @@ describe('resolveEnvironment', () => { profile: 'project', projectId: PROJECT, }, - credential: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + credential: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }) }) @@ -95,14 +89,11 @@ describe('resolveEnvironment', () => { profile: 'work', }, fakeProfiles(), - fakeCredentials( - 'pmfa_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', - ), + fakeCredentials('pmfa_AQIDBAUGBwgJCgsMDQ4PEBESExRXid_4'), ), ).resolves.toMatchObject({ context: {owner: 'organization', profile: 'work'}, - credential: - 'pmfa_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', + credential: 'pmfa_AQIDBAUGBwgJCgsMDQ4PEBESExRXid_4', }) }) @@ -130,29 +121,23 @@ describe('resolveEnvironment', () => { profile: 'project', }, {load: () => Promise.resolve(profile), save: () => Promise.resolve()}, - fakeCredentials( - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', - ), + fakeCredentials('pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k'), ), ).resolves.toMatchObject({ - credential: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + credential: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', profile: 'project', projectId: '11111111-1111-4111-8111-111111111111', }) }) test('prefers an environment API key over the active listener profile', async () => { - const credentials = fakeCredentials( - 'pmfa_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', - ) + const credentials = fakeCredentials('pmfa_AQIDBAUGBwgJCgsMDQ4PEBESExRXid_4') await expect( resolveListenerEnvironment( { env: { - POLYMORFA_API_KEY: - 'pmfa_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC', + POLYMORFA_API_KEY: 'pmfa_AgMEBQYHCAkKCwwNDg8QERITFBXd5SUP', }, project: '11111111-1111-4111-8111-111111111111', }, @@ -160,8 +145,7 @@ describe('resolveEnvironment', () => { credentials, ), ).resolves.toMatchObject({ - credential: - 'pmfa_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC', + credential: 'pmfa_AgMEBQYHCAkKCwwNDg8QERITFBXd5SUP', principalType: 'organization_key', }) expect(credentials.get).not.toHaveBeenCalled() @@ -174,8 +158,7 @@ describe('resolveEnvironment', () => { resolveListenerEnvironment( { env: { - POLYMORFA_API_KEY: - 'pmfa_DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD', + POLYMORFA_API_KEY: 'pmfa_AwQFBgcICQoLDA0ODxAREhMUFRYcof0T', }, project: 'checkout', }, @@ -195,8 +178,7 @@ describe('resolveEnvironment', () => { resolveDeveloperEnvironment( { env: { - POLYMORFA_API_KEY: - 'pmfa_DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD', + POLYMORFA_API_KEY: 'pmfa_AwQFBgcICQoLDA0ODxAREhMUFRYcof0T', }, owner: 'project', project: 'checkout', @@ -226,8 +208,7 @@ describe('resolveEnvironment', () => { resolveListenerEnvironment( { env: { - POLYMORFA_API_KEY: - 'pmfa_DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD', + POLYMORFA_API_KEY: 'pmfa_AwQFBgcICQoLDA0ODxAREhMUFRYcof0T', }, project: 'checkout', }, @@ -257,8 +238,7 @@ describe('resolveEnvironment', () => { await expect( resolveDeveloperEnvironment({ env: { - POLYMORFA_PROJECT_TOKEN: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, project: PROJECT, }), @@ -269,8 +249,7 @@ describe('resolveEnvironment', () => { expect( resolveEnvironment({ env: { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_BASE_URL: 'http://127.0.0.1:4567', UNRELATED_SECRET: 'do-not-copy', }, @@ -281,8 +260,7 @@ describe('resolveEnvironment', () => { surface: 'platform', credential: { type: 'apiKey', - value: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + value: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, baseUrl: 'http://127.0.0.1:4567', timeoutMs: 5000, @@ -292,7 +270,7 @@ describe('resolveEnvironment', () => { test('rejects a client token for the Platform surface', () => { expect(() => resolveEnvironment({ - env: {POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser'}, + env: {POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy'}, surface: 'platform', }), ).toThrow('Platform API requests require POLYMORFA_API_KEY.') @@ -301,12 +279,12 @@ describe('resolveEnvironment', () => { test('resolves a client token for the Messaging surface', () => { expect( resolveEnvironment({ - env: {POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser'}, + env: {POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy'}, surface: 'messaging', }), ).toEqual({ surface: 'messaging', - credential: {type: 'clientToken', value: 'pmfa_ct_browser'}, + credential: {type: 'clientToken', value: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy'}, }) }) @@ -314,8 +292,7 @@ describe('resolveEnvironment', () => { expect( resolveEnvironment({ env: { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, surface: 'messaging', }), @@ -323,8 +300,7 @@ describe('resolveEnvironment', () => { surface: 'messaging', credential: { type: 'apiKey', - value: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + value: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, }) }) @@ -333,9 +309,8 @@ describe('resolveEnvironment', () => { expect(() => resolveEnvironment({ env: { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', - POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_browser', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', + POLYMORFA_CLIENT_TOKEN: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', }, surface: 'messaging', }), @@ -466,16 +441,13 @@ describe('resolveEnvironment', () => { }) test('prefers an environment credential over the active profile', async () => { - const credentials = fakeCredentials( - 'pmfa_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', - ) + const credentials = fakeCredentials('pmfa_AQIDBAUGBwgJCgsMDQ4PEBESExRXid_4') await expect( resolveCommandEnvironment( { env: { - POLYMORFA_API_KEY: - 'pmfa_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC', + POLYMORFA_API_KEY: 'pmfa_AgMEBQYHCAkKCwwNDg8QERITFBXd5SUP', }, surface: 'platform', }, @@ -485,8 +457,7 @@ describe('resolveEnvironment', () => { ).resolves.toMatchObject({ credential: { type: 'apiKey', - value: - 'pmfa_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC', + value: 'pmfa_AgMEBQYHCAkKCwwNDg8QERITFBXd5SUP', }, source: 'environment', }) @@ -498,15 +469,12 @@ describe('resolveEnvironment', () => { resolveCommandEnvironment( {env: {}, surface: 'platform'}, fakeProfiles(), - fakeCredentials( - 'pmfa_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', - ), + fakeCredentials('pmfa_AQIDBAUGBwgJCgsMDQ4PEBESExRXid_4'), ), ).resolves.toMatchObject({ credential: { type: 'apiKey', - value: - 'pmfa_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', + value: 'pmfa_AQIDBAUGBwgJCgsMDQ4PEBESExRXid_4', }, profile: 'work', source: 'profile', @@ -518,22 +486,18 @@ describe('resolveEnvironment', () => { resolveCommandEnvironment( { env: { - POLYMORFA_API_KEY: - 'pmfa_CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC', + POLYMORFA_API_KEY: 'pmfa_AgMEBQYHCAkKCwwNDg8QERITFBXd5SUP', }, profile: 'work', surface: 'messaging', }, fakeProfiles(), - fakeCredentials( - 'pmfa_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', - ), + fakeCredentials('pmfa_AQIDBAUGBwgJCgsMDQ4PEBESExRXid_4'), ), ).resolves.toMatchObject({ credential: { type: 'apiKey', - value: - 'pmfa_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', + value: 'pmfa_AQIDBAUGBwgJCgsMDQ4PEBESExRXid_4', }, profile: 'work', source: 'profile', @@ -542,8 +506,7 @@ describe('resolveEnvironment', () => { }) describe('resolveDeveloperEnvironment owner inference', () => { - const key = - 'pmfa_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB' + const key = 'pmfa_AQIDBAUGBwgJCgsMDQ4PEBESExRXid_4' test('reads the whole organization despite a saved project profile', async () => { const config: ProfileConfig = { @@ -610,8 +573,7 @@ describe('resolveDeveloperEnvironment owner inference', () => { resolveDeveloperEnvironment( { env: { - POLYMORFA_PROJECT_TOKEN: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, inferOwner: true, }, @@ -639,18 +601,18 @@ function fakeProject(slug: string, id: string = PROJECT): ProjectWithStats { return { _creationTime: 0, _id: id, - activeSessions: 0, + activeConnections: 0, defaultTier: 'free', icon: {type: 'emoji', value: 'x'}, iconUrl: null, isActive: true, lastActivity: null, name: slug, - orgId: '33333333-3333-4333-8333-333333333333', + teamId: '33333333-3333-4333-8333-333333333333', slug, stage: 'development', totalMessages: 0, - totalSessions: 0, + totalConnections: 0, } } @@ -678,7 +640,7 @@ function fakeCredentials(value: string): CredentialStore { } } -const PROJECT_TOKEN = `pmfa_pt_${'A'.repeat(94)}` +const PROJECT_TOKEN = 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' function projectProfiles() { const config: ProfileConfig = { version: 2, diff --git a/test/developer/client.test.ts b/test/developer/client.test.ts index 6abdfa6c..111f753d 100644 --- a/test/developer/client.test.ts +++ b/test/developer/client.test.ts @@ -1,52 +1,50 @@ import {Client} from '@polymorfa/sdk' import {describe, expect, test, vi} from 'vitest' -import {createDeveloperSession} from '../../src/developer/client.js' +import {createDeveloperConnection} from '../../src/developer/client.js' import {withEnvironment} from '../helpers/http-server.js' -describe('createDeveloperSession', () => { +describe('createDeveloperConnection', () => { test('ignores a broken project link for organization-owned resources', async () => { const loadLinkedProject = vi.fn(() => Promise.reject(new Error('Broken project link')), ) - const session = await withEnvironment( + const connection = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_PROJECT_TOKEN: undefined, }, () => - createDeveloperSession( + createDeveloperConnection( {owner: 'organization'}, undefined, loadLinkedProject, ), ) - expect(session.context.owner).toBe('organization') + expect(connection.context.owner).toBe('organization') expect(loadLinkedProject).not.toHaveBeenCalled() }) test('creates an immutable project view from an organization key', async () => { - const session = await withEnvironment( + const connection = await withEnvironment( { - POLYMORFA_API_KEY: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_API_KEY: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_PROJECT_TOKEN: undefined, }, () => - createDeveloperSession({ + createDeveloperConnection({ owner: 'project', project: PROJECT, }), ) - expect(session.client).toBeInstanceOf(Client) - expect(session.client.owner).toBe('project') - expect(session.client.projectId).toBe(PROJECT) - expect(session.context).toMatchObject({ + expect(connection.client).toBeInstanceOf(Client) + expect(connection.client.owner).toBe('project') + expect(connection.client.projectId).toBe(PROJECT) + expect(connection.context).toMatchObject({ owner: 'project', principalType: 'organization_key', projectId: PROJECT, @@ -54,24 +52,23 @@ describe('createDeveloperSession', () => { }) test('constructs a project-root client for an exact project token', async () => { - const session = await withEnvironment( + const connection = await withEnvironment( { POLYMORFA_API_KEY: undefined, POLYMORFA_CLIENT_TOKEN: undefined, - POLYMORFA_PROJECT_TOKEN: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + POLYMORFA_PROJECT_TOKEN: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, () => - createDeveloperSession({ + createDeveloperConnection({ owner: 'project', project: PROJECT, }), ) - expect(session.client).toBeInstanceOf(Client) - expect(session.client.owner).toBe('project') - expect(session.client.projectId).toBe(PROJECT) - expect(session.context.principalType).toBe('project_token') + expect(connection.client).toBeInstanceOf(Client) + expect(connection.client.owner).toBe('project') + expect(connection.client.projectId).toBe(PROJECT) + expect(connection.context.principalType).toBe('project_token') }) }) diff --git a/test/developer/render.test.ts b/test/developer/render.test.ts index a5445800..8fbb50bc 100644 --- a/test/developer/render.test.ts +++ b/test/developer/render.test.ts @@ -43,7 +43,7 @@ describe('developer detail renderers', () => { const text = renderWebhookDetail({ createdAt: '2026-09-08T00:00:00Z', enabled: true, - eventTypes: ['message.received', 'session.connected'], + eventTypes: ['message.received', 'connection.connected'], format: 'native', headers: [{name: 'x-team'}], id: 'wh_1', @@ -59,7 +59,7 @@ describe('developer detail renderers', () => { 'URL\thttps://hooks.example.test/polymorfa', 'Enabled\ttrue', 'Format\tnative', - 'Event types\tmessage.received, session.connected', + 'Event types\tmessage.received, connection.connected', 'Phone offline warning\toff', 'Header names\tx-team', 'Created\t2026-09-08T00:00:00Z', @@ -71,7 +71,7 @@ describe('developer detail renderers', () => { const base = { createdAt: '2026-09-08T00:00:00Z', enabled: true, - eventTypes: ['session.phone_offline'], + eventTypes: ['connection.phone_offline'], format: 'native', headers: [], id: 'wh_1', diff --git a/test/fixtures/event-stream-blocked-output.ts b/test/fixtures/event-stream-blocked-output.ts index 579159c0..987fad06 100644 --- a/test/fixtures/event-stream-blocked-output.ts +++ b/test/fixtures/event-stream-blocked-output.ts @@ -2,7 +2,7 @@ import {fileURLToPath} from 'node:url' import EventStream from '../../src/commands/event/stream.js' -Object.defineProperty(EventStream.prototype, 'developerSession', { +Object.defineProperty(EventStream.prototype, 'developerConnection', { value: () => Promise.resolve({ context: {owner: 'project'}, diff --git a/test/input/stdin.test.ts b/test/input/stdin.test.ts index abaa3e46..5e691800 100644 --- a/test/input/stdin.test.ts +++ b/test/input/stdin.test.ts @@ -7,13 +7,9 @@ describe('readSecretFromStdin', () => { test('reads one trimmed secret without returning extra input', async () => { await expect( readSecretFromStdin( - Readable.from([ - ' pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n', - ]), + Readable.from([' pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k\n']), ), - ).resolves.toBe( - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', - ) + ).resolves.toBe('pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k') }) test('rejects empty and oversized input', async () => { diff --git a/test/listener/forwarding.test.ts b/test/listener/forwarding.test.ts index 4bcddb38..a7d97040 100644 --- a/test/listener/forwarding.test.ts +++ b/test/listener/forwarding.test.ts @@ -39,7 +39,7 @@ describe('local event forwarding', () => { }) for (const value of [ 'Authorization: Bearer hidden', - 'Cookie: session=hidden', + 'Cookie: connection=hidden', 'Content-Length: 0', 'Polymorfa-Local-Signature: forged', 'X-Mode: ok\r\nInjected: true', diff --git a/test/mcp/session-discovery.test.ts b/test/mcp/connection-discovery.test.ts similarity index 75% rename from test/mcp/session-discovery.test.ts rename to test/mcp/connection-discovery.test.ts index 0c7dcc87..b39202ec 100644 --- a/test/mcp/session-discovery.test.ts +++ b/test/mcp/connection-discovery.test.ts @@ -1,6 +1,6 @@ import {afterEach, describe, expect, test} from 'vitest' -import {listMcpSessions} from '../../src/mcp/session-discovery.js' +import {listMcpConnections} from '../../src/mcp/connection-discovery.js' import { startHttpServer, withEnvironment, @@ -8,9 +8,9 @@ import { } from '../helpers/http-server.js' const PROJECT_ID = '11111111-1111-4111-8111-111111111111' -const API_KEY = `pmfa_${'A'.repeat(72)}` +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' -describe('MCP session discovery', () => { +describe('MCP connection discovery', () => { let server: TestHttpServer | undefined afterEach(async () => { @@ -18,13 +18,13 @@ describe('MCP session discovery', () => { server = undefined }) - test('reads one project and returns only non-secret session fields', async () => { + test('reads one project and returns only non-secret connection fields', async () => { server = await startHttpServer({ body: { data: [ { projectId: PROJECT_ID, - sessionId: 'session_1', + connectionId: 'session_1', name: 'Support', status: 'CONNECTED', testMode: false, @@ -33,7 +33,7 @@ describe('MCP session discovery', () => { }, ], }, - headers: {'request-id': 'req_sessions'}, + headers: {'request-id': 'req_connections'}, }) const result = await withEnvironment( @@ -43,26 +43,26 @@ describe('MCP session discovery', () => { POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_BASE_URL: server.baseUrl, }, - () => listMcpSessions(PROJECT_ID), + () => listMcpConnections(PROJECT_ID), ) expect(result).toEqual({ - sessions: [ + connections: [ { - sessionId: 'session_1', + connectionId: 'session_1', name: 'Support', status: 'CONNECTED', testMode: false, }, ], status: 200, - requestId: 'req_sessions', + requestId: 'req_connections', }) expect(JSON.stringify(result)).not.toMatch( /phone|secret-value|\+49123456789/, ) expect(server.requests.map(({method, url}) => `${method} ${url}`)).toEqual([ - `GET /platform/sessions?projectId=${PROJECT_ID}`, + `GET /platform/connections?projectId=${PROJECT_ID}`, ]) expect(server.requests[0]?.headers.authorization).toBe(`Bearer ${API_KEY}`) }) @@ -77,7 +77,7 @@ describe('MCP session discovery', () => { POLYMORFA_CLIENT_TOKEN: undefined, POLYMORFA_BASE_URL: server.baseUrl, }, - () => listMcpSessions(PROJECT_ID), + () => listMcpConnections(PROJECT_ID), ), ).rejects.toThrow('Select only one organization API key') expect(server.requests).toHaveLength(0) diff --git a/test/mcp/server.test.ts b/test/mcp/server.test.ts index 17dc44ed..0c880fd8 100644 --- a/test/mcp/server.test.ts +++ b/test/mcp/server.test.ts @@ -11,7 +11,7 @@ describe('MCP stdio server', () => { afterEach(async () => close?.()) - test('negotiates listener controls and project-scoped session discovery', async () => { + test('negotiates listener controls and project-scoped connection discovery', async () => { const input = new PassThrough() const output = new PassThrough() const transport = new StdioServerTransport(input, output) @@ -19,7 +19,7 @@ describe('MCP stdio server', () => { async () => new Promise<never>(() => {}), ) const handle = serveMcp(manager, '0.1.0-test', transport, () => - Promise.resolve({sessions: [], status: 200}), + Promise.resolve({connections: [], status: 200}), ) close = () => handle.close() @@ -58,7 +58,7 @@ describe('MCP stdio server', () => { 'polymorfa_listen_start', 'polymorfa_listen_status', 'polymorfa_listen_stop', - 'polymorfa_session_list', + 'polymorfa_connection_list', ]) const start = ( messages[1] as { @@ -76,7 +76,7 @@ describe('MCP stdio server', () => { expect(pattern.test('11111111-1111-4111-8111-111111111111')).toBe(true) expect(pattern.test('project_123')).toBe(false) expect(pattern.test('11111111-1111-4111-8111-11111111111G')).toBe(false) - const sessions = ( + const connections = ( messages[1] as { result: { tools: Array<{ @@ -86,16 +86,16 @@ describe('MCP stdio server', () => { }> } } - ).result.tools.find(({name}) => name === 'polymorfa_session_list') - expect(sessions?.annotations?.readOnlyHint).toBe(true) + ).result.tools.find(({name}) => name === 'polymorfa_connection_list') + expect(connections?.annotations?.readOnlyHint).toBe(true) expect( new RegExp( - sessions?.inputSchema.properties.projectId?.pattern ?? '', + connections?.inputSchema.properties.projectId?.pattern ?? '', ).test('project_123'), ).toBe(false) }) - test('returns only curated session fields and hides failures', async () => { + test('returns only curated connection fields and hides failures', async () => { const input = new PassThrough() const output = new PassThrough() const transport = new StdioServerTransport(input, output) @@ -110,9 +110,9 @@ describe('MCP stdio server', () => { return Promise.reject(new Error('Bearer pmfa_secret_value')) } return Promise.resolve({ - sessions: [ + connections: [ { - sessionId: 'session_1', + connectionId: 'session_1', name: 'Support', status: 'CONNECTED', testMode: false, @@ -145,7 +145,7 @@ describe('MCP stdio server', () => { id: 2, jsonrpc: '2.0', method: 'tools/call', - params: {name: 'polymorfa_session_list', arguments: {projectId}}, + params: {name: 'polymorfa_connection_list', arguments: {projectId}}, })}\n`, ) await waitFor(messages, 2) @@ -153,7 +153,7 @@ describe('MCP stdio server', () => { id: 2, result: { structuredContent: { - sessions: [{sessionId: 'session_1', status: 'CONNECTED'}], + connections: [{connectionId: 'session_1', status: 'CONNECTED'}], status: 200, }, }, @@ -165,7 +165,7 @@ describe('MCP stdio server', () => { id: 3, jsonrpc: '2.0', method: 'tools/call', - params: {name: 'polymorfa_session_list', arguments: {projectId}}, + params: {name: 'polymorfa_connection_list', arguments: {projectId}}, })}\n`, ) await waitFor(messages, 3) diff --git a/test/sdk/client.test.ts b/test/sdk/client.test.ts index ef7a8423..efa4f563 100644 --- a/test/sdk/client.test.ts +++ b/test/sdk/client.test.ts @@ -20,8 +20,7 @@ describe('createRawClient', () => { surface: 'platform', credential: { type: 'apiKey', - value: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + value: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, }) @@ -31,7 +30,7 @@ describe('createRawClient', () => { test('returns the public Messaging raw client', () => { const client = createRawClient({ surface: 'messaging', - credential: {type: 'clientToken', value: 'pmfa_ct_browser'}, + credential: {type: 'clientToken', value: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy'}, }) expect(client).toBeInstanceOf(RawClient) @@ -41,27 +40,27 @@ describe('createRawClient', () => { expect(() => createRawClient({ surface: 'platform', - credential: {type: 'clientToken', value: 'pmfa_ct_browser'}, + credential: { + type: 'clientToken', + value: 'pmfa_ct_cG1mYV9jdF9icm93c2Vy', + }, }), - ).toThrow( - 'Client and project tokens cannot be used as organization server API keys.', - ) + ).toThrow('Client and project tokens cannot be used as team keys.') }) - test('creates a typed Messaging client with session and operation resources', () => { + test('creates a typed Messaging client with connection and operation resources', () => { const client = createMessagingClient({ surface: 'messaging', credential: { type: 'apiKey', - value: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + value: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, timeoutMs: 1234, }) expect(client).toBeInstanceOf(MessagingClient) - expect(client.sessions).toHaveProperty('qr') - expect(client.sessions).toHaveProperty('requestPairingCode') + expect(client.connections).toHaveProperty('qr') + expect(client.connections).toHaveProperty('requestPairingCode') expect(client.quickLinks).toHaveProperty('create') expect(client.quickLinks).toHaveProperty('retrieve') expect(client.quickLinks).toHaveProperty('cancel') @@ -72,8 +71,7 @@ describe('createRawClient', () => { const client = createMessagingClient({ credential: { type: 'projectToken', - value: - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + value: 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, surface: 'messaging', }) @@ -87,31 +85,29 @@ describe('createRawClient', () => { surface: 'platform', credential: { type: 'apiKey', - value: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + value: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, }) expect(client).toBeInstanceOf(Client) - expect(client.owner).toBe('organization') + expect(client.owner).toBe('team') expect(client.billing).toHaveProperty('retrieve') expect(client.billing).toHaveProperty('usage') expect(client.billing).toHaveProperty('listTransactions') expect(client.billing).toHaveProperty('listPricing') expect(client.billing).not.toHaveProperty('updateReminderSettings') - expect(client.sessions).toHaveProperty('retrieve') - expect(client.sessions).toHaveProperty('update') - expect(client.sessions).toHaveProperty('quoteTierChange') - expect(client.sessions).toHaveProperty('retrieveTierChange') - expect(client.organizations).not.toHaveProperty('update') + expect(client.connections).toHaveProperty('retrieve') + expect(client.connections).toHaveProperty('update') + expect(client.connections).toHaveProperty('quoteTierChange') + expect(client.connections).toHaveProperty('retrieveTierChange') + expect(client.teams).not.toHaveProperty('update') expect(() => createPlatformClient({ surface: 'messaging', credential: { type: 'apiKey', - value: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + value: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, }), ).toThrow('requires the Platform API surface') @@ -127,8 +123,7 @@ describe('createRawClient', () => { baseUrl: server.baseUrl, credential: { type: 'apiKey', - value: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + value: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, surface: 'platform', }).project('11111111-1111-4111-8111-111111111111') @@ -143,7 +138,7 @@ describe('createRawClient', () => { url: '/platform/projects/11111111-1111-4111-8111-111111111111/events?limit=25', }) expect(server.requests[0]?.headers.authorization).toBe( - 'Bearer pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'Bearer pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', ) } finally { await server.close() @@ -157,17 +152,17 @@ describe('typed webhook events', () => { event: 'command.result', id: 'evt_123', payload: { - command: 'session.start', + command: 'connection.start', requestId: 'req_123', success: true, }, - session: 'session_123', + connection: 'connection_123', timestamp: '2026-08-19T18:00:00.000Z', } expect(isEvent(event, 'command.result')).toBe(true) if (isEvent(event, 'command.result')) { - expect(event.payload.command).toBe('session.start') + expect(event.payload.command).toBe('connection.start') expect(event.payload.success).toBe(true) } expect(isEvent(event, 'message.received')).toBe(false) diff --git a/test/services/auth.test.ts b/test/services/auth.test.ts index d0501c27..6328bc6a 100644 --- a/test/services/auth.test.ts +++ b/test/services/auth.test.ts @@ -9,8 +9,7 @@ describe('AuthService', () => { const fixture = createFixture() const result = await fixture.service.login({ - apiKey: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + apiKey: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', profile: 'work', }) @@ -21,7 +20,7 @@ describe('AuthService', () => { }) expect(fixture.credentials.set).toHaveBeenCalledWith( 'profile:work:apiKey', - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', ) expect(fixture.saved()).toEqual({ activeProfile: 'work', @@ -33,7 +32,7 @@ describe('AuthService', () => { version: 2, }) expect(JSON.stringify(fixture.saved())).not.toContain( - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', ) }) @@ -42,8 +41,7 @@ describe('AuthService', () => { await expect( fixture.service.login({ - apiKey: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + apiKey: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', profile: '../work', }), ).rejects.toThrow('Profile names may contain') @@ -55,13 +53,13 @@ describe('AuthService', () => { await expect( fixture.service.login({apiKey: 'secret', profile: 'work'}), - ).rejects.toThrow('must use the canonical pmfa_ v1 format') + ).rejects.toThrow('must use the canonical pmfa_ opaque format') expect(fixture.credentials.set).not.toHaveBeenCalled() }) test('stores an exact-project token only with explicit project ownership', async () => { const fixture = createFixture() - const token = `pmfa_pt_${'A'.repeat(94)}` + const token = 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' await expect( fixture.service.loginProjectToken({ @@ -88,13 +86,12 @@ describe('AuthService', () => { await fixture.service.loginProjectToken({ profile: 'project', project: 'project_1', - projectToken: - ' pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ', + projectToken: ' pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k ', }) expect(fixture.credentials.set).toHaveBeenCalledWith( 'profile:project:projectToken', - 'pmfa_pt_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', ) await expect( fixture.service.loginProjectToken({ @@ -102,7 +99,7 @@ describe('AuthService', () => { project: 'project_1', projectToken: 'pmfa_pt_', }), - ).rejects.toThrow('canonical pmfa_pt_ v1 format') + ).rejects.toThrow('canonical [REDACTED] opaque format') }) test('removes the previous project-token keyring entry after switching a profile to an API key', async () => { @@ -120,12 +117,11 @@ describe('AuthService', () => { version: 2, }) vi.mocked(fixture.credentials.get).mockResolvedValue( - `pmfa_pt_${'A'.repeat(94)}`, + 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', ) await fixture.service.login({ - apiKey: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + apiKey: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', profile: 'work', }) @@ -157,7 +153,7 @@ describe('AuthService', () => { }, version: 2, }) - const oldToken = `pmfa_pt_${'A'.repeat(94)}` + const oldToken = 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' vi.mocked(fixture.credentials.get).mockResolvedValue(oldToken) vi.mocked(fixture.repository.save).mockRejectedValue( new Error('profile save failed'), @@ -165,8 +161,7 @@ describe('AuthService', () => { await expect( fixture.service.login({ - apiKey: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + apiKey: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', profile: 'work', }), ).rejects.toThrow('profile save failed') @@ -216,7 +211,7 @@ describe('AuthService', () => { test('switches the active profile and reports secure credential availability', async () => { const fixture = createFixture(profileConfig()) vi.mocked(fixture.credentials.get).mockResolvedValue( - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', ) await expect(fixture.service.use('work')).resolves.toMatchObject({ @@ -250,7 +245,7 @@ describe('AuthService', () => { version: 2, }) vi.mocked(fixture.credentials.get).mockResolvedValue( - `pmfa_pt_${'A'.repeat(94)}`, + 'pmfa_pt_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', ) await expect(fixture.service.status('project')).resolves.toMatchObject({ diff --git a/test/services/call-consent.test.ts b/test/services/call-consent.test.ts index e770d93e..3da7ae8b 100644 --- a/test/services/call-consent.test.ts +++ b/test/services/call-consent.test.ts @@ -223,7 +223,7 @@ describe('rendering', () => { [ 'Allowed\tno', 'Refusal\tcalls_disabled', - 'Call permission\tnot used on linked-device numbers', + 'Call permission\tnot used on linked-device connections', ].join('\n'), ) }) @@ -233,7 +233,7 @@ function fakeClient( requests: ImportCallOptOutsInput[], result: CallOptOutImportResult, failAfterFirst?: Error, -): ClientInstance<'organization'> { +): ClientInstance<'team'> { return { callOptOuts: { import(input: ImportCallOptOutsInput) { @@ -247,5 +247,5 @@ function fakeClient( }) }, }, - } as unknown as ClientInstance<'organization'> + } as unknown as ClientInstance<'team'> } diff --git a/test/services/call-retention.test.ts b/test/services/call-retention.test.ts index dfe71638..8d22c512 100644 --- a/test/services/call-retention.test.ts +++ b/test/services/call-retention.test.ts @@ -28,7 +28,7 @@ describe('call retention changes', () => { const {client} = fakeClient() client.retrieve = () => Promise.reject( - new PolymorfaAuthorizationError('Missing sessions:read', { + new PolymorfaAuthorizationError('Missing connections:read', { code: 'forbidden', status: 403, requestId: 'req_retention', diff --git a/test/services/doctor.test.ts b/test/services/doctor.test.ts index 67337e1d..653110b4 100644 --- a/test/services/doctor.test.ts +++ b/test/services/doctor.test.ts @@ -9,8 +9,7 @@ import type {CredentialStore} from '../../src/config/credentials.js' import type {ProfileConfig} from '../../src/config/profiles.js' import {runDoctor, type DoctorDependencies} from '../../src/services/doctor.js' -const KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const config: ProfileConfig = { activeProfile: 'work', profiles: { diff --git a/test/services/groups.test.ts b/test/services/groups.test.ts index 6306df2c..71bd0c00 100644 --- a/test/services/groups.test.ts +++ b/test/services/groups.test.ts @@ -26,13 +26,13 @@ describe('group read services', () => { headers: {'request-id': 'req_groups'}, }) - const result = await listGroups(client(server.baseUrl), 'session/main') + const result = await listGroups(client(server.baseUrl), 'connection/main') expect(result).toEqual({ data: [group], metadata: {attempts: 1, requestId: 'req_groups', status: 200}, }) - expect(server.requests[0]?.url).toBe('/messaging/session%2Fmain/groups') + expect(server.requests[0]?.url).toBe('/messaging/connection%2Fmain/groups') }) test('retrieves a group and its participants through encoded identifiers', async () => { @@ -40,10 +40,10 @@ describe('group read services', () => { server = await startHttpServer({body: {data: group, success: true}}) await expect( - viewGroup(client(server.baseUrl), 'session/main', '123@g.us'), + viewGroup(client(server.baseUrl), 'connection/main', '123@g.us'), ).resolves.toMatchObject({data: group}) expect(server.requests[0]?.url).toBe( - '/messaging/session%2Fmain/groups/123%40g.us', + '/messaging/connection%2Fmain/groups/123%40g.us', ) await server.close() @@ -51,7 +51,11 @@ describe('group read services', () => { body: {data: group.participants, success: true}, }) await expect( - listGroupParticipants(client(server.baseUrl), 'session/main', '123@g.us'), + listGroupParticipants( + client(server.baseUrl), + 'connection/main', + '123@g.us', + ), ).resolves.toMatchObject({data: group.participants}) }) @@ -73,12 +77,12 @@ describe('group read services', () => { server = await startHttpServer({body: {success: true, data}}) const response = await getGroupCapabilities( client(server.baseUrl), - 'session/main', + 'connection/main', '9007199254740993', ) expect(response.data).toEqual(data) expect(server.requests[0]?.url).toBe( - '/messaging/session%2Fmain/groups/9007199254740993/capabilities', + '/messaging/connection%2Fmain/groups/9007199254740993/capabilities', ) expect(renderGroupCapabilities(data)).toContain( 'polls.endTime\tunknown\tunknown', @@ -106,8 +110,7 @@ function client(baseUrl: string) { baseUrl, credential: { type: 'apiKey', - value: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + value: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, surface: 'messaging', }) diff --git a/test/services/new-chat-cap-render.test.ts b/test/services/new-chat-cap-render.test.ts index 30ee5d8d..d007f301 100644 --- a/test/services/new-chat-cap-render.test.ts +++ b/test/services/new-chat-cap-render.test.ts @@ -1,10 +1,10 @@ -import type {Session} from '@polymorfa/sdk' +import type {Connection} from '@polymorfa/sdk' import {describe, expect, test} from 'vitest' -import {renderManagedSession} from '../../src/services/platform-management.js' +import {renderManagedConnection} from '../../src/services/platform-management.js' const base = { - sessionId: 'session_1', + connectionId: 'session_1', name: 'Support', tenantId: 'team_1', type: 'linked_device', @@ -12,16 +12,16 @@ const base = { status: 'CONNECTED', createdAt: '2026-09-26T00:00:00.000Z', updatedAt: '2026-09-27T00:00:00.000Z', -} as unknown as Session +} as unknown as Connection const cap = (newChatCapping: unknown) => - renderManagedSession({...base, newChatCapping} as unknown as Session) + renderManagedConnection({...base, newChatCapping} as unknown as Connection) .split('\n') .find((line) => line.startsWith('New-chat cap')) -describe('session view new-chat cap line', () => { +describe('connection view new-chat cap line', () => { test('omits the line when the API returned no field', () => { - expect(renderManagedSession(base)).not.toContain('New-chat cap') + expect(renderManagedConnection(base)).not.toContain('New-chat cap') }) test('describes each WhatsApp state', () => { diff --git a/test/services/projects.test.ts b/test/services/projects.test.ts index b27158da..fa65cc8d 100644 --- a/test/services/projects.test.ts +++ b/test/services/projects.test.ts @@ -17,8 +17,7 @@ import { } from '../../src/context/environment.js' import {ProjectContextService} from '../../src/services/projects.js' -const API_KEY = - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +const API_KEY = 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k' const APP = '11111111-1111-4111-8111-111111111111' const WEB = '22222222-2222-4222-8222-222222222222' @@ -320,17 +319,17 @@ function project(id: string, slug: string, name: string) { return { _creationTime: 0, _id: id, - activeSessions: 0, + activeConnections: 0, defaultTier: 'standard', icon: {}, iconUrl: null, isActive: true, lastActivity: null, name, - orgId: 'org_1', + teamId: 'org_1', slug, stage: 'development', totalMessages: 0, - totalSessions: 0, + totalConnections: 0, } } diff --git a/test/services/voice.test.ts b/test/services/voice.test.ts index c4d8744a..abd30a89 100644 --- a/test/services/voice.test.ts +++ b/test/services/voice.test.ts @@ -145,8 +145,7 @@ describe('voice transfers', () => { baseUrl: 'https://api.example.test', credential: { type: 'apiKey' as const, - value: - 'pmfa_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + value: 'pmfa_AAECAwQFBgcICQoLDA0ODxAREhM73f-k', }, surface: 'platform' as const, ...(timeoutMs === undefined ? {} : {timeoutMs}),