@sentry/junior-google 0.298.0 → 0.300.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/README.md +39 -5
- package/dist/config.d.ts +8 -1
- package/dist/credentials.d.ts +51 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2088 -920
- package/dist/links/calendar.d.ts +11 -0
- package/dist/links/files.d.ts +11 -0
- package/dist/links/summary.d.ts +13 -0
- package/dist/tools/cancel-event.d.ts +70 -2
- package/dist/tools/create-doc.d.ts +212 -0
- package/dist/tools/create-event.d.ts +70 -2
- package/dist/tools/doc-edits.d.ts +84 -0
- package/dist/tools/doc-markdown.d.ts +40 -0
- package/dist/tools/files.d.ts +17 -1
- package/dist/tools/find-meeting-times.d.ts +70 -2
- package/dist/tools/insert-doc-content.d.ts +206 -0
- package/dist/tools/list-events.d.ts +70 -2
- package/dist/tools/list-file-comments.d.ts +70 -2
- package/dist/tools/read-doc.d.ts +12 -135
- package/dist/tools/read-file.d.ts +241 -0
- package/dist/tools/read-meeting-transcript.d.ts +70 -2
- package/dist/tools/read-sheet.d.ts +12 -138
- package/dist/tools/read-slides.d.ts +12 -137
- package/dist/tools/replace-doc-content.d.ts +205 -0
- package/dist/tools/replace-doc-text.d.ts +209 -0
- package/dist/tools/search-files.d.ts +78 -3
- package/dist/tools/shared.d.ts +36 -2
- package/dist/tools/update-event.d.ts +70 -2
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
# @sentry/junior-google
|
|
2
2
|
|
|
3
3
|
Proof of concept. Junior uses its own Google Workspace account, such as
|
|
4
|
-
`junior@example.com`, to schedule meetings, read Meet transcripts,
|
|
5
|
-
Google Docs, Sheets, and Slides that are shared with that account
|
|
4
|
+
`junior@example.com`, to schedule meetings, read Meet transcripts, read
|
|
5
|
+
Google Docs, Sheets, and Slides that are shared with that account, and create
|
|
6
|
+
and edit Google Docs. Junior does
|
|
6
7
|
not use the Google credentials of the people it helps.
|
|
7
8
|
|
|
8
9
|
## Setup
|
|
9
10
|
|
|
10
11
|
1. In the Google Cloud project of the dashboard OAuth client, enable the
|
|
11
|
-
Calendar, Drive, Sheets, and Slides APIs.
|
|
12
|
+
Calendar, Docs, Drive, Sheets, and Slides APIs.
|
|
12
13
|
2. Use an **Internal** consent screen. Add the scopes
|
|
13
14
|
`calendar.events.freebusy`, `calendar.events.readonly`,
|
|
14
|
-
`calendar.events.owned`, and `drive.readonly`.
|
|
15
|
+
`calendar.events.owned`, `documents`, `drive.file`, and `drive.readonly`.
|
|
16
|
+
After you add a scope, reconnect the account in step 7.
|
|
15
17
|
3. Add the redirect URIs
|
|
16
18
|
`https://<junior host>/api/plugins/google/oauth/callback` and
|
|
17
19
|
`http://127.0.0.1:8765/oauth/callback` (CLI).
|
|
@@ -24,6 +26,38 @@ not use the Google credentials of the people it helps.
|
|
|
24
26
|
`junior google connect`.
|
|
25
27
|
|
|
26
28
|
Anyone who can talk to Junior can read what the Junior account can see. Share
|
|
27
|
-
calendars and files with that account only when that is acceptable.
|
|
29
|
+
calendars and files with that account only when that is acceptable. Given a
|
|
30
|
+
link, Junior opens any Doc, Sheet, or Slides file shared with its account.
|
|
31
|
+
One tool, `readGoogleFile`, reads all three. It takes the type from the link,
|
|
32
|
+
or from Drive for a bare file id.
|
|
33
|
+
Search finds only files that any employee could already find in Drive, and
|
|
34
|
+
files shared with the requester by name. Files shared by link, or only with
|
|
35
|
+
other people or groups, never show up in search. Search also drops every file
|
|
36
|
+
that no account in `GOOGLE_WORKSPACE_ALLOWED_DOMAINS` owns. Shared-drive files
|
|
37
|
+
have no owner, so search shows them only when they are shared with the
|
|
38
|
+
requester by name. Search returns nothing for a requester outside those
|
|
39
|
+
domains.
|
|
40
|
+
|
|
41
|
+
The dashboard shows a card for a Doc, Sheet, Slides, or Calendar event link
|
|
42
|
+
only when the signed-in viewer can open it too. A file must name the
|
|
43
|
+
viewer's email as a reader, writer, or owner, be open to anyone with the
|
|
44
|
+
link, or be open to the viewer's domain and owned in that domain. Access
|
|
45
|
+
through a Google group gets no card. An event must be on the Junior
|
|
46
|
+
account's calendar, with the viewer as its organizer, creator, or a guest.
|
|
47
|
+
A file card shows the title, type, owner, and modified time. An event card
|
|
48
|
+
shows the title and time. Cards never show content or guests.
|
|
49
|
+
|
|
50
|
+
Junior edits a Doc only for a requester who can edit it through their own
|
|
51
|
+
email, their domain, or an editable link. Access through a Google group is not
|
|
52
|
+
checked. Anyone who can talk to Junior can read a Doc that Junior edits, if
|
|
53
|
+
they give Junior its link. Junior makes the requester the owner of a Doc it
|
|
54
|
+
creates, then removes its own access. Google emails the requester about the
|
|
55
|
+
new ownership. Junior cannot read or edit that Doc again unless the requester
|
|
56
|
+
shares it back. This only works for requesters in the same Workspace
|
|
57
|
+
organization as Junior's account.
|
|
58
|
+
|
|
59
|
+
Each edit of an existing Doc needs the `revision_id` that `readGoogleFile` or
|
|
60
|
+
the last edit returned. If someone changed the Doc after that, the edit is
|
|
61
|
+
refused, so Junior never changes text that it did not read.
|
|
28
62
|
|
|
29
63
|
Plugin setup: https://junior.sentry.dev/extend/
|
package/dist/config.d.ts
CHANGED
|
@@ -18,11 +18,18 @@ export declare const GOOGLE_ALLOWED_DOMAINS_ENV = "GOOGLE_WORKSPACE_ALLOWED_DOMA
|
|
|
18
18
|
* still decide how much detail each calendar shows.
|
|
19
19
|
* - `calendar.events.owned`: create and change events on Junior's own
|
|
20
20
|
* calendar.
|
|
21
|
+
* - `documents`: create Docs and edit Docs that Junior's account can already
|
|
22
|
+
* edit, through the Docs API. It gives no access to other Drive files and
|
|
23
|
+
* cannot change sharing.
|
|
24
|
+
* - `drive.file`: make the requester the owner of a Doc that Junior created,
|
|
25
|
+
* then remove Junior's own access. It only covers files this OAuth client
|
|
26
|
+
* created, so it cannot change sharing on other files. Full `drive` is not
|
|
27
|
+
* needed.
|
|
21
28
|
* - `drive.readonly`: search Drive, export Docs, read Sheets and Slides, and
|
|
22
29
|
* read comments. The Drive comments API accepts no narrower read scope. The
|
|
23
30
|
* Sheets and Slides APIs also accept this scope.
|
|
24
31
|
*/
|
|
25
|
-
export declare const GOOGLE_API_SCOPES: readonly ["https://www.googleapis.com/auth/calendar.events.freebusy", "https://www.googleapis.com/auth/calendar.events.owned", "https://www.googleapis.com/auth/calendar.events.readonly", "https://www.googleapis.com/auth/drive.readonly"];
|
|
32
|
+
export declare const GOOGLE_API_SCOPES: readonly ["https://www.googleapis.com/auth/calendar.events.freebusy", "https://www.googleapis.com/auth/calendar.events.owned", "https://www.googleapis.com/auth/calendar.events.readonly", "https://www.googleapis.com/auth/documents", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.readonly"];
|
|
26
33
|
/** Identity scopes used only to verify which account signed in. */
|
|
27
34
|
export declare const GOOGLE_IDENTITY_SCOPES: readonly ["openid", "email"];
|
|
28
35
|
export interface GoogleConfig {
|
package/dist/credentials.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Credential issuing and egress policy for Google APIs.
|
|
3
3
|
*
|
|
4
|
-
* Only this plugin's own tools may use Junior's Google
|
|
5
|
-
* enforce disclosure and invite rules in code, so the sandbox
|
|
6
|
-
* callers get no Google credential at all.
|
|
4
|
+
* Only this plugin's own tools and link cards may use Junior's Google
|
|
5
|
+
* account. They enforce disclosure and invite rules in code, so the sandbox
|
|
6
|
+
* and other callers get no Google credential at all.
|
|
7
7
|
*/
|
|
8
8
|
import { type EgressHookContext, type IssueCredentialHookContext, type PluginCredentialResult, type PluginGrant } from "@sentry/junior-plugin-api";
|
|
9
9
|
/** Calendar and Drive API host. */
|
|
@@ -48,6 +48,30 @@ export declare const GOOGLE_OPERATIONS: {
|
|
|
48
48
|
readonly method: "POST";
|
|
49
49
|
readonly path: RegExp;
|
|
50
50
|
};
|
|
51
|
+
readonly "google.docs.document.batchUpdate": {
|
|
52
|
+
readonly access: "write";
|
|
53
|
+
readonly host: "docs.googleapis.com";
|
|
54
|
+
readonly method: "POST";
|
|
55
|
+
readonly path: RegExp;
|
|
56
|
+
};
|
|
57
|
+
readonly "google.docs.document.create": {
|
|
58
|
+
readonly access: "write";
|
|
59
|
+
readonly host: "docs.googleapis.com";
|
|
60
|
+
readonly method: "POST";
|
|
61
|
+
readonly path: RegExp;
|
|
62
|
+
};
|
|
63
|
+
readonly "google.docs.document.get": {
|
|
64
|
+
readonly access: "read";
|
|
65
|
+
readonly host: "docs.googleapis.com";
|
|
66
|
+
readonly method: "GET";
|
|
67
|
+
readonly path: RegExp;
|
|
68
|
+
};
|
|
69
|
+
readonly "google.drive.about.get": {
|
|
70
|
+
readonly access: "read";
|
|
71
|
+
readonly host: "www.googleapis.com";
|
|
72
|
+
readonly method: "GET";
|
|
73
|
+
readonly path: RegExp;
|
|
74
|
+
};
|
|
51
75
|
readonly "google.drive.comments.list": {
|
|
52
76
|
readonly access: "read";
|
|
53
77
|
readonly host: "www.googleapis.com";
|
|
@@ -72,6 +96,30 @@ export declare const GOOGLE_OPERATIONS: {
|
|
|
72
96
|
readonly method: "GET";
|
|
73
97
|
readonly path: RegExp;
|
|
74
98
|
};
|
|
99
|
+
readonly "google.drive.permission.create": {
|
|
100
|
+
readonly access: "write";
|
|
101
|
+
readonly host: "www.googleapis.com";
|
|
102
|
+
readonly method: "POST";
|
|
103
|
+
readonly path: RegExp;
|
|
104
|
+
};
|
|
105
|
+
readonly "google.drive.file.delete": {
|
|
106
|
+
readonly access: "write";
|
|
107
|
+
readonly host: "www.googleapis.com";
|
|
108
|
+
readonly method: "DELETE";
|
|
109
|
+
readonly path: RegExp;
|
|
110
|
+
};
|
|
111
|
+
readonly "google.drive.permission.delete": {
|
|
112
|
+
readonly access: "write";
|
|
113
|
+
readonly host: "www.googleapis.com";
|
|
114
|
+
readonly method: "DELETE";
|
|
115
|
+
readonly path: RegExp;
|
|
116
|
+
};
|
|
117
|
+
readonly "google.drive.permissions.list": {
|
|
118
|
+
readonly access: "read";
|
|
119
|
+
readonly host: "www.googleapis.com";
|
|
120
|
+
readonly method: "GET";
|
|
121
|
+
readonly path: RegExp;
|
|
122
|
+
};
|
|
75
123
|
readonly "google.sheets.spreadsheet.get": {
|
|
76
124
|
readonly access: "read";
|
|
77
125
|
readonly host: "sheets.googleapis.com";
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Junior acts as its own Google Workspace account. A Junior admin connects
|
|
5
5
|
* that account out of band, through the dashboard Admin page or the CLI.
|
|
6
|
-
* Calendar, Docs, Sheets, and Slides tools use host-owned
|
|
7
|
-
* sandbox gets no Google credential.
|
|
6
|
+
* Calendar, Docs, Sheets, and Slides tools and link cards use host-owned
|
|
7
|
+
* egress, and the sandbox gets no Google credential.
|
|
8
8
|
*/
|
|
9
9
|
import { type PluginRegistration } from "@sentry/junior-plugin-api";
|
|
10
10
|
/** Register Junior's Google Workspace plugin. */
|