productcraft 0.0.1 → 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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +107 -0
  3. package/package.json +15 -14
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ProductCraft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # productcraft
2
+
3
+ All-in-one Node.js / TypeScript SDK for the [ProductCraft](https://productcraft.co) platform. One install, one auth credential, every surface.
4
+
5
+ ```bash
6
+ npm install productcraft
7
+ ```
8
+
9
+ ## When to use this
10
+
11
+ Install **`productcraft`** when you call more than one ProductCraft API from the same backend (e.g. you mint Heimdall tokens *and* send transactional email through Envoi). It's a thin wrapper that instantiates one of each per-surface client and shares your auth credential across them.
12
+
13
+ Install the **per-product packages** when you only need one:
14
+
15
+ - `@productcraft/heimdall` — customer auth + EndUsers
16
+ - `@productcraft/envoi` — transactional email
17
+ - `@productcraft/rally` — waitlists
18
+ - `@productcraft/agora` — landing pages
19
+ - `@productcraft/platform-auth` — workspace administration
20
+
21
+ The per-product packages are leaner (no bundled deps for the surfaces you don't use).
22
+
23
+ ## Quick start
24
+
25
+ ```ts
26
+ import { ProductCraft } from "productcraft";
27
+
28
+ const pc = new ProductCraft({
29
+ auth: { type: "apiKey", key: process.env.PCFT_KEY! },
30
+ });
31
+
32
+ // Heimdall — sign in an EndUser through the BFF flow
33
+ const consumer = pc.heimdall.consumer("my-app-slug");
34
+ const tokens = await consumer.auth.signin({
35
+ identifier: "alice@example.com",
36
+ password: "...",
37
+ });
38
+
39
+ // Envoi — send a transactional email from the same backend
40
+ await pc.envoi.client.POST(
41
+ "/v1/mailboxes/{mailboxId}/messages/send",
42
+ {
43
+ params: { path: { mailboxId: "mbx_..." } },
44
+ body: {
45
+ to: "alice@example.com",
46
+ from: "hello@yourbrand.com",
47
+ subject: "Welcome",
48
+ html: "<p>Hi!</p>",
49
+ },
50
+ },
51
+ );
52
+
53
+ // Rally — accept a waitlist signup
54
+ await pc.rally.client.POST(
55
+ "/v1/waitlists/{workspaceSlug}/{waitlistSlug}/entries",
56
+ {
57
+ params: { path: { workspaceSlug: "my-workspace", waitlistSlug: "early-access" } },
58
+ body: { email: "alice@example.com" },
59
+ },
60
+ );
61
+ ```
62
+
63
+ ## What gets instantiated
64
+
65
+ ```ts
66
+ class ProductCraft {
67
+ readonly heimdall: Heimdall; // @productcraft/heimdall
68
+ readonly envoi: Envoi; // @productcraft/envoi
69
+ readonly rally: Rally; // @productcraft/rally
70
+ readonly agora: Agora; // @productcraft/agora
71
+ readonly platformAuth: PlatformAuth; // @productcraft/platform-auth
72
+ }
73
+ ```
74
+
75
+ Each is the same class you'd get from installing its per-product package directly — `pc.heimdall` is `new Heimdall(config)`, etc. The classes are re-exported so you can refer to their types: `import type { Heimdall } from "productcraft"`.
76
+
77
+ ## Configuration
78
+
79
+ ```ts
80
+ new ProductCraft({
81
+ // Shared auth credential — applied to every surface
82
+ auth: { type: "apiKey", key: "pcft_live_..." }
83
+ | { type: "bearer", token: "eyJ..." }
84
+ | { type: "cookie", value: "auth_token=..." },
85
+
86
+ // Shared overrides (optional)
87
+ baseUrl: "...", // RARELY useful — surfaces have different base URLs
88
+ fetch: customFetch,
89
+
90
+ // Per-surface overrides — useful for dev / staging
91
+ heimdall: { baseUrl: "https://api.heimdall.example.test" },
92
+ envoi: { baseUrl: "https://api.mail.example.test" },
93
+ rally: { baseUrl: "https://api.rally.example.test" },
94
+ agora: { baseUrl: "https://agora.example.test" },
95
+ platformAuth: { baseUrl: "https://api.auth.example.test" },
96
+ });
97
+ ```
98
+
99
+ A per-surface override is merged over the shared config — you can change just the base URL of one surface (e.g. pointing Heimdall at a staging cluster while Envoi stays on prod) without restating the whole credential.
100
+
101
+ ## How these SDKs are built
102
+
103
+ Every surface is generated from its live OpenAPI spec via [`openapi-typescript`](https://openapi-ts.dev/) (types) + [`openapi-fetch`](https://openapi-ts.dev/openapi-fetch/) (runtime). Heimdall additionally has a hand-written ergonomic layer (`consumer(slug).auth.signin(...)`) on top of the generated client; the other surfaces ship the `client` directly for now.
104
+
105
+ ## License
106
+
107
+ [MIT](https://github.com/clauderanelagh/productcraft-node/blob/main/LICENSE).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "productcraft",
3
- "version": "0.0.1",
4
- "description": "All-in-one Node.js / TypeScript SDK for the ProductCraft platform \u2014 Heimdall, Envoi, Rally, Agora, and Platform-Auth from a single import. Install per-product packages (`@productcraft/heimdall`, ...) if you only need one.",
3
+ "version": "0.0.3",
4
+ "description": "All-in-one Node.js / TypeScript SDK for the ProductCraft platform — Heimdall, Envoi, Rally, Agora, and Platform-Auth from a single import. Install per-product packages (`@productcraft/heimdall`, ...) if you only need one.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
@@ -21,10 +21,6 @@
21
21
  "engines": {
22
22
  "node": ">=18"
23
23
  },
24
- "scripts": {
25
- "build": "tsup",
26
- "test": "vitest run"
27
- },
28
24
  "keywords": [
29
25
  "productcraft",
30
26
  "sdk",
@@ -46,14 +42,19 @@
46
42
  },
47
43
  "homepage": "https://github.com/clauderanelagh/productcraft-node",
48
44
  "publishConfig": {
49
- "access": "public"
45
+ "access": "public",
46
+ "provenance": true
50
47
  },
51
48
  "dependencies": {
52
- "@productcraft/agora": "workspace:^",
53
- "@productcraft/core": "workspace:^",
54
- "@productcraft/envoi": "workspace:^",
55
- "@productcraft/heimdall": "workspace:^",
56
- "@productcraft/platform-auth": "workspace:^",
57
- "@productcraft/rally": "workspace:^"
49
+ "@productcraft/agora": "^0.0.3",
50
+ "@productcraft/core": "^0.0.3",
51
+ "@productcraft/envoi": "^0.0.3",
52
+ "@productcraft/heimdall": "^0.1.0",
53
+ "@productcraft/platform-auth": "^0.0.3",
54
+ "@productcraft/rally": "^0.0.3"
55
+ },
56
+ "scripts": {
57
+ "build": "tsup",
58
+ "test": "vitest run"
58
59
  }
59
- }
60
+ }