@venturekit-pro/social 0.0.0-dev.20260627215235 → 0.0.0-dev.20260701113915
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 +4 -0
- package/dist/adapters/instagram.d.ts.map +1 -1
- package/dist/adapters/instagram.js +28 -0
- package/dist/adapters/instagram.js.map +1 -1
- package/dist/adapters/linkedin.d.ts.map +1 -1
- package/dist/adapters/linkedin.js +35 -0
- package/dist/adapters/linkedin.js.map +1 -1
- package/dist/adapters/x.d.ts.map +1 -1
- package/dist/adapters/x.js +29 -0
- package/dist/adapters/x.js.map +1 -1
- package/dist/catalog/crud.d.ts +50 -0
- package/dist/catalog/crud.d.ts.map +1 -0
- package/dist/catalog/crud.js +152 -0
- package/dist/catalog/crud.js.map +1 -0
- package/dist/catalog/index.d.ts +11 -0
- package/dist/catalog/index.d.ts.map +1 -0
- package/dist/catalog/index.js +10 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/catalog/types.d.ts +55 -0
- package/dist/catalog/types.d.ts.map +1 -0
- package/dist/catalog/types.js +11 -0
- package/dist/catalog/types.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/migrations/vk_social_0001_init.sql +5 -5
- package/package.json +4 -4
- package/src/migrations/vk_social_0001_init.sql +5 -5
- package/LICENSE +0 -191
package/README.md
CHANGED
|
@@ -23,6 +23,10 @@ calling-app concept. Apps compose those on top.
|
|
|
23
23
|
retry policies that match the failure mode.
|
|
24
24
|
- **Pre-publish validation** — `validatePost()` enforces per-platform
|
|
25
25
|
body / hashtag / media constraints and surfaces both errors and warnings.
|
|
26
|
+
- **First-comment threads** — set `SocialPost.firstComment` and any adapter
|
|
27
|
+
whose `constraints.supportsFirstComment` is `true` (LinkedIn, X, Instagram)
|
|
28
|
+
posts it as a companion comment / reply after the main post. Best-effort:
|
|
29
|
+
a failed comment never unwinds the already-live post.
|
|
26
30
|
|
|
27
31
|
## Wire-up
|
|
28
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instagram.d.ts","sourceRoot":"","sources":["../../src/adapters/instagram.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAIV,yBAAyB,EAE1B,MAAM,aAAa,CAAC;AAOrB,eAAO,MAAM,qBAAqB,EAAE,yBAiBnC,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAClD;AAED,wBAAgB,sBAAsB,CACpC,MAAM,GAAE,sBAA2B,GAClC,aAAa,
|
|
1
|
+
{"version":3,"file":"instagram.d.ts","sourceRoot":"","sources":["../../src/adapters/instagram.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAIV,yBAAyB,EAE1B,MAAM,aAAa,CAAC;AAOrB,eAAO,MAAM,qBAAqB,EAAE,yBAiBnC,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAClD;AAED,wBAAgB,sBAAsB,CACpC,MAAM,GAAE,sBAA2B,GAClC,aAAa,CAkGf"}
|
|
@@ -94,6 +94,12 @@ export function createInstagramAdapter(config = {}) {
|
|
|
94
94
|
throw new Error('[social/instagram] media_publish returned no id; vendor body: ' +
|
|
95
95
|
publishRes.bodyText.slice(0, 200));
|
|
96
96
|
}
|
|
97
|
+
// First-comment (commonly used to park the hashtag block off the
|
|
98
|
+
// caption). Best-effort: the media is already live, so a failed
|
|
99
|
+
// comment must not unwind the publish.
|
|
100
|
+
if (post.firstComment && constraints.supportsFirstComment) {
|
|
101
|
+
await postFirstComment(baseUrl, version, credentials, externalRef, post.firstComment);
|
|
102
|
+
}
|
|
97
103
|
return {
|
|
98
104
|
externalRef,
|
|
99
105
|
// IG doesn't expose a deterministic media-permalink at
|
|
@@ -110,4 +116,26 @@ export function createInstagramAdapter(config = {}) {
|
|
|
110
116
|
function stripIgPrefix(authorRef) {
|
|
111
117
|
return authorRef.startsWith('ig_user_') ? authorRef.slice(8) : authorRef;
|
|
112
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Post a first-comment on a just-published IG media item via the
|
|
121
|
+
* `/{ig-media-id}/comments` endpoint.
|
|
122
|
+
*
|
|
123
|
+
* Best-effort by contract: the media is already live, so a failed
|
|
124
|
+
* comment must never unwind the publish. Vendor errors are swallowed.
|
|
125
|
+
*/
|
|
126
|
+
async function postFirstComment(baseUrl, version, credentials, mediaId, text) {
|
|
127
|
+
try {
|
|
128
|
+
await vendorFetch('instagram', `${baseUrl}/${version}/${encodeURIComponent(mediaId)}/comments`, {
|
|
129
|
+
method: 'POST',
|
|
130
|
+
headers: {
|
|
131
|
+
Authorization: `Bearer ${credentials.accessToken}`,
|
|
132
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
133
|
+
},
|
|
134
|
+
body: new URLSearchParams({ message: text }),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// Swallowed — see doc comment.
|
|
139
|
+
}
|
|
140
|
+
}
|
|
113
141
|
//# sourceMappingURL=instagram.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instagram.js","sourceRoot":"","sources":["../../src/adapters/instagram.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,OAAO,EAAE,WAAW,EAAE,MAAM,YA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AAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkedin.d.ts","sourceRoot":"","sources":["../../src/adapters/linkedin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAIV,yBAAyB,EAE1B,MAAM,aAAa,CAAC;AAMrB,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,
|
|
1
|
+
{"version":3,"file":"linkedin.d.ts","sourceRoot":"","sources":["../../src/adapters/linkedin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAIV,yBAAyB,EAE1B,MAAM,aAAa,CAAC;AAMrB,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,CA+Df"}
|
|
@@ -67,6 +67,11 @@ export function createLinkedInAdapter(config = {}) {
|
|
|
67
67
|
// one, the post probably WASN'T accepted — fail loud.
|
|
68
68
|
throw new Error('[social/linkedin] Publish returned no id; vendor body: ' + res.bodyText.slice(0, 200));
|
|
69
69
|
}
|
|
70
|
+
// First-comment companion thread. Best-effort: the post is
|
|
71
|
+
// already live, so a failed comment must NOT unwind the publish.
|
|
72
|
+
if (post.firstComment && constraints.supportsFirstComment) {
|
|
73
|
+
await postFirstComment(baseUrl, credentials, externalRef, post.firstComment);
|
|
74
|
+
}
|
|
70
75
|
return {
|
|
71
76
|
externalRef,
|
|
72
77
|
// The public URL form is `https://www.linkedin.com/feed/update/<urn>`.
|
|
@@ -79,6 +84,36 @@ export function createLinkedInAdapter(config = {}) {
|
|
|
79
84
|
},
|
|
80
85
|
};
|
|
81
86
|
}
|
|
87
|
+
// ─── Internal: first-comment ──────────────────────────────────────────
|
|
88
|
+
/**
|
|
89
|
+
* Post a first-comment under a freshly-published UGC post via the
|
|
90
|
+
* `socialActions/{urn}/comments` endpoint. The comment is authored by
|
|
91
|
+
* the same actor as the post (`credentials.authorRef`).
|
|
92
|
+
*
|
|
93
|
+
* Best-effort by contract: the post is already live, so a failed
|
|
94
|
+
* comment must never unwind a successful publish. We swallow vendor
|
|
95
|
+
* errors here and let the caller's publish result stand.
|
|
96
|
+
*/
|
|
97
|
+
async function postFirstComment(baseUrl, credentials, postUrn, text) {
|
|
98
|
+
try {
|
|
99
|
+
await vendorFetch('linkedin', `${baseUrl}/v2/socialActions/${encodeURIComponent(postUrn)}/comments`, {
|
|
100
|
+
method: 'POST',
|
|
101
|
+
headers: {
|
|
102
|
+
Authorization: `Bearer ${credentials.accessToken}`,
|
|
103
|
+
'Content-Type': 'application/json',
|
|
104
|
+
'X-Restli-Protocol-Version': '2.0.0',
|
|
105
|
+
},
|
|
106
|
+
body: JSON.stringify({
|
|
107
|
+
actor: credentials.authorRef,
|
|
108
|
+
object: postUrn,
|
|
109
|
+
message: { text },
|
|
110
|
+
}),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
// Swallowed — see doc comment.
|
|
115
|
+
}
|
|
116
|
+
}
|
|
82
117
|
function buildUgcPost(post, credentials) {
|
|
83
118
|
const media = post.media ?? [];
|
|
84
119
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,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAClD;AAED,wBAAgB,cAAc,CAAC,MAAM,GAAE,cAAmB,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"x.d.ts","sourceRoot":"","sources":["../../src/adapters/x.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAIV,yBAAyB,EAE1B,MAAM,aAAa,CAAC;AAMrB,eAAO,MAAM,aAAa,EAAE,yBAU3B,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAClD;AAED,wBAAgB,cAAc,CAAC,MAAM,GAAE,cAAmB,GAAG,aAAa,CAwDzE"}
|
package/dist/adapters/x.js
CHANGED
|
@@ -52,6 +52,12 @@ export function createXAdapter(config = {}) {
|
|
|
52
52
|
if (!externalRef) {
|
|
53
53
|
throw new Error('[social/x] Publish returned no tweet id; vendor body: ' + res.bodyText.slice(0, 200));
|
|
54
54
|
}
|
|
55
|
+
// First-comment = a reply tweet threaded under the published one.
|
|
56
|
+
// Best-effort: the parent is already live, so a failed reply must
|
|
57
|
+
// not unwind the publish.
|
|
58
|
+
if (post.firstComment && constraints.supportsFirstComment) {
|
|
59
|
+
await postReply(baseUrl, credentials, externalRef, post.firstComment);
|
|
60
|
+
}
|
|
55
61
|
// X's public URL form requires the username, which we don't
|
|
56
62
|
// necessarily have at publish time. Use the canonical `i/web`
|
|
57
63
|
// form which works for any tweet and lets the browser redirect.
|
|
@@ -66,6 +72,29 @@ export function createXAdapter(config = {}) {
|
|
|
66
72
|
},
|
|
67
73
|
};
|
|
68
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Post a reply tweet threaded under a just-published tweet (the X
|
|
77
|
+
* equivalent of a "first comment").
|
|
78
|
+
*
|
|
79
|
+
* Best-effort by contract: the parent tweet is already live, so a
|
|
80
|
+
* failed reply must never unwind the publish. Vendor errors are
|
|
81
|
+
* swallowed here.
|
|
82
|
+
*/
|
|
83
|
+
async function postReply(baseUrl, credentials, inReplyToTweetId, text) {
|
|
84
|
+
try {
|
|
85
|
+
await vendorFetch('x', `${baseUrl}/2/tweets`, {
|
|
86
|
+
method: 'POST',
|
|
87
|
+
headers: {
|
|
88
|
+
Authorization: `Bearer ${credentials.accessToken}`,
|
|
89
|
+
'Content-Type': 'application/json',
|
|
90
|
+
},
|
|
91
|
+
body: JSON.stringify({ text, reply: { in_reply_to_tweet_id: inReplyToTweetId } }),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// Swallowed — see doc comment.
|
|
96
|
+
}
|
|
97
|
+
}
|
|
69
98
|
function buildTweetBody(post) {
|
|
70
99
|
const body = { text: post.body };
|
|
71
100
|
const media = post.media ?? [];
|
package/dist/adapters/x.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x.js","sourceRoot":"","sources":["../../src/adapters/x.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,UAAU,GAAG,yBAAyB,CAAC;AAE7C,MAAM,CAAC,MAAM,aAAa,GAA8B;IACtD,YAAY,EAAE,GAAG;IACjB,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,CAAC;IACd,gBAAgB,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,CAAC;IACxE,aAAa,EAAE,CAAC;IAChB,mBAAmB,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK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AAqD;QACrD,IAAI,CAAC,KAAK,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IACtD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRUD over `vk_social_platforms` — the platform-admin-owned catalog.
|
|
3
|
+
*
|
|
4
|
+
* Pure SQL against a caller-supplied `Querier`; no `@venturekit/data`
|
|
5
|
+
* import so the package stays decoupled from the data layer (it's an
|
|
6
|
+
* optional peer). Consumers pass their `query` / transaction querier in.
|
|
7
|
+
*
|
|
8
|
+
* Lifecycle-timestamp convention (matches the LLM model catalog):
|
|
9
|
+
* flipping `status` into `deprecated` / `disabled` auto-stamps the
|
|
10
|
+
* matching timestamp; flipping back to `available` clears both.
|
|
11
|
+
*/
|
|
12
|
+
import type { CreateSocialPlatformInput, PatchSocialPlatformInput, Querier, SocialPlatformRow } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* List every catalog row. Ordered by status (available → deprecated →
|
|
15
|
+
* disabled) so admin pickers show the useful rows up top, then
|
|
16
|
+
* alphabetically within each group.
|
|
17
|
+
*/
|
|
18
|
+
export declare function listSocialPlatforms(querier: Querier): Promise<SocialPlatformRow[]>;
|
|
19
|
+
/** Fetch one catalog row by its `key` PK, or `null` when absent. */
|
|
20
|
+
export declare function getSocialPlatformByKey(querier: Querier, key: string): Promise<SocialPlatformRow | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Insert a new catalog row. The `key` PK is DB-enforced; callers map
|
|
23
|
+
* `23505` to a 409 via `isUniqueViolation`.
|
|
24
|
+
*
|
|
25
|
+
* When the row is created already in a `deprecated` / `disabled` state
|
|
26
|
+
* the matching lifecycle timestamp is auto-stamped to `NOW()` so the
|
|
27
|
+
* happy path stays one-shot.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createSocialPlatform(querier: Querier, input: CreateSocialPlatformInput): Promise<SocialPlatformRow>;
|
|
30
|
+
/**
|
|
31
|
+
* Patch any subset of mutable fields. `key` is immutable (it's the PK
|
|
32
|
+
* and is referenced by `vk_tenant_social_platforms` ON DELETE RESTRICT;
|
|
33
|
+
* renaming would break those FKs). A status flip stamps / clears the
|
|
34
|
+
* matching lifecycle timestamp. A no-op patch returns the current row.
|
|
35
|
+
*/
|
|
36
|
+
export declare function patchSocialPlatform(querier: Querier, key: string, patch: PatchSocialPlatformInput): Promise<SocialPlatformRow | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Delete a catalog row. RESTRICTed by the `vk_tenant_social_platforms`
|
|
39
|
+
* FK — a row in use by any tenant raises `23503`; callers translate
|
|
40
|
+
* that to a friendly 409. Returns `true` when a row was removed.
|
|
41
|
+
*/
|
|
42
|
+
export declare function deleteSocialPlatform(querier: Querier, key: string): Promise<boolean>;
|
|
43
|
+
/** True when `err` is a Postgres `unique_violation` (23505). */
|
|
44
|
+
export declare function isUniqueViolation(err: unknown): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* True when `err` is a Postgres `foreign_key_violation` (23503) — used
|
|
47
|
+
* to map a delete blocked by `vk_tenant_social_platforms` into a 409.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isForeignKeyViolation(err: unknown): boolean;
|
|
50
|
+
//# sourceMappingURL=crud.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../src/catalog/crud.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,OAAO,EACP,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAmBpB;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAW9B;AAED,oEAAoE;AACpE,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAMnC;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAwB5B;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAyCnC;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,OAAO,CAAC,CAMlB;AAID,gEAAgE;AAChE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAKvD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAK3D"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRUD over `vk_social_platforms` — the platform-admin-owned catalog.
|
|
3
|
+
*
|
|
4
|
+
* Pure SQL against a caller-supplied `Querier`; no `@venturekit/data`
|
|
5
|
+
* import so the package stays decoupled from the data layer (it's an
|
|
6
|
+
* optional peer). Consumers pass their `query` / transaction querier in.
|
|
7
|
+
*
|
|
8
|
+
* Lifecycle-timestamp convention (matches the LLM model catalog):
|
|
9
|
+
* flipping `status` into `deprecated` / `disabled` auto-stamps the
|
|
10
|
+
* matching timestamp; flipping back to `available` clears both.
|
|
11
|
+
*/
|
|
12
|
+
// Shared projection so reads + read-backs return an identical shape
|
|
13
|
+
// regardless of the consumer's mapper config (explicit aliases don't
|
|
14
|
+
// depend on the snake→camel auto-mapper being enabled).
|
|
15
|
+
const PLATFORM_SELECT = `
|
|
16
|
+
SELECT
|
|
17
|
+
key,
|
|
18
|
+
display_name AS "displayName",
|
|
19
|
+
status,
|
|
20
|
+
description,
|
|
21
|
+
meta,
|
|
22
|
+
introduced_at AS "introducedAt",
|
|
23
|
+
deprecated_at AS "deprecatedAt",
|
|
24
|
+
disabled_at AS "disabledAt",
|
|
25
|
+
created_at AS "createdAt",
|
|
26
|
+
updated_at AS "updatedAt"
|
|
27
|
+
FROM vk_social_platforms`;
|
|
28
|
+
/**
|
|
29
|
+
* List every catalog row. Ordered by status (available → deprecated →
|
|
30
|
+
* disabled) so admin pickers show the useful rows up top, then
|
|
31
|
+
* alphabetically within each group.
|
|
32
|
+
*/
|
|
33
|
+
export async function listSocialPlatforms(querier) {
|
|
34
|
+
return querier(`${PLATFORM_SELECT}
|
|
35
|
+
ORDER BY
|
|
36
|
+
CASE status
|
|
37
|
+
WHEN 'available' THEN 0
|
|
38
|
+
WHEN 'deprecated' THEN 1
|
|
39
|
+
WHEN 'disabled' THEN 2
|
|
40
|
+
END,
|
|
41
|
+
display_name ASC`);
|
|
42
|
+
}
|
|
43
|
+
/** Fetch one catalog row by its `key` PK, or `null` when absent. */
|
|
44
|
+
export async function getSocialPlatformByKey(querier, key) {
|
|
45
|
+
const rows = await querier(`${PLATFORM_SELECT} WHERE key = $1 LIMIT 1`, [key]);
|
|
46
|
+
return rows[0] ?? null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Insert a new catalog row. The `key` PK is DB-enforced; callers map
|
|
50
|
+
* `23505` to a 409 via `isUniqueViolation`.
|
|
51
|
+
*
|
|
52
|
+
* When the row is created already in a `deprecated` / `disabled` state
|
|
53
|
+
* the matching lifecycle timestamp is auto-stamped to `NOW()` so the
|
|
54
|
+
* happy path stays one-shot.
|
|
55
|
+
*/
|
|
56
|
+
export async function createSocialPlatform(querier, input) {
|
|
57
|
+
const status = input.status ?? 'available';
|
|
58
|
+
const deprecatedAt = status === 'deprecated' ? 'NOW()' : 'NULL';
|
|
59
|
+
const disabledAt = status === 'disabled' ? 'NOW()' : 'NULL';
|
|
60
|
+
await querier(`INSERT INTO vk_social_platforms
|
|
61
|
+
(key, display_name, description, status, meta, deprecated_at, disabled_at)
|
|
62
|
+
VALUES
|
|
63
|
+
($1, $2, $3, $4::vk_social_platform_status, $5::jsonb, ${deprecatedAt}, ${disabledAt})`, [
|
|
64
|
+
input.key,
|
|
65
|
+
input.displayName,
|
|
66
|
+
input.description ?? null,
|
|
67
|
+
status,
|
|
68
|
+
JSON.stringify(input.meta ?? {}),
|
|
69
|
+
]);
|
|
70
|
+
const row = await getSocialPlatformByKey(querier, input.key);
|
|
71
|
+
if (!row) {
|
|
72
|
+
throw new Error(`Insert into vk_social_platforms succeeded but read-back returned null for key=${input.key}`);
|
|
73
|
+
}
|
|
74
|
+
return row;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Patch any subset of mutable fields. `key` is immutable (it's the PK
|
|
78
|
+
* and is referenced by `vk_tenant_social_platforms` ON DELETE RESTRICT;
|
|
79
|
+
* renaming would break those FKs). A status flip stamps / clears the
|
|
80
|
+
* matching lifecycle timestamp. A no-op patch returns the current row.
|
|
81
|
+
*/
|
|
82
|
+
export async function patchSocialPlatform(querier, key, patch) {
|
|
83
|
+
const sets = [];
|
|
84
|
+
const params = [];
|
|
85
|
+
let idx = 1;
|
|
86
|
+
if (patch.displayName !== undefined) {
|
|
87
|
+
sets.push(`display_name = $${idx++}`);
|
|
88
|
+
params.push(patch.displayName);
|
|
89
|
+
}
|
|
90
|
+
if (patch.description !== undefined) {
|
|
91
|
+
sets.push(`description = $${idx++}`);
|
|
92
|
+
params.push(patch.description);
|
|
93
|
+
}
|
|
94
|
+
if (patch.meta !== undefined) {
|
|
95
|
+
sets.push(`meta = $${idx++}::jsonb`);
|
|
96
|
+
params.push(JSON.stringify(patch.meta));
|
|
97
|
+
}
|
|
98
|
+
if (patch.status !== undefined) {
|
|
99
|
+
sets.push(`status = $${idx++}::vk_social_platform_status`);
|
|
100
|
+
params.push(patch.status);
|
|
101
|
+
if (patch.status === 'deprecated') {
|
|
102
|
+
sets.push(`deprecated_at = COALESCE(deprecated_at, NOW())`);
|
|
103
|
+
sets.push(`disabled_at = NULL`);
|
|
104
|
+
}
|
|
105
|
+
else if (patch.status === 'disabled') {
|
|
106
|
+
sets.push(`disabled_at = COALESCE(disabled_at, NOW())`);
|
|
107
|
+
}
|
|
108
|
+
else if (patch.status === 'available') {
|
|
109
|
+
sets.push(`deprecated_at = NULL`);
|
|
110
|
+
sets.push(`disabled_at = NULL`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (sets.length === 0) {
|
|
114
|
+
return getSocialPlatformByKey(querier, key);
|
|
115
|
+
}
|
|
116
|
+
sets.push(`updated_at = NOW()`);
|
|
117
|
+
params.push(key);
|
|
118
|
+
await querier(`UPDATE vk_social_platforms
|
|
119
|
+
SET ${sets.join(', ')}
|
|
120
|
+
WHERE key = $${idx}`, params);
|
|
121
|
+
return getSocialPlatformByKey(querier, key);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Delete a catalog row. RESTRICTed by the `vk_tenant_social_platforms`
|
|
125
|
+
* FK — a row in use by any tenant raises `23503`; callers translate
|
|
126
|
+
* that to a friendly 409. Returns `true` when a row was removed.
|
|
127
|
+
*/
|
|
128
|
+
export async function deleteSocialPlatform(querier, key) {
|
|
129
|
+
const result = await querier(`DELETE FROM vk_social_platforms WHERE key = $1 RETURNING key`, [key]);
|
|
130
|
+
return result.length > 0;
|
|
131
|
+
}
|
|
132
|
+
// ─── PG error helpers ───────────────────────────────────────────────
|
|
133
|
+
/** True when `err` is a Postgres `unique_violation` (23505). */
|
|
134
|
+
export function isUniqueViolation(err) {
|
|
135
|
+
if (err && typeof err === 'object' && 'code' in err) {
|
|
136
|
+
if (err.code === '23505')
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* True when `err` is a Postgres `foreign_key_violation` (23503) — used
|
|
143
|
+
* to map a delete blocked by `vk_tenant_social_platforms` into a 409.
|
|
144
|
+
*/
|
|
145
|
+
export function isForeignKeyViolation(err) {
|
|
146
|
+
if (err && typeof err === 'object' && 'code' in err) {
|
|
147
|
+
if (err.code === '23503')
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=crud.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crud.js","sourceRoot":"","sources":["../../src/catalog/crud.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,oEAAoE;AACpE,qEAAqE;AACrE,wDAAwD;AACxD,MAAM,eAAe,GAAG;;;;;;;;;;;;2BAYG,CAAC;AAE5B;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAgB;IAEhB,OAAO,OAAO,CACZ,GAAG,eAAe;;;;;;;wBAOE,CACrB,CAAC;AACJ,CAAC;AAED,oEAAoE;AACpE,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAgB,EAChB,GAAW;IAEX,MAAM,IAAI,GAAG,MAAM,OAAO,CACxB,GAAG,eAAe,yBAAyB,EAC3C,CAAC,GAAG,CAAC,CACN,CAAC;IACF,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACzB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAAgB,EAChB,KAAgC;IAEhC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,WAAW,CAAC;IAC3C,MAAM,YAAY,GAAG,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAChE,MAAM,UAAU,GAAG,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5D,MAAM,OAA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C,GAAG,CAAC,CACN,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED,uEAAuE;AAEvE,gEAAgE;AAChE,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC5C,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QACpD,IAAK,GAA0B,CAAC,IAAI,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;IAChE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAChD,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QACpD,IAAK,GAA0B,CAAC,IAAI,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;IAChE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vk_social_platforms` catalog — CRUD + types.
|
|
3
|
+
*
|
|
4
|
+
* The platform-admin-owned list of supported social networks. Consuming
|
|
5
|
+
* apps expose this read-write to their platform admins and read-only to
|
|
6
|
+
* tenants. Pair with `vk_tenant_social_platforms` (per-tenant enable +
|
|
7
|
+
* author-ref) which the package also ships.
|
|
8
|
+
*/
|
|
9
|
+
export type { SocialPlatformStatus, SocialPlatformRow, CreateSocialPlatformInput, PatchSocialPlatformInput, Querier, } from './types.js';
|
|
10
|
+
export { listSocialPlatforms, getSocialPlatformByKey, createSocialPlatform, patchSocialPlatform, deleteSocialPlatform, isUniqueViolation, isForeignKeyViolation, } from './crud.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/catalog/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,OAAO,GACR,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vk_social_platforms` catalog — CRUD + types.
|
|
3
|
+
*
|
|
4
|
+
* The platform-admin-owned list of supported social networks. Consuming
|
|
5
|
+
* apps expose this read-write to their platform admins and read-only to
|
|
6
|
+
* tenants. Pair with `vk_tenant_social_platforms` (per-tenant enable +
|
|
7
|
+
* author-ref) which the package also ships.
|
|
8
|
+
*/
|
|
9
|
+
export { listSocialPlatforms, getSocialPlatformByKey, createSocialPlatform, patchSocialPlatform, deleteSocialPlatform, isUniqueViolation, isForeignKeyViolation, } from './crud.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/catalog/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the `vk_social_platforms` catalog CRUD module.
|
|
3
|
+
*
|
|
4
|
+
* The catalog is the platform-admin-owned list of every social network
|
|
5
|
+
* the package supports (schema in `vk_social_0001_init.sql`). One row
|
|
6
|
+
* per `(provider, adapter version)`. Consuming apps (e.g. the CMS) expose
|
|
7
|
+
* CRUD over this same table to their platform-admin users; tenants only
|
|
8
|
+
* enumerate it.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Lifecycle status — mirrors the DB enum `vk_social_platform_status`:
|
|
12
|
+
* - `available` — renders in pickers.
|
|
13
|
+
* - `deprecated` — still callable, UI nudges a swap.
|
|
14
|
+
* - `disabled` — refuses to publish at the adapter-resolution boundary.
|
|
15
|
+
*/
|
|
16
|
+
export type SocialPlatformStatus = 'available' | 'deprecated' | 'disabled';
|
|
17
|
+
/**
|
|
18
|
+
* One row of `vk_social_platforms`, post-mapping (snake_case →
|
|
19
|
+
* camelCase). `meta` is intentionally loose (`Record<string, unknown>`)
|
|
20
|
+
* — the package documents `{ iconKey, brandColor }` but apps may stamp
|
|
21
|
+
* extra rendering keys.
|
|
22
|
+
*/
|
|
23
|
+
export interface SocialPlatformRow {
|
|
24
|
+
key: string;
|
|
25
|
+
displayName: string;
|
|
26
|
+
status: SocialPlatformStatus;
|
|
27
|
+
description: string | null;
|
|
28
|
+
meta: Record<string, unknown>;
|
|
29
|
+
introducedAt: Date;
|
|
30
|
+
deprecatedAt: Date | null;
|
|
31
|
+
disabledAt: Date | null;
|
|
32
|
+
createdAt: Date;
|
|
33
|
+
updatedAt: Date;
|
|
34
|
+
}
|
|
35
|
+
export interface CreateSocialPlatformInput {
|
|
36
|
+
key: string;
|
|
37
|
+
displayName: string;
|
|
38
|
+
description?: string | null;
|
|
39
|
+
status?: SocialPlatformStatus;
|
|
40
|
+
meta?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export interface PatchSocialPlatformInput {
|
|
43
|
+
displayName?: string;
|
|
44
|
+
description?: string | null;
|
|
45
|
+
status?: SocialPlatformStatus;
|
|
46
|
+
meta?: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Querier — same shape as the rest of the workspace (`@venturekit/data`'s
|
|
50
|
+
* `query` / a bound transaction `tx.query`). Declared locally so this
|
|
51
|
+
* module carries no hard dependency on `@venturekit/data` (it's an
|
|
52
|
+
* optional peer); the consumer passes their querier in.
|
|
53
|
+
*/
|
|
54
|
+
export type Querier = <T = Record<string, unknown>[]>(sql: string, params?: unknown[]) => Promise<T>;
|
|
55
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/catalog/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,YAAY,EAAE,IAAI,CAAC;IACnB,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,wBAAwB;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAClD,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,OAAO,EAAE,KACf,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the `vk_social_platforms` catalog CRUD module.
|
|
3
|
+
*
|
|
4
|
+
* The catalog is the platform-admin-owned list of every social network
|
|
5
|
+
* the package supports (schema in `vk_social_0001_init.sql`). One row
|
|
6
|
+
* per `(provider, adapter version)`. Consuming apps (e.g. the CMS) expose
|
|
7
|
+
* CRUD over this same table to their platform-admin users; tenants only
|
|
8
|
+
* enumerate it.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/catalog/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* `createXAdapter` /
|
|
11
11
|
* `createFacebookAdapter` /
|
|
12
12
|
* `createInstagramAdapter` — v1 adapters.
|
|
13
|
+
* - `listSocialPlatforms` / `createSocialPlatform` / …
|
|
14
|
+
* — CRUD over the `vk_social_platforms` catalog.
|
|
13
15
|
* - `getSocialMigrationsDir` — path to `vk_social_*.sql` for `vk migrate`.
|
|
14
16
|
*
|
|
15
17
|
* Documentation: https://venturekit.dev
|
|
@@ -24,5 +26,7 @@ export { vendorFetch } from './http.js';
|
|
|
24
26
|
export type { FetchOptions, FetchResult } from './http.js';
|
|
25
27
|
export { createLinkedInAdapter, LINKEDIN_CONSTRAINTS, createXAdapter, X_CONSTRAINTS, createFacebookAdapter, FACEBOOK_CONSTRAINTS, createInstagramAdapter, INSTAGRAM_CONSTRAINTS, } from './adapters/index.js';
|
|
26
28
|
export type { LinkedInAdapterConfig, XAdapterConfig, FacebookAdapterConfig, InstagramAdapterConfig, } from './adapters/index.js';
|
|
29
|
+
export { listSocialPlatforms, getSocialPlatformByKey, createSocialPlatform, patchSocialPlatform, deleteSocialPlatform, isUniqueViolation, isForeignKeyViolation, } from './catalog/index.js';
|
|
30
|
+
export type { SocialPlatformStatus, SocialPlatformRow, CreateSocialPlatformInput, PatchSocialPlatformInput, } from './catalog/index.js';
|
|
27
31
|
export { getSocialMigrationsDir } from './path.js';
|
|
28
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,YAAY,EACV,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG3D,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* `createXAdapter` /
|
|
11
11
|
* `createFacebookAdapter` /
|
|
12
12
|
* `createInstagramAdapter` — v1 adapters.
|
|
13
|
+
* - `listSocialPlatforms` / `createSocialPlatform` / …
|
|
14
|
+
* — CRUD over the `vk_social_platforms` catalog.
|
|
13
15
|
* - `getSocialMigrationsDir` — path to `vk_social_*.sql` for `vk migrate`.
|
|
14
16
|
*
|
|
15
17
|
* Documentation: https://venturekit.dev
|
|
@@ -22,6 +24,8 @@ export { validatePost, simplifyRatio } from './validation.js';
|
|
|
22
24
|
export { vendorFetch } from './http.js';
|
|
23
25
|
// ─── V1 adapters ─────────────────────────────────────────────────────
|
|
24
26
|
export { createLinkedInAdapter, LINKEDIN_CONSTRAINTS, createXAdapter, X_CONSTRAINTS, createFacebookAdapter, FACEBOOK_CONSTRAINTS, createInstagramAdapter, INSTAGRAM_CONSTRAINTS, } from './adapters/index.js';
|
|
27
|
+
// ─── Platform catalog (vk_social_platforms CRUD) ─────────────────────
|
|
28
|
+
export { listSocialPlatforms, getSocialPlatformByKey, createSocialPlatform, patchSocialPlatform, deleteSocialPlatform, isUniqueViolation, isForeignKeyViolation, } from './catalog/index.js';
|
|
25
29
|
// ─── Migrations wiring ───────────────────────────────────────────────
|
|
26
30
|
export { getSocialMigrationsDir } from './path.js';
|
|
27
31
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAiBH,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,wEAAwE;AACxE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE9D,uEAAuE;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,wEAAwE;AACxE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAQ7B,wEAAwE;AACxE,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAQ5B,wEAAwE;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -35,7 +35,7 @@ BEGIN
|
|
|
35
35
|
END
|
|
36
36
|
$$;
|
|
37
37
|
|
|
38
|
-
CREATE TABLE IF NOT EXISTS
|
|
38
|
+
CREATE TABLE IF NOT EXISTS vk_social_platforms (
|
|
39
39
|
key varchar(64) PRIMARY KEY,
|
|
40
40
|
display_name varchar(255) NOT NULL,
|
|
41
41
|
-- Lifecycle: `available` rows render in pickers; `deprecated` ones
|
|
@@ -65,9 +65,9 @@ CREATE TABLE IF NOT EXISTS social_platforms (
|
|
|
65
65
|
-- author ref (the platform-side id we publish into), and optional
|
|
66
66
|
-- vendor metadata.
|
|
67
67
|
|
|
68
|
-
CREATE TABLE IF NOT EXISTS
|
|
68
|
+
CREATE TABLE IF NOT EXISTS vk_tenant_social_platforms (
|
|
69
69
|
tenant_id uuid NOT NULL,
|
|
70
|
-
platform_key varchar(64) NOT NULL REFERENCES
|
|
70
|
+
platform_key varchar(64) NOT NULL REFERENCES vk_social_platforms(key) ON DELETE RESTRICT,
|
|
71
71
|
enabled boolean NOT NULL DEFAULT TRUE,
|
|
72
72
|
-- Platform-side identifier this tenant publishes to. URN / page id /
|
|
73
73
|
-- ig user id. Required when enabled = TRUE; the application enforces
|
|
@@ -84,7 +84,7 @@ CREATE TABLE IF NOT EXISTS tenant_social_platforms (
|
|
|
84
84
|
);
|
|
85
85
|
|
|
86
86
|
CREATE INDEX IF NOT EXISTS tenant_social_platforms_enabled_idx
|
|
87
|
-
ON
|
|
87
|
+
ON vk_tenant_social_platforms (tenant_id)
|
|
88
88
|
WHERE enabled;
|
|
89
89
|
|
|
90
90
|
-- ─── Catalog seed ───────────────────────────────────────────────────
|
|
@@ -93,7 +93,7 @@ CREATE INDEX IF NOT EXISTS tenant_social_platforms_enabled_idx
|
|
|
93
93
|
-- an already-seeded DB is a no-op. Tenants who want to add custom
|
|
94
94
|
-- adapters (e.g. Mastodon, Bluesky) insert their own row at app boot.
|
|
95
95
|
|
|
96
|
-
INSERT INTO
|
|
96
|
+
INSERT INTO vk_social_platforms (key, display_name, description, meta) VALUES
|
|
97
97
|
(
|
|
98
98
|
'linkedin',
|
|
99
99
|
'LinkedIn',
|
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.20260701113915",
|
|
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.20260701113915"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@venturekit/data": "0.0.0-dev.
|
|
61
|
+
"@venturekit/data": "0.0.0-dev.20260701113915"
|
|
62
62
|
},
|
|
63
63
|
"peerDependenciesMeta": {
|
|
64
64
|
"@venturekit/data": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/node": "^25.6.0",
|
|
70
|
-
"@venturekit/data": "0.0.0-dev.
|
|
70
|
+
"@venturekit/data": "0.0.0-dev.20260701113915",
|
|
71
71
|
"typescript": "^5.3.0"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
@@ -35,7 +35,7 @@ BEGIN
|
|
|
35
35
|
END
|
|
36
36
|
$$;
|
|
37
37
|
|
|
38
|
-
CREATE TABLE IF NOT EXISTS
|
|
38
|
+
CREATE TABLE IF NOT EXISTS vk_social_platforms (
|
|
39
39
|
key varchar(64) PRIMARY KEY,
|
|
40
40
|
display_name varchar(255) NOT NULL,
|
|
41
41
|
-- Lifecycle: `available` rows render in pickers; `deprecated` ones
|
|
@@ -65,9 +65,9 @@ CREATE TABLE IF NOT EXISTS social_platforms (
|
|
|
65
65
|
-- author ref (the platform-side id we publish into), and optional
|
|
66
66
|
-- vendor metadata.
|
|
67
67
|
|
|
68
|
-
CREATE TABLE IF NOT EXISTS
|
|
68
|
+
CREATE TABLE IF NOT EXISTS vk_tenant_social_platforms (
|
|
69
69
|
tenant_id uuid NOT NULL,
|
|
70
|
-
platform_key varchar(64) NOT NULL REFERENCES
|
|
70
|
+
platform_key varchar(64) NOT NULL REFERENCES vk_social_platforms(key) ON DELETE RESTRICT,
|
|
71
71
|
enabled boolean NOT NULL DEFAULT TRUE,
|
|
72
72
|
-- Platform-side identifier this tenant publishes to. URN / page id /
|
|
73
73
|
-- ig user id. Required when enabled = TRUE; the application enforces
|
|
@@ -84,7 +84,7 @@ CREATE TABLE IF NOT EXISTS tenant_social_platforms (
|
|
|
84
84
|
);
|
|
85
85
|
|
|
86
86
|
CREATE INDEX IF NOT EXISTS tenant_social_platforms_enabled_idx
|
|
87
|
-
ON
|
|
87
|
+
ON vk_tenant_social_platforms (tenant_id)
|
|
88
88
|
WHERE enabled;
|
|
89
89
|
|
|
90
90
|
-- ─── Catalog seed ───────────────────────────────────────────────────
|
|
@@ -93,7 +93,7 @@ CREATE INDEX IF NOT EXISTS tenant_social_platforms_enabled_idx
|
|
|
93
93
|
-- an already-seeded DB is a no-op. Tenants who want to add custom
|
|
94
94
|
-- adapters (e.g. Mastodon, Bluesky) insert their own row at app boot.
|
|
95
95
|
|
|
96
|
-
INSERT INTO
|
|
96
|
+
INSERT INTO vk_social_platforms (key, display_name, description, meta) VALUES
|
|
97
97
|
(
|
|
98
98
|
'linkedin',
|
|
99
99
|
'LinkedIn',
|
package/LICENSE
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Apache License
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
5
|
-
|
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
-
|
|
8
|
-
1. Definitions.
|
|
9
|
-
|
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
-
the copyright owner that is granting the License.
|
|
15
|
-
|
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
-
|
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
-
exercising permissions granted by this License.
|
|
26
|
-
|
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
30
|
-
|
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
|
32
|
-
transformation or translation of a Source form, including but
|
|
33
|
-
not limited to compiled object code, generated documentation,
|
|
34
|
-
and conversions to other media types.
|
|
35
|
-
|
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
40
|
-
|
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
48
|
-
|
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
-
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
-
subsequently incorporated within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding any notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
Copyright 2025 VentureKit Contributors
|
|
180
|
-
|
|
181
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
-
you may not use this file except in compliance with the License.
|
|
183
|
-
You may obtain a copy of the License at
|
|
184
|
-
|
|
185
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
-
|
|
187
|
-
Unless required by applicable law or agreed to in writing, software
|
|
188
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
-
See the License for the specific language governing permissions and
|
|
191
|
-
limitations under the License.
|