@productcraft/rally 0.0.2 → 0.0.3

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 ADDED
@@ -0,0 +1,54 @@
1
+ # @productcraft/rally
2
+
3
+ Typed Node.js SDK for [ProductCraft Rally](https://productcraft.co) — waitlists, gated signups, and growth experiments.
4
+
5
+ ```bash
6
+ npm install @productcraft/rally
7
+ ```
8
+
9
+ Server-side only. The SDK ships a Platform API Key; never embed it in a browser bundle.
10
+
11
+ ## Quick start
12
+
13
+ ```ts
14
+ import { Rally } from "@productcraft/rally";
15
+
16
+ const rally = new Rally({
17
+ auth: { type: "apiKey", key: process.env.PCFT_KEY! },
18
+ });
19
+
20
+ // Accept a signup from a marketing site into a waitlist
21
+ const { data, error } = await rally.client.POST(
22
+ "/v1/waitlists/{workspaceSlug}/{waitlistSlug}/entries",
23
+ {
24
+ params: { path: { workspaceSlug: "my-workspace", waitlistSlug: "early-access" } },
25
+ body: { email: "alice@example.com" },
26
+ },
27
+ );
28
+ ```
29
+
30
+ The `client` is an [`openapi-fetch`](https://openapi-ts.dev/openapi-fetch/) instance bound to `https://api.rally.productcraft.co` and your auth credential. Every endpoint in the published OpenAPI spec is reachable through `client.GET`, `client.POST`, etc., with full path-param + body autocomplete.
31
+
32
+ ## Public entry endpoint
33
+
34
+ `POST /v1/waitlists/:workspaceSlug/:waitlistSlug/entries` is intentionally unauthenticated so a marketing site's `<form>` can POST signups directly. Every other Rally endpoint (admin, approval, exports) requires a PlatformUser cookie or a workspace-scoped PAK.
35
+
36
+ ## Configuration
37
+
38
+ ```ts
39
+ new Rally({
40
+ auth: { type: "apiKey", key: "pcft_live_..." }
41
+ | { type: "bearer", token: "eyJ..." }
42
+ | { type: "cookie", value: "auth_token=..." },
43
+ baseUrl: "https://api.rally.example.test", // optional override
44
+ fetch: customFetch, // optional
45
+ });
46
+ ```
47
+
48
+ ## How this SDK is built
49
+
50
+ Generated from the live OpenAPI spec at `https://api.rally.productcraft.co/docs-json` via [`openapi-typescript`](https://openapi-ts.dev/) + [`openapi-fetch`](https://openapi-ts.dev/openapi-fetch/). The nightly `spec-refresh` workflow opens a PR whenever the spec changes.
51
+
52
+ ## License
53
+
54
+ [MIT](https://github.com/clauderanelagh/productcraft-node/blob/main/LICENSE).