@opencoredev/social-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -0
  3. package/dist/cli.d.ts +14 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +223 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/cloud/common.d.ts +26 -0
  8. package/dist/cloud/common.d.ts.map +1 -0
  9. package/dist/cloud/common.js +307 -0
  10. package/dist/cloud/common.js.map +1 -0
  11. package/dist/cloud/lifecycle.d.ts +11 -0
  12. package/dist/cloud/lifecycle.d.ts.map +1 -0
  13. package/dist/cloud/lifecycle.js +108 -0
  14. package/dist/cloud/lifecycle.js.map +1 -0
  15. package/dist/cloud/media.d.ts +24 -0
  16. package/dist/cloud/media.d.ts.map +1 -0
  17. package/dist/cloud/media.js +97 -0
  18. package/dist/cloud/media.js.map +1 -0
  19. package/dist/cloud/outcomes.d.ts +10 -0
  20. package/dist/cloud/outcomes.d.ts.map +1 -0
  21. package/dist/cloud/outcomes.js +188 -0
  22. package/dist/cloud/outcomes.js.map +1 -0
  23. package/dist/cloud/post-for-me.d.ts +70 -0
  24. package/dist/cloud/post-for-me.d.ts.map +1 -0
  25. package/dist/cloud/post-for-me.js +326 -0
  26. package/dist/cloud/post-for-me.js.map +1 -0
  27. package/dist/cloud/zernio.d.ts +112 -0
  28. package/dist/cloud/zernio.d.ts.map +1 -0
  29. package/dist/cloud/zernio.js +542 -0
  30. package/dist/cloud/zernio.js.map +1 -0
  31. package/dist/core/adapter.d.ts +118 -0
  32. package/dist/core/adapter.d.ts.map +1 -0
  33. package/dist/core/adapter.js +4 -0
  34. package/dist/core/adapter.js.map +1 -0
  35. package/dist/core/client.d.ts +108 -0
  36. package/dist/core/client.d.ts.map +1 -0
  37. package/dist/core/client.js +893 -0
  38. package/dist/core/client.js.map +1 -0
  39. package/dist/core/concurrency.d.ts +10 -0
  40. package/dist/core/concurrency.d.ts.map +1 -0
  41. package/dist/core/concurrency.js +78 -0
  42. package/dist/core/concurrency.js.map +1 -0
  43. package/dist/core/errors.d.ts +45 -0
  44. package/dist/core/errors.d.ts.map +1 -0
  45. package/dist/core/errors.js +44 -0
  46. package/dist/core/errors.js.map +1 -0
  47. package/dist/core/idempotency.d.ts +34 -0
  48. package/dist/core/idempotency.d.ts.map +1 -0
  49. package/dist/core/idempotency.js +59 -0
  50. package/dist/core/idempotency.js.map +1 -0
  51. package/dist/core/index.d.ts +7 -0
  52. package/dist/core/index.d.ts.map +1 -0
  53. package/dist/core/index.js +7 -0
  54. package/dist/core/index.js.map +1 -0
  55. package/dist/core/pagination.d.ts +12 -0
  56. package/dist/core/pagination.d.ts.map +1 -0
  57. package/dist/core/pagination.js +81 -0
  58. package/dist/core/pagination.js.map +1 -0
  59. package/dist/core/types.d.ts +329 -0
  60. package/dist/core/types.d.ts.map +1 -0
  61. package/dist/core/types.js +7 -0
  62. package/dist/core/types.js.map +1 -0
  63. package/dist/index.d.ts +2 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +2 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/platforms/bluesky.d.ts +132 -0
  68. package/dist/platforms/bluesky.d.ts.map +1 -0
  69. package/dist/platforms/bluesky.js +1049 -0
  70. package/dist/platforms/bluesky.js.map +1 -0
  71. package/dist/platforms/instagram.d.ts +63 -0
  72. package/dist/platforms/instagram.d.ts.map +1 -0
  73. package/dist/platforms/instagram.js +676 -0
  74. package/dist/platforms/instagram.js.map +1 -0
  75. package/dist/platforms/linkedin.d.ts +54 -0
  76. package/dist/platforms/linkedin.d.ts.map +1 -0
  77. package/dist/platforms/linkedin.js +580 -0
  78. package/dist/platforms/linkedin.js.map +1 -0
  79. package/dist/platforms/threads.d.ts +102 -0
  80. package/dist/platforms/threads.d.ts.map +1 -0
  81. package/dist/platforms/threads.js +571 -0
  82. package/dist/platforms/threads.js.map +1 -0
  83. package/dist/platforms/tiktok.d.ts +32 -0
  84. package/dist/platforms/tiktok.d.ts.map +1 -0
  85. package/dist/platforms/tiktok.js +511 -0
  86. package/dist/platforms/tiktok.js.map +1 -0
  87. package/dist/platforms/x-engagement.d.ts +17 -0
  88. package/dist/platforms/x-engagement.d.ts.map +1 -0
  89. package/dist/platforms/x-engagement.js +47 -0
  90. package/dist/platforms/x-engagement.js.map +1 -0
  91. package/dist/platforms/x.d.ts +82 -0
  92. package/dist/platforms/x.d.ts.map +1 -0
  93. package/dist/platforms/x.js +511 -0
  94. package/dist/platforms/x.js.map +1 -0
  95. package/dist/platforms/youtube-upload.d.ts +33 -0
  96. package/dist/platforms/youtube-upload.d.ts.map +1 -0
  97. package/dist/platforms/youtube-upload.js +281 -0
  98. package/dist/platforms/youtube-upload.js.map +1 -0
  99. package/dist/platforms/youtube.d.ts +55 -0
  100. package/dist/platforms/youtube.d.ts.map +1 -0
  101. package/dist/platforms/youtube.js +561 -0
  102. package/dist/platforms/youtube.js.map +1 -0
  103. package/dist/server/connections.d.ts +124 -0
  104. package/dist/server/connections.d.ts.map +1 -0
  105. package/dist/server/connections.js +334 -0
  106. package/dist/server/connections.js.map +1 -0
  107. package/dist/server/credentials.d.ts +52 -0
  108. package/dist/server/credentials.d.ts.map +1 -0
  109. package/dist/server/credentials.js +115 -0
  110. package/dist/server/credentials.js.map +1 -0
  111. package/dist/server/index.d.ts +5 -0
  112. package/dist/server/index.d.ts.map +1 -0
  113. package/dist/server/index.js +5 -0
  114. package/dist/server/index.js.map +1 -0
  115. package/dist/server/oauth.d.ts +48 -0
  116. package/dist/server/oauth.d.ts.map +1 -0
  117. package/dist/server/oauth.js +483 -0
  118. package/dist/server/oauth.js.map +1 -0
  119. package/dist/server/webhooks.d.ts +58 -0
  120. package/dist/server/webhooks.d.ts.map +1 -0
  121. package/dist/server/webhooks.js +198 -0
  122. package/dist/server/webhooks.js.map +1 -0
  123. package/dist/testing/index.d.ts +47 -0
  124. package/dist/testing/index.d.ts.map +1 -0
  125. package/dist/testing/index.js +413 -0
  126. package/dist/testing/index.js.map +1 -0
  127. package/dist/testing.d.ts +2 -0
  128. package/dist/testing.d.ts.map +1 -0
  129. package/dist/testing.js +2 -0
  130. package/dist/testing.js.map +1 -0
  131. package/dist/transport/binary.d.ts +3 -0
  132. package/dist/transport/binary.d.ts.map +1 -0
  133. package/dist/transport/binary.js +30 -0
  134. package/dist/transport/binary.js.map +1 -0
  135. package/dist/transport/budget.d.ts +4 -0
  136. package/dist/transport/budget.d.ts.map +1 -0
  137. package/dist/transport/budget.js +27 -0
  138. package/dist/transport/budget.js.map +1 -0
  139. package/dist/transport/http.d.ts +44 -0
  140. package/dist/transport/http.d.ts.map +1 -0
  141. package/dist/transport/http.js +230 -0
  142. package/dist/transport/http.js.map +1 -0
  143. package/dist/transport/json.d.ts +3 -0
  144. package/dist/transport/json.d.ts.map +1 -0
  145. package/dist/transport/json.js +11 -0
  146. package/dist/transport/json.js.map +1 -0
  147. package/dist/transport/upload.d.ts +25 -0
  148. package/dist/transport/upload.d.ts.map +1 -0
  149. package/dist/transport/upload.js +133 -0
  150. package/dist/transport/upload.js.map +1 -0
  151. package/dist/transport/validation.d.ts +6 -0
  152. package/dist/transport/validation.d.ts.map +1 -0
  153. package/dist/transport/validation.js +24 -0
  154. package/dist/transport/validation.js.map +1 -0
  155. package/package.json +96 -0
@@ -0,0 +1,326 @@
1
+ import { managedLifecycle } from "./lifecycle.js";
2
+ import { managedMedia } from "./media.js";
3
+ export { MemoryManagedMediaStore, } from "./media.js";
4
+ import { defineAdapter } from "../core/adapter.js";
5
+ import { SocialError } from "../core/errors.js";
6
+ import { array, object, optionalNumber, optionalString, string } from "../transport/validation.js";
7
+ import { verifyPostForMeWebhook, decodeWebhook } from "../server/webhooks.js";
8
+ import { accountMatches, capabilityManifest, managedHttp, managedPreparation, managedOptionIssues, optionsObject, platform, publicFields, } from "./common.js";
9
+ import { postForMeOutcome } from "./outcomes.js";
10
+ export function postForMe(options) {
11
+ const request = managedHttp("https://api.postforme.dev", options);
12
+ const mediaPipeline = managedMedia("post-for-me", options, (body, context) => request("/v1/media/create-upload-url", context, body));
13
+ const now = () => (options.clock?.() ?? new Date()).toISOString();
14
+ const account = (value, backend) => {
15
+ const row = object(value);
16
+ const handle = optionalString(row["username"]);
17
+ return {
18
+ ref: {
19
+ kind: "connected-account",
20
+ version: 1,
21
+ backend,
22
+ platform: platform(row["platform"]),
23
+ accountId: string(row["id"]),
24
+ },
25
+ displayName: handle ?? string(row["user_id"]),
26
+ ...(handle ? { handle } : {}),
27
+ status: row["status"] === "connected"
28
+ ? "connected"
29
+ : row["status"] === "disconnected"
30
+ ? "reconnect-required"
31
+ : "unknown",
32
+ };
33
+ };
34
+ const feed = async (ref, context, metrics) => {
35
+ accountMatches(ref, context);
36
+ const result = object(await request(`/v1/social-account-feeds/${encodeURIComponent(ref.accountId)}`, context, undefined, { platform_post_id: ref.postId, limit: "1", ...(metrics ? { expand: "metrics" } : {}) }));
37
+ const row = array(result["data"])
38
+ .map(object)
39
+ .find((item) => item["platform_post_id"] === ref.postId && item["social_account_id"] === ref.accountId);
40
+ if (!row)
41
+ throw new SocialError({
42
+ code: "upstream_failure",
43
+ operation: "posts.read",
44
+ message: "The native post is absent or inaccessible in this account feed.",
45
+ });
46
+ return row;
47
+ };
48
+ const adapter = defineAdapter({
49
+ id: "post-for-me",
50
+ capabilities: capabilityManifest("post-for-me", "v1 / OpenAPI 1.0", [
51
+ "accounts.read",
52
+ "posts.publish",
53
+ "posts.read",
54
+ "posts.list",
55
+ "posts.status",
56
+ "posts.cancelScheduled",
57
+ "posts.deleteBackendRecord",
58
+ "analytics.read",
59
+ "media.upload",
60
+ "webhooks.verify",
61
+ ]),
62
+ media: { upload: mediaPipeline.upload },
63
+ accounts: {
64
+ async list(input, context) {
65
+ const offset = input.cursor === undefined ? 0 : Number(input.cursor);
66
+ const limit = input.limit ?? 25;
67
+ if (!Number.isSafeInteger(offset) ||
68
+ offset < 0 ||
69
+ !Number.isSafeInteger(limit) ||
70
+ limit < 1 ||
71
+ limit > 100)
72
+ throw new SocialError({
73
+ code: "invalid_input",
74
+ operation: "accounts.read",
75
+ message: "Use an opaque returned cursor and a page size from 1 to 100.",
76
+ });
77
+ const result = object(await request("/v1/social-accounts", context, undefined, {
78
+ offset: String(offset),
79
+ limit: String(limit),
80
+ }));
81
+ const rows = array(result["data"]);
82
+ const meta = object(result["meta"]);
83
+ const next = meta["next"] ? String(offset + limit) : undefined;
84
+ return {
85
+ items: rows.map((value) => account(value, context.backendInstance)),
86
+ ...(next ? { nextCursor: next } : {}),
87
+ };
88
+ },
89
+ async get(ref, context) {
90
+ accountMatches(ref, context);
91
+ const result = account(await request(`/v1/social-accounts/${encodeURIComponent(ref.accountId)}`, context), context.backendInstance);
92
+ if (result.ref.accountId !== ref.accountId || result.ref.platform !== ref.platform)
93
+ throw new SocialError({
94
+ code: "unauthorized",
95
+ operation: "accounts.read",
96
+ message: "Account identity does not match the requested reference.",
97
+ });
98
+ return result;
99
+ },
100
+ },
101
+ posts: {
102
+ ...managedLifecycle("post-for-me", request, now),
103
+ async list(account, input, context) {
104
+ accountMatches(account, context);
105
+ const limit = input.limit ?? 25;
106
+ if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100)
107
+ throw new SocialError({
108
+ code: "invalid_input",
109
+ operation: "posts.read",
110
+ message: "Post for Me feed page size must be between 1 and 100.",
111
+ });
112
+ const result = object(await request(`/v1/social-account-feeds/${encodeURIComponent(account.accountId)}`, context, undefined, {
113
+ limit: String(limit),
114
+ ...(input.cursor === undefined ? {} : { cursor: input.cursor }),
115
+ }));
116
+ const rows = array(result["data"])
117
+ .map(object)
118
+ .filter((row) => row["social_account_id"] === account.accountId)
119
+ .map((row) => publicFields(row, [
120
+ "platform_post_id",
121
+ "social_account_id",
122
+ "platform_account_id",
123
+ "platform_url",
124
+ "caption",
125
+ "posted_at",
126
+ "media",
127
+ "created_at",
128
+ ]));
129
+ const meta = result["meta"] === undefined ? {} : object(result["meta"]);
130
+ const hasMore = meta["has_more"];
131
+ const cursor = optionalString(meta["cursor"]);
132
+ // `has_more: false` is authoritative. Older responses may omit it;
133
+ // in that case, a non-empty `next` marker plus cursor permits continuation.
134
+ const next = hasMore === false
135
+ ? undefined
136
+ : hasMore === true
137
+ ? cursor
138
+ : optionalString(meta["next"]) && cursor
139
+ ? cursor
140
+ : undefined;
141
+ return { items: rows, ...(next === undefined ? {} : { nextCursor: next }) };
142
+ },
143
+ prepareTarget(target) {
144
+ const issues = [
145
+ ...managedPreparation(target),
146
+ ...managedOptionIssues(target, "post-for-me"),
147
+ ];
148
+ if (target.account.platform === "tiktok") {
149
+ const privacy = optionsObject(target)["privacy"];
150
+ if (privacy !== "SELF_ONLY" && privacy !== "PUBLIC_TO_EVERYONE")
151
+ issues.push({
152
+ code: "tiktok.privacy_unsupported",
153
+ message: "Post for Me documents private/public privacy only; this adapter cannot map the selected privacy safely.",
154
+ severity: "error",
155
+ targetIndex: target.targetIndex,
156
+ });
157
+ }
158
+ for (const media of target.content.media ?? [])
159
+ if (media.altText !== undefined)
160
+ issues.push({
161
+ code: "media.alt_text_unsupported",
162
+ message: "Post for Me's current media schema does not document alt text. Choose a backend with an explicit accessibility mapping.",
163
+ severity: "error",
164
+ targetIndex: target.targetIndex,
165
+ });
166
+ return issues;
167
+ },
168
+ async publishTarget(target, context) {
169
+ accountMatches(target.account, context);
170
+ const media = [];
171
+ for (const item of target.content.media ?? [])
172
+ media.push({ url: await mediaPipeline.resolve(item, target.account, context) });
173
+ const config = optionsObject(target);
174
+ const platformConfig = {};
175
+ if (target.account.platform === "instagram" && typeof config["shareToFeed"] === "boolean")
176
+ platformConfig["share_to_feed"] = config["shareToFeed"];
177
+ if (target.account.platform === "x" &&
178
+ config["replySettings"] !== undefined &&
179
+ config["replySettings"] !== "everyone")
180
+ platformConfig["reply_settings"] = string(config["replySettings"]);
181
+ if (target.account.platform === "youtube") {
182
+ platformConfig["title"] = string(config["title"]);
183
+ platformConfig["privacy_status"] = string(config["visibility"]);
184
+ if (typeof config["madeForKids"] === "boolean")
185
+ platformConfig["made_for_kids"] = config["madeForKids"];
186
+ }
187
+ if (target.account.platform === "tiktok") {
188
+ platformConfig["privacy_status"] =
189
+ config["privacy"] === "SELF_ONLY" ? "private" : "public";
190
+ platformConfig["auto_add_music"] = false;
191
+ platformConfig["allow_duet"] = !config["disableDuet"];
192
+ platformConfig["allow_stitch"] = !config["disableStitch"];
193
+ platformConfig["disclose_your_brand"] = config["ownBrand"];
194
+ platformConfig["is_ai_generated"] = config["aiGenerated"];
195
+ platformConfig["is_draft"] = config["draft"];
196
+ if (typeof config["disableComments"] === "boolean")
197
+ platformConfig["allow_comment"] = !config["disableComments"];
198
+ if (typeof config["brandedContent"] === "boolean")
199
+ platformConfig["disclose_branded_content"] = config["brandedContent"];
200
+ }
201
+ const response = await request("/v1/social-posts", context, {
202
+ caption: target.content.text ?? "",
203
+ social_accounts: [target.account.accountId],
204
+ media,
205
+ ...(target.schedule ? { scheduled_at: target.schedule.at } : {}),
206
+ ...(context.targetIdempotencyKey ? { external_id: context.targetIdempotencyKey } : {}),
207
+ ...(Object.keys(platformConfig).length
208
+ ? { platform_configurations: { [target.account.platform]: platformConfig } }
209
+ : {}),
210
+ });
211
+ const parent = object(response);
212
+ let results;
213
+ if (parent["status"] === "processed") {
214
+ try {
215
+ results = await request("/v1/social-post-results", context, undefined, {
216
+ post_id: string(parent["id"]),
217
+ social_account_id: target.account.accountId,
218
+ limit: "2",
219
+ });
220
+ }
221
+ catch {
222
+ /* Preserve the accepted parent if immediate reconciliation is unavailable. */
223
+ }
224
+ }
225
+ return postForMeOutcome(parent, results, {
226
+ account: target.account,
227
+ targetIndex: target.targetIndex,
228
+ observedAt: now(),
229
+ });
230
+ },
231
+ async getDelivery(ref, context) {
232
+ const account = {
233
+ kind: "connected-account",
234
+ version: 1,
235
+ backend: ref.backend,
236
+ platform: ref.platform,
237
+ accountId: ref.accountId,
238
+ };
239
+ accountMatches(account, context);
240
+ const parent = await request(`/v1/social-posts/${encodeURIComponent(ref.deliveryId)}`, context);
241
+ const results = await request("/v1/social-post-results", context, undefined, {
242
+ post_id: ref.deliveryId,
243
+ social_account_id: ref.accountId,
244
+ limit: "2",
245
+ });
246
+ return postForMeOutcome(parent, results, { account, targetIndex: 0, observedAt: now() });
247
+ },
248
+ async get(ref, context) {
249
+ return publicFields(await feed(ref, context, false), [
250
+ "platform_post_id",
251
+ "social_account_id",
252
+ "platform_account_id",
253
+ "platform_url",
254
+ "caption",
255
+ "posted_at",
256
+ ]);
257
+ },
258
+ },
259
+ analytics: {
260
+ async getPostMetrics(ref, context) {
261
+ const row = await feed(ref, context, true);
262
+ if (row["metrics"] === undefined || row["metrics"] === null)
263
+ return [];
264
+ const metrics = object(row["metrics"]);
265
+ const result = [];
266
+ // Count fields retain provider names; absent metrics are not invented zeros.
267
+ for (const key of [
268
+ "likes",
269
+ "like_count",
270
+ "comments",
271
+ "comment_count",
272
+ "shares",
273
+ "share_count",
274
+ "views",
275
+ "view_count",
276
+ "impressions",
277
+ "reach",
278
+ "reposts",
279
+ "repost_count",
280
+ ]) {
281
+ const value = optionalNumber(metrics[key]);
282
+ if (value !== undefined)
283
+ result.push({
284
+ name: key,
285
+ value,
286
+ unit: "count",
287
+ period: "lifetime",
288
+ fetchedAt: now(),
289
+ freshness: "unknown",
290
+ source: `post-for-me:${ref.platform}:feed`,
291
+ });
292
+ }
293
+ return result;
294
+ },
295
+ },
296
+ webhooks: {
297
+ async verify(input) {
298
+ await verifyPostForMeWebhook({ ...input, secret: options.webhookSecret ?? "" });
299
+ return { valid: true, method: "shared-secret" };
300
+ },
301
+ async decode(input, context) {
302
+ const event = await decodeWebhook({
303
+ provider: "post-for-me",
304
+ backend: context.backendInstance,
305
+ body: input.body,
306
+ receivedAt: now(),
307
+ });
308
+ return { ...event };
309
+ },
310
+ },
311
+ native: {
312
+ async createConnection(input, context) {
313
+ platform(input.platform);
314
+ const result = object(await request("/v1/social-accounts/auth-url", context, {
315
+ platform: input.platform,
316
+ external_id: input.externalId,
317
+ permissions: input.permissions,
318
+ ...(input.redirectUrl ? { redirect_url_override: input.redirectUrl } : {}),
319
+ }));
320
+ return { url: string(result["url"]), platform: string(result["platform"]) };
321
+ },
322
+ },
323
+ });
324
+ return adapter;
325
+ }
326
+ //# sourceMappingURL=post-for-me.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-for-me.js","sourceRoot":"","sources":["../../src/cloud/post-for-me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EACL,uBAAuB,GAGxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUhD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,YAAY,GAEb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AASjD,MAAM,UAAU,SAAS,CAAC,OAAuB;IAC/C,MAAM,OAAO,GAAG,WAAW,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC;IAClE,MAAM,aAAa,GAAG,YAAY,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAC3E,OAAO,CAAC,6BAA6B,EAAE,OAAO,EAAE,IAAI,CAAC,CACtD,CAAC;IACF,MAAM,GAAG,GAAG,GAAG,E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,CAAC,EAAE,CAAC;YAC9E,CAAC;SACF;KACF,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,112 @@
1
+ export { MemoryManagedMediaStore, type ManagedMediaStore, type ManagedMediaRecord, } from "./media.js";
2
+ import type { AccountRecord, AdapterOperationContext, CommentRef, ConnectedAccountRef, ConversationRef, JsonObject, MetricValue, PlatformPostRef, PreparedPublishTarget } from "../core/types.js";
3
+ import { type ManagedOptions } from "./common.js";
4
+ export interface ZernioConnectionOptions {
5
+ platform: string;
6
+ profileId: string;
7
+ redirectUrl: string;
8
+ }
9
+ export declare function zernio(options: ManagedOptions): {
10
+ id: string;
11
+ capabilities: {
12
+ capabilities: (import("../index.js").CapabilityDeclaration | {
13
+ platform: string;
14
+ operation: string;
15
+ availability: "available";
16
+ })[];
17
+ schemaVersion: 1;
18
+ backend: string;
19
+ apiRevision: string;
20
+ runtime: readonly string[];
21
+ };
22
+ media: {
23
+ upload: (item: import("../index.js").MediaAttachment, account: ConnectedAccountRef, context: AdapterOperationContext) => Promise<import("../index.js").MediaRef>;
24
+ };
25
+ accounts: {
26
+ list(input: {
27
+ cursor?: string;
28
+ limit?: number;
29
+ }, context: AdapterOperationContext): Promise<{
30
+ nextCursor?: string;
31
+ items: AccountRecord[];
32
+ }>;
33
+ get(ref: ConnectedAccountRef, context: AdapterOperationContext): Promise<AccountRecord>;
34
+ };
35
+ posts: {
36
+ list(account: ConnectedAccountRef, input: {
37
+ readonly cursor?: string;
38
+ readonly limit?: number;
39
+ }, context: AdapterOperationContext): Promise<{
40
+ nextCursor?: string;
41
+ items: JsonObject[];
42
+ }>;
43
+ prepareTarget(target: PreparedPublishTarget): import("../index.js").PreparationIssue[];
44
+ publishTarget(target: PreparedPublishTarget, context: AdapterOperationContext): Promise<import("../index.js").DeliveryOutcome>;
45
+ getDelivery(ref: {
46
+ backend: string;
47
+ platform: string;
48
+ accountId: string;
49
+ deliveryId: string;
50
+ }, context: AdapterOperationContext): Promise<import("../index.js").DeliveryOutcome>;
51
+ get(ref: PlatformPostRef, context: AdapterOperationContext): Promise<JsonObject>;
52
+ removeFromPlatform?: (ref: PlatformPostRef, context: AdapterOperationContext) => Promise<void>;
53
+ cancelScheduled(ref: import("../index.js").ScheduledJobRef, context: AdapterOperationContext): Promise<import("../index.js").ScheduleCancellation>;
54
+ deleteBackendRecord(ref: import("../index.js").BackendPostRef, context: AdapterOperationContext): Promise<void>;
55
+ };
56
+ analytics: {
57
+ getAccountMetrics(ref: ConnectedAccountRef, context: AdapterOperationContext): Promise<readonly MetricValue[]>;
58
+ getPostMetrics(ref: PlatformPostRef, context: AdapterOperationContext): Promise<readonly MetricValue[]>;
59
+ };
60
+ comments: {
61
+ list(ref: PlatformPostRef, input: {
62
+ readonly cursor?: string;
63
+ readonly limit?: number;
64
+ }, context: AdapterOperationContext): Promise<{
65
+ nextCursor?: string;
66
+ items: JsonObject[];
67
+ }>;
68
+ reply(ref: CommentRef, content: {
69
+ text: string;
70
+ }, context: AdapterOperationContext): Promise<CommentRef>;
71
+ };
72
+ messages: {
73
+ listConversations(ref: ConnectedAccountRef, input: {
74
+ readonly cursor?: string;
75
+ readonly limit?: number;
76
+ }, context: AdapterOperationContext): Promise<{
77
+ nextCursor?: string;
78
+ items: JsonObject[];
79
+ }>;
80
+ listMessages(ref: ConversationRef, input: {
81
+ readonly cursor?: string;
82
+ readonly limit?: number;
83
+ }, context: AdapterOperationContext): Promise<{
84
+ nextCursor?: string;
85
+ items: JsonObject[];
86
+ }>;
87
+ send(ref: ConversationRef, content: {
88
+ text: string;
89
+ }, context: AdapterOperationContext): Promise<JsonObject>;
90
+ };
91
+ webhooks: {
92
+ verify(input: {
93
+ headers: Headers;
94
+ body: Uint8Array;
95
+ }): Promise<{
96
+ valid: true;
97
+ method: "hmac";
98
+ }>;
99
+ decode(input: {
100
+ headers: Headers;
101
+ body: Uint8Array;
102
+ }, context: AdapterOperationContext): Promise<JsonObject>;
103
+ };
104
+ native: {
105
+ createConnection(input: ZernioConnectionOptions, context: AdapterOperationContext): Promise<{
106
+ providerState?: string;
107
+ url: string;
108
+ }>;
109
+ listProfiles(context: AdapterOperationContext): Promise<JsonObject[]>;
110
+ };
111
+ };
112
+ //# sourceMappingURL=zernio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zernio.d.ts","sourceRoot":"","sources":["../../src/cloud/zernio.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC;AAGpB,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,UAAU,EAEV,WAAW,EACX,eAAe,EACf,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EASL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,cAAc;;;;;;;;;;;;;;;;;oBA6FtB;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,WAAW,uBAAuB;;;;iBA6BxE,mBAAmB,WAAW,uBAAuB;;;sBAkBzD,mBAAmB,SACrB;YAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,WACnD,uBAAuB;;mBA4Ef,UAAU,EAAE;;8BAMT,qBAAqB;8BAoBf,qBAAqB,WAAW,uBAAuB;yBAmE5E;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CA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