@protobase/server 0.133.4 → 0.133.6
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/better-auth/store/adoption.js +1 -1
- package/dist/better-auth/store/legacy-record.d.ts +1 -1
- package/dist/better-auth/store/legacy-record.js +2 -2
- package/dist/changes/read-capture.js +1 -1
- package/dist/comments/comments-module.js +1 -1
- package/dist/derived/derived-module.js +1 -1
- package/dist/history/history-module.js +1 -1
- package/dist/jobs/jobs-module.js +1 -1
- package/dist/mail/feedback/mail-feedback-module.js +1 -1
- package/dist/mail/unsubscribe/unsubscribes-module.js +1 -1
- package/dist/notifications/devices-module.js +1 -2
- package/dist/package.js +1 -1
- package/dist/realtime/relay/realtime-relay-module.js +1 -1
- package/dist/relay/read-relay.js +1 -1
- package/dist/user-tables/user-tables-module.js +1 -1
- package/dist/webhooks/table/delivery-log-module.js +1 -1
- package/dist/webhooks/table/webhooks-schema-module.js +1 -2
- package/dist/workflows/custom-steps/custom-steps-module.js +1 -1
- package/dist/workflows/workflows-schema-module.js +1 -1
- package/package.json +6 -6
|
@@ -88,7 +88,7 @@ const planAdoption = async (db, names) => {
|
|
|
88
88
|
});
|
|
89
89
|
problems.push(`${migration.version} ${migration.name} ${[...missing, ...otherType].join(", ")}`);
|
|
90
90
|
});
|
|
91
|
-
if (problems.length > 0) throw new Error(`The auth store an earlier Protobase made matches none of its migrations' versions: ${problems.join("; ")}
|
|
91
|
+
if (problems.length > 0) throw new Error(`The auth store an earlier Protobase made matches none of its migrations' versions: ${problems.join("; ")}.`);
|
|
92
92
|
return adoption;
|
|
93
93
|
};
|
|
94
94
|
/**
|
|
@@ -7,6 +7,6 @@ import { Kysely } from "kysely";
|
|
|
7
7
|
export declare const stepsOfVersions: (versions: readonly number[]) => AppliedStep[];
|
|
8
8
|
/** The former record of versions, in the store's schema, as the store's names named it. */
|
|
9
9
|
export declare const versionRecordTable: (names: StoreNames) => TableId;
|
|
10
|
-
/** Why a store that records its migrations by version alone, in `table`, is refused
|
|
10
|
+
/** Why a store that records its migrations by version alone, in `table`, is refused. */
|
|
11
11
|
export declare const versionRecordRefusal: (table: string) => string;
|
|
12
12
|
//#endregion
|
|
@@ -25,8 +25,8 @@ const stepsOfVersions = (versions) => {
|
|
|
25
25
|
};
|
|
26
26
|
/** The former record of versions, in the store's schema, as the store's names named it. */
|
|
27
27
|
const versionRecordTable = (names) => migrationNames(names).former(versionRecord);
|
|
28
|
-
/** Why a store that records its migrations by version alone, in `table`, is refused
|
|
29
|
-
const versionRecordRefusal = (table) => `The auth store records its migrations by version in ${table}, without auth_steps, as a Protobase before 0.130 left it
|
|
28
|
+
/** Why a store that records its migrations by version alone, in `table`, is refused. */
|
|
29
|
+
const versionRecordRefusal = (table) => `The auth store records its migrations by version in ${table}, without auth_steps, as a Protobase before 0.130 left it, which no step of this version of Protobase reads`;
|
|
30
30
|
/** Refuses a store without `auth_steps` that has the former record of versions. */
|
|
31
31
|
const refuseVersionRecord = async (db, names) => {
|
|
32
32
|
const table = versionRecordTable(names);
|
|
@@ -30,7 +30,7 @@ const readCapture = (triggers) => async (db, input) => {
|
|
|
30
30
|
const [outbox] = await rowsOf(db, sql`select to_regclass(${`${quoteIdent(schema)}."outbox"`}) is not null as found,
|
|
31
31
|
exists (select from information_schema.columns where table_schema = ${schema} and table_name = 'outbox' and column_name = 'database_role') as role`);
|
|
32
32
|
if (!outbox.found) return;
|
|
33
|
-
if (!outbox.role) throw new Error(`The outbox of the change capture in schema "${schema}" lacks its database_role column, which no step of this version of Protobase records
|
|
33
|
+
if (!outbox.role) throw new Error(`The outbox of the change capture in schema "${schema}" lacks its database_role column, which no step of this version of Protobase records`);
|
|
34
34
|
const [capture] = await rowsOf(db, sql`select p.oid::text as oid, p.prosrc as source, p.prosecdef as definer from pg_proc p join pg_namespace n on n.oid = p.pronamespace where n.nspname = ${schema} and p.proname = 'capture' and p.pronargs = 0`);
|
|
35
35
|
const current = capture && capture.definer && capture.source === captureBody(schema);
|
|
36
36
|
const found = capture ? await readTriggers(db, capture.oid) : [];
|
|
@@ -5,7 +5,7 @@ import { relationFound } from "../relation-found.js";
|
|
|
5
5
|
/** The comments table as the database has it: step 1 once it is there with every index. Refuses one without them, which no step records. */
|
|
6
6
|
const readComments = async (db) => {
|
|
7
7
|
if (!await relationFound(db, "\"comments\".\"comments\"")) return;
|
|
8
|
-
if (!await hasIndexes(db, "comments", "comments", commentsIndexes.map(([name]) => name))) throw new Error(`The comments table ${commentsTable} lacks indexes no step of this version of Protobase records
|
|
8
|
+
if (!await hasIndexes(db, "comments", "comments", commentsIndexes.map(([name]) => name))) throw new Error(`The comments table ${commentsTable} lacks indexes no step of this version of Protobase records`);
|
|
9
9
|
return {
|
|
10
10
|
lastStep: 1,
|
|
11
11
|
replaceables: {}
|
|
@@ -49,7 +49,7 @@ const readDerived = async (db, input) => {
|
|
|
49
49
|
const [found] = await rowsOf(db, sql`select to_regclass('derived.values') is not null as values,
|
|
50
50
|
to_regclass('derived.reads') is not null and to_regclass('derived.declared') is not null and to_regclass('derived.versions') is not null and to_regclass('derived.pending') is not null as complete`);
|
|
51
51
|
if (!found.values) return;
|
|
52
|
-
if (!(found.complete && await hasIndexes(db, "derived", "reads", ["reads_match", "reads_value"]) && await hasIndexes(db, "derived", "pending", ["pending_value"]))) throw new Error("The derived schema lacks its versions sequence, pending table or indexes, which no step of this version of Protobase records
|
|
52
|
+
if (!(found.complete && await hasIndexes(db, "derived", "reads", ["reads_match", "reads_value"]) && await hasIndexes(db, "derived", "pending", ["pending_value"]))) throw new Error("The derived schema lacks its versions sequence, pending table or indexes, which no step of this version of Protobase records");
|
|
53
53
|
const declared = (await rowsOf(db, sql`select "name" from "derived"."declared"`)).map((row) => row.name);
|
|
54
54
|
const given = input.resources[values.name] ?? {};
|
|
55
55
|
const entries = {};
|
|
@@ -8,7 +8,7 @@ const readHistory = async (db, { names }) => {
|
|
|
8
8
|
const schema = names.schema;
|
|
9
9
|
const { rows } = await sql`select to_regclass(${`${quoteIdent(schema)}."history"`}) is not null as found`.execute(db);
|
|
10
10
|
if (!rows[0].found) return;
|
|
11
|
-
if (!await hasIndexes(db, schema, "history", historyIndexes.map(([name]) => name))) throw new Error(`The history table in schema "${schema}" lacks indexes no step of this version of Protobase records
|
|
11
|
+
if (!await hasIndexes(db, schema, "history", historyIndexes.map(([name]) => name))) throw new Error(`The history table in schema "${schema}" lacks indexes no step of this version of Protobase records`);
|
|
12
12
|
return {
|
|
13
13
|
lastStep: 1,
|
|
14
14
|
replaceables: {},
|
package/dist/jobs/jobs-module.js
CHANGED
|
@@ -47,7 +47,7 @@ const readJobs = async (db) => {
|
|
|
47
47
|
const step = Object.entries(pgBossSteps).find(([, version]) => version === pgBoss)?.[0];
|
|
48
48
|
const pinned = Object.values(pgBossSteps).at(-1);
|
|
49
49
|
if (pgBoss > pinned) throw new Error(`The jobs schema is at pg-boss schema version ${pgBoss}, newer than the ${pinned} this version of Protobase records: upgrade Protobase`);
|
|
50
|
-
if (step === void 0) throw new Error(`The jobs schema is at pg-boss schema version ${pgBoss}, which no step of this version of Protobase records
|
|
50
|
+
if (step === void 0) throw new Error(`The jobs schema is at pg-boss schema version ${pgBoss}, which no step of this version of Protobase records`);
|
|
51
51
|
const functions = await rows(db, `select obj_description(to_regprocedure(signature), 'pg_proc') as comment from unnest($1::text[]) with ordinality as s(signature, n) order by n`, [functionSignatures.map((signature) => `${jobsSchema}.${signature}`)]);
|
|
52
52
|
return {
|
|
53
53
|
lastStep: Number(step),
|
|
@@ -9,7 +9,7 @@ import { feedbackIndexes, feedbackTableSql } from "./feedback-schema.js";
|
|
|
9
9
|
*/
|
|
10
10
|
const readMailFeedback = async (db) => {
|
|
11
11
|
if (!await relationFound(db, feedbackTable)) return;
|
|
12
|
-
if (!await hasIndexes(db, "mail", "feedback", feedbackIndexes.map(([name]) => name))) throw new Error(`The table ${feedbackTable} of mailFeedback lacks indexes no step of this version of Protobase records
|
|
12
|
+
if (!await hasIndexes(db, "mail", "feedback", feedbackIndexes.map(([name]) => name))) throw new Error(`The table ${feedbackTable} of mailFeedback lacks indexes no step of this version of Protobase records`);
|
|
13
13
|
return {
|
|
14
14
|
lastStep: 1,
|
|
15
15
|
replaceables: {}
|
|
@@ -6,7 +6,7 @@ import { unsubscribesIndexes, unsubscribesTableSql } from "./unsubscribe-schema.
|
|
|
6
6
|
/** The opt-outs table as the database has it: step 1 once it is there with every index. Refuses one without them, which no step records. */
|
|
7
7
|
const readUnsubscribes = async (db) => {
|
|
8
8
|
if (!await relationFound(db, unsubscribesTable)) return;
|
|
9
|
-
if (!await hasIndexes(db, "mail", "unsubscribes", unsubscribesIndexes.map(([name]) => name))) throw new Error(`The opt-outs table ${unsubscribesTable} lacks indexes no step of this version of Protobase records
|
|
9
|
+
if (!await hasIndexes(db, "mail", "unsubscribes", unsubscribesIndexes.map(([name]) => name))) throw new Error(`The opt-outs table ${unsubscribesTable} lacks indexes no step of this version of Protobase records`);
|
|
10
10
|
return {
|
|
11
11
|
lastStep: 1,
|
|
12
12
|
replaceables: {}
|
|
@@ -6,7 +6,6 @@ import { regclass } from "./schema.js";
|
|
|
6
6
|
import { tableNames } from "./table-names.js";
|
|
7
7
|
import { sql } from "kysely";
|
|
8
8
|
//#region src/notifications/devices-module.ts
|
|
9
|
-
const upgradeFirst = "with `protobase migration` and `protobase migrate` of Protobase 0.14.2 first, then run this command again";
|
|
10
9
|
const kindChecksWithoutRelay = async (db, oid, names) => {
|
|
11
10
|
const { rows } = await sql`select c.conname as name, pg_get_constraintdef(c.oid) as def from pg_constraint c
|
|
12
11
|
join pg_attribute a on a.attrelid = c.conrelid and a.attnum = any(c.conkey)
|
|
@@ -25,7 +24,7 @@ const readDevices = async (db, input) => {
|
|
|
25
24
|
const oid = await regclass(db, devices);
|
|
26
25
|
if (oid === null) return;
|
|
27
26
|
const numbers = await columnNumbers(db, oid, names);
|
|
28
|
-
if (numbers.session_id === void 0 || (await kindChecksWithoutRelay(db, oid, names)).length > 0) throw new Error(`The devices table ${devices} was written before devices kept their session and could be relay devices, which no step of this version of Protobase records
|
|
27
|
+
if (numbers.session_id === void 0 || (await kindChecksWithoutRelay(db, oid, names)).length > 0) throw new Error(`The devices table ${devices} was written before devices kept their session and could be relay devices, which no step of this version of Protobase records`);
|
|
29
28
|
const missing = deviceColumns.find((column) => numbers[column] === void 0);
|
|
30
29
|
if (missing !== void 0) throw new Error(`The devices table ${devices} has no column "${names.columns[missing]}": add it, or name the table's own with notifications: { devices: { columns: { ${missing}: ... } } } in protobase.config.ts`);
|
|
31
30
|
if (!await uniqueOn(db, oid, numbers.token)) throw new Error(`The devices table ${devices} needs a unique index on its token column "${names.columns.token}" alone, which moving a device to the user who registers it relies on`);
|
package/dist/package.js
CHANGED
|
@@ -12,7 +12,7 @@ const readRealtimeRelay = async (db) => {
|
|
|
12
12
|
(select count(*)::int from information_schema.columns where table_schema = ${relaySchema} and table_name = any(${[...spacedTables]}::text[]) and column_name = 'space') as spaced`.execute(db);
|
|
13
13
|
const { found, spaced } = rows[0];
|
|
14
14
|
if (found === 0) return;
|
|
15
|
-
if (found < relayTables.length || spaced < spacedTables.length) throw new Error(`The ${relaySchema} schema lacks tables or columns no step of this version of Protobase records
|
|
15
|
+
if (found < relayTables.length || spaced < spacedTables.length) throw new Error(`The ${relaySchema} schema lacks tables or columns no step of this version of Protobase records`);
|
|
16
16
|
return {
|
|
17
17
|
lastStep: 1,
|
|
18
18
|
replaceables: {}
|
package/dist/relay/read-relay.js
CHANGED
|
@@ -77,7 +77,7 @@ const readRelay = (members, organization) => async (db, input) => {
|
|
|
77
77
|
const sessions = await sessionsCurrent(db, input.names.sessions);
|
|
78
78
|
if (!state.table && !sessions) return;
|
|
79
79
|
const version = state.comment?.match(/^Protobase realtime members (\d+)$/)?.[1];
|
|
80
|
-
if (state.comment && Number(version) !== 3) throw new Error(`The functions that keep realtime.members are at ${version === void 0 ? "a version" : `version ${version}`} no step of this version of Protobase records
|
|
80
|
+
if (state.comment && Number(version) !== 3) throw new Error(`The functions that keep realtime.members are at ${version === void 0 ? "a version" : `version ${version}`} no step of this version of Protobase records`);
|
|
81
81
|
const found = await readTriggers(db);
|
|
82
82
|
const given = Object.entries(input.resources[members.name] ?? {});
|
|
83
83
|
const rels = await regclassText(db, given.map(([, { input: listed }]) => listed.table));
|
|
@@ -27,7 +27,7 @@ const userTablesModule = {
|
|
|
27
27
|
read: async (db) => {
|
|
28
28
|
const found = await readUserTablesSchema(db);
|
|
29
29
|
if (!found.tables) return;
|
|
30
|
-
if (!userTablesCurrent(found)) throw new Error(`The ${definitionsSchema} schema lacks the default of a definition's version, a definition's organization, the position index of its fields, the ${userTablesSchema} schema or pg_trgm, which no step of this version of Protobase records
|
|
30
|
+
if (!userTablesCurrent(found)) throw new Error(`The ${definitionsSchema} schema lacks the default of a definition's version, a definition's organization, the position index of its fields, the ${userTablesSchema} schema or pg_trgm, which no step of this version of Protobase records`);
|
|
31
31
|
return {
|
|
32
32
|
lastStep: 1,
|
|
33
33
|
replaceables: {}
|
|
@@ -7,7 +7,7 @@ import { relationFound } from "../../relation-found.js";
|
|
|
7
7
|
const readDeliveryLog = async (db, { names }) => {
|
|
8
8
|
const schema = names.schema;
|
|
9
9
|
if (!await relationFound(db, `${quoteIdent(schema)}."delivery_log"`)) return;
|
|
10
|
-
if (!await hasIndexes(db, schema, "delivery_log", deliveryLogIndexes)) throw new Error(`The delivery log in schema "${schema}" lacks indexes no step of this version of Protobase records
|
|
10
|
+
if (!await hasIndexes(db, schema, "delivery_log", deliveryLogIndexes)) throw new Error(`The delivery log in schema "${schema}" lacks indexes no step of this version of Protobase records`);
|
|
11
11
|
return {
|
|
12
12
|
lastStep: 1,
|
|
13
13
|
replaceables: {},
|
|
@@ -5,7 +5,6 @@ import { relationFound } from "../../relation-found.js";
|
|
|
5
5
|
import { sql } from "kysely";
|
|
6
6
|
//#region src/webhooks/table/webhooks-schema-module.ts
|
|
7
7
|
const functionNames = ["subscription_commands", "deliveries_resend"];
|
|
8
|
-
const upgradeFirst = "with `protobase migration` and `protobase migrate` of Protobase 0.14.2 first, then run this command again";
|
|
9
8
|
/**
|
|
10
9
|
* The functions' version, from the oldest version their comments name, `undefined` when one of them or the deliveries
|
|
11
10
|
* view is missing, so they are written again as new. Refuses a version newer than this version of Protobase writes.
|
|
@@ -27,7 +26,7 @@ const readFunctions = async (db, schema) => {
|
|
|
27
26
|
const readWebhooks = async (db, { names }) => {
|
|
28
27
|
const schema = names.schema;
|
|
29
28
|
if (!await relationFound(db, `${quoteIdent(schema)}."subscriptions"`)) return;
|
|
30
|
-
if (!await hasIndexes(db, schema, "subscriptions", subscriptionsIndexes)) throw new Error(`The subscriptions table in schema "${schema}" lacks indexes no step of this version of Protobase records
|
|
29
|
+
if (!await hasIndexes(db, schema, "subscriptions", subscriptionsIndexes)) throw new Error(`The subscriptions table in schema "${schema}" lacks indexes no step of this version of Protobase records`);
|
|
31
30
|
return {
|
|
32
31
|
lastStep: 1,
|
|
33
32
|
replaceables: await readFunctions(db, schema),
|
|
@@ -16,7 +16,7 @@ const readCustomSteps = async (db, { names }) => {
|
|
|
16
16
|
const schema = names.schema;
|
|
17
17
|
const tables = [...customStepsTables, ...runnersTables];
|
|
18
18
|
if (!await tablesFound(db, schema, tables.slice(0, 1))) return;
|
|
19
|
-
if (!await tablesFound(db, schema, tables)) throw new Error(`The custom steps' tables in schema "${schema}" are not all there, which no step of this version of Protobase records
|
|
19
|
+
if (!await tablesFound(db, schema, tables)) throw new Error(`The custom steps' tables in schema "${schema}" are not all there, which no step of this version of Protobase records`);
|
|
20
20
|
return {
|
|
21
21
|
lastStep: 1,
|
|
22
22
|
replaceables: await triggersFound(db, schema, triggers) ? { functions: 1 } : {},
|
|
@@ -13,7 +13,7 @@ const readWorkflows = async (db, { names }) => {
|
|
|
13
13
|
if (!await tablesFound(db, schema, ["runs"])) return;
|
|
14
14
|
const version = commentVersion(await functionComment(db, schema, "run_version"));
|
|
15
15
|
if (version !== void 0 && version > 28) throw new Error(`The ${schema} schema is at version ${version}, newer than the 28 this version of Protobase writes: upgrade Protobase`);
|
|
16
|
-
if (version !== 28 || !await tablesFound(db, schema, ["triggers"])) throw new Error(`The ${schema} schema is at ${version === void 0 ? "a version" : `version ${version}`} no step of this version of Protobase records
|
|
16
|
+
if (version !== 28 || !await tablesFound(db, schema, ["triggers"])) throw new Error(`The ${schema} schema is at ${version === void 0 ? "a version" : `version ${version}`} no step of this version of Protobase records`);
|
|
17
17
|
return {
|
|
18
18
|
lastStep: 1,
|
|
19
19
|
replaceables: await triggersFound(db, schema, [...workflowsTriggers, ...statusTriggers]) ? { functions: 28 } : {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/server",
|
|
3
|
-
"version": "0.133.
|
|
3
|
+
"version": "0.133.6",
|
|
4
4
|
"description": "The Protobase REST API as a Hono app, with Better Auth sign-in.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@better-auth/sso": "^1.7.12",
|
|
45
45
|
"@livekit/protocol": "1.53.1",
|
|
46
46
|
"@modelcontextprotocol/server": "^2.3.1",
|
|
47
|
-
"@protobase/layout": "0.133.
|
|
48
|
-
"@protobase/query": "0.133.
|
|
49
|
-
"@protobase/schema": "0.133.
|
|
50
|
-
"@protobase/workflow-plugins": "0.133.
|
|
51
|
-
"@protobase/workflows": "0.133.
|
|
47
|
+
"@protobase/layout": "0.133.6",
|
|
48
|
+
"@protobase/query": "0.133.6",
|
|
49
|
+
"@protobase/schema": "0.133.6",
|
|
50
|
+
"@protobase/workflow-plugins": "0.133.6",
|
|
51
|
+
"@protobase/workflows": "0.133.6",
|
|
52
52
|
"@react-email/render": "^2.1.0",
|
|
53
53
|
"@react-pdf/primitives": "^4.4.0",
|
|
54
54
|
"@react-pdf/renderer": "^4.9.1",
|