@particle-academy/google-calendar-js 0.0.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/README.md +209 -2
- package/art/fancified.svg +26 -0
- package/dist/chunk-7CMSUBWQ.js +550 -0
- package/dist/chunk-7CMSUBWQ.js.map +1 -0
- package/dist/flow.cjs +682 -0
- package/dist/flow.cjs.map +1 -0
- package/dist/flow.d.cts +33 -0
- package/dist/flow.d.ts +33 -0
- package/dist/flow.js +130 -0
- package/dist/flow.js.map +1 -0
- package/dist/index.cjs +576 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +398 -0
- package/dist/index.d.ts +398 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +78 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@particle-academy/google-calendar-ui`,
|
|
4
|
+
`@particle-academy/google-calendar-js`, `particle-academy/google-calendar-php`
|
|
5
|
+
and `fancy-google-calendar`.
|
|
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.2.0] — 2026-09-30
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`event_create`**, **`event_update`** and **`event_delete`** — write
|
|
16
|
+
support, the first this connector has had. `event_update` uses PATCH
|
|
17
|
+
(`events.patch`), not PUT (`events.update`): PUT requires resending the
|
|
18
|
+
whole event or Google clears every field left out, which is a trap for
|
|
19
|
+
a caller that only wants to change one thing. No scope change —
|
|
20
|
+
`calendar.events` already covers create/update/delete.
|
|
21
|
+
- Deliberately NOT included: attendees and recurrence. Both need an
|
|
22
|
+
array-of-objects (attendees) or array-of-strings (recurrence) config
|
|
23
|
+
shape nothing in this estate's vocabulary has needed before now; same
|
|
24
|
+
bar as everything in `vocabulary-deferred.md` — a second real need,
|
|
25
|
+
not a first guess. All-day (date-only) events are out of scope for the
|
|
26
|
+
same reason: they need `start.date`/`end.date` instead of
|
|
27
|
+
`start.dateTime`/`end.dateTime`, a variant this config shape cannot
|
|
28
|
+
express yet.
|
|
29
|
+
|
|
30
|
+
## [0.1.0] — 2026-09-15
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **First release.** Actions `event_get`, `event_list` (full or incremental
|
|
35
|
+
with a `syncToken`; a `410` means list in full again), `channel_watch` and
|
|
36
|
+
`channel_stop`; the `events_changed` trigger, the first in the estate with
|
|
37
|
+
`delivery: "subscription"`. Google cannot renew a channel, so the trigger's
|
|
38
|
+
lease names `channel_watch` again as its renew, 86400 seconds before the
|
|
39
|
+
week-long channel expires. Deliveries carry an EMPTY body and are verified
|
|
40
|
+
by the channel token Google echoes in `X-Goog-Channel-Token`.
|
|
41
|
+
- Requires `fancy-connector-core` ≥ 0.8.0 in js and php — the release that
|
|
42
|
+
carries `LeaseDeclaration` and the shared-token verification scheme.
|
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
CHANGED
|
@@ -1,3 +1,210 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Google Calendar
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://particle.academy)
|
|
4
|
+
|
|
5
|
+
Google Calendar for [fancy-flow][flow] — as **four imported, versioned packages**, one
|
|
6
|
+
per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
|
|
7
|
+
change.
|
|
8
|
+
|
|
9
|
+
[flow]: https://github.com/Particle-Academy/fancy-flow
|
|
10
|
+
|
|
11
|
+
| Runtime | Package | Install |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Authoring surface (every host) | `@particle-academy/google-calendar-ui` | `npm install @particle-academy/google-calendar-ui` |
|
|
14
|
+
| Node | `@particle-academy/google-calendar-js` | `npm install @particle-academy/google-calendar-js` |
|
|
15
|
+
| PHP 8.4+ | `particle-academy/google-calendar-php` | `composer require particle-academy/google-calendar-php` |
|
|
16
|
+
| Python 3.11+ | `fancy-google-calendar` | `pip install fancy-google-calendar` |
|
|
17
|
+
|
|
18
|
+
The `ui` package is the editor surface and is React on every host — a PHP or
|
|
19
|
+
Python project installs it *and* its own runtime package, and never the `js` one.
|
|
20
|
+
|
|
21
|
+
## What it costs you
|
|
22
|
+
|
|
23
|
+
One dependency: `@particle-academy/fancy-connector-core` (or
|
|
24
|
+
`particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
|
|
25
|
+
packages pull in themselves. The Python package has **zero** runtime
|
|
26
|
+
dependencies.
|
|
27
|
+
|
|
28
|
+
**No Google Calendar SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
|
|
29
|
+
subject to the kit's full approval bar, and one per provider is hundreds of
|
|
30
|
+
dependencies nobody is tracking.
|
|
31
|
+
|
|
32
|
+
## Setting it up
|
|
33
|
+
|
|
34
|
+
Everything below is generated from `provider/manifest.json`, so it cannot disagree with what the packages do.
|
|
35
|
+
|
|
36
|
+
### Credentials
|
|
37
|
+
|
|
38
|
+
A Google Calendar connection holds 5 values.
|
|
39
|
+
|
|
40
|
+
**Two kinds of value, and mixing them up matters.** A `provider` credential is ONE value for the whole installation — an OAuth app's client secret serves every connected account. An `account` credential is one per connected account. A host that stores the second where it stores the first lets one account's credentials reach another's.
|
|
41
|
+
|
|
42
|
+
| Field | Scope | Secret | Where it comes from |
|
|
43
|
+
|---|---|---|---|
|
|
44
|
+
| **OAuth client ID** | per installation | not secret | From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account. |
|
|
45
|
+
| **OAuth client secret** | per installation | **secret** | The client secret for the same OAuth app. One value for the whole installation. |
|
|
46
|
+
| **Access token** | per connected account | **secret** | Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token. |
|
|
47
|
+
| **Refresh token** | per connected account | **secret** | Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour. |
|
|
48
|
+
| **Channel token** | per connected account | **secret** | A secret the host chooses per connected account and sends as `token` on every events.watch. Google echoes it back in the X-Goog-Channel-Token header of every notification, and that echo is the ONLY thing that authenticates a delivery -- Google does not sign them. Up to 256 characters. |
|
|
49
|
+
|
|
50
|
+
### Authorising
|
|
51
|
+
|
|
52
|
+
Google Calendar uses OAuth2 (authorization_code). The package DECLARES the exchange; the HOST performs it — a consent screen needs a browser, a redirect URI and somewhere to persist the result, and all three belong to the host.
|
|
53
|
+
|
|
54
|
+
- **Authorize URL** — https://accounts.google.com/o/oauth2/v2/auth
|
|
55
|
+
- **Token URL** — https://oauth2.googleapis.com/token
|
|
56
|
+
- **Scopes** — `https://www.googleapis.com/auth/calendar.events`
|
|
57
|
+
- **Access token lifetime** — 3600 seconds (1 hours). A host that never refreshes works all afternoon and is broken by morning.
|
|
58
|
+
|
|
59
|
+
The refresh tokens do **not** rotate: the same one is reusable, so a refresh may safely be retried and may run concurrently. Stated rather than assumed, because the opposite — a provider that spends the token and revokes the grant on a replay — looks identical until it happens.
|
|
60
|
+
|
|
61
|
+
### The estate
|
|
62
|
+
|
|
63
|
+
**Google Calendar has no test estate, and somebody checked.** Everything this connector does is real. Use the faker to build against it.
|
|
64
|
+
|
|
65
|
+
> Google has no sandbox for Calendar. A test calendar is a real one in a real account, so every watch and every read is real -- point this at a scratch calendar, not a production one. The faker is the only way to develop against it without touching an account.
|
|
66
|
+
|
|
67
|
+
## What it can do
|
|
68
|
+
|
|
69
|
+
### Actions
|
|
70
|
+
|
|
71
|
+
#### `channel_stop` — Google Calendar stop watching
|
|
72
|
+
|
|
73
|
+
Close a push-notification channel. The host's subscription machinery calls this before re-creating a channel and when a trigger is removed.
|
|
74
|
+
|
|
75
|
+
`POST /calendar/v3/channels/stop` · idempotent — safe to replay
|
|
76
|
+
|
|
77
|
+
| Input | Required | What it is |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| `channelId` | yes | The channel's id, as sent to channel_watch. |
|
|
80
|
+
| `resourceId` | yes | The resourceId channel_watch answered with. Both are needed; Google refuses a stop with only one. |
|
|
81
|
+
|
|
82
|
+
#### `channel_watch` — Google Calendar watch
|
|
83
|
+
|
|
84
|
+
Open a push-notification channel on a calendar's events. The host's subscription machinery calls this; it is not a node most workflows need.
|
|
85
|
+
|
|
86
|
+
`POST /calendar/v3/calendars/{calendarId}/events/watch` · **unsafe to replay** — a retried durable run does it TWICE
|
|
87
|
+
|
|
88
|
+
| Input | Required | What it is |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| `calendarId` | yes | `primary` for the connected account's own calendar, or a calendar's id. |
|
|
91
|
+
| `channelId` | yes | A UUID the host mints for THIS channel. Google requires it to be unique; it comes back in every notification as X-Goog-Channel-ID and is what channel_stop needs. |
|
|
92
|
+
| `address` | yes | The HTTPS URL the host mounts for this trigger. Google POSTs notifications here with an EMPTY body and the facts in X-Goog-* headers. |
|
|
93
|
+
| `token` | yes | The connection's channelToken. The host fills this from the connection -- never type a value here. Google echoes it in X-Goog-Channel-Token, and that echo is how a delivery is verified. |
|
|
94
|
+
| `ttlSeconds` | yes | How long Google keeps the channel alive. Google's default is 604800 (one week), and the discovery document types it as a STRING inside `params`. |
|
|
95
|
+
|
|
96
|
+
#### `event_create` — Create Google Calendar event
|
|
97
|
+
|
|
98
|
+
Create a timed event on a Google Calendar.
|
|
99
|
+
|
|
100
|
+
`POST /calendar/v3/calendars/{calendarId}/events` · **unsafe to replay** — a retried durable run does it TWICE
|
|
101
|
+
|
|
102
|
+
| Input | Required | What it is |
|
|
103
|
+
|---|---|---|
|
|
104
|
+
| `calendarId` | yes | `primary` for the connected account's own calendar, or a calendar's id. |
|
|
105
|
+
| `summary` | yes | Title |
|
|
106
|
+
| `description` | no | Can contain HTML. |
|
|
107
|
+
| `location` | no | Free-form text. |
|
|
108
|
+
| `startDateTime` | yes | RFC 3339, e.g. 2026-10-01T14:00:00Z. Include an offset, or pair with a time zone below. |
|
|
109
|
+
| `startTimeZone` | no | IANA name, e.g. America/New_York. Optional when the start time already carries an offset. |
|
|
110
|
+
| `endDateTime` | yes | RFC 3339. Exclusive -- the event ends at, not through, this instant. |
|
|
111
|
+
| `endTimeZone` | no | End time zone |
|
|
112
|
+
| `status` | no | "cancelled" is not offered here -- that is event_delete's job, not a status this action should be able to set on create. |
|
|
113
|
+
| `visibility` | no | Visibility |
|
|
114
|
+
| `transparency` | no | opaque blocks time on the calendar (Busy); transparent does not (Available). |
|
|
115
|
+
| `colorId` | no | An id from the colors endpoint's event section. Leave blank for the calendar's default. |
|
|
116
|
+
|
|
117
|
+
#### `event_delete` — Delete Google Calendar event
|
|
118
|
+
|
|
119
|
+
Remove an event from a Google Calendar.
|
|
120
|
+
|
|
121
|
+
`DELETE /calendar/v3/calendars/{calendarId}/events/{eventId}` · idempotent — safe to replay
|
|
122
|
+
|
|
123
|
+
| Input | Required | What it is |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| `calendarId` | yes | Calendar ID |
|
|
126
|
+
| `eventId` | yes | From event_create's data.id, or event_list/event_get. |
|
|
127
|
+
|
|
128
|
+
#### `event_get` — Google Calendar event
|
|
129
|
+
|
|
130
|
+
Read one event from a Google Calendar.
|
|
131
|
+
|
|
132
|
+
`GET /calendar/v3/calendars/{calendarId}/events/{eventId}` · reads only — safe to replay
|
|
133
|
+
|
|
134
|
+
| Input | Required | What it is |
|
|
135
|
+
|---|---|---|
|
|
136
|
+
| `calendarId` | yes | `primary` for the connected account's own calendar, or a calendar's id (usually an email address). |
|
|
137
|
+
| `eventId` | yes | The event's id, as published by another node or by a notification's follow-up list. |
|
|
138
|
+
|
|
139
|
+
#### `event_list` — Google Calendar events
|
|
140
|
+
|
|
141
|
+
List events from a Google Calendar, in full or incrementally with a sync token.
|
|
142
|
+
|
|
143
|
+
`GET /calendar/v3/calendars/{calendarId}/events` · reads only — safe to replay
|
|
144
|
+
|
|
145
|
+
| Input | Required | What it is |
|
|
146
|
+
|---|---|---|
|
|
147
|
+
| `calendarId` | yes | `primary` for the connected account's own calendar, or a calendar's id. |
|
|
148
|
+
| `syncToken` | no | From a previous list's nextSyncToken. With one set, Google returns ONLY what changed since -- including deletions, as cancelled events. Leave blank for a full list. |
|
|
149
|
+
| `timeMin` | no | RFC 3339 lower bound on an event's END time, e.g. 2026-09-15T00:00:00Z. Not allowed together with a sync token. |
|
|
150
|
+
| `timeMax` | no | RFC 3339 upper bound on an event's START time. Not allowed together with a sync token. |
|
|
151
|
+
| `maxResults` | no | Events per page. Google's default is 250 and its maximum 2500; a nextPageToken means there are more. |
|
|
152
|
+
| `pageToken` | no | From a previous page's nextPageToken. |
|
|
153
|
+
| `singleEvents` | no | Return each occurrence of a recurring event as its own item, rather than the series once. |
|
|
154
|
+
|
|
155
|
+
#### `event_update` — Update Google Calendar event
|
|
156
|
+
|
|
157
|
+
Change one or more fields of an existing event. Only the fields provided are touched.
|
|
158
|
+
|
|
159
|
+
`PATCH /calendar/v3/calendars/{calendarId}/events/{eventId}` · idempotent — safe to replay
|
|
160
|
+
|
|
161
|
+
| Input | Required | What it is |
|
|
162
|
+
|---|---|---|
|
|
163
|
+
| `calendarId` | yes | Calendar ID |
|
|
164
|
+
| `eventId` | yes | From event_create's data.id, or event_list/event_get. |
|
|
165
|
+
| `summary` | no | Title |
|
|
166
|
+
| `description` | no | Description |
|
|
167
|
+
| `location` | no | Location |
|
|
168
|
+
| `startDateTime` | no | RFC 3339. Leave blank to leave the start time unchanged. |
|
|
169
|
+
| `startTimeZone` | no | Start time zone |
|
|
170
|
+
| `endDateTime` | no | RFC 3339. Leave blank to leave the end time unchanged. |
|
|
171
|
+
| `endTimeZone` | no | End time zone |
|
|
172
|
+
| `status` | no | Setting cancelled here has the same effect as event_delete -- offered because PATCH is also Google's documented way to cancel one instance of a recurring event, which event_delete (which removes the whole resource) cannot target. |
|
|
173
|
+
| `visibility` | no | Visibility |
|
|
174
|
+
| `transparency` | no | Show me as |
|
|
175
|
+
| `colorId` | no | Color ID |
|
|
176
|
+
|
|
177
|
+
### Triggers
|
|
178
|
+
|
|
179
|
+
#### `events_changed` — Google Calendar change
|
|
180
|
+
|
|
181
|
+
Start a run when something changes on a watched Google Calendar.
|
|
182
|
+
|
|
183
|
+
A SUBSCRIPTION: Google Calendar delivers to your endpoint only while a subscription it issued is alive, at most 168 hours at a time. Its expiry is read from the `channel_watch` response (`expiration`); 86400 seconds before it, Google Calendar cannot renew one, so the host stops it (`channel_stop`) and creates it again (`channel_watch`). A lease that lapses is re-listed AND re-subscribed, because notifications during the gap are gone. Every delivery: the token Google Calendar echoes back is compared with the connection's `channelToken` before anything runs.
|
|
184
|
+
|
|
185
|
+
**You have to set this up with the provider first:**
|
|
186
|
+
|
|
187
|
+
The host mints a UUID, calls channel_watch with it, its own URL for this trigger and the connection's channelToken, and stores the returned id, resourceId and expiration. Google cannot renew a channel: 86400 seconds before it expires the host calls channel_stop and then channel_watch again. A channel that lapsed is re-listed FIRST (event_list with the stored syncToken; a 410 means list in full) and then re-created, because notifications during the gap are gone. Google delivers with an EMPTY body: the host verifies X-Goog-Channel-Token against the connection's channelToken and injects the X-Goog-* headers as the event, camel-cased as below. The first message on a new channel is `sync` and carries no change.
|
|
188
|
+
|
|
189
|
+
## Run it before you have credentials
|
|
190
|
+
|
|
191
|
+
Every operation ships a **faker**, whether or not Google Calendar has a sandbox. Set a
|
|
192
|
+
node's mode to `fake` and it returns the shape Google Calendar actually publishes — the
|
|
193
|
+
same field names, deterministically — so you can wire the downstream nodes before
|
|
194
|
+
touching an account, a key, or a network.
|
|
195
|
+
|
|
196
|
+
## This repository is generated
|
|
197
|
+
|
|
198
|
+
`provider/` is the source. Everything under `packages/` is emitted from it and
|
|
199
|
+
**must not be hand-edited** — CI regenerates and diffs on every push, and the
|
|
200
|
+
next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).
|
|
201
|
+
|
|
202
|
+
## Two namespaces, which do not match on purpose
|
|
203
|
+
|
|
204
|
+
The repo is `github.com/Fancy-Friends/google-calendar`; the packages publish under
|
|
205
|
+
`particle-academy`. Nothing derives one from the other — the names come from
|
|
206
|
+
weaver's `friends.json` and nowhere else.
|
|
207
|
+
|
|
208
|
+
## Licence
|
|
209
|
+
|
|
210
|
+
MIT.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="28" role="img" aria-label="Fancified — built with Fancy UI">
|
|
2
|
+
<title>Fancified · built with Fancy UI</title>
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient id="fcdBg" x1="0" y1="0" x2="1" y2="1">
|
|
5
|
+
<stop offset="0" stop-color="#6d28d9"/>
|
|
6
|
+
<stop offset=".5" stop-color="#9333ea"/>
|
|
7
|
+
<stop offset="1" stop-color="#d946ef"/>
|
|
8
|
+
</linearGradient>
|
|
9
|
+
<linearGradient id="fcdGloss" x1="0" y1="0" x2="0" y2="1">
|
|
10
|
+
<stop offset="0" stop-color="#ffffff" stop-opacity=".30"/>
|
|
11
|
+
<stop offset=".55" stop-color="#ffffff" stop-opacity="0"/>
|
|
12
|
+
</linearGradient>
|
|
13
|
+
<clipPath id="fcdClip"><rect width="128" height="28" rx="7"/></clipPath>
|
|
14
|
+
</defs>
|
|
15
|
+
<g clip-path="url(#fcdClip)">
|
|
16
|
+
<rect width="128" height="28" fill="url(#fcdBg)"/>
|
|
17
|
+
<rect width="34" height="28" fill="#3b0764" fill-opacity=".5"/>
|
|
18
|
+
<rect width="128" height="13" fill="url(#fcdGloss)"/>
|
|
19
|
+
<g fill="#fff">
|
|
20
|
+
<path transform="translate(17 14)" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
|
|
21
|
+
<path transform="translate(25.5 7.5) scale(.34)" fill-opacity=".85" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
|
|
22
|
+
</g>
|
|
23
|
+
<text x="81" y="18.5" fill="#ffffff" text-anchor="middle" font-family="'Segoe UI',Verdana,'DejaVu Sans',sans-serif" font-size="12" font-weight="700" letter-spacing=".3">Fancified</text>
|
|
24
|
+
</g>
|
|
25
|
+
<rect x=".5" y=".5" width="127" height="27" rx="6.5" fill="none" stroke="#ffffff" stroke-opacity=".22"/>
|
|
26
|
+
</svg>
|