@protobase/cli 0.71.0 → 0.71.1
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/cli/package.js
CHANGED
|
@@ -4,7 +4,8 @@ import { AdminAuth } from "@protobase/server";
|
|
|
4
4
|
* The sign-in of the project in `projectDir`, built from its config's `auth` over DATABASE_URL, with only the plugins
|
|
5
5
|
* it turns on. With a device or history store of the app's own (notifications/store.ts, notifications/history-store.ts),
|
|
6
6
|
* deleting a user removes their devices or history from it too; the built-in tables go with the user by their foreign
|
|
7
|
-
* keys.
|
|
7
|
+
* keys. With workflows, deleting a user revokes their connected accounts and parks the triggers on them, as the app
|
|
8
|
+
* does, reporting a token it left valid on stderr.
|
|
8
9
|
*/
|
|
9
10
|
export declare const loadProjectAuth: (projectDir: string) => Promise<AdminAuth>;
|
|
10
11
|
//#endregion
|
package/dist/users/load-auth.js
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import { loadNearestEnvFile } from "../dev/env.js";
|
|
2
|
-
import { projectNotifications } from "../config/project-parts.js";
|
|
2
|
+
import { projectNotifications, projectWorkflows } from "../config/project-parts.js";
|
|
3
3
|
import { projectAuth } from "../config/build-project.js";
|
|
4
4
|
import { loadSourceConfig } from "../config/source-config.js";
|
|
5
5
|
import { openAppDatabase } from "../project/pg-db.js";
|
|
6
6
|
import pg from "pg";
|
|
7
|
-
import { removeDevicesWithUsers, removeHistoryWithUsers } from "@protobase/server";
|
|
7
|
+
import { releaseConnectionsWithUsers, removeDevicesWithUsers, removeHistoryWithUsers } from "@protobase/server";
|
|
8
8
|
//#region src/users/load-auth.ts
|
|
9
9
|
/**
|
|
10
10
|
* The sign-in of the project in `projectDir`, built from its config's `auth` over DATABASE_URL, with only the plugins
|
|
11
11
|
* it turns on. With a device or history store of the app's own (notifications/store.ts, notifications/history-store.ts),
|
|
12
12
|
* deleting a user removes their devices or history from it too; the built-in tables go with the user by their foreign
|
|
13
|
-
* keys.
|
|
13
|
+
* keys. With workflows, deleting a user revokes their connected accounts and parks the triggers on them, as the app
|
|
14
|
+
* does, reporting a token it left valid on stderr.
|
|
14
15
|
*/
|
|
15
16
|
const loadProjectAuth = async (projectDir) => {
|
|
16
17
|
loadNearestEnvFile(projectDir);
|
|
17
18
|
const config = await loadSourceConfig(projectDir, { command: "tool" });
|
|
18
19
|
if (!config.auth) throw new Error("Sign-in is off (`auth: false` in the config), so the app has no users to manage");
|
|
19
20
|
if (!process.env.DATABASE_URL) throw new Error("No database: set DATABASE_URL");
|
|
20
|
-
const
|
|
21
|
+
const database = openAppDatabase(pg, process.env.DATABASE_URL);
|
|
22
|
+
const [workflows, notifications] = await Promise.all([projectWorkflows(config), projectNotifications(config)]);
|
|
23
|
+
const auth = await projectAuth(config, database, workflows);
|
|
24
|
+
if (workflows) releaseConnectionsWithUsers(auth, workflows, {
|
|
25
|
+
db: database.db,
|
|
26
|
+
report: (error) => void process.stderr.write(`${error.message}\n`)
|
|
27
|
+
});
|
|
21
28
|
if (notifications?.store) removeDevicesWithUsers(auth, notifications.store);
|
|
22
29
|
if (notifications?.historyStore) removeHistoryWithUsers(auth, notifications.historyStore);
|
|
23
30
|
return auth;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.71.
|
|
3
|
+
"version": "0.71.1",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@better-auth/core": "^1.7.12",
|
|
45
45
|
"@hono/node-server": "^2.1.3",
|
|
46
|
-
"@protobase/config": "0.71.
|
|
47
|
-
"@protobase/layout": "0.71.
|
|
48
|
-
"@protobase/query": "0.71.
|
|
49
|
-
"@protobase/schema": "0.71.
|
|
50
|
-
"@protobase/server": "0.71.
|
|
51
|
-
"@protobase/ui": "0.71.
|
|
52
|
-
"@protobase/workflows": "0.71.
|
|
46
|
+
"@protobase/config": "0.71.1",
|
|
47
|
+
"@protobase/layout": "0.71.1",
|
|
48
|
+
"@protobase/query": "0.71.1",
|
|
49
|
+
"@protobase/schema": "0.71.1",
|
|
50
|
+
"@protobase/server": "0.71.1",
|
|
51
|
+
"@protobase/ui": "0.71.1",
|
|
52
|
+
"@protobase/workflows": "0.71.1",
|
|
53
53
|
"@react-email/render": "^2.1.0",
|
|
54
54
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
55
55
|
"@sentry/vite-plugin": "^11.10.0",
|
|
@@ -223,7 +223,7 @@ A save also refuses a Task that leaves out an argument its step type needs, such
|
|
|
223
223
|
Each connected account belongs to the person who connected it, and only that person can turn on a workflow that uses it.
|
|
224
224
|
:::
|
|
225
225
|
|
|
226
|
-
A trigger or step type that signs in to another service, such as a mailbox, uses an account that someone connected. Each person connects their own accounts on the **Connections** section of the account page's Profile tab. Connecting takes them to the provider and back. Under each account, the section links each workflow that uses it: those the person turned on, whose enabled version binds the account, while they may still change them. The app keeps the account's tokens on the server, encrypted, and refreshes them when they expire. **Disconnect** first makes the triggers on the account wait for a new sign-in, then asks the provider to revoke the token when the connection has a revocation endpoint, and then deletes the account, so no step or trigger can use the token again, even one that was fetching it at that moment. The answer's `revocation` says what became of the token: `revoked` when the provider took it, `queued` when it did not answer or refused, and `not_revoked` when the connection has no revocation endpoint or the token could not be revoked or queued, as when it no longer decrypts with the app's secret; the section shows it. A queued token is tried again later, waiting from a minute up to an hour between tries, ten tries in all. Until then it keeps the token encrypted with the app's secret, in the workflows schema's `connection_revocations`, and drops it once the provider takes it, after the last try, or once the app's secret no longer decrypts it. A provider that never takes it keeps the token valid on its side. When stopping the triggers or deleting the account fails, disconnecting answers that error and keeps the account, and disconnecting again finishes the job. It answers `503` (`CONNECTIONS_STARTING`) and keeps the account while the workflows have not started. Its refusals come in the language the request asks for. <gap>Connection refusals from the auth endpoints cannot follow the app's `locale` setting because passing it to the auth instance, which is made before the app's options, is not implemented.</gap> The auth endpoint `/unlink-account` refuses an account that Connections lists (`403`, `CONNECTION_UNLINK_REFUSED`): disconnect it there. Connecting again makes a new account with a new id: bind it in the workflow's `connections` and turn the workflow on again. Revoking at Google ends everything the account allowed the app, the sign-in and a linked mailbox included, and the dialog says so.
|
|
226
|
+
A trigger or step type that signs in to another service, such as a mailbox, uses an account that someone connected. Each person connects their own accounts on the **Connections** section of the account page's Profile tab. Connecting takes them to the provider and back. Under each account, the section links each workflow that uses it: those the person turned on, whose enabled version binds the account, while they may still change them. The app keeps the account's tokens on the server, encrypted, and refreshes them when they expire. **Disconnect** first makes the triggers on the account wait for a new sign-in, then asks the provider to revoke the token when the connection has a revocation endpoint, and then deletes the account, so no step or trigger can use the token again, even one that was fetching it at that moment. The answer's `revocation` says what became of the token: `revoked` when the provider took it, `queued` when it did not answer or refused, and `not_revoked` when the connection has no revocation endpoint or the token could not be revoked or queued, as when it no longer decrypts with the app's secret; the section shows it. A queued token is tried again later, waiting from a minute up to an hour between tries, ten tries in all. Until then it keeps the token encrypted with the app's secret, in the workflows schema's `connection_revocations`, and drops it once the provider takes it, after the last try, or once the app's secret no longer decrypts it. A provider that never takes it keeps the token valid on its side. When stopping the triggers or deleting the account fails, disconnecting answers that error and keeps the account, and disconnecting again finishes the job. It answers `503` (`CONNECTIONS_STARTING`) and keeps the account while the workflows have not started. Deleting a user, by an admin, by themselves or with `protobase users delete`, does the same for each of their connected accounts before the user goes; when it cannot, as while the workflows have not started, the user and their accounts stay, and deleting them again finishes the job. <gap>A user deletion refused while the workflows start cannot answer in the language the request asks for because passing the request to the user-deletion listeners is not implemented.</gap> Its refusals come in the language the request asks for. <gap>Connection refusals from the auth endpoints cannot follow the app's `locale` setting because passing it to the auth instance, which is made before the app's options, is not implemented.</gap> The auth endpoint `/unlink-account` refuses an account that Connections lists (`403`, `CONNECTION_UNLINK_REFUSED`): disconnect it there. Connecting again makes a new account with a new id: bind it in the workflow's `connections` and turn the workflow on again. Revoking at Google ends everything the account allowed the app, the sign-in and a linked mailbox included, and the dialog says so.
|
|
227
227
|
|
|
228
228
|
A workflow names the account each of its connections uses in its definition's `connections`, by `<plugin>:<connection>` and the account's id, which the Connections section shows, as does `list_connections` [over MCP](mcp.md#workflows):
|
|
229
229
|
|