@particle-academy/youtube-ui 0.1.0 → 0.2.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 CHANGED
@@ -4,6 +4,40 @@ All notable changes to `@particle-academy/youtube-ui`,
4
4
  `@particle-academy/youtube-js`, `particle-academy/youtube-php` and
5
5
  `fancy-youtube`.
6
6
 
7
+ ## [0.2.0] — 2026-08-24
8
+
9
+ ### Added
10
+
11
+ - **The README now says how to SET THIS CONNECTOR UP**, in the package itself.
12
+
13
+ Until now it explained what the four packages are, what they cost and why the
14
+ repo is generated — and said nothing about credentials, scopes, sandboxes or
15
+ operations. Somebody who installed it could not learn from it which credentials
16
+ a connection needs, where a human GETS them, which scopes to request, or what
17
+ the connector can actually do. All of that was already in the definition; the
18
+ one document a consumer reads was the one that omitted everything actionable.
19
+
20
+ The new **Setting it up** section carries:
21
+
22
+ - every credential, with the text saying where the value comes from, whether it
23
+ is **per installation** or **per connected account**, and whether it is secret;
24
+ - the OAuth authorize and token URLs and the exact scopes, verbatim;
25
+ - the access-token lifetime, and where refresh tokens ROTATE, the two things a
26
+ host must not do — retry a failed refresh, or refresh concurrently — because a
27
+ replay revokes the entire grant and nothing in the failure says why;
28
+ - the estate in this provider's own terms, including the cases where a
29
+ successful-looking run reaches nobody, or reaches the real one;
30
+ - every action and trigger with its method, path, inputs, and whether it is safe
31
+ to replay;
32
+ - a trigger's provider-side setup, which nobody can derive from anything else.
33
+
34
+ It is **generated from `provider/manifest.json`**, so it cannot drift from what
35
+ the packages do — which is the point at a few hundred providers, where a
36
+ hand-written setup section is a few hundred documents going quietly stale.
37
+
38
+ No code changed. This release exists because a registry and an installing agent
39
+ read the PUBLISHED artifact, and the artifact carried the old README.
40
+
7
41
  ## [0.1.0] — 2026-08-23
8
42
 
9
43
  First release.
@@ -27,3 +61,4 @@ accepts for modifying playlist contents. YouTube has no test estate, and
27
61
  `playlistItems.insert` has no idempotency key; a retry can add the video twice.
28
62
 
29
63
  [0.1.0]: https://github.com/Fancy-Friends/youtube/releases/tag/v0.1.0
64
+ [0.2.0]: https://github.com/Fancy-Friends/youtube/releases/tag/v0.2.0
package/README.md CHANGED
@@ -27,6 +27,55 @@ dependencies.
27
27
  subject to the kit's full approval bar, and one per provider is hundreds of
28
28
  dependencies nobody is tracking.
29
29
 
30
+ ## Setting it up
31
+
32
+ Everything below is generated from `provider/manifest.json`, so it cannot disagree with what the packages do.
33
+
34
+ ### Credentials
35
+
36
+ A YouTube connection holds 4 values.
37
+
38
+ **Two kinds of value, and mixing them up matters.** A `provider` credential is ONE value for the whole installation — an OAuth app's client secret serves every connected account. An `account` credential is one per connected account. A host that stores the second where it stores the first lets one account's credentials reach another's.
39
+
40
+ | Field | Scope | Secret | Where it comes from |
41
+ |---|---|---|---|
42
+ | **OAuth client ID** | per installation | not secret | From Google Cloud Console. One value for the whole installation. |
43
+ | **OAuth client secret** | per installation | **secret** | The client secret for the same OAuth app. |
44
+ | **Access token** | per connected account | **secret** | Per connected YouTube account; expires after one hour. |
45
+ | **Refresh token** | per connected account | **secret** | Per connected YouTube account; the host uses it to refresh the access token. |
46
+
47
+ ### Authorising
48
+
49
+ YouTube uses OAuth2 (authorization_code). The package DECLARES the exchange; the HOST performs it — a consent screen needs a browser, a redirect URI and somewhere to persist the result, and all three belong to the host.
50
+
51
+ - **Authorize URL** — https://accounts.google.com/o/oauth2/v2/auth
52
+ - **Token URL** — https://oauth2.googleapis.com/token
53
+ - **Scopes** — `https://www.googleapis.com/auth/youtube.force-ssl`
54
+ - **Access token lifetime** — 3600 seconds (1 hours). A host that never refreshes works all afternoon and is broken by morning.
55
+
56
+ The refresh tokens do **not** rotate: the same one is reusable, so a refresh may safely be retried and may run concurrently. Stated rather than assumed, because the opposite — a provider that spends the token and revokes the grant on a replay — looks identical until it happens.
57
+
58
+ ### The estate
59
+
60
+ **YouTube has no test estate, and somebody checked.** Everything this connector does is real. Use the faker to build against it.
61
+
62
+ > YouTube has no sandbox. Every live-mode add changes a real playlist; use the faker during development and remove live test items afterward.
63
+
64
+ ## What it can do
65
+
66
+ ### Actions
67
+
68
+ #### `playlist_item_insert` — YouTube playlist item
69
+
70
+ Add a video to a YouTube playlist.
71
+
72
+ `POST /youtube/v3/playlistItems` · **unsafe to replay** — a retried durable run does it TWICE
73
+
74
+ | Input | Required | What it is |
75
+ |---|---|---|
76
+ | `playlistId` | yes | The YouTube id of the playlist to add the video to. |
77
+ | `videoId` | yes | The YouTube id of the video to add. |
78
+
30
79
  ## Run it before you have credentials
31
80
 
32
81
  Every operation ships a **faker**, whether or not YouTube has a sandbox. Set a
package/dist/index.cjs CHANGED
@@ -49,6 +49,7 @@ var YOUTUBE_OAUTH = {
49
49
  ],
50
50
  "accessTokenCredential": "accessToken",
51
51
  "refreshTokenCredential": "refreshToken",
52
+ "refreshTokenRotates": false,
52
53
  "accessTokenTtlSeconds": 3600
53
54
  };
54
55
  function youtubeMeta(role, operation, docs) {
@@ -1 +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,EAAS,iBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,qBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,G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AQ,iCAAA;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,aAAA,EAAe;AAAA,GACjB;AAAA,EACA;AAAA,IACE,MAAA,EAAQ,uBAAA;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,aAAA,EAAe;AAAA;AAEnB;AAEO,IAAM,uBAAA,GAA8CA,+BAAoB,0BAAA,EAA4B;AAAA,EACzG,IAAA,EAAM,0BAAA;AAAA,EACN,OAAA,EAAS,CAAC,uBAAuB,CAAA;AAAA,EACjC,KAAA,EAAO,uBAAA;AAAA,EACP,WAAA,EAAa,oCAAA;AAAA,EACb,MAAA,EAAQ,CAAC,EAAE,EAAA,EAAI,MAAM,CAAA;AAAA,EACrB,OAAA,EAAS,CAAC,EAAE,EAAA,EAAI,OAAO,CAAA;AAAA,EACvB,WAAA,EAAa,kBAAA;AAAA,EACb,WAAA,EAAa,4BAAA;AAAA,EACb,YAAA,EAAc;AAAA,IACZ;AAAA,MACE,MAAA,EAAQ,MAAA;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,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"]}
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,EAAS,iBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,qBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,aAAA;AAAA,IACP,OAAA,EAAS,cAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IAC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AAAA,IACR,aAAA,EAAe;AAAA;AAEnB;AAEO,IAAM,uBAAA,GAA8CA,+BAAoB,0BAAA,EAA4B;AAAA,EACzG,IAAA,EAAM,0BAAA;AAAA,EACN,OAAA,EAAS,CAAC,uBAAuB,CAAA;AAAA,EACjC,KAAA,EAAO,uBAAA;AAAA,EACP,WAAA,EAAa,oCAAA;AAAA,EACb,MAAA,EAAQ,CAAC,EAAE,EAAA,EAAI,MAAM,CAAA;AAAA,EACrB,OAAA,EAAS,CAAC,EAAE,EAAA,EAAI,OAAO,CAAA;AAAA,EACvB,WAAA,EAAa,kBAAA;AAAA,EACb,WAAA,EAAa,4BAAA;AAAA,EACb,YAAA,EAAc;AAAA,IACZ;AAAA,MACE,MAAA,EAAQ,MAAA;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,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 *\n * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may\n * safely be retried and may run concurrently. That is stated rather than\n * assumed because the opposite — a provider that spends the token and revokes\n * the grant on a replay — looks identical until it happens.\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 \"refreshTokenRotates\": false,\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/dist/index.d.cts CHANGED
@@ -76,6 +76,11 @@ declare const YOUTUBE_CREDENTIALS: readonly [{
76
76
  * The access token lasts 3600 seconds. A host that never refreshes will work
77
77
  * all afternoon and be broken by morning, which is why the lifetime is stated
78
78
  * rather than left to be discovered.
79
+ *
80
+ * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may
81
+ * safely be retried and may run concurrently. That is stated rather than
82
+ * assumed because the opposite — a provider that spends the token and revokes
83
+ * the grant on a replay — looks identical until it happens.
79
84
  */
80
85
  declare const YOUTUBE_OAUTH: {
81
86
  readonly flow: "authorization_code";
@@ -84,6 +89,7 @@ declare const YOUTUBE_OAUTH: {
84
89
  readonly scopes: readonly ["https://www.googleapis.com/auth/youtube.force-ssl"];
85
90
  readonly accessTokenCredential: "accessToken";
86
91
  readonly refreshTokenCredential: "refreshToken";
92
+ readonly refreshTokenRotates: false;
87
93
  readonly accessTokenTtlSeconds: 3600;
88
94
  };
89
95
  /** Build a YouTube node's connector metadata from the operation it performs. */
package/dist/index.d.ts CHANGED
@@ -76,6 +76,11 @@ declare const YOUTUBE_CREDENTIALS: readonly [{
76
76
  * The access token lasts 3600 seconds. A host that never refreshes will work
77
77
  * all afternoon and be broken by morning, which is why the lifetime is stated
78
78
  * rather than left to be discovered.
79
+ *
80
+ * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may
81
+ * safely be retried and may run concurrently. That is stated rather than
82
+ * assumed because the opposite — a provider that spends the token and revokes
83
+ * the grant on a replay — looks identical until it happens.
79
84
  */
80
85
  declare const YOUTUBE_OAUTH: {
81
86
  readonly flow: "authorization_code";
@@ -84,6 +89,7 @@ declare const YOUTUBE_OAUTH: {
84
89
  readonly scopes: readonly ["https://www.googleapis.com/auth/youtube.force-ssl"];
85
90
  readonly accessTokenCredential: "accessToken";
86
91
  readonly refreshTokenCredential: "refreshToken";
92
+ readonly refreshTokenRotates: false;
87
93
  readonly accessTokenTtlSeconds: 3600;
88
94
  };
89
95
  /** Build a YouTube node's connector metadata from the operation it performs. */
package/dist/index.js CHANGED
@@ -47,6 +47,7 @@ var YOUTUBE_OAUTH = {
47
47
  ],
48
48
  "accessTokenCredential": "accessToken",
49
49
  "refreshTokenCredential": "refreshToken",
50
+ "refreshTokenRotates": false,
50
51
  "accessTokenTtlSeconds": 3600
51
52
  };
52
53
  function youtubeMeta(role, operation, docs) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/service.ts","../src/kinds/playlist-item-insert.ts","../src/index.ts"],"names":[],"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,EAAS,iBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,qBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,Q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EAAe;AAAA,GACjB;AAAA,EACA;AAAA,IACE,MAAA,EAAQ,iCAAA;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,aAAA,EAAe;AAAA,GACjB;AAAA,EACA;AAAA,IACE,MAAA,EAAQ,uBAAA;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,aAAA,EAAe;AAAA;AAEnB;AAEO,IAAM,uBAAA,GAA8C,oBAAoB,0BAAA,EAA4B;AAAA,EACzG,IAAA,EAAM,0BAAA;AAAA,EACN,OAAA,EAAS,CAAC,uBAAuB,CAAA;AAAA,EACjC,KAAA,EAAO,uBAAA;AAAA,EACP,WAAA,EAAa,oCAAA;AAAA,EACb,MAAA,EAAQ,CAAC,EAAE,EAAA,EAAI,MAAM,CAAA;AAAA,EACrB,OAAA,EAAS,CAAC,EAAE,EAAA,EAAI,OAAO,CAAA;AAAA,EACvB,WAAA,EAAa,kBAAA;AAAA,EACb,WAAA,EAAa,4BAAA;AAAA,EACb,YAAA,EAAc;AAAA,IACZ;AAAA,MACE,MAAA,EAAQ,MAAA;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"]}
1
+ {"version":3,"sources":["../src/service.ts","../src/kinds/playlist-item-insert.ts","../src/index.ts"],"names":[],"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,EAAS,iBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,qBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,aAAA;AAAA,IACP,OAAA,EAAS,cAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,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IACR,MAAA,EAAQ,QAAA;AAAA,IACR,aAAA,EAAe;AAAA;AAEnB;AAEO,IAAM,uBAAA,GAA8C,oBAAoB,0BAAA,EAA4B;AAAA,EACzG,IAAA,EAAM,0BAAA;AAAA,EACN,OAAA,EAAS,CAAC,uBAAuB,CAAA;AAAA,EACjC,KAAA,EAAO,uBAAA;AAAA,EACP,WAAA,EAAa,oCAAA;AAAA,EACb,MAAA,EAAQ,CAAC,EAAE,EAAA,EAAI,MAAM,CAAA;AAAA,EACrB,OAAA,EAAS,CAAC,EAAE,EAAA,EAAI,OAAO,CAAA;AAAA,EACvB,WAAA,EAAa,kBAAA;AAAA,EACb,WAAA,EAAa,4BAAA;AAAA,EACb,YAAA,EAAc;AAAA,IACZ;AAAA,MACE,MAAA,EAAQ,MAAA;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 *\n * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may\n * safely be retried and may run concurrently. That is stated rather than\n * assumed because the opposite — a provider that spends the token and revokes\n * the grant on a replay — looks identical until it happens.\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 \"refreshTokenRotates\": false,\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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@particle-academy/youtube-ui",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
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
5
  "repository": {
6
6
  "type": "git",