@particle-academy/google-sheets-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 +74 -0
- package/LICENSE +21 -0
- package/README.md +51 -0
- package/dist/index.cjs +172 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +131 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +160 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@particle-academy/google-sheets-ui`,
|
|
4
|
+
`@particle-academy/google-sheets-js`, `particle-academy/google-sheets-php` and
|
|
5
|
+
`fancy-google-sheets`.
|
|
6
|
+
|
|
7
|
+
The four packages share one version, because they are generated from one
|
|
8
|
+
`provider/` definition and a version that meant something different in each
|
|
9
|
+
would be a version nobody could reason about.
|
|
10
|
+
|
|
11
|
+
## [0.1.0] — 2026-08-23
|
|
12
|
+
|
|
13
|
+
First release. Provider eight, and the first Google connector.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- `row_append` — append a row to a sheet.
|
|
18
|
+
`POST /v4/spreadsheets/{spreadsheetId}/values/{range}:append`.
|
|
19
|
+
- A faker for it, so the node runs on a canvas with no Google account.
|
|
20
|
+
|
|
21
|
+
### Config can go in the URL now
|
|
22
|
+
|
|
23
|
+
Every provider before this one sent a fixed path. Google Sheets needs **two
|
|
24
|
+
config values in the URL** and one **in the query of a POST**, so where a value
|
|
25
|
+
lands is declarable — `send.in: "path" | "query" | "body"` — and stays derived
|
|
26
|
+
when unstated.
|
|
27
|
+
|
|
28
|
+
**A path value is URL-encoded, in all three runtimes.** A range is
|
|
29
|
+
`Sheet1!A:B`; it contains `!`, and a sheet named `Q1/Q2` contains a slash.
|
|
30
|
+
Interpolated raw it changes *which URL is called*, and Google answers 404 about
|
|
31
|
+
a spreadsheet rather than about encoding — pointing at the sheet name instead of
|
|
32
|
+
at the interpolation.
|
|
33
|
+
|
|
34
|
+
The path template and the config are checked against each other, the same way a
|
|
35
|
+
GraphQL document and its variables are: a placeholder nothing fills, a field
|
|
36
|
+
naming no placeholder, and an optional path field are all refused at definition
|
|
37
|
+
time. A URL cannot have a hole in it.
|
|
38
|
+
|
|
39
|
+
### `valueInputOption` is in the QUERY, and that is not cosmetic
|
|
40
|
+
|
|
41
|
+
Sent in the body, Google **ignores it silently** and falls back to `RAW`. An
|
|
42
|
+
author who asked for `USER_ENTERED` then gets `=SUM(A1:A2)` stored as text that
|
|
43
|
+
looks like a formula and never calculates. Nothing errors.
|
|
44
|
+
|
|
45
|
+
### `values` is an array of ARRAYS
|
|
46
|
+
|
|
47
|
+
`ValueRange.values` is rows-of-cells, so a single row has to be wrapped:
|
|
48
|
+
`[["a", "b", "c"]]`. A flat array is rejected as the wrong type. That is
|
|
49
|
+
`encoding: "rows"`, and it is a different keyword from `array` by one word.
|
|
50
|
+
|
|
51
|
+
### The scope is the full `spreadsheets` one, deliberately
|
|
52
|
+
|
|
53
|
+
Not `drive.file`. `append` writes to a spreadsheet the user names by id, and
|
|
54
|
+
`drive.file` only reaches files **the app itself created** — so it would work
|
|
55
|
+
throughout testing, where the app made the sheet, and fail against the document
|
|
56
|
+
somebody actually wants to append to. Read from the discovery document's scopes
|
|
57
|
+
for this exact method.
|
|
58
|
+
|
|
59
|
+
### No sandbox, and no idempotency
|
|
60
|
+
|
|
61
|
+
`sandbox` is `none` — **checked**. Google has no test estate for Sheets: a test
|
|
62
|
+
spreadsheet is a real one in a real Drive, so every append is real.
|
|
63
|
+
|
|
64
|
+
`values.append` takes no idempotency key; the discovery document offers neither
|
|
65
|
+
a header nor a parameter for one. So it is `unsafe-to-replay` with no way to
|
|
66
|
+
make it safe, and a retried durable run appends a **second row**.
|
|
67
|
+
|
|
68
|
+
### Access tokens last one hour
|
|
69
|
+
|
|
70
|
+
Google's do. A connection that is never refreshed stops working within the day,
|
|
71
|
+
which is why `refreshToken` is required rather than optional — and Google only
|
|
72
|
+
issues one when the consent request asked for offline access.
|
|
73
|
+
|
|
74
|
+
[0.1.0]: https://github.com/Fancy-Friends/google-sheets/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 Sheets
|
|
2
|
+
|
|
3
|
+
Google Sheets 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-sheets-ui` | `npm install @particle-academy/google-sheets-ui` |
|
|
12
|
+
| Node | `@particle-academy/google-sheets-js` | `npm install @particle-academy/google-sheets-js` |
|
|
13
|
+
| PHP 8.4+ | `particle-academy/google-sheets-php` | `composer require particle-academy/google-sheets-php` |
|
|
14
|
+
| Python 3.11+ | `fancy-google-sheets` | `pip install fancy-google-sheets` |
|
|
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 Sheets 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 Sheets has a sandbox. Set a
|
|
33
|
+
node's mode to `fake` and it returns the shape Google Sheets 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-sheets`; 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,172 @@
|
|
|
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_SHEETS_SERVICE = {
|
|
8
|
+
service: "google_sheets",
|
|
9
|
+
serviceTitle: "Google Sheets",
|
|
10
|
+
domain: "productivity",
|
|
11
|
+
sandbox: "none"
|
|
12
|
+
};
|
|
13
|
+
var GOOGLE_SHEETS_CREDENTIALS = [
|
|
14
|
+
{
|
|
15
|
+
"key": "clientId",
|
|
16
|
+
"label": "OAuth client ID",
|
|
17
|
+
"scope": "provider",
|
|
18
|
+
"secret": false,
|
|
19
|
+
"help": "From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account."
|
|
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. One value for the whole installation."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"key": "accessToken",
|
|
30
|
+
"label": "Access token",
|
|
31
|
+
"scope": "account",
|
|
32
|
+
"secret": true,
|
|
33
|
+
"help": "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"key": "refreshToken",
|
|
37
|
+
"label": "Refresh token",
|
|
38
|
+
"scope": "account",
|
|
39
|
+
"secret": true,
|
|
40
|
+
"help": "Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour."
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
var GOOGLE_SHEETS_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/spreadsheets"
|
|
49
|
+
],
|
|
50
|
+
"accessTokenCredential": "accessToken",
|
|
51
|
+
"refreshTokenCredential": "refreshToken",
|
|
52
|
+
"accessTokenTtlSeconds": 3600
|
|
53
|
+
};
|
|
54
|
+
function googleSheetsMeta(role, operation, docs) {
|
|
55
|
+
return { ...GOOGLE_SHEETS_SERVICE, role, operation, docs };
|
|
56
|
+
}
|
|
57
|
+
var GOOGLE_SHEETS_ROW_KIND = "@particle-academy/google_sheets_row";
|
|
58
|
+
var GOOGLE_SHEETS_ROW_OPERATION = "row_append";
|
|
59
|
+
var GOOGLE_SHEETS_ROW_META = googleSheetsMeta("action", "append a row", "https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append");
|
|
60
|
+
var GOOGLE_SHEETS_ROW_OUTPUT = [
|
|
61
|
+
{
|
|
62
|
+
"path": "data.spreadsheetId",
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "The spreadsheet that was written to."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"path": "data.updates.updatedRange",
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "The range Google actually wrote, in A1 notation. NOT the range that was asked for -- append finds the first empty row below it."
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "data.updates.updatedRows",
|
|
73
|
+
"type": "number",
|
|
74
|
+
"description": "How many rows were added."
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"path": "data.updates.updatedCells",
|
|
78
|
+
"type": "number",
|
|
79
|
+
"description": "How many cells were written."
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
var googleSheetsRowKind = connectors.defineConnectorKind(GOOGLE_SHEETS_ROW_META, {
|
|
83
|
+
name: GOOGLE_SHEETS_ROW_KIND,
|
|
84
|
+
aliases: ["google_sheets_row"],
|
|
85
|
+
label: "Google Sheets row",
|
|
86
|
+
description: "Append a row to a Google Sheet.",
|
|
87
|
+
inputs: [{ id: "in" }],
|
|
88
|
+
outputs: [{ id: "out" }],
|
|
89
|
+
sideEffects: "unsafe-to-replay",
|
|
90
|
+
outputShape: GOOGLE_SHEETS_ROW_OUTPUT,
|
|
91
|
+
configSchema: [
|
|
92
|
+
{
|
|
93
|
+
"type": "text",
|
|
94
|
+
"key": "spreadsheetId",
|
|
95
|
+
"label": "Spreadsheet ID",
|
|
96
|
+
"required": true,
|
|
97
|
+
"description": "The long id from the sheet's URL: docs.google.com/spreadsheets/d/THIS_PART/edit."
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"type": "text",
|
|
101
|
+
"key": "range",
|
|
102
|
+
"label": "Range",
|
|
103
|
+
"required": true,
|
|
104
|
+
"default": "Sheet1!A:Z",
|
|
105
|
+
"description": "Where to append, in A1 notation. Google finds the last row of this range and writes below it."
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"type": "text",
|
|
109
|
+
"key": "values",
|
|
110
|
+
"label": "Row values",
|
|
111
|
+
"required": true,
|
|
112
|
+
"description": "The cells of the row, comma separated. Left to right from the start of the range."
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"type": "select",
|
|
116
|
+
"key": "valueInputOption",
|
|
117
|
+
"label": "How to interpret the values",
|
|
118
|
+
"default": "USER_ENTERED",
|
|
119
|
+
"description": "USER_ENTERED parses the cells the way typing them would -- so =SUM(A1:A2) becomes a formula and 1/2/26 becomes a date. RAW stores exactly the characters given.",
|
|
120
|
+
"options": [
|
|
121
|
+
{
|
|
122
|
+
"value": "USER_ENTERED",
|
|
123
|
+
"label": "As if typed (formulas and dates parsed)"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"value": "RAW",
|
|
127
|
+
"label": "Exactly as given"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"type": "select",
|
|
133
|
+
"key": "insertDataOption",
|
|
134
|
+
"label": "When the range already has data below",
|
|
135
|
+
"default": "INSERT_ROWS",
|
|
136
|
+
"description": "INSERT_ROWS pushes existing rows down. OVERWRITE writes into them.",
|
|
137
|
+
"options": [
|
|
138
|
+
{
|
|
139
|
+
"value": "INSERT_ROWS",
|
|
140
|
+
"label": "Insert new rows"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"value": "OVERWRITE",
|
|
144
|
+
"label": "Overwrite what is there"
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
defaultConfig: {
|
|
150
|
+
"mode": "auto"
|
|
151
|
+
},
|
|
152
|
+
renderBody: ({ config }) => connectors.summarize(GOOGLE_SHEETS_ROW_META, config, "append a row")
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// src/index.ts
|
|
156
|
+
var GOOGLE_SHEETS_KINDS = [
|
|
157
|
+
googleSheetsRowKind
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
|
|
161
|
+
exports.GOOGLE_SHEETS_CREDENTIALS = GOOGLE_SHEETS_CREDENTIALS;
|
|
162
|
+
exports.GOOGLE_SHEETS_KINDS = GOOGLE_SHEETS_KINDS;
|
|
163
|
+
exports.GOOGLE_SHEETS_OAUTH = GOOGLE_SHEETS_OAUTH;
|
|
164
|
+
exports.GOOGLE_SHEETS_ROW_KIND = GOOGLE_SHEETS_ROW_KIND;
|
|
165
|
+
exports.GOOGLE_SHEETS_ROW_META = GOOGLE_SHEETS_ROW_META;
|
|
166
|
+
exports.GOOGLE_SHEETS_ROW_OPERATION = GOOGLE_SHEETS_ROW_OPERATION;
|
|
167
|
+
exports.GOOGLE_SHEETS_ROW_OUTPUT = GOOGLE_SHEETS_ROW_OUTPUT;
|
|
168
|
+
exports.GOOGLE_SHEETS_SERVICE = GOOGLE_SHEETS_SERVICE;
|
|
169
|
+
exports.googleSheetsMeta = googleSheetsMeta;
|
|
170
|
+
exports.googleSheetsRowKind = googleSheetsRowKind;
|
|
171
|
+
//# sourceMappingURL=index.cjs.map
|
|
172
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/service.ts","../src/kinds/row-append.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;;;AAmCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,qBAAA,GAAwB;AAAA,EACnC,OAAA,EAAS,eAAA;AAAA,EACT,YAAA,EAAc,eAAA;AAAA,EACd,MAAA,EAAQ,cAAA;AAAA,EACR,OAAA,EAAS;AACX;AAGO,IAAM,yBAAA,GAA4B;AAAA,EACvC;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,KAA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P,OAAA,EAAS,uCAAA;AAAA,MACT,SAAA,EAAW,aAAA;AAAA,MACX,aAAA,EAAe,oEAAA;AAAA,MACf,SAAA,EAAW;AAAA,QACT;AAAA,UACE,OAAA,EAAS,aAAA;AAAA,UACT,OAAA,EAAS;AAAA,SACX;AAAA,QACA;AAAA,UACE,OAAA,EAAS,WAAA;AAAA,UACT,OAAA,EAAS;AAAA;AACX;AACF;AACF,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACbC,oBAAA,CAAU,sBAAA,EAAwB,QAAmC,cAAc;AACvF,CAAC;;;ACzGM,IAAM,mBAAA,GAA4C;AAAA,EACvD;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 -- google_sheets\n */\n\n/**\n * Google Sheets's identity on the authoring surface, shared by every Google\n * Sheets 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 has no sandbox for Sheets. A test spreadsheet is a real one in a real\n * Drive, so every append is real -- point this at a scratch sheet, not a\n * production one. The faker is the only way to develop against it without\n * touching a document.\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_SHEETS_SERVICE = {\n service: \"google_sheets\",\n serviceTitle: \"Google Sheets\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a Google Sheets connection holds. */\nexport const GOOGLE_SHEETS_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.\"\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. One value for the whole installation.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Sheets 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_SHEETS_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/spreadsheets\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Sheets node's connector metadata from the operation it performs. */\nexport function googleSheetsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_SHEETS_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/row-append.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/row-append.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets row — Append a row to a Google Sheet.\n *\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\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 { googleSheetsMeta } from \"../service.js\";\n\nexport const GOOGLE_SHEETS_ROW_KIND = \"@particle-academy/google_sheets_row\";\nexport const GOOGLE_SHEETS_ROW_OPERATION = \"row_append\";\n\nexport const GOOGLE_SHEETS_ROW_META = googleSheetsMeta(\"action\", \"append a row\", \"https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\");\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_SHEETS_ROW_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.spreadsheetId\",\n \"type\": \"string\",\n \"description\": \"The spreadsheet that was written to.\"\n },\n {\n \"path\": \"data.updates.updatedRange\",\n \"type\": \"string\",\n \"description\": \"The range Google actually wrote, in A1 notation. NOT the range that was asked for -- append finds the first empty row below it.\"\n },\n {\n \"path\": \"data.updates.updatedRows\",\n \"type\": \"number\",\n \"description\": \"How many rows were added.\"\n },\n {\n \"path\": \"data.updates.updatedCells\",\n \"type\": \"number\",\n \"description\": \"How many cells were written.\"\n }\n];\n\nexport const googleSheetsRowKind: NodeKindDefinition = defineConnectorKind(GOOGLE_SHEETS_ROW_META, {\n name: GOOGLE_SHEETS_ROW_KIND,\n aliases: [\"google_sheets_row\"],\n label: \"Google Sheets row\",\n description: \"Append a row to a Google Sheet.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_SHEETS_ROW_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"spreadsheetId\",\n \"label\": \"Spreadsheet ID\",\n \"required\": true,\n \"description\": \"The long id from the sheet's URL: docs.google.com/spreadsheets/d/THIS_PART/edit.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"range\",\n \"label\": \"Range\",\n \"required\": true,\n \"default\": \"Sheet1!A:Z\",\n \"description\": \"Where to append, in A1 notation. Google finds the last row of this range and writes below it.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"values\",\n \"label\": \"Row values\",\n \"required\": true,\n \"description\": \"The cells of the row, comma separated. Left to right from the start of the range.\"\n },\n {\n \"type\": \"select\",\n \"key\": \"valueInputOption\",\n \"label\": \"How to interpret the values\",\n \"default\": \"USER_ENTERED\",\n \"description\": \"USER_ENTERED parses the cells the way typing them would -- so =SUM(A1:A2) becomes a formula and 1/2/26 becomes a date. RAW stores exactly the characters given.\",\n \"options\": [\n {\n \"value\": \"USER_ENTERED\",\n \"label\": \"As if typed (formulas and dates parsed)\"\n },\n {\n \"value\": \"RAW\",\n \"label\": \"Exactly as given\"\n }\n ]\n },\n {\n \"type\": \"select\",\n \"key\": \"insertDataOption\",\n \"label\": \"When the range already has data below\",\n \"default\": \"INSERT_ROWS\",\n \"description\": \"INSERT_ROWS pushes existing rows down. OVERWRITE writes into them.\",\n \"options\": [\n {\n \"value\": \"INSERT_ROWS\",\n \"label\": \"Insert new rows\"\n },\n {\n \"value\": \"OVERWRITE\",\n \"label\": \"Overwrite what is there\"\n }\n ]\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_SHEETS_ROW_META, config as Record<string, unknown>, \"append a row\"),\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_sheets\n */\n\n/**\n * Google Sheets'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/row-append.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleSheetsRowKind } from \"./kinds/row-append.js\";\n\n/** Every Google Sheets kind, for a host that registers the lot. */\nexport const GOOGLE_SHEETS_KINDS: NodeKindDefinition[] = [\n googleSheetsRowKind,\n];\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
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_sheets
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Google Sheets's identity on the authoring surface, shared by every Google
|
|
17
|
+
* Sheets 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 has no sandbox for Sheets. A test spreadsheet is a real one in a real
|
|
26
|
+
* Drive, so every append is real -- point this at a scratch sheet, not a
|
|
27
|
+
* production one. The faker is the only way to develop against it without
|
|
28
|
+
* touching a document.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The connector API version this package was GENERATED against.
|
|
33
|
+
*
|
|
34
|
+
* A literal, never imported — an imported constant lets an upgrade rewrite the
|
|
35
|
+
* very claim it exists to detect.
|
|
36
|
+
*/
|
|
37
|
+
declare const CONNECTOR_API_VERSION = 1;
|
|
38
|
+
/** The parts of a connector's identity that belong to the SERVICE, not the node. */
|
|
39
|
+
declare const GOOGLE_SHEETS_SERVICE: {
|
|
40
|
+
readonly service: "google_sheets";
|
|
41
|
+
readonly serviceTitle: "Google Sheets";
|
|
42
|
+
readonly domain: "productivity";
|
|
43
|
+
readonly sandbox: "none";
|
|
44
|
+
};
|
|
45
|
+
/** The credentials a Google Sheets connection holds. */
|
|
46
|
+
declare const GOOGLE_SHEETS_CREDENTIALS: readonly [{
|
|
47
|
+
readonly key: "clientId";
|
|
48
|
+
readonly label: "OAuth client ID";
|
|
49
|
+
readonly scope: "provider";
|
|
50
|
+
readonly secret: false;
|
|
51
|
+
readonly help: "From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.";
|
|
52
|
+
}, {
|
|
53
|
+
readonly key: "clientSecret";
|
|
54
|
+
readonly label: "OAuth client secret";
|
|
55
|
+
readonly scope: "provider";
|
|
56
|
+
readonly secret: true;
|
|
57
|
+
readonly help: "The client secret for the same OAuth app. One value for the whole installation.";
|
|
58
|
+
}, {
|
|
59
|
+
readonly key: "accessToken";
|
|
60
|
+
readonly label: "Access token";
|
|
61
|
+
readonly scope: "account";
|
|
62
|
+
readonly secret: true;
|
|
63
|
+
readonly help: "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.";
|
|
64
|
+
}, {
|
|
65
|
+
readonly key: "refreshToken";
|
|
66
|
+
readonly label: "Refresh token";
|
|
67
|
+
readonly scope: "account";
|
|
68
|
+
readonly secret: true;
|
|
69
|
+
readonly help: "Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour.";
|
|
70
|
+
}];
|
|
71
|
+
/**
|
|
72
|
+
* The OAuth2 exchange Google Sheets requires — DECLARED here, performed by the
|
|
73
|
+
* host.
|
|
74
|
+
*
|
|
75
|
+
* A consent screen needs a browser, a redirect URI and somewhere to persist
|
|
76
|
+
* the result, and all three belong to the host; a package that ran the dance
|
|
77
|
+
* itself would have to own a web server. So this says precisely enough for a
|
|
78
|
+
* host to do it.
|
|
79
|
+
*
|
|
80
|
+
* The access token lasts 3600 seconds. A host that never refreshes will work
|
|
81
|
+
* all afternoon and be broken by morning, which is why the lifetime is stated
|
|
82
|
+
* rather than left to be discovered.
|
|
83
|
+
*/
|
|
84
|
+
declare const GOOGLE_SHEETS_OAUTH: {
|
|
85
|
+
readonly flow: "authorization_code";
|
|
86
|
+
readonly authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth";
|
|
87
|
+
readonly tokenUrl: "https://oauth2.googleapis.com/token";
|
|
88
|
+
readonly scopes: readonly ["https://www.googleapis.com/auth/spreadsheets"];
|
|
89
|
+
readonly accessTokenCredential: "accessToken";
|
|
90
|
+
readonly refreshTokenCredential: "refreshToken";
|
|
91
|
+
readonly accessTokenTtlSeconds: 3600;
|
|
92
|
+
};
|
|
93
|
+
/** Build a Google Sheets node's connector metadata from the operation it performs. */
|
|
94
|
+
declare function googleSheetsMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
|
|
95
|
+
|
|
96
|
+
declare const GOOGLE_SHEETS_ROW_KIND = "@particle-academy/google_sheets_row";
|
|
97
|
+
declare const GOOGLE_SHEETS_ROW_OPERATION = "row_append";
|
|
98
|
+
declare const GOOGLE_SHEETS_ROW_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
99
|
+
/**
|
|
100
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
101
|
+
*
|
|
102
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
103
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
104
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
105
|
+
* and hoping.
|
|
106
|
+
*/
|
|
107
|
+
declare const GOOGLE_SHEETS_ROW_OUTPUT: OutputField[];
|
|
108
|
+
declare const googleSheetsRowKind: NodeKindDefinition;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* GENERATED FILE — do not edit.
|
|
112
|
+
*
|
|
113
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
114
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
115
|
+
* being rejected, because it works until it silently does not. Fix
|
|
116
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
117
|
+
*
|
|
118
|
+
* npm run provider -- google_sheets
|
|
119
|
+
*/
|
|
120
|
+
/**
|
|
121
|
+
* Google Sheets's node kinds for fancy-flow.
|
|
122
|
+
*
|
|
123
|
+
* Install this on every host. The TypeScript executors live in the js
|
|
124
|
+
* package's `./flow` subpath; PHP and Python hosts run their own and need only
|
|
125
|
+
* this.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/** Every Google Sheets kind, for a host that registers the lot. */
|
|
129
|
+
declare const GOOGLE_SHEETS_KINDS: NodeKindDefinition[];
|
|
130
|
+
|
|
131
|
+
export { CONNECTOR_API_VERSION, GOOGLE_SHEETS_CREDENTIALS, GOOGLE_SHEETS_KINDS, GOOGLE_SHEETS_OAUTH, GOOGLE_SHEETS_ROW_KIND, GOOGLE_SHEETS_ROW_META, GOOGLE_SHEETS_ROW_OPERATION, GOOGLE_SHEETS_ROW_OUTPUT, GOOGLE_SHEETS_SERVICE, googleSheetsMeta, googleSheetsRowKind };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
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_sheets
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Google Sheets's identity on the authoring surface, shared by every Google
|
|
17
|
+
* Sheets 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 has no sandbox for Sheets. A test spreadsheet is a real one in a real
|
|
26
|
+
* Drive, so every append is real -- point this at a scratch sheet, not a
|
|
27
|
+
* production one. The faker is the only way to develop against it without
|
|
28
|
+
* touching a document.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The connector API version this package was GENERATED against.
|
|
33
|
+
*
|
|
34
|
+
* A literal, never imported — an imported constant lets an upgrade rewrite the
|
|
35
|
+
* very claim it exists to detect.
|
|
36
|
+
*/
|
|
37
|
+
declare const CONNECTOR_API_VERSION = 1;
|
|
38
|
+
/** The parts of a connector's identity that belong to the SERVICE, not the node. */
|
|
39
|
+
declare const GOOGLE_SHEETS_SERVICE: {
|
|
40
|
+
readonly service: "google_sheets";
|
|
41
|
+
readonly serviceTitle: "Google Sheets";
|
|
42
|
+
readonly domain: "productivity";
|
|
43
|
+
readonly sandbox: "none";
|
|
44
|
+
};
|
|
45
|
+
/** The credentials a Google Sheets connection holds. */
|
|
46
|
+
declare const GOOGLE_SHEETS_CREDENTIALS: readonly [{
|
|
47
|
+
readonly key: "clientId";
|
|
48
|
+
readonly label: "OAuth client ID";
|
|
49
|
+
readonly scope: "provider";
|
|
50
|
+
readonly secret: false;
|
|
51
|
+
readonly help: "From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.";
|
|
52
|
+
}, {
|
|
53
|
+
readonly key: "clientSecret";
|
|
54
|
+
readonly label: "OAuth client secret";
|
|
55
|
+
readonly scope: "provider";
|
|
56
|
+
readonly secret: true;
|
|
57
|
+
readonly help: "The client secret for the same OAuth app. One value for the whole installation.";
|
|
58
|
+
}, {
|
|
59
|
+
readonly key: "accessToken";
|
|
60
|
+
readonly label: "Access token";
|
|
61
|
+
readonly scope: "account";
|
|
62
|
+
readonly secret: true;
|
|
63
|
+
readonly help: "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.";
|
|
64
|
+
}, {
|
|
65
|
+
readonly key: "refreshToken";
|
|
66
|
+
readonly label: "Refresh token";
|
|
67
|
+
readonly scope: "account";
|
|
68
|
+
readonly secret: true;
|
|
69
|
+
readonly help: "Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour.";
|
|
70
|
+
}];
|
|
71
|
+
/**
|
|
72
|
+
* The OAuth2 exchange Google Sheets requires — DECLARED here, performed by the
|
|
73
|
+
* host.
|
|
74
|
+
*
|
|
75
|
+
* A consent screen needs a browser, a redirect URI and somewhere to persist
|
|
76
|
+
* the result, and all three belong to the host; a package that ran the dance
|
|
77
|
+
* itself would have to own a web server. So this says precisely enough for a
|
|
78
|
+
* host to do it.
|
|
79
|
+
*
|
|
80
|
+
* The access token lasts 3600 seconds. A host that never refreshes will work
|
|
81
|
+
* all afternoon and be broken by morning, which is why the lifetime is stated
|
|
82
|
+
* rather than left to be discovered.
|
|
83
|
+
*/
|
|
84
|
+
declare const GOOGLE_SHEETS_OAUTH: {
|
|
85
|
+
readonly flow: "authorization_code";
|
|
86
|
+
readonly authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth";
|
|
87
|
+
readonly tokenUrl: "https://oauth2.googleapis.com/token";
|
|
88
|
+
readonly scopes: readonly ["https://www.googleapis.com/auth/spreadsheets"];
|
|
89
|
+
readonly accessTokenCredential: "accessToken";
|
|
90
|
+
readonly refreshTokenCredential: "refreshToken";
|
|
91
|
+
readonly accessTokenTtlSeconds: 3600;
|
|
92
|
+
};
|
|
93
|
+
/** Build a Google Sheets node's connector metadata from the operation it performs. */
|
|
94
|
+
declare function googleSheetsMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
|
|
95
|
+
|
|
96
|
+
declare const GOOGLE_SHEETS_ROW_KIND = "@particle-academy/google_sheets_row";
|
|
97
|
+
declare const GOOGLE_SHEETS_ROW_OPERATION = "row_append";
|
|
98
|
+
declare const GOOGLE_SHEETS_ROW_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
99
|
+
/**
|
|
100
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
101
|
+
*
|
|
102
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
103
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
104
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
105
|
+
* and hoping.
|
|
106
|
+
*/
|
|
107
|
+
declare const GOOGLE_SHEETS_ROW_OUTPUT: OutputField[];
|
|
108
|
+
declare const googleSheetsRowKind: NodeKindDefinition;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* GENERATED FILE — do not edit.
|
|
112
|
+
*
|
|
113
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
114
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
115
|
+
* being rejected, because it works until it silently does not. Fix
|
|
116
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
117
|
+
*
|
|
118
|
+
* npm run provider -- google_sheets
|
|
119
|
+
*/
|
|
120
|
+
/**
|
|
121
|
+
* Google Sheets's node kinds for fancy-flow.
|
|
122
|
+
*
|
|
123
|
+
* Install this on every host. The TypeScript executors live in the js
|
|
124
|
+
* package's `./flow` subpath; PHP and Python hosts run their own and need only
|
|
125
|
+
* this.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/** Every Google Sheets kind, for a host that registers the lot. */
|
|
129
|
+
declare const GOOGLE_SHEETS_KINDS: NodeKindDefinition[];
|
|
130
|
+
|
|
131
|
+
export { CONNECTOR_API_VERSION, GOOGLE_SHEETS_CREDENTIALS, GOOGLE_SHEETS_KINDS, GOOGLE_SHEETS_OAUTH, GOOGLE_SHEETS_ROW_KIND, GOOGLE_SHEETS_ROW_META, GOOGLE_SHEETS_ROW_OPERATION, GOOGLE_SHEETS_ROW_OUTPUT, GOOGLE_SHEETS_SERVICE, googleSheetsMeta, googleSheetsRowKind };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { defineConnectorKind, summarize } from '@particle-academy/fancy-flow/connectors';
|
|
2
|
+
|
|
3
|
+
// src/service.ts
|
|
4
|
+
var CONNECTOR_API_VERSION = 1;
|
|
5
|
+
var GOOGLE_SHEETS_SERVICE = {
|
|
6
|
+
service: "google_sheets",
|
|
7
|
+
serviceTitle: "Google Sheets",
|
|
8
|
+
domain: "productivity",
|
|
9
|
+
sandbox: "none"
|
|
10
|
+
};
|
|
11
|
+
var GOOGLE_SHEETS_CREDENTIALS = [
|
|
12
|
+
{
|
|
13
|
+
"key": "clientId",
|
|
14
|
+
"label": "OAuth client ID",
|
|
15
|
+
"scope": "provider",
|
|
16
|
+
"secret": false,
|
|
17
|
+
"help": "From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account."
|
|
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. One value for the whole installation."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"key": "accessToken",
|
|
28
|
+
"label": "Access token",
|
|
29
|
+
"scope": "account",
|
|
30
|
+
"secret": true,
|
|
31
|
+
"help": "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"key": "refreshToken",
|
|
35
|
+
"label": "Refresh token",
|
|
36
|
+
"scope": "account",
|
|
37
|
+
"secret": true,
|
|
38
|
+
"help": "Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour."
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
var GOOGLE_SHEETS_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/spreadsheets"
|
|
47
|
+
],
|
|
48
|
+
"accessTokenCredential": "accessToken",
|
|
49
|
+
"refreshTokenCredential": "refreshToken",
|
|
50
|
+
"accessTokenTtlSeconds": 3600
|
|
51
|
+
};
|
|
52
|
+
function googleSheetsMeta(role, operation, docs) {
|
|
53
|
+
return { ...GOOGLE_SHEETS_SERVICE, role, operation, docs };
|
|
54
|
+
}
|
|
55
|
+
var GOOGLE_SHEETS_ROW_KIND = "@particle-academy/google_sheets_row";
|
|
56
|
+
var GOOGLE_SHEETS_ROW_OPERATION = "row_append";
|
|
57
|
+
var GOOGLE_SHEETS_ROW_META = googleSheetsMeta("action", "append a row", "https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append");
|
|
58
|
+
var GOOGLE_SHEETS_ROW_OUTPUT = [
|
|
59
|
+
{
|
|
60
|
+
"path": "data.spreadsheetId",
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "The spreadsheet that was written to."
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"path": "data.updates.updatedRange",
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "The range Google actually wrote, in A1 notation. NOT the range that was asked for -- append finds the first empty row below it."
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"path": "data.updates.updatedRows",
|
|
71
|
+
"type": "number",
|
|
72
|
+
"description": "How many rows were added."
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"path": "data.updates.updatedCells",
|
|
76
|
+
"type": "number",
|
|
77
|
+
"description": "How many cells were written."
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
var googleSheetsRowKind = defineConnectorKind(GOOGLE_SHEETS_ROW_META, {
|
|
81
|
+
name: GOOGLE_SHEETS_ROW_KIND,
|
|
82
|
+
aliases: ["google_sheets_row"],
|
|
83
|
+
label: "Google Sheets row",
|
|
84
|
+
description: "Append a row to a Google Sheet.",
|
|
85
|
+
inputs: [{ id: "in" }],
|
|
86
|
+
outputs: [{ id: "out" }],
|
|
87
|
+
sideEffects: "unsafe-to-replay",
|
|
88
|
+
outputShape: GOOGLE_SHEETS_ROW_OUTPUT,
|
|
89
|
+
configSchema: [
|
|
90
|
+
{
|
|
91
|
+
"type": "text",
|
|
92
|
+
"key": "spreadsheetId",
|
|
93
|
+
"label": "Spreadsheet ID",
|
|
94
|
+
"required": true,
|
|
95
|
+
"description": "The long id from the sheet's URL: docs.google.com/spreadsheets/d/THIS_PART/edit."
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"type": "text",
|
|
99
|
+
"key": "range",
|
|
100
|
+
"label": "Range",
|
|
101
|
+
"required": true,
|
|
102
|
+
"default": "Sheet1!A:Z",
|
|
103
|
+
"description": "Where to append, in A1 notation. Google finds the last row of this range and writes below it."
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"type": "text",
|
|
107
|
+
"key": "values",
|
|
108
|
+
"label": "Row values",
|
|
109
|
+
"required": true,
|
|
110
|
+
"description": "The cells of the row, comma separated. Left to right from the start of the range."
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"type": "select",
|
|
114
|
+
"key": "valueInputOption",
|
|
115
|
+
"label": "How to interpret the values",
|
|
116
|
+
"default": "USER_ENTERED",
|
|
117
|
+
"description": "USER_ENTERED parses the cells the way typing them would -- so =SUM(A1:A2) becomes a formula and 1/2/26 becomes a date. RAW stores exactly the characters given.",
|
|
118
|
+
"options": [
|
|
119
|
+
{
|
|
120
|
+
"value": "USER_ENTERED",
|
|
121
|
+
"label": "As if typed (formulas and dates parsed)"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"value": "RAW",
|
|
125
|
+
"label": "Exactly as given"
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"type": "select",
|
|
131
|
+
"key": "insertDataOption",
|
|
132
|
+
"label": "When the range already has data below",
|
|
133
|
+
"default": "INSERT_ROWS",
|
|
134
|
+
"description": "INSERT_ROWS pushes existing rows down. OVERWRITE writes into them.",
|
|
135
|
+
"options": [
|
|
136
|
+
{
|
|
137
|
+
"value": "INSERT_ROWS",
|
|
138
|
+
"label": "Insert new rows"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"value": "OVERWRITE",
|
|
142
|
+
"label": "Overwrite what is there"
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
defaultConfig: {
|
|
148
|
+
"mode": "auto"
|
|
149
|
+
},
|
|
150
|
+
renderBody: ({ config }) => summarize(GOOGLE_SHEETS_ROW_META, config, "append a row")
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// src/index.ts
|
|
154
|
+
var GOOGLE_SHEETS_KINDS = [
|
|
155
|
+
googleSheetsRowKind
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
export { CONNECTOR_API_VERSION, GOOGLE_SHEETS_CREDENTIALS, GOOGLE_SHEETS_KINDS, GOOGLE_SHEETS_OAUTH, GOOGLE_SHEETS_ROW_KIND, GOOGLE_SHEETS_ROW_META, GOOGLE_SHEETS_ROW_OPERATION, GOOGLE_SHEETS_ROW_OUTPUT, GOOGLE_SHEETS_SERVICE, googleSheetsMeta, googleSheetsRowKind };
|
|
159
|
+
//# sourceMappingURL=index.js.map
|
|
160
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/service.ts","../src/kinds/row-append.ts","../src/index.ts"],"names":[],"mappings":";;;AAmCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,qBAAA,GAAwB;AAAA,EACnC,OAAA,EAAS,eAAA;AAAA,EACT,YAAA,EAAc,eAAA;AAAA,EACd,MAAA,EAAQ,cAAA;AAAA,EACR,OAAA,EAAS;AACX;AAGO,IAAM,yBAAA,GAA4B;AAAA,EACvC;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,E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AA,EAAS,uCAAA;AAAA,MACT,SAAA,EAAW,aAAA;AAAA,MACX,aAAA,EAAe,oEAAA;AAAA,MACf,SAAA,EAAW;AAAA,QACT;AAAA,UACE,OAAA,EAAS,aAAA;AAAA,UACT,OAAA,EAAS;AAAA,SACX;AAAA,QACA;AAAA,UACE,OAAA,EAAS,WAAA;AAAA,UACT,OAAA,EAAS;AAAA;AACX;AACF;AACF,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACb,SAAA,CAAU,sBAAA,EAAwB,QAAmC,cAAc;AACvF,CAAC;;;ACzGM,IAAM,mBAAA,GAA4C;AAAA,EACvD;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_sheets\n */\n\n/**\n * Google Sheets's identity on the authoring surface, shared by every Google\n * Sheets 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 has no sandbox for Sheets. A test spreadsheet is a real one in a real\n * Drive, so every append is real -- point this at a scratch sheet, not a\n * production one. The faker is the only way to develop against it without\n * touching a document.\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_SHEETS_SERVICE = {\n service: \"google_sheets\",\n serviceTitle: \"Google Sheets\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a Google Sheets connection holds. */\nexport const GOOGLE_SHEETS_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.\"\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. One value for the whole installation.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Sheets 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_SHEETS_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/spreadsheets\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Sheets node's connector metadata from the operation it performs. */\nexport function googleSheetsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_SHEETS_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/row-append.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/row-append.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets row — Append a row to a Google Sheet.\n *\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\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 { googleSheetsMeta } from \"../service.js\";\n\nexport const GOOGLE_SHEETS_ROW_KIND = \"@particle-academy/google_sheets_row\";\nexport const GOOGLE_SHEETS_ROW_OPERATION = \"row_append\";\n\nexport const GOOGLE_SHEETS_ROW_META = googleSheetsMeta(\"action\", \"append a row\", \"https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\");\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_SHEETS_ROW_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.spreadsheetId\",\n \"type\": \"string\",\n \"description\": \"The spreadsheet that was written to.\"\n },\n {\n \"path\": \"data.updates.updatedRange\",\n \"type\": \"string\",\n \"description\": \"The range Google actually wrote, in A1 notation. NOT the range that was asked for -- append finds the first empty row below it.\"\n },\n {\n \"path\": \"data.updates.updatedRows\",\n \"type\": \"number\",\n \"description\": \"How many rows were added.\"\n },\n {\n \"path\": \"data.updates.updatedCells\",\n \"type\": \"number\",\n \"description\": \"How many cells were written.\"\n }\n];\n\nexport const googleSheetsRowKind: NodeKindDefinition = defineConnectorKind(GOOGLE_SHEETS_ROW_META, {\n name: GOOGLE_SHEETS_ROW_KIND,\n aliases: [\"google_sheets_row\"],\n label: \"Google Sheets row\",\n description: \"Append a row to a Google Sheet.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_SHEETS_ROW_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"spreadsheetId\",\n \"label\": \"Spreadsheet ID\",\n \"required\": true,\n \"description\": \"The long id from the sheet's URL: docs.google.com/spreadsheets/d/THIS_PART/edit.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"range\",\n \"label\": \"Range\",\n \"required\": true,\n \"default\": \"Sheet1!A:Z\",\n \"description\": \"Where to append, in A1 notation. Google finds the last row of this range and writes below it.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"values\",\n \"label\": \"Row values\",\n \"required\": true,\n \"description\": \"The cells of the row, comma separated. Left to right from the start of the range.\"\n },\n {\n \"type\": \"select\",\n \"key\": \"valueInputOption\",\n \"label\": \"How to interpret the values\",\n \"default\": \"USER_ENTERED\",\n \"description\": \"USER_ENTERED parses the cells the way typing them would -- so =SUM(A1:A2) becomes a formula and 1/2/26 becomes a date. RAW stores exactly the characters given.\",\n \"options\": [\n {\n \"value\": \"USER_ENTERED\",\n \"label\": \"As if typed (formulas and dates parsed)\"\n },\n {\n \"value\": \"RAW\",\n \"label\": \"Exactly as given\"\n }\n ]\n },\n {\n \"type\": \"select\",\n \"key\": \"insertDataOption\",\n \"label\": \"When the range already has data below\",\n \"default\": \"INSERT_ROWS\",\n \"description\": \"INSERT_ROWS pushes existing rows down. OVERWRITE writes into them.\",\n \"options\": [\n {\n \"value\": \"INSERT_ROWS\",\n \"label\": \"Insert new rows\"\n },\n {\n \"value\": \"OVERWRITE\",\n \"label\": \"Overwrite what is there\"\n }\n ]\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_SHEETS_ROW_META, config as Record<string, unknown>, \"append a row\"),\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_sheets\n */\n\n/**\n * Google Sheets'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/row-append.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleSheetsRowKind } from \"./kinds/row-append.js\";\n\n/** Every Google Sheets kind, for a host that registers the lot. */\nexport const GOOGLE_SHEETS_KINDS: NodeKindDefinition[] = [\n googleSheetsRowKind,\n];\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@particle-academy/google-sheets-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Google Sheets'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-sheets.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/Fancy-Friends/google-sheets#readme",
|
|
10
|
+
"bugs": "https://github.com/Fancy-Friends/google-sheets/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_sheets",
|
|
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
|
+
}
|