@particle-academy/youtube-ui 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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@particle-academy/youtube-ui`,
4
+ `@particle-academy/youtube-js`, `particle-academy/youtube-php` and
5
+ `fancy-youtube`.
6
+
7
+ ## [0.1.0] — 2026-08-23
8
+
9
+ First release.
10
+
11
+ ### Added
12
+
13
+ - `playlist_item_insert` — add a video to a YouTube playlist with
14
+ `POST /youtube/v3/playlistItems?part=snippet`.
15
+ - A top-level `PlaylistItem` faker for development without changing a channel.
16
+
17
+ ### Fixed query protocol
18
+
19
+ YouTube requires `part=snippet` in the query. It names both the request section
20
+ being written and the response section included, so it is a fixed protocol
21
+ literal rather than a user-facing option.
22
+
23
+ ### Narrow access, no sandbox, no idempotency
24
+
25
+ The connector requests `youtube.force-ssl`, the narrowest scope this method
26
+ accepts for modifying playlist contents. YouTube has no test estate, and
27
+ `playlistItems.insert` has no idempotency key; a retry can add the video twice.
28
+
29
+ [0.1.0]: https://github.com/Fancy-Friends/youtube/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Particle Academy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # YouTube
2
+
3
+ YouTube for [fancy-flow][flow] — as **four imported, versioned packages**, one
4
+ per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
5
+ change.
6
+
7
+ [flow]: https://github.com/Particle-Academy/fancy-flow
8
+
9
+ | Runtime | Package | Install |
10
+ |---|---|---|
11
+ | Authoring surface (every host) | `@particle-academy/youtube-ui` | `npm install @particle-academy/youtube-ui` |
12
+ | Node | `@particle-academy/youtube-js` | `npm install @particle-academy/youtube-js` |
13
+ | PHP 8.4+ | `particle-academy/youtube-php` | `composer require particle-academy/youtube-php` |
14
+ | Python 3.11+ | `fancy-youtube` | `pip install fancy-youtube` |
15
+
16
+ The `ui` package is the editor surface and is React on every host — a PHP or
17
+ Python project installs it *and* its own runtime package, and never the `js` one.
18
+
19
+ ## What it costs you
20
+
21
+ One dependency: `@particle-academy/fancy-connector-core` (or
22
+ `particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
23
+ packages pull in themselves. The Python package has **zero** runtime
24
+ dependencies.
25
+
26
+ **No YouTube SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
27
+ subject to the kit's full approval bar, and one per provider is hundreds of
28
+ dependencies nobody is tracking.
29
+
30
+ ## Run it before you have credentials
31
+
32
+ Every operation ships a **faker**, whether or not YouTube has a sandbox. Set a
33
+ node's mode to `fake` and it returns the shape YouTube actually publishes — the
34
+ same field names, deterministically — so you can wire the downstream nodes before
35
+ touching an account, a key, or a network.
36
+
37
+ ## This repository is generated
38
+
39
+ `provider/` is the source. Everything under `packages/` is emitted from it and
40
+ **must not be hand-edited** — CI regenerates and diffs on every push, and the
41
+ next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).
42
+
43
+ ## Two namespaces, which do not match on purpose
44
+
45
+ The repo is `github.com/Fancy-Friends/youtube`; the packages publish under
46
+ `particle-academy`. Nothing derives one from the other — the names come from
47
+ weaver's `friends.json` and nowhere else.
48
+
49
+ ## Licence
50
+
51
+ MIT.
package/dist/index.cjs ADDED
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+
3
+ var connectors = require('@particle-academy/fancy-flow/connectors');
4
+
5
+ // src/service.ts
6
+ var CONNECTOR_API_VERSION = 1;
7
+ var YOUTUBE_SERVICE = {
8
+ service: "youtube",
9
+ serviceTitle: "YouTube",
10
+ domain: "marketing",
11
+ sandbox: "none"
12
+ };
13
+ var YOUTUBE_CREDENTIALS = [
14
+ {
15
+ "key": "clientId",
16
+ "label": "OAuth client ID",
17
+ "scope": "provider",
18
+ "secret": false,
19
+ "help": "From Google Cloud Console. One value for the whole installation."
20
+ },
21
+ {
22
+ "key": "clientSecret",
23
+ "label": "OAuth client secret",
24
+ "scope": "provider",
25
+ "secret": true,
26
+ "help": "The client secret for the same OAuth app."
27
+ },
28
+ {
29
+ "key": "accessToken",
30
+ "label": "Access token",
31
+ "scope": "account",
32
+ "secret": true,
33
+ "help": "Per connected YouTube account; expires after one hour."
34
+ },
35
+ {
36
+ "key": "refreshToken",
37
+ "label": "Refresh token",
38
+ "scope": "account",
39
+ "secret": true,
40
+ "help": "Per connected YouTube account; the host uses it to refresh the access token."
41
+ }
42
+ ];
43
+ var YOUTUBE_OAUTH = {
44
+ "flow": "authorization_code",
45
+ "authorizeUrl": "https://accounts.google.com/o/oauth2/v2/auth",
46
+ "tokenUrl": "https://oauth2.googleapis.com/token",
47
+ "scopes": [
48
+ "https://www.googleapis.com/auth/youtube.force-ssl"
49
+ ],
50
+ "accessTokenCredential": "accessToken",
51
+ "refreshTokenCredential": "refreshToken",
52
+ "accessTokenTtlSeconds": 3600
53
+ };
54
+ function youtubeMeta(role, operation, docs) {
55
+ return { ...YOUTUBE_SERVICE, role, operation, docs };
56
+ }
57
+ var YOUTUBE_PLAYLIST_ITEM_KIND = "@particle-academy/youtube_playlist_item";
58
+ var YOUTUBE_PLAYLIST_ITEM_OPERATION = "playlist_item_insert";
59
+ var YOUTUBE_PLAYLIST_ITEM_META = youtubeMeta("action", "add a video to a playlist", "https://developers.google.com/youtube/v3/docs/playlistItems/insert");
60
+ var YOUTUBE_PLAYLIST_ITEM_OUTPUT = [
61
+ {
62
+ "path": "data.id",
63
+ "type": "string",
64
+ "description": "YouTube's unique id for the new playlist item."
65
+ },
66
+ {
67
+ "path": "data.kind",
68
+ "type": "string",
69
+ "description": "The fixed resource kind `youtube#playlistItem`."
70
+ },
71
+ {
72
+ "path": "data.snippet.playlistId",
73
+ "type": "string",
74
+ "description": "The playlist containing the item."
75
+ },
76
+ {
77
+ "path": "data.snippet.resourceId.videoId",
78
+ "type": "string",
79
+ "description": "The video added to the playlist."
80
+ },
81
+ {
82
+ "path": "data.snippet.position",
83
+ "type": "number",
84
+ "description": "The item's zero-based position in the playlist."
85
+ }
86
+ ];
87
+ var youtubePlaylistItemKind = connectors.defineConnectorKind(YOUTUBE_PLAYLIST_ITEM_META, {
88
+ name: YOUTUBE_PLAYLIST_ITEM_KIND,
89
+ aliases: ["youtube_playlist_item"],
90
+ label: "YouTube playlist item",
91
+ description: "Add a video to a YouTube playlist.",
92
+ inputs: [{ id: "in" }],
93
+ outputs: [{ id: "out" }],
94
+ sideEffects: "unsafe-to-replay",
95
+ outputShape: YOUTUBE_PLAYLIST_ITEM_OUTPUT,
96
+ configSchema: [
97
+ {
98
+ "type": "text",
99
+ "key": "playlistId",
100
+ "label": "Playlist ID",
101
+ "required": true,
102
+ "description": "The YouTube id of the playlist to add the video to."
103
+ },
104
+ {
105
+ "type": "text",
106
+ "key": "videoId",
107
+ "label": "Video ID",
108
+ "required": true,
109
+ "description": "The YouTube id of the video to add."
110
+ }
111
+ ],
112
+ defaultConfig: {
113
+ "mode": "auto"
114
+ },
115
+ renderBody: ({ config }) => connectors.summarize(YOUTUBE_PLAYLIST_ITEM_META, config, "add a video to a playlist")
116
+ });
117
+
118
+ // src/index.ts
119
+ var YOUTUBE_KINDS = [
120
+ youtubePlaylistItemKind
121
+ ];
122
+
123
+ exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
124
+ exports.YOUTUBE_CREDENTIALS = YOUTUBE_CREDENTIALS;
125
+ exports.YOUTUBE_KINDS = YOUTUBE_KINDS;
126
+ exports.YOUTUBE_OAUTH = YOUTUBE_OAUTH;
127
+ exports.YOUTUBE_PLAYLIST_ITEM_KIND = YOUTUBE_PLAYLIST_ITEM_KIND;
128
+ exports.YOUTUBE_PLAYLIST_ITEM_META = YOUTUBE_PLAYLIST_ITEM_META;
129
+ exports.YOUTUBE_PLAYLIST_ITEM_OPERATION = YOUTUBE_PLAYLIST_ITEM_OPERATION;
130
+ exports.YOUTUBE_PLAYLIST_ITEM_OUTPUT = YOUTUBE_PLAYLIST_ITEM_OUTPUT;
131
+ exports.YOUTUBE_SERVICE = YOUTUBE_SERVICE;
132
+ exports.youtubeMeta = youtubeMeta;
133
+ exports.youtubePlaylistItemKind = youtubePlaylistItemKind;
134
+ //# sourceMappingURL=index.cjs.map
135
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/service.ts","../src/kinds/playlist-item-insert.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;;;AAgCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,eAAA,GAAkB;AAAA,EAC7B,OAAA,EAAS,SAAA;AAAA,EACT,YAAA,EAAc,SAAA;AAAA,EACd,MAAA,EAAQ,WAAA;AAAA,EACR,OAAA,EAAS;AACX;AAGO,IAAM,mBAAA,GAAsB;AAAA,EACjC;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,E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AAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACbC,oBAAA,CAAU,0BAAA,EAA4B,QAAmC,2BAA2B;AACxG,CAAC;;;ACpEM,IAAM,aAAA,GAAsC;AAAA,EACjD;AACF","file":"index.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- youtube\n */\n\n/**\n * YouTube's identity on the authoring surface, shared by every YouTube node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\n *\n * YouTube has no sandbox. Every live-mode add changes a real playlist; use the\n * faker during development and remove live test items afterward.\n */\n\nimport type { ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported — an imported constant lets an upgrade rewrite the\n * very claim it exists to detect.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const YOUTUBE_SERVICE = {\n service: \"youtube\",\n serviceTitle: \"YouTube\",\n domain: \"marketing\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a YouTube connection holds. */\nexport const YOUTUBE_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console. One value for the whole installation.\"\n },\n {\n \"key\": \"clientSecret\",\n \"label\": \"OAuth client secret\",\n \"scope\": \"provider\",\n \"secret\": true,\n \"help\": \"The client secret for the same OAuth app.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected YouTube account; expires after one hour.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected YouTube account; the host uses it to refresh the access token.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange YouTube requires — DECLARED here, performed by the host.\n *\n * A consent screen needs a browser, a redirect URI and somewhere to persist\n * the result, and all three belong to the host; a package that ran the dance\n * itself would have to own a web server. So this says precisely enough for a\n * host to do it.\n *\n * The access token lasts 3600 seconds. A host that never refreshes will work\n * all afternoon and be broken by morning, which is why the lifetime is stated\n * rather than left to be discovered.\n */\nexport const YOUTUBE_OAUTH = {\n \"flow\": \"authorization_code\",\n \"authorizeUrl\": \"https://accounts.google.com/o/oauth2/v2/auth\",\n \"tokenUrl\": \"https://oauth2.googleapis.com/token\",\n \"scopes\": [\n \"https://www.googleapis.com/auth/youtube.force-ssl\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a YouTube node's connector metadata from the operation it performs. */\nexport function youtubeMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...YOUTUBE_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/playlist-item-insert.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/playlist-item-insert.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- youtube\n */\n\n/**\n * YouTube playlist item — Add a video to a YouTube playlist.\n *\n * https://developers.google.com/youtube/v3/docs/playlistItems/insert\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { youtubeMeta } from \"../service.js\";\n\nexport const YOUTUBE_PLAYLIST_ITEM_KIND = \"@particle-academy/youtube_playlist_item\";\nexport const YOUTUBE_PLAYLIST_ITEM_OPERATION = \"playlist_item_insert\";\n\nexport const YOUTUBE_PLAYLIST_ITEM_META = youtubeMeta(\"action\", \"add a video to a playlist\", \"https://developers.google.com/youtube/v3/docs/playlistItems/insert\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const YOUTUBE_PLAYLIST_ITEM_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.id\",\n \"type\": \"string\",\n \"description\": \"YouTube's unique id for the new playlist item.\"\n },\n {\n \"path\": \"data.kind\",\n \"type\": \"string\",\n \"description\": \"The fixed resource kind `youtube#playlistItem`.\"\n },\n {\n \"path\": \"data.snippet.playlistId\",\n \"type\": \"string\",\n \"description\": \"The playlist containing the item.\"\n },\n {\n \"path\": \"data.snippet.resourceId.videoId\",\n \"type\": \"string\",\n \"description\": \"The video added to the playlist.\"\n },\n {\n \"path\": \"data.snippet.position\",\n \"type\": \"number\",\n \"description\": \"The item's zero-based position in the playlist.\"\n }\n];\n\nexport const youtubePlaylistItemKind: NodeKindDefinition = defineConnectorKind(YOUTUBE_PLAYLIST_ITEM_META, {\n name: YOUTUBE_PLAYLIST_ITEM_KIND,\n aliases: [\"youtube_playlist_item\"],\n label: \"YouTube playlist item\",\n description: \"Add a video to a YouTube playlist.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: YOUTUBE_PLAYLIST_ITEM_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"playlistId\",\n \"label\": \"Playlist ID\",\n \"required\": true,\n \"description\": \"The YouTube id of the playlist to add the video to.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"videoId\",\n \"label\": \"Video ID\",\n \"required\": true,\n \"description\": \"The YouTube id of the video to add.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(YOUTUBE_PLAYLIST_ITEM_META, config as Record<string, unknown>, \"add a video to a playlist\"),\n});\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- youtube\n */\n\n/**\n * YouTube's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/playlist-item-insert.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { youtubePlaylistItemKind } from \"./kinds/playlist-item-insert.js\";\n\n/** Every YouTube kind, for a host that registers the lot. */\nexport const YOUTUBE_KINDS: NodeKindDefinition[] = [\n youtubePlaylistItemKind,\n];\n"]}
@@ -0,0 +1,127 @@
1
+ import * as _particle_academy_fancy_flow_connectors from '@particle-academy/fancy-flow/connectors';
2
+ import { ConnectorMeta, OutputField } from '@particle-academy/fancy-flow/connectors';
3
+ import { NodeKindDefinition } from '@particle-academy/fancy-flow/engine';
4
+
5
+ /**
6
+ * GENERATED FILE — do not edit.
7
+ *
8
+ * Emitted from provider/manifest.json by weaver's generator.
9
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
10
+ * being rejected, because it works until it silently does not. Fix
11
+ * provider/manifest.json (or weaver's template/) and regenerate:
12
+ *
13
+ * npm run provider -- youtube
14
+ */
15
+ /**
16
+ * YouTube's identity on the authoring surface, shared by every YouTube node.
17
+ *
18
+ * This file must import nothing from the js package: a PHP or Python project
19
+ * installs the ui package and never that one, and the import would be a
20
+ * dangling module the moment it did.
21
+ *
22
+ * ## The sandbox trap
23
+ *
24
+ * YouTube has no sandbox. Every live-mode add changes a real playlist; use the
25
+ * faker during development and remove live test items afterward.
26
+ */
27
+
28
+ /**
29
+ * The connector API version this package was GENERATED against.
30
+ *
31
+ * A literal, never imported — an imported constant lets an upgrade rewrite the
32
+ * very claim it exists to detect.
33
+ */
34
+ declare const CONNECTOR_API_VERSION = 1;
35
+ /** The parts of a connector's identity that belong to the SERVICE, not the node. */
36
+ declare const YOUTUBE_SERVICE: {
37
+ readonly service: "youtube";
38
+ readonly serviceTitle: "YouTube";
39
+ readonly domain: "marketing";
40
+ readonly sandbox: "none";
41
+ };
42
+ /** The credentials a YouTube connection holds. */
43
+ declare const YOUTUBE_CREDENTIALS: readonly [{
44
+ readonly key: "clientId";
45
+ readonly label: "OAuth client ID";
46
+ readonly scope: "provider";
47
+ readonly secret: false;
48
+ readonly help: "From Google Cloud Console. One value for the whole installation.";
49
+ }, {
50
+ readonly key: "clientSecret";
51
+ readonly label: "OAuth client secret";
52
+ readonly scope: "provider";
53
+ readonly secret: true;
54
+ readonly help: "The client secret for the same OAuth app.";
55
+ }, {
56
+ readonly key: "accessToken";
57
+ readonly label: "Access token";
58
+ readonly scope: "account";
59
+ readonly secret: true;
60
+ readonly help: "Per connected YouTube account; expires after one hour.";
61
+ }, {
62
+ readonly key: "refreshToken";
63
+ readonly label: "Refresh token";
64
+ readonly scope: "account";
65
+ readonly secret: true;
66
+ readonly help: "Per connected YouTube account; the host uses it to refresh the access token.";
67
+ }];
68
+ /**
69
+ * The OAuth2 exchange YouTube requires — DECLARED here, performed by the host.
70
+ *
71
+ * A consent screen needs a browser, a redirect URI and somewhere to persist
72
+ * the result, and all three belong to the host; a package that ran the dance
73
+ * itself would have to own a web server. So this says precisely enough for a
74
+ * host to do it.
75
+ *
76
+ * The access token lasts 3600 seconds. A host that never refreshes will work
77
+ * all afternoon and be broken by morning, which is why the lifetime is stated
78
+ * rather than left to be discovered.
79
+ */
80
+ declare const YOUTUBE_OAUTH: {
81
+ readonly flow: "authorization_code";
82
+ readonly authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth";
83
+ readonly tokenUrl: "https://oauth2.googleapis.com/token";
84
+ readonly scopes: readonly ["https://www.googleapis.com/auth/youtube.force-ssl"];
85
+ readonly accessTokenCredential: "accessToken";
86
+ readonly refreshTokenCredential: "refreshToken";
87
+ readonly accessTokenTtlSeconds: 3600;
88
+ };
89
+ /** Build a YouTube node's connector metadata from the operation it performs. */
90
+ declare function youtubeMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
91
+
92
+ declare const YOUTUBE_PLAYLIST_ITEM_KIND = "@particle-academy/youtube_playlist_item";
93
+ declare const YOUTUBE_PLAYLIST_ITEM_OPERATION = "playlist_item_insert";
94
+ declare const YOUTUBE_PLAYLIST_ITEM_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
95
+ /**
96
+ * What this node emits — the "ingredients" a downstream node can reference.
97
+ *
98
+ * fancy-flow reads `outputShape` off the kind and offers it in the variable
99
+ * picker, so declaring it is the whole of the work: an author configuring the
100
+ * next node picks `{{ $json.data.id }}` off a list instead of typing a path
101
+ * and hoping.
102
+ */
103
+ declare const YOUTUBE_PLAYLIST_ITEM_OUTPUT: OutputField[];
104
+ declare const youtubePlaylistItemKind: NodeKindDefinition;
105
+
106
+ /**
107
+ * GENERATED FILE — do not edit.
108
+ *
109
+ * Emitted from provider/manifest.json by weaver's generator.
110
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
111
+ * being rejected, because it works until it silently does not. Fix
112
+ * provider/manifest.json (or weaver's template/) and regenerate:
113
+ *
114
+ * npm run provider -- youtube
115
+ */
116
+ /**
117
+ * YouTube's node kinds for fancy-flow.
118
+ *
119
+ * Install this on every host. The TypeScript executors live in the js
120
+ * package's `./flow` subpath; PHP and Python hosts run their own and need only
121
+ * this.
122
+ */
123
+
124
+ /** Every YouTube kind, for a host that registers the lot. */
125
+ declare const YOUTUBE_KINDS: NodeKindDefinition[];
126
+
127
+ export { CONNECTOR_API_VERSION, YOUTUBE_CREDENTIALS, YOUTUBE_KINDS, YOUTUBE_OAUTH, YOUTUBE_PLAYLIST_ITEM_KIND, YOUTUBE_PLAYLIST_ITEM_META, YOUTUBE_PLAYLIST_ITEM_OPERATION, YOUTUBE_PLAYLIST_ITEM_OUTPUT, YOUTUBE_SERVICE, youtubeMeta, youtubePlaylistItemKind };
@@ -0,0 +1,127 @@
1
+ import * as _particle_academy_fancy_flow_connectors from '@particle-academy/fancy-flow/connectors';
2
+ import { ConnectorMeta, OutputField } from '@particle-academy/fancy-flow/connectors';
3
+ import { NodeKindDefinition } from '@particle-academy/fancy-flow/engine';
4
+
5
+ /**
6
+ * GENERATED FILE — do not edit.
7
+ *
8
+ * Emitted from provider/manifest.json by weaver's generator.
9
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
10
+ * being rejected, because it works until it silently does not. Fix
11
+ * provider/manifest.json (or weaver's template/) and regenerate:
12
+ *
13
+ * npm run provider -- youtube
14
+ */
15
+ /**
16
+ * YouTube's identity on the authoring surface, shared by every YouTube node.
17
+ *
18
+ * This file must import nothing from the js package: a PHP or Python project
19
+ * installs the ui package and never that one, and the import would be a
20
+ * dangling module the moment it did.
21
+ *
22
+ * ## The sandbox trap
23
+ *
24
+ * YouTube has no sandbox. Every live-mode add changes a real playlist; use the
25
+ * faker during development and remove live test items afterward.
26
+ */
27
+
28
+ /**
29
+ * The connector API version this package was GENERATED against.
30
+ *
31
+ * A literal, never imported — an imported constant lets an upgrade rewrite the
32
+ * very claim it exists to detect.
33
+ */
34
+ declare const CONNECTOR_API_VERSION = 1;
35
+ /** The parts of a connector's identity that belong to the SERVICE, not the node. */
36
+ declare const YOUTUBE_SERVICE: {
37
+ readonly service: "youtube";
38
+ readonly serviceTitle: "YouTube";
39
+ readonly domain: "marketing";
40
+ readonly sandbox: "none";
41
+ };
42
+ /** The credentials a YouTube connection holds. */
43
+ declare const YOUTUBE_CREDENTIALS: readonly [{
44
+ readonly key: "clientId";
45
+ readonly label: "OAuth client ID";
46
+ readonly scope: "provider";
47
+ readonly secret: false;
48
+ readonly help: "From Google Cloud Console. One value for the whole installation.";
49
+ }, {
50
+ readonly key: "clientSecret";
51
+ readonly label: "OAuth client secret";
52
+ readonly scope: "provider";
53
+ readonly secret: true;
54
+ readonly help: "The client secret for the same OAuth app.";
55
+ }, {
56
+ readonly key: "accessToken";
57
+ readonly label: "Access token";
58
+ readonly scope: "account";
59
+ readonly secret: true;
60
+ readonly help: "Per connected YouTube account; expires after one hour.";
61
+ }, {
62
+ readonly key: "refreshToken";
63
+ readonly label: "Refresh token";
64
+ readonly scope: "account";
65
+ readonly secret: true;
66
+ readonly help: "Per connected YouTube account; the host uses it to refresh the access token.";
67
+ }];
68
+ /**
69
+ * The OAuth2 exchange YouTube requires — DECLARED here, performed by the host.
70
+ *
71
+ * A consent screen needs a browser, a redirect URI and somewhere to persist
72
+ * the result, and all three belong to the host; a package that ran the dance
73
+ * itself would have to own a web server. So this says precisely enough for a
74
+ * host to do it.
75
+ *
76
+ * The access token lasts 3600 seconds. A host that never refreshes will work
77
+ * all afternoon and be broken by morning, which is why the lifetime is stated
78
+ * rather than left to be discovered.
79
+ */
80
+ declare const YOUTUBE_OAUTH: {
81
+ readonly flow: "authorization_code";
82
+ readonly authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth";
83
+ readonly tokenUrl: "https://oauth2.googleapis.com/token";
84
+ readonly scopes: readonly ["https://www.googleapis.com/auth/youtube.force-ssl"];
85
+ readonly accessTokenCredential: "accessToken";
86
+ readonly refreshTokenCredential: "refreshToken";
87
+ readonly accessTokenTtlSeconds: 3600;
88
+ };
89
+ /** Build a YouTube node's connector metadata from the operation it performs. */
90
+ declare function youtubeMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
91
+
92
+ declare const YOUTUBE_PLAYLIST_ITEM_KIND = "@particle-academy/youtube_playlist_item";
93
+ declare const YOUTUBE_PLAYLIST_ITEM_OPERATION = "playlist_item_insert";
94
+ declare const YOUTUBE_PLAYLIST_ITEM_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
95
+ /**
96
+ * What this node emits — the "ingredients" a downstream node can reference.
97
+ *
98
+ * fancy-flow reads `outputShape` off the kind and offers it in the variable
99
+ * picker, so declaring it is the whole of the work: an author configuring the
100
+ * next node picks `{{ $json.data.id }}` off a list instead of typing a path
101
+ * and hoping.
102
+ */
103
+ declare const YOUTUBE_PLAYLIST_ITEM_OUTPUT: OutputField[];
104
+ declare const youtubePlaylistItemKind: NodeKindDefinition;
105
+
106
+ /**
107
+ * GENERATED FILE — do not edit.
108
+ *
109
+ * Emitted from provider/manifest.json by weaver's generator.
110
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
111
+ * being rejected, because it works until it silently does not. Fix
112
+ * provider/manifest.json (or weaver's template/) and regenerate:
113
+ *
114
+ * npm run provider -- youtube
115
+ */
116
+ /**
117
+ * YouTube's node kinds for fancy-flow.
118
+ *
119
+ * Install this on every host. The TypeScript executors live in the js
120
+ * package's `./flow` subpath; PHP and Python hosts run their own and need only
121
+ * this.
122
+ */
123
+
124
+ /** Every YouTube kind, for a host that registers the lot. */
125
+ declare const YOUTUBE_KINDS: NodeKindDefinition[];
126
+
127
+ export { CONNECTOR_API_VERSION, YOUTUBE_CREDENTIALS, YOUTUBE_KINDS, YOUTUBE_OAUTH, YOUTUBE_PLAYLIST_ITEM_KIND, YOUTUBE_PLAYLIST_ITEM_META, YOUTUBE_PLAYLIST_ITEM_OPERATION, YOUTUBE_PLAYLIST_ITEM_OUTPUT, YOUTUBE_SERVICE, youtubeMeta, youtubePlaylistItemKind };
package/dist/index.js ADDED
@@ -0,0 +1,123 @@
1
+ import { defineConnectorKind, summarize } from '@particle-academy/fancy-flow/connectors';
2
+
3
+ // src/service.ts
4
+ var CONNECTOR_API_VERSION = 1;
5
+ var YOUTUBE_SERVICE = {
6
+ service: "youtube",
7
+ serviceTitle: "YouTube",
8
+ domain: "marketing",
9
+ sandbox: "none"
10
+ };
11
+ var YOUTUBE_CREDENTIALS = [
12
+ {
13
+ "key": "clientId",
14
+ "label": "OAuth client ID",
15
+ "scope": "provider",
16
+ "secret": false,
17
+ "help": "From Google Cloud Console. One value for the whole installation."
18
+ },
19
+ {
20
+ "key": "clientSecret",
21
+ "label": "OAuth client secret",
22
+ "scope": "provider",
23
+ "secret": true,
24
+ "help": "The client secret for the same OAuth app."
25
+ },
26
+ {
27
+ "key": "accessToken",
28
+ "label": "Access token",
29
+ "scope": "account",
30
+ "secret": true,
31
+ "help": "Per connected YouTube account; expires after one hour."
32
+ },
33
+ {
34
+ "key": "refreshToken",
35
+ "label": "Refresh token",
36
+ "scope": "account",
37
+ "secret": true,
38
+ "help": "Per connected YouTube account; the host uses it to refresh the access token."
39
+ }
40
+ ];
41
+ var YOUTUBE_OAUTH = {
42
+ "flow": "authorization_code",
43
+ "authorizeUrl": "https://accounts.google.com/o/oauth2/v2/auth",
44
+ "tokenUrl": "https://oauth2.googleapis.com/token",
45
+ "scopes": [
46
+ "https://www.googleapis.com/auth/youtube.force-ssl"
47
+ ],
48
+ "accessTokenCredential": "accessToken",
49
+ "refreshTokenCredential": "refreshToken",
50
+ "accessTokenTtlSeconds": 3600
51
+ };
52
+ function youtubeMeta(role, operation, docs) {
53
+ return { ...YOUTUBE_SERVICE, role, operation, docs };
54
+ }
55
+ var YOUTUBE_PLAYLIST_ITEM_KIND = "@particle-academy/youtube_playlist_item";
56
+ var YOUTUBE_PLAYLIST_ITEM_OPERATION = "playlist_item_insert";
57
+ var YOUTUBE_PLAYLIST_ITEM_META = youtubeMeta("action", "add a video to a playlist", "https://developers.google.com/youtube/v3/docs/playlistItems/insert");
58
+ var YOUTUBE_PLAYLIST_ITEM_OUTPUT = [
59
+ {
60
+ "path": "data.id",
61
+ "type": "string",
62
+ "description": "YouTube's unique id for the new playlist item."
63
+ },
64
+ {
65
+ "path": "data.kind",
66
+ "type": "string",
67
+ "description": "The fixed resource kind `youtube#playlistItem`."
68
+ },
69
+ {
70
+ "path": "data.snippet.playlistId",
71
+ "type": "string",
72
+ "description": "The playlist containing the item."
73
+ },
74
+ {
75
+ "path": "data.snippet.resourceId.videoId",
76
+ "type": "string",
77
+ "description": "The video added to the playlist."
78
+ },
79
+ {
80
+ "path": "data.snippet.position",
81
+ "type": "number",
82
+ "description": "The item's zero-based position in the playlist."
83
+ }
84
+ ];
85
+ var youtubePlaylistItemKind = defineConnectorKind(YOUTUBE_PLAYLIST_ITEM_META, {
86
+ name: YOUTUBE_PLAYLIST_ITEM_KIND,
87
+ aliases: ["youtube_playlist_item"],
88
+ label: "YouTube playlist item",
89
+ description: "Add a video to a YouTube playlist.",
90
+ inputs: [{ id: "in" }],
91
+ outputs: [{ id: "out" }],
92
+ sideEffects: "unsafe-to-replay",
93
+ outputShape: YOUTUBE_PLAYLIST_ITEM_OUTPUT,
94
+ configSchema: [
95
+ {
96
+ "type": "text",
97
+ "key": "playlistId",
98
+ "label": "Playlist ID",
99
+ "required": true,
100
+ "description": "The YouTube id of the playlist to add the video to."
101
+ },
102
+ {
103
+ "type": "text",
104
+ "key": "videoId",
105
+ "label": "Video ID",
106
+ "required": true,
107
+ "description": "The YouTube id of the video to add."
108
+ }
109
+ ],
110
+ defaultConfig: {
111
+ "mode": "auto"
112
+ },
113
+ renderBody: ({ config }) => summarize(YOUTUBE_PLAYLIST_ITEM_META, config, "add a video to a playlist")
114
+ });
115
+
116
+ // src/index.ts
117
+ var YOUTUBE_KINDS = [
118
+ youtubePlaylistItemKind
119
+ ];
120
+
121
+ export { CONNECTOR_API_VERSION, YOUTUBE_CREDENTIALS, YOUTUBE_KINDS, YOUTUBE_OAUTH, YOUTUBE_PLAYLIST_ITEM_KIND, YOUTUBE_PLAYLIST_ITEM_META, YOUTUBE_PLAYLIST_ITEM_OPERATION, YOUTUBE_PLAYLIST_ITEM_OUTPUT, YOUTUBE_SERVICE, youtubeMeta, youtubePlaylistItemKind };
122
+ //# sourceMappingURL=index.js.map
123
+ //# sourceMappingURL=index.js.map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;AAAA,MACR,KAAA,EAAO,YAAA;AAAA,MACP,OAAA,EAAS,aAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,SAAA;AAAA,MACP,OAAA,EAAS,UAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,aAAA,EAAe;AAAA;AACjB,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACb,SAAA,CAAU,0BAAA,EAA4B,QAAmC,2BAA2B;AACxG,CAAC;;;ACpEM,IAAM,aAAA,GAAsC;AAAA,EACjD;AACF","file":"index.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- youtube\n */\n\n/**\n * YouTube's identity on the authoring surface, shared by every YouTube node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\n *\n * YouTube has no sandbox. Every live-mode add changes a real playlist; use the\n * faker during development and remove live test items afterward.\n */\n\nimport type { ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported — an imported constant lets an upgrade rewrite the\n * very claim it exists to detect.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const YOUTUBE_SERVICE = {\n service: \"youtube\",\n serviceTitle: \"YouTube\",\n domain: \"marketing\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a YouTube connection holds. */\nexport const YOUTUBE_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console. One value for the whole installation.\"\n },\n {\n \"key\": \"clientSecret\",\n \"label\": \"OAuth client secret\",\n \"scope\": \"provider\",\n \"secret\": true,\n \"help\": \"The client secret for the same OAuth app.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected YouTube account; expires after one hour.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected YouTube account; the host uses it to refresh the access token.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange YouTube requires — DECLARED here, performed by the host.\n *\n * A consent screen needs a browser, a redirect URI and somewhere to persist\n * the result, and all three belong to the host; a package that ran the dance\n * itself would have to own a web server. So this says precisely enough for a\n * host to do it.\n *\n * The access token lasts 3600 seconds. A host that never refreshes will work\n * all afternoon and be broken by morning, which is why the lifetime is stated\n * rather than left to be discovered.\n */\nexport const YOUTUBE_OAUTH = {\n \"flow\": \"authorization_code\",\n \"authorizeUrl\": \"https://accounts.google.com/o/oauth2/v2/auth\",\n \"tokenUrl\": \"https://oauth2.googleapis.com/token\",\n \"scopes\": [\n \"https://www.googleapis.com/auth/youtube.force-ssl\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a YouTube node's connector metadata from the operation it performs. */\nexport function youtubeMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...YOUTUBE_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/playlist-item-insert.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/playlist-item-insert.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- youtube\n */\n\n/**\n * YouTube playlist item — Add a video to a YouTube playlist.\n *\n * https://developers.google.com/youtube/v3/docs/playlistItems/insert\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { youtubeMeta } from \"../service.js\";\n\nexport const YOUTUBE_PLAYLIST_ITEM_KIND = \"@particle-academy/youtube_playlist_item\";\nexport const YOUTUBE_PLAYLIST_ITEM_OPERATION = \"playlist_item_insert\";\n\nexport const YOUTUBE_PLAYLIST_ITEM_META = youtubeMeta(\"action\", \"add a video to a playlist\", \"https://developers.google.com/youtube/v3/docs/playlistItems/insert\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const YOUTUBE_PLAYLIST_ITEM_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.id\",\n \"type\": \"string\",\n \"description\": \"YouTube's unique id for the new playlist item.\"\n },\n {\n \"path\": \"data.kind\",\n \"type\": \"string\",\n \"description\": \"The fixed resource kind `youtube#playlistItem`.\"\n },\n {\n \"path\": \"data.snippet.playlistId\",\n \"type\": \"string\",\n \"description\": \"The playlist containing the item.\"\n },\n {\n \"path\": \"data.snippet.resourceId.videoId\",\n \"type\": \"string\",\n \"description\": \"The video added to the playlist.\"\n },\n {\n \"path\": \"data.snippet.position\",\n \"type\": \"number\",\n \"description\": \"The item's zero-based position in the playlist.\"\n }\n];\n\nexport const youtubePlaylistItemKind: NodeKindDefinition = defineConnectorKind(YOUTUBE_PLAYLIST_ITEM_META, {\n name: YOUTUBE_PLAYLIST_ITEM_KIND,\n aliases: [\"youtube_playlist_item\"],\n label: \"YouTube playlist item\",\n description: \"Add a video to a YouTube playlist.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: YOUTUBE_PLAYLIST_ITEM_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"playlistId\",\n \"label\": \"Playlist ID\",\n \"required\": true,\n \"description\": \"The YouTube id of the playlist to add the video to.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"videoId\",\n \"label\": \"Video ID\",\n \"required\": true,\n \"description\": \"The YouTube id of the video to add.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(YOUTUBE_PLAYLIST_ITEM_META, config as Record<string, unknown>, \"add a video to a playlist\"),\n});\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- youtube\n */\n\n/**\n * YouTube's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/playlist-item-insert.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { youtubePlaylistItemKind } from \"./kinds/playlist-item-insert.js\";\n\n/** Every YouTube kind, for a host that registers the lot. */\nexport const YOUTUBE_KINDS: NodeKindDefinition[] = [\n youtubePlaylistItemKind,\n];\n"]}
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@particle-academy/youtube-ui",
3
+ "version": "0.1.0",
4
+ "description": "YouTube's authoring surface for fancy-flow — the node kinds, their config schemas and their declared output shapes. React on every host; carries no executor.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Fancy-Friends/youtube.git"
8
+ },
9
+ "homepage": "https://github.com/Fancy-Friends/youtube#readme",
10
+ "bugs": "https://github.com/Fancy-Friends/youtube/issues",
11
+ "type": "module",
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "import": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "require": {
22
+ "types": "./dist/index.d.cts",
23
+ "default": "./dist/index.cjs"
24
+ }
25
+ },
26
+ "./package.json": "./package.json"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "README.md",
31
+ "CHANGELOG.md",
32
+ "LICENSE"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsup",
36
+ "lint": "tsc --noEmit",
37
+ "test": "node --import tsx --test tests/*.test.ts",
38
+ "prepublishOnly": "tsup"
39
+ },
40
+ "dependencies": {},
41
+ "peerDependencies": {
42
+ "@particle-academy/fancy-flow": ">=0.48.0 <2.0"
43
+ },
44
+ "devDependencies": {
45
+ "@particle-academy/fancy-flow": ">=0.48.0 <2.0",
46
+ "@types/node": "^26.2.0",
47
+ "tsup": "^8.5.0",
48
+ "tsx": "^4.19.0",
49
+ "typescript": "^5.8.0"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "keywords": [
55
+ "youtube",
56
+ "marketing",
57
+ "connector",
58
+ "fancy-flow",
59
+ "fancy-ui",
60
+ "particle-academy"
61
+ ],
62
+ "license": "MIT",
63
+ "sideEffects": false,
64
+ "engines": {
65
+ "node": ">=22"
66
+ }
67
+ }