@protobase/server 0.21.7 → 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/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/changes/capture-schema.d.ts +1 -1
- package/dist/changes/outbox.d.ts +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 +7 -4
- package/dist/create-admin.js +43 -8
- package/dist/deps.d.ts +4 -2
- package/dist/error-handler.js +1 -1
- package/dist/files/attach.js +1 -1
- package/dist/files/cleanup-runner.d.ts +1 -1
- package/dist/files/runtime.d.ts +2 -2
- package/dist/files/upload.js +2 -2
- package/dist/history/read-history.js +1 -1
- 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 +2 -2
- 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 +2 -2
- package/dist/request-access.d.ts +2 -2
- package/dist/routes/record.js +17 -0
- package/dist/row-permissions.js +3 -3
- package/dist/scan-guard.d.ts +2 -2
- package/dist/sql-parts.js +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/view-access.js +33 -5
- package/dist/view-related.js +15 -2
- package/dist/webhooks/subscription.d.ts +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 +2 -2
- package/dist/write-shared.js +3 -2
- package/dist/write-update.js +1 -1
- package/package.json +4 -4
package/dist/create-admin.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AdminAuth } from "./better-auth/create-auth.js";
|
|
2
2
|
import { EventsOptions } from "./changes/events-options.js";
|
|
3
|
-
import { HistoryOptions } from "./history/options.js";
|
|
4
3
|
import { JobDefinition } from "./jobs/job-types.js";
|
|
5
4
|
import { Admin, Authenticator, PageSource, ViewSource } from "./types.js";
|
|
5
|
+
import { CommentUsers } from "./comments/comment-users.js";
|
|
6
|
+
import { HistoryOptions } from "./history/options.js";
|
|
6
7
|
import { WebhooksOptions } from "./webhooks/table/options.js";
|
|
7
8
|
import { SubscriptionDefinition } from "./webhooks/subscription.js";
|
|
8
9
|
import { FilesOptions } from "./files/options.js";
|
|
@@ -10,8 +11,8 @@ import { Difficulty } from "./forms/challenge.js";
|
|
|
10
11
|
import { ResourceSource } from "./resource-source.js";
|
|
11
12
|
import { FunctionSource } from "./functions/define-function.js";
|
|
12
13
|
import { AdminOptions } from "./admin-options.js";
|
|
13
|
-
import { Db } from "@protobase/query";
|
|
14
14
|
import { BottomBarSource, UserMenuSource } from "@protobase/schema";
|
|
15
|
+
import { Db } from "@protobase/query";
|
|
15
16
|
//#region src/create-admin.d.ts
|
|
16
17
|
export type CreateAdminInput = {
|
|
17
18
|
resources: ResourceSource[];
|
|
@@ -34,7 +35,7 @@ export type CreateAdminInput = {
|
|
|
34
35
|
events?: EventsOptions;
|
|
35
36
|
/** How long the history of resources with `.history()` is kept (see `HistoryOptions`). */
|
|
36
37
|
history?: HistoryOptions;
|
|
37
|
-
/** The app's jobs (see `defineJob`): with any, or a resource with events or
|
|
38
|
+
/** The app's jobs (see `defineJob`): with any, or a resource with events, history or comments, admins get the failed jobs page (`failed_jobs`). */
|
|
38
39
|
jobs?: JobDefinition[];
|
|
39
40
|
/** Where the resources' events are delivered (`subscription(...)` exports of the config module). */
|
|
40
41
|
subscriptions?: SubscriptionDefinition[];
|
|
@@ -55,7 +56,9 @@ export type CreateAdminInput = {
|
|
|
55
56
|
options?: AdminOptions;
|
|
56
57
|
/** @internal The proof-of-work range of public forms' bot checks, which tests make tiny. */
|
|
57
58
|
formsDifficulty?: Difficulty;
|
|
59
|
+
/** @internal The users comments name, mention and mail, which tests fake; from `auth` otherwise. */
|
|
60
|
+
commentUsers?: CommentUsers;
|
|
58
61
|
};
|
|
59
62
|
/** The admin REST API as a Hono app. It uses only Web APIs, so it runs on Node, Workers and anywhere else Hono does. */
|
|
60
|
-
export declare const createAdmin: ({ resources: appResources, views: appViews, pages, userMenu, bottomBars, db, authenticate, auth, functions, files: filesOptions, events, history: historyOptions, jobs, subscriptions, webhooks: webhooksOptions, bundlePlugins, fieldTypes, options, formsDifficulty }: CreateAdminInput) => Admin;
|
|
63
|
+
export declare const createAdmin: ({ resources: appResources, views: appViews, pages, userMenu, bottomBars, db, authenticate, auth, functions, files: filesOptions, events, history: historyOptions, jobs, subscriptions, webhooks: webhooksOptions, bundlePlugins, fieldTypes, options, formsDifficulty, commentUsers: givenCommentUsers }: CreateAdminInput) => Admin;
|
|
61
64
|
//#endregion
|
package/dist/create-admin.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aiModel } from "./ai/ai-model.js";
|
|
2
|
+
import { hasAiActions, hasAiFields } from "./ai/ai-fields.js";
|
|
3
|
+
import { fillHook } from "./ai/fill-hook.js";
|
|
2
4
|
import { createErrorHandler } from "./error-handler.js";
|
|
3
5
|
import { isCaptured } from "./changes/capture-sql.js";
|
|
4
6
|
import { assistantRecords } from "./assistant/records.js";
|
|
7
|
+
import { fillJob } from "./ai/fill-job.js";
|
|
8
|
+
import { assistantSettings } from "./assistant/assistant-settings.js";
|
|
5
9
|
import { builtInAssistant } from "./assistant/built-in-assistant.js";
|
|
6
10
|
import { consoleAuditQueue } from "./audit/console-queue.js";
|
|
7
11
|
import { webauthnPath } from "./better-auth/origins.js";
|
|
@@ -11,8 +15,12 @@ import { authBasePath } from "./better-auth/create-auth.js";
|
|
|
11
15
|
import { organizationRoutes } from "./better-auth/organizations/admin-routes.js";
|
|
12
16
|
import { statusRoute } from "./better-auth/status-route.js";
|
|
13
17
|
import { changesSchema } from "./changes/events-options.js";
|
|
14
|
-
import {
|
|
18
|
+
import { appOrigin } from "./comments/app-origin.js";
|
|
15
19
|
import { betterAuthActorNames } from "./history/actor-names.js";
|
|
20
|
+
import { betterAuthCommentUsers } from "./comments/comment-users.js";
|
|
21
|
+
import { mentionJob } from "./comments/mention-job.js";
|
|
22
|
+
import { commentsResource, commentsView } from "./comments/record-comments.js";
|
|
23
|
+
import { activityResource, activityView } from "./history/activity.js";
|
|
16
24
|
import { historyDays } from "./history/options.js";
|
|
17
25
|
import { pruneHistoryJob } from "./history/prune-history.js";
|
|
18
26
|
import { callerRecords } from "./functions/records.js";
|
|
@@ -52,23 +60,29 @@ const declaredRoles = (auth, roles) => {
|
|
|
52
60
|
return names.length > 0 ? [...new Set(names)] : void 0;
|
|
53
61
|
};
|
|
54
62
|
/** The admin REST API as a Hono app. It uses only Web APIs, so it runs on Node, Workers and anywhere else Hono does. */
|
|
55
|
-
const createAdmin = ({ resources: appResources, views: appViews = [], pages = [], userMenu, bottomBars = [], db, authenticate, auth, functions = {}, files: filesOptions, events, history: historyOptions, jobs = [], subscriptions = [], webhooks: webhooksOptions, bundlePlugins = [], fieldTypes = {}, options = {}, formsDifficulty }) => {
|
|
63
|
+
const createAdmin = ({ resources: appResources, views: appViews = [], pages = [], userMenu, bottomBars = [], db, authenticate, auth, functions = {}, files: filesOptions, events, history: historyOptions, jobs = [], subscriptions = [], webhooks: webhooksOptions, bundlePlugins = [], fieldTypes = {}, options = {}, formsDifficulty, commentUsers: givenCommentUsers }) => {
|
|
56
64
|
const basePath = options.basePath ?? "/api/v1";
|
|
57
65
|
const appModels = appResources.map((resource) => resource.toModel());
|
|
58
|
-
const
|
|
66
|
+
const withComments = appModels.some((model) => model.comments);
|
|
67
|
+
const withAiFields = hasAiFields(appModels);
|
|
68
|
+
const withJobs = jobs.length > 0 || appModels.some(isCaptured) || withComments || withAiFields;
|
|
59
69
|
const withHistory = appModels.some((model) => model.history);
|
|
60
70
|
const changes = changesSchema(events);
|
|
61
71
|
const days = historyDays(historyOptions);
|
|
62
72
|
const resources = [
|
|
63
73
|
...appResources,
|
|
64
74
|
...withJobs ? [failedJobs] : [],
|
|
65
|
-
...withHistory ? [activityResource(changes, { tenant: appModels.some((model) => model.history && model.tenant) })] : []
|
|
75
|
+
...withHistory ? [activityResource(changes, { tenant: appModels.some((model) => model.history && model.tenant) })] : [],
|
|
76
|
+
...withComments ? [commentsResource({ tenant: appModels.some((model) => model.comments && model.tenant) })] : []
|
|
66
77
|
];
|
|
67
78
|
const views = [
|
|
68
79
|
...appViews,
|
|
69
80
|
...withJobs ? [failedJobsView] : [],
|
|
70
|
-
...withHistory ? [activityView] : []
|
|
81
|
+
...withHistory ? [activityView] : [],
|
|
82
|
+
...withComments ? [commentsView] : []
|
|
71
83
|
];
|
|
84
|
+
const commentUsers = withComments ? givenCommentUsers ?? (auth && betterAuthCommentUsers(auth)) : void 0;
|
|
85
|
+
const mentions = withComments ? mentionJob(commentUsers, auth?.appName ?? readAppName(globalThis.process?.env ?? {}) ?? "Protobase") : void 0;
|
|
72
86
|
const registry = buildRegistry(resources);
|
|
73
87
|
const apiFunctions = Object.fromEntries(Object.entries(functions).map(([name, source]) => [name, toApiFunction(name, source)]));
|
|
74
88
|
const viewModels = views.map((view) => view.toModel());
|
|
@@ -109,6 +123,9 @@ const createAdmin = ({ resources: appResources, views: appViews = [], pages = []
|
|
|
109
123
|
systemPath
|
|
110
124
|
});
|
|
111
125
|
const table = webhooksOptions && webhookTable(webhooksOptions, auth);
|
|
126
|
+
const withAi = withAiFields || hasAiActions(viewModels);
|
|
127
|
+
const model = withAi ? aiModel(options.assistant, globalThis.process?.env ?? {}) : void 0;
|
|
128
|
+
const fill = withAiFields ? fillJob(() => deps) : void 0;
|
|
112
129
|
const deps = {
|
|
113
130
|
db,
|
|
114
131
|
registry,
|
|
@@ -120,7 +137,11 @@ const createAdmin = ({ resources: appResources, views: appViews = [], pages = []
|
|
|
120
137
|
systemPath,
|
|
121
138
|
statementTimeoutMs: options.statementTimeoutMs ?? 15e3,
|
|
122
139
|
guard: createScanGuard(db, options.scanGuard),
|
|
123
|
-
hooks: [
|
|
140
|
+
hooks: [
|
|
141
|
+
...options.writeHooks ?? [],
|
|
142
|
+
...table ? [subscriptionWriteCheck(registry.entries.map((entry) => entry.model), table.checkUrl)] : [],
|
|
143
|
+
...fill ? [fillHook(() => deps, fill)] : []
|
|
144
|
+
],
|
|
124
145
|
audit: options.audit ?? consoleAuditQueue(),
|
|
125
146
|
accessOptions: {
|
|
126
147
|
...options.roles && { roles: options.roles },
|
|
@@ -138,6 +159,15 @@ const createAdmin = ({ resources: appResources, views: appViews = [], pages = []
|
|
|
138
159
|
...withHistory && { history: {
|
|
139
160
|
schema: changes,
|
|
140
161
|
...auth && { actorNames: betterAuthActorNames(auth) }
|
|
162
|
+
} },
|
|
163
|
+
...mentions && { comments: {
|
|
164
|
+
...commentUsers && { users: commentUsers },
|
|
165
|
+
mentionJob: mentions,
|
|
166
|
+
appOrigin: appOrigin(auth?.origins ?? [])
|
|
167
|
+
} },
|
|
168
|
+
...withAi && { ai: {
|
|
169
|
+
...model && { model },
|
|
170
|
+
...options.onUnhandledError && { report: options.onUnhandledError }
|
|
141
171
|
} }
|
|
142
172
|
};
|
|
143
173
|
const meta = createMeta(deps, auth?.appName ?? readAppName(globalThis.process?.env ?? {}) ?? "Protobase");
|
|
@@ -229,7 +259,12 @@ const createAdmin = ({ resources: appResources, views: appViews = [], pages = []
|
|
|
229
259
|
log: (line) => console.log(line),
|
|
230
260
|
...table && { table }
|
|
231
261
|
});
|
|
232
|
-
return Object.assign(app, { jobs: [
|
|
262
|
+
return Object.assign(app, { jobs: [
|
|
263
|
+
...webhooks.jobs,
|
|
264
|
+
...withHistory && days !== void 0 ? [pruneHistoryJob(changes, days)] : [],
|
|
265
|
+
...mentions ? [mentions] : [],
|
|
266
|
+
...fill ? [fill] : []
|
|
267
|
+
] });
|
|
233
268
|
};
|
|
234
269
|
//#endregion
|
|
235
270
|
export { createAdmin };
|
package/dist/deps.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import "./types.js";
|
|
2
|
+
import "./comments/comment-users.js";
|
|
3
|
+
import "./comments/mention-job.js";
|
|
2
4
|
import "./files/runtime.js";
|
|
3
5
|
import "./plugins/plugin-settings.js";
|
|
4
6
|
import "./registry.js";
|
|
5
7
|
import "./scan-guard.js";
|
|
6
8
|
import { PageModel } from "@protobase/layout";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
+
import { ResolveOptions, ViewModel } from "@protobase/schema";
|
|
10
|
+
import { Db } from "@protobase/query";
|
package/dist/error-handler.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpProblem, problemResponse } from "./problem.js";
|
|
2
|
-
import { HTTPException } from "hono/http-exception";
|
|
3
2
|
import { QueryError } from "@protobase/query";
|
|
3
|
+
import { HTTPException } from "hono/http-exception";
|
|
4
4
|
//#region src/error-handler.ts
|
|
5
5
|
const titles = {
|
|
6
6
|
400: "Bad Request",
|
package/dist/files/attach.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { badRequest } from "../problem.js";
|
|
2
|
+
import { tenantScope } from "../tenant.js";
|
|
2
3
|
import { accepts } from "./media-types.js";
|
|
3
4
|
import { externalFile, parseExternalUrl } from "./external-url.js";
|
|
4
5
|
import { baseOf, parseUri, variantPaths } from "./uri.js";
|
|
5
|
-
import { tenantScope } from "../tenant.js";
|
|
6
6
|
import { readTicket } from "./ticket.js";
|
|
7
7
|
//#region src/files/attach.ts
|
|
8
8
|
/** The ticket scope of a caller's upload for one field. */
|
package/dist/files/runtime.d.ts
CHANGED
package/dist/files/upload.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HttpProblem, badRequest } from "../problem.js";
|
|
2
|
-
import { accepts, servedType } from "./media-types.js";
|
|
3
|
-
import { cleanName, tenantSegment, variantPath } from "./uri.js";
|
|
4
2
|
import { tenantScope } from "../tenant.js";
|
|
5
3
|
import { requestAccess, requireOperation, writableFields } from "../request-access.js";
|
|
4
|
+
import { accepts, servedType } from "./media-types.js";
|
|
5
|
+
import { cleanName, tenantSegment, variantPath } from "./uri.js";
|
|
6
6
|
import { issueTicket } from "./ticket.js";
|
|
7
7
|
import { ticketScope } from "./attach.js";
|
|
8
8
|
import { ticketSeconds } from "./runtime.js";
|
|
@@ -6,8 +6,8 @@ import { fetchReadable } from "../read-service.js";
|
|
|
6
6
|
import { quoteIdent } from "../changes/capture-sql.js";
|
|
7
7
|
import { parseParams } from "../params.js";
|
|
8
8
|
import { encodeKey } from "@protobase/schema/internal";
|
|
9
|
-
import { sql } from "kysely";
|
|
10
9
|
import { z } from "zod";
|
|
10
|
+
import { sql } from "kysely";
|
|
11
11
|
//#region src/history/read-history.ts
|
|
12
12
|
const params = z.object({
|
|
13
13
|
page_size: z.coerce.number().int().min(0).max(100).optional(),
|
package/dist/index.d.ts
CHANGED
|
@@ -9,16 +9,18 @@ import { PlatformSignIn, readPlatformSignIn } from "./better-auth/platform-sign-
|
|
|
9
9
|
import { EmailComponent, EmailOptions, EmailTemplate, RenderedEmail, defineEmail } from "./mail/define-email.js";
|
|
10
10
|
import { AdminAuth, CreateAuthOptions, UserCreatedHook, createAuth, normalizeRoles } from "./better-auth/create-auth.js";
|
|
11
11
|
import { EventsOptions } from "./changes/events-options.js";
|
|
12
|
-
import { HistoryOptions } from "./history/options.js";
|
|
13
12
|
import { StandardSchema, readJson } from "./functions/read-json.js";
|
|
14
13
|
import { EnqueueOptions, JobContext, JobDefinition, JobOptions } from "./jobs/job-types.js";
|
|
15
14
|
import { Admin, AuditEvent, AuditQueue, Authenticator, PipelineHook, ScanGuardMode, Session, SessionOrganization, TenantValue, User, ViewSource, WriteEvent, WriteOperation } from "./types.js";
|
|
15
|
+
import { CommentUsers } from "./comments/comment-users.js";
|
|
16
|
+
import { HistoryOptions } from "./history/options.js";
|
|
16
17
|
import { WebhooksOptions } from "./webhooks/table/options.js";
|
|
17
18
|
import { EventData, RunContext, SubscriptionDefinition, SubscriptionEvent, SubscriptionOptions, subscription } from "./webhooks/subscription.js";
|
|
18
19
|
import { Sharp, renderVariant, thumbHash } from "./files/images.js";
|
|
19
20
|
import { FileProvider, FileStore, StoredObject } from "./files/store.js";
|
|
20
21
|
import { FilesOptions } from "./files/options.js";
|
|
21
22
|
import { ErrorReportingOptions, ErrorReportingSettings, errorReportingSettings, errorReportingVariable } from "./error-reporting/error-reporting-settings.js";
|
|
23
|
+
import { ChatMessage, ChatTextPart, Completion, CompletionOptions, ModelError, ModelSettings, ReasoningDetail, ReasoningEffort, ToolCall, ToolSpec, streamChatCompletion } from "./assistant/chat-completions.js";
|
|
22
24
|
import { CleanupEntry, CleanupSchedule, ScheduledDelete, storageCleanupSchedule } from "./files/cleanup-schedule.js";
|
|
23
25
|
import { CleanupReport } from "./files/cleanup-runner.js";
|
|
24
26
|
import { MapLayer } from "./maps/map-layers.js";
|
|
@@ -30,7 +32,6 @@ import { RecordKeyInput, ToolRecord, ToolRecords } from "./assistant/records.js"
|
|
|
30
32
|
import { FunctionRecords, ListParams, RecordPage } from "./functions/records.js";
|
|
31
33
|
import { ApiFunction, CorsOptions, FunctionApp, FunctionCaller, FunctionContext, FunctionHandler, FunctionOptions, FunctionSource, ProtectedFunctionOptions, PublicFunctionContext, PublicFunctionHandler, PublicFunctionOptions, defineFunction } from "./functions/define-function.js";
|
|
32
34
|
import { CorsOrigins } from "./api-cors.js";
|
|
33
|
-
import { ChatMessage, ChatTextPart, Completion, CompletionOptions, ModelError, ModelSettings, ReasoningDetail, ReasoningEffort, ToolCall, ToolSpec, streamChatCompletion } from "./assistant/chat-completions.js";
|
|
34
35
|
import { ConversationRecord, ConversationStore } from "./assistant/conversation-store.js";
|
|
35
36
|
import { Conversation, ConversationsOptions, conversationKey, createConversations } from "./assistant/conversations.js";
|
|
36
37
|
import { ApprovalAnswer, ApprovalRequest, requestApproval } from "./assistant/approval.js";
|
|
@@ -61,6 +62,9 @@ import { parseColumns, readOutbox } from "./changes/outbox.js";
|
|
|
61
62
|
import { newWebhookSecret } from "./webhooks/standard-webhooks.js";
|
|
62
63
|
import { webhooks } from "./webhooks/table/plugin.js";
|
|
63
64
|
import { checkWebhooksSchema, webhooksMigration } from "./webhooks/table/schema.js";
|
|
65
|
+
import { checkComments, commentsMigration } from "./comments/comments-sql.js";
|
|
66
|
+
import { CheckAiInput, checkAi } from "./ai/check-ai.js";
|
|
67
|
+
import { CommentItem } from "./comments/comment-item.js";
|
|
64
68
|
import { MemberInput, NewOrganization, addAppRoleToOwners, addMember, createOrganization, listOrganizations, removeMember, setMemberRoles } from "./better-auth/organizations/host.js";
|
|
65
69
|
import { AssistantBackend, assistantProtocolRoutes } from "./assistant/protocol-routes.js";
|
|
66
70
|
import { fileConversationStore } from "./assistant/file-conversation-store.js";
|
|
@@ -87,4 +91,4 @@ import { FatalJobError } from "./jobs/run-job.js";
|
|
|
87
91
|
import { DrainResult, JobsRuntime, StartJobsOptions, startJobs } from "./jobs/runtime.js";
|
|
88
92
|
import { jobsDrainApp } from "./jobs/drain-route.js";
|
|
89
93
|
import { checkJobsSchema, jobsSchema, jobsSchemaMigration } from "./jobs/schema.js";
|
|
90
|
-
export { type Admin, type AdminAuth, type AdminOptions, type ApiFunction, type ApprovalAnswer, type ApprovalRequest, type AssistantBackend, type AssistantOptions, type AssistantSettings, type AssistantTool, type AuditEvent, type AuditQueue, type Authenticator, type BetterAuthAuthenticatorOptions, type CapturedRow, type ChatMessage, type ChatTextPart, type CleanupEntry, type CleanupReport, type CleanupSchedule, type CoalescedChange, type Completion, type CompletionOptions, type Conversation, type ConversationRecord, type ConversationStore, type ConversationsOptions, type CorsOptions, type CorsOrigins, type CreateAdminInput, type CreateAuthOptions, type DrainResult, type EmailComponent, type EmailOptions, type EmailTemplate, type EnqueueOptions, type ErrorReporter, type ErrorReportingOptions, type ErrorReportingSettings, type EventData, type EventsOptions, FatalJobError, type FileCleanupInput, type FileLimits, type FileObject, type FileProvider, type FileRef, type FileStore, type FileVariantObject, type FilesOptions, type FunctionApp, type FunctionCaller, type FunctionContext, type FunctionEnv, type FunctionHandler, type FunctionOptions, type FunctionRecords, type FunctionSource, type HistoryOptions, HttpProblem, type IssueTokenOptions, type JobContext, type JobDefinition, type JobOptions, type JobsRuntime, type JwtOptions, type LinkedAccount, type ListParams, type LocalFilesOptions, type MailMessage, type Mailer, type MapLayer, type MapOptions, type MapSettings, type MemberInput, MissingCredentials, ModelError, type ModelSettings, type NewOrganization, type NewUser, type OperatorProvider, type OrganizationRole, type OrganizationsOptions, type PipelineHook, type PlatformSignIn, type PluginOption, type PluginRef, type ProjectConfig, type ProtectedFunctionOptions, type PublicFunctionContext, type PublicFunctionEnv, type PublicFunctionHandler, type PublicFunctionOptions, type QueryOptions, type QueryResult, type ReasoningDetail, type ReasoningEffort, type RecordKeyInput, type RecordPage, type RenderedEmail, type ResourceChange, type ResourceSource, type RoleDefinition, type RolesInput, type RunContext, type RuntimeOptions, type S3Bucket, type S3FilesOptions, type S3ListPage, type S3Object, type ScanGuardMode, type ScheduledDelete, type Session, type SessionOrganization, type Sharp, type SignInPolicy, type SignInRule, type SignatureOptions, type SourceOption, type SourceRef, type StaffAccessRule, type StaffSignIn, type StandardSchema, type StandardWebhookOptions, type StartJobsOptions, type StoreFileInput, type StoredMember, type StoredObject, type StoredOrganization, type StoredUser, type SubscriptionDefinition, type SubscriptionEvent, type SubscriptionOptions, type TenantValue, type ToolCall, type ToolContext, type ToolRecord, type ToolRecords, type ToolSpec, type TrustedApp, type TurnOptions, type User, type UserCreatedHook, type ViewSource, type WebhooksOptions, type WidgetOptions, type WriteEvent, type WriteOperation, addAppRoleToOwners, addMember, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaMigration, badRequest, beforeSignInPluginsVariable, betterAuthAuthenticator, changesMigration, checkAuthSchema, checkChanges, checkJobsSchema, checkSourceNames, checkViewQueries, checkWebhooksSchema, coalesce, configExports, consoleAuditQueue, conversationKey, createAdmin, createAuth, createConversations, createFileCleanup, createOrganization, createUser, defaultSignInPolicy, defineConfig, defineEmail, defineFunction, defineJob, defineTool, deleteUser, errorReportingSettings, errorReportingVariable, eventMatcher, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, handleDroppedConnections, hasUsers, imageSize, isCaptured, isJobDefinition, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, limitedFileStore, listOrganizations, listUsers, localFileStore, localFiles, mapSettings, mapStyleUrl, mapStyleVariable, maxTokenTtlSeconds, maxWidgetPropsBytes, mergeConfig, migrationCommand, newWebhookSecret, normalizeRoles, notFound, parseColumns, parseRoles, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, processor, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIn, readWriteQueryTool, recordOf, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runReadOnlyQuery, runReadWriteQuery, runTurn, runtimeUrl, runtimeVariable, s3FileStore, s3Files, seesAssistant, seesRuntime, setMemberRoles, setUserBanned, setUserRole, signInPolicyMethods, sourceOptions, sourcesFor, sourcesVariable, startErrorReporting, startJobs, storageCleanupSchedule, storeFile, streamChatCompletion, subscription, thumbHash, unauthorized, variantPath, verifySignature, verifyStandardWebhook, webauthnPath, webhooks, webhooksMigration, widget, withCacheBreakpoints, withTrustedApps };
|
|
94
|
+
export { type Admin, type AdminAuth, type AdminOptions, type ApiFunction, type ApprovalAnswer, type ApprovalRequest, type AssistantBackend, type AssistantOptions, type AssistantSettings, type AssistantTool, type AuditEvent, type AuditQueue, type Authenticator, type BetterAuthAuthenticatorOptions, type CapturedRow, type ChatMessage, type ChatTextPart, type CheckAiInput, type CleanupEntry, type CleanupReport, type CleanupSchedule, type CoalescedChange, type CommentItem, type CommentUsers, type Completion, type CompletionOptions, type Conversation, type ConversationRecord, type ConversationStore, type ConversationsOptions, type CorsOptions, type CorsOrigins, type CreateAdminInput, type CreateAuthOptions, type DrainResult, type EmailComponent, type EmailOptions, type EmailTemplate, type EnqueueOptions, type ErrorReporter, type ErrorReportingOptions, type ErrorReportingSettings, type EventData, type EventsOptions, FatalJobError, type FileCleanupInput, type FileLimits, type FileObject, type FileProvider, type FileRef, type FileStore, type FileVariantObject, type FilesOptions, type FunctionApp, type FunctionCaller, type FunctionContext, type FunctionEnv, type FunctionHandler, type FunctionOptions, type FunctionRecords, type FunctionSource, type HistoryOptions, HttpProblem, type IssueTokenOptions, type JobContext, type JobDefinition, type JobOptions, type JobsRuntime, type JwtOptions, type LinkedAccount, type ListParams, type LocalFilesOptions, type MailMessage, type Mailer, type MapLayer, type MapOptions, type MapSettings, type MemberInput, MissingCredentials, ModelError, type ModelSettings, type NewOrganization, type NewUser, type OperatorProvider, type OrganizationRole, type OrganizationsOptions, type PipelineHook, type PlatformSignIn, type PluginOption, type PluginRef, type ProjectConfig, type ProtectedFunctionOptions, type PublicFunctionContext, type PublicFunctionEnv, type PublicFunctionHandler, type PublicFunctionOptions, type QueryOptions, type QueryResult, type ReasoningDetail, type ReasoningEffort, type RecordKeyInput, type RecordPage, type RenderedEmail, type ResourceChange, type ResourceSource, type RoleDefinition, type RolesInput, type RunContext, type RuntimeOptions, type S3Bucket, type S3FilesOptions, type S3ListPage, type S3Object, type ScanGuardMode, type ScheduledDelete, type Session, type SessionOrganization, type Sharp, type SignInPolicy, type SignInRule, type SignatureOptions, type SourceOption, type SourceRef, type StaffAccessRule, type StaffSignIn, type StandardSchema, type StandardWebhookOptions, type StartJobsOptions, type StoreFileInput, type StoredMember, type StoredObject, type StoredOrganization, type StoredUser, type SubscriptionDefinition, type SubscriptionEvent, type SubscriptionOptions, type TenantValue, type ToolCall, type ToolContext, type ToolRecord, type ToolRecords, type ToolSpec, type TrustedApp, type TurnOptions, type User, type UserCreatedHook, type ViewSource, type WebhooksOptions, type WidgetOptions, type WriteEvent, type WriteOperation, addAppRoleToOwners, addMember, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaMigration, badRequest, beforeSignInPluginsVariable, betterAuthAuthenticator, changesMigration, checkAi, checkAuthSchema, checkChanges, checkComments, checkJobsSchema, checkSourceNames, checkViewQueries, checkWebhooksSchema, coalesce, commentsMigration, configExports, consoleAuditQueue, conversationKey, createAdmin, createAuth, createConversations, createFileCleanup, createOrganization, createUser, defaultSignInPolicy, defineConfig, defineEmail, defineFunction, defineJob, defineTool, deleteUser, errorReportingSettings, errorReportingVariable, eventMatcher, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, handleDroppedConnections, hasUsers, imageSize, isCaptured, isJobDefinition, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, limitedFileStore, listOrganizations, listUsers, localFileStore, localFiles, mapSettings, mapStyleUrl, mapStyleVariable, maxTokenTtlSeconds, maxWidgetPropsBytes, mergeConfig, migrationCommand, newWebhookSecret, normalizeRoles, notFound, parseColumns, parseRoles, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, processor, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIn, readWriteQueryTool, recordOf, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runReadOnlyQuery, runReadWriteQuery, runTurn, runtimeUrl, runtimeVariable, s3FileStore, s3Files, seesAssistant, seesRuntime, setMemberRoles, setUserBanned, setUserRole, signInPolicyMethods, sourceOptions, sourcesFor, sourcesVariable, startErrorReporting, startJobs, storageCleanupSchedule, storeFile, streamChatCompletion, subscription, thumbHash, unauthorized, variantPath, verifySignature, verifyStandardWebhook, webauthnPath, webhooks, webhooksMigration, widget, withCacheBreakpoints, withTrustedApps };
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
import { HttpProblem, MissingCredentials, badRequest, forbidden, notFound, unauthorized } from "./problem.js";
|
|
2
|
+
import { formatUri, variantPath } from "./files/uri.js";
|
|
3
|
+
import { checkJobsSchema, jobsSchema, jobsSchemaMigration } from "./jobs/schema.js";
|
|
4
|
+
import { isCaptured } from "./changes/capture-sql.js";
|
|
5
|
+
import { defineJob, isJobDefinition, jobDefinitions } from "./jobs/define-job.js";
|
|
6
|
+
import { FatalJobError } from "./jobs/run-job.js";
|
|
7
|
+
import { ModelError, streamChatCompletion } from "./assistant/chat-completions.js";
|
|
1
8
|
import { assistantRoles, assistantSettings, assistantVariables, seesAssistant } from "./assistant/assistant-settings.js";
|
|
2
9
|
import { conversationKey, createConversations } from "./assistant/conversations.js";
|
|
3
10
|
import { fileConversationStore } from "./assistant/file-conversation-store.js";
|
|
4
|
-
import { HttpProblem, MissingCredentials, badRequest, forbidden, notFound, unauthorized } from "./problem.js";
|
|
5
11
|
import { assistantProtocolRoutes } from "./assistant/protocol-routes.js";
|
|
6
12
|
import { runReadOnlyQuery, runReadWriteQuery } from "./assistant/run-query.js";
|
|
7
13
|
import { defineTool } from "./assistant/tools.js";
|
|
8
14
|
import { readOnlyQueryTool, readWriteQueryTool } from "./assistant/query-tools.js";
|
|
9
15
|
import { requestApproval } from "./assistant/approval.js";
|
|
10
16
|
import { withCacheBreakpoints } from "./assistant/cache-breakpoints.js";
|
|
11
|
-
import { ModelError, streamChatCompletion } from "./assistant/chat-completions.js";
|
|
12
|
-
import { formatUri, variantPath } from "./files/uri.js";
|
|
13
|
-
import { checkJobsSchema, jobsSchema, jobsSchemaMigration } from "./jobs/schema.js";
|
|
14
|
-
import { isCaptured } from "./changes/capture-sql.js";
|
|
15
17
|
import { runTurn } from "./assistant/turn.js";
|
|
16
18
|
import { consoleAuditQueue } from "./audit/console-queue.js";
|
|
17
19
|
import { webauthnPath } from "./better-auth/origins.js";
|
|
@@ -22,12 +24,12 @@ import { readPlatformSignIn } from "./better-auth/platform-sign-in.js";
|
|
|
22
24
|
import { createAuth, normalizeRoles } from "./better-auth/create-auth.js";
|
|
23
25
|
import { addAppRoleToOwners, addMember, createOrganization, listOrganizations, removeMember, setMemberRoles } from "./better-auth/organizations/host.js";
|
|
24
26
|
import { createUser, deleteUser, hasUsers, listUsers, roleChoices, setUserBanned, setUserRole } from "./better-auth/users.js";
|
|
25
|
-
import {
|
|
27
|
+
import { changesMigration, checkChanges, migrationCommand } from "./changes/capture-schema.js";
|
|
28
|
+
import { checkComments, commentsMigration } from "./comments/comments-sql.js";
|
|
26
29
|
import { coalesce } from "./changes/coalesce.js";
|
|
27
30
|
import { eventMatcher } from "./changes/match-events.js";
|
|
28
31
|
import { parseColumns, readOutbox } from "./changes/outbox.js";
|
|
29
32
|
import { recordOf, resourceChange } from "./changes/resource-change.js";
|
|
30
|
-
import { FatalJobError } from "./jobs/run-job.js";
|
|
31
33
|
import { defineFunction } from "./functions/define-function.js";
|
|
32
34
|
import { newWebhookSecret } from "./webhooks/standard-webhooks.js";
|
|
33
35
|
import { subscription } from "./webhooks/subscription.js";
|
|
@@ -51,9 +53,9 @@ import { withTrustedApps } from "./better-auth/app-tokens.js";
|
|
|
51
53
|
import { betterAuthAuthenticator } from "./better-auth/authenticator.js";
|
|
52
54
|
import { issueToken, maxTokenTtlSeconds } from "./better-auth/tokens.js";
|
|
53
55
|
import { authSchemaMigration, checkAuthSchema } from "./better-auth/auth-schema.js";
|
|
54
|
-
import { changesMigration, checkChanges, migrationCommand } from "./changes/capture-schema.js";
|
|
55
56
|
import { webhooks } from "./webhooks/table/plugin.js";
|
|
56
57
|
import { checkWebhooksSchema, webhooksMigration } from "./webhooks/table/schema.js";
|
|
58
|
+
import { checkAi } from "./ai/check-ai.js";
|
|
57
59
|
import { maxWidgetPropsBytes, widget } from "./assistant/widget.js";
|
|
58
60
|
import { startErrorReporting } from "./error-reporting/error-reporter.js";
|
|
59
61
|
import { functionApp } from "./functions/function-app.js";
|
|
@@ -66,4 +68,4 @@ import { aspectRatio, fileSize, fileType, imageSize, processor } from "./files/p
|
|
|
66
68
|
import { defineEmail } from "./mail/define-email.js";
|
|
67
69
|
import { startJobs } from "./jobs/runtime.js";
|
|
68
70
|
import { jobsDrainApp } from "./jobs/drain-route.js";
|
|
69
|
-
export { FatalJobError, HttpProblem, MissingCredentials, ModelError, addAppRoleToOwners, addMember, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaMigration, badRequest, beforeSignInPluginsVariable, betterAuthAuthenticator, changesMigration, checkAuthSchema, checkChanges, checkJobsSchema, checkSourceNames, checkViewQueries, checkWebhooksSchema, coalesce, configExports, consoleAuditQueue, conversationKey, createAdmin, createAuth, createConversations, createFileCleanup, createOrganization, createUser, defaultSignInPolicy, defineConfig, defineEmail, defineFunction, defineJob, defineTool, deleteUser, errorReportingSettings, errorReportingVariable, eventMatcher, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, handleDroppedConnections, hasUsers, imageSize, isCaptured, isJobDefinition, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, limitedFileStore, listOrganizations, listUsers, localFileStore, localFiles, mapSettings, mapStyleUrl, mapStyleVariable, maxTokenTtlSeconds, maxWidgetPropsBytes, mergeConfig, migrationCommand, newWebhookSecret, normalizeRoles, notFound, parseColumns, parseRoles, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, processor, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIn, readWriteQueryTool, recordOf, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runReadOnlyQuery, runReadWriteQuery, runTurn, runtimeUrl, runtimeVariable, s3FileStore, s3Files, seesAssistant, seesRuntime, setMemberRoles, setUserBanned, setUserRole, signInPolicyMethods, sourceOptions, sourcesFor, sourcesVariable, startErrorReporting, startJobs, storageCleanupSchedule, storeFile, streamChatCompletion, subscription, thumbHash, unauthorized, variantPath, verifySignature, verifyStandardWebhook, webauthnPath, webhooks, webhooksMigration, widget, withCacheBreakpoints, withTrustedApps };
|
|
71
|
+
export { FatalJobError, HttpProblem, MissingCredentials, ModelError, addAppRoleToOwners, addMember, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaMigration, badRequest, beforeSignInPluginsVariable, betterAuthAuthenticator, changesMigration, checkAi, checkAuthSchema, checkChanges, checkComments, checkJobsSchema, checkSourceNames, checkViewQueries, checkWebhooksSchema, coalesce, commentsMigration, configExports, consoleAuditQueue, conversationKey, createAdmin, createAuth, createConversations, createFileCleanup, createOrganization, createUser, defaultSignInPolicy, defineConfig, defineEmail, defineFunction, defineJob, defineTool, deleteUser, errorReportingSettings, errorReportingVariable, eventMatcher, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, handleDroppedConnections, hasUsers, imageSize, isCaptured, isJobDefinition, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, limitedFileStore, listOrganizations, listUsers, localFileStore, localFiles, mapSettings, mapStyleUrl, mapStyleVariable, maxTokenTtlSeconds, maxWidgetPropsBytes, mergeConfig, migrationCommand, newWebhookSecret, normalizeRoles, notFound, parseColumns, parseRoles, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, processor, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIn, readWriteQueryTool, recordOf, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runReadOnlyQuery, runReadWriteQuery, runTurn, runtimeUrl, runtimeVariable, s3FileStore, s3Files, seesAssistant, seesRuntime, setMemberRoles, setUserBanned, setUserRole, signInPolicyMethods, sourceOptions, sourcesFor, sourcesVariable, startErrorReporting, startJobs, storageCleanupSchedule, storeFile, streamChatCompletion, subscription, thumbHash, unauthorized, variantPath, verifySignature, verifyStandardWebhook, webauthnPath, webhooks, webhooksMigration, widget, withCacheBreakpoints, withTrustedApps };
|
package/dist/jobs/runtime.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { clearCurrentJobs, setCurrentJobs } from "./current.js";
|
|
2
2
|
import { jobsSchema } from "./schema.js";
|
|
3
|
-
import { platformMailer } from "../mail/platform-mailer.js";
|
|
4
3
|
import "./schedule.js";
|
|
5
4
|
import { runJob, validatePayload } from "./run-job.js";
|
|
5
|
+
import { platformMailer } from "../mail/platform-mailer.js";
|
|
6
6
|
import { jobsDatabase } from "./database.js";
|
|
7
7
|
import { queueOptions, queueSettingsDiffer, sendOptions } from "./options.js";
|
|
8
8
|
import { createSchedules } from "./schedules.js";
|
package/dist/list-photos.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { badRequest } from "./problem.js";
|
|
2
|
-
import { presentFiles } from "./files/present.js";
|
|
3
|
-
import { exposeRow } from "./rows.js";
|
|
4
2
|
import { checkedSort } from "./filter-input.js";
|
|
5
3
|
import { readScope, requestAccess } from "./request-access.js";
|
|
4
|
+
import { presentFiles } from "./files/present.js";
|
|
5
|
+
import { exposeRow } from "./rows.js";
|
|
6
6
|
import { readTransaction } from "./transactions.js";
|
|
7
7
|
import { cardPhotosErrors } from "./view-card-photos.js";
|
|
8
8
|
import { cardPhotoLimit } from "@protobase/schema/internal";
|
|
9
|
-
import { relatedRows } from "@protobase/query";
|
|
10
9
|
import { checkFilter, createWhere } from "@protobase/schema";
|
|
10
|
+
import { relatedRows } from "@protobase/query";
|
|
11
11
|
//#region src/list-photos.ts
|
|
12
12
|
const where = createWhere();
|
|
13
13
|
const invalid = (parameter, message) => badRequest("invalid-parameter", `Invalid ${parameter}: ${message}`, { errors: [{
|
package/dist/list-service.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { checkedFilter, checkedSort } from "./filter-input.js";
|
|
2
|
+
import { readScope, requestAccess, requireOperation } from "./request-access.js";
|
|
1
3
|
import { presentFiles } from "./files/present.js";
|
|
2
4
|
import { etagAlias } from "./sql-parts.js";
|
|
3
5
|
import { etagOf } from "./etag.js";
|
|
4
6
|
import { exposeRow, pickFields } from "./rows.js";
|
|
5
|
-
import { checkedFilter, checkedSort } from "./filter-input.js";
|
|
6
|
-
import { readScope, requestAccess, requireOperation } from "./request-access.js";
|
|
7
7
|
import { rowPermissions } from "./row-permissions.js";
|
|
8
8
|
import { readTransaction } from "./transactions.js";
|
|
9
9
|
import { deletedRows, listParams, pageSizeOf, parseParams, seekParams, selectedFields } from "./params.js";
|
package/dist/map-service.js
CHANGED
|
@@ -5,8 +5,8 @@ import { parseParams, selectedFields } from "./params.js";
|
|
|
5
5
|
import { labelRequests } from "./related-labels.js";
|
|
6
6
|
import { photosRequest } from "./list-photos.js";
|
|
7
7
|
import { listRecords } from "./list-service.js";
|
|
8
|
-
import { checkMapPosition, countUpTo, mapBuckets, maxMapZoom } from "@protobase/query";
|
|
9
8
|
import { z } from "zod";
|
|
9
|
+
import { checkMapPosition, countUpTo, mapBuckets, maxMapZoom } from "@protobase/query";
|
|
10
10
|
const mapParams = z.object({
|
|
11
11
|
latitude: z.string().min(1),
|
|
12
12
|
longitude: z.string().min(1),
|
package/dist/meta.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { seesAssistant } from "./assistant/assistant-settings.js";
|
|
2
|
-
import { sha256Hex, stableJson } from "./hash.js";
|
|
3
1
|
import { requestAccess } from "./request-access.js";
|
|
2
|
+
import { sha256Hex, stableJson } from "./hash.js";
|
|
3
|
+
import { seesAssistant } from "./assistant/assistant-settings.js";
|
|
4
4
|
import { pruneView } from "./view-access.js";
|
|
5
5
|
import { activeRole } from "./active-role.js";
|
|
6
6
|
import { pluginsFor } from "./plugins/plugin-settings.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { writableFields } from "../request-access.js";
|
|
2
2
|
import { pascal } from "./naming.js";
|
|
3
|
+
import { pickView } from "@protobase/schema";
|
|
3
4
|
import { mapCellPixels, maxMapBuckets, maxMapZoom } from "@protobase/query";
|
|
4
5
|
//#region src/openapi/resource-paths.ts
|
|
5
6
|
const param = (name) => ({ $ref: `#/components/parameters/${name}` });
|
|
@@ -85,6 +86,37 @@ const page = (name, seek = false) => json({
|
|
|
85
86
|
photos
|
|
86
87
|
}
|
|
87
88
|
});
|
|
89
|
+
const person = {
|
|
90
|
+
type: "object",
|
|
91
|
+
required: ["id"],
|
|
92
|
+
properties: {
|
|
93
|
+
id: { type: "string" },
|
|
94
|
+
name: { type: "string" }
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const comment = {
|
|
98
|
+
type: "object",
|
|
99
|
+
required: [
|
|
100
|
+
"id",
|
|
101
|
+
"created_at",
|
|
102
|
+
"body",
|
|
103
|
+
"author",
|
|
104
|
+
"mentions"
|
|
105
|
+
],
|
|
106
|
+
properties: {
|
|
107
|
+
id: { type: "string" },
|
|
108
|
+
created_at: {
|
|
109
|
+
type: "string",
|
|
110
|
+
format: "date-time"
|
|
111
|
+
},
|
|
112
|
+
body: { type: "string" },
|
|
113
|
+
author: person,
|
|
114
|
+
mentions: {
|
|
115
|
+
type: "array",
|
|
116
|
+
items: person
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
88
120
|
const bounds = {
|
|
89
121
|
type: "object",
|
|
90
122
|
properties: {
|
|
@@ -140,6 +172,7 @@ const needs = {
|
|
|
140
172
|
create: "create",
|
|
141
173
|
update: "update",
|
|
142
174
|
undelete: "update",
|
|
175
|
+
generate: "update",
|
|
143
176
|
delete: "delete"
|
|
144
177
|
};
|
|
145
178
|
const withoutDenied = (paths, access) => Object.fromEntries(Object.entries(paths).flatMap(([path, methods]) => {
|
|
@@ -160,6 +193,7 @@ const resourcePaths = (access) => {
|
|
|
160
193
|
404: error("NotFound")
|
|
161
194
|
};
|
|
162
195
|
const sensitive = Object.values(access.readable.fields).filter((field) => field.sensitive).map((field) => field.name);
|
|
196
|
+
const aiActions = (pickView(access.deps.views, access.session.user.roles, entry.name)?.actions ?? []).filter((action) => action.run?.kind === "ai").map((action) => action.name);
|
|
163
197
|
const paths = {
|
|
164
198
|
[`/${entry.name}`]: {
|
|
165
199
|
get: {
|
|
@@ -325,6 +359,31 @@ const resourcePaths = (access) => {
|
|
|
325
359
|
...keyErrors
|
|
326
360
|
}
|
|
327
361
|
} } },
|
|
362
|
+
...aiActions.length > 0 && { [`/${entry.name}/{key}:generate`]: { post: {
|
|
363
|
+
operationId: `generate_${entry.name}`,
|
|
364
|
+
tags: tag,
|
|
365
|
+
summary: `Run an AI action on a ${entry.name} record`,
|
|
366
|
+
description: "The model writes the action's field from its prompt, as the caller, who must be signed in, may read the fields the prompt names and may update the field. An edit made while the model answers is a 412; empty inputs or an empty answer are a 422, and nothing is written.",
|
|
367
|
+
parameters: [param("key")],
|
|
368
|
+
requestBody: {
|
|
369
|
+
required: true,
|
|
370
|
+
content: json({
|
|
371
|
+
type: "object",
|
|
372
|
+
required: ["action"],
|
|
373
|
+
properties: { action: {
|
|
374
|
+
type: "string",
|
|
375
|
+
enum: aiActions
|
|
376
|
+
} },
|
|
377
|
+
additionalProperties: false
|
|
378
|
+
})
|
|
379
|
+
},
|
|
380
|
+
responses: {
|
|
381
|
+
200: record(name, entry),
|
|
382
|
+
...keyErrors,
|
|
383
|
+
403: error("Forbidden"),
|
|
384
|
+
412: error("PreconditionFailed")
|
|
385
|
+
}
|
|
386
|
+
} } },
|
|
328
387
|
...entry.model.history && { [`/${entry.name}/{key}:history`]: { get: {
|
|
329
388
|
operationId: `history_${entry.name}`,
|
|
330
389
|
tags: tag,
|
|
@@ -396,6 +455,98 @@ const resourcePaths = (access) => {
|
|
|
396
455
|
...keyErrors
|
|
397
456
|
}
|
|
398
457
|
} } },
|
|
458
|
+
...entry.model.comments && {
|
|
459
|
+
[`/${entry.name}/{key}:comments`]: {
|
|
460
|
+
get: {
|
|
461
|
+
operationId: `comments_${entry.name}`,
|
|
462
|
+
tags: tag,
|
|
463
|
+
summary: `The comments on a ${entry.name} record`,
|
|
464
|
+
description: "Newest first, with the same access as a get, a deleted record included.",
|
|
465
|
+
parameters: [
|
|
466
|
+
param("key"),
|
|
467
|
+
query("page_size", "Comments per page, at most 100 (default 20)", { type: "integer" }),
|
|
468
|
+
query("page_token", "The next_page_token of the previous page")
|
|
469
|
+
],
|
|
470
|
+
responses: {
|
|
471
|
+
200: {
|
|
472
|
+
description: "A page of comments",
|
|
473
|
+
content: json({
|
|
474
|
+
type: "object",
|
|
475
|
+
required: ["items", "next_page_token"],
|
|
476
|
+
properties: {
|
|
477
|
+
items: {
|
|
478
|
+
type: "array",
|
|
479
|
+
items: comment
|
|
480
|
+
},
|
|
481
|
+
next_page_token: {
|
|
482
|
+
type: "string",
|
|
483
|
+
description: "Empty on the last page"
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
})
|
|
487
|
+
},
|
|
488
|
+
...keyErrors
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
post: {
|
|
492
|
+
operationId: `comment_${entry.name}`,
|
|
493
|
+
tags: tag,
|
|
494
|
+
summary: `Comment on a ${entry.name} record`,
|
|
495
|
+
description: "For a signed-in caller who may read the record, not deleted. Each mentioned user must be able to read the record too, and is emailed a link to it.",
|
|
496
|
+
parameters: [param("key")],
|
|
497
|
+
requestBody: {
|
|
498
|
+
required: true,
|
|
499
|
+
content: json({
|
|
500
|
+
type: "object",
|
|
501
|
+
required: ["body"],
|
|
502
|
+
properties: {
|
|
503
|
+
body: {
|
|
504
|
+
type: "string",
|
|
505
|
+
maxLength: 1e4
|
|
506
|
+
},
|
|
507
|
+
mentions: {
|
|
508
|
+
type: "array",
|
|
509
|
+
items: { type: "string" },
|
|
510
|
+
maxItems: 20,
|
|
511
|
+
description: "The user ids it mentions"
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
additionalProperties: false
|
|
515
|
+
})
|
|
516
|
+
},
|
|
517
|
+
responses: {
|
|
518
|
+
201: {
|
|
519
|
+
description: "The comment",
|
|
520
|
+
content: json(comment)
|
|
521
|
+
},
|
|
522
|
+
...keyErrors,
|
|
523
|
+
403: error("Forbidden")
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
[`/${entry.name}/{key}:mentionable`]: { get: {
|
|
528
|
+
operationId: `mentionable_${entry.name}`,
|
|
529
|
+
tags: tag,
|
|
530
|
+
summary: `The users a comment on a ${entry.name} record may mention`,
|
|
531
|
+
description: "At most 8, by name: users whose name contains q who may read the record, without the caller.",
|
|
532
|
+
parameters: [param("key"), query("q", "Part of the name")],
|
|
533
|
+
responses: {
|
|
534
|
+
200: {
|
|
535
|
+
description: "The users",
|
|
536
|
+
content: json({
|
|
537
|
+
type: "object",
|
|
538
|
+
required: ["items"],
|
|
539
|
+
properties: { items: {
|
|
540
|
+
type: "array",
|
|
541
|
+
items: person
|
|
542
|
+
} }
|
|
543
|
+
})
|
|
544
|
+
},
|
|
545
|
+
...keyErrors,
|
|
546
|
+
403: error("Forbidden")
|
|
547
|
+
}
|
|
548
|
+
} }
|
|
549
|
+
},
|
|
399
550
|
[`/${entry.name}:facets`]: { get: {
|
|
400
551
|
operationId: `facets_${entry.name}`,
|
|
401
552
|
tags: tag,
|
package/dist/project-config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AdminAuth } from "./better-auth/create-auth.js";
|
|
2
2
|
import { EventsOptions } from "./changes/events-options.js";
|
|
3
|
-
import { HistoryOptions } from "./history/options.js";
|
|
4
3
|
import { Authenticator } from "./types.js";
|
|
4
|
+
import { HistoryOptions } from "./history/options.js";
|
|
5
5
|
import { WebhooksOptions } from "./webhooks/table/options.js";
|
|
6
6
|
import { FilesOptions } from "./files/options.js";
|
|
7
7
|
import { FunctionSource } from "./functions/define-function.js";
|
package/dist/read-service.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { notFound } from "./problem.js";
|
|
2
|
+
import { tenantScope } from "./tenant.js";
|
|
3
|
+
import { recordDecision, requestAccess, requireOperation, targetFilter, visibleFields, writableFields } from "./request-access.js";
|
|
2
4
|
import { presentFiles } from "./files/present.js";
|
|
3
5
|
import { pickFields } from "./rows.js";
|
|
4
6
|
import { fetchRecord } from "./records.js";
|
|
5
|
-
import { tenantScope } from "./tenant.js";
|
|
6
|
-
import { recordDecision, requestAccess, requireOperation, targetFilter, visibleFields, writableFields } from "./request-access.js";
|
|
7
7
|
import { rowPermissions } from "./row-permissions.js";
|
|
8
8
|
import { readTransaction } from "./transactions.js";
|
|
9
9
|
//#region src/read-service.ts
|