@dxos/plugin-youtube 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/lib/browser/ChannelArticle-CDQR4BBY.mjs +90 -0
- package/dist/lib/browser/ChannelArticle-CDQR4BBY.mjs.map +7 -0
- package/dist/lib/browser/ChannelSettings-ZYUNW3VS.mjs +28 -0
- package/dist/lib/browser/ChannelSettings-ZYUNW3VS.mjs.map +7 -0
- package/dist/lib/browser/VideoArticle-FC4A6E7B.mjs +76 -0
- package/dist/lib/browser/VideoArticle-FC4A6E7B.mjs.map +7 -0
- package/dist/lib/browser/VideoCard-CCPXDCB7.mjs +64 -0
- package/dist/lib/browser/VideoCard-CCPXDCB7.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-MJY6A6SN.mjs +195 -0
- package/dist/lib/browser/app-graph-builder-MJY6A6SN.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-FRYUYJ22.mjs +22 -0
- package/dist/lib/browser/blueprint-definition-FRYUYJ22.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +13 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-C26XKDK2.mjs +355 -0
- package/dist/lib/browser/chunk-C26XKDK2.mjs.map +7 -0
- package/dist/lib/browser/chunk-DFRSBBSO.mjs +21 -0
- package/dist/lib/browser/chunk-DFRSBBSO.mjs.map +7 -0
- package/dist/lib/browser/chunk-GFRR4TTX.mjs +72 -0
- package/dist/lib/browser/chunk-GFRR4TTX.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-MUE22YUM.mjs +57 -0
- package/dist/lib/browser/chunk-MUE22YUM.mjs.map +7 -0
- package/dist/lib/browser/chunk-P67QEKBQ.mjs +72 -0
- package/dist/lib/browser/chunk-P67QEKBQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-YMDT37TA.mjs +62 -0
- package/dist/lib/browser/chunk-YMDT37TA.mjs.map +7 -0
- package/dist/lib/browser/chunk-Z3DGTMKC.mjs +8 -0
- package/dist/lib/browser/chunk-Z3DGTMKC.mjs.map +7 -0
- package/dist/lib/browser/clear-synced-videos-EVMJIZPD.mjs +66 -0
- package/dist/lib/browser/clear-synced-videos-EVMJIZPD.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +153 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/browser/react-surface-EDA5VYDC.mjs +77 -0
- package/dist/lib/browser/react-surface-EDA5VYDC.mjs.map +7 -0
- package/dist/lib/browser/sync-423Q4BDD.mjs +360 -0
- package/dist/lib/browser/sync-423Q4BDD.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +14 -0
- package/dist/lib/browser/types/index.mjs.map +7 -0
- package/dist/lib/node-esm/ChannelArticle-GQ64BO7V.mjs +91 -0
- package/dist/lib/node-esm/ChannelArticle-GQ64BO7V.mjs.map +7 -0
- package/dist/lib/node-esm/ChannelSettings-DM2HWNKO.mjs +29 -0
- package/dist/lib/node-esm/ChannelSettings-DM2HWNKO.mjs.map +7 -0
- package/dist/lib/node-esm/VideoArticle-WLTWZO3K.mjs +77 -0
- package/dist/lib/node-esm/VideoArticle-WLTWZO3K.mjs.map +7 -0
- package/dist/lib/node-esm/VideoCard-FOWQZK75.mjs +65 -0
- package/dist/lib/node-esm/VideoCard-FOWQZK75.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-IU5TBAXN.mjs +196 -0
- package/dist/lib/node-esm/app-graph-builder-IU5TBAXN.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-W264MZ3D.mjs +23 -0
- package/dist/lib/node-esm/blueprint-definition-W264MZ3D.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +14 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5KNC2JMP.mjs +58 -0
- package/dist/lib/node-esm/chunk-5KNC2JMP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6BUJ2DQX.mjs +73 -0
- package/dist/lib/node-esm/chunk-6BUJ2DQX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CX6MV3QM.mjs +23 -0
- package/dist/lib/node-esm/chunk-CX6MV3QM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CZSLL3XQ.mjs +63 -0
- package/dist/lib/node-esm/chunk-CZSLL3XQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JM5SBBP5.mjs +356 -0
- package/dist/lib/node-esm/chunk-JM5SBBP5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JSGRZMG3.mjs +73 -0
- package/dist/lib/node-esm/chunk-JSGRZMG3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-M4S6BE47.mjs +10 -0
- package/dist/lib/node-esm/chunk-M4S6BE47.mjs.map +7 -0
- package/dist/lib/node-esm/clear-synced-videos-5UCH6XHL.mjs +67 -0
- package/dist/lib/node-esm/clear-synced-videos-5UCH6XHL.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +154 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/react-surface-5DJAQPHJ.mjs +78 -0
- package/dist/lib/node-esm/react-surface-5DJAQPHJ.mjs.map +7 -0
- package/dist/lib/node-esm/sync-CEF5DX2J.mjs +361 -0
- package/dist/lib/node-esm/sync-CEF5DX2J.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +15 -0
- package/dist/lib/node-esm/types/index.mjs.map +7 -0
- package/dist/types/src/YouTubePlugin.d.ts +3 -0
- package/dist/types/src/YouTubePlugin.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +3 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/youtube.d.ts +4 -0
- package/dist/types/src/blueprints/youtube.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.d.ts +8 -0
- package/dist/types/src/containers/ChannelArticle/ChannelArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ChannelArticle/index.d.ts +3 -0
- package/dist/types/src/containers/ChannelArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/ChannelSettings/ChannelSettings.d.ts +7 -0
- package/dist/types/src/containers/ChannelSettings/ChannelSettings.d.ts.map +1 -0
- package/dist/types/src/containers/ChannelSettings/index.d.ts +3 -0
- package/dist/types/src/containers/ChannelSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/VideoArticle/VideoArticle.d.ts +11 -0
- package/dist/types/src/containers/VideoArticle/VideoArticle.d.ts.map +1 -0
- package/dist/types/src/containers/VideoArticle/index.d.ts +3 -0
- package/dist/types/src/containers/VideoArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/VideoCard/VideoCard.d.ts +9 -0
- package/dist/types/src/containers/VideoCard/VideoCard.d.ts.map +1 -0
- package/dist/types/src/containers/VideoCard/index.d.ts +3 -0
- package/dist/types/src/containers/VideoCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +11 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +3 -0
- package/dist/types/src/meta.d.ts.map +1 -0
- package/dist/types/src/operations/apis/index.d.ts +2 -0
- package/dist/types/src/operations/apis/index.d.ts.map +1 -0
- package/dist/types/src/operations/apis/youtube/api.d.ts +251 -0
- package/dist/types/src/operations/apis/youtube/api.d.ts.map +1 -0
- package/dist/types/src/operations/apis/youtube/index.d.ts +3 -0
- package/dist/types/src/operations/apis/youtube/index.d.ts.map +1 -0
- package/dist/types/src/operations/apis/youtube/types.d.ts +493 -0
- package/dist/types/src/operations/apis/youtube/types.d.ts.map +1 -0
- package/dist/types/src/operations/clear-synced-videos.d.ts +5 -0
- package/dist/types/src/operations/clear-synced-videos.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +45 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +5 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/services/google-credentials.d.ts +35 -0
- package/dist/types/src/operations/services/google-credentials.d.ts.map +1 -0
- package/dist/types/src/operations/services/index.d.ts +2 -0
- package/dist/types/src/operations/services/index.d.ts.map +1 -0
- package/dist/types/src/operations/sync.d.ts +5 -0
- package/dist/types/src/operations/sync.d.ts.map +1 -0
- package/dist/types/src/operations/sync.test.d.ts +2 -0
- package/dist/types/src/operations/sync.test.d.ts.map +1 -0
- package/dist/types/src/operations/transcript.d.ts +12 -0
- package/dist/types/src/operations/transcript.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +49 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/types/Channel.d.ts +54 -0
- package/dist/types/src/types/Channel.d.ts.map +1 -0
- package/dist/types/src/types/Video.d.ts +41 -0
- package/dist/types/src/types/Video.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +5 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +113 -0
- package/src/YouTubePlugin.tsx +66 -0
- package/src/blueprints/index.ts +7 -0
- package/src/blueprints/youtube.ts +52 -0
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +148 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +17 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +7 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +54 -0
- package/src/containers/ChannelArticle/ChannelArticle.tsx +115 -0
- package/src/containers/ChannelArticle/index.ts +7 -0
- package/src/containers/ChannelSettings/ChannelSettings.tsx +34 -0
- package/src/containers/ChannelSettings/index.ts +7 -0
- package/src/containers/VideoArticle/VideoArticle.tsx +109 -0
- package/src/containers/VideoArticle/index.ts +7 -0
- package/src/containers/VideoCard/VideoCard.tsx +86 -0
- package/src/containers/VideoCard/index.ts +7 -0
- package/src/containers/index.ts +24 -0
- package/src/index.ts +8 -0
- package/src/meta.ts +19 -0
- package/src/operations/apis/index.ts +5 -0
- package/src/operations/apis/youtube/api.ts +149 -0
- package/src/operations/apis/youtube/index.ts +6 -0
- package/src/operations/apis/youtube/types.ts +254 -0
- package/src/operations/clear-synced-videos.ts +50 -0
- package/src/operations/definitions.ts +62 -0
- package/src/operations/index.ts +13 -0
- package/src/operations/services/google-credentials.ts +81 -0
- package/src/operations/services/index.ts +5 -0
- package/src/operations/sync.test.ts +114 -0
- package/src/operations/sync.ts +309 -0
- package/src/operations/transcript.ts +47 -0
- package/src/translations.ts +59 -0
- package/src/types/Channel.ts +80 -0
- package/src/types/Video.ts +67 -0
- package/src/types/index.ts +8 -0
- package/src/types/types.ts +10 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
youtube_default
|
|
3
|
+
} from "../chunk-MUE22YUM.mjs";
|
|
4
|
+
import "../chunk-Z3DGTMKC.mjs";
|
|
5
|
+
import "../chunk-C26XKDK2.mjs";
|
|
6
|
+
import "../chunk-P67QEKBQ.mjs";
|
|
7
|
+
import "../chunk-GFRR4TTX.mjs";
|
|
8
|
+
import "../chunk-YMDT37TA.mjs";
|
|
9
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
10
|
+
export {
|
|
11
|
+
youtube_default as YouTubeBlueprint
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-J5LGTIGS.mjs";
|
|
4
|
+
|
|
5
|
+
// src/operations/services/google-credentials.ts
|
|
6
|
+
import * as Context from "effect/Context";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
import * as Layer from "effect/Layer";
|
|
9
|
+
import { Database } from "@dxos/echo";
|
|
10
|
+
import { CredentialsService } from "@dxos/functions";
|
|
11
|
+
import { log } from "@dxos/log";
|
|
12
|
+
var __dxlog_file = "/Users/mykola/dev/dxos/packages/plugins/plugin-youtube/src/operations/services/google-credentials.ts";
|
|
13
|
+
var makeService = (cachedToken) => ({
|
|
14
|
+
get: () => cachedToken ? Effect.succeed(cachedToken) : Effect.map(CredentialsService.getCredential({
|
|
15
|
+
service: "google.com"
|
|
16
|
+
}), (credential) => credential.apiKey)
|
|
17
|
+
});
|
|
18
|
+
var loadAccessToken = (accessTokenRef, label) => Effect.gen(function* () {
|
|
19
|
+
if (accessTokenRef) {
|
|
20
|
+
const accessToken = yield* Database.load(accessTokenRef);
|
|
21
|
+
if (accessToken?.token) {
|
|
22
|
+
log(`using ${label}-specific access token`, {
|
|
23
|
+
note: accessToken.note
|
|
24
|
+
}, {
|
|
25
|
+
F: __dxlog_file,
|
|
26
|
+
L: 35,
|
|
27
|
+
S: this,
|
|
28
|
+
C: (f, a) => f(...a)
|
|
29
|
+
});
|
|
30
|
+
return accessToken.token;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return void 0;
|
|
34
|
+
});
|
|
35
|
+
var GoogleCredentials = class _GoogleCredentials extends Context.Tag("GoogleCredentials")() {
|
|
36
|
+
/**
|
|
37
|
+
* Creates a credentials layer from a channel.
|
|
38
|
+
* Pre-loads the access token during layer construction.
|
|
39
|
+
*/
|
|
40
|
+
static fromChannel = (channel) => Layer.effect(_GoogleCredentials, Effect.map(loadAccessToken(channel.accessToken, "channel"), makeService));
|
|
41
|
+
/**
|
|
42
|
+
* Creates a credentials layer from a channel ref.
|
|
43
|
+
* Loads the channel and pre-loads the access token during layer construction.
|
|
44
|
+
*/
|
|
45
|
+
static fromChannelRef = (channelRef) => Layer.effect(_GoogleCredentials, Effect.flatMap(Database.load(channelRef), (channel) => Effect.map(loadAccessToken(channel.accessToken, "channel"), makeService)));
|
|
46
|
+
/**
|
|
47
|
+
* Default layer that uses database credentials.
|
|
48
|
+
* Use this for operations that don't have an associated channel.
|
|
49
|
+
*/
|
|
50
|
+
static default = Layer.succeed(_GoogleCredentials, makeService(void 0));
|
|
51
|
+
/** Convenience accessor - returns the Google API token. */
|
|
52
|
+
static get = () => Effect.flatMap(_GoogleCredentials, (service) => service.get());
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// src/operations/apis/youtube/index.ts
|
|
56
|
+
var youtube_exports = {};
|
|
57
|
+
__export(youtube_exports, {
|
|
58
|
+
CaptionResource: () => CaptionResource,
|
|
59
|
+
CaptionsListResponse: () => CaptionsListResponse,
|
|
60
|
+
ChannelItem: () => ChannelItem,
|
|
61
|
+
ChannelSnippet: () => ChannelSnippet,
|
|
62
|
+
ChannelsResponse: () => ChannelsResponse,
|
|
63
|
+
ErrorResponse: () => ErrorResponse,
|
|
64
|
+
PlaylistItem: () => PlaylistItem,
|
|
65
|
+
PlaylistItemsResponse: () => PlaylistItemsResponse,
|
|
66
|
+
SearchItem: () => SearchItem,
|
|
67
|
+
SearchResponse: () => SearchResponse,
|
|
68
|
+
VideoContentDetails: () => VideoContentDetails,
|
|
69
|
+
VideoItem: () => VideoItem,
|
|
70
|
+
VideoSnippet: () => VideoSnippet,
|
|
71
|
+
VideoStatistics: () => VideoStatistics,
|
|
72
|
+
VideosResponse: () => VideosResponse,
|
|
73
|
+
YouTubeError: () => YouTubeError,
|
|
74
|
+
getChannel: () => getChannel,
|
|
75
|
+
getChannelByHandle: () => getChannelByHandle,
|
|
76
|
+
getVideoDetails: () => getVideoDetails,
|
|
77
|
+
listPlaylistItems: () => listPlaylistItems,
|
|
78
|
+
searchChannels: () => searchChannels
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// src/operations/apis/youtube/api.ts
|
|
82
|
+
import * as HttpClient from "@effect/platform/HttpClient";
|
|
83
|
+
import * as HttpClientRequest from "@effect/platform/HttpClientRequest";
|
|
84
|
+
import * as Effect2 from "effect/Effect";
|
|
85
|
+
import * as Schedule from "effect/Schedule";
|
|
86
|
+
import * as Schema2 from "effect/Schema";
|
|
87
|
+
import { withAuthorization } from "@dxos/functions";
|
|
88
|
+
import { log as log2 } from "@dxos/log";
|
|
89
|
+
|
|
90
|
+
// src/operations/apis/youtube/types.ts
|
|
91
|
+
import * as Schema from "effect/Schema";
|
|
92
|
+
var YouTubeError = class _YouTubeError extends Schema.TaggedError()("YouTubeError", {
|
|
93
|
+
code: Schema.Number,
|
|
94
|
+
message: Schema.String,
|
|
95
|
+
status: Schema.optional(Schema.String)
|
|
96
|
+
}) {
|
|
97
|
+
static fromErrorResponse(response) {
|
|
98
|
+
return new _YouTubeError({
|
|
99
|
+
code: response.error.code,
|
|
100
|
+
message: response.error.message,
|
|
101
|
+
status: response.error.status
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var ErrorResponse = Schema.Struct({
|
|
106
|
+
error: Schema.Struct({
|
|
107
|
+
code: Schema.Number,
|
|
108
|
+
message: Schema.String,
|
|
109
|
+
status: Schema.optional(Schema.String)
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
var ChannelSnippet = Schema.Struct({
|
|
113
|
+
title: Schema.String,
|
|
114
|
+
description: Schema.optional(Schema.String),
|
|
115
|
+
customUrl: Schema.optional(Schema.String),
|
|
116
|
+
publishedAt: Schema.optional(Schema.String),
|
|
117
|
+
thumbnails: Schema.optional(Schema.Struct({
|
|
118
|
+
default: Schema.optional(Schema.Struct({
|
|
119
|
+
url: Schema.String
|
|
120
|
+
})),
|
|
121
|
+
medium: Schema.optional(Schema.Struct({
|
|
122
|
+
url: Schema.String
|
|
123
|
+
})),
|
|
124
|
+
high: Schema.optional(Schema.Struct({
|
|
125
|
+
url: Schema.String
|
|
126
|
+
}))
|
|
127
|
+
}))
|
|
128
|
+
});
|
|
129
|
+
var ChannelItem = Schema.Struct({
|
|
130
|
+
kind: Schema.String,
|
|
131
|
+
etag: Schema.String,
|
|
132
|
+
id: Schema.String,
|
|
133
|
+
snippet: Schema.optional(ChannelSnippet),
|
|
134
|
+
contentDetails: Schema.optional(Schema.Struct({
|
|
135
|
+
relatedPlaylists: Schema.optional(Schema.Struct({
|
|
136
|
+
uploads: Schema.optional(Schema.String)
|
|
137
|
+
}))
|
|
138
|
+
}))
|
|
139
|
+
});
|
|
140
|
+
var ChannelsResponse = Schema.Struct({
|
|
141
|
+
kind: Schema.String,
|
|
142
|
+
etag: Schema.String,
|
|
143
|
+
pageInfo: Schema.optional(Schema.Struct({
|
|
144
|
+
totalResults: Schema.Number,
|
|
145
|
+
resultsPerPage: Schema.Number
|
|
146
|
+
})),
|
|
147
|
+
items: Schema.Array(ChannelItem)
|
|
148
|
+
});
|
|
149
|
+
var VideoSnippet = Schema.Struct({
|
|
150
|
+
publishedAt: Schema.String,
|
|
151
|
+
channelId: Schema.optional(Schema.String),
|
|
152
|
+
title: Schema.String,
|
|
153
|
+
description: Schema.optional(Schema.String),
|
|
154
|
+
thumbnails: Schema.optional(Schema.Struct({
|
|
155
|
+
default: Schema.optional(Schema.Struct({
|
|
156
|
+
url: Schema.String
|
|
157
|
+
})),
|
|
158
|
+
medium: Schema.optional(Schema.Struct({
|
|
159
|
+
url: Schema.String
|
|
160
|
+
})),
|
|
161
|
+
high: Schema.optional(Schema.Struct({
|
|
162
|
+
url: Schema.String
|
|
163
|
+
})),
|
|
164
|
+
standard: Schema.optional(Schema.Struct({
|
|
165
|
+
url: Schema.String
|
|
166
|
+
})),
|
|
167
|
+
maxres: Schema.optional(Schema.Struct({
|
|
168
|
+
url: Schema.String
|
|
169
|
+
}))
|
|
170
|
+
})),
|
|
171
|
+
channelTitle: Schema.optional(Schema.String),
|
|
172
|
+
playlistId: Schema.optional(Schema.String),
|
|
173
|
+
position: Schema.optional(Schema.Number),
|
|
174
|
+
resourceId: Schema.optional(Schema.Struct({
|
|
175
|
+
kind: Schema.String,
|
|
176
|
+
videoId: Schema.String
|
|
177
|
+
}))
|
|
178
|
+
});
|
|
179
|
+
var VideoContentDetails = Schema.Struct({
|
|
180
|
+
videoId: Schema.optional(Schema.String),
|
|
181
|
+
videoPublishedAt: Schema.optional(Schema.String),
|
|
182
|
+
duration: Schema.optional(Schema.String)
|
|
183
|
+
});
|
|
184
|
+
var VideoStatistics = Schema.Struct({
|
|
185
|
+
viewCount: Schema.optional(Schema.String),
|
|
186
|
+
likeCount: Schema.optional(Schema.String),
|
|
187
|
+
commentCount: Schema.optional(Schema.String)
|
|
188
|
+
});
|
|
189
|
+
var VideoItem = Schema.Struct({
|
|
190
|
+
kind: Schema.String,
|
|
191
|
+
etag: Schema.String,
|
|
192
|
+
id: Schema.String,
|
|
193
|
+
snippet: Schema.optional(VideoSnippet),
|
|
194
|
+
contentDetails: Schema.optional(VideoContentDetails),
|
|
195
|
+
statistics: Schema.optional(VideoStatistics)
|
|
196
|
+
});
|
|
197
|
+
var VideosResponse = Schema.Struct({
|
|
198
|
+
kind: Schema.String,
|
|
199
|
+
etag: Schema.String,
|
|
200
|
+
nextPageToken: Schema.optional(Schema.String),
|
|
201
|
+
prevPageToken: Schema.optional(Schema.String),
|
|
202
|
+
pageInfo: Schema.optional(Schema.Struct({
|
|
203
|
+
totalResults: Schema.Number,
|
|
204
|
+
resultsPerPage: Schema.Number
|
|
205
|
+
})),
|
|
206
|
+
items: Schema.Array(VideoItem)
|
|
207
|
+
});
|
|
208
|
+
var PlaylistItem = Schema.Struct({
|
|
209
|
+
kind: Schema.String,
|
|
210
|
+
etag: Schema.String,
|
|
211
|
+
id: Schema.String,
|
|
212
|
+
snippet: Schema.optional(VideoSnippet),
|
|
213
|
+
contentDetails: Schema.optional(VideoContentDetails)
|
|
214
|
+
});
|
|
215
|
+
var PlaylistItemsResponse = Schema.Struct({
|
|
216
|
+
kind: Schema.String,
|
|
217
|
+
etag: Schema.String,
|
|
218
|
+
nextPageToken: Schema.optional(Schema.String),
|
|
219
|
+
prevPageToken: Schema.optional(Schema.String),
|
|
220
|
+
pageInfo: Schema.optional(Schema.Struct({
|
|
221
|
+
totalResults: Schema.Number,
|
|
222
|
+
resultsPerPage: Schema.Number
|
|
223
|
+
})),
|
|
224
|
+
items: Schema.Array(PlaylistItem)
|
|
225
|
+
});
|
|
226
|
+
var SearchItem = Schema.Struct({
|
|
227
|
+
kind: Schema.String,
|
|
228
|
+
etag: Schema.String,
|
|
229
|
+
id: Schema.Struct({
|
|
230
|
+
kind: Schema.String,
|
|
231
|
+
videoId: Schema.optional(Schema.String),
|
|
232
|
+
channelId: Schema.optional(Schema.String),
|
|
233
|
+
playlistId: Schema.optional(Schema.String)
|
|
234
|
+
}),
|
|
235
|
+
snippet: Schema.optional(VideoSnippet)
|
|
236
|
+
});
|
|
237
|
+
var SearchResponse = Schema.Struct({
|
|
238
|
+
kind: Schema.String,
|
|
239
|
+
etag: Schema.String,
|
|
240
|
+
nextPageToken: Schema.optional(Schema.String),
|
|
241
|
+
prevPageToken: Schema.optional(Schema.String),
|
|
242
|
+
pageInfo: Schema.optional(Schema.Struct({
|
|
243
|
+
totalResults: Schema.Number,
|
|
244
|
+
resultsPerPage: Schema.Number
|
|
245
|
+
})),
|
|
246
|
+
items: Schema.Array(SearchItem)
|
|
247
|
+
});
|
|
248
|
+
var CaptionResource = Schema.Struct({
|
|
249
|
+
id: Schema.String,
|
|
250
|
+
snippet: Schema.optional(Schema.Struct({
|
|
251
|
+
videoId: Schema.optional(Schema.String),
|
|
252
|
+
language: Schema.optional(Schema.String),
|
|
253
|
+
name: Schema.optional(Schema.String),
|
|
254
|
+
trackKind: Schema.optional(Schema.String)
|
|
255
|
+
}))
|
|
256
|
+
});
|
|
257
|
+
var CaptionsListResponse = Schema.Struct({
|
|
258
|
+
kind: Schema.String,
|
|
259
|
+
etag: Schema.String,
|
|
260
|
+
items: Schema.optional(Schema.Array(CaptionResource))
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// src/operations/apis/youtube/api.ts
|
|
264
|
+
var __dxlog_file2 = "/Users/mykola/dev/dxos/packages/plugins/plugin-youtube/src/operations/apis/youtube/api.ts";
|
|
265
|
+
var API_URL = "https://www.googleapis.com/youtube/v3";
|
|
266
|
+
var createUrl = (parts, params) => {
|
|
267
|
+
const url = new URL(parts.filter(Boolean).join("/"));
|
|
268
|
+
if (params) {
|
|
269
|
+
Object.entries(params).filter(([_, value]) => value != null).forEach(([key, value]) => url.searchParams.set(key, String(value)));
|
|
270
|
+
}
|
|
271
|
+
return url;
|
|
272
|
+
};
|
|
273
|
+
var decodeAndHandleErrors = (schema) => (data) => Schema2.decodeUnknown(Schema2.Union(schema, ErrorResponse))(data).pipe(Effect2.flatMap((response) => {
|
|
274
|
+
if ("error" in response) {
|
|
275
|
+
return Effect2.fail(YouTubeError.fromErrorResponse(response));
|
|
276
|
+
} else {
|
|
277
|
+
return Effect2.succeed(response);
|
|
278
|
+
}
|
|
279
|
+
}));
|
|
280
|
+
var makeYouTubeApiRequest = Effect2.fn("makeYouTubeApiRequest")(function* (url) {
|
|
281
|
+
const token = yield* GoogleCredentials.get();
|
|
282
|
+
const httpClient = yield* HttpClient.HttpClient.pipe(Effect2.map(withAuthorization(token, "Bearer")));
|
|
283
|
+
const httpClientWithTracerDisabled = httpClient.pipe(HttpClient.withTracerDisabledWhen(() => true));
|
|
284
|
+
const request = HttpClientRequest.get(url);
|
|
285
|
+
const response = yield* request.pipe(HttpClientRequest.setHeader("accept", "application/json"), httpClientWithTracerDisabled.execute, Effect2.flatMap((res) => res.json), Effect2.timeout("10 seconds"), Effect2.retry(Schedule.exponential(1e3).pipe(Schedule.compose(Schedule.recurs(3)))), Effect2.scoped, Effect2.withSpan("YouTubeApiRequest"));
|
|
286
|
+
if (response.error) {
|
|
287
|
+
log2.catch(response.error, void 0, {
|
|
288
|
+
F: __dxlog_file2,
|
|
289
|
+
L: 81,
|
|
290
|
+
S: this,
|
|
291
|
+
C: (f, a) => f(...a)
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
return response;
|
|
295
|
+
});
|
|
296
|
+
var getChannel = Effect2.fn(function* (channelId) {
|
|
297
|
+
const url = createUrl([
|
|
298
|
+
API_URL,
|
|
299
|
+
"channels"
|
|
300
|
+
], {
|
|
301
|
+
part: "snippet,contentDetails",
|
|
302
|
+
id: channelId
|
|
303
|
+
}).toString();
|
|
304
|
+
return yield* makeYouTubeApiRequest(url).pipe(Effect2.flatMap(decodeAndHandleErrors(ChannelsResponse)));
|
|
305
|
+
});
|
|
306
|
+
var getChannelByHandle = Effect2.fn(function* (handle) {
|
|
307
|
+
const url = createUrl([
|
|
308
|
+
API_URL,
|
|
309
|
+
"channels"
|
|
310
|
+
], {
|
|
311
|
+
part: "snippet,contentDetails",
|
|
312
|
+
forHandle: handle.startsWith("@") ? handle.slice(1) : handle
|
|
313
|
+
}).toString();
|
|
314
|
+
return yield* makeYouTubeApiRequest(url).pipe(Effect2.flatMap(decodeAndHandleErrors(ChannelsResponse)));
|
|
315
|
+
});
|
|
316
|
+
var searchChannels = Effect2.fn(function* (query, maxResults = 10) {
|
|
317
|
+
const url = createUrl([
|
|
318
|
+
API_URL,
|
|
319
|
+
"search"
|
|
320
|
+
], {
|
|
321
|
+
part: "snippet",
|
|
322
|
+
type: "channel",
|
|
323
|
+
q: query,
|
|
324
|
+
maxResults
|
|
325
|
+
}).toString();
|
|
326
|
+
return yield* makeYouTubeApiRequest(url).pipe(Effect2.flatMap(decodeAndHandleErrors(SearchResponse)));
|
|
327
|
+
});
|
|
328
|
+
var listPlaylistItems = Effect2.fn(function* (playlistId, maxResults = 50, pageToken) {
|
|
329
|
+
const url = createUrl([
|
|
330
|
+
API_URL,
|
|
331
|
+
"playlistItems"
|
|
332
|
+
], {
|
|
333
|
+
part: "snippet,contentDetails",
|
|
334
|
+
playlistId,
|
|
335
|
+
maxResults,
|
|
336
|
+
pageToken
|
|
337
|
+
}).toString();
|
|
338
|
+
return yield* makeYouTubeApiRequest(url).pipe(Effect2.flatMap(decodeAndHandleErrors(PlaylistItemsResponse)));
|
|
339
|
+
});
|
|
340
|
+
var getVideoDetails = Effect2.fn(function* (videoIds) {
|
|
341
|
+
const url = createUrl([
|
|
342
|
+
API_URL,
|
|
343
|
+
"videos"
|
|
344
|
+
], {
|
|
345
|
+
part: "snippet,contentDetails,statistics",
|
|
346
|
+
id: videoIds.join(",")
|
|
347
|
+
}).toString();
|
|
348
|
+
return yield* makeYouTubeApiRequest(url).pipe(Effect2.flatMap(decodeAndHandleErrors(VideosResponse)));
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
export {
|
|
352
|
+
GoogleCredentials,
|
|
353
|
+
youtube_exports
|
|
354
|
+
};
|
|
355
|
+
//# sourceMappingURL=chunk-C26XKDK2.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/services/google-credentials.ts", "../../../src/operations/apis/youtube/index.ts", "../../../src/operations/apis/youtube/api.ts", "../../../src/operations/apis/youtube/types.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport { Database, type Ref } from '@dxos/echo';\nimport { CredentialsService } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { type AccessToken } from '@dxos/types';\n\nimport type * as Channel from '../../types/Channel';\n\n/**\n * Creates the service interface from a cached token.\n * Falls back to database credentials if no cached token is provided.\n */\nconst makeService = (cachedToken: string | undefined): Context.Tag.Service<GoogleCredentials> => ({\n get: () =>\n cachedToken\n ? Effect.succeed(cachedToken)\n : Effect.map(CredentialsService.getCredential({ service: 'google.com' }), (credential) => credential.apiKey!),\n});\n\n/**\n * Loads access token from a ref if available.\n */\nconst loadAccessToken = (accessTokenRef: Ref.Ref<AccessToken.AccessToken> | undefined, label: string) =>\n Effect.gen(function* () {\n if (accessTokenRef) {\n const accessToken = yield* Database.load(accessTokenRef);\n if (accessToken?.token) {\n log(`using ${label}-specific access token`, { note: accessToken.note });\n return accessToken.token;\n }\n }\n return undefined;\n });\n\n/**\n * Service for accessing Google API credentials.\n * Provides the Google API token either from an object's access token or falls back to database credentials.\n */\n// TODO(dmaretskyi): Remove this service.\nexport class GoogleCredentials extends Context.Tag('GoogleCredentials')<\n GoogleCredentials,\n {\n /** Returns the Google API token. */\n get: () => Effect.Effect<string, never, CredentialsService>;\n }\n>() {\n /**\n * Creates a credentials layer from a channel.\n * Pre-loads the access token during layer construction.\n */\n static fromChannel = (channel: Channel.YouTubeChannel) =>\n Layer.effect(GoogleCredentials, Effect.map(loadAccessToken(channel.accessToken, 'channel'), makeService));\n\n /**\n * Creates a credentials layer from a channel ref.\n * Loads the channel and pre-loads the access token during layer construction.\n */\n static fromChannelRef = (channelRef: Ref.Ref<Channel.YouTubeChannel>) =>\n Layer.effect(\n GoogleCredentials,\n Effect.flatMap(Database.load(channelRef), (channel) =>\n Effect.map(loadAccessToken(channel.accessToken, 'channel'), makeService),\n ),\n );\n\n /**\n * Default layer that uses database credentials.\n * Use this for operations that don't have an associated channel.\n */\n static default = Layer.succeed(GoogleCredentials, makeService(undefined));\n\n /** Convenience accessor - returns the Google API token. */\n static get = () => Effect.flatMap(GoogleCredentials, (service) => service.get());\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nexport * from './api';\nexport * from './types';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as HttpClient from '@effect/platform/HttpClient';\nimport * as HttpClientRequest from '@effect/platform/HttpClientRequest';\nimport * as Effect from 'effect/Effect';\nimport type * as ParseResult from 'effect/ParseResult';\nimport * as Schedule from 'effect/Schedule';\nimport * as Schema from 'effect/Schema';\n\nimport { withAuthorization } from '@dxos/functions';\nimport { log } from '@dxos/log';\n\nimport { GoogleCredentials } from '../../services/google-credentials';\n\nimport {\n ChannelsResponse,\n ErrorResponse,\n PlaylistItemsResponse,\n SearchResponse,\n VideosResponse,\n YouTubeError,\n} from './types';\n\nconst API_URL = 'https://www.googleapis.com/youtube/v3';\n\n/**\n * Creates a URL from path segments and query parameters.\n */\nconst createUrl = (parts: (string | undefined)[], params?: Record<string, unknown>): URL => {\n const url = new URL(parts.filter(Boolean).join('/'));\n if (params) {\n Object.entries(params)\n .filter(([_, value]) => value != null)\n .forEach(([key, value]) => url.searchParams.set(key, String(value)));\n }\n return url;\n};\n\n/**\n * Decode response and handle YouTube API errors.\n */\nconst decodeAndHandleErrors =\n <S extends Schema.Schema.Any>(schema: S) =>\n (\n data: unknown,\n ): Effect.Effect<Schema.Schema.Type<S>, YouTubeError | ParseResult.ParseError, Schema.Schema.Context<S>> =>\n Schema.decodeUnknown(Schema.Union(schema, ErrorResponse))(data).pipe(\n Effect.flatMap((response) => {\n if ('error' in response) {\n return Effect.fail(YouTubeError.fromErrorResponse(response));\n } else {\n return Effect.succeed(response);\n }\n }),\n );\n\n/**\n * Makes an authenticated HTTP request to a YouTube API endpoint.\n */\nconst makeYouTubeApiRequest = Effect.fn('makeYouTubeApiRequest')(function* (url: string) {\n const token = yield* GoogleCredentials.get();\n\n const httpClient = yield* HttpClient.HttpClient.pipe(Effect.map(withAuthorization(token, 'Bearer')));\n const httpClientWithTracerDisabled = httpClient.pipe(HttpClient.withTracerDisabledWhen(() => true));\n\n const request = HttpClientRequest.get(url);\n\n const response = yield* request.pipe(\n HttpClientRequest.setHeader('accept', 'application/json'),\n httpClientWithTracerDisabled.execute,\n Effect.flatMap((res) => res.json),\n Effect.timeout('10 seconds'),\n Effect.retry(Schedule.exponential(1_000).pipe(Schedule.compose(Schedule.recurs(3)))),\n Effect.scoped,\n Effect.withSpan('YouTubeApiRequest'),\n );\n\n if ((response as Record<string, unknown>).error) {\n log.catch((response as Record<string, unknown>).error);\n }\n\n return response;\n});\n\n/**\n * Get channel details by channel ID.\n * https://developers.google.com/youtube/v3/docs/channels/list\n */\nexport const getChannel = Effect.fn(function* (channelId: string) {\n const url = createUrl([API_URL, 'channels'], {\n part: 'snippet,contentDetails',\n id: channelId,\n }).toString();\n return yield* makeYouTubeApiRequest(url).pipe(Effect.flatMap(decodeAndHandleErrors(ChannelsResponse)));\n});\n\n/**\n * Get channel by username/handle.\n * https://developers.google.com/youtube/v3/docs/channels/list\n */\nexport const getChannelByHandle = Effect.fn(function* (handle: string) {\n const url = createUrl([API_URL, 'channels'], {\n part: 'snippet,contentDetails',\n forHandle: handle.startsWith('@') ? handle.slice(1) : handle,\n }).toString();\n return yield* makeYouTubeApiRequest(url).pipe(Effect.flatMap(decodeAndHandleErrors(ChannelsResponse)));\n});\n\n/**\n * Search for channels by query.\n * https://developers.google.com/youtube/v3/docs/search/list\n */\nexport const searchChannels = Effect.fn(function* (query: string, maxResults = 10) {\n const url = createUrl([API_URL, 'search'], {\n part: 'snippet',\n type: 'channel',\n q: query,\n maxResults,\n }).toString();\n return yield* makeYouTubeApiRequest(url).pipe(Effect.flatMap(decodeAndHandleErrors(SearchResponse)));\n});\n\n/**\n * List videos from a playlist (used to get uploads from a channel's uploads playlist).\n * https://developers.google.com/youtube/v3/docs/playlistItems/list\n */\nexport const listPlaylistItems = Effect.fn(function* (playlistId: string, maxResults = 50, pageToken?: string) {\n const url = createUrl([API_URL, 'playlistItems'], {\n part: 'snippet,contentDetails',\n playlistId,\n maxResults,\n pageToken,\n }).toString();\n return yield* makeYouTubeApiRequest(url).pipe(Effect.flatMap(decodeAndHandleErrors(PlaylistItemsResponse)));\n});\n\n/**\n * Get detailed video information including statistics and duration.\n * https://developers.google.com/youtube/v3/docs/videos/list\n */\nexport const getVideoDetails = Effect.fn(function* (videoIds: string[]) {\n const url = createUrl([API_URL, 'videos'], {\n part: 'snippet,contentDetails,statistics',\n id: videoIds.join(','),\n }).toString();\n return yield* makeYouTubeApiRequest(url).pipe(Effect.flatMap(decodeAndHandleErrors(VideosResponse)));\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\n/**\n * YouTube API error response.\n */\nexport class YouTubeError extends Schema.TaggedError<YouTubeError>()('YouTubeError', {\n code: Schema.Number,\n message: Schema.String,\n status: Schema.optional(Schema.String),\n}) {\n static fromErrorResponse(response: ErrorResponse) {\n return new YouTubeError({\n code: response.error.code,\n message: response.error.message,\n status: response.error.status,\n });\n }\n}\n\nexport const ErrorResponse = Schema.Struct({\n error: Schema.Struct({\n code: Schema.Number,\n message: Schema.String,\n status: Schema.optional(Schema.String),\n }),\n});\n\nexport type ErrorResponse = Schema.Schema.Type<typeof ErrorResponse>;\n\n/**\n * YouTube channel snippet from search/channel API.\n */\nexport const ChannelSnippet = Schema.Struct({\n title: Schema.String,\n description: Schema.optional(Schema.String),\n customUrl: Schema.optional(Schema.String),\n publishedAt: Schema.optional(Schema.String),\n thumbnails: Schema.optional(\n Schema.Struct({\n default: Schema.optional(Schema.Struct({ url: Schema.String })),\n medium: Schema.optional(Schema.Struct({ url: Schema.String })),\n high: Schema.optional(Schema.Struct({ url: Schema.String })),\n }),\n ),\n});\n\n/**\n * YouTube channel item from channels API.\n */\nexport const ChannelItem = Schema.Struct({\n kind: Schema.String,\n etag: Schema.String,\n id: Schema.String,\n snippet: Schema.optional(ChannelSnippet),\n contentDetails: Schema.optional(\n Schema.Struct({\n relatedPlaylists: Schema.optional(\n Schema.Struct({\n uploads: Schema.optional(Schema.String),\n }),\n ),\n }),\n ),\n});\n\n/**\n * YouTube channels list response.\n */\nexport const ChannelsResponse = Schema.Struct({\n kind: Schema.String,\n etag: Schema.String,\n pageInfo: Schema.optional(\n Schema.Struct({\n totalResults: Schema.Number,\n resultsPerPage: Schema.Number,\n }),\n ),\n items: Schema.Array(ChannelItem),\n});\n\nexport type ChannelsResponse = Schema.Schema.Type<typeof ChannelsResponse>;\n\n/**\n * Video snippet from search/playlistItems API.\n */\nexport const VideoSnippet = Schema.Struct({\n publishedAt: Schema.String,\n channelId: Schema.optional(Schema.String),\n title: Schema.String,\n description: Schema.optional(Schema.String),\n thumbnails: Schema.optional(\n Schema.Struct({\n default: Schema.optional(Schema.Struct({ url: Schema.String })),\n medium: Schema.optional(Schema.Struct({ url: Schema.String })),\n high: Schema.optional(Schema.Struct({ url: Schema.String })),\n standard: Schema.optional(Schema.Struct({ url: Schema.String })),\n maxres: Schema.optional(Schema.Struct({ url: Schema.String })),\n }),\n ),\n channelTitle: Schema.optional(Schema.String),\n playlistId: Schema.optional(Schema.String),\n position: Schema.optional(Schema.Number),\n resourceId: Schema.optional(\n Schema.Struct({\n kind: Schema.String,\n videoId: Schema.String,\n }),\n ),\n});\n\n/**\n * Content details for a video.\n */\nexport const VideoContentDetails = Schema.Struct({\n videoId: Schema.optional(Schema.String),\n videoPublishedAt: Schema.optional(Schema.String),\n duration: Schema.optional(Schema.String),\n});\n\n/**\n * Video statistics.\n */\nexport const VideoStatistics = Schema.Struct({\n viewCount: Schema.optional(Schema.String),\n likeCount: Schema.optional(Schema.String),\n commentCount: Schema.optional(Schema.String),\n});\n\n/**\n * Video item from videos API.\n */\nexport const VideoItem = Schema.Struct({\n kind: Schema.String,\n etag: Schema.String,\n id: Schema.String,\n snippet: Schema.optional(VideoSnippet),\n contentDetails: Schema.optional(VideoContentDetails),\n statistics: Schema.optional(VideoStatistics),\n});\n\nexport type VideoItem = Schema.Schema.Type<typeof VideoItem>;\n\n/**\n * YouTube videos list response.\n */\nexport const VideosResponse = Schema.Struct({\n kind: Schema.String,\n etag: Schema.String,\n nextPageToken: Schema.optional(Schema.String),\n prevPageToken: Schema.optional(Schema.String),\n pageInfo: Schema.optional(\n Schema.Struct({\n totalResults: Schema.Number,\n resultsPerPage: Schema.Number,\n }),\n ),\n items: Schema.Array(VideoItem),\n});\n\nexport type VideosResponse = Schema.Schema.Type<typeof VideosResponse>;\n\n/**\n * Playlist item from playlistItems API.\n */\nexport const PlaylistItem = Schema.Struct({\n kind: Schema.String,\n etag: Schema.String,\n id: Schema.String,\n snippet: Schema.optional(VideoSnippet),\n contentDetails: Schema.optional(VideoContentDetails),\n});\n\n/**\n * YouTube playlist items response.\n */\nexport const PlaylistItemsResponse = Schema.Struct({\n kind: Schema.String,\n etag: Schema.String,\n nextPageToken: Schema.optional(Schema.String),\n prevPageToken: Schema.optional(Schema.String),\n pageInfo: Schema.optional(\n Schema.Struct({\n totalResults: Schema.Number,\n resultsPerPage: Schema.Number,\n }),\n ),\n items: Schema.Array(PlaylistItem),\n});\n\nexport type PlaylistItemsResponse = Schema.Schema.Type<typeof PlaylistItemsResponse>;\n\n/**\n * Search result item.\n */\nexport const SearchItem = Schema.Struct({\n kind: Schema.String,\n etag: Schema.String,\n id: Schema.Struct({\n kind: Schema.String,\n videoId: Schema.optional(Schema.String),\n channelId: Schema.optional(Schema.String),\n playlistId: Schema.optional(Schema.String),\n }),\n snippet: Schema.optional(VideoSnippet),\n});\n\n/**\n * YouTube search response.\n */\nexport const SearchResponse = Schema.Struct({\n kind: Schema.String,\n etag: Schema.String,\n nextPageToken: Schema.optional(Schema.String),\n prevPageToken: Schema.optional(Schema.String),\n pageInfo: Schema.optional(\n Schema.Struct({\n totalResults: Schema.Number,\n resultsPerPage: Schema.Number,\n }),\n ),\n items: Schema.Array(SearchItem),\n});\n\nexport type SearchResponse = Schema.Schema.Type<typeof SearchResponse>;\n\n/**\n * Caption track from captions.list.\n */\nexport const CaptionResource = Schema.Struct({\n id: Schema.String,\n snippet: Schema.optional(\n Schema.Struct({\n videoId: Schema.optional(Schema.String),\n language: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n trackKind: Schema.optional(Schema.String),\n }),\n ),\n});\n\n/**\n * YouTube captions.list response.\n */\nexport const CaptionsListResponse = Schema.Struct({\n kind: Schema.String,\n etag: Schema.String,\n items: Schema.optional(Schema.Array(CaptionResource)),\n});\n\nexport type CaptionsListResponse = Schema.Schema.Type<typeof CaptionsListResponse>;\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AAEvB,SAASC,gBAA0B;AACnC,SAASC,0BAA0B;AACnC,SAASC,WAAW;;AASpB,IAAMC,cAAc,CAACC,iBAA6E;EAChGC,KAAK,MACHD,cACWE,eAAQF,WAAAA,IACRG,WAAIN,mBAAmBO,cAAc;IAAEC,SAAS;EAAa,CAAA,GAAI,CAACC,eAAeA,WAAWC,MAAM;AACjH;AAKA,IAAMC,kBAAkB,CAACC,gBAA8DC,UAC9EC,WAAI,aAAA;AACT,MAAIF,gBAAgB;AAClB,UAAMG,cAAc,OAAOhB,SAASiB,KAAKJ,cAAAA;AACzC,QAAIG,aAAaE,OAAO;AACtBhB,UAAI,SAASY,KAAAA,0BAA+B;QAAEK,MAAMH,YAAYG;MAAK,GA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SAAQ;AACX,SAAO,OAAO9B,sBAAsB3B,GAAAA,EAAKoB,KAAYC,gBAAQP,sBAAsB8D,cAAAA,CAAAA,CAAAA;AACrF,CAAA;",
|
|
6
|
+
"names": ["Context", "Effect", "Layer", "Database", "CredentialsService", "log", "makeService", "cachedToken", "get", "succeed", "map", "getCredential", "service", "credential", "apiKey", "loadAccessToken", "accessTokenRef", "label", "gen", "accessToken", "load", "token", "note", "undefined", "GoogleCredentials", "Tag", "fromChannel", "channel", "effect", "fromChannelRef", "channelRef", "flatMap", "default", "HttpClient", "HttpClientRequest", "Effect", "Schedule", "Schema", "withAuthorization", "log", "Schema", "YouTubeError", "TaggedError", "code", "Number", "message", "String", "status", "optional", "fromErrorResponse", "response", "error", "ErrorResponse", "Struct", "ChannelSnippet", "title", "description", "customUrl", "publishedAt", "thumbnails", "default", "url", "medium", "high", "ChannelItem", "kind", "etag", "id", "snippet", "contentDetails", "relatedPlaylists", "uploads", "ChannelsResponse", "pageInfo", "totalResults", "resultsPerPage", "items", "Array", "VideoSnippet", "channelId", "standard", "maxres", "channelTitle", "playlistId", "position", "resourceId", "videoId", "VideoContentDetails", "videoPublishedAt", "duration", "VideoStatistics", "viewCount", "likeCount", "commentCount", "VideoItem", "statistics", "VideosResponse", "nextPageToken", "prevPageToken", "PlaylistItem", "PlaylistItemsResponse", "SearchItem", "SearchResponse", "CaptionResource", "language", "name", "trackKind", "CaptionsListResponse", "API_URL", "createUrl", "parts", "params", "url", "URL", "filter", "Boolean", "join", "Object", "entries", "_", "value", "forEach", "key", "searchParams", "set", "String", "decodeAndHandleErrors", "schema", "data", "decodeUnknown", "Union", "ErrorResponse", "pipe", "flatMap", "response", "fail", "YouTubeError", "fromErrorResponse", "succeed", "makeYouTubeApiRequest", "fn", "token", "GoogleCredentials", "get", "httpClient", "HttpClient", "map", "withAuthorization", "httpClientWithTracerDisabled", "withTracerDisabledWhen", "request", "setHeader", "execute", "res", "json", "timeout", "retry", "exponential", "compose", "recurs", "scoped", "withSpan", "error", "log", "catch", "getChannel", "channelId", "part", "id", "toString", "ChannelsResponse", "getChannelByHandle", "handle", "forHandle", "startsWith", "slice", "searchChannels", "query", "maxResults", "type", "q", "SearchResponse", "listPlaylistItems", "playlistId", "pageToken", "PlaylistItemsResponse", "getVideoDetails", "videoIds", "VideosResponse"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/meta.ts
|
|
2
|
+
import { trim } from "@dxos/util";
|
|
3
|
+
var meta = {
|
|
4
|
+
id: "org.dxos.plugin.youtube",
|
|
5
|
+
name: "YouTube",
|
|
6
|
+
description: trim`
|
|
7
|
+
YouTube channel subscription and video feed management.
|
|
8
|
+
Sync videos from channels and access transcripts for analysis.
|
|
9
|
+
`,
|
|
10
|
+
icon: "ph--youtube-logo--regular",
|
|
11
|
+
iconHue: "red",
|
|
12
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-youtube",
|
|
13
|
+
tags: [
|
|
14
|
+
"labs"
|
|
15
|
+
]
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
meta
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=chunk-DFRSBBSO.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.youtube',\n name: 'YouTube',\n description: trim`\n YouTube channel subscription and video feed management.\n Sync videos from channels and access transcripts for analysis.\n `,\n icon: 'ph--youtube-logo--regular',\n iconHue: 'red',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-youtube',\n tags: ['labs'],\n};\n"],
|
|
5
|
+
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,MAAM;IAAC;;AACT;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "tags"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-J5LGTIGS.mjs";
|
|
4
|
+
|
|
5
|
+
// src/types/types.ts
|
|
6
|
+
var YouTubeOperation = {};
|
|
7
|
+
|
|
8
|
+
// src/types/Channel.ts
|
|
9
|
+
var Channel_exports = {};
|
|
10
|
+
__export(Channel_exports, {
|
|
11
|
+
CreateYouTubeChannelSchema: () => CreateYouTubeChannelSchema,
|
|
12
|
+
YouTubeChannel: () => YouTubeChannel,
|
|
13
|
+
instanceOf: () => instanceOf,
|
|
14
|
+
make: () => make
|
|
15
|
+
});
|
|
16
|
+
import * as Schema from "effect/Schema";
|
|
17
|
+
import { Annotation, Feed, Obj, Ref, Type } from "@dxos/echo";
|
|
18
|
+
import { FormInputAnnotation } from "@dxos/echo/internal";
|
|
19
|
+
import { FeedAnnotation } from "@dxos/schema";
|
|
20
|
+
import { AccessToken } from "@dxos/types";
|
|
21
|
+
var YouTubeChannel = Schema.Struct({
|
|
22
|
+
/** Display name for the channel. */
|
|
23
|
+
name: Schema.String.pipe(Schema.optional),
|
|
24
|
+
/** YouTube channel ID (e.g., UC...). */
|
|
25
|
+
channelId: Schema.String.pipe(Schema.optional),
|
|
26
|
+
/** YouTube channel URL or handle. */
|
|
27
|
+
channelUrl: Schema.String.pipe(Schema.optional),
|
|
28
|
+
/** Feed containing YouTubeVideo objects. */
|
|
29
|
+
feed: Ref.Ref(Feed.Feed).pipe(FormInputAnnotation.set(false)),
|
|
30
|
+
/** Last sync timestamp. */
|
|
31
|
+
lastSyncedAt: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
32
|
+
/** Google API credentials for fetching channel data. */
|
|
33
|
+
accessToken: Schema.optional(Ref.Ref(AccessToken.AccessToken).annotations({
|
|
34
|
+
title: "Account",
|
|
35
|
+
description: "Google account credentials for syncing this YouTube channel."
|
|
36
|
+
}))
|
|
37
|
+
}).pipe(Type.object({
|
|
38
|
+
typename: "org.dxos.type.youtube-channel",
|
|
39
|
+
version: "0.1.0"
|
|
40
|
+
}), Annotation.IconAnnotation.set({
|
|
41
|
+
icon: "ph--youtube-logo--regular",
|
|
42
|
+
hue: "red"
|
|
43
|
+
}), FeedAnnotation.set(true));
|
|
44
|
+
var instanceOf = (value) => Obj.instanceOf(YouTubeChannel, value);
|
|
45
|
+
var CreateYouTubeChannelSchema = Schema.Struct({
|
|
46
|
+
name: Schema.optional(Schema.String.annotations({
|
|
47
|
+
title: "Name"
|
|
48
|
+
})),
|
|
49
|
+
channelUrl: Schema.optional(Schema.String.annotations({
|
|
50
|
+
title: "Channel URL",
|
|
51
|
+
description: "YouTube channel URL, handle (e.g., @channelname), or channel ID."
|
|
52
|
+
})),
|
|
53
|
+
accessToken: Schema.optional(Ref.Ref(AccessToken.AccessToken).annotations({
|
|
54
|
+
title: "Account",
|
|
55
|
+
description: "Google account credentials for syncing this YouTube channel."
|
|
56
|
+
}))
|
|
57
|
+
});
|
|
58
|
+
var make = (props = {}) => {
|
|
59
|
+
const feed = Feed.make();
|
|
60
|
+
const channel = Obj.make(YouTubeChannel, {
|
|
61
|
+
feed: Ref.make(feed),
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
Obj.setParent(feed, channel);
|
|
65
|
+
return channel;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
YouTubeOperation,
|
|
70
|
+
Channel_exports
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=chunk-GFRR4TTX.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/types.ts", "../../../src/types/Channel.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\n/**\n * YouTube plugin operations (placeholder for future expansion).\n */\nexport const YouTubeOperation = {\n // Operations will be defined here when needed.\n} as const;\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Feed, Obj, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation } from '@dxos/echo/internal';\nimport { FeedAnnotation } from '@dxos/schema';\nimport { AccessToken } from '@dxos/types';\n\n// @import-as-namespace\n\n/**\n * YouTubeChannel schema representing a YouTube channel to sync videos from.\n */\nexport const YouTubeChannel = Schema.Struct({\n /** Display name for the channel. */\n name: Schema.String.pipe(Schema.optional),\n /** YouTube channel ID (e.g., UC...). */\n channelId: Schema.String.pipe(Schema.optional),\n /** YouTube channel URL or handle. */\n channelUrl: Schema.String.pipe(Schema.optional),\n /** Feed containing YouTubeVideo objects. */\n feed: Ref.Ref(Feed.Feed).pipe(FormInputAnnotation.set(false)),\n /** Last sync timestamp. */\n lastSyncedAt: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),\n /** Google API credentials for fetching channel data. */\n accessToken: Schema.optional(\n Ref.Ref(AccessToken.AccessToken).annotations({\n title: 'Account',\n description: 'Google account credentials for syncing this YouTube channel.',\n }),\n ),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.youtube-channel',\n version: '0.1.0',\n }),\n Annotation.IconAnnotation.set({\n icon: 'ph--youtube-logo--regular',\n hue: 'red',\n }),\n FeedAnnotation.set(true),\n);\n\nexport interface YouTubeChannel extends Schema.Schema.Type<typeof YouTubeChannel> {}\n\n/** Checks if a value is a YouTubeChannel object. */\nexport const instanceOf = (value: unknown): value is YouTubeChannel => Obj.instanceOf(YouTubeChannel, value);\n\nexport const CreateYouTubeChannelSchema = Schema.Struct({\n name: Schema.optional(Schema.String.annotations({ title: 'Name' })),\n channelUrl: Schema.optional(\n Schema.String.annotations({\n title: 'Channel URL',\n description: 'YouTube channel URL, handle (e.g., @channelname), or channel ID.',\n }),\n ),\n accessToken: Schema.optional(\n Ref.Ref(AccessToken.AccessToken).annotations({\n title: 'Account',\n description: 'Google account credentials for syncing this YouTube channel.',\n }),\n ),\n});\nexport interface CreateYouTubeChannelSchema extends Schema.Schema.Type<typeof CreateYouTubeChannelSchema> {}\n\ntype YouTubeChannelProps = Omit<Obj.MakeProps<typeof YouTubeChannel>, 'feed' | 'lastSyncedAt'>;\n\n/** Creates a YouTubeChannel object with a backing feed. */\nexport const make = (props: YouTubeChannelProps = {}) => {\n const feed = Feed.make();\n const channel = Obj.make(YouTubeChannel, {\n feed: Ref.make(feed),\n ...props,\n });\n Obj.setParent(feed, channel);\n return channel;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;AAOO,IAAMA,mBAAmB,CAEhC;;;ACTA;;;;;;;AAIA,YAAYC,YAAY;AAExB,SAASC,YAAYC,MAAMC,KAAKC,KAAKC,YAAY;AACjD,SAASC,2BAA2B;AACpC,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAOrB,IAAMC,iBAAwBC,cAAO;;EAE1CC,MAAaC,cAAOC,KAAYC,eAAQ;;EAExCC,WAAkBH,cAAOC,KAAYC,eAAQ;;EAE7CE,YAAmBJ,cAAOC,KAAYC,eAAQ;;EAE9CG,MAAMC,IAAIA,IAAIC,KAAKA,IAAI,EAAEN,KAAKO,oBAAoBC,IAAI,KAAA,CAAA;;EAEtDC,cAAqBV,cAAOC,KAAKO,oBAAoBC,IAAI,KAAA,GAAeP,eAAQ;;EAEhFS,aAAoBT,gBAClBI,IAAIA,IAAIM,YAAYA,WAAW,EAAEC,YAAY;IAC3CC,OAAO;IACPC,aAAa;EACf,CAAA,CAAA;AAEJ,CAAA,EAAGd,KACDe,KAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,WAAWC,eAAeZ,IAAI;EAC5Ba,MAAM;EACNC,KAAK;AACP,CAAA,GACAC,eAAef,IAAI,IAAA,CAAA;AAMd,IAAMgB,aAAa,CAACC,UAA4CC,IAAIF,WAAW5B,gBAAgB6B,KAAAA;AAE/F,IAAME,6BAAoC9B,cAAO;EACtDC,MAAaG,gBAAgBF,cAAOa,YAAY;IAAEC,OAAO;EAAO,CAAA,CAAA;EAChEV,YAAmBF,gBACVF,cAAOa,YAAY;IACxBC,OAAO;IACPC,aAAa;EACf,CAAA,CAAA;EAEFJ,aAAoBT,gBAClBI,IAAIA,IAAIM,YAAYA,WAAW,EAAEC,YAAY;IAC3CC,OAAO;IACPC,aAAa;EACf,CAAA,CAAA;AAEJ,CAAA;AAMO,IAAMc,OAAO,CAACC,QAA6B,CAAC,MAAC;AAClD,QAAMzB,OAAOE,KAAKsB,KAAI;AACtB,QAAME,UAAUJ,IAAIE,KAAKhC,gBAAgB;IACvCQ,MAAMC,IAAIuB,KAAKxB,IAAAA;IACf,GAAGyB;EACL,CAAA;AACAH,MAAIK,UAAU3B,MAAM0B,OAAAA;AACpB,SAAOA;AACT;",
|
|
6
|
+
"names": ["YouTubeOperation", "Schema", "Annotation", "Feed", "Obj", "Ref", "Type", "FormInputAnnotation", "FeedAnnotation", "AccessToken", "YouTubeChannel", "Struct", "name", "String", "pipe", "optional", "channelId", "channelUrl", "feed", "Ref", "Feed", "FormInputAnnotation", "set", "lastSyncedAt", "accessToken", "AccessToken", "annotations", "title", "description", "Type", "object", "typename", "version", "Annotation", "IconAnnotation", "icon", "hue", "FeedAnnotation", "instanceOf", "value", "Obj", "CreateYouTubeChannelSchema", "make", "props", "channel", "setParent"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ClearSyncedVideos,
|
|
3
|
+
Sync
|
|
4
|
+
} from "./chunk-P67QEKBQ.mjs";
|
|
5
|
+
|
|
6
|
+
// src/blueprints/youtube.ts
|
|
7
|
+
import { Blueprint, Template } from "@dxos/blueprints";
|
|
8
|
+
import { trim } from "@dxos/util";
|
|
9
|
+
var BLUEPRINT_KEY = "dxos.org/blueprint/youtube";
|
|
10
|
+
var make = () => Blueprint.make({
|
|
11
|
+
key: BLUEPRINT_KEY,
|
|
12
|
+
name: "YouTube",
|
|
13
|
+
tools: Blueprint.toolDefinitions({
|
|
14
|
+
operations: [
|
|
15
|
+
Sync,
|
|
16
|
+
ClearSyncedVideos
|
|
17
|
+
],
|
|
18
|
+
tools: []
|
|
19
|
+
}),
|
|
20
|
+
instructions: Template.make({
|
|
21
|
+
source: trim`
|
|
22
|
+
You manage YouTube channel subscriptions and video content.
|
|
23
|
+
|
|
24
|
+
# Summary formatting:
|
|
25
|
+
- Format summaries as markdown documents without extra comments.
|
|
26
|
+
- Use markdown formatting for headings and bullet points.
|
|
27
|
+
- Format video summaries as lists with key points.
|
|
28
|
+
|
|
29
|
+
# References
|
|
30
|
+
- Use references to objects in the form of:
|
|
31
|
+
@dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M
|
|
32
|
+
- References are rendered as rich content in the response to the user.
|
|
33
|
+
|
|
34
|
+
# Video Analysis
|
|
35
|
+
When analyzing videos:
|
|
36
|
+
- Summarize the key topics and themes.
|
|
37
|
+
- Extract important quotes or statements.
|
|
38
|
+
- Identify action items or recommendations.
|
|
39
|
+
- Note any timestamps for important sections.
|
|
40
|
+
|
|
41
|
+
# Transcript Usage
|
|
42
|
+
- Videos may include transcripts that can be used for deeper analysis.
|
|
43
|
+
- When summarizing content, reference the transcript for accuracy.
|
|
44
|
+
- Transcripts include timestamps that can help locate specific content.
|
|
45
|
+
`
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
var blueprint = {
|
|
49
|
+
key: BLUEPRINT_KEY,
|
|
50
|
+
make
|
|
51
|
+
};
|
|
52
|
+
var youtube_default = blueprint;
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
youtube_default
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=chunk-MUE22YUM.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/blueprints/youtube.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type AppCapabilities } from '@dxos/app-toolkit';\nimport { Blueprint, Template } from '@dxos/blueprints';\nimport { trim } from '@dxos/util';\n\nimport { ClearSyncedVideos, Sync } from '../operations';\n\nconst BLUEPRINT_KEY = 'dxos.org/blueprint/youtube';\n\nconst make = () =>\n Blueprint.make({\n key: BLUEPRINT_KEY,\n name: 'YouTube',\n tools: Blueprint.toolDefinitions({ operations: [Sync, ClearSyncedVideos], tools: [] }),\n instructions: Template.make({\n source: trim`\n You manage YouTube channel subscriptions and video content.\n\n # Summary formatting:\n - Format summaries as markdown documents without extra comments.\n - Use markdown formatting for headings and bullet points.\n - Format video summaries as lists with key points.\n\n # References\n - Use references to objects in the form of:\n @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M\n - References are rendered as rich content in the response to the user.\n\n # Video Analysis\n When analyzing videos:\n - Summarize the key topics and themes.\n - Extract important quotes or statements.\n - Identify action items or recommendations.\n - Note any timestamps for important sections.\n\n # Transcript Usage\n - Videos may include transcripts that can be used for deeper analysis.\n - When summarizing content, reference the transcript for accuracy.\n - Transcripts include timestamps that can help locate specific content.\n `,\n }),\n });\n\nconst blueprint: AppCapabilities.BlueprintDefinition = {\n key: BLUEPRINT_KEY,\n make,\n};\n\nexport default blueprint;\n"],
|
|
5
|
+
"mappings": ";;;;;;AAKA,SAASA,WAAWC,gBAAgB;AACpC,SAASC,YAAY;AAIrB,IAAMC,gBAAgB;AAEtB,IAAMC,OAAO,MACXC,UAAUD,KAAK;EACbE,KAAKH;EACLI,MAAM;EACNC,OAAOH,UAAUI,gBAAgB;IAAEC,YAAY;MAACC;MAAMC;;IAAoBJ,OAAO,CAAA;EAAG,CAAA;EACpFK,cAAcC,SAASV,KAAK;IAC1BW,QAAQC;;;;;;;;;;;;;;;;;;;;;;;;;EAyBV,CAAA;AACF,CAAA;AAEF,IAAMC,YAAiD;EACrDX,KAAKH;EACLC;AACF;AAEA,IAAA,kBAAea;",
|
|
6
|
+
"names": ["Blueprint", "Template", "trim", "BLUEPRINT_KEY", "make", "Blueprint", "key", "name", "tools", "toolDefinitions", "operations", "Sync", "ClearSyncedVideos", "instructions", "Template", "source", "trim", "blueprint"]
|
|
7
|
+
}
|