@venturekit-pro/social 0.0.0-dev.20260815190251 → 0.0.0-dev.20260815191300
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/dist/adapters/facebook.d.ts +5 -13
- package/dist/adapters/facebook.d.ts.map +1 -1
- package/dist/adapters/facebook.js +32 -155
- package/dist/adapters/facebook.js.map +1 -1
- package/dist/adapters/linkedin.d.ts +14 -17
- package/dist/adapters/linkedin.d.ts.map +1 -1
- package/dist/adapters/linkedin.js +75 -99
- package/dist/adapters/linkedin.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +4 -4
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
* Facebook (Pages) adapter — Meta Graph API.
|
|
3
3
|
*
|
|
4
4
|
* Endpoints:
|
|
5
|
-
* - Text post:
|
|
6
|
-
* -
|
|
7
|
-
* - Multi-photo: `POST /v18.0/<page-id>/photos` (published=false)
|
|
8
|
-
* per photo, then `POST /v18.0/<page-id>/feed`
|
|
9
|
-
* with `attached_media` referencing all photo ids.
|
|
5
|
+
* - Text post: `POST /v18.0/<page-id>/feed`
|
|
6
|
+
* - Photo post: `POST /v18.0/<page-id>/photos`
|
|
10
7
|
*
|
|
11
8
|
* Auth: Page access token via `?access_token=…` OR
|
|
12
9
|
* `Authorization: Bearer …`. We use the header form so the
|
|
@@ -23,14 +20,9 @@
|
|
|
23
20
|
* because the adapter downloads the image in-process (where it CAN
|
|
24
21
|
* reach a presigned / private URL) and pushes the bytes to Meta.
|
|
25
22
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* all uploaded photo ids via the `attached_media` field. This is the
|
|
30
|
-
* only Graph API flow that produces a multi-image post on a Page.
|
|
31
|
-
*
|
|
32
|
-
* Meta's /photos endpoint accepts JPEG and PNG only. Images in other
|
|
33
|
-
* formats (e.g. WebP, which the CMS uses for blog covers) are
|
|
23
|
+
* Meta's /photos endpoint accepts JPEG and PNG only. The format is
|
|
24
|
+
* read from the downloaded bytes rather than `media.mimeType`, and
|
|
25
|
+
* anything else (e.g. WebP, which the CMS uses for blog covers) is
|
|
34
26
|
* converted to JPEG before upload via the optional `sharp` peer
|
|
35
27
|
* dependency. The constraints allow WebP so validation doesn't block
|
|
36
28
|
* the post before the adapter can convert it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facebook.d.ts","sourceRoot":"","sources":["../../src/adapters/facebook.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"facebook.d.ts","sourceRoot":"","sources":["../../src/adapters/facebook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAGV,yBAAyB,EAE1B,MAAM,aAAa,CAAC;AAerB,eAAO,MAAM,oBAAoB,EAAE,yBAYlC,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAClD;AAED,wBAAgB,qBAAqB,CACnC,MAAM,GAAE,qBAA0B,GACjC,aAAa,CAyEf"}
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
* Facebook (Pages) adapter — Meta Graph API.
|
|
3
3
|
*
|
|
4
4
|
* Endpoints:
|
|
5
|
-
* - Text post:
|
|
6
|
-
* -
|
|
7
|
-
* - Multi-photo: `POST /v18.0/<page-id>/photos` (published=false)
|
|
8
|
-
* per photo, then `POST /v18.0/<page-id>/feed`
|
|
9
|
-
* with `attached_media` referencing all photo ids.
|
|
5
|
+
* - Text post: `POST /v18.0/<page-id>/feed`
|
|
6
|
+
* - Photo post: `POST /v18.0/<page-id>/photos`
|
|
10
7
|
*
|
|
11
8
|
* Auth: Page access token via `?access_token=…` OR
|
|
12
9
|
* `Authorization: Bearer …`. We use the header form so the
|
|
@@ -23,26 +20,20 @@
|
|
|
23
20
|
* because the adapter downloads the image in-process (where it CAN
|
|
24
21
|
* reach a presigned / private URL) and pushes the bytes to Meta.
|
|
25
22
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* all uploaded photo ids via the `attached_media` field. This is the
|
|
30
|
-
* only Graph API flow that produces a multi-image post on a Page.
|
|
31
|
-
*
|
|
32
|
-
* Meta's /photos endpoint accepts JPEG and PNG only. Images in other
|
|
33
|
-
* formats (e.g. WebP, which the CMS uses for blog covers) are
|
|
23
|
+
* Meta's /photos endpoint accepts JPEG and PNG only. The format is
|
|
24
|
+
* read from the downloaded bytes rather than `media.mimeType`, and
|
|
25
|
+
* anything else (e.g. WebP, which the CMS uses for blog covers) is
|
|
34
26
|
* converted to JPEG before upload via the optional `sharp` peer
|
|
35
27
|
* dependency. The constraints allow WebP so validation doesn't block
|
|
36
28
|
* the post before the adapter can convert it.
|
|
37
29
|
*/
|
|
38
|
-
import {
|
|
30
|
+
import { vendorFetch } from '../http.js';
|
|
31
|
+
import { downloadMedia, ensureUploadableImage, filenameForMime, } from '../media.js';
|
|
39
32
|
import { validatePost } from '../validation.js';
|
|
40
33
|
const META_GRAPH_BASE = 'https://graph.facebook.com';
|
|
41
34
|
const META_GRAPH_VERSION = 'v18.0';
|
|
42
35
|
/** MIME types Meta's /photos endpoint actually accepts. */
|
|
43
36
|
const FACEBOOK_UPLOAD_MIME = new Set(['image/jpeg', 'image/png']);
|
|
44
|
-
/** Maximum photos per album-style feed post (Meta's hard limit). */
|
|
45
|
-
const MAX_FB_PHOTOS = 10;
|
|
46
37
|
export const FACEBOOK_CONSTRAINTS = {
|
|
47
38
|
maxBodyChars: 63206, // Meta's published max; 2000 is the recommended ceiling
|
|
48
39
|
minBodyChars: 1,
|
|
@@ -51,10 +42,7 @@ export const FACEBOOK_CONSTRAINTS = {
|
|
|
51
42
|
// WebP is allowed at validation time so the adapter can convert it
|
|
52
43
|
// to JPEG before uploading — Meta's /photos endpoint rejects WebP.
|
|
53
44
|
allowedMimeTypes: ['image/jpeg', 'image/png', 'image/webp'],
|
|
54
|
-
|
|
55
|
-
// `attached_media` on the /feed endpoint. Single-photo posts still go
|
|
56
|
-
// through /photos; 2+ photos use the multi-upload flow.
|
|
57
|
-
maxMediaCount: 10,
|
|
45
|
+
maxMediaCount: 1,
|
|
58
46
|
allowedAspectRatios: ['1:1', '4:3', '16:9', '4:5'],
|
|
59
47
|
maxMediaSizeBytes: 10 * 1024 * 1024,
|
|
60
48
|
supportsFirstComment: false,
|
|
@@ -75,13 +63,13 @@ export function createFacebookAdapter(config = {}) {
|
|
|
75
63
|
},
|
|
76
64
|
async publish(post, credentials) {
|
|
77
65
|
const pageId = stripPagePrefix(credentials.authorRef);
|
|
78
|
-
const
|
|
66
|
+
const hasMedia = (post.media?.length ?? 0) > 0;
|
|
79
67
|
// Text / link posts hit /<page-id>/feed — no image, so the
|
|
80
68
|
// original JSON body path is correct.
|
|
81
|
-
if (
|
|
69
|
+
if (!hasMedia) {
|
|
82
70
|
const endpoint = `/${version}/${encodeURIComponent(pageId)}/feed`;
|
|
83
71
|
const body = buildFeedBody(post);
|
|
84
|
-
const res = await
|
|
72
|
+
const res = await vendorFetch('facebook', `${baseUrl}${endpoint}`, {
|
|
85
73
|
method: 'POST',
|
|
86
74
|
headers: {
|
|
87
75
|
Authorization: `Bearer ${credentials.accessToken}`,
|
|
@@ -91,67 +79,29 @@ export function createFacebookAdapter(config = {}) {
|
|
|
91
79
|
});
|
|
92
80
|
return parseResult(res, post);
|
|
93
81
|
}
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
return parseResult(res, post);
|
|
114
|
-
}
|
|
115
|
-
// Multi-photo posts (2–10 images) create an album-style feed
|
|
116
|
-
// post. Each image is pre-uploaded to /<page-id>/photos with
|
|
117
|
-
// `published=false` (multipart form data), then a single
|
|
118
|
-
// /<page-id>/feed post references all uploaded photo ids via
|
|
119
|
-
// `attached_media`.
|
|
120
|
-
const photosEndpoint = `/${version}/${encodeURIComponent(pageId)}/photos`;
|
|
121
|
-
const feedEndpoint = `/${version}/${encodeURIComponent(pageId)}/feed`;
|
|
122
|
-
const attachedMedia = [];
|
|
123
|
-
for (const media of post.media.slice(0, MAX_FB_PHOTOS)) {
|
|
124
|
-
const { imgBuf, mimeType } = await prepareImage(media);
|
|
125
|
-
const form = new FormData();
|
|
126
|
-
form.append('published', 'false');
|
|
127
|
-
form.append('source', new Blob([imgBuf], { type: mimeType }), 'image.jpg');
|
|
128
|
-
const uploadRes = await fbFetch('facebook', `${baseUrl}${photosEndpoint}`, {
|
|
129
|
-
method: 'POST',
|
|
130
|
-
headers: { Authorization: `Bearer ${credentials.accessToken}` },
|
|
131
|
-
body: form,
|
|
132
|
-
});
|
|
133
|
-
const uploadJson = uploadRes.body;
|
|
134
|
-
const photoId = uploadJson?.id;
|
|
135
|
-
if (!photoId) {
|
|
136
|
-
throw new SocialPublishError('[social/facebook] Multi-photo upload returned no id; vendor body: ' +
|
|
137
|
-
uploadRes.bodyText.slice(0, 200), { platform: 'facebook', raw: uploadRes.body });
|
|
138
|
-
}
|
|
139
|
-
attachedMedia.push({ media_fbid: photoId });
|
|
140
|
-
}
|
|
141
|
-
// Create the feed post referencing all uploaded photos.
|
|
142
|
-
const feedBody = {
|
|
143
|
-
message: post.body,
|
|
144
|
-
attached_media: attachedMedia,
|
|
145
|
-
};
|
|
146
|
-
const feedRes = await fbFetch('facebook', `${baseUrl}${feedEndpoint}`, {
|
|
82
|
+
// Photo posts hit /<page-id>/photos with multipart form data.
|
|
83
|
+
// We download the image in-process and upload the bytes via the
|
|
84
|
+
// `source` field — Meta's servers don't need to fetch anything.
|
|
85
|
+
const media = post.media[0];
|
|
86
|
+
const endpoint = `/${version}/${encodeURIComponent(pageId)}/photos`;
|
|
87
|
+
const downloaded = await downloadMedia(media.url, 'facebook', {
|
|
88
|
+
maxBytes: constraints.maxMediaSizeBytes,
|
|
89
|
+
});
|
|
90
|
+
// Meta's /photos endpoint accepts JPEG and PNG only; anything
|
|
91
|
+
// else (e.g. WebP) is transcoded first.
|
|
92
|
+
const { bytes, mimeType } = await ensureUploadableImage(downloaded, media.mimeType, FACEBOOK_UPLOAD_MIME, 'facebook');
|
|
93
|
+
const form = new FormData();
|
|
94
|
+
form.append('message', post.body);
|
|
95
|
+
form.append('source', new Blob([bytes], { type: mimeType }), filenameForMime(mimeType));
|
|
96
|
+
// Do NOT set Content-Type manually — fetch() sets the multipart
|
|
97
|
+
// boundary automatically from FormData. A manual header would
|
|
98
|
+
// omit the boundary and Meta would reject the request.
|
|
99
|
+
const res = await vendorFetch('facebook', `${baseUrl}${endpoint}`, {
|
|
147
100
|
method: 'POST',
|
|
148
|
-
headers: {
|
|
149
|
-
|
|
150
|
-
'Content-Type': 'application/json',
|
|
151
|
-
},
|
|
152
|
-
body: JSON.stringify(feedBody),
|
|
101
|
+
headers: { Authorization: `Bearer ${credentials.accessToken}` },
|
|
102
|
+
body: form,
|
|
153
103
|
});
|
|
154
|
-
return parseResult(
|
|
104
|
+
return parseResult(res, post);
|
|
155
105
|
},
|
|
156
106
|
};
|
|
157
107
|
}
|
|
@@ -181,77 +131,4 @@ function parseResult(res, post) {
|
|
|
181
131
|
raw: json,
|
|
182
132
|
};
|
|
183
133
|
}
|
|
184
|
-
/**
|
|
185
|
-
* Download image bytes from a URL the calling process can reach
|
|
186
|
-
* (presigned S3, CDN, etc.) but the platform's servers cannot.
|
|
187
|
-
*/
|
|
188
|
-
async function downloadImage(url, platform) {
|
|
189
|
-
const res = await fetch(url);
|
|
190
|
-
if (!res.ok) {
|
|
191
|
-
throw new SocialPublishError(`[social/${platform}] Could not fetch media for upload: ` +
|
|
192
|
-
`${res.status} ${res.statusText} — ${url}`, { platform: platform, status: res.status });
|
|
193
|
-
}
|
|
194
|
-
return res.arrayBuffer();
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Download an image and convert it to a MIME type Meta's /photos
|
|
198
|
-
* endpoint accepts (JPEG or PNG). Returns the raw bytes + the final
|
|
199
|
-
* MIME type. Used by both the single-photo and multi-photo flows.
|
|
200
|
-
*/
|
|
201
|
-
async function prepareImage(media) {
|
|
202
|
-
let imgBuf = new Uint8Array(await downloadImage(media.url, 'facebook'));
|
|
203
|
-
let mimeType = media.mimeType;
|
|
204
|
-
if (!FACEBOOK_UPLOAD_MIME.has(mimeType)) {
|
|
205
|
-
const sharp = await importSharp();
|
|
206
|
-
imgBuf = await sharp(imgBuf).jpeg({ quality: 90 }).toBuffer();
|
|
207
|
-
mimeType = 'image/jpeg';
|
|
208
|
-
}
|
|
209
|
-
return { imgBuf, mimeType };
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Lazy-import `sharp` so it's only loaded when an image actually
|
|
213
|
-
* needs format conversion. The package declares it as an optional
|
|
214
|
-
* peer dependency — apps that only post JPEG/PNG never need it.
|
|
215
|
-
*/
|
|
216
|
-
async function importSharp() {
|
|
217
|
-
try {
|
|
218
|
-
const sharp = (await import('sharp')).default;
|
|
219
|
-
return sharp;
|
|
220
|
-
}
|
|
221
|
-
catch {
|
|
222
|
-
throw new Error('[social/facebook] The `sharp` package is required to convert images to JPEG for Facebook. ' +
|
|
223
|
-
'Install it with `npm install sharp` or `pnpm add sharp`.');
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* fetch wrapper with the same vendor-status → typed-error mapping as
|
|
228
|
-
* `vendorFetch`, but accepts `FormData` as the body (the shared
|
|
229
|
-
* `vendorFetch` types `body` as `string | URLSearchParams`).
|
|
230
|
-
*/
|
|
231
|
-
async function fbFetch(platform, url, opts) {
|
|
232
|
-
const res = await fetch(url, {
|
|
233
|
-
method: opts.method,
|
|
234
|
-
headers: { Accept: 'application/json', ...opts.headers },
|
|
235
|
-
body: opts.body,
|
|
236
|
-
});
|
|
237
|
-
const bodyText = await res.text();
|
|
238
|
-
let body;
|
|
239
|
-
try {
|
|
240
|
-
body = bodyText ? JSON.parse(bodyText) : null;
|
|
241
|
-
}
|
|
242
|
-
catch {
|
|
243
|
-
body = bodyText;
|
|
244
|
-
}
|
|
245
|
-
if (res.ok)
|
|
246
|
-
return { body, bodyText };
|
|
247
|
-
const truncated = bodyText.length > 1024 ? bodyText.slice(0, 1024) + '…' : bodyText;
|
|
248
|
-
const message = `${res.status} ${res.statusText}: ${truncated}`;
|
|
249
|
-
if (res.status === 401 || res.status === 403) {
|
|
250
|
-
throw new SocialAuthError(message, { platform, status: res.status, raw: body });
|
|
251
|
-
}
|
|
252
|
-
if (res.status >= 400 && res.status < 500) {
|
|
253
|
-
throw new SocialValidationError(message, { platform, status: res.status, raw: body });
|
|
254
|
-
}
|
|
255
|
-
throw new SocialPublishError(message, { platform, status: res.status, raw: body });
|
|
256
|
-
}
|
|
257
134
|
//# sourceMappingURL=facebook.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facebook.js","sourceRoot":"","sources":["../../src/adapters/facebook.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"facebook.js","sourceRoot":"","sources":["../../src/adapters/facebook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AASH,OAAO,EAAE,WAAW,EAAoB,MAAM,YAAY,CAAC;AAC3D,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,eAAe,GAAG,4BAA4B,CAAC;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AC,EAAE,GAAG,CAAC,CACvF,CAAC;IACJ,CAAC;IACD,OAAO;QACL,WAAW;QACX,YAAY,EAAE,4BAA4B,kBAAkB,CAAC,WAAW,CAAC,EAAE;QAC3E,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,GAAG,EAAE,IAAI;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* LinkedIn adapter — Posts API (
|
|
2
|
+
* LinkedIn adapter — UGC Posts API (v2).
|
|
3
3
|
*
|
|
4
|
-
* Endpoint: `POST https://api.linkedin.com/
|
|
4
|
+
* Endpoint: `POST https://api.linkedin.com/v2/ugcPosts`
|
|
5
5
|
* Auth: OAuth 2.0 bearer token in `Authorization: Bearer …`
|
|
6
6
|
* Author: `urn:li:organization:<id>` or `urn:li:person:<id>`
|
|
7
7
|
* — caller supplies via `credentials.authorRef`.
|
|
8
8
|
*
|
|
9
|
-
* The adapter implements text
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* render on sponsored content (ads), not organic posts, so we don't
|
|
14
|
-
* use them.
|
|
9
|
+
* The adapter implements text + image posts (the 95% case for
|
|
10
|
+
* editorial content). Article / video / multi-image carousels are
|
|
11
|
+
* out of scope for the v1 ship and require the staged-upload
|
|
12
|
+
* endpoint; deliberately deferred.
|
|
15
13
|
*
|
|
16
14
|
* Image staging:
|
|
17
|
-
* If `media.url` is already a LinkedIn
|
|
18
|
-
* (`urn:li:
|
|
19
|
-
* adapter uses it directly. Otherwise the adapter
|
|
20
|
-
* two-step staging automatically:
|
|
21
|
-
* 1. `POST /
|
|
15
|
+
* If `media.url` is already a LinkedIn asset URN
|
|
16
|
+
* (`urn:li:digitalmediaAsset:…`) — e.g. the caller pre-staged the
|
|
17
|
+
* upload — the adapter uses it directly. Otherwise the adapter
|
|
18
|
+
* performs LinkedIn's two-step staging automatically:
|
|
19
|
+
* 1. `POST /v2/assets?action=registerUpload` → upload URL + asset URN
|
|
22
20
|
* 2. `PUT` the image bytes to the upload URL
|
|
23
|
-
* 3. Use the
|
|
24
|
-
* `content.multiImage` field
|
|
21
|
+
* 3. Use the asset URN in the UGC post's `media` field
|
|
25
22
|
* This means callers can pass a plain image URL (presigned S3, CDN,
|
|
26
23
|
* etc.) without implementing the staging protocol themselves.
|
|
27
24
|
*
|
|
28
|
-
* LinkedIn's
|
|
29
|
-
* format is read from the downloaded bytes rather than
|
|
25
|
+
* LinkedIn's feedshare-image recipe accepts JPEG and PNG only (not
|
|
26
|
+
* WebP). The format is read from the downloaded bytes rather than
|
|
30
27
|
* `media.mimeType`, and anything else is converted to JPEG before
|
|
31
28
|
* upload. Conversion requires the optional `sharp` peer dependency;
|
|
32
29
|
* if it's not installed, the adapter throws a clear error.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkedin.d.ts","sourceRoot":"","sources":["../../src/adapters/linkedin.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"linkedin.d.ts","sourceRoot":"","sources":["../../src/adapters/linkedin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAIV,yBAAyB,EAG1B,MAAM,aAAa,CAAC;AAWrB,eAAO,MAAM,oBAAoB,EAAE,yBAUlC,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,WAAW,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAClD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,GAAE,qBAA0B,GACjC,aAAa,CA0Ef"}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* LinkedIn adapter — Posts API (
|
|
2
|
+
* LinkedIn adapter — UGC Posts API (v2).
|
|
3
3
|
*
|
|
4
|
-
* Endpoint: `POST https://api.linkedin.com/
|
|
4
|
+
* Endpoint: `POST https://api.linkedin.com/v2/ugcPosts`
|
|
5
5
|
* Auth: OAuth 2.0 bearer token in `Authorization: Bearer …`
|
|
6
6
|
* Author: `urn:li:organization:<id>` or `urn:li:person:<id>`
|
|
7
7
|
* — caller supplies via `credentials.authorRef`.
|
|
8
8
|
*
|
|
9
|
-
* The adapter implements text
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* render on sponsored content (ads), not organic posts, so we don't
|
|
14
|
-
* use them.
|
|
9
|
+
* The adapter implements text + image posts (the 95% case for
|
|
10
|
+
* editorial content). Article / video / multi-image carousels are
|
|
11
|
+
* out of scope for the v1 ship and require the staged-upload
|
|
12
|
+
* endpoint; deliberately deferred.
|
|
15
13
|
*
|
|
16
14
|
* Image staging:
|
|
17
|
-
* If `media.url` is already a LinkedIn
|
|
18
|
-
* (`urn:li:
|
|
19
|
-
* adapter uses it directly. Otherwise the adapter
|
|
20
|
-
* two-step staging automatically:
|
|
21
|
-
* 1. `POST /
|
|
15
|
+
* If `media.url` is already a LinkedIn asset URN
|
|
16
|
+
* (`urn:li:digitalmediaAsset:…`) — e.g. the caller pre-staged the
|
|
17
|
+
* upload — the adapter uses it directly. Otherwise the adapter
|
|
18
|
+
* performs LinkedIn's two-step staging automatically:
|
|
19
|
+
* 1. `POST /v2/assets?action=registerUpload` → upload URL + asset URN
|
|
22
20
|
* 2. `PUT` the image bytes to the upload URL
|
|
23
|
-
* 3. Use the
|
|
24
|
-
* `content.multiImage` field
|
|
21
|
+
* 3. Use the asset URN in the UGC post's `media` field
|
|
25
22
|
* This means callers can pass a plain image URL (presigned S3, CDN,
|
|
26
23
|
* etc.) without implementing the staging protocol themselves.
|
|
27
24
|
*
|
|
28
|
-
* LinkedIn's
|
|
29
|
-
* format is read from the downloaded bytes rather than
|
|
25
|
+
* LinkedIn's feedshare-image recipe accepts JPEG and PNG only (not
|
|
26
|
+
* WebP). The format is read from the downloaded bytes rather than
|
|
30
27
|
* `media.mimeType`, and anything else is converted to JPEG before
|
|
31
28
|
* upload. Conversion requires the optional `sharp` peer dependency;
|
|
32
29
|
* if it's not installed, the adapter throws a clear error.
|
|
@@ -68,41 +65,37 @@ export function createLinkedInAdapter(config = {}) {
|
|
|
68
65
|
},
|
|
69
66
|
async publish(post, credentials) {
|
|
70
67
|
// Stage images that aren't already LinkedIn URNs.
|
|
71
|
-
// When a link preview is active (post.link), media is dropped
|
|
72
|
-
// by the post-builder — so staging is skipped entirely.
|
|
73
68
|
const media = post.media ?? [];
|
|
74
69
|
const stagedMedia = [];
|
|
75
70
|
for (const m of media) {
|
|
76
|
-
if (m.url.startsWith('urn:li:
|
|
71
|
+
if (m.url.startsWith('urn:li:digitalmediaAsset:')) {
|
|
77
72
|
// Caller already staged the upload — use the URN directly.
|
|
78
73
|
stagedMedia.push(m.url);
|
|
79
74
|
}
|
|
80
75
|
else {
|
|
81
|
-
// Auto-stage: download →
|
|
76
|
+
// Auto-stage: download → registerUpload → PUT bytes → URN.
|
|
82
77
|
stagedMedia.push(await stageImage(baseUrl, credentials, m, constraints.maxMediaSizeBytes));
|
|
83
78
|
}
|
|
84
79
|
}
|
|
85
|
-
|
|
86
|
-
// (/v2/ugcPosts) is legacy and doesn't support the current
|
|
87
|
-
// content model (article / multiImage).
|
|
88
|
-
const body = buildPostBody(post, credentials, stagedMedia);
|
|
80
|
+
const body = buildUgcPost(post, credentials, stagedMedia);
|
|
89
81
|
const headers = {
|
|
90
82
|
Authorization: `Bearer ${credentials.accessToken}`,
|
|
91
83
|
'Content-Type': 'application/json',
|
|
92
84
|
'X-Restli-Protocol-Version': '2.0.0',
|
|
93
|
-
// Required by the Posts API — format is YYYYMM.
|
|
94
|
-
'Linkedin-Version': '202511',
|
|
95
85
|
};
|
|
96
|
-
|
|
86
|
+
// No idempotency header — LinkedIn has no `Idempotency-Key`
|
|
87
|
+
// equivalent, and it cannot travel in the body either (see
|
|
88
|
+
// `UgcPostBody`). Retries are deduped caller-side.
|
|
89
|
+
const res = await vendorFetch('linkedin', `${baseUrl}/v2/ugcPosts`, {
|
|
97
90
|
method: 'POST',
|
|
98
91
|
headers,
|
|
99
92
|
body: JSON.stringify(body),
|
|
100
93
|
});
|
|
101
|
-
// The Posts API returns the post URN in the `x-restli-id` header
|
|
102
|
-
// (e.g. "urn:li:share:6844785523593134080") and an empty body.
|
|
103
94
|
const json = res.body;
|
|
104
|
-
const externalRef = json?.id ?? res.headers.get('x-
|
|
95
|
+
const externalRef = json?.id ?? res.headers.get('x-linkedin-id') ?? '';
|
|
105
96
|
if (!externalRef) {
|
|
97
|
+
// LinkedIn always returns 201 with an id; if we didn't get
|
|
98
|
+
// one, the post probably WASN'T accepted — fail loud.
|
|
106
99
|
throw new Error('[social/linkedin] Publish returned no id; vendor body: ' + res.bodyText.slice(0, 200));
|
|
107
100
|
}
|
|
108
101
|
// First-comment companion thread. Best-effort: the post is
|
|
@@ -112,6 +105,7 @@ export function createLinkedInAdapter(config = {}) {
|
|
|
112
105
|
}
|
|
113
106
|
return {
|
|
114
107
|
externalRef,
|
|
108
|
+
// The public URL form is `https://www.linkedin.com/feed/update/<urn>`.
|
|
115
109
|
publishedUrl: `https://www.linkedin.com/feed/update/${encodeURIComponent(externalRef)}`,
|
|
116
110
|
publishedAt: new Date().toISOString(),
|
|
117
111
|
idempotencyKey: post.idempotencyKey,
|
|
@@ -123,56 +117,61 @@ export function createLinkedInAdapter(config = {}) {
|
|
|
123
117
|
}
|
|
124
118
|
// ─── Internal: image staging ──────────────────────────────────────────
|
|
125
119
|
/**
|
|
126
|
-
* Download an image from a URL, convert to JPEG if needed,
|
|
127
|
-
* the upload with LinkedIn
|
|
128
|
-
* the image URN (`urn:li:image:...`).
|
|
129
|
-
*
|
|
130
|
-
* Uses the Images API (`POST /rest/images?action=initializeUpload`)
|
|
131
|
-
* which returns `urn:li:image:...` URNs compatible with the Posts API.
|
|
132
|
-
* The older Assets API returned `urn:li:digitalmediaAsset:...` URNs
|
|
133
|
-
* which the Posts API rejects.
|
|
120
|
+
* Download an image from a URL, convert to JPEG if needed, register
|
|
121
|
+
* the upload with LinkedIn, push the bytes, and return the asset URN.
|
|
134
122
|
*/
|
|
135
123
|
async function stageImage(baseUrl, credentials, media, maxBytes) {
|
|
136
124
|
// Download the image (the calling process can reach presigned /
|
|
137
125
|
// private URLs that LinkedIn's servers cannot), then transcode if
|
|
138
|
-
// the image recipe won't take the format.
|
|
126
|
+
// the feedshare-image recipe won't take the format.
|
|
139
127
|
const downloaded = await downloadMedia(media.url, 'linkedin', { maxBytes });
|
|
140
128
|
const { bytes, mimeType } = await ensureUploadableImage(downloaded, media.mimeType, LINKEDIN_ACCEPTED_MIME, 'linkedin');
|
|
141
|
-
// Step 1:
|
|
142
|
-
|
|
143
|
-
|
|
129
|
+
// Step 1: register the upload. Request SYNCHRONOUS_UPLOAD so
|
|
130
|
+
// LinkedIn confirms the image processed before we reference it.
|
|
131
|
+
const registerBody = {
|
|
132
|
+
registerUploadRequest: {
|
|
133
|
+
recipes: ['urn:li:digitalmediaRecipe:feedshare-image'],
|
|
144
134
|
owner: credentials.authorRef,
|
|
135
|
+
serviceRelationships: [
|
|
136
|
+
{
|
|
137
|
+
relationshipType: 'OWNER',
|
|
138
|
+
identifier: 'urn:li:userGeneratedContent',
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
supportedUploadMechanism: ['SYNCHRONOUS_UPLOAD'],
|
|
145
142
|
},
|
|
146
143
|
};
|
|
147
|
-
const
|
|
144
|
+
const regRes = await vendorFetch('linkedin', `${baseUrl}/v2/assets?action=registerUpload`, {
|
|
148
145
|
method: 'POST',
|
|
149
146
|
headers: {
|
|
150
147
|
Authorization: `Bearer ${credentials.accessToken}`,
|
|
151
148
|
'Content-Type': 'application/json',
|
|
152
149
|
'X-Restli-Protocol-Version': '2.0.0',
|
|
153
|
-
'Linkedin-Version': '202511',
|
|
154
150
|
},
|
|
155
|
-
body: JSON.stringify(
|
|
151
|
+
body: JSON.stringify(registerBody),
|
|
156
152
|
});
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
153
|
+
const regJson = regRes.body;
|
|
154
|
+
const uploadMech = regJson?.value?.uploadMechanism?.['com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest'];
|
|
155
|
+
const uploadUrl = uploadMech?.uploadUrl;
|
|
156
|
+
const assetUrn = regJson?.value?.asset;
|
|
157
|
+
if (!uploadUrl || !assetUrn) {
|
|
158
|
+
throw new SocialPublishError('[social/linkedin] registerUpload returned no upload URL / asset URN; vendor body: ' +
|
|
159
|
+
regRes.bodyText.slice(0, 500), { platform: 'linkedin', status: regRes.status, raw: regRes.body });
|
|
163
160
|
}
|
|
164
161
|
// Step 2: upload the bytes. The upload URL is a one-shot signed
|
|
165
162
|
// endpoint rather than the LinkedIn API proper, but it still goes
|
|
166
163
|
// through `vendorFetch` so the call inherits the abort timeout and
|
|
167
|
-
// the status → typed-error mapping.
|
|
164
|
+
// the status → typed-error mapping. Forward any headers LinkedIn
|
|
165
|
+
// asked us to echo back.
|
|
168
166
|
await vendorFetch('linkedin', uploadUrl, {
|
|
169
167
|
method: 'PUT',
|
|
170
168
|
headers: {
|
|
171
169
|
'Content-Type': mimeType,
|
|
170
|
+
...(uploadMech?.headers ?? {}),
|
|
172
171
|
},
|
|
173
172
|
body: bytes,
|
|
174
173
|
});
|
|
175
|
-
return
|
|
174
|
+
return assetUrn;
|
|
176
175
|
}
|
|
177
176
|
// ─── Internal: first-comment ──────────────────────────────────────────
|
|
178
177
|
/**
|
|
@@ -204,59 +203,36 @@ async function postFirstComment(baseUrl, credentials, postUrn, text) {
|
|
|
204
203
|
// Swallowed — see doc comment.
|
|
205
204
|
}
|
|
206
205
|
}
|
|
207
|
-
function
|
|
206
|
+
function buildUgcPost(post, credentials, stagedMedia) {
|
|
208
207
|
const hasMedia = stagedMedia.length > 0;
|
|
209
|
-
const
|
|
210
|
-
const altTexts = post.media ?? [];
|
|
208
|
+
const hasArticleLink = !hasMedia && !!post.link;
|
|
211
209
|
const body = {
|
|
212
210
|
author: credentials.authorRef,
|
|
213
|
-
commentary: post.body,
|
|
214
|
-
visibility: 'PUBLIC',
|
|
215
211
|
lifecycleState: 'PUBLISHED',
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
212
|
+
specificContent: {
|
|
213
|
+
'com.linkedin.ugc.ShareContent': {
|
|
214
|
+
shareCommentary: { text: post.body },
|
|
215
|
+
shareMediaCategory: hasMedia ? 'IMAGE' : hasArticleLink ? 'ARTICLE' : 'NONE',
|
|
216
|
+
},
|
|
220
217
|
},
|
|
221
|
-
|
|
218
|
+
visibility: { 'com.linkedin.ugc.MemberNetworkVisibility': 'PUBLIC' },
|
|
222
219
|
};
|
|
223
|
-
if (
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
article: {
|
|
231
|
-
source: post.link,
|
|
232
|
-
title: firstLine.slice(0, 200),
|
|
233
|
-
description: post.body.slice(0, 400),
|
|
234
|
-
},
|
|
235
|
-
};
|
|
220
|
+
if (hasMedia) {
|
|
221
|
+
const altTexts = post.media ?? [];
|
|
222
|
+
body.specificContent['com.linkedin.ugc.ShareContent'].media = stagedMedia.map((urn, i) => ({
|
|
223
|
+
status: 'READY',
|
|
224
|
+
...(altTexts[i]?.altText ? { description: { text: altTexts[i].altText } } : {}),
|
|
225
|
+
media: urn,
|
|
226
|
+
}));
|
|
236
227
|
}
|
|
237
|
-
else if (
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
},
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
// Multiple images (2-20) — use content.multiImage
|
|
249
|
-
body.content = {
|
|
250
|
-
multiImage: {
|
|
251
|
-
images: stagedMedia.map((urn, i) => ({
|
|
252
|
-
id: urn,
|
|
253
|
-
...(altTexts[i]?.altText ? { altText: altTexts[i].altText } : {}),
|
|
254
|
-
})),
|
|
255
|
-
},
|
|
256
|
-
};
|
|
257
|
-
}
|
|
228
|
+
else if (hasArticleLink) {
|
|
229
|
+
body.specificContent['com.linkedin.ugc.ShareContent'].media = [
|
|
230
|
+
{
|
|
231
|
+
status: 'READY',
|
|
232
|
+
originalUrl: post.link,
|
|
233
|
+
},
|
|
234
|
+
];
|
|
258
235
|
}
|
|
259
|
-
// else: text-only post, no content field
|
|
260
236
|
return body;
|
|
261
237
|
}
|
|
262
238
|
//# sourceMappingURL=linkedin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkedin.js","sourceRoot":"","sources":["../../src/adapters/linkedin.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"linkedin.js","sourceRoot":"","sources":["../../src/adapters/linkedin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAWH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAErD,mEAAmE;AACnE,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,oBAAoB,GAA8B;IAC7D,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,CAA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AAC;SAAM,IAAI,cAAc,EAAE,CAAC;QAC1B,IAAI,CAAC,eAAe,CAAC,+BAA+B,CAAC,CAAC,KAAK,GAAG;YAC5D;gBACE,MAAM,EAAE,OAAO;gBACf,WAAW,EAAE,IAAI,CAAC,IAAK;aACxB;SACF,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ export interface SocialPost {
|
|
|
94
94
|
/**
|
|
95
95
|
* Caller-side idempotency token. This is NEVER sent to a vendor: none
|
|
96
96
|
* of the supported platforms expose an idempotency field, and
|
|
97
|
-
* LinkedIn's Posts API rejects unknown body fields outright with
|
|
97
|
+
* LinkedIn's UGC Posts API rejects unknown body fields outright with
|
|
98
98
|
* `403 ACCESS_DENIED`. Adapters echo it back on `PublishResult` so the
|
|
99
99
|
* caller can dedupe retries against its own records.
|
|
100
100
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venturekit-pro/social",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.20260815191300",
|
|
4
4
|
"description": "Social-platform publishing adapters + catalog for VentureKit applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"publishing"
|
|
56
56
|
],
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@venturekit/core": "0.0.0-dev.
|
|
58
|
+
"@venturekit/core": "0.0.0-dev.20260815191300"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@venturekit/data": "0.0.0-dev.
|
|
61
|
+
"@venturekit/data": "0.0.0-dev.20260815191300",
|
|
62
62
|
"sharp": ">=0.32"
|
|
63
63
|
},
|
|
64
64
|
"peerDependenciesMeta": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/node": "^26.1.2",
|
|
74
|
-
"@venturekit/data": "0.0.0-dev.
|
|
74
|
+
"@venturekit/data": "0.0.0-dev.20260815191300",
|
|
75
75
|
"sharp": "^0.35.3",
|
|
76
76
|
"typescript": "^5.3.0"
|
|
77
77
|
},
|