fancy-google-docs 0.4.0__tar.gz → 0.6.0__tar.gz
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.
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/CHANGELOG.md +46 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/PKG-INFO +8 -1
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/README.md +7 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/pyproject.toml +1 -1
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/__init__.py +1 -1
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/_runtime.py +48 -3
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/.gitignore +0 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/LICENSE +0 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/art/fancified.svg +0 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/_fake.py +0 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/actions/__init__.py +0 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/actions/document_create.py +0 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/actions/text_insert.py +0 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/faker.py +0 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/py.typed +0 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/service.py +0 -0
- {fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/tests/test_faker.py +0 -0
|
@@ -8,6 +8,52 @@ The four packages share one version, because they are generated from one
|
|
|
8
8
|
`provider/` definition and a version that meant something different in each
|
|
9
9
|
would be a version nobody could reason about.
|
|
10
10
|
|
|
11
|
+
## [0.6.0] — 2026-11-08
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **One Google consent grant, shared by every Google connector** (`oauth.grant:
|
|
16
|
+
"google"`), for an org-level Google connection: one OAuth client, one consent
|
|
17
|
+
and one refresh token per person, with each feature's scopes asked for when it
|
|
18
|
+
is first used. Declared in the manifest, the `-ui` package's OAuth constant,
|
|
19
|
+
the README and the registry index:
|
|
20
|
+
- `authorizeParams`: `access_type=offline` and `include_granted_scopes=true`.
|
|
21
|
+
A refresh token comes back only on the FIRST code exchange, so keep the stored
|
|
22
|
+
one when an exchange returns none.
|
|
23
|
+
- `revoke`: POST `https://oauth2.googleapis.com/revoke` with `token`, and
|
|
24
|
+
`scope: "grant"`. **Revoking removes the person's WHOLE Google grant, every
|
|
25
|
+
Google connector**, so a per-feature disconnect stops using that feature's
|
|
26
|
+
scopes locally and only a full Google disconnect revokes.
|
|
27
|
+
- `identity`: identify the account by the id_token's `sub` (request `openid`;
|
|
28
|
+
issuer `https://accounts.google.com` or `accounts.google.com`; audience is
|
|
29
|
+
the `clientId`), never by email, which Google says is neither unique nor
|
|
30
|
+
permanent.
|
|
31
|
+
`restrictedScopes` is empty: none of this connector's scopes is restricted.
|
|
32
|
+
|
|
33
|
+
Nothing a request sends has changed; this is what a host needs to run the
|
|
34
|
+
connection.
|
|
35
|
+
|
|
36
|
+
## [0.5.0] — 2026-11-08
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- **Laravel integration, in this package** (`src/Laravel/`), auto-discovered
|
|
41
|
+
through composer's `extra.laravel`. Laravel is SUGGESTED, never required:
|
|
42
|
+
outside a Laravel app none of it loads.
|
|
43
|
+
- a service provider that merges `config/google-docs.php` under
|
|
44
|
+
`connectors.google-docs` (credentials from the environment, or per call for a
|
|
45
|
+
multi-account app);
|
|
46
|
+
- the `GoogleDocs` facade: `GoogleDocs::call('<operation>', [...])` runs any action;
|
|
47
|
+
- `GoogleDocs::fake()`, answered from the connector's faker, with
|
|
48
|
+
`assertSent` / `assertNotSent` / `assertNothingSent` / `assertSentCount`;
|
|
49
|
+
- its own Pest test of all of it against a booted Laravel app.
|
|
50
|
+
|
|
51
|
+
### Changed
|
|
52
|
+
|
|
53
|
+
- **Tests: Pest `^5`**, and `laravel/framework` `^13` as a DEV-ONLY test
|
|
54
|
+
dependency (the framework this package integrates with; nothing ships in
|
|
55
|
+
`require`).
|
|
56
|
+
|
|
11
57
|
## [0.4.0] — 2026-10-01
|
|
12
58
|
|
|
13
59
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fancy-google-docs
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Google Docs for Python — the service descriptor, its faker, its webhook verification, and one function per operation. Plain HTTP; no vendor SDK.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Fancy-Friends/google-docs
|
|
6
6
|
Project-URL: Issues, https://github.com/Fancy-Friends/google-docs/issues
|
|
@@ -77,6 +77,13 @@ Google Docs uses OAuth2 (authorization_code). The package DECLARES the exchange;
|
|
|
77
77
|
- **Scopes** — `https://www.googleapis.com/auth/documents`
|
|
78
78
|
- **Access token lifetime** — 3600 seconds (1 hours). A host that never refreshes works all afternoon and is broken by morning.
|
|
79
79
|
|
|
80
|
+
**One consent grant, shared** (`grant: "google"`). Every connector declaring the same grant can run on ONE OAuth client, with one consent and one refresh token per person.
|
|
81
|
+
|
|
82
|
+
- **Authorize with** `access_type=offline`, `include_granted_scopes=true`. Ask for a feature's scopes when it is first used; the new token covers every scope granted before. A refresh token comes back only on the FIRST exchange, so keep the stored one when an exchange returns none.
|
|
83
|
+
- **Revoke** — POST https://oauth2.googleapis.com/revoke with `token`. **It removes the WHOLE grant**: every connector sharing it, not only this one. A per-feature disconnect stops using that feature's scopes locally; only a full disconnect revokes.
|
|
84
|
+
- **Identify the account by `sub`**: request `openid`, then verify the token response's id_token (issuer `https://accounts.google.com` or `accounts.google.com`, keys at https://www.googleapis.com/oauth2/v3/certs, audience = `clientId`). Never key a connection by email.
|
|
85
|
+
- **No restricted scopes** in this connector.
|
|
86
|
+
|
|
80
87
|
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.
|
|
81
88
|
|
|
82
89
|
### The estate
|
|
@@ -55,6 +55,13 @@ Google Docs uses OAuth2 (authorization_code). The package DECLARES the exchange;
|
|
|
55
55
|
- **Scopes** — `https://www.googleapis.com/auth/documents`
|
|
56
56
|
- **Access token lifetime** — 3600 seconds (1 hours). A host that never refreshes works all afternoon and is broken by morning.
|
|
57
57
|
|
|
58
|
+
**One consent grant, shared** (`grant: "google"`). Every connector declaring the same grant can run on ONE OAuth client, with one consent and one refresh token per person.
|
|
59
|
+
|
|
60
|
+
- **Authorize with** `access_type=offline`, `include_granted_scopes=true`. Ask for a feature's scopes when it is first used; the new token covers every scope granted before. A refresh token comes back only on the FIRST exchange, so keep the stored one when an exchange returns none.
|
|
61
|
+
- **Revoke** — POST https://oauth2.googleapis.com/revoke with `token`. **It removes the WHOLE grant**: every connector sharing it, not only this one. A per-feature disconnect stops using that feature's scopes locally; only a full disconnect revokes.
|
|
62
|
+
- **Identify the account by `sub`**: request `openid`, then verify the token response's id_token (issuer `https://accounts.google.com` or `accounts.google.com`, keys at https://www.googleapis.com/oauth2/v3/certs, audience = `clientId`). Never key a connection by email.
|
|
63
|
+
- **No restricted scopes** in this connector.
|
|
64
|
+
|
|
58
65
|
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.
|
|
59
66
|
|
|
60
67
|
### The estate
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "fancy-google-docs"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.6.0"
|
|
8
8
|
description = "Google Docs for Python — the service descriptor, its faker, its webhook verification, and one function per operation. Plain HTTP; no vendor SDK."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
# 3.11 matches fancy-flow-py's floor: 3.10 reaches end of life on 2026-10-31,
|
|
@@ -22,7 +22,7 @@ from .actions.text_insert import text_insert
|
|
|
22
22
|
from .faker import respond
|
|
23
23
|
from .service import BASE_URLS, CONNECTOR_API_VERSION, REQUIRES, SANDBOX, SERVICE, TITLE, descriptor
|
|
24
24
|
|
|
25
|
-
__version__ = "0.
|
|
25
|
+
__version__ = "0.6.0"
|
|
26
26
|
|
|
27
27
|
__all__ = [
|
|
28
28
|
"BASE_URLS",
|
|
@@ -319,6 +319,11 @@ def verify_hmac(
|
|
|
319
319
|
secret_encoding: str = "utf8", # noqa: S107 — how the secret is SPELLED, not one
|
|
320
320
|
secret_prefix: str | None = None,
|
|
321
321
|
id: str | None = None,
|
|
322
|
+
timestamp_unit: str = "s",
|
|
323
|
+
signs_request_line: bool = False,
|
|
324
|
+
uri: str | None = None,
|
|
325
|
+
method: str | None = None,
|
|
326
|
+
url: str | None = None,
|
|
322
327
|
) -> Verification:
|
|
323
328
|
"""Verify one inbound delivery.
|
|
324
329
|
|
|
@@ -366,21 +371,33 @@ def verify_hmac(
|
|
|
366
371
|
False, "the delivery carried no timestamp, and this scheme signs one"
|
|
367
372
|
)
|
|
368
373
|
try:
|
|
369
|
-
sent =
|
|
374
|
+
sent = float(timestamp)
|
|
370
375
|
except (TypeError, ValueError):
|
|
371
376
|
return Verification(False, f'the delivery timestamp "{timestamp}" is not a number')
|
|
377
|
+
# Converted, never compared raw: HubSpot sends MILLISECONDS, and a
|
|
378
|
+
# millisecond value against a window in seconds refuses every delivery.
|
|
379
|
+
if timestamp_unit == "ms":
|
|
380
|
+
sent = sent / 1000
|
|
372
381
|
|
|
373
382
|
current = int(time.time()) if now is None else now
|
|
374
383
|
if abs(current - sent) > tolerance:
|
|
375
384
|
return Verification(
|
|
376
385
|
False,
|
|
377
386
|
f"the delivery is outside the {tolerance}s replay window "
|
|
378
|
-
f"({abs(current - sent)}s old)",
|
|
387
|
+
f"({int(abs(current - sent))}s old)",
|
|
379
388
|
)
|
|
380
389
|
|
|
381
390
|
# A payload that signs the delivery's ID (Svix) takes it as a third argument;
|
|
382
391
|
# the two-argument payloads every earlier scheme wrote are called as before.
|
|
383
|
-
|
|
392
|
+
# HubSpot v3 signs the REQUEST LINE: refused by name without it, and the
|
|
393
|
+
# uri normalised here, once, by the scheme's rule.
|
|
394
|
+
if signs_request_line:
|
|
395
|
+
if not method or not url:
|
|
396
|
+
return Verification(False, "the delivery carried no request method or url")
|
|
397
|
+
line = {"method": method, "uri": normalise_signed_uri(url, uri) if uri else url}
|
|
398
|
+
signed = payload(raw, timestamp, id, line)
|
|
399
|
+
else:
|
|
400
|
+
signed = payload(raw, timestamp) if id is None else payload(raw, timestamp, id)
|
|
384
401
|
computed = hmac.new(key, signed.encode(), digest)
|
|
385
402
|
expected = computed.hexdigest() if encoding == "hex" else _b64(computed.digest())
|
|
386
403
|
|
|
@@ -392,6 +409,34 @@ def verify_hmac(
|
|
|
392
409
|
return Verification(True)
|
|
393
410
|
|
|
394
411
|
|
|
412
|
+
_HUBSPOT_V3_DECODE = {
|
|
413
|
+
"%3A": ":", "%2F": "/", "%3F": "?", "%40": "@", "%21": "!", "%24": "$",
|
|
414
|
+
"%27": "'", "%28": "(", "%29": ")", "%2A": "*", "%2C": ",", "%3B": ";",
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
def normalise_signed_uri(url: str, rule: str) -> str:
|
|
419
|
+
"""The URI a provider signs, from the URL the request arrived on.
|
|
420
|
+
|
|
421
|
+
``hubspot-v3``: only the QUERY portion is percent-decoded, and only for
|
|
422
|
+
twelve escapes (case-insensitive); never its leading ``?``; any
|
|
423
|
+
``#fragment`` dropped. ``%26`` and ``%3D`` stay as sent. The twin of the
|
|
424
|
+
core's ``normaliseSignedUri``.
|
|
425
|
+
"""
|
|
426
|
+
import re
|
|
427
|
+
|
|
428
|
+
if rule != "hubspot-v3":
|
|
429
|
+
raise ValueError(f"unknown signed-uri rule {rule!r}")
|
|
430
|
+
without_fragment = url.split("#", 1)[0]
|
|
431
|
+
base, sep, query = without_fragment.partition("?")
|
|
432
|
+
if not sep:
|
|
433
|
+
return without_fragment
|
|
434
|
+
decoded = re.sub(
|
|
435
|
+
r"%[0-9A-Fa-f]{2}", lambda m: _HUBSPOT_V3_DECODE.get(m.group(0).upper(), m.group(0)), query
|
|
436
|
+
)
|
|
437
|
+
return f"{base}?{decoded}"
|
|
438
|
+
|
|
439
|
+
|
|
395
440
|
def _secret_key_bytes(
|
|
396
441
|
secret: str,
|
|
397
442
|
secret_encoding: str = "utf8", # noqa: S107 — how the secret is SPELLED, not one
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/actions/__init__.py
RENAMED
|
File without changes
|
{fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/actions/document_create.py
RENAMED
|
File without changes
|
{fancy_google_docs-0.4.0 → fancy_google_docs-0.6.0}/src/fancy_google_docs/actions/text_insert.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|