@ovra/ts-sdk 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,9 +8,10 @@ infrastructure for AI agents. Issue virtual Visa cards, declare and approve
8
8
  spending intents, settle payments under signed mandates, and reconcile from
9
9
  the same typed surface.
10
10
 
11
- **Version: `0.4.1`** — fully bound to the `/v1/*` API. Auto-published
12
- from `apps/api/openapi.json` on every push to `main` that touches the
13
- spec or `packages/sdk/src`; see the repo
11
+ **Version: `0.5.0`** — fully bound to the `/v1/*` API. Regenerated
12
+ from `apps/api/openapi.json`; releases ship manually for now (see
13
+ [Publishing](#publishing) below auto-publish is wired but pending
14
+ on GH Actions billing). See the repo
14
15
  [CHANGELOG](https://github.com/ovra/ovra/blob/main/CHANGELOG.md) for the
15
16
  v0 → v1 migration notes.
16
17
 
@@ -341,40 +342,154 @@ await ovra.agenticCommerce.refundOrder({
341
342
 
342
343
  ## Resource coverage
343
344
 
344
- `Ovra` binds the highest-traffic resources as ergonomic namespaces. The
345
- full v1 surface (103 paths, ~145 operations) is also available as
346
- tree-shakable functions via `import { … } from "@ovra/ts-sdk/api"` —
347
- use those directly for the long-tail resources not in the table below.
345
+ `Ovra` binds every `/v1/*` resource as an ergonomic namespace
346
+ 33 namespaces, 141 operations total, all of them auto-typed from the
347
+ generated client. Listed by domain:
348
+
349
+ ### Money
350
+
351
+ - `wallets` — `list`, `create`, `get`, `update`, `delete`
352
+ - `transfers` — `list`, `create`, `get`
353
+ - `beneficiaries` — `list`, `create`, `get`, `update`, `delete`
354
+ - `refunds` — `list`, `create`, `get`
355
+ - `paymentRequests` — `list`, `create`, `get`, `cancel`
356
+ - `ledgerEntries` — `list`, `get` (double-entry ledger, read-only)
357
+ - `billing` — `getSubscription`, `createSubscription`,
358
+ `createPortalSession`, `getPaymentMethod`, `setupPaymentMethod`,
359
+ `fundWallet`, `getSepaInstructions`, `getBalance`, `collectOverage`
360
+ - `invoices` — `list`, `get`
361
+
362
+ ### Agents & spending
363
+
364
+ - `agents` — `list`, `create`, `get`, `update`, `delete`, `freeze`,
365
+ `unfreeze`, `getByExternalId`
366
+ - `cards` — `list`, `create`, `get`, `update`, `freeze`, `unfreeze`,
367
+ `close`, `rotate`
368
+ - `intents` — `list`, `create`, `get`, `approve`, `deny`, `cancel`,
369
+ `issueCredentials`, `confirmPayment`
370
+ - `transactions` — `list`, `get` (read-only)
371
+ - `checkout` — `execute`, `confirm`
372
+ - `agenticCommerce` — `listVerticals`, `search`, `getOffer`,
373
+ `getMerchantJwk`, `buy`, `listOrders`, `getOrder`, `verifyOrder`,
374
+ `refundOrder`
375
+ - `runs` — `create`, `get`
376
+ - `outcomes` — `list`, `create`, `get`
377
+ - `forecast` — `get`
378
+ - `pay()` — one-call buy convenience wrapper around
379
+ `agenticCommerce.buy`
380
+
381
+ ### Compliance & governance
382
+
383
+ - `policies` — `list`, `create`, `get`, `update`, `delete`, `apply`
384
+ - `approvalPolicies` — `create`, `get`, `update`, `delete`
385
+ - `disputes` — `list`, `create`, `get`, `resolve`, `listEvidence`,
386
+ `addEvidence` (nested per-dispute)
387
+ - `disputeEvidence` — `list`, `create` (standalone file uploads)
388
+ - `riskEvents` — `list`, `listViolations`, `listFraudAlerts`,
389
+ `updateFraudAlert`, `getAgentRisk`, `unfreezeAgent`, `getConfig`,
390
+ `updateConfig`, `getSummary`
391
+ - `auditEvents` — `list`, `get`, `verifyChain` (tamper-evident)
392
+ - `accessEvents` — `list`, `get`
393
+ - `metrics` — `list`
394
+
395
+ ### Identity & access
396
+
397
+ - `customers` — `me`, `create`, `get`, `update`
398
+ - `apiKeys` — `list`, `create`, `get`, `delete` (requires `sk_*` scope)
399
+ - `delegations` — `list`, `create`, `get`, `delete` (mint `at_*` tokens)
400
+ - `passkeys` — `list`, `revoke`
401
+ - `merchantCategories` — `list`, `get` (MCC lookup)
402
+
403
+ ### Webhooks & notifications
404
+
405
+ - `webhooks` — `list`, `create`, `get`, `update`, `delete`,
406
+ `rotateSecret`, `ping`, `listDeliveries`
407
+ - `notifications` — `list`, `unreadCount`, `markRead`, `markAllRead`
408
+ (user-scoped — token credential, not `sk_*`)
409
+ - `pushSubscriptions` — `getVapidPublicKey`, `register`, `delete`
410
+ (Web Push for the approve PWA)
411
+
412
+ ### Scope requirements
413
+
414
+ Most write namespaces require an `sk_*` workspace key. The following
415
+ will 403 with a restricted (`rk_*`) or agent (`at_*`) token:
416
+
417
+ - `apiKeys.*`, `delegations.create|delete`, `webhooks.*` mutations,
418
+ `policies.*` mutations, `approvalPolicies.*`, `billing.*` mutations,
419
+ `riskEvents.updateConfig|unfreezeAgent`, `customers.create|update`
420
+
421
+ Reads on those surfaces are allowed with `rk_*`. `notifications`,
422
+ `pushSubscriptions`, and `passkeys` are user-scoped — they want a
423
+ session credential, not a workspace key.
424
+
425
+ ### Plan requirements
426
+
427
+ A handful of namespaces are gated on the workspace's billing plan and
428
+ will throw `E_PLAN_UPGRADE_REQUIRED` (HTTP 402) or
429
+ `E_PERMISSION_DENIED` (HTTP 403) on Starter:
430
+
431
+ - **Business plan or higher** — `auditEvents.*`, `metrics.*`,
432
+ `riskEvents.*`, `delegations.*`
433
+
434
+ Catch the error and surface the upgrade prompt:
348
435
 
349
- Bound on the `Ovra` instance:
436
+ ```ts
437
+ try {
438
+ await ovra.auditEvents.list();
439
+ } catch (err) {
440
+ if (err instanceof OvraError && err.code === "E_PLAN_UPGRADE_REQUIRED") {
441
+ // route the user to getovra.com/dashboard/billing
442
+ }
443
+ }
444
+ ```
350
445
 
351
- - **Agents & auth** — `agents`, `passkeys`
352
- - **Spending** — `intents`, `cards`, `checkout`, `agenticCommerce`,
353
- `paymentRequests`
354
- - **Money movement** — `wallets`, `transfers`, `beneficiaries`, `refunds`
355
- - **Policy & governance** — `policies`, `disputes`
356
- - **Observability** — `transactions`, `outcomes`, `runs`, `forecast`
357
- - **Identity** — `customers`, `webhooks`
358
- - **One-call buy** — `pay()` (wraps `agenticCommerce.buy`)
446
+ ### Tree-shaking
359
447
 
360
- Need `apiKeys`, `delegations`, `approvalPolicies`, `riskEvents`,
361
- `auditEvents`, `accessEvents`, `notifications`, `invoices`, `metrics`,
362
- `merchantCategories`, `pushSubscriptions`, `ledgerEntries`,
363
- `disputeEvidence`, or `billing`? Import the generated function and pass
364
- the client:
448
+ Prefer raw functions over the class? Every operation is also exported
449
+ from `@ovra/ts-sdk/api`:
365
450
 
366
451
  ```ts
367
- import { Ovra } from "@ovra/ts-sdk";
368
452
  import { listApiKeys } from "@ovra/ts-sdk/api";
369
-
370
- const ovra = new Ovra({ apiKey: process.env.OVRA_API_KEY! });
371
- // (advanced) reach into the generated client for unbound namespaces:
372
453
  const keys = await listApiKeys({ query: { limit: 10 } });
373
454
  ```
374
455
 
375
456
  The full inventory is in `apps/api/openapi.json` (single source of
376
457
  truth — the SDK is regenerated from it on every release).
377
458
 
459
+ ## Publishing
460
+
461
+ > **Status (2026-05-28):** auto-publish via
462
+ > `.github/workflows/sdk-publish.yaml` is wired correctly but
463
+ > **currently blocked at the runner-allocation step** — the GitHub
464
+ > account has a billing issue ("recent account payments have failed
465
+ > or your spending limit needs to be increased"). All workflow runs
466
+ > exit in ~3-5 s before the YAML steps start. Until billing is
467
+ > restored, every release ships via the manual script below; both
468
+ > `0.4.0` and `0.4.1` were published this way.
469
+
470
+ Manual release flow (single command — runs regen + build + version
471
+ check + `npm publish`):
472
+
473
+ ```sh
474
+ # Bump packages/sdk/package.json version first (semver: patch / minor / major)
475
+ pnpm --filter @ovra/ts-sdk version patch --no-git-tag-version
476
+
477
+ # Then publish (refuses if local <= remote, or if git tree is dirty)
478
+ pnpm run publish:sdk # or: pnpm --filter @ovra/ts-sdk run publish-manual
479
+ pnpm run publish:sdk:dry # dry-run (no upload, full pipeline otherwise)
480
+ ```
481
+
482
+ The script lives at `scripts/publish-sdk.sh`. Requirements: logged in
483
+ to npm as a publisher on the `@ovra` scope (`npm login`), clean git
484
+ tree, local version strictly greater than the version currently on
485
+ npm.
486
+
487
+ Once GH Actions billing is restored, every push to `main` that
488
+ touches `apps/api/openapi.json`, `packages/sdk/src/**`,
489
+ `packages/sdk/openapi-ts.config.ts`, or `packages/sdk/package.json`
490
+ will regenerate, bump (patch), and publish automatically — the
491
+ workflow is already in place.
492
+
378
493
  ## License
379
494
 
380
495
  Commercial — see [LICENSE](./LICENSE). The Ovra service requires a paid