@opencoredev/social-sdk 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-request.d.ts +15 -0
- package/dist/cli-request.js +193 -0
- package/dist/cli.d.ts +4 -3
- package/dist/cli.js +19 -21
- package/dist/cloud/common.d.ts +7 -6
- package/dist/cloud/common.js +35 -54
- package/dist/cloud/lifecycle.js +31 -35
- package/dist/cloud/media.d.ts +2 -2
- package/dist/cloud/media.js +13 -3
- package/dist/cloud/outcomes.d.ts +4 -3
- package/dist/cloud/outcomes.js +8 -15
- package/dist/cloud/post-for-me.js +41 -49
- package/dist/cloud/zernio.js +58 -98
- package/dist/core/client.js +79 -99
- package/dist/core/fields.d.ts +14 -0
- package/dist/core/fields.js +14 -0
- package/dist/core/idempotency.d.ts +7 -2
- package/dist/core/idempotency.js +37 -20
- package/dist/core/pagination.js +8 -7
- package/dist/core/types.d.ts +3 -2
- package/dist/platforms/bluesky.d.ts +65 -1
- package/dist/platforms/bluesky.js +675 -276
- package/dist/platforms/instagram.d.ts +2 -0
- package/dist/platforms/instagram.js +130 -105
- package/dist/platforms/linkedin.d.ts +58 -1
- package/dist/platforms/linkedin.js +877 -107
- package/dist/platforms/threads.d.ts +13 -1
- package/dist/platforms/threads.js +204 -302
- package/dist/platforms/tiktok.d.ts +4 -0
- package/dist/platforms/tiktok.js +140 -124
- package/dist/platforms/webhook-adapter.d.ts +9 -0
- package/dist/platforms/webhook-adapter.js +24 -0
- package/dist/platforms/x-engagement.js +7 -12
- package/dist/platforms/x-stream.d.ts +83 -0
- package/dist/platforms/x-stream.js +350 -0
- package/dist/platforms/x.d.ts +87 -0
- package/dist/platforms/x.js +648 -120
- package/dist/platforms/youtube-upload.d.ts +1 -1
- package/dist/platforms/youtube-upload.js +6 -2
- package/dist/platforms/youtube.d.ts +28 -4
- package/dist/platforms/youtube.js +291 -133
- package/dist/server/bluesky-oauth.d.ts +177 -0
- package/dist/server/bluesky-oauth.js +1229 -0
- package/dist/server/connections.d.ts +14 -0
- package/dist/server/connections.js +10 -2
- package/dist/server/egress.d.ts +14 -0
- package/dist/server/egress.js +115 -0
- package/dist/server/oauth-internal.d.ts +6 -0
- package/dist/server/oauth-internal.js +66 -0
- package/dist/server/oauth.d.ts +1 -1
- package/dist/server/oauth.js +46 -99
- package/dist/server/webhooks.d.ts +136 -3
- package/dist/server/webhooks.js +639 -25
- package/dist/testing/index.js +14 -28
- package/dist/transport/http.d.ts +1 -1
- package/dist/transport/http.js +0 -1
- package/dist/transport/json.d.ts +7 -0
- package/dist/transport/json.js +32 -4
- package/dist/transport/upload.d.ts +1 -1
- package/dist/transport/upload.js +46 -38
- package/dist/transport/validation.d.ts +16 -5
- package/dist/transport/validation.js +29 -7
- package/package.json +2 -2
|
@@ -25,7 +25,7 @@ export type YouTubeUploadStatus = {
|
|
|
25
25
|
nextByte: number;
|
|
26
26
|
} | {
|
|
27
27
|
state: "complete";
|
|
28
|
-
video:
|
|
28
|
+
video: JsonObject;
|
|
29
29
|
};
|
|
30
30
|
export declare function queryYouTubeUpload(session: YouTubeUploadSession, options: YouTubeUploadOptions): Promise<YouTubeUploadStatus>;
|
|
31
31
|
/** Explicit resumption reopens the caller's replayable source and skips confirmed bytes. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SocialError } from "../core/errors.js";
|
|
2
2
|
import { readJson } from "../transport/http.js";
|
|
3
|
+
import { isJsonValue } from "../transport/json.js";
|
|
3
4
|
import { array, object, optionalString, string } from "../transport/validation.js";
|
|
4
5
|
const deadlines = new WeakMap();
|
|
5
6
|
function deadlineFor(options) {
|
|
@@ -178,8 +179,11 @@ export async function beginYouTubeUpload(input, options) {
|
|
|
178
179
|
return { url, size: input.size, mimeType: input.mimeType, channelId: input.channelId };
|
|
179
180
|
}
|
|
180
181
|
async function statusFrom(response) {
|
|
181
|
-
if (response.status !== 308)
|
|
182
|
-
|
|
182
|
+
if (response.status !== 308) {
|
|
183
|
+
const body = await response.json();
|
|
184
|
+
// A non-JSON value decodes like an absent body: `object` rejects it as invalid.
|
|
185
|
+
return { state: "complete", video: object(isJsonValue(body) ? body : undefined) };
|
|
186
|
+
}
|
|
183
187
|
const range = response.headers.get("range");
|
|
184
188
|
if (!range)
|
|
185
189
|
return { state: "incomplete", nextByte: 0 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AdapterOperationContext, JsonObject, MediaAttachment } from "../core/types.js";
|
|
2
|
-
import { type YouTubeUploadSession } from "./youtube-upload.js";
|
|
1
|
+
import type { AdapterOperationContext, ConnectedAccountRef, JsonObject, MediaAttachment } from "../core/types.js";
|
|
2
|
+
import { type YouTubeUploadSession, type YouTubeUploadStatus } from "./youtube-upload.js";
|
|
3
3
|
export interface YouTubeOptions {
|
|
4
4
|
readonly auth: {
|
|
5
5
|
readonly accessToken: string;
|
|
@@ -9,10 +9,12 @@ export interface YouTubeOptions {
|
|
|
9
9
|
readonly clock?: () => Date;
|
|
10
10
|
/** Persist secret resumable URI server-side before uploading any video bytes. */
|
|
11
11
|
readonly saveUploadSession?: (session: YouTubeUploadSession) => Promise<void>;
|
|
12
|
+
/** The `hub.secret` sent when subscribing to push notifications. */
|
|
13
|
+
readonly webhookSecret?: string;
|
|
12
14
|
}
|
|
13
15
|
export interface YouTubeNative {
|
|
14
|
-
readonly resumeUpload: (session: YouTubeUploadSession, media: MediaAttachment, context: AdapterOperationContext) => Promise<
|
|
15
|
-
readonly queryUpload: (session: YouTubeUploadSession, context: AdapterOperationContext) => Promise<
|
|
16
|
+
readonly resumeUpload: (session: YouTubeUploadSession, media: MediaAttachment, context: AdapterOperationContext) => Promise<YouTubeUploadStatus>;
|
|
17
|
+
readonly queryUpload: (session: YouTubeUploadSession, context: AdapterOperationContext) => Promise<YouTubeUploadStatus>;
|
|
16
18
|
readonly setThumbnail: (input: {
|
|
17
19
|
readonly videoId: string;
|
|
18
20
|
readonly thumbnail: MediaAttachment;
|
|
@@ -79,6 +81,18 @@ export interface YouTubeNative {
|
|
|
79
81
|
readonly body?: JsonObject;
|
|
80
82
|
readonly context: AdapterOperationContext;
|
|
81
83
|
}) => Promise<JsonObject | void>;
|
|
84
|
+
/**
|
|
85
|
+
* Deletes one comment with `comments.delete`. For a top-level comment, pass the thread's
|
|
86
|
+
* `snippet.topLevelComment.id`; `commentThreads` has no delete method. Google documents a
|
|
87
|
+
* 403 `forbidden` for insufficient permissions and does not list which comments a channel
|
|
88
|
+
* may delete. Use `commentsModeration` with `setModerationStatus: "rejected"` to remove
|
|
89
|
+
* another user's comment from your video.
|
|
90
|
+
*/
|
|
91
|
+
readonly deleteComment: (input: {
|
|
92
|
+
readonly account: ConnectedAccountRef;
|
|
93
|
+
readonly commentId: string;
|
|
94
|
+
readonly context: AdapterOperationContext;
|
|
95
|
+
}) => Promise<void>;
|
|
82
96
|
readonly heldComments: (input: {
|
|
83
97
|
readonly pageToken?: string;
|
|
84
98
|
readonly maxResults?: number;
|
|
@@ -93,6 +107,16 @@ export interface YouTubeNative {
|
|
|
93
107
|
readonly videoId: string;
|
|
94
108
|
readonly context: AdapterOperationContext;
|
|
95
109
|
}) => Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Update the configured channel with channels.update. One part is written per call. The adapter
|
|
112
|
+
* reads the current part first and merges `value` into it, because YouTube deletes any mutable
|
|
113
|
+
* property omitted from the write. A `null` field removes that property or localization.
|
|
114
|
+
*/
|
|
115
|
+
readonly updateProfile: (input: {
|
|
116
|
+
readonly part: "brandingSettings" | "localizations";
|
|
117
|
+
readonly value: JsonObject;
|
|
118
|
+
readonly context: AdapterOperationContext;
|
|
119
|
+
}) => Promise<JsonObject>;
|
|
96
120
|
readonly analytics: (input: {
|
|
97
121
|
readonly query: Record<string, string>;
|
|
98
122
|
readonly context: AdapterOperationContext;
|