@protobase/server 0.21.6 → 0.21.8
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/aggregate-groups.js +1 -1
- package/dist/aggregate-service.js +3 -3
- package/dist/ai/ai-fields.js +9 -0
- package/dist/ai/ai-model.js +9 -0
- package/dist/ai/check-ai.d.ts +13 -0
- package/dist/ai/check-ai.js +11 -0
- package/dist/ai/fill-hook.js +47 -0
- package/dist/ai/fill-job.js +67 -0
- package/dist/ai/generate-route.js +57 -0
- package/dist/ai/generate-value.js +28 -0
- package/dist/ai/values.js +15 -0
- package/dist/anonymous.js +7 -2
- package/dist/assistant/assistant-settings.d.ts +2 -2
- package/dist/assistant/assistant-settings.js +7 -21
- package/dist/assistant/built-in-assistant.js +2 -1
- package/dist/assistant/model-settings.js +31 -0
- package/dist/assistant/turn.d.ts +1 -1
- package/dist/assistant/turn.js +2 -2
- package/dist/batch/reorder.js +2 -2
- package/dist/batch/run-batch.js +1 -1
- package/dist/better-auth/create-auth.d.ts +12 -4
- package/dist/better-auth/create-auth.js +0 -1
- package/dist/better-auth/organizations/invitation-endpoints.js +1 -1
- package/dist/better-auth/organizations/member-endpoints.js +1 -1
- package/dist/better-auth/passkey-plugin.js +1 -1
- package/dist/better-auth/policy-plugin.js +1 -1
- package/dist/better-auth/roles/roles-plugin.js +1 -1
- package/dist/better-auth/sign-up/sign-up-plugin.js +1 -1
- package/dist/better-auth/staff-sign-in-endpoints.js +1 -1
- package/dist/better-auth/status-route.js +1 -1
- package/dist/changes/match-events.js +1 -1
- package/dist/check-roles.js +1 -1
- package/dist/check-shell.js +1 -1
- package/dist/check-views.js +26 -4
- package/dist/comments/app-origin.js +11 -0
- package/dist/comments/comment-access.js +54 -0
- package/dist/comments/comment-input.js +26 -0
- package/dist/comments/comment-item.d.ts +16 -0
- package/dist/comments/comment-item.js +18 -0
- package/dist/comments/comment-users.d.ts +21 -0
- package/dist/comments/comment-users.js +35 -0
- package/dist/comments/comments-sql.d.ts +8 -0
- package/dist/comments/comments-sql.js +37 -0
- package/dist/comments/mention-email.js +37 -0
- package/dist/comments/mention-job.d.ts +3 -0
- package/dist/comments/mention-job.js +43 -0
- package/dist/comments/mentionable.js +38 -0
- package/dist/comments/post-comment.js +57 -0
- package/dist/comments/read-comments.js +45 -0
- package/dist/comments/record-comments.js +53 -0
- package/dist/comments/record-label.js +19 -0
- package/dist/create-admin.d.ts +9 -3
- package/dist/create-admin.js +55 -11
- package/dist/deps.d.ts +2 -0
- package/dist/error-handler.js +1 -1
- package/dist/files/attach.js +1 -1
- package/dist/files/upload.js +2 -2
- package/dist/forms/challenge.d.ts +8 -0
- package/dist/forms/challenge.js +71 -0
- package/dist/forms/check-forms.js +59 -0
- package/dist/forms/rate-limit.js +38 -0
- package/dist/forms/routes.js +83 -0
- package/dist/forms/runtime.js +31 -0
- package/dist/history/read-history.js +4 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +11 -9
- package/dist/jobs/runtime.js +1 -1
- package/dist/list-photos.js +3 -3
- package/dist/list-service.js +2 -2
- package/dist/map-service.js +1 -1
- package/dist/meta.js +4 -4
- package/dist/openapi/resource-paths.js +151 -0
- package/dist/project-config.d.ts +1 -1
- package/dist/read-service.js +2 -2
- package/dist/related-labels.js +1 -1
- package/dist/request-access.js +26 -2
- package/dist/routes/record.js +17 -0
- package/dist/row-permissions.js +3 -3
- package/dist/sql-parts.js +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/validate-body.js +6 -1
- package/dist/view-access.js +35 -6
- package/dist/view-related.js +15 -2
- package/dist/webhooks/route-events.js +1 -1
- package/dist/webhooks/table/schema.js +1 -1
- package/dist/webhooks/table/webhook-table.js +1 -1
- package/dist/webhooks/webhooks.js +1 -1
- package/dist/write-pipeline.js +8 -5
- package/dist/write-shared.js +3 -2
- package/dist/write-update.js +1 -1
- package/package.json +5 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { dispatchJobName, isCaptured } from "../changes/capture-sql.js";
|
|
2
2
|
import { defineJob } from "../jobs/define-job.js";
|
|
3
|
+
import { FatalJobError } from "../jobs/run-job.js";
|
|
3
4
|
import { coalesce } from "../changes/coalesce.js";
|
|
4
5
|
import { EventCodeError } from "../changes/event-code-error.js";
|
|
5
6
|
import { eventMatcher } from "../changes/match-events.js";
|
|
@@ -7,7 +8,6 @@ import { deleteOutbox, readOutbox } from "../changes/outbox.js";
|
|
|
7
8
|
import { resourceChange } from "../changes/resource-change.js";
|
|
8
9
|
import { callerRecords } from "../functions/records.js";
|
|
9
10
|
import { writeHistory } from "../history/write-history.js";
|
|
10
|
-
import { FatalJobError } from "../jobs/run-job.js";
|
|
11
11
|
import { maxTries, nextRetryDelay } from "./retry-schedule.js";
|
|
12
12
|
import { subscriberEvents } from "./subscriber-view.js";
|
|
13
13
|
import { attemptDelivery } from "./attempt.js";
|
package/dist/write-pipeline.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { HttpProblem, badRequest } from "./problem.js";
|
|
2
|
-
import { isDatabaseError } from "./error-handler.js";
|
|
3
|
-
import { deleteRecord, fetchRecord, insertRecord, restoreRecord } from "./records.js";
|
|
4
2
|
import { tenantScope } from "./tenant.js";
|
|
5
3
|
import { requestAccess, requireOperation, targetFilter, writableFields } from "./request-access.js";
|
|
4
|
+
import { deleteRecord, fetchRecord, insertRecord, restoreRecord } from "./records.js";
|
|
6
5
|
import { writeTransaction } from "./transactions.js";
|
|
7
6
|
import { blockedDelete } from "./blocked-delete.js";
|
|
7
|
+
import { isDatabaseError } from "./error-handler.js";
|
|
8
8
|
import { attachFiles } from "./files/attach.js";
|
|
9
9
|
import { actorSettings, wakeDispatch } from "./changes/actor.js";
|
|
10
10
|
import { validateBody } from "./validate-body.js";
|
|
@@ -91,9 +91,12 @@ const writeIn = async (trx, deps, access, request) => {
|
|
|
91
91
|
if (request.operation === "update") return update(trx, deps, access, request);
|
|
92
92
|
return removeOrRestore(trx, deps, access, request);
|
|
93
93
|
};
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
/**
|
|
95
|
+
* The path every single write takes: resolve access once, then `writeIn` in its own transaction with a statement timeout.
|
|
96
|
+
* The caller has already authenticated `session`; `form` is the public form a visitor creates through.
|
|
97
|
+
*/
|
|
98
|
+
const runWrite = async (deps, entry, session, request, form) => {
|
|
99
|
+
const access = await requestAccess(deps, entry, session, form);
|
|
97
100
|
requireOperation(access, request.operation === "undelete" ? "update" : request.operation);
|
|
98
101
|
const result = await writeTransaction(deps.db, deps.statementTimeoutMs, (trx) => writeIn(trx, deps, access, request), actorSettings(deps, session));
|
|
99
102
|
wakeDispatch(deps);
|
package/dist/write-shared.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { forbidden, notFound, preconditionFailed, preconditionRequired } from "./problem.js";
|
|
2
|
+
import { tenantScope } from "./tenant.js";
|
|
3
|
+
import { andFilters, recordDecision } from "./request-access.js";
|
|
2
4
|
import { presentFiles } from "./files/present.js";
|
|
3
5
|
import { ifMatchSatisfied } from "./etag.js";
|
|
4
6
|
import { pickFields } from "./rows.js";
|
|
5
7
|
import { fetchRecord } from "./records.js";
|
|
6
|
-
import { tenantScope } from "./tenant.js";
|
|
7
|
-
import { andFilters, recordDecision } from "./request-access.js";
|
|
8
8
|
import { scheduleRemovedFiles } from "./files/attach.js";
|
|
9
9
|
//#region src/write-shared.ts
|
|
10
10
|
const missing = (entry) => notFound(`No ${entry.name} with this key`);
|
|
@@ -45,6 +45,7 @@ const notifier = (deps, access) => async (trx, kind, before, after) => {
|
|
|
45
45
|
resource: access.full,
|
|
46
46
|
user: session.user,
|
|
47
47
|
...session.tenant !== void 0 && { tenant: session.tenant },
|
|
48
|
+
...session.anonymous && { anonymous: true },
|
|
48
49
|
...before && { before },
|
|
49
50
|
...after && { after }
|
|
50
51
|
};
|
package/dist/write-update.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fetchRecord, updateRecord } from "./records.js";
|
|
2
1
|
import { tenantScope } from "./tenant.js";
|
|
3
2
|
import { targetFilter } from "./request-access.js";
|
|
3
|
+
import { fetchRecord, updateRecord } from "./records.js";
|
|
4
4
|
import { attachFiles } from "./files/attach.js";
|
|
5
5
|
import { validateBody } from "./validate-body.js";
|
|
6
6
|
import { assertWritten, checkPrecondition, decide, denied, firstKeyField, missing, notifier } from "./write-shared.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/server",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.8",
|
|
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": {
|
|
@@ -30,13 +30,14 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@better-auth/passkey": "^1.7.7",
|
|
33
|
-
"@protobase/layout": "0.21.
|
|
34
|
-
"@protobase/query": "0.21.
|
|
35
|
-
"@protobase/schema": "0.21.
|
|
33
|
+
"@protobase/layout": "0.21.8",
|
|
34
|
+
"@protobase/query": "0.21.8",
|
|
35
|
+
"@protobase/schema": "0.21.8",
|
|
36
36
|
"@react-email/render": "^2.1.0",
|
|
37
37
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
38
38
|
"@sentry/core": "^11.7.0",
|
|
39
39
|
"@simplewebauthn/server": "^13.3.1",
|
|
40
|
+
"altcha-lib": "^2.6.0",
|
|
40
41
|
"better-auth": "^1.7.7",
|
|
41
42
|
"cron-parser": "^5.10.1",
|
|
42
43
|
"file-type": "^22.1.1",
|