@particle-academy/google-drive-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 +24 -0
- package/LICENSE +21 -0
- package/README.md +51 -0
- package/dist/index.cjs +129 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +129 -0
- package/dist/index.d.ts +129 -0
- package/dist/index.js +117 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@particle-academy/google-drive-ui`,
|
|
4
|
+
`@particle-academy/google-drive-js`, `particle-academy/google-drive-php` and
|
|
5
|
+
`fancy-google-drive`.
|
|
6
|
+
|
|
7
|
+
## [0.1.0] — 2026-08-23
|
|
8
|
+
|
|
9
|
+
First release.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `folder_create` — create a metadata-only Google Drive folder with a name and
|
|
14
|
+
optional parent folder id. `POST /drive/v3/files`.
|
|
15
|
+
- A top-level `File` faker for development without touching a real Drive.
|
|
16
|
+
|
|
17
|
+
### Narrow access, honest replay behavior
|
|
18
|
+
|
|
19
|
+
The connector requests `drive.file`, the narrowest scope accepted by
|
|
20
|
+
`files.create`. It can manage files this app creates, not arbitrary pre-existing
|
|
21
|
+
Drive files. Google has no Drive sandbox and exposes no idempotency key, so live
|
|
22
|
+
tests create real folders and retries can create duplicates.
|
|
23
|
+
|
|
24
|
+
[0.1.0]: https://github.com/Fancy-Friends/google-drive/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
|
+
# Google Drive
|
|
2
|
+
|
|
3
|
+
Google Drive 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/google-drive-ui` | `npm install @particle-academy/google-drive-ui` |
|
|
12
|
+
| Node | `@particle-academy/google-drive-js` | `npm install @particle-academy/google-drive-js` |
|
|
13
|
+
| PHP 8.4+ | `particle-academy/google-drive-php` | `composer require particle-academy/google-drive-php` |
|
|
14
|
+
| Python 3.11+ | `fancy-google-drive` | `pip install fancy-google-drive` |
|
|
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 Google Drive 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 Google Drive has a sandbox. Set a
|
|
33
|
+
node's mode to `fake` and it returns the shape Google Drive 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/google-drive`; 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,129 @@
|
|
|
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 GOOGLE_DRIVE_SERVICE = {
|
|
8
|
+
service: "google_drive",
|
|
9
|
+
serviceTitle: "Google Drive",
|
|
10
|
+
domain: "productivity",
|
|
11
|
+
sandbox: "none"
|
|
12
|
+
};
|
|
13
|
+
var GOOGLE_DRIVE_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 Google account; expires after one hour."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"key": "refreshToken",
|
|
37
|
+
"label": "Refresh token",
|
|
38
|
+
"scope": "account",
|
|
39
|
+
"secret": true,
|
|
40
|
+
"help": "Per connected Google account; the host uses it to refresh the access token."
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
var GOOGLE_DRIVE_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/drive.file"
|
|
49
|
+
],
|
|
50
|
+
"accessTokenCredential": "accessToken",
|
|
51
|
+
"refreshTokenCredential": "refreshToken",
|
|
52
|
+
"accessTokenTtlSeconds": 3600
|
|
53
|
+
};
|
|
54
|
+
function googleDriveMeta(role, operation, docs) {
|
|
55
|
+
return { ...GOOGLE_DRIVE_SERVICE, role, operation, docs };
|
|
56
|
+
}
|
|
57
|
+
var GOOGLE_DRIVE_FOLDER_KIND = "@particle-academy/google_drive_folder";
|
|
58
|
+
var GOOGLE_DRIVE_FOLDER_OPERATION = "folder_create";
|
|
59
|
+
var GOOGLE_DRIVE_FOLDER_META = googleDriveMeta("action", "create a folder", "https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create");
|
|
60
|
+
var GOOGLE_DRIVE_FOLDER_OUTPUT = [
|
|
61
|
+
{
|
|
62
|
+
"path": "data.id",
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "The created folder's id."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"path": "data.name",
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "The folder name Google stored."
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "data.mimeType",
|
|
73
|
+
"type": "string",
|
|
74
|
+
"description": "The fixed Google Drive folder MIME type."
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"path": "data.parents",
|
|
78
|
+
"type": "array",
|
|
79
|
+
"description": "The parent folder id array returned by Drive."
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
var googleDriveFolderKind = connectors.defineConnectorKind(GOOGLE_DRIVE_FOLDER_META, {
|
|
83
|
+
name: GOOGLE_DRIVE_FOLDER_KIND,
|
|
84
|
+
aliases: ["google_drive_folder"],
|
|
85
|
+
label: "Google Drive folder",
|
|
86
|
+
description: "Create a folder in Google Drive.",
|
|
87
|
+
inputs: [{ id: "in" }],
|
|
88
|
+
outputs: [{ id: "out" }],
|
|
89
|
+
sideEffects: "unsafe-to-replay",
|
|
90
|
+
outputShape: GOOGLE_DRIVE_FOLDER_OUTPUT,
|
|
91
|
+
configSchema: [
|
|
92
|
+
{
|
|
93
|
+
"type": "text",
|
|
94
|
+
"key": "name",
|
|
95
|
+
"label": "Folder name",
|
|
96
|
+
"required": true,
|
|
97
|
+
"description": "The folder name. Drive does not require names to be unique within a parent."
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"type": "text",
|
|
101
|
+
"key": "parents",
|
|
102
|
+
"label": "Parent folder IDs",
|
|
103
|
+
"description": "Parent folder ids, comma separated. Leave empty to create the folder in My Drive."
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
defaultConfig: {
|
|
107
|
+
"mode": "auto"
|
|
108
|
+
},
|
|
109
|
+
renderBody: ({ config }) => connectors.summarize(GOOGLE_DRIVE_FOLDER_META, config, "create a folder")
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// src/index.ts
|
|
113
|
+
var GOOGLE_DRIVE_KINDS = [
|
|
114
|
+
googleDriveFolderKind
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
|
|
118
|
+
exports.GOOGLE_DRIVE_CREDENTIALS = GOOGLE_DRIVE_CREDENTIALS;
|
|
119
|
+
exports.GOOGLE_DRIVE_FOLDER_KIND = GOOGLE_DRIVE_FOLDER_KIND;
|
|
120
|
+
exports.GOOGLE_DRIVE_FOLDER_META = GOOGLE_DRIVE_FOLDER_META;
|
|
121
|
+
exports.GOOGLE_DRIVE_FOLDER_OPERATION = GOOGLE_DRIVE_FOLDER_OPERATION;
|
|
122
|
+
exports.GOOGLE_DRIVE_FOLDER_OUTPUT = GOOGLE_DRIVE_FOLDER_OUTPUT;
|
|
123
|
+
exports.GOOGLE_DRIVE_KINDS = GOOGLE_DRIVE_KINDS;
|
|
124
|
+
exports.GOOGLE_DRIVE_OAUTH = GOOGLE_DRIVE_OAUTH;
|
|
125
|
+
exports.GOOGLE_DRIVE_SERVICE = GOOGLE_DRIVE_SERVICE;
|
|
126
|
+
exports.googleDriveFolderKind = googleDriveFolderKind;
|
|
127
|
+
exports.googleDriveMeta = googleDriveMeta;
|
|
128
|
+
//# sourceMappingURL=index.cjs.map
|
|
129
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/service.ts","../src/kinds/folder-create.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":"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","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 -- google_drive\n */\n\n/**\n * Google Drive's identity on the authoring surface, shared by every Google\n * Drive 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 * Google Drive has no sandbox. Every folder created in live mode is real; use\n * the faker during development and delete live test folders 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 GOOGLE_DRIVE_SERVICE = {\n service: \"google_drive\",\n serviceTitle: \"Google Drive\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a Google Drive connection holds. */\nexport const GOOGLE_DRIVE_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 Google account; expires after one hour.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account; the host uses it to refresh the access token.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Drive requires — DECLARED here, performed by the\n * 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 GOOGLE_DRIVE_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/drive.file\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Drive node's connector metadata from the operation it performs. */\nexport function googleDriveMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_DRIVE_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/folder-create.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/folder-create.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_drive\n */\n\n/**\n * Google Drive folder — Create a folder in Google Drive.\n *\n * https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create\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 { googleDriveMeta } from \"../service.js\";\n\nexport const GOOGLE_DRIVE_FOLDER_KIND = \"@particle-academy/google_drive_folder\";\nexport const GOOGLE_DRIVE_FOLDER_OPERATION = \"folder_create\";\n\nexport const GOOGLE_DRIVE_FOLDER_META = googleDriveMeta(\"action\", \"create a folder\", \"https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create\");\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 GOOGLE_DRIVE_FOLDER_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.id\",\n \"type\": \"string\",\n \"description\": \"The created folder's id.\"\n },\n {\n \"path\": \"data.name\",\n \"type\": \"string\",\n \"description\": \"The folder name Google stored.\"\n },\n {\n \"path\": \"data.mimeType\",\n \"type\": \"string\",\n \"description\": \"The fixed Google Drive folder MIME type.\"\n },\n {\n \"path\": \"data.parents\",\n \"type\": \"array\",\n \"description\": \"The parent folder id array returned by Drive.\"\n }\n];\n\nexport const googleDriveFolderKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DRIVE_FOLDER_META, {\n name: GOOGLE_DRIVE_FOLDER_KIND,\n aliases: [\"google_drive_folder\"],\n label: \"Google Drive folder\",\n description: \"Create a folder in Google Drive.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DRIVE_FOLDER_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"name\",\n \"label\": \"Folder name\",\n \"required\": true,\n \"description\": \"The folder name. Drive does not require names to be unique within a parent.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"parents\",\n \"label\": \"Parent folder IDs\",\n \"description\": \"Parent folder ids, comma separated. Leave empty to create the folder in My Drive.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DRIVE_FOLDER_META, config as Record<string, unknown>, \"create a folder\"),\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 -- google_drive\n */\n\n/**\n * Google Drive'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/folder-create.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleDriveFolderKind } from \"./kinds/folder-create.js\";\n\n/** Every Google Drive kind, for a host that registers the lot. */\nexport const GOOGLE_DRIVE_KINDS: NodeKindDefinition[] = [\n googleDriveFolderKind,\n];\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
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 -- google_drive
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Google Drive's identity on the authoring surface, shared by every Google
|
|
17
|
+
* Drive node.
|
|
18
|
+
*
|
|
19
|
+
* This file must import nothing from the js package: a PHP or Python project
|
|
20
|
+
* installs the ui package and never that one, and the import would be a
|
|
21
|
+
* dangling module the moment it did.
|
|
22
|
+
*
|
|
23
|
+
* ## The sandbox trap
|
|
24
|
+
*
|
|
25
|
+
* Google Drive has no sandbox. Every folder created in live mode is real; use
|
|
26
|
+
* the faker during development and delete live test folders afterward.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The connector API version this package was GENERATED against.
|
|
31
|
+
*
|
|
32
|
+
* A literal, never imported — an imported constant lets an upgrade rewrite the
|
|
33
|
+
* very claim it exists to detect.
|
|
34
|
+
*/
|
|
35
|
+
declare const CONNECTOR_API_VERSION = 1;
|
|
36
|
+
/** The parts of a connector's identity that belong to the SERVICE, not the node. */
|
|
37
|
+
declare const GOOGLE_DRIVE_SERVICE: {
|
|
38
|
+
readonly service: "google_drive";
|
|
39
|
+
readonly serviceTitle: "Google Drive";
|
|
40
|
+
readonly domain: "productivity";
|
|
41
|
+
readonly sandbox: "none";
|
|
42
|
+
};
|
|
43
|
+
/** The credentials a Google Drive connection holds. */
|
|
44
|
+
declare const GOOGLE_DRIVE_CREDENTIALS: readonly [{
|
|
45
|
+
readonly key: "clientId";
|
|
46
|
+
readonly label: "OAuth client ID";
|
|
47
|
+
readonly scope: "provider";
|
|
48
|
+
readonly secret: false;
|
|
49
|
+
readonly help: "From Google Cloud Console. One value for the whole installation.";
|
|
50
|
+
}, {
|
|
51
|
+
readonly key: "clientSecret";
|
|
52
|
+
readonly label: "OAuth client secret";
|
|
53
|
+
readonly scope: "provider";
|
|
54
|
+
readonly secret: true;
|
|
55
|
+
readonly help: "The client secret for the same OAuth app.";
|
|
56
|
+
}, {
|
|
57
|
+
readonly key: "accessToken";
|
|
58
|
+
readonly label: "Access token";
|
|
59
|
+
readonly scope: "account";
|
|
60
|
+
readonly secret: true;
|
|
61
|
+
readonly help: "Per connected Google account; expires after one hour.";
|
|
62
|
+
}, {
|
|
63
|
+
readonly key: "refreshToken";
|
|
64
|
+
readonly label: "Refresh token";
|
|
65
|
+
readonly scope: "account";
|
|
66
|
+
readonly secret: true;
|
|
67
|
+
readonly help: "Per connected Google account; the host uses it to refresh the access token.";
|
|
68
|
+
}];
|
|
69
|
+
/**
|
|
70
|
+
* The OAuth2 exchange Google Drive requires — DECLARED here, performed by the
|
|
71
|
+
* host.
|
|
72
|
+
*
|
|
73
|
+
* A consent screen needs a browser, a redirect URI and somewhere to persist
|
|
74
|
+
* the result, and all three belong to the host; a package that ran the dance
|
|
75
|
+
* itself would have to own a web server. So this says precisely enough for a
|
|
76
|
+
* host to do it.
|
|
77
|
+
*
|
|
78
|
+
* The access token lasts 3600 seconds. A host that never refreshes will work
|
|
79
|
+
* all afternoon and be broken by morning, which is why the lifetime is stated
|
|
80
|
+
* rather than left to be discovered.
|
|
81
|
+
*/
|
|
82
|
+
declare const GOOGLE_DRIVE_OAUTH: {
|
|
83
|
+
readonly flow: "authorization_code";
|
|
84
|
+
readonly authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth";
|
|
85
|
+
readonly tokenUrl: "https://oauth2.googleapis.com/token";
|
|
86
|
+
readonly scopes: readonly ["https://www.googleapis.com/auth/drive.file"];
|
|
87
|
+
readonly accessTokenCredential: "accessToken";
|
|
88
|
+
readonly refreshTokenCredential: "refreshToken";
|
|
89
|
+
readonly accessTokenTtlSeconds: 3600;
|
|
90
|
+
};
|
|
91
|
+
/** Build a Google Drive node's connector metadata from the operation it performs. */
|
|
92
|
+
declare function googleDriveMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
|
|
93
|
+
|
|
94
|
+
declare const GOOGLE_DRIVE_FOLDER_KIND = "@particle-academy/google_drive_folder";
|
|
95
|
+
declare const GOOGLE_DRIVE_FOLDER_OPERATION = "folder_create";
|
|
96
|
+
declare const GOOGLE_DRIVE_FOLDER_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
97
|
+
/**
|
|
98
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
99
|
+
*
|
|
100
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
101
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
102
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
103
|
+
* and hoping.
|
|
104
|
+
*/
|
|
105
|
+
declare const GOOGLE_DRIVE_FOLDER_OUTPUT: OutputField[];
|
|
106
|
+
declare const googleDriveFolderKind: NodeKindDefinition;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* GENERATED FILE — do not edit.
|
|
110
|
+
*
|
|
111
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
112
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
113
|
+
* being rejected, because it works until it silently does not. Fix
|
|
114
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
115
|
+
*
|
|
116
|
+
* npm run provider -- google_drive
|
|
117
|
+
*/
|
|
118
|
+
/**
|
|
119
|
+
* Google Drive's node kinds for fancy-flow.
|
|
120
|
+
*
|
|
121
|
+
* Install this on every host. The TypeScript executors live in the js
|
|
122
|
+
* package's `./flow` subpath; PHP and Python hosts run their own and need only
|
|
123
|
+
* this.
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
/** Every Google Drive kind, for a host that registers the lot. */
|
|
127
|
+
declare const GOOGLE_DRIVE_KINDS: NodeKindDefinition[];
|
|
128
|
+
|
|
129
|
+
export { CONNECTOR_API_VERSION, GOOGLE_DRIVE_CREDENTIALS, GOOGLE_DRIVE_FOLDER_KIND, GOOGLE_DRIVE_FOLDER_META, GOOGLE_DRIVE_FOLDER_OPERATION, GOOGLE_DRIVE_FOLDER_OUTPUT, GOOGLE_DRIVE_KINDS, GOOGLE_DRIVE_OAUTH, GOOGLE_DRIVE_SERVICE, googleDriveFolderKind, googleDriveMeta };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
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 -- google_drive
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Google Drive's identity on the authoring surface, shared by every Google
|
|
17
|
+
* Drive node.
|
|
18
|
+
*
|
|
19
|
+
* This file must import nothing from the js package: a PHP or Python project
|
|
20
|
+
* installs the ui package and never that one, and the import would be a
|
|
21
|
+
* dangling module the moment it did.
|
|
22
|
+
*
|
|
23
|
+
* ## The sandbox trap
|
|
24
|
+
*
|
|
25
|
+
* Google Drive has no sandbox. Every folder created in live mode is real; use
|
|
26
|
+
* the faker during development and delete live test folders afterward.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The connector API version this package was GENERATED against.
|
|
31
|
+
*
|
|
32
|
+
* A literal, never imported — an imported constant lets an upgrade rewrite the
|
|
33
|
+
* very claim it exists to detect.
|
|
34
|
+
*/
|
|
35
|
+
declare const CONNECTOR_API_VERSION = 1;
|
|
36
|
+
/** The parts of a connector's identity that belong to the SERVICE, not the node. */
|
|
37
|
+
declare const GOOGLE_DRIVE_SERVICE: {
|
|
38
|
+
readonly service: "google_drive";
|
|
39
|
+
readonly serviceTitle: "Google Drive";
|
|
40
|
+
readonly domain: "productivity";
|
|
41
|
+
readonly sandbox: "none";
|
|
42
|
+
};
|
|
43
|
+
/** The credentials a Google Drive connection holds. */
|
|
44
|
+
declare const GOOGLE_DRIVE_CREDENTIALS: readonly [{
|
|
45
|
+
readonly key: "clientId";
|
|
46
|
+
readonly label: "OAuth client ID";
|
|
47
|
+
readonly scope: "provider";
|
|
48
|
+
readonly secret: false;
|
|
49
|
+
readonly help: "From Google Cloud Console. One value for the whole installation.";
|
|
50
|
+
}, {
|
|
51
|
+
readonly key: "clientSecret";
|
|
52
|
+
readonly label: "OAuth client secret";
|
|
53
|
+
readonly scope: "provider";
|
|
54
|
+
readonly secret: true;
|
|
55
|
+
readonly help: "The client secret for the same OAuth app.";
|
|
56
|
+
}, {
|
|
57
|
+
readonly key: "accessToken";
|
|
58
|
+
readonly label: "Access token";
|
|
59
|
+
readonly scope: "account";
|
|
60
|
+
readonly secret: true;
|
|
61
|
+
readonly help: "Per connected Google account; expires after one hour.";
|
|
62
|
+
}, {
|
|
63
|
+
readonly key: "refreshToken";
|
|
64
|
+
readonly label: "Refresh token";
|
|
65
|
+
readonly scope: "account";
|
|
66
|
+
readonly secret: true;
|
|
67
|
+
readonly help: "Per connected Google account; the host uses it to refresh the access token.";
|
|
68
|
+
}];
|
|
69
|
+
/**
|
|
70
|
+
* The OAuth2 exchange Google Drive requires — DECLARED here, performed by the
|
|
71
|
+
* host.
|
|
72
|
+
*
|
|
73
|
+
* A consent screen needs a browser, a redirect URI and somewhere to persist
|
|
74
|
+
* the result, and all three belong to the host; a package that ran the dance
|
|
75
|
+
* itself would have to own a web server. So this says precisely enough for a
|
|
76
|
+
* host to do it.
|
|
77
|
+
*
|
|
78
|
+
* The access token lasts 3600 seconds. A host that never refreshes will work
|
|
79
|
+
* all afternoon and be broken by morning, which is why the lifetime is stated
|
|
80
|
+
* rather than left to be discovered.
|
|
81
|
+
*/
|
|
82
|
+
declare const GOOGLE_DRIVE_OAUTH: {
|
|
83
|
+
readonly flow: "authorization_code";
|
|
84
|
+
readonly authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth";
|
|
85
|
+
readonly tokenUrl: "https://oauth2.googleapis.com/token";
|
|
86
|
+
readonly scopes: readonly ["https://www.googleapis.com/auth/drive.file"];
|
|
87
|
+
readonly accessTokenCredential: "accessToken";
|
|
88
|
+
readonly refreshTokenCredential: "refreshToken";
|
|
89
|
+
readonly accessTokenTtlSeconds: 3600;
|
|
90
|
+
};
|
|
91
|
+
/** Build a Google Drive node's connector metadata from the operation it performs. */
|
|
92
|
+
declare function googleDriveMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
|
|
93
|
+
|
|
94
|
+
declare const GOOGLE_DRIVE_FOLDER_KIND = "@particle-academy/google_drive_folder";
|
|
95
|
+
declare const GOOGLE_DRIVE_FOLDER_OPERATION = "folder_create";
|
|
96
|
+
declare const GOOGLE_DRIVE_FOLDER_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
97
|
+
/**
|
|
98
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
99
|
+
*
|
|
100
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
101
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
102
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
103
|
+
* and hoping.
|
|
104
|
+
*/
|
|
105
|
+
declare const GOOGLE_DRIVE_FOLDER_OUTPUT: OutputField[];
|
|
106
|
+
declare const googleDriveFolderKind: NodeKindDefinition;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* GENERATED FILE — do not edit.
|
|
110
|
+
*
|
|
111
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
112
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
113
|
+
* being rejected, because it works until it silently does not. Fix
|
|
114
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
115
|
+
*
|
|
116
|
+
* npm run provider -- google_drive
|
|
117
|
+
*/
|
|
118
|
+
/**
|
|
119
|
+
* Google Drive's node kinds for fancy-flow.
|
|
120
|
+
*
|
|
121
|
+
* Install this on every host. The TypeScript executors live in the js
|
|
122
|
+
* package's `./flow` subpath; PHP and Python hosts run their own and need only
|
|
123
|
+
* this.
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
/** Every Google Drive kind, for a host that registers the lot. */
|
|
127
|
+
declare const GOOGLE_DRIVE_KINDS: NodeKindDefinition[];
|
|
128
|
+
|
|
129
|
+
export { CONNECTOR_API_VERSION, GOOGLE_DRIVE_CREDENTIALS, GOOGLE_DRIVE_FOLDER_KIND, GOOGLE_DRIVE_FOLDER_META, GOOGLE_DRIVE_FOLDER_OPERATION, GOOGLE_DRIVE_FOLDER_OUTPUT, GOOGLE_DRIVE_KINDS, GOOGLE_DRIVE_OAUTH, GOOGLE_DRIVE_SERVICE, googleDriveFolderKind, googleDriveMeta };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { defineConnectorKind, summarize } from '@particle-academy/fancy-flow/connectors';
|
|
2
|
+
|
|
3
|
+
// src/service.ts
|
|
4
|
+
var CONNECTOR_API_VERSION = 1;
|
|
5
|
+
var GOOGLE_DRIVE_SERVICE = {
|
|
6
|
+
service: "google_drive",
|
|
7
|
+
serviceTitle: "Google Drive",
|
|
8
|
+
domain: "productivity",
|
|
9
|
+
sandbox: "none"
|
|
10
|
+
};
|
|
11
|
+
var GOOGLE_DRIVE_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 Google account; expires after one hour."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"key": "refreshToken",
|
|
35
|
+
"label": "Refresh token",
|
|
36
|
+
"scope": "account",
|
|
37
|
+
"secret": true,
|
|
38
|
+
"help": "Per connected Google account; the host uses it to refresh the access token."
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
var GOOGLE_DRIVE_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/drive.file"
|
|
47
|
+
],
|
|
48
|
+
"accessTokenCredential": "accessToken",
|
|
49
|
+
"refreshTokenCredential": "refreshToken",
|
|
50
|
+
"accessTokenTtlSeconds": 3600
|
|
51
|
+
};
|
|
52
|
+
function googleDriveMeta(role, operation, docs) {
|
|
53
|
+
return { ...GOOGLE_DRIVE_SERVICE, role, operation, docs };
|
|
54
|
+
}
|
|
55
|
+
var GOOGLE_DRIVE_FOLDER_KIND = "@particle-academy/google_drive_folder";
|
|
56
|
+
var GOOGLE_DRIVE_FOLDER_OPERATION = "folder_create";
|
|
57
|
+
var GOOGLE_DRIVE_FOLDER_META = googleDriveMeta("action", "create a folder", "https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create");
|
|
58
|
+
var GOOGLE_DRIVE_FOLDER_OUTPUT = [
|
|
59
|
+
{
|
|
60
|
+
"path": "data.id",
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "The created folder's id."
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"path": "data.name",
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "The folder name Google stored."
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"path": "data.mimeType",
|
|
71
|
+
"type": "string",
|
|
72
|
+
"description": "The fixed Google Drive folder MIME type."
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"path": "data.parents",
|
|
76
|
+
"type": "array",
|
|
77
|
+
"description": "The parent folder id array returned by Drive."
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
var googleDriveFolderKind = defineConnectorKind(GOOGLE_DRIVE_FOLDER_META, {
|
|
81
|
+
name: GOOGLE_DRIVE_FOLDER_KIND,
|
|
82
|
+
aliases: ["google_drive_folder"],
|
|
83
|
+
label: "Google Drive folder",
|
|
84
|
+
description: "Create a folder in Google Drive.",
|
|
85
|
+
inputs: [{ id: "in" }],
|
|
86
|
+
outputs: [{ id: "out" }],
|
|
87
|
+
sideEffects: "unsafe-to-replay",
|
|
88
|
+
outputShape: GOOGLE_DRIVE_FOLDER_OUTPUT,
|
|
89
|
+
configSchema: [
|
|
90
|
+
{
|
|
91
|
+
"type": "text",
|
|
92
|
+
"key": "name",
|
|
93
|
+
"label": "Folder name",
|
|
94
|
+
"required": true,
|
|
95
|
+
"description": "The folder name. Drive does not require names to be unique within a parent."
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"type": "text",
|
|
99
|
+
"key": "parents",
|
|
100
|
+
"label": "Parent folder IDs",
|
|
101
|
+
"description": "Parent folder ids, comma separated. Leave empty to create the folder in My Drive."
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
defaultConfig: {
|
|
105
|
+
"mode": "auto"
|
|
106
|
+
},
|
|
107
|
+
renderBody: ({ config }) => summarize(GOOGLE_DRIVE_FOLDER_META, config, "create a folder")
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// src/index.ts
|
|
111
|
+
var GOOGLE_DRIVE_KINDS = [
|
|
112
|
+
googleDriveFolderKind
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
export { CONNECTOR_API_VERSION, GOOGLE_DRIVE_CREDENTIALS, GOOGLE_DRIVE_FOLDER_KIND, GOOGLE_DRIVE_FOLDER_META, GOOGLE_DRIVE_FOLDER_OPERATION, GOOGLE_DRIVE_FOLDER_OUTPUT, GOOGLE_DRIVE_KINDS, GOOGLE_DRIVE_OAUTH, GOOGLE_DRIVE_SERVICE, googleDriveFolderKind, googleDriveMeta };
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
117
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/service.ts","../src/kinds/folder-create.ts","../src/index.ts"],"names":[],"mappings":";;;AAiCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,oBAAA,GAAuB;AAAA,EAClC,OAAA,EAAS,cAAA;AAAA,EACT,YAAA,EAAc,cAAA;AAAA,EACd,MAAA,EAAQ,cAAA;AAAA,EACR,OAAA,EAAS;AACX;AAGO,IAAM,wBAAA,GAA2B;AAAA,EACtC;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,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,eAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA;AAEZ;AAeO,IAAM,kBAAA,GAAqB;AAAA,EAChC,MAAA,EAAQ,oBAAA;AAAA,EACR,cAAA,EAAgB,8CAAA;AAAA,EAChB,UAAA,EAAY,qCAAA;AAAA,EACZ,QAAA,EAAU;AAAA,IACR;AAAA,GACF;AAAA,EACA,uBAAA,EAAyB,aAAA;AAAA,EACzB,wBAAA,EAA0B,cAAA;AAAA,EAC1B,uBAAA,EAAyB;AAC3B;AAGO,SAAS,eAAA,CACd,IAAA,EACA,SAAA,EACA,IAAA,EACe;AACf,EAAA,OAAO,EAAE,GAAG,oBAAA,EAAsB,IAAA,EAAM,WAAW,IAAA,EAAK;AAC1D;ACpFO,IAAM,wBAAA,GAA2B;AACjC,IAAM,6BAAA,GAAgC;AAEtC,IAAM,wBAAA,GAA2B,eAAA,CAAgB,QAAA,EAAU,iBAAA,EAAmB,kFAAkF;AAUhK,IAAM,0BAAA,GAA4C;AAAA,EACvD;AAAA,IACE,MAAA,EAAQ,SAAA;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,aAAA,EAAe;AAAA,GACjB;AAAA,EACA;AAAA,IACE,MAAA,EAAQ,WAAA;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,aAAA,EAAe;AAAA,GACjB;AAAA,EACA;AAAA,IACE,MAAA,EAAQ,eAAA;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,aAAA,EAAe;AAAA,GACjB;AAAA,EACA;AAAA,IACE,MAAA,EAAQ,cAAA;AAAA,IACR,MAAA,EAAQ,OAAA;AAAA,IACR,aAAA,EAAe;AAAA;AAEnB;AAEO,IAAM,qBAAA,GAA4C,oBAAoB,wBAAA,EAA0B;AAAA,EACrG,IAAA,EAAM,wBAAA;AAAA,EACN,OAAA,EAAS,CAAC,qBAAqB,CAAA;AAAA,EAC/B,KAAA,EAAO,qBAAA;AAAA,EACP,WAAA,EAAa,kCAAA;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,0BAAA;AAAA,EACb,YAAA,EAAc;AAAA,IACZ;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,MAAA;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,mBAAA;AAAA,MACT,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,wBAAA,EAA0B,QAAmC,iBAAiB;AAC5F,CAAC;;;AC9DM,IAAM,kBAAA,GAA2C;AAAA,EACtD;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 -- google_drive\n */\n\n/**\n * Google Drive's identity on the authoring surface, shared by every Google\n * Drive 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 * Google Drive has no sandbox. Every folder created in live mode is real; use\n * the faker during development and delete live test folders 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 GOOGLE_DRIVE_SERVICE = {\n service: \"google_drive\",\n serviceTitle: \"Google Drive\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a Google Drive connection holds. */\nexport const GOOGLE_DRIVE_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 Google account; expires after one hour.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account; the host uses it to refresh the access token.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Drive requires — DECLARED here, performed by the\n * 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 GOOGLE_DRIVE_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/drive.file\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Drive node's connector metadata from the operation it performs. */\nexport function googleDriveMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_DRIVE_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/folder-create.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/folder-create.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_drive\n */\n\n/**\n * Google Drive folder — Create a folder in Google Drive.\n *\n * https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create\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 { googleDriveMeta } from \"../service.js\";\n\nexport const GOOGLE_DRIVE_FOLDER_KIND = \"@particle-academy/google_drive_folder\";\nexport const GOOGLE_DRIVE_FOLDER_OPERATION = \"folder_create\";\n\nexport const GOOGLE_DRIVE_FOLDER_META = googleDriveMeta(\"action\", \"create a folder\", \"https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create\");\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 GOOGLE_DRIVE_FOLDER_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.id\",\n \"type\": \"string\",\n \"description\": \"The created folder's id.\"\n },\n {\n \"path\": \"data.name\",\n \"type\": \"string\",\n \"description\": \"The folder name Google stored.\"\n },\n {\n \"path\": \"data.mimeType\",\n \"type\": \"string\",\n \"description\": \"The fixed Google Drive folder MIME type.\"\n },\n {\n \"path\": \"data.parents\",\n \"type\": \"array\",\n \"description\": \"The parent folder id array returned by Drive.\"\n }\n];\n\nexport const googleDriveFolderKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DRIVE_FOLDER_META, {\n name: GOOGLE_DRIVE_FOLDER_KIND,\n aliases: [\"google_drive_folder\"],\n label: \"Google Drive folder\",\n description: \"Create a folder in Google Drive.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DRIVE_FOLDER_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"name\",\n \"label\": \"Folder name\",\n \"required\": true,\n \"description\": \"The folder name. Drive does not require names to be unique within a parent.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"parents\",\n \"label\": \"Parent folder IDs\",\n \"description\": \"Parent folder ids, comma separated. Leave empty to create the folder in My Drive.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DRIVE_FOLDER_META, config as Record<string, unknown>, \"create a folder\"),\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 -- google_drive\n */\n\n/**\n * Google Drive'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/folder-create.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleDriveFolderKind } from \"./kinds/folder-create.js\";\n\n/** Every Google Drive kind, for a host that registers the lot. */\nexport const GOOGLE_DRIVE_KINDS: NodeKindDefinition[] = [\n googleDriveFolderKind,\n];\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@particle-academy/google-drive-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Google Drive'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/google-drive.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/Fancy-Friends/google-drive#readme",
|
|
10
|
+
"bugs": "https://github.com/Fancy-Friends/google-drive/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
|
+
"google_drive",
|
|
56
|
+
"productivity",
|
|
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
|
+
}
|