@productcraft/social 0.7.1 → 0.8.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 +16 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,9 +24,8 @@ The customer backend acts on behalf of one of its EndUsers via the `X-Acting-As`
|
|
|
24
24
|
```ts
|
|
25
25
|
import { Social } from "@productcraft/social";
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
27
|
+
// Reads PRODUCTCRAFT_API_KEY from the environment
|
|
28
|
+
const social = new Social();
|
|
30
29
|
|
|
31
30
|
const { data, error } = await social.client.POST(
|
|
32
31
|
"/v1/workspaces/{workspaceId}/communities",
|
|
@@ -63,10 +62,24 @@ const { data, error } = await social.client.POST(
|
|
|
63
62
|
|
|
64
63
|
Social's wire is snake_case both at the DTO level and in TS types — there's no name translation layer for this surface. Use snake_case keys in `body` to match what the API actually accepts.
|
|
65
64
|
|
|
65
|
+
## Credentials from the environment
|
|
66
|
+
|
|
67
|
+
Server-side, omit `auth` and the client reads your workspace key from the environment:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# .env
|
|
71
|
+
PRODUCTCRAFT_API_KEY=pcft_live_...
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- An explicit `auth` always wins over the environment.
|
|
75
|
+
- Hosts are never read from the environment. Override them in code with `baseUrl`.
|
|
76
|
+
- This is a server-only fallback. Never put a key in `NEXT_PUBLIC_*` or any other variable a bundler inlines into browser code.
|
|
77
|
+
|
|
66
78
|
## Configuration
|
|
67
79
|
|
|
68
80
|
```ts
|
|
69
81
|
new Social({
|
|
82
|
+
// Omit to use PRODUCTCRAFT_API_KEY from the environment
|
|
70
83
|
auth: { type: "apiKey", key: "pcft_live_..." }
|
|
71
84
|
| { type: "bearer", token: "eyJ..." }
|
|
72
85
|
| { type: "cookie", value: "auth_token=..." },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@productcraft/social",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Social-as-a-service backend — communities, posts, ranked feeds, stories, direct conversations, notifications, moderation, flags via ProductCraft Social. Generated from the production OpenAPI spec.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"openapi-fetch": "^0.13.0",
|
|
46
|
-
"@productcraft/core": "^0.
|
|
46
|
+
"@productcraft/core": "^0.3.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsup"
|