@protobase/server 0.30.1 → 0.30.2
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/files/limits.d.ts +5 -0
- package/dist/files/limits.js +10 -4
- package/dist/files/local-files.js +3 -1
- package/dist/files/runtime.js +4 -2
- package/dist/files/s3-files.js +3 -1
- package/dist/files/storage-provider.d.ts +12 -0
- package/dist/files/storage-provider.js +18 -0
- package/dist/files/store.d.ts +2 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/storage/object-key.d.ts +9 -0
- package/package.json +4 -4
package/dist/files/limits.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export type FileLimits = {
|
|
|
5
5
|
maxBytes?: number | string;
|
|
6
6
|
maxFiles?: number;
|
|
7
7
|
};
|
|
8
|
+
/** What `store` holds, in bytes and files, leaving out its own `.cleanup/` entries. */
|
|
9
|
+
export declare const storeUsage: (store: FileStore) => Promise<{
|
|
10
|
+
bytes: number;
|
|
11
|
+
files: number;
|
|
12
|
+
}>;
|
|
8
13
|
/**
|
|
9
14
|
* `store` refusing a file with `507` once it would hold more than `maxBytes` or `maxFiles`. Only files count, not the
|
|
10
15
|
* store's own `.cleanup/` entries. What the store holds is counted with `list` on the first upload and again when the
|
package/dist/files/limits.js
CHANGED
|
@@ -4,6 +4,14 @@ import { parseSize } from "@protobase/schema/internal";
|
|
|
4
4
|
//#region src/files/limits.ts
|
|
5
5
|
/** How long a count of what a store holds is trusted before it is taken again. */
|
|
6
6
|
const recountMs = 3e5;
|
|
7
|
+
/** What `store` holds, in bytes and files, leaving out its own `.cleanup/` entries. */
|
|
8
|
+
const storeUsage = async (store) => {
|
|
9
|
+
const files = (await store.list("")).filter((object) => isFilePath(object.path));
|
|
10
|
+
return {
|
|
11
|
+
bytes: files.reduce((sum, object) => sum + object.size, 0),
|
|
12
|
+
files: files.length
|
|
13
|
+
};
|
|
14
|
+
};
|
|
7
15
|
const limitReached = () => new HttpProblem(507, "storage-full", "Insufficient Storage", "The file storage is full; delete files to make room");
|
|
8
16
|
var LimitReached = class extends Error {};
|
|
9
17
|
const checkedFiles = (value) => {
|
|
@@ -27,10 +35,8 @@ const limitedFileStore = (store, limits, now = Date.now) => {
|
|
|
27
35
|
};
|
|
28
36
|
const usage = async () => {
|
|
29
37
|
if (counted && now() - counted.at < 3e5) return counted;
|
|
30
|
-
const files = (await store.list("")).filter((object) => isFilePath(object.path));
|
|
31
38
|
counted = {
|
|
32
|
-
|
|
33
|
-
files: files.length,
|
|
39
|
+
...await storeUsage(store),
|
|
34
40
|
at: now()
|
|
35
41
|
};
|
|
36
42
|
return counted;
|
|
@@ -76,4 +82,4 @@ const limitedFileStore = (store, limits, now = Date.now) => {
|
|
|
76
82
|
};
|
|
77
83
|
};
|
|
78
84
|
//#endregion
|
|
79
|
-
export { limitedFileStore, recountMs };
|
|
85
|
+
export { limitedFileStore, recountMs, storeUsage };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HttpProblem } from "../problem.js";
|
|
2
2
|
import { parseDuration } from "./duration.js";
|
|
3
3
|
import { limitedFileStore } from "./limits.js";
|
|
4
|
+
import { parseSize } from "@protobase/schema/internal";
|
|
4
5
|
//#region src/files/local-files.ts
|
|
5
6
|
const node = async () => ({
|
|
6
7
|
fs: await import("node:fs/promises"),
|
|
@@ -99,7 +100,8 @@ const localFiles = ({ dir, public: isPublic = false, publicUrl, retention, maxBy
|
|
|
99
100
|
}),
|
|
100
101
|
public: isPublic || publicUrl !== void 0,
|
|
101
102
|
...publicUrl !== void 0 && { publicUrl: publicUrl.replace(/\/$/, "") },
|
|
102
|
-
...retention !== void 0 && { retention: parseDuration(retention, "retention") }
|
|
103
|
+
...retention !== void 0 && { retention: parseDuration(retention, "retention") },
|
|
104
|
+
...maxBytes !== void 0 && { maxBytes: parseSize(maxBytes) }
|
|
103
105
|
});
|
|
104
106
|
//#endregion
|
|
105
107
|
export { localFileStore, localFiles };
|
package/dist/files/runtime.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { fileColumns, runCleanup } from "./cleanup-runner.js";
|
|
2
2
|
import { storageCleanupSchedule } from "./cleanup-schedule.js";
|
|
3
3
|
import { resolveProviders, retentionOf } from "./providers.js";
|
|
4
|
+
import { storageProviderName } from "./storage-provider.js";
|
|
4
5
|
import { createSigner } from "./signer.js";
|
|
5
6
|
import { trustedImageHosts } from "./trusted-hosts.js";
|
|
6
7
|
import { parseSize } from "@protobase/schema/internal";
|
|
@@ -13,8 +14,9 @@ const imageFields = (models) => models.flatMap((model) => Object.values(model.fi
|
|
|
13
14
|
* provider is not configured, nothing signs uploads, or a field makes image variants or placeholders without sharp.
|
|
14
15
|
*/
|
|
15
16
|
const createFilesRuntime = ({ options = {}, env, models, systemPath, storage: servesStorage = false }) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
17
|
+
const storageName = servesStorage ? storageProviderName(options) : void 0;
|
|
18
|
+
const storage = storageName && options.storage !== false ? {
|
|
19
|
+
provider: storageName,
|
|
18
20
|
maxBytes: parseSize(options.storage?.maxFileSize ?? "50 MB")
|
|
19
21
|
} : void 0;
|
|
20
22
|
const fieldProviders = models.flatMap((model) => Object.values(model.fields).flatMap((field) => field.file ? [field.file.provider] : []));
|
package/dist/files/s3-files.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { contentDisposition, servedType } from "./media-types.js";
|
|
2
2
|
import { parseDuration } from "./duration.js";
|
|
3
3
|
import { limitedFileStore } from "./limits.js";
|
|
4
|
+
import { parseSize } from "@protobase/schema/internal";
|
|
4
5
|
//#region src/files/s3-files.ts
|
|
5
6
|
const codeOf = (error) => error instanceof Error ? error.code : void 0;
|
|
6
7
|
/** A store in a bucket, under `prefix`. Downloads get presigned links, so their bytes never pass through the app. */
|
|
@@ -106,7 +107,8 @@ const s3Files = (options) => {
|
|
|
106
107
|
}),
|
|
107
108
|
public: isPublic || publicUrl !== void 0,
|
|
108
109
|
...publicUrl !== void 0 && { publicUrl: `${publicUrl.replace(/\/$/, "")}${folder === "" ? "" : `/${folder}`}` },
|
|
109
|
-
...retention !== void 0 && { retention: parseDuration(retention, "retention") }
|
|
110
|
+
...retention !== void 0 && { retention: parseDuration(retention, "retention") },
|
|
111
|
+
...maxBytes !== void 0 && { maxBytes: parseSize(maxBytes) }
|
|
110
112
|
};
|
|
111
113
|
};
|
|
112
114
|
//#endregion
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FileProvider } from "./store.js";
|
|
2
|
+
import { FilesOptions } from "./options.js";
|
|
3
|
+
//#region src/files/storage-provider.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The provider `/storage/v1` keeps object bytes in, as the app resolves it from the config and the environment, for a
|
|
6
|
+
* command that writes them, such as `protobase import supabase`. Fails when `files.storage` is `false`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const storageProvider: (options: FilesOptions, env: Record<string, string | undefined>) => {
|
|
9
|
+
name: string;
|
|
10
|
+
provider: FileProvider;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolveProviders } from "./providers.js";
|
|
2
|
+
//#region src/files/storage-provider.ts
|
|
3
|
+
/** The provider `/storage/v1` keeps object bytes in: `files.storage.provider`, default `private`. */
|
|
4
|
+
const storageProviderName = (options) => options.storage === false ? void 0 : options.storage?.provider ?? "private";
|
|
5
|
+
/**
|
|
6
|
+
* The provider `/storage/v1` keeps object bytes in, as the app resolves it from the config and the environment, for a
|
|
7
|
+
* command that writes them, such as `protobase import supabase`. Fails when `files.storage` is `false`.
|
|
8
|
+
*/
|
|
9
|
+
const storageProvider = (options, env) => {
|
|
10
|
+
const name = storageProviderName(options);
|
|
11
|
+
if (!name) throw new Error("files.storage is false in protobase.config.ts, so the app keeps no Storage objects");
|
|
12
|
+
return {
|
|
13
|
+
name,
|
|
14
|
+
provider: resolveProviders(options, env, [name])[name]
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { storageProvider, storageProviderName };
|
package/dist/files/store.d.ts
CHANGED
|
@@ -42,5 +42,7 @@ export type FileProvider = {
|
|
|
42
42
|
publicUrl?: string;
|
|
43
43
|
/** Milliseconds between a file leaving its row and its bytes being deleted; default `files.retention` (0 when public). */
|
|
44
44
|
retention?: number;
|
|
45
|
+
/** The most bytes its store takes (see `limitedFileStore`); unset for no limit. */
|
|
46
|
+
maxBytes?: number;
|
|
45
47
|
};
|
|
46
48
|
//#endregion
|
package/dist/index.d.ts
CHANGED
|
@@ -86,10 +86,12 @@ import { startErrorReporting } from "./error-reporting/error-reporter.js";
|
|
|
86
86
|
import { FunctionEnv, PublicFunctionEnv, functionApp } from "./functions/function-app.js";
|
|
87
87
|
import { SignatureOptions, StandardWebhookOptions, verifySignature, verifyStandardWebhook } from "./functions/verify-signature.js";
|
|
88
88
|
import { requireEnv } from "./functions/require-env.js";
|
|
89
|
-
import { FileLimits, limitedFileStore } from "./files/limits.js";
|
|
89
|
+
import { FileLimits, limitedFileStore, storeUsage } from "./files/limits.js";
|
|
90
90
|
import { LocalFilesOptions, localFileStore, localFiles } from "./files/local-files.js";
|
|
91
91
|
import { StoreFileInput, storeFile } from "./files/store-file.js";
|
|
92
92
|
import { S3Bucket, S3FilesOptions, S3ListPage, S3Object, s3FileStore, s3Files } from "./files/s3-files.js";
|
|
93
|
+
import { storageProvider } from "./files/storage-provider.js";
|
|
94
|
+
import { objectKey } from "./storage/object-key.js";
|
|
93
95
|
import { FileCleanupInput, createFileCleanup } from "./files/file-cleanup.js";
|
|
94
96
|
import { FileObject, FileVariantObject } from "./files/present.js";
|
|
95
97
|
import { FileRef, formatUri, variantPath } from "./files/uri.js";
|
|
@@ -100,4 +102,4 @@ import { isSchedule } from "./jobs/schedule.js";
|
|
|
100
102
|
import { DrainResult, JobsRuntime, StartJobsOptions, startJobs } from "./jobs/runtime.js";
|
|
101
103
|
import { jobsDrainApp } from "./jobs/drain-route.js";
|
|
102
104
|
import { checkJobsSchema, jobsSchema, jobsSchemaMigration } from "./jobs/schema.js";
|
|
103
|
-
export { type Admin, type AdminAuth, type AdminOptions, type ApiFunction, type ApiKeys, type ApiKeysOptions, type AppIcons, type AppIdentity, type ApprovalAnswer, type ApprovalRequest, type AssistantBackend, type AssistantOptions, type AssistantSettings, type AssistantTool, type AuditEvent, type AuditQueue, type Authenticator, type BetterAuthAuthenticatorOptions, type Caller, type CallerOptions, 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 JwtVerifyOptions, type LinkedAccount, type ListParams, type LocalFilesOptions, type MailMessage, type Mailer, type MapLayer, type MapOptions, type MapSettings, type MemberInput, MissingCredentials, type MobileConfig, ModelError, type ModelSettings, type NewOrganization, type NewUser, type OperatorProvider, type OrganizationRole, type OrganizationsOptions, type PipelineHook, type PlatformSignIn, type PluginOption, type PluginRef, type PngIcon, 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, apiKeyCaller, apiKeySettings, apiKeyVariables, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaMigration, badRequest, beforeSignInPluginsVariable, betterAuthAuthenticator, betterAuthTokens, changesMigration, checkAi, checkAuthSchema, checkChanges, checkComments, checkComputed, checkJobsSchema, checkSourceNames, checkViewQueries, checkWebhooksSchema, coalesce, commentsMigration, computedMigration, configExports, consoleAuditQueue, conversationKey, createAdmin, createAuth, createConversations, createFileCleanup, createOrganization, createUser, defaultAppName, defaultSignInPolicy, defineConfig, defineEmail, defineFunction, defineJob, defineTool, deleteUser, errorReportingSettings, errorReportingVariable, eventMatcher, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, handleDroppedConnections, hasUsers, imageSize, isBackgroundWork, isCaptured, isJobDefinition, isSchedule, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, jwtVerifier, limitedFileStore, listOrganizations, listUsers, localFileStore, localFiles, mapSettings, mapStyleUrl, mapStyleVariable, maxTokenTtlSeconds, maxWidgetPropsBytes, mergeConfig, migrationCommand, newWebhookSecret, normalizeRoles, notFound, parseColumns, parseRoles, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, pngIcons, processor, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIn, readWriteQueryTool, recordOf, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runInBackground, 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 };
|
|
105
|
+
export { type Admin, type AdminAuth, type AdminOptions, type ApiFunction, type ApiKeys, type ApiKeysOptions, type AppIcons, type AppIdentity, type ApprovalAnswer, type ApprovalRequest, type AssistantBackend, type AssistantOptions, type AssistantSettings, type AssistantTool, type AuditEvent, type AuditQueue, type Authenticator, type BetterAuthAuthenticatorOptions, type Caller, type CallerOptions, 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 JwtVerifyOptions, type LinkedAccount, type ListParams, type LocalFilesOptions, type MailMessage, type Mailer, type MapLayer, type MapOptions, type MapSettings, type MemberInput, MissingCredentials, type MobileConfig, ModelError, type ModelSettings, type NewOrganization, type NewUser, type OperatorProvider, type OrganizationRole, type OrganizationsOptions, type PipelineHook, type PlatformSignIn, type PluginOption, type PluginRef, type PngIcon, 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, apiKeyCaller, apiKeySettings, apiKeyVariables, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaMigration, badRequest, beforeSignInPluginsVariable, betterAuthAuthenticator, betterAuthTokens, changesMigration, checkAi, checkAuthSchema, checkChanges, checkComments, checkComputed, checkJobsSchema, checkSourceNames, checkViewQueries, checkWebhooksSchema, coalesce, commentsMigration, computedMigration, configExports, consoleAuditQueue, conversationKey, createAdmin, createAuth, createConversations, createFileCleanup, createOrganization, createUser, defaultAppName, defaultSignInPolicy, defineConfig, defineEmail, defineFunction, defineJob, defineTool, deleteUser, errorReportingSettings, errorReportingVariable, eventMatcher, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, handleDroppedConnections, hasUsers, imageSize, isBackgroundWork, isCaptured, isJobDefinition, isSchedule, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, jwtVerifier, limitedFileStore, listOrganizations, listUsers, localFileStore, localFiles, mapSettings, mapStyleUrl, mapStyleVariable, maxTokenTtlSeconds, maxWidgetPropsBytes, mergeConfig, migrationCommand, newWebhookSecret, normalizeRoles, notFound, objectKey, parseColumns, parseRoles, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, pngIcons, processor, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIn, readWriteQueryTool, recordOf, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runInBackground, runReadOnlyQuery, runReadWriteQuery, runTurn, runtimeUrl, runtimeVariable, s3FileStore, s3Files, seesAssistant, seesRuntime, setMemberRoles, setUserBanned, setUserRole, signInPolicyMethods, sourceOptions, sourcesFor, sourcesVariable, startErrorReporting, startJobs, storageCleanupSchedule, storageProvider, storeFile, storeUsage, streamChatCompletion, subscription, thumbHash, unauthorized, variantPath, verifySignature, verifyStandardWebhook, webauthnPath, webhooks, webhooksMigration, widget, withCacheBreakpoints, withTrustedApps };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { webauthnPath } from "./better-auth/origins.js";
|
|
|
21
21
|
import { apiKeySettings, apiKeyVariables } from "./api-keys/api-key-settings.js";
|
|
22
22
|
import { apiKeyCaller } from "./api-keys/resolve-caller.js";
|
|
23
23
|
import { jwtAuthenticator, jwtVerifier } from "./auth/jwt.js";
|
|
24
|
+
import { objectKey } from "./storage/object-key.js";
|
|
24
25
|
import { defaultAppName } from "./app-name.js";
|
|
25
26
|
import { defaultSignInPolicy, signInPolicyMethods } from "./better-auth/sign-in-policy.js";
|
|
26
27
|
import { parseRoles } from "./better-auth/parse-roles.js";
|
|
@@ -40,9 +41,10 @@ import { newWebhookSecret } from "./webhooks/standard-webhooks.js";
|
|
|
40
41
|
import { subscription } from "./webhooks/subscription.js";
|
|
41
42
|
import { errorReportingSettings, errorReportingVariable } from "./error-reporting/error-reporting-settings.js";
|
|
42
43
|
import { storageCleanupSchedule } from "./files/cleanup-schedule.js";
|
|
43
|
-
import { limitedFileStore } from "./files/limits.js";
|
|
44
|
+
import { limitedFileStore, storeUsage } from "./files/limits.js";
|
|
44
45
|
import { localFileStore, localFiles } from "./files/local-files.js";
|
|
45
46
|
import { s3FileStore, s3Files } from "./files/s3-files.js";
|
|
47
|
+
import { storageProvider } from "./files/storage-provider.js";
|
|
46
48
|
import { isBackgroundWork, runInBackground } from "./background-work.js";
|
|
47
49
|
import { mapSettings, mapStyleUrl, mapStyleVariable } from "./maps/map-settings.js";
|
|
48
50
|
import { beforeSignInPluginsVariable, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable } from "./plugins/plugin-settings.js";
|
|
@@ -75,4 +77,4 @@ import { aspectRatio, fileSize, fileType, imageSize, processor } from "./files/p
|
|
|
75
77
|
import { defineEmail } from "./mail/define-email.js";
|
|
76
78
|
import { startJobs } from "./jobs/runtime.js";
|
|
77
79
|
import { jobsDrainApp } from "./jobs/drain-route.js";
|
|
78
|
-
export { FatalJobError, HttpProblem, MissingCredentials, ModelError, addAppRoleToOwners, addMember, apiKeyCaller, apiKeySettings, apiKeyVariables, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaMigration, badRequest, beforeSignInPluginsVariable, betterAuthAuthenticator, betterAuthTokens, changesMigration, checkAi, checkAuthSchema, checkChanges, checkComments, checkComputed, checkJobsSchema, checkSourceNames, checkViewQueries, checkWebhooksSchema, coalesce, commentsMigration, computedMigration, configExports, consoleAuditQueue, conversationKey, createAdmin, createAuth, createConversations, createFileCleanup, createOrganization, createUser, defaultAppName, defaultSignInPolicy, defineConfig, defineEmail, defineFunction, defineJob, defineTool, deleteUser, errorReportingSettings, errorReportingVariable, eventMatcher, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, handleDroppedConnections, hasUsers, imageSize, isBackgroundWork, isCaptured, isJobDefinition, isSchedule, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, jwtVerifier, limitedFileStore, listOrganizations, listUsers, localFileStore, localFiles, mapSettings, mapStyleUrl, mapStyleVariable, maxTokenTtlSeconds, maxWidgetPropsBytes, mergeConfig, migrationCommand, newWebhookSecret, normalizeRoles, notFound, parseColumns, parseRoles, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, pngIcons, processor, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIn, readWriteQueryTool, recordOf, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runInBackground, 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 };
|
|
80
|
+
export { FatalJobError, HttpProblem, MissingCredentials, ModelError, addAppRoleToOwners, addMember, apiKeyCaller, apiKeySettings, apiKeyVariables, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaMigration, badRequest, beforeSignInPluginsVariable, betterAuthAuthenticator, betterAuthTokens, changesMigration, checkAi, checkAuthSchema, checkChanges, checkComments, checkComputed, checkJobsSchema, checkSourceNames, checkViewQueries, checkWebhooksSchema, coalesce, commentsMigration, computedMigration, configExports, consoleAuditQueue, conversationKey, createAdmin, createAuth, createConversations, createFileCleanup, createOrganization, createUser, defaultAppName, defaultSignInPolicy, defineConfig, defineEmail, defineFunction, defineJob, defineTool, deleteUser, errorReportingSettings, errorReportingVariable, eventMatcher, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, handleDroppedConnections, hasUsers, imageSize, isBackgroundWork, isCaptured, isJobDefinition, isSchedule, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, jwtVerifier, limitedFileStore, listOrganizations, listUsers, localFileStore, localFiles, mapSettings, mapStyleUrl, mapStyleVariable, maxTokenTtlSeconds, maxWidgetPropsBytes, mergeConfig, migrationCommand, newWebhookSecret, normalizeRoles, notFound, objectKey, parseColumns, parseRoles, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, pngIcons, processor, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIn, readWriteQueryTool, recordOf, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runInBackground, runReadOnlyQuery, runReadWriteQuery, runTurn, runtimeUrl, runtimeVariable, s3FileStore, s3Files, seesAssistant, seesRuntime, setMemberRoles, setUserBanned, setUserRole, signInPolicyMethods, sourceOptions, sourcesFor, sourcesVariable, startErrorReporting, startJobs, storageCleanupSchedule, storageProvider, storeFile, storeUsage, streamChatCompletion, subscription, thumbHash, unauthorized, variantPath, verifySignature, verifyStandardWebhook, webauthnPath, webhooks, webhooksMigration, widget, withCacheBreakpoints, withTrustedApps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/storage/object-key.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Where an object's bytes are kept in the storage provider: `storage/<sha-256 of bucket and name>/<version>`. Names may
|
|
4
|
+
* hold any character, which no provider takes in a path; the hash takes every one, and the version keeps an upload apart
|
|
5
|
+
* from the one it replaces until the database says which is current. A row without a version, as an import may leave
|
|
6
|
+
* it, is at `unversioned`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const objectKey: (bucket: string, name: string, version: string | null) => Promise<string>;
|
|
9
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/server",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.2",
|
|
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": {
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@better-auth/passkey": "^1.7.7",
|
|
34
34
|
"@better-auth/sso": "^1.7.7",
|
|
35
|
-
"@protobase/layout": "0.30.
|
|
36
|
-
"@protobase/query": "0.30.
|
|
37
|
-
"@protobase/schema": "0.30.
|
|
35
|
+
"@protobase/layout": "0.30.2",
|
|
36
|
+
"@protobase/query": "0.30.2",
|
|
37
|
+
"@protobase/schema": "0.30.2",
|
|
38
38
|
"@react-email/render": "^2.1.0",
|
|
39
39
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
40
40
|
"@sentry/core": "^11.7.0",
|