@productcraft/social 1.0.2 → 1.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 +10 -10
- package/dist/index.d.cts +42 -10
- package/dist/index.d.ts +42 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ The customer backend acts on behalf of one of its EndUsers via the `X-Acting-As`
|
|
|
21
21
|
|
|
22
22
|
## Quick start — create a community (admin)
|
|
23
23
|
|
|
24
|
-
```ts
|
|
24
|
+
```ts before
|
|
25
25
|
import { Social } from "@productcraft/social";
|
|
26
26
|
|
|
27
27
|
// Reads PRODUCTCRAFT_API_KEY from the environment
|
|
@@ -38,7 +38,7 @@ const { data, error } = await social.client.POST(
|
|
|
38
38
|
|
|
39
39
|
## Quick start — post on behalf of an EndUser (customer backend)
|
|
40
40
|
|
|
41
|
-
```ts
|
|
41
|
+
```ts before
|
|
42
42
|
const actor_id = "<actor-uuid>"; // the EndUser's Social actor id
|
|
43
43
|
|
|
44
44
|
const { data, error } = await social.client.POST(
|
|
@@ -66,7 +66,7 @@ Social's wire is snake_case both at the DTO level and in TS types — there's no
|
|
|
66
66
|
|
|
67
67
|
1.0 renames every **path parameter** to snake_case, to match the rest of the ProductCraft APIs: `{communityId}` is now `{community_id}`, `{actorId}` is `{actor_id}`, `{srcActorId}` is `{src_actor_id}`, and so on. Request URLs are unchanged, so nothing breaks at runtime; the change is in the TypeScript path keys and in `params.path`:
|
|
68
68
|
|
|
69
|
-
```ts
|
|
69
|
+
```ts before
|
|
70
70
|
// 0.x
|
|
71
71
|
await social.client.GET("/v1/communities/{communityId}/posts/{postId}", {
|
|
72
72
|
params: { path: { communityId, postId } },
|
|
@@ -95,7 +95,7 @@ PRODUCTCRAFT_API_KEY=pcft_live_...
|
|
|
95
95
|
|
|
96
96
|
## Configuration
|
|
97
97
|
|
|
98
|
-
```ts
|
|
98
|
+
```ts before
|
|
99
99
|
new Social({
|
|
100
100
|
// Omit to use PRODUCTCRAFT_API_KEY from the environment
|
|
101
101
|
auth: { type: "apiKey", key: "pcft_live_..." }
|
|
@@ -110,7 +110,7 @@ new Social({
|
|
|
110
110
|
|
|
111
111
|
### Posts + feeds
|
|
112
112
|
|
|
113
|
-
```ts
|
|
113
|
+
```ts before
|
|
114
114
|
// Create a post
|
|
115
115
|
await social.client.POST(
|
|
116
116
|
"/v1/communities/{community_id}/posts",
|
|
@@ -134,7 +134,7 @@ await social.client.GET(
|
|
|
134
134
|
|
|
135
135
|
### Stories
|
|
136
136
|
|
|
137
|
-
```ts
|
|
137
|
+
```ts before
|
|
138
138
|
// Post a story (24h TTL)
|
|
139
139
|
await social.client.POST(
|
|
140
140
|
"/v1/communities/{community_id}/stories",
|
|
@@ -150,7 +150,7 @@ await social.client.GET(
|
|
|
150
150
|
|
|
151
151
|
### Social graph
|
|
152
152
|
|
|
153
|
-
```ts
|
|
153
|
+
```ts before
|
|
154
154
|
// Follow / unfollow
|
|
155
155
|
await social.client.PUT(
|
|
156
156
|
"/v1/communities/{community_id}/follows/{src_actor_id}/{dst_actor_id}",
|
|
@@ -163,7 +163,7 @@ await social.client.PUT(
|
|
|
163
163
|
|
|
164
164
|
### Notifications
|
|
165
165
|
|
|
166
|
-
```ts
|
|
166
|
+
```ts before
|
|
167
167
|
// List
|
|
168
168
|
await social.client.GET(
|
|
169
169
|
"/v1/communities/{community_id}/actors/{actor_id}/notifications",
|
|
@@ -185,7 +185,7 @@ await social.client.POST(
|
|
|
185
185
|
|
|
186
186
|
### Direct conversations
|
|
187
187
|
|
|
188
|
-
```ts
|
|
188
|
+
```ts before
|
|
189
189
|
// Start / open a conversation
|
|
190
190
|
await social.client.POST(
|
|
191
191
|
"/v1/communities/{community_id}/conversations",
|
|
@@ -201,7 +201,7 @@ await social.client.POST(
|
|
|
201
201
|
|
|
202
202
|
### Moderation (workspace admin)
|
|
203
203
|
|
|
204
|
-
```ts
|
|
204
|
+
```ts before
|
|
205
205
|
// List flags
|
|
206
206
|
await social.client.GET(
|
|
207
207
|
"/v1/workspaces/{workspace_id}/communities/{community_id}/moderation/flags",
|
package/dist/index.d.cts
CHANGED
|
@@ -2171,7 +2171,10 @@ interface paths {
|
|
|
2171
2171
|
path?: never;
|
|
2172
2172
|
cookie?: never;
|
|
2173
2173
|
};
|
|
2174
|
-
/**
|
|
2174
|
+
/**
|
|
2175
|
+
* Get one webhook endpoint (without its secret).
|
|
2176
|
+
* @description The endpoint's URL, subscription, on/off state, failure streak and the last 4 characters of its signing secret. The full secret is only returned when the endpoint is created or its secret is rotated.
|
|
2177
|
+
*/
|
|
2175
2178
|
get: operations["WebhooksController_social_community_getEndpoint"];
|
|
2176
2179
|
put?: never;
|
|
2177
2180
|
post?: never;
|
|
@@ -2276,7 +2279,10 @@ interface paths {
|
|
|
2276
2279
|
path?: never;
|
|
2277
2280
|
cookie?: never;
|
|
2278
2281
|
};
|
|
2279
|
-
/**
|
|
2282
|
+
/**
|
|
2283
|
+
* Get one webhook event with every delivery attempt.
|
|
2284
|
+
* @description The event as it was sent (`type`, `data`) and every delivery attempt to every endpoint, with its trigger, HTTP status, error and the start of the response body. Use it to debug a receiver, then `replay` to send it again.
|
|
2285
|
+
*/
|
|
2280
2286
|
get: operations["WebhooksController_social_community_getEvent"];
|
|
2281
2287
|
put?: never;
|
|
2282
2288
|
post?: never;
|
|
@@ -2733,7 +2739,10 @@ interface paths {
|
|
|
2733
2739
|
path?: never;
|
|
2734
2740
|
cookie?: never;
|
|
2735
2741
|
};
|
|
2736
|
-
/**
|
|
2742
|
+
/**
|
|
2743
|
+
* Get one webhook endpoint (without its secret).
|
|
2744
|
+
* @description The endpoint's URL, subscription, on/off state, failure streak and the last 4 characters of its signing secret. The full secret is only returned when the endpoint is created or its secret is rotated.
|
|
2745
|
+
*/
|
|
2737
2746
|
get: operations["WebhooksController_social_workspace_community_getEndpoint"];
|
|
2738
2747
|
put?: never;
|
|
2739
2748
|
post?: never;
|
|
@@ -2838,7 +2847,10 @@ interface paths {
|
|
|
2838
2847
|
path?: never;
|
|
2839
2848
|
cookie?: never;
|
|
2840
2849
|
};
|
|
2841
|
-
/**
|
|
2850
|
+
/**
|
|
2851
|
+
* Get one webhook event with every delivery attempt.
|
|
2852
|
+
* @description The event as it was sent (`type`, `data`) and every delivery attempt to every endpoint, with its trigger, HTTP status, error and the start of the response body. Use it to debug a receiver, then `replay` to send it again.
|
|
2853
|
+
*/
|
|
2842
2854
|
get: operations["WebhooksController_social_workspace_community_getEvent"];
|
|
2843
2855
|
put?: never;
|
|
2844
2856
|
post?: never;
|
|
@@ -2923,7 +2935,10 @@ interface paths {
|
|
|
2923
2935
|
path?: never;
|
|
2924
2936
|
cookie?: never;
|
|
2925
2937
|
};
|
|
2926
|
-
/**
|
|
2938
|
+
/**
|
|
2939
|
+
* Get one webhook endpoint (without its secret).
|
|
2940
|
+
* @description The endpoint's URL, subscription, on/off state, failure streak and the last 4 characters of its signing secret. The full secret is only returned when the endpoint is created or its secret is rotated.
|
|
2941
|
+
*/
|
|
2927
2942
|
get: operations["WebhooksController_social_workspace_getEndpoint"];
|
|
2928
2943
|
put?: never;
|
|
2929
2944
|
post?: never;
|
|
@@ -3028,7 +3043,10 @@ interface paths {
|
|
|
3028
3043
|
path?: never;
|
|
3029
3044
|
cookie?: never;
|
|
3030
3045
|
};
|
|
3031
|
-
/**
|
|
3046
|
+
/**
|
|
3047
|
+
* Get one webhook event with every delivery attempt.
|
|
3048
|
+
* @description The event as it was sent (`type`, `data`) and every delivery attempt to every endpoint, with its trigger, HTTP status, error and the start of the response body. Use it to debug a receiver, then `replay` to send it again.
|
|
3049
|
+
*/
|
|
3032
3050
|
get: operations["WebhooksController_social_workspace_getEvent"];
|
|
3033
3051
|
put?: never;
|
|
3034
3052
|
post?: never;
|
|
@@ -4710,8 +4728,9 @@ interface components {
|
|
|
4710
4728
|
*/
|
|
4711
4729
|
description?: string | null;
|
|
4712
4730
|
/**
|
|
4713
|
-
* @description
|
|
4731
|
+
* @description Send `false` to create it switched off.
|
|
4714
4732
|
* @default true
|
|
4733
|
+
* @example true
|
|
4715
4734
|
*/
|
|
4716
4735
|
enabled: boolean;
|
|
4717
4736
|
/**
|
|
@@ -6604,6 +6623,7 @@ interface components {
|
|
|
6604
6623
|
/**
|
|
6605
6624
|
* @description Hours the previous secret keeps signing too (0 ends it now).
|
|
6606
6625
|
* @default 24
|
|
6626
|
+
* @example 24
|
|
6607
6627
|
*/
|
|
6608
6628
|
grace_hours: number;
|
|
6609
6629
|
};
|
|
@@ -7009,11 +7029,23 @@ interface components {
|
|
|
7009
7029
|
url?: string;
|
|
7010
7030
|
};
|
|
7011
7031
|
UpdateWebhookEndpointDto: {
|
|
7012
|
-
/**
|
|
7032
|
+
/**
|
|
7033
|
+
* @description A new label; null clears it.
|
|
7034
|
+
* @example Production receiver
|
|
7035
|
+
*/
|
|
7013
7036
|
description?: string | null;
|
|
7014
|
-
/**
|
|
7037
|
+
/**
|
|
7038
|
+
* @description Switch it on or off. Switching on also clears an automatic disable.
|
|
7039
|
+
* @example true
|
|
7040
|
+
*/
|
|
7015
7041
|
enabled?: boolean;
|
|
7016
|
-
/**
|
|
7042
|
+
/**
|
|
7043
|
+
* @description Replaces the subscription. Event types from `GET …/webhooks/event-types`. Empty or omitted means every event, including types added later.
|
|
7044
|
+
* @example [
|
|
7045
|
+
* "post.created",
|
|
7046
|
+
* "post.updated"
|
|
7047
|
+
* ]
|
|
7048
|
+
*/
|
|
7017
7049
|
event_types?: ("post.created" | "post.updated" | "post.deleted" | "post.reaction.created" | "repost.created" | "comment.created" | "comment.updated" | "comment.deleted" | "comment.reaction.created" | "edge.follow.created" | "edge.follow.deleted" | "edge.follow.requested" | "edge.follow.request_approved" | "flag.created" | "flag.updated" | "moderation.action.applied" | "actor.updated" | "dm.message.created" | "tag.created" | "asset.ready" | "asset.failed")[];
|
|
7018
7050
|
/**
|
|
7019
7051
|
* Format: uri
|
package/dist/index.d.ts
CHANGED
|
@@ -2171,7 +2171,10 @@ interface paths {
|
|
|
2171
2171
|
path?: never;
|
|
2172
2172
|
cookie?: never;
|
|
2173
2173
|
};
|
|
2174
|
-
/**
|
|
2174
|
+
/**
|
|
2175
|
+
* Get one webhook endpoint (without its secret).
|
|
2176
|
+
* @description The endpoint's URL, subscription, on/off state, failure streak and the last 4 characters of its signing secret. The full secret is only returned when the endpoint is created or its secret is rotated.
|
|
2177
|
+
*/
|
|
2175
2178
|
get: operations["WebhooksController_social_community_getEndpoint"];
|
|
2176
2179
|
put?: never;
|
|
2177
2180
|
post?: never;
|
|
@@ -2276,7 +2279,10 @@ interface paths {
|
|
|
2276
2279
|
path?: never;
|
|
2277
2280
|
cookie?: never;
|
|
2278
2281
|
};
|
|
2279
|
-
/**
|
|
2282
|
+
/**
|
|
2283
|
+
* Get one webhook event with every delivery attempt.
|
|
2284
|
+
* @description The event as it was sent (`type`, `data`) and every delivery attempt to every endpoint, with its trigger, HTTP status, error and the start of the response body. Use it to debug a receiver, then `replay` to send it again.
|
|
2285
|
+
*/
|
|
2280
2286
|
get: operations["WebhooksController_social_community_getEvent"];
|
|
2281
2287
|
put?: never;
|
|
2282
2288
|
post?: never;
|
|
@@ -2733,7 +2739,10 @@ interface paths {
|
|
|
2733
2739
|
path?: never;
|
|
2734
2740
|
cookie?: never;
|
|
2735
2741
|
};
|
|
2736
|
-
/**
|
|
2742
|
+
/**
|
|
2743
|
+
* Get one webhook endpoint (without its secret).
|
|
2744
|
+
* @description The endpoint's URL, subscription, on/off state, failure streak and the last 4 characters of its signing secret. The full secret is only returned when the endpoint is created or its secret is rotated.
|
|
2745
|
+
*/
|
|
2737
2746
|
get: operations["WebhooksController_social_workspace_community_getEndpoint"];
|
|
2738
2747
|
put?: never;
|
|
2739
2748
|
post?: never;
|
|
@@ -2838,7 +2847,10 @@ interface paths {
|
|
|
2838
2847
|
path?: never;
|
|
2839
2848
|
cookie?: never;
|
|
2840
2849
|
};
|
|
2841
|
-
/**
|
|
2850
|
+
/**
|
|
2851
|
+
* Get one webhook event with every delivery attempt.
|
|
2852
|
+
* @description The event as it was sent (`type`, `data`) and every delivery attempt to every endpoint, with its trigger, HTTP status, error and the start of the response body. Use it to debug a receiver, then `replay` to send it again.
|
|
2853
|
+
*/
|
|
2842
2854
|
get: operations["WebhooksController_social_workspace_community_getEvent"];
|
|
2843
2855
|
put?: never;
|
|
2844
2856
|
post?: never;
|
|
@@ -2923,7 +2935,10 @@ interface paths {
|
|
|
2923
2935
|
path?: never;
|
|
2924
2936
|
cookie?: never;
|
|
2925
2937
|
};
|
|
2926
|
-
/**
|
|
2938
|
+
/**
|
|
2939
|
+
* Get one webhook endpoint (without its secret).
|
|
2940
|
+
* @description The endpoint's URL, subscription, on/off state, failure streak and the last 4 characters of its signing secret. The full secret is only returned when the endpoint is created or its secret is rotated.
|
|
2941
|
+
*/
|
|
2927
2942
|
get: operations["WebhooksController_social_workspace_getEndpoint"];
|
|
2928
2943
|
put?: never;
|
|
2929
2944
|
post?: never;
|
|
@@ -3028,7 +3043,10 @@ interface paths {
|
|
|
3028
3043
|
path?: never;
|
|
3029
3044
|
cookie?: never;
|
|
3030
3045
|
};
|
|
3031
|
-
/**
|
|
3046
|
+
/**
|
|
3047
|
+
* Get one webhook event with every delivery attempt.
|
|
3048
|
+
* @description The event as it was sent (`type`, `data`) and every delivery attempt to every endpoint, with its trigger, HTTP status, error and the start of the response body. Use it to debug a receiver, then `replay` to send it again.
|
|
3049
|
+
*/
|
|
3032
3050
|
get: operations["WebhooksController_social_workspace_getEvent"];
|
|
3033
3051
|
put?: never;
|
|
3034
3052
|
post?: never;
|
|
@@ -4710,8 +4728,9 @@ interface components {
|
|
|
4710
4728
|
*/
|
|
4711
4729
|
description?: string | null;
|
|
4712
4730
|
/**
|
|
4713
|
-
* @description
|
|
4731
|
+
* @description Send `false` to create it switched off.
|
|
4714
4732
|
* @default true
|
|
4733
|
+
* @example true
|
|
4715
4734
|
*/
|
|
4716
4735
|
enabled: boolean;
|
|
4717
4736
|
/**
|
|
@@ -6604,6 +6623,7 @@ interface components {
|
|
|
6604
6623
|
/**
|
|
6605
6624
|
* @description Hours the previous secret keeps signing too (0 ends it now).
|
|
6606
6625
|
* @default 24
|
|
6626
|
+
* @example 24
|
|
6607
6627
|
*/
|
|
6608
6628
|
grace_hours: number;
|
|
6609
6629
|
};
|
|
@@ -7009,11 +7029,23 @@ interface components {
|
|
|
7009
7029
|
url?: string;
|
|
7010
7030
|
};
|
|
7011
7031
|
UpdateWebhookEndpointDto: {
|
|
7012
|
-
/**
|
|
7032
|
+
/**
|
|
7033
|
+
* @description A new label; null clears it.
|
|
7034
|
+
* @example Production receiver
|
|
7035
|
+
*/
|
|
7013
7036
|
description?: string | null;
|
|
7014
|
-
/**
|
|
7037
|
+
/**
|
|
7038
|
+
* @description Switch it on or off. Switching on also clears an automatic disable.
|
|
7039
|
+
* @example true
|
|
7040
|
+
*/
|
|
7015
7041
|
enabled?: boolean;
|
|
7016
|
-
/**
|
|
7042
|
+
/**
|
|
7043
|
+
* @description Replaces the subscription. Event types from `GET …/webhooks/event-types`. Empty or omitted means every event, including types added later.
|
|
7044
|
+
* @example [
|
|
7045
|
+
* "post.created",
|
|
7046
|
+
* "post.updated"
|
|
7047
|
+
* ]
|
|
7048
|
+
*/
|
|
7017
7049
|
event_types?: ("post.created" | "post.updated" | "post.deleted" | "post.reaction.created" | "repost.created" | "comment.created" | "comment.updated" | "comment.deleted" | "comment.reaction.created" | "edge.follow.created" | "edge.follow.deleted" | "edge.follow.requested" | "edge.follow.request_approved" | "flag.created" | "flag.updated" | "moderation.action.applied" | "actor.updated" | "dm.message.created" | "tag.created" | "asset.ready" | "asset.failed")[];
|
|
7018
7050
|
/**
|
|
7019
7051
|
* Format: uri
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@productcraft/social",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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",
|