@sentry/junior-google 0.302.0 → 0.304.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/dist/index.d.ts +2 -2
- package/dist/index.js +3639 -3892
- package/package.json +9 -12
- package/dist/cli.d.ts +0 -3
- package/dist/config.d.ts +0 -49
- package/dist/credentials.d.ts +0 -153
- package/dist/db/schema.d.ts +0 -98
- package/dist/links/calendar.d.ts +0 -11
- package/dist/links/files.d.ts +0 -47
- package/dist/links/summary.d.ts +0 -13
- package/dist/links/thumbnails.d.ts +0 -8
- package/dist/oauth.d.ts +0 -47
- package/dist/setup-routes.d.ts +0 -25
- package/dist/store.d.ts +0 -22
- package/dist/tools/cancel-event.d.ts +0 -316
- package/dist/tools/create-doc.d.ts +0 -294
- package/dist/tools/create-event.d.ts +0 -342
- package/dist/tools/doc-edits.d.ts +0 -84
- package/dist/tools/doc-markdown.d.ts +0 -40
- package/dist/tools/files.d.ts +0 -94
- package/dist/tools/find-meeting-times.d.ts +0 -386
- package/dist/tools/insert-doc-content.d.ts +0 -288
- package/dist/tools/list-events.d.ts +0 -329
- package/dist/tools/list-file-comments.d.ts +0 -310
- package/dist/tools/read-doc.d.ts +0 -19
- package/dist/tools/read-file.d.ts +0 -323
- package/dist/tools/read-meeting-transcript.d.ts +0 -306
- package/dist/tools/read-sheet.d.ts +0 -27
- package/dist/tools/read-slides.d.ts +0 -27
- package/dist/tools/replace-doc-content.d.ts +0 -287
- package/dist/tools/replace-doc-text.d.ts +0 -291
- package/dist/tools/search-files.d.ts +0 -300
- package/dist/tools/shared.d.ts +0 -323
- package/dist/tools/update-event.d.ts +0 -321
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-google",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.304.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,28 +22,25 @@
|
|
|
22
22
|
"migrations"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@sentry/junior-plugin-api": "0.304.0",
|
|
25
26
|
"commander": "^14.0.3",
|
|
26
27
|
"drizzle-orm": "^0.45.4",
|
|
27
28
|
"parse5": "^7.3.0",
|
|
28
|
-
"zod": "^4.6.7"
|
|
29
|
-
"@sentry/junior-plugin-api": "0.302.0"
|
|
29
|
+
"zod": "^4.6.7"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@types/node": "^
|
|
32
|
+
"@sentry/junior-testing": "0.0.0",
|
|
33
|
+
"@types/node": "^24.19.2",
|
|
34
34
|
"@types/pg": "^8.15.6",
|
|
35
35
|
"drizzle-kit": "^0.31.8",
|
|
36
|
-
"oxlint": "^1.79.0",
|
|
37
36
|
"pg": "^8.16.3",
|
|
38
|
-
"
|
|
39
|
-
"typescript": "
|
|
40
|
-
"vitest": "^4.1.12"
|
|
41
|
-
"@sentry/junior-testing": "0.0.0"
|
|
37
|
+
"tsdown": "0.23.7",
|
|
38
|
+
"typescript": "7.0.2",
|
|
39
|
+
"vitest": "^4.1.12"
|
|
42
40
|
},
|
|
43
41
|
"scripts": {
|
|
44
|
-
"build": "
|
|
42
|
+
"build": "tsdown",
|
|
45
43
|
"db:generate": "pnpm exec drizzle-kit generate --config drizzle.config.ts",
|
|
46
|
-
"lint": "oxlint --config ../junior/.oxlintrc.json --deny-warnings src tests tsup.config.ts vitest.config.ts",
|
|
47
44
|
"test": "vitest run",
|
|
48
45
|
"typecheck": "tsc --noEmit"
|
|
49
46
|
}
|
package/dist/cli.d.ts
DELETED
package/dist/config.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deployment configuration for the Google plugin.
|
|
3
|
-
*
|
|
4
|
-
* Values come from host environment variables. They never reach the sandbox.
|
|
5
|
-
*/
|
|
6
|
-
/** Dashboard sign-in uses the same OAuth client. */
|
|
7
|
-
export declare const GOOGLE_CLIENT_ID_ENV = "GOOGLE_CLIENT_ID";
|
|
8
|
-
export declare const GOOGLE_CLIENT_SECRET_ENV = "GOOGLE_CLIENT_SECRET";
|
|
9
|
-
export declare const GOOGLE_ACCOUNT_EMAIL_ENV = "GOOGLE_WORKSPACE_ACCOUNT_EMAIL";
|
|
10
|
-
export declare const GOOGLE_ALLOWED_DOMAINS_ENV = "GOOGLE_WORKSPACE_ALLOWED_DOMAINS";
|
|
11
|
-
/**
|
|
12
|
-
* API scopes the tools need. A connected grant must have all of them. Request
|
|
13
|
-
* nothing broader.
|
|
14
|
-
*
|
|
15
|
-
* - `calendar.events.freebusy`: availability for `findMeetingTimes`.
|
|
16
|
-
* - `calendar.events.readonly`: events that Junior's account can see on other
|
|
17
|
-
* people's calendars, for `listCalendarEvents`. Google sharing settings
|
|
18
|
-
* still decide how much detail each calendar shows.
|
|
19
|
-
* - `calendar.events.owned`: create and change events on Junior's own
|
|
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.
|
|
28
|
-
* - `drive.readonly`: search Drive, export Docs, read Sheets and Slides, and
|
|
29
|
-
* read comments. The Drive comments API accepts no narrower read scope. The
|
|
30
|
-
* Sheets and Slides APIs also accept this scope.
|
|
31
|
-
*/
|
|
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"];
|
|
33
|
-
/** Identity scopes used only to verify which account signed in. */
|
|
34
|
-
export declare const GOOGLE_IDENTITY_SCOPES: readonly ["openid", "email"];
|
|
35
|
-
export interface GoogleConfig {
|
|
36
|
-
/** The Workspace account Junior acts as, for example `junior@sentry.io`. */
|
|
37
|
-
accountEmail: string;
|
|
38
|
-
/** Domains Junior may check availability for and invite. */
|
|
39
|
-
allowedDomains: string[];
|
|
40
|
-
clientId: string;
|
|
41
|
-
clientSecret: string;
|
|
42
|
-
}
|
|
43
|
-
/** Return the email domain in lowercase, or undefined for a malformed email. */
|
|
44
|
-
export declare function emailDomain(email: string): string | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Read the Google plugin configuration, or undefined when the deployment does
|
|
47
|
-
* not configure the plugin.
|
|
48
|
-
*/
|
|
49
|
-
export declare function readGoogleConfig(): GoogleConfig | undefined;
|
package/dist/credentials.d.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Credential issuing and egress policy for Google APIs.
|
|
3
|
-
*
|
|
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
|
-
*/
|
|
8
|
-
import { type EgressHookContext, type IssueCredentialHookContext, type PluginContext, type PluginCredentialResult, type PluginGrant } from "@sentry/junior-plugin-api";
|
|
9
|
-
import { type GoogleConfig } from "./config";
|
|
10
|
-
/** Calendar and Drive API host. */
|
|
11
|
-
export declare const GOOGLE_API_DOMAIN = "www.googleapis.com";
|
|
12
|
-
/** Every host that receives Junior's Google access token. */
|
|
13
|
-
export declare const GOOGLE_API_DOMAINS: string[];
|
|
14
|
-
/** Google API operations that plugin tools may perform. */
|
|
15
|
-
export declare const GOOGLE_OPERATIONS: {
|
|
16
|
-
readonly "google.calendar.event.create": {
|
|
17
|
-
readonly access: "write";
|
|
18
|
-
readonly host: "www.googleapis.com";
|
|
19
|
-
readonly method: "POST";
|
|
20
|
-
readonly path: RegExp;
|
|
21
|
-
};
|
|
22
|
-
readonly "google.calendar.event.delete": {
|
|
23
|
-
readonly access: "write";
|
|
24
|
-
readonly host: "www.googleapis.com";
|
|
25
|
-
readonly method: "DELETE";
|
|
26
|
-
readonly path: RegExp;
|
|
27
|
-
};
|
|
28
|
-
readonly "google.calendar.event.get": {
|
|
29
|
-
readonly access: "read";
|
|
30
|
-
readonly host: "www.googleapis.com";
|
|
31
|
-
readonly method: "GET";
|
|
32
|
-
readonly path: RegExp;
|
|
33
|
-
};
|
|
34
|
-
readonly "google.calendar.event.update": {
|
|
35
|
-
readonly access: "write";
|
|
36
|
-
readonly host: "www.googleapis.com";
|
|
37
|
-
readonly method: "PATCH";
|
|
38
|
-
readonly path: RegExp;
|
|
39
|
-
};
|
|
40
|
-
readonly "google.calendar.events.list": {
|
|
41
|
-
readonly access: "read";
|
|
42
|
-
readonly host: "www.googleapis.com";
|
|
43
|
-
readonly method: "GET";
|
|
44
|
-
readonly path: RegExp;
|
|
45
|
-
};
|
|
46
|
-
readonly "google.calendar.freebusy.query": {
|
|
47
|
-
readonly access: "read";
|
|
48
|
-
readonly host: "www.googleapis.com";
|
|
49
|
-
readonly method: "POST";
|
|
50
|
-
readonly path: RegExp;
|
|
51
|
-
};
|
|
52
|
-
readonly "google.docs.document.batchUpdate": {
|
|
53
|
-
readonly access: "write";
|
|
54
|
-
readonly host: "docs.googleapis.com";
|
|
55
|
-
readonly method: "POST";
|
|
56
|
-
readonly path: RegExp;
|
|
57
|
-
};
|
|
58
|
-
readonly "google.docs.document.create": {
|
|
59
|
-
readonly access: "write";
|
|
60
|
-
readonly host: "docs.googleapis.com";
|
|
61
|
-
readonly method: "POST";
|
|
62
|
-
readonly path: RegExp;
|
|
63
|
-
};
|
|
64
|
-
readonly "google.docs.document.get": {
|
|
65
|
-
readonly access: "read";
|
|
66
|
-
readonly host: "docs.googleapis.com";
|
|
67
|
-
readonly method: "GET";
|
|
68
|
-
readonly path: RegExp;
|
|
69
|
-
};
|
|
70
|
-
readonly "google.drive.about.get": {
|
|
71
|
-
readonly access: "read";
|
|
72
|
-
readonly host: "www.googleapis.com";
|
|
73
|
-
readonly method: "GET";
|
|
74
|
-
readonly path: RegExp;
|
|
75
|
-
};
|
|
76
|
-
readonly "google.drive.comments.list": {
|
|
77
|
-
readonly access: "read";
|
|
78
|
-
readonly host: "www.googleapis.com";
|
|
79
|
-
readonly method: "GET";
|
|
80
|
-
readonly path: RegExp;
|
|
81
|
-
};
|
|
82
|
-
readonly "google.drive.file.export": {
|
|
83
|
-
readonly access: "read";
|
|
84
|
-
readonly host: "www.googleapis.com";
|
|
85
|
-
readonly method: "GET";
|
|
86
|
-
readonly path: RegExp;
|
|
87
|
-
};
|
|
88
|
-
readonly "google.drive.file.get": {
|
|
89
|
-
readonly access: "read";
|
|
90
|
-
readonly host: "www.googleapis.com";
|
|
91
|
-
readonly method: "GET";
|
|
92
|
-
readonly path: RegExp;
|
|
93
|
-
};
|
|
94
|
-
readonly "google.drive.files.list": {
|
|
95
|
-
readonly access: "read";
|
|
96
|
-
readonly host: "www.googleapis.com";
|
|
97
|
-
readonly method: "GET";
|
|
98
|
-
readonly path: RegExp;
|
|
99
|
-
};
|
|
100
|
-
readonly "google.drive.permission.create": {
|
|
101
|
-
readonly access: "write";
|
|
102
|
-
readonly host: "www.googleapis.com";
|
|
103
|
-
readonly method: "POST";
|
|
104
|
-
readonly path: RegExp;
|
|
105
|
-
};
|
|
106
|
-
readonly "google.drive.file.delete": {
|
|
107
|
-
readonly access: "write";
|
|
108
|
-
readonly host: "www.googleapis.com";
|
|
109
|
-
readonly method: "DELETE";
|
|
110
|
-
readonly path: RegExp;
|
|
111
|
-
};
|
|
112
|
-
readonly "google.drive.permission.delete": {
|
|
113
|
-
readonly access: "write";
|
|
114
|
-
readonly host: "www.googleapis.com";
|
|
115
|
-
readonly method: "DELETE";
|
|
116
|
-
readonly path: RegExp;
|
|
117
|
-
};
|
|
118
|
-
readonly "google.drive.permissions.list": {
|
|
119
|
-
readonly access: "read";
|
|
120
|
-
readonly host: "www.googleapis.com";
|
|
121
|
-
readonly method: "GET";
|
|
122
|
-
readonly path: RegExp;
|
|
123
|
-
};
|
|
124
|
-
readonly "google.sheets.spreadsheet.get": {
|
|
125
|
-
readonly access: "read";
|
|
126
|
-
readonly host: "sheets.googleapis.com";
|
|
127
|
-
readonly method: "GET";
|
|
128
|
-
readonly path: RegExp;
|
|
129
|
-
};
|
|
130
|
-
readonly "google.sheets.values.batchGet": {
|
|
131
|
-
readonly access: "read";
|
|
132
|
-
readonly host: "sheets.googleapis.com";
|
|
133
|
-
readonly method: "GET";
|
|
134
|
-
readonly path: RegExp;
|
|
135
|
-
};
|
|
136
|
-
readonly "google.slides.presentation.get": {
|
|
137
|
-
readonly access: "read";
|
|
138
|
-
readonly host: "slides.googleapis.com";
|
|
139
|
-
readonly method: "GET";
|
|
140
|
-
readonly path: RegExp;
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
export type GoogleOperation = keyof typeof GOOGLE_OPERATIONS;
|
|
144
|
-
/** Select the grant for one Google request, or deny it. */
|
|
145
|
-
export declare function googleGrantForEgress(ctx: EgressHookContext): PluginGrant;
|
|
146
|
-
/**
|
|
147
|
-
* Return a fresh access token for Junior's Google account, for a request
|
|
148
|
-
* that cannot go through egress, such as a Drive thumbnail that the image
|
|
149
|
-
* proxy fetches. Return nothing when the account is not connected.
|
|
150
|
-
*/
|
|
151
|
-
export declare function readGoogleAccessToken(ctx: Pick<PluginContext, "db" | "log">, config: GoogleConfig): Promise<string | undefined>;
|
|
152
|
-
/** Mint a short-lived access token for Junior's Google account. */
|
|
153
|
-
export declare function issueGoogleCredential(ctx: IssueCredentialHookContext): Promise<PluginCredentialResult>;
|
package/dist/db/schema.d.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Google accounts that Junior acts as.
|
|
3
|
-
*
|
|
4
|
-
* One row per connected account email. The refresh token is a long-lived
|
|
5
|
-
* secret: never log it, return it from routes, or expose it to the sandbox.
|
|
6
|
-
*/
|
|
7
|
-
export declare const juniorGoogleAccounts: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
8
|
-
name: "junior_google_accounts";
|
|
9
|
-
schema: undefined;
|
|
10
|
-
columns: {
|
|
11
|
-
accountEmail: import("drizzle-orm/pg-core").PgColumn<{
|
|
12
|
-
name: "account_email";
|
|
13
|
-
tableName: "junior_google_accounts";
|
|
14
|
-
dataType: "string";
|
|
15
|
-
columnType: "PgText";
|
|
16
|
-
data: string;
|
|
17
|
-
driverParam: string;
|
|
18
|
-
notNull: true;
|
|
19
|
-
hasDefault: false;
|
|
20
|
-
isPrimaryKey: true;
|
|
21
|
-
isAutoincrement: false;
|
|
22
|
-
hasRuntimeDefault: false;
|
|
23
|
-
enumValues: [string, ...string[]];
|
|
24
|
-
baseColumn: never;
|
|
25
|
-
identity: undefined;
|
|
26
|
-
generated: undefined;
|
|
27
|
-
}, {}, {}>;
|
|
28
|
-
refreshToken: import("drizzle-orm/pg-core").PgColumn<{
|
|
29
|
-
name: "refresh_token";
|
|
30
|
-
tableName: "junior_google_accounts";
|
|
31
|
-
dataType: "string";
|
|
32
|
-
columnType: "PgText";
|
|
33
|
-
data: string;
|
|
34
|
-
driverParam: string;
|
|
35
|
-
notNull: true;
|
|
36
|
-
hasDefault: false;
|
|
37
|
-
isPrimaryKey: false;
|
|
38
|
-
isAutoincrement: false;
|
|
39
|
-
hasRuntimeDefault: false;
|
|
40
|
-
enumValues: [string, ...string[]];
|
|
41
|
-
baseColumn: never;
|
|
42
|
-
identity: undefined;
|
|
43
|
-
generated: undefined;
|
|
44
|
-
}, {}, {}>;
|
|
45
|
-
scope: import("drizzle-orm/pg-core").PgColumn<{
|
|
46
|
-
name: "scope";
|
|
47
|
-
tableName: "junior_google_accounts";
|
|
48
|
-
dataType: "string";
|
|
49
|
-
columnType: "PgText";
|
|
50
|
-
data: string;
|
|
51
|
-
driverParam: string;
|
|
52
|
-
notNull: true;
|
|
53
|
-
hasDefault: false;
|
|
54
|
-
isPrimaryKey: false;
|
|
55
|
-
isAutoincrement: false;
|
|
56
|
-
hasRuntimeDefault: false;
|
|
57
|
-
enumValues: [string, ...string[]];
|
|
58
|
-
baseColumn: never;
|
|
59
|
-
identity: undefined;
|
|
60
|
-
generated: undefined;
|
|
61
|
-
}, {}, {}>;
|
|
62
|
-
connectedBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
63
|
-
name: "connected_by";
|
|
64
|
-
tableName: "junior_google_accounts";
|
|
65
|
-
dataType: "string";
|
|
66
|
-
columnType: "PgText";
|
|
67
|
-
data: string;
|
|
68
|
-
driverParam: string;
|
|
69
|
-
notNull: true;
|
|
70
|
-
hasDefault: false;
|
|
71
|
-
isPrimaryKey: false;
|
|
72
|
-
isAutoincrement: false;
|
|
73
|
-
hasRuntimeDefault: false;
|
|
74
|
-
enumValues: [string, ...string[]];
|
|
75
|
-
baseColumn: never;
|
|
76
|
-
identity: undefined;
|
|
77
|
-
generated: undefined;
|
|
78
|
-
}, {}, {}>;
|
|
79
|
-
connectedAtMs: import("drizzle-orm/pg-core").PgColumn<{
|
|
80
|
-
name: "connected_at_ms";
|
|
81
|
-
tableName: "junior_google_accounts";
|
|
82
|
-
dataType: "number";
|
|
83
|
-
columnType: "PgBigInt53";
|
|
84
|
-
data: number;
|
|
85
|
-
driverParam: string | number;
|
|
86
|
-
notNull: true;
|
|
87
|
-
hasDefault: false;
|
|
88
|
-
isPrimaryKey: false;
|
|
89
|
-
isAutoincrement: false;
|
|
90
|
-
hasRuntimeDefault: false;
|
|
91
|
-
enumValues: undefined;
|
|
92
|
-
baseColumn: never;
|
|
93
|
-
identity: undefined;
|
|
94
|
-
generated: undefined;
|
|
95
|
-
}, {}, {}>;
|
|
96
|
-
};
|
|
97
|
-
dialect: 'pg';
|
|
98
|
-
}>;
|
package/dist/links/calendar.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Link cards for Google Calendar events.
|
|
3
|
-
*
|
|
4
|
-
* Junior's own Google account reads the event from its own calendar, so the
|
|
5
|
-
* card shows only when the viewer organizes, created, or is invited to the
|
|
6
|
-
* event. Any unclear case gets no card. The card shows the title, the time,
|
|
7
|
-
* and the start of the description, never the guests.
|
|
8
|
-
*/
|
|
9
|
-
import type { PluginObjectLinkDefinition } from "@sentry/junior-plugin-api";
|
|
10
|
-
/** Google Calendar event links that resolve to Calendar event cards. */
|
|
11
|
-
export declare const googleCalendarLinks: PluginObjectLinkDefinition;
|
package/dist/links/files.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Link cards for Google Docs, Sheets, and Slides, and for Drive files and
|
|
3
|
-
* folders.
|
|
4
|
-
*
|
|
5
|
-
* Junior's own Google account reads the file, so the card shows only when
|
|
6
|
-
* Drive says that the viewer can open it too. This is the rule of
|
|
7
|
-
* `searchGoogleFiles`. Any unclear case gets no card. A Doc card also shows
|
|
8
|
-
* its first paragraph.
|
|
9
|
-
*/
|
|
10
|
-
import type { ObjectLinkContext, PluginObjectLinkDefinition } from "@sentry/junior-plugin-api";
|
|
11
|
-
import * as z from "zod";
|
|
12
|
-
import { type FileReference } from "../tools/files";
|
|
13
|
-
declare const linkedFileSchema: z.ZodObject<{
|
|
14
|
-
driveId: z.ZodOptional<z.ZodString>;
|
|
15
|
-
id: z.ZodString;
|
|
16
|
-
mimeType: z.ZodString;
|
|
17
|
-
modifiedTime: z.ZodOptional<z.ZodString>;
|
|
18
|
-
name: z.ZodString;
|
|
19
|
-
owners: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
20
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
21
|
-
emailAddress: z.ZodOptional<z.ZodString>;
|
|
22
|
-
}, z.core.$strip>>>;
|
|
23
|
-
thumbnailLink: z.ZodOptional<z.ZodString>;
|
|
24
|
-
trashed: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
-
}, z.core.$strip>;
|
|
26
|
-
type LinkedFile = z.infer<typeof linkedFileSchema>;
|
|
27
|
-
/** What a card or an image read needs to check one viewer. */
|
|
28
|
-
type ViewerReadContext = Pick<ObjectLinkContext, "egress" | "viewer">;
|
|
29
|
-
/** A file that a link names, and the Drive MIME types that the link fits. */
|
|
30
|
-
interface FileLink {
|
|
31
|
-
accepts(mimeType: string): boolean;
|
|
32
|
-
file: FileReference;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Read a file that the viewer can open in Drive, with no cache. Return
|
|
36
|
-
* nothing when Junior's account cannot read it, the link does not fit its
|
|
37
|
-
* type, it is in the trash, or the viewer cannot open it.
|
|
38
|
-
*/
|
|
39
|
-
export declare function readViewerFile(ctx: ViewerReadContext, link: FileLink, allowedDomains: string[]): Promise<LinkedFile | undefined>;
|
|
40
|
-
/** Return the file link of a thumbnail image ref. */
|
|
41
|
-
export declare function thumbnailFileLink(ref: string): FileLink | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Docs, Sheets, and Slides links, and Drive file and folder links, that
|
|
44
|
-
* resolve to document cards.
|
|
45
|
-
*/
|
|
46
|
-
export declare const googleFileLinks: PluginObjectLinkDefinition;
|
|
47
|
-
export {};
|
package/dist/links/summary.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type ObjectLinkContext } from "@sentry/junior-plugin-api";
|
|
2
|
-
import { type FileReference } from "../tools/files";
|
|
3
|
-
/**
|
|
4
|
-
* Make a card summary from a Calendar event description. Calendar stores
|
|
5
|
-
* descriptions as HTML or plain text, so parse it and keep only the text.
|
|
6
|
-
*/
|
|
7
|
-
export declare function htmlSummary(html: string | undefined): string | undefined;
|
|
8
|
-
/**
|
|
9
|
-
* Read the first body paragraph of a Doc as a card summary. Call it only
|
|
10
|
-
* after the viewer may open the Doc. A Docs API failure gives no summary,
|
|
11
|
-
* so the card still shows.
|
|
12
|
-
*/
|
|
13
|
-
export declare function docSummary(ctx: ObjectLinkContext, file: FileReference): Promise<string | undefined>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Drive file thumbnails for link cards, served through the Junior image
|
|
3
|
-
* proxy. Each read checks the viewer again with the link card rule, and
|
|
4
|
-
* Junior's Google credential goes only to Google's thumbnail host.
|
|
5
|
-
*/
|
|
6
|
-
import type { PluginImageSource } from "@sentry/junior-plugin-api";
|
|
7
|
-
/** Drive thumbnails that link cards show. */
|
|
8
|
-
export declare const googleImages: PluginImageSource;
|
package/dist/oauth.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { type GoogleConfig } from "./config";
|
|
2
|
-
import { type GoogleDb } from "./store";
|
|
3
|
-
/** A sign-in attempt failed in a way that is safe to show to the admin. */
|
|
4
|
-
export declare class GoogleConnectError extends Error {
|
|
5
|
-
name: string;
|
|
6
|
-
}
|
|
7
|
-
/** One pending sign-in: the state and PKCE verifier the callback must match. */
|
|
8
|
-
export interface GoogleSignInRequest {
|
|
9
|
-
codeVerifier: string;
|
|
10
|
-
state: string;
|
|
11
|
-
}
|
|
12
|
-
/** Create the random state and PKCE verifier for one sign-in attempt. */
|
|
13
|
-
export declare function createGoogleSignInRequest(): GoogleSignInRequest;
|
|
14
|
-
/** Build the Google consent URL for the configured Junior account. */
|
|
15
|
-
export declare function googleAuthorizationUrl(input: {
|
|
16
|
-
config: GoogleConfig;
|
|
17
|
-
redirectUri: string;
|
|
18
|
-
request: GoogleSignInRequest;
|
|
19
|
-
}): string;
|
|
20
|
-
/**
|
|
21
|
-
* Exchange an authorization code, verify the account and scopes, and store the
|
|
22
|
-
* refresh token. A grant that fails a check is revoked and never stored.
|
|
23
|
-
*/
|
|
24
|
-
export declare function connectGoogleAccount(input: {
|
|
25
|
-
code: string;
|
|
26
|
-
codeVerifier: string;
|
|
27
|
-
config: GoogleConfig;
|
|
28
|
-
connectedBy: string;
|
|
29
|
-
db: GoogleDb;
|
|
30
|
-
redirectUri: string;
|
|
31
|
-
}): Promise<{
|
|
32
|
-
accountEmail: string;
|
|
33
|
-
scope: string;
|
|
34
|
-
}>;
|
|
35
|
-
/**
|
|
36
|
-
* Exchange the stored refresh token for a short-lived access token.
|
|
37
|
-
*
|
|
38
|
-
* Returns undefined when Google rejects the refresh token (`invalid_grant`),
|
|
39
|
-
* which means an admin must reconnect the account.
|
|
40
|
-
*/
|
|
41
|
-
export declare function refreshGoogleAccessToken(input: {
|
|
42
|
-
config: GoogleConfig;
|
|
43
|
-
refreshToken: string;
|
|
44
|
-
}): Promise<{
|
|
45
|
-
accessToken: string;
|
|
46
|
-
expiresAtMs: number;
|
|
47
|
-
} | undefined>;
|
package/dist/setup-routes.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Admin-only setup for the Google account that Junior acts as.
|
|
3
|
-
*
|
|
4
|
-
* The dashboard Admin page lists `createGoogleSetupPage()` for Junior admins.
|
|
5
|
-
* Its Connect link opens the sign-in routes below, which mount under Junior's
|
|
6
|
-
* authenticated plugin namespace, `/api/plugins/google`. Every route checks
|
|
7
|
-
* the Junior admin role on the server. Google consent must come from the
|
|
8
|
-
* configured account itself.
|
|
9
|
-
*/
|
|
10
|
-
import type { PluginRouteApp, PluginUserPageDefinition } from "@sentry/junior-plugin-api";
|
|
11
|
-
import { type GoogleConfig } from "./config";
|
|
12
|
-
import { type GoogleDb } from "./store";
|
|
13
|
-
export declare const GOOGLE_PLUGIN_ROUTE_PREFIX = "/api/plugins/google";
|
|
14
|
-
/** Public URL of this plugin's OAuth callback. */
|
|
15
|
-
export declare function googleCallbackUrl(request: Request): string;
|
|
16
|
-
/** Create the admin-only Google sign-in routes. */
|
|
17
|
-
export declare function createGoogleSetupRoutes(input: {
|
|
18
|
-
config: GoogleConfig;
|
|
19
|
-
db: GoogleDb;
|
|
20
|
-
}): PluginRouteApp;
|
|
21
|
-
/**
|
|
22
|
-
* Admin page that shows whether the Google account is connected and links to
|
|
23
|
-
* Google sign-in. Junior lists and serves it only to Junior admins.
|
|
24
|
-
*/
|
|
25
|
-
export declare function createGoogleSetupPage(): PluginUserPageDefinition;
|
package/dist/store.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { PgDatabase, PgQueryResultHKT } from "drizzle-orm/pg-core";
|
|
2
|
-
import * as googleSqlSchema from "./db/schema";
|
|
3
|
-
import { juniorGoogleAccounts } from "./db/schema";
|
|
4
|
-
export type GoogleDb = PgDatabase<PgQueryResultHKT, typeof googleSqlSchema>;
|
|
5
|
-
export type GoogleAccountRecord = typeof juniorGoogleAccounts.$inferSelect;
|
|
6
|
-
/** Read the stored connection for one account email. */
|
|
7
|
-
export declare function getGoogleAccount(db: GoogleDb, accountEmail: string): Promise<GoogleAccountRecord | undefined>;
|
|
8
|
-
/** Create or replace the stored connection for one account email. */
|
|
9
|
-
export declare function saveGoogleAccount(db: GoogleDb, record: GoogleAccountRecord): Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* Remove a connection after Google rejects its refresh token.
|
|
12
|
-
*
|
|
13
|
-
* The token match keeps a concurrent reconnect from being deleted.
|
|
14
|
-
*/
|
|
15
|
-
export declare function deleteRejectedGoogleAccount(db: GoogleDb, record: Pick<GoogleAccountRecord, "accountEmail" | "refreshToken">): Promise<void>;
|
|
16
|
-
/** Project a stored connection into admin-safe fields. Never includes tokens. */
|
|
17
|
-
export declare function googleAccountStatus(record: GoogleAccountRecord): {
|
|
18
|
-
accountEmail: string;
|
|
19
|
-
connectedAt: string;
|
|
20
|
-
connectedBy: string;
|
|
21
|
-
scope: string;
|
|
22
|
-
};
|