@cronvello/sdk 0.3.0 → 0.4.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 +42 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/{dispatch-handler-B5b9iCyH.d.cts → dispatch-handler-yHIFEnNG.d.cts} +1 -1
- package/dist/{dispatch-handler-B5b9iCyH.d.ts → dispatch-handler-yHIFEnNG.d.ts} +1 -1
- package/dist/express.d.cts +1 -1
- package/dist/express.d.ts +1 -1
- package/dist/index.cjs +107 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +251 -3
- package/dist/index.d.ts +251 -3
- package/dist/index.js +107 -1
- package/dist/index.js.map +1 -1
- package/dist/next.d.cts +1 -1
- package/dist/next.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -594,6 +594,48 @@ Transient failures (429 / 5xx / network) are retried automatically with backoff.
|
|
|
594
594
|
|
|
595
595
|
---
|
|
596
596
|
|
|
597
|
+
## Operator client
|
|
598
|
+
|
|
599
|
+
You do not need this to *use* Cronvello. It is the backend-to-backend surface for the service
|
|
600
|
+
that **provisions apps into** Cronvello — registering them, checking their registration, minting
|
|
601
|
+
new per-app tokens, removing them.
|
|
602
|
+
|
|
603
|
+
It is a separate class on purpose. It runs against the same host as `/v1`, but it takes
|
|
604
|
+
Cronvello's **service key**, which is authorized across every registered app — far broader than
|
|
605
|
+
an account `apiKey`. Two classes with two differently named options means you cannot send the
|
|
606
|
+
wrong credential by accident.
|
|
607
|
+
|
|
608
|
+
```ts
|
|
609
|
+
import { CronvelloAdminClient } from "@cronvello/sdk";
|
|
610
|
+
|
|
611
|
+
const admin = new CronvelloAdminClient({ serviceKey: process.env.CRONVELLO_SERVICE_KEY! });
|
|
612
|
+
|
|
613
|
+
// Idempotent upsert, keyed on the string appId. Re-run it on every provisioning pass.
|
|
614
|
+
const app = await admin.externalApps.register({
|
|
615
|
+
appId: "node-shop",
|
|
616
|
+
name: "Shop",
|
|
617
|
+
base_url: "https://shop.example.com",
|
|
618
|
+
generateApiKey: true,
|
|
619
|
+
});
|
|
620
|
+
app.generatedApiKey; // plaintext, exactly ONCE, and only for a newly created app
|
|
621
|
+
|
|
622
|
+
const status = await admin.externalApps.status("node-shop");
|
|
623
|
+
// { registered, isActive, isLive, lastSyncedAt, jobCount }
|
|
624
|
+
|
|
625
|
+
// Drift recovery when the current token is lost. Invalidates the old one.
|
|
626
|
+
const { newApiKey } = await admin.externalApps.rotateKey("node-shop");
|
|
627
|
+
|
|
628
|
+
// Takes the NUMERIC app id, not the string appId — an asymmetry in the server contract.
|
|
629
|
+
await admin.externalApps.delete(app.id);
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
Cross-field rules (`base_url` or `targetUrl`; a key or `generateApiKey`; both OAuth credentials)
|
|
633
|
+
are checked before the request leaves, so a bad call raises `CronvelloConfigError` synchronously
|
|
634
|
+
rather than returning an opaque 400. Everything else — errors, retries, envelope handling —
|
|
635
|
+
behaves exactly as the low-level client above.
|
|
636
|
+
|
|
637
|
+
---
|
|
638
|
+
|
|
597
639
|
## License
|
|
598
640
|
|
|
599
641
|
MIT
|