productcraft 0.2.9 → 0.3.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.
Files changed (2) hide show
  1. package/README.md +16 -3
  2. package/package.json +17 -13
package/README.md CHANGED
@@ -25,9 +25,8 @@ The per-product packages are leaner (no bundled deps for the surfaces you don't
25
25
  ```ts
26
26
  import { ProductCraft } from "productcraft";
27
27
 
28
- const pc = new ProductCraft({
29
- auth: { type: "apiKey", key: process.env.PCFT_KEY! },
30
- });
28
+ // Reads PRODUCTCRAFT_API_KEY from the environment
29
+ const pc = new ProductCraft();
31
30
 
32
31
  // Auth — sign in an EndUser through the BFF flow
33
32
  const consumer = pc.auth.consumer("my-app-slug");
@@ -78,11 +77,25 @@ class ProductCraft {
78
77
 
79
78
  Each is the same class you'd get from installing its per-product package directly — `pc.auth` is `new Auth(config)`, etc. The classes are re-exported so you can refer to their types: `import type { Auth } from "productcraft"`.
80
79
 
80
+ ## Credentials from the environment
81
+
82
+ Server-side, omit `auth` and the client reads your workspace key from the environment:
83
+
84
+ ```bash
85
+ # .env
86
+ PRODUCTCRAFT_API_KEY=pcft_live_...
87
+ ```
88
+
89
+ - An explicit `auth` always wins over the environment.
90
+ - Hosts are never read from the environment. Override them in code with `baseUrl`.
91
+ - This is a server-only fallback. Never put a key in `NEXT_PUBLIC_*` or any other variable a bundler inlines into browser code.
92
+
81
93
  ## Configuration
82
94
 
83
95
  ```ts
84
96
  new ProductCraft({
85
97
  // Shared auth credential — applied to every surface
98
+ // Omit to use PRODUCTCRAFT_API_KEY from the environment
86
99
  auth: { type: "apiKey", key: "pcft_live_..." }
87
100
  | { type: "bearer", token: "eyJ..." }
88
101
  | { type: "cookie", value: "auth_token=..." },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "productcraft",
3
- "version": "0.2.9",
3
+ "version": "0.3.0",
4
4
  "description": "All-in-one Node.js / TypeScript SDK for the ProductCraft platform — Auth, Mail, Waitlist, Social, Platform-Auth, and Trawl from a single import. Install per-product packages (`@productcraft/auth`, ...) if you only need one.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -24,14 +24,15 @@
24
24
  "keywords": [
25
25
  "productcraft",
26
26
  "sdk",
27
+ "typescript",
28
+ "openapi",
27
29
  "auth",
30
+ "email",
28
31
  "mail",
29
32
  "waitlist",
30
33
  "social",
31
- "auth",
32
- "email",
33
- "waitlist",
34
- "openapi"
34
+ "web-extraction",
35
+ "workspace"
35
36
  ],
36
37
  "author": "ProductCraft",
37
38
  "license": "MIT",
@@ -40,19 +41,22 @@
40
41
  "url": "git+https://github.com/clauderanelagh/productcraft-node.git",
41
42
  "directory": "packages/umbrella"
42
43
  },
43
- "homepage": "https://github.com/clauderanelagh/productcraft-node",
44
+ "homepage": "https://productcraft.co/docs/sdks",
45
+ "bugs": {
46
+ "url": "https://github.com/clauderanelagh/productcraft-node/issues"
47
+ },
44
48
  "publishConfig": {
45
49
  "access": "public",
46
50
  "provenance": true
47
51
  },
48
52
  "dependencies": {
49
- "@productcraft/auth": "^0.6.0",
50
- "@productcraft/social": "^0.7.0",
51
- "@productcraft/core": "^0.2.0",
52
- "@productcraft/mail": "^0.1.1",
53
- "@productcraft/platform-auth": "^0.0.12",
54
- "@productcraft/waitlist": "^0.1.1",
55
- "@productcraft/trawl": "^0.1.1"
53
+ "@productcraft/social": "^0.8.0",
54
+ "@productcraft/core": "^0.3.0",
55
+ "@productcraft/mail": "^0.2.0",
56
+ "@productcraft/auth": "^0.8.0",
57
+ "@productcraft/platform-auth": "^0.1.0",
58
+ "@productcraft/waitlist": "^0.2.0",
59
+ "@productcraft/trawl": "^0.2.0"
56
60
  },
57
61
  "scripts": {
58
62
  "build": "tsup",