@rebasepro/server 0.29.0 → 0.29.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/{GCSStorageController-BrIYwK-M.js → GCSStorageController-Bgrcn6Uh.js} +2 -2
- package/dist/{GCSStorageController-BrIYwK-M.js.map → GCSStorageController-Bgrcn6Uh.js.map} +1 -1
- package/dist/{S3StorageController-BD2Y9fAu.js → S3StorageController-B27ibWz8.js} +2 -2
- package/dist/{S3StorageController-BD2Y9fAu.js.map → S3StorageController-B27ibWz8.js.map} +1 -1
- package/dist/{access-9uIagW6R.js → access-BihomvkO.js} +5 -5
- package/dist/access-BihomvkO.js.map +1 -0
- package/dist/api/rest/api-generator.d.ts +9 -0
- package/dist/api/rest/auth-collection-writes.d.ts +2 -2
- package/dist/api/rest/field-access-query.d.ts +1 -1
- package/dist/api/rest/query-parser.d.ts +29 -5
- package/dist/api/types.d.ts +9 -0
- package/dist/{ast-schema-editor-CNfBLvr-.js → ast-schema-editor-C0n8s_Z6.js} +2 -2
- package/dist/{ast-schema-editor-CNfBLvr-.js.map → ast-schema-editor-C0n8s_Z6.js.map} +1 -1
- package/dist/auth/user-profile.d.ts +29 -0
- package/dist/{auth-Crf0K_Ex.js → auth-C-RJT4VO.js} +11 -11
- package/dist/{auth-Crf0K_Ex.js.map → auth-C-RJT4VO.js.map} +1 -1
- package/dist/auth_adapter-HFv5axIT.js.map +1 -1
- package/dist/{backup-Cu1Xss09.js → backup-D-ds7wml.js} +6 -6
- package/dist/{backup-Cu1Xss09.js.map → backup-D-ds7wml.js.map} +1 -1
- package/dist/boot/env.d.ts +4 -2
- package/dist/boot/options.d.ts +4 -2
- package/dist/boot/resource-adapters.d.ts +1 -1
- package/dist/{branch-routes-XdCv4JwV.js → branch-routes-ClQrYUyP.js} +2 -2
- package/dist/{branch-routes-XdCv4JwV.js.map → branch-routes-ClQrYUyP.js.map} +1 -1
- package/dist/{contract-routes-Dw-7TPpm.js → contract-routes-BGXR9D5C.js} +2 -2
- package/dist/contract-routes-BGXR9D5C.js.map +1 -0
- package/dist/{cron-loader-DIvfKXNc.js → cron-loader-BN24T-O1.js} +2 -2
- package/dist/{cron-loader-DIvfKXNc.js.map → cron-loader-BN24T-O1.js.map} +1 -1
- package/dist/{cron-routes-DU3iiBvf.js → cron-routes-CjCWNcX6.js} +3 -3
- package/dist/{cron-routes-DU3iiBvf.js.map → cron-routes-CjCWNcX6.js.map} +1 -1
- package/dist/{cron-scheduler-BpZ7mPoi.js → cron-scheduler-CM08t50L.js} +2 -2
- package/dist/{cron-scheduler-BpZ7mPoi.js.map → cron-scheduler-CM08t50L.js.map} +1 -1
- package/dist/{cron-store-DzgxrJB8.js → cron-store-iv5yn27j.js} +5 -5
- package/dist/cron-store-iv5yn27j.js.map +1 -0
- package/dist/data_driver-D0mg1Y_x.js.map +1 -1
- package/dist/dist-2-J8_MGi.js +19359 -0
- package/dist/dist-2-J8_MGi.js.map +1 -0
- package/dist/dynamic-import-Bi3XK5y-.js.map +1 -1
- package/dist/{field-access-wcJeaL5H.js → field-access-BDyTY2D4.js} +2 -2
- package/dist/{field-access-wcJeaL5H.js.map → field-access-BDyTY2D4.js.map} +1 -1
- package/dist/{filter-dialect-FFhZoNGh.js → filter-dialect-CgeSm3Kl.js} +17 -2
- package/dist/filter-dialect-CgeSm3Kl.js.map +1 -0
- package/dist/{function-routes-CQ0z3WDt.js → function-routes-mSmsW34_.js} +49 -2
- package/dist/function-routes-mSmsW34_.js.map +1 -0
- package/dist/functions/context.d.ts +60 -1
- package/dist/functions/index.d.ts +2 -2
- package/dist/functions/index.js +48 -1
- package/dist/functions/index.js.map +1 -1
- package/dist/history/history-routes.d.ts +2 -1
- package/dist/{history-recorder-B1j5i1ZT.js → history-recorder-BV34l2qf.js} +3 -3
- package/dist/{history-recorder-B1j5i1ZT.js.map → history-recorder-BV34l2qf.js.map} +1 -1
- package/dist/{history-store-D-jDz4Nv.js → history-store-Dbyvv1KZ.js} +3 -3
- package/dist/{history-store-D-jDz4Nv.js.map → history-store-Dbyvv1KZ.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.es.js +361 -105
- package/dist/index.es.js.map +1 -1
- package/dist/init/health.d.ts +1 -1
- package/dist/init/surfaces.d.ts +2 -0
- package/dist/{internal-tables-CRaBxJeE.js → internal-tables-BmN-5QQr.js} +77 -15
- package/dist/internal-tables-BmN-5QQr.js.map +1 -0
- package/dist/jobs/job-store.d.ts +3 -1
- package/dist/{jobs-CzFPOfp1.js → jobs-D9RBf3Yb.js} +5 -11
- package/dist/jobs-D9RBf3Yb.js.map +1 -0
- package/dist/{jwt-GIOW5uNd.js → jwt-C3dwSo1U.js} +2 -2
- package/dist/{jwt-GIOW5uNd.js.map → jwt-C3dwSo1U.js.map} +1 -1
- package/dist/{keys-eRFGbaeH.js → keys-DmK8vGhX.js} +2 -2
- package/dist/{keys-eRFGbaeH.js.map → keys-DmK8vGhX.js.map} +1 -1
- package/dist/mcp/mcp-routes.d.ts +1 -1
- package/dist/mcp/mcp-tools.d.ts +13 -2
- package/dist/mcp/mcp-view.d.ts +7 -0
- package/dist/mcp/oauth-store.d.ts +3 -1
- package/dist/mcp/show-app-guide.d.ts +19 -0
- package/dist/{offline-Cy6woFyt-CTjHURuZ.js → offline-B6J1YUWF-CEJLzvJw.js} +71 -11
- package/dist/offline-B6J1YUWF-CEJLzvJw.js.map +1 -0
- package/dist/{offline-store-C2Sy3Kwl-DFw34Y50.js → offline-store-B7F5mimt-Bh5f-dWu.js} +55 -10
- package/dist/offline-store-B7F5mimt-Bh5f-dWu.js.map +1 -0
- package/dist/{openapi-generator-CzvnvC53.js → openapi-generator-1s5sWUnN.js} +3 -3
- package/dist/openapi-generator-1s5sWUnN.js.map +1 -0
- package/dist/{query-parser-B0HJPjPt.js → query-parser-mFFiGEFV.js} +120 -29
- package/dist/query-parser-mFFiGEFV.js.map +1 -0
- package/dist/{rls-simulator-routes-77UrbME2.js → rls-simulator-routes-C7C3f57E.js} +3 -3
- package/dist/{rls-simulator-routes-77UrbME2.js.map → rls-simulator-routes-C7C3f57E.js.map} +1 -1
- package/dist/{schema-editor-routes-MSrmYTCh.js → schema-editor-routes-BFRh4mHu.js} +3 -3
- package/dist/{schema-editor-routes-MSrmYTCh.js.map → schema-editor-routes-BFRh4mHu.js.map} +1 -1
- package/dist/{sql-export-routes-DAeT_WVm.js → sql-export-routes-9nXTfyP_.js} +2 -2
- package/dist/{sql-export-routes-DAeT_WVm.js.map → sql-export-routes-9nXTfyP_.js.map} +1 -1
- package/dist/{sql-rows-C6GEc2oE.js → sql-rows-CIThkmuF.js} +2 -2
- package/dist/sql-rows-CIThkmuF.js.map +1 -0
- package/dist/{src-DwcwNTsc.js → src-CE9LRXDq.js} +62 -13
- package/dist/src-CE9LRXDq.js.map +1 -0
- package/dist/topics/runtime.d.ts +1 -1
- package/dist/user-profile-C1UkoaJe.js +46 -0
- package/dist/user-profile-C1UkoaJe.js.map +1 -0
- package/package.json +5 -5
- package/dist/access-9uIagW6R.js.map +0 -1
- package/dist/contract-routes-Dw-7TPpm.js.map +0 -1
- package/dist/cron-store-DzgxrJB8.js.map +0 -1
- package/dist/dist-CwBjjwfY.js +0 -19359
- package/dist/dist-CwBjjwfY.js.map +0 -1
- package/dist/filter-dialect-FFhZoNGh.js.map +0 -1
- package/dist/function-routes-CQ0z3WDt.js.map +0 -1
- package/dist/internal-tables-CRaBxJeE.js.map +0 -1
- package/dist/jobs-CzFPOfp1.js.map +0 -1
- package/dist/offline-Cy6woFyt-CTjHURuZ.js.map +0 -1
- package/dist/offline-store-C2Sy3Kwl-DFw34Y50.js.map +0 -1
- package/dist/openapi-generator-CzvnvC53.js.map +0 -1
- package/dist/query-parser-B0HJPjPt.js.map +0 -1
- package/dist/sql-rows-C6GEc2oE.js.map +0 -1
- package/dist/src-DwcwNTsc.js.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -4,46 +4,46 @@ globalThis.process ??= __rebaseProcess;
|
|
|
4
4
|
__rebaseCreateRequire(import.meta.url);
|
|
5
5
|
import { r as __require, t as __commonJSMin } from "./rolldown-runtime-dW7B1o5h.js";
|
|
6
6
|
import { a as RebaseClientError, i as RebaseApiError, n as MAX_LIST_LIMIT, o as isUnsupported, s as unsupportedMethod } from "./data_driver-D0mg1Y_x.js";
|
|
7
|
-
import { C as isFieldOperation, T as EntityRelation, _ as normalizeOrderBy, b as BATCH_REF_KEY, c as collectAllPages, g as OrderBySpecError, l as paginateFind, m as normalizeInclude, p as mergeIncludeSpecs, r as deserializeFilter, t as RESERVED_QUERY_KEYS, u as resolveFindWindow, v as serializeOrderBy, x as FIELD_OPERATORS, y as withRelationReferencesOnly } from "./filter-dialect-
|
|
8
|
-
import { A as
|
|
7
|
+
import { C as isFieldOperation, T as EntityRelation, _ as normalizeOrderBy, b as BATCH_REF_KEY, c as collectAllPages, g as OrderBySpecError, l as paginateFind, m as normalizeInclude, p as mergeIncludeSpecs, r as deserializeFilter, t as RESERVED_QUERY_KEYS, u as resolveFindWindow, v as serializeOrderBy, x as FIELD_OPERATORS, y as withRelationReferencesOnly } from "./filter-dialect-CgeSm3Kl.js";
|
|
8
|
+
import { A as DEFAULT_STORAGE_SOURCE_KEY, B as RLS_ROLES_SQL, C as declaredQueueConsumers, D as resourceToStorageSource, E as resourceToDataSource, F as resourceEnvSuffix, G as isPostgresCollectionConfig, I as resourceKeyOf, J as getDataSourceCapabilities, L as resourceKind, M as DEFAULT_RESOURCE_KEY, N as buildResourceGraph, O as setQueueRuntime, P as resolveResourceRefs, R as resourceKinds, T as declaredSubscriptions, U as getCollectionDataPath, V as RLS_UID_SQL, W as getDeclaredSubcollections, Y as ALL_WHERE_FILTER_OPS, b as summarizeScopes, c as intersectScopes, g as scopeGrantsAny, h as scopeGrants, j as storageEnvSuffix, k as setTopicRuntime, p as parseScope, q as DEFAULT_DATA_SOURCE_KEY, rt as sortKeyToString, s as hasAdminRole, v as scopesForRoles, w as declaredRlsPolicyShape, z as RLS_JWT_SQL } from "./src-CE9LRXDq.js";
|
|
9
9
|
import { a as nestCollectionPatchPaths, c as ADMIN_PROPERTY_KEYS, i as isCollectionPatch, n as collectionPatchProblems, r as diffCollections, s as ADMIN_COLLECTION_KEYS, t as applyCollectionPatch } from "./collection_patch-BRu-BvDv.js";
|
|
10
|
-
import { a as restoresSoftDeletedRow, c as hydrateRegExp, d as hasForeignKeyOnTarget, f as isManyToMany, l as INCLUDE_COUNT_KEY, n as buildCollectionSchema, o as softDeleteFieldOf, r as idPropertyEntry, s as buildTenantSecurityRule, t as buildCollectionInputSchema, u as JUNCTION_PIVOT_KEY } from "./openapi-generator-
|
|
10
|
+
import { a as restoresSoftDeletedRow, c as hydrateRegExp, d as hasForeignKeyOnTarget, f as isManyToMany, l as INCLUDE_COUNT_KEY, n as buildCollectionSchema, o as softDeleteFieldOf, r as idPropertyEntry, s as buildTenantSecurityRule, t as buildCollectionInputSchema, u as JUNCTION_PIVOT_KEY } from "./openapi-generator-1s5sWUnN.js";
|
|
11
11
|
import { n as isAnonymousUid, r as policy } from "./policy-PdzX-Opd.js";
|
|
12
12
|
import { n as isSQLAdmin, r as isSchemaEditingAdmin } from "./backend-CaG_Jyso.js";
|
|
13
|
-
import { a as parseEnvBoolean, i as validateCronExpression, t as CronScheduler } from "./cron-scheduler-
|
|
13
|
+
import { a as parseEnvBoolean, i as validateCronExpression, t as CronScheduler } from "./cron-scheduler-CM08t50L.js";
|
|
14
14
|
import { c as simulationHeaders, t as AUTH_FLOW_HEADER } from "./auth_adapter-HFv5axIT.js";
|
|
15
15
|
import { n as isValidAppHost, r as reservedPrefixFor, t as SCHEMA_VERSION_HEADER } from "./project_manifest-R6y_KHms.js";
|
|
16
|
-
import { i as serializeCollections, n as createContractRoutes, r as computeSchemaVersion } from "./contract-routes-
|
|
17
|
-
import { A as isPublicObjectGrant, C as queryTokenAuth, D as userFromToken, E as requireAuth, F as decideImpersonation, G as isApiKeyToken, H as createApiKeyPreAuth, I as refuseUnhonouredImpersonation, J as extractBearerToken, K as resolveApiKey, M as storageObjectOfPath, N as storageRequestWildcard, O as PUBLIC_OBJECT_PRINCIPAL, Q as supportsRlsScoping, S as publicObjectAuth, T as requireAdmin, U as createFunctionScopeGuard, V as reportSimulatedContext, W as createTusScopeGuard, X as SERVICE_IDENTITY, Y as safeCompare, Z as scopeDataDriver, _ as createAuthMiddleware, at as httpMethodToOperation, b as fileTokenAuth, c as configureAccess, ct as isPublicStoragePath, d as keyOwnerResolverFor, et as isAccessTokenRevoked, f as processAccessControl, g as setDefaultAccessControl, h as requireScopeByMethod, it as refuseSimulatedWrite, j as requestedStorageObject, k as isDownloadTokenGrant, l as getAccessModel, lt as storageObjectPath, m as requireScope, n as accessModelFromCollections, ot as PUBLIC_STORAGE_PREFIX, q as validateApiKey, r as accessOf, s as callerScopes, st as isPublicStorageKey, u as hasScope, v as createRequireAuth, w as refuse$1, x as optionalAuth, y as extractUserFromToken } from "./access-
|
|
18
|
-
import { a as
|
|
16
|
+
import { i as serializeCollections, n as createContractRoutes, r as computeSchemaVersion } from "./contract-routes-BGXR9D5C.js";
|
|
17
|
+
import { A as isPublicObjectGrant, C as queryTokenAuth, D as userFromToken, E as requireAuth, F as decideImpersonation, G as isApiKeyToken, H as createApiKeyPreAuth, I as refuseUnhonouredImpersonation, J as extractBearerToken, K as resolveApiKey, M as storageObjectOfPath, N as storageRequestWildcard, O as PUBLIC_OBJECT_PRINCIPAL, Q as supportsRlsScoping, S as publicObjectAuth, T as requireAdmin, U as createFunctionScopeGuard, V as reportSimulatedContext, W as createTusScopeGuard, X as SERVICE_IDENTITY, Y as safeCompare, Z as scopeDataDriver, _ as createAuthMiddleware, at as httpMethodToOperation, b as fileTokenAuth, c as configureAccess, ct as isPublicStoragePath, d as keyOwnerResolverFor, et as isAccessTokenRevoked, f as processAccessControl, g as setDefaultAccessControl, h as requireScopeByMethod, it as refuseSimulatedWrite, j as requestedStorageObject, k as isDownloadTokenGrant, l as getAccessModel, lt as storageObjectPath, m as requireScope, n as accessModelFromCollections, ot as PUBLIC_STORAGE_PREFIX, q as validateApiKey, r as accessOf, s as callerScopes, st as isPublicStorageKey, u as hasScope, v as createRequireAuth, w as refuse$1, x as optionalAuth, y as extractUserFromToken } from "./access-BihomvkO.js";
|
|
18
|
+
import { a as parseWriteFilter, c as assertQueryFieldsReadable, d as cursorToStartAfter, f as decodeCursor$1, h as toDriverAggregateGroup, i as parseQueryOptions, l as assertReadableFields, m as toDriverAggregate, n as parseAggregateSelect, o as resolveListLimitParam, p as reconcileCursorOrder, r as parseGroupBy, s as assertNoHiddenAggregateNames, t as orderByEntriesToTuples, u as requestViewer } from "./query-parser-mFFiGEFV.js";
|
|
19
19
|
import { a as logger, c as setLogLevel, d as hostEnv, i as logLevelEnabled, l as setLogOutput, o as rawQueryLoggingEnabled, r as describeCauseChain, s as redactSensitiveText, t as _setLogLineHook } from "./logger-SigQ2oZJ.js";
|
|
20
20
|
import { n as suggestNearMiss, r as toSnakeCase } from "./strings.es-B7QLnHh2.js";
|
|
21
|
-
import { a as restrictedFieldNames, c as getTableName, d as relationDeclaringProperty, f as resolveCollectionRelations, l as isJunctionBackedRelation, m as toWireKey, n as canReadField, o as fieldKeyForColumn, p as resolveRelation, r as canWriteField, s as findRelation, t as apiHiddenFieldNames } from "./field-access-
|
|
22
|
-
import { c as createTransport, d as parseRebaseJson, h as unref, l as defaultCodeForStatus, m as withETag, o as createCollectionClient, p as etagOf, r as SDKQueryBuilder, u as invalidBulkBody } from "./offline-store-
|
|
23
|
-
import { $ as getEmailChangeNoticeTemplate, A as createDataRateLimitCheck, B as registerDevEmailSink, C as createJwksRoutes, D as AUTH_CONFIG_LIMIT, E as isBootstrapWindowOpen, F as activeDevEmailSink, G as validatePasswordStrength, H as createEmailService, I as clearActiveDevEmailSink, J as createAdapterAuthMiddleware, K as verifyPassword, L as createDevEmailSink, M as createRateLimiter, N as setSharedRateLimitStore, O as DEFAULT_FUNCTIONS_ANONYMOUS_LIMIT, P as MemoryRateLimitStore, Q as resolveEmailLinkBase, R as devEmailSinkFor, S as createApiKeyStore, T as configureUserPicking, U as resolveAuthHooks, V as SMTPEmailService, W as hashPassword, X as generateSecurePassword, Y as completeUserCreation, Z as assertEmailLinkBases, _ as oauthCodeFlowSchema, a as createBitbucketProvider, at as getUserInvitationTemplate, b as createApiKeyRoutes, c as createTwitterProvider, ct as RawHtml, d as createMicrosoftProvider, dt as raw, et as getEmailChangeTemplate, f as tryVerifyOidcIdToken, ft as createSqlRateLimitStore, g as createGoogleProvider, h as createLinkedinProvider, i as createSlackProvider, it as getPasswordResetTemplate, j as createDataRateLimiter, k as createAuthLimiters, l as createFacebookProvider, lt as escapeHtml, m as createGitHubProvider, mt as securityRuleToConditions, n as createCustomAuthAdapter, nt as getEmailVerificationTemplate, o as createGitLabProvider, ot as getWelcomeEmailTemplate, p as verifyOidcIdToken, pt as resolveRateLimitStoreKind, q as adapterRefusal, r as createSpotifyProvider, rt as getMagicLinkTemplate, s as createDiscordProvider, st as resolveEmailBranding, tt as getEmailOtpTemplate, u as createAppleProvider, ut as html, v as pkceTokenParams, w as createBuiltinAuthAdapter, x as createPersonalKeyRoutes, y as providerVerifiedEmail, z as extractLinks } from "./auth-
|
|
24
|
-
import "./resumable-upload-threshold-CKv-Ry0l.js";
|
|
25
|
-
import { r as revokeInternalTableSql, t as REBASE_INTERNAL_TABLES } from "./internal-tables-CRaBxJeE.js";
|
|
21
|
+
import { a as restrictedFieldNames, c as getTableName, d as relationDeclaringProperty, f as resolveCollectionRelations, l as isJunctionBackedRelation, m as toWireKey, n as canReadField, o as fieldKeyForColumn, p as resolveRelation, r as canWriteField, s as findRelation, t as apiHiddenFieldNames } from "./field-access-BDyTY2D4.js";
|
|
22
|
+
import { c as createTransport, d as parseRebaseJson, h as unref, l as defaultCodeForStatus, m as withETag, o as createCollectionClient, p as etagOf, r as SDKQueryBuilder, u as invalidBulkBody } from "./offline-store-B7F5mimt-Bh5f-dWu.js";
|
|
23
|
+
import { $ as getEmailChangeNoticeTemplate, A as createDataRateLimitCheck, B as registerDevEmailSink, C as createJwksRoutes, D as AUTH_CONFIG_LIMIT, E as isBootstrapWindowOpen, F as activeDevEmailSink, G as validatePasswordStrength, H as createEmailService, I as clearActiveDevEmailSink, J as createAdapterAuthMiddleware, K as verifyPassword, L as createDevEmailSink, M as createRateLimiter, N as setSharedRateLimitStore, O as DEFAULT_FUNCTIONS_ANONYMOUS_LIMIT, P as MemoryRateLimitStore, Q as resolveEmailLinkBase, R as devEmailSinkFor, S as createApiKeyStore, T as configureUserPicking, U as resolveAuthHooks, V as SMTPEmailService, W as hashPassword, X as generateSecurePassword, Y as completeUserCreation, Z as assertEmailLinkBases, _ as oauthCodeFlowSchema, a as createBitbucketProvider, at as getUserInvitationTemplate, b as createApiKeyRoutes, c as createTwitterProvider, ct as RawHtml, d as createMicrosoftProvider, dt as raw, et as getEmailChangeTemplate, f as tryVerifyOidcIdToken, ft as createSqlRateLimitStore, g as createGoogleProvider, h as createLinkedinProvider, i as createSlackProvider, it as getPasswordResetTemplate, j as createDataRateLimiter, k as createAuthLimiters, l as createFacebookProvider, lt as escapeHtml, m as createGitHubProvider, mt as securityRuleToConditions, n as createCustomAuthAdapter, nt as getEmailVerificationTemplate, o as createGitLabProvider, ot as getWelcomeEmailTemplate, p as verifyOidcIdToken, pt as resolveRateLimitStoreKind, q as adapterRefusal, r as createSpotifyProvider, rt as getMagicLinkTemplate, s as createDiscordProvider, st as resolveEmailBranding, tt as getEmailOtpTemplate, u as createAppleProvider, ut as html, v as pkceTokenParams, w as createBuiltinAuthAdapter, x as createPersonalKeyRoutes, y as providerVerifiedEmail, z as extractLinks } from "./auth-C-RJT4VO.js";
|
|
26
24
|
import { a as warnDeprecated, n as FilesFailedToLoadError } from "./dynamic-import-Bi3XK5y-.js";
|
|
27
|
-
import
|
|
25
|
+
import "./resumable-upload-threshold-CKv-Ry0l.js";
|
|
26
|
+
import { i as revokeInternalTableSql, t as REBASE_INTERNAL_TABLES } from "./internal-tables-BmN-5QQr.js";
|
|
27
|
+
import { C as randomHex, E as sha256Hex, S as constantTimeEqual, T as sha256Bytes, b as normalizePemFromEnv, d as hasAsymmetricSigningKey, g as setDefaultJwtService, h as processJwtService, l as getJwks, m as jwtOf, n as configureJwt, r as createJwtService, y as verifyJwt } from "./jwt-C3dwSo1U.js";
|
|
28
28
|
import { a as isConcurrentDdlRace, c as provisioningExec, l as withoutLeadingComments, o as isDuplicateObjectRace, r as createDdlBootstrapper, s as isSchemaChange, t as CONCURRENT_DDL_SQLSTATES } from "./ddl-bootstrap-DhCuwhHM.js";
|
|
29
|
-
import { t as createCronStore } from "./cron-store-
|
|
29
|
+
import { t as createCronStore } from "./cron-store-iv5yn27j.js";
|
|
30
30
|
import { a as isDataException, c as dbConnectionErrorCounts, i as errorHandler, n as DATABASE_UNAVAILABLE_MESSAGE, o as isDatabaseUnreachable, r as declaredErrorAnswer, s as schemaDriftRemedy, t as ApiError } from "./errors-DpTMfX77.js";
|
|
31
31
|
import { n as HARD_DELETE_QUERY_PARAM, r as parseHardDelete } from "./soft-delete-params-DDRmxT2z.js";
|
|
32
|
-
import { a as canonicalStorageId, i as canonicalStorageBucket, n as InvalidStorageBucketError, o as canonicalStorageKey, r as InvalidStorageKeyError, t as InvalidListOptionsError } from "./keys-
|
|
32
|
+
import { a as canonicalStorageId, i as canonicalStorageBucket, n as InvalidStorageBucketError, o as canonicalStorageKey, r as InvalidStorageKeyError, t as InvalidListOptionsError } from "./keys-DmK8vGhX.js";
|
|
33
33
|
import { t as logMiddleware } from "./logs-routes-08LiyYua.js";
|
|
34
34
|
import { a as fileWebStream, d as IMAGE_MIME_TYPES, i as bytesView, l as DEFAULT_MAX_FILE_SIZE, n as ObjectTooLargeError, o as meteredChunks, s as readStreamFully, t as validateUploadedFile, u as DOCUMENT_MIME_TYPES } from "./upload-validation-B-psYLaN.js";
|
|
35
|
-
import { t as S3StorageController } from "./S3StorageController-
|
|
36
|
-
import { t as GCSStorageController } from "./GCSStorageController-
|
|
35
|
+
import { t as S3StorageController } from "./S3StorageController-B27ibWz8.js";
|
|
36
|
+
import { t as GCSStorageController } from "./GCSStorageController-Bgrcn6Uh.js";
|
|
37
37
|
import { a as isHonoLike, i as loadFunctionsWithDiagnostics, n as loadFunctions, r as loadFunctionsFromDirectory } from "./function-loader-BzKo2Oiu.js";
|
|
38
|
-
import { a as getDriver, c as
|
|
38
|
+
import { a as getDriver, c as getSql, d as getUserProfile, f as hasRole, g as requireDriver, h as isAuthenticated, i as getApiKey, l as getUser, m as isAdmin, o as getRequestId, p as identityResolved, r as requireRole, s as getRoles, t as createFunctionRoutes, u as getUserId } from "./function-routes-mSmsW34_.js";
|
|
39
39
|
import "./proxy-LUsudeht.js";
|
|
40
40
|
import "./request-timeout-DW2OBWfJ.js";
|
|
41
41
|
import { t as FunctionSelectionError } from "./selection-CRpqKUbt.js";
|
|
42
|
-
import { a as loadCrons, i as loadCronJobsWithDiagnostics, n as declareCrons, r as loadCronJobsFromDirectory } from "./cron-loader-
|
|
43
|
-
import { t as createCronRoutes } from "./cron-routes-
|
|
44
|
-
import { a as listBackupObjects, c as readBackupBytes, i as backupStorageFromEnv, n as createBackupLinkRoutes, o as parseBackupDestination, r as createBackupRoutes, s as parseBackupTimestamp } from "./backup-
|
|
45
|
-
import { a as defaultBackoff, i as createJobQueue, n as createJobStore, o as currentAmbientTransaction, r as PermanentJobError } from "./jobs-
|
|
46
|
-
import { t as METRIC_SERIES } from "./history-store-
|
|
42
|
+
import { a as loadCrons, i as loadCronJobsWithDiagnostics, n as declareCrons, r as loadCronJobsFromDirectory } from "./cron-loader-BN24T-O1.js";
|
|
43
|
+
import { t as createCronRoutes } from "./cron-routes-CjCWNcX6.js";
|
|
44
|
+
import { a as listBackupObjects, c as readBackupBytes, i as backupStorageFromEnv, n as createBackupLinkRoutes, o as parseBackupDestination, r as createBackupRoutes, s as parseBackupTimestamp } from "./backup-D-ds7wml.js";
|
|
45
|
+
import { a as defaultBackoff, i as createJobQueue, n as createJobStore, o as currentAmbientTransaction, r as PermanentJobError } from "./jobs-D9RBf3Yb.js";
|
|
46
|
+
import { t as METRIC_SERIES } from "./history-store-Dbyvv1KZ.js";
|
|
47
47
|
import { createHash, createSign, randomBytes } from "node:crypto";
|
|
48
48
|
import * as path$2 from "node:path";
|
|
49
49
|
import path from "node:path";
|
|
@@ -1389,6 +1389,18 @@ function removeFunctions(o) {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
return o;
|
|
1391
1391
|
}
|
|
1392
|
+
//#endregion
|
|
1393
|
+
//#region ../common/src/util/identity.ts
|
|
1394
|
+
/**
|
|
1395
|
+
* A key part as an address spells it. A day key's value may reach here as a
|
|
1396
|
+
* `Date` — the admin's view model holds dates as `Date`s, parsed from the
|
|
1397
|
+
* `YYYY-MM-DD` the wire carries, which is midnight UTC — and is written back
|
|
1398
|
+
* as that day, never as the `Date`'s text.
|
|
1399
|
+
*/
|
|
1400
|
+
function keyPart(value, key) {
|
|
1401
|
+
if (key.isDay && value instanceof Date && !isNaN(value.getTime())) return value.toISOString().slice(0, 10);
|
|
1402
|
+
return String(value ?? "");
|
|
1403
|
+
}
|
|
1392
1404
|
/**
|
|
1393
1405
|
* Derive a row's address from its key columns.
|
|
1394
1406
|
*
|
|
@@ -1398,8 +1410,8 @@ function removeFunctions(o) {
|
|
|
1398
1410
|
*/
|
|
1399
1411
|
function buildCompositeId(values, primaryKeys) {
|
|
1400
1412
|
if (primaryKeys.length === 0) return "";
|
|
1401
|
-
if (primaryKeys.length === 1) return
|
|
1402
|
-
return primaryKeys.map((pk) =>
|
|
1413
|
+
if (primaryKeys.length === 1) return keyPart(values[primaryKeys[0].fieldName], primaryKeys[0]);
|
|
1414
|
+
return primaryKeys.map((pk) => keyPart(values[pk.fieldName], pk)).join(":::");
|
|
1403
1415
|
}
|
|
1404
1416
|
/**
|
|
1405
1417
|
* The primary keys of a collection, as declared by its properties.
|
|
@@ -1427,7 +1439,8 @@ function getDeclaredPrimaryKeys(collection) {
|
|
|
1427
1439
|
keys.push({
|
|
1428
1440
|
fieldName,
|
|
1429
1441
|
type: prop.type === "number" ? "number" : "string",
|
|
1430
|
-
isUUID: prop.isId === "uuid"
|
|
1442
|
+
isUUID: prop.isId === "uuid",
|
|
1443
|
+
...prop.type === "date" ? { isDay: true } : {}
|
|
1431
1444
|
});
|
|
1432
1445
|
}
|
|
1433
1446
|
return keys;
|
|
@@ -1774,7 +1787,7 @@ function hasPropertyCallbacks(properties, callbackName) {
|
|
|
1774
1787
|
/**
|
|
1775
1788
|
* Recursively process properties to apply field-level hooks.
|
|
1776
1789
|
*/
|
|
1777
|
-
async function processProperties(properties, values, previousValues,
|
|
1790
|
+
async function processProperties(properties, values, previousValues, run, callbackName) {
|
|
1778
1791
|
if (!values || typeof values !== "object") return values;
|
|
1779
1792
|
const result = { ...values };
|
|
1780
1793
|
for (const [key, property] of Object.entries(properties)) {
|
|
@@ -1784,15 +1797,11 @@ async function processProperties(properties, values, previousValues, propsContex
|
|
|
1784
1797
|
if (property.type === "array" && Array.isArray(currentValue)) {
|
|
1785
1798
|
if (property.of && !Array.isArray(property.of)) currentValue = await Promise.all(currentValue.map(async (item, index) => {
|
|
1786
1799
|
const prevItem = Array.isArray(previousValue) ? previousValue[index] : void 0;
|
|
1787
|
-
return (await processProperties({ "_tmp": property.of }, { "_tmp": item }, { "_tmp": prevItem },
|
|
1800
|
+
return (await processProperties({ "_tmp": property.of }, { "_tmp": item }, { "_tmp": prevItem }, run, callbackName))["_tmp"];
|
|
1788
1801
|
}));
|
|
1789
|
-
} else if (property.type === "map" && property.properties && typeof currentValue === "object") currentValue = await processProperties(property.properties, currentValue, previousValue ?? {},
|
|
1802
|
+
} else if (property.type === "map" && property.properties && typeof currentValue === "object") currentValue = await processProperties(property.properties, currentValue, previousValue ?? {}, run, callbackName);
|
|
1790
1803
|
if (property.callbacks?.[callbackName]) {
|
|
1791
|
-
const cbRes = await Promise.resolve(property.callbacks
|
|
1792
|
-
...propsContext,
|
|
1793
|
-
value: currentValue,
|
|
1794
|
-
previousValue
|
|
1795
|
-
}));
|
|
1804
|
+
const cbRes = await Promise.resolve(run(property.callbacks, currentValue, previousValue));
|
|
1796
1805
|
if (cbRes !== void 0) currentValue = cbRes;
|
|
1797
1806
|
}
|
|
1798
1807
|
result[key] = currentValue;
|
|
@@ -1808,14 +1817,25 @@ var buildPropertyCallbacks = (properties) => {
|
|
|
1808
1817
|
const propertyCallbacks = {};
|
|
1809
1818
|
if (hasPropertyCallbacks(properties, "afterRead")) propertyCallbacks.afterRead = async (props) => {
|
|
1810
1819
|
const row = props.row;
|
|
1811
|
-
const processedValues = await processProperties(properties, row, row,
|
|
1820
|
+
const processedValues = await processProperties(properties, row, row, (callbacks, value, previousValue) => {
|
|
1821
|
+
const args = {
|
|
1822
|
+
...props,
|
|
1823
|
+
value,
|
|
1824
|
+
previousValue
|
|
1825
|
+
};
|
|
1826
|
+
return callbacks.afterRead?.(args);
|
|
1827
|
+
}, "afterRead");
|
|
1812
1828
|
return {
|
|
1813
1829
|
...props.row,
|
|
1814
1830
|
...processedValues
|
|
1815
1831
|
};
|
|
1816
1832
|
};
|
|
1817
1833
|
if (hasPropertyCallbacks(properties, "beforeSave")) propertyCallbacks.beforeSave = async (props) => {
|
|
1818
|
-
return await processProperties(properties, props.values, props.previousValues ?? {},
|
|
1834
|
+
return await processProperties(properties, props.values, props.previousValues ?? {}, (callbacks, value, previousValue) => callbacks.beforeSave?.({
|
|
1835
|
+
...props,
|
|
1836
|
+
value,
|
|
1837
|
+
previousValue
|
|
1838
|
+
}), "beforeSave");
|
|
1819
1839
|
};
|
|
1820
1840
|
return Object.keys(propertyCallbacks).length > 0 ? propertyCallbacks : void 0;
|
|
1821
1841
|
};
|
|
@@ -2100,11 +2120,21 @@ function tenantRule(collection) {
|
|
|
2100
2120
|
const rule = buildTenantSecurityRule(collection);
|
|
2101
2121
|
return rule ? [rule] : [];
|
|
2102
2122
|
}
|
|
2123
|
+
/**
|
|
2124
|
+
* Whether a collection goes without the injected baseline: its own
|
|
2125
|
+
* `disableDefaultPolicies` when it says, otherwise the database's
|
|
2126
|
+
* `rls.defaultPolicies` (`database({ rls: { defaultPolicies: false } })`).
|
|
2127
|
+
*/
|
|
2128
|
+
function defaultPoliciesDisabled(collection) {
|
|
2129
|
+
if (!isPostgresCollectionConfig(collection)) return false;
|
|
2130
|
+
if (collection.disableDefaultPolicies !== void 0) return collection.disableDefaultPolicies;
|
|
2131
|
+
return !declaredRlsPolicyShape(collection.dataSource ?? "(default)").defaultPolicies;
|
|
2132
|
+
}
|
|
2103
2133
|
function getEffectiveSecurityRules(collection) {
|
|
2104
2134
|
const explicit = [...collection.securityRules ?? []];
|
|
2105
2135
|
const tableName = getTableName(collection);
|
|
2106
2136
|
const injected = [];
|
|
2107
|
-
if (
|
|
2137
|
+
if (defaultPoliciesDisabled(collection)) return [
|
|
2108
2138
|
...explicit,
|
|
2109
2139
|
...tenantRule(collection),
|
|
2110
2140
|
...isAuthCollection$2(collection) ? [adminWriteGate(tableName)] : []
|
|
@@ -3498,6 +3528,7 @@ var assertBeforeQueryIsPostgresOnly = (collections) => {
|
|
|
3498
3528
|
var QueryBuilder = class {
|
|
3499
3529
|
collection;
|
|
3500
3530
|
params = { where: {} };
|
|
3531
|
+
/** Only `find` and `listen` are read; any {@link CollectionAccessor} is one. */
|
|
3501
3532
|
constructor(collection) {
|
|
3502
3533
|
this.collection = collection;
|
|
3503
3534
|
}
|
|
@@ -3904,7 +3935,10 @@ function createDriverAccessor(driver, slug, getPks = () => [], toViewModel, stor
|
|
|
3904
3935
|
aggregate: driver.restFetchService?.aggregate ? async (params) => {
|
|
3905
3936
|
const limit = (params.groupBy?.length ?? 0) > 0 ? params.limit : void 0;
|
|
3906
3937
|
const rows = await driver.restFetchService.aggregate(storedPath(), {
|
|
3907
|
-
aggregates: params.select.map(
|
|
3938
|
+
aggregates: params.select.map((select) => select.where ? {
|
|
3939
|
+
...toDriverAggregate(select),
|
|
3940
|
+
filter: deserializeFilter(select.where)
|
|
3941
|
+
} : toDriverAggregate(select)),
|
|
3908
3942
|
groupBy: params.groupBy?.map((group) => toDriverAggregateGroup(group)),
|
|
3909
3943
|
filter: params.where ? deserializeFilter(params.where) : void 0,
|
|
3910
3944
|
logical: params.logical,
|
|
@@ -3940,7 +3974,9 @@ function createDriverAccessor(driver, slug, getPks = () => [], toViewModel, stor
|
|
|
3940
3974
|
path: storedPath(),
|
|
3941
3975
|
rows: data,
|
|
3942
3976
|
upsert: options?.upsert,
|
|
3943
|
-
onConflict: options?.onConflict
|
|
3977
|
+
onConflict: options?.onConflict,
|
|
3978
|
+
...options?.where ? { conflictWhere: deserializeFilter(options.where) } : {},
|
|
3979
|
+
...options?.ignoreDuplicates ? { ignoreDuplicates: true } : {}
|
|
3944
3980
|
}), slug, getPks(), toViewModel);
|
|
3945
3981
|
} : void 0,
|
|
3946
3982
|
async update(id, data) {
|
|
@@ -3972,6 +4008,19 @@ function createDriverAccessor(driver, slug, getPks = () => [], toViewModel, stor
|
|
|
3972
4008
|
ids
|
|
3973
4009
|
});
|
|
3974
4010
|
} : void 0,
|
|
4011
|
+
updateWhere: driver.updateWhere ? async (query, data) => {
|
|
4012
|
+
return rowsToEntities(await driver.updateWhere({
|
|
4013
|
+
path: storedPath(),
|
|
4014
|
+
filter: query.where ? deserializeFilter(query.where) : void 0,
|
|
4015
|
+
logical: query.logical,
|
|
4016
|
+
values: data
|
|
4017
|
+
}), slug, getPks(), toViewModel);
|
|
4018
|
+
} : void 0,
|
|
4019
|
+
deleteWhere: driver.deleteWhere ? (query) => driver.deleteWhere({
|
|
4020
|
+
path: storedPath(),
|
|
4021
|
+
filter: query.where ? deserializeFilter(query.where) : void 0,
|
|
4022
|
+
logical: query.logical
|
|
4023
|
+
}) : void 0,
|
|
3975
4024
|
count: driver.count ? (params) => countRows(params) : void 0,
|
|
3976
4025
|
trash: {
|
|
3977
4026
|
find: (params) => findRows(params, "only"),
|
|
@@ -4315,7 +4364,9 @@ function toSdkCollectionClient(snap, slug = "collection") {
|
|
|
4315
4364
|
if (!snap.createMany) throw new Error("Bulk writes are not supported by this collection's data source. Fall back to create() per record.");
|
|
4316
4365
|
return (await snap.createMany(data, {
|
|
4317
4366
|
upsert: options?.upsert,
|
|
4318
|
-
onConflict: options?.onConflict
|
|
4367
|
+
onConflict: options?.onConflict,
|
|
4368
|
+
where: options?.where,
|
|
4369
|
+
ignoreDuplicates: options?.ignoreDuplicates
|
|
4319
4370
|
})).map(entityToRow);
|
|
4320
4371
|
},
|
|
4321
4372
|
/**
|
|
@@ -4332,10 +4383,12 @@ function toSdkCollectionClient(snap, slug = "collection") {
|
|
|
4332
4383
|
if (!snap.createMany) throw new Error("Upsert is not supported by this collection's data source: it needs a bulk write, which this driver does not implement. Fall back to create() or update().");
|
|
4333
4384
|
const row = (await snap.createMany([data], {
|
|
4334
4385
|
upsert: true,
|
|
4335
|
-
onConflict: options?.onConflict
|
|
4386
|
+
onConflict: options?.onConflict,
|
|
4387
|
+
where: options?.where,
|
|
4388
|
+
ignoreDuplicates: options?.ignoreDuplicates
|
|
4336
4389
|
}))[0];
|
|
4337
|
-
if (!row) throw new Error(`Upsert into "${slug}" returned no row.`);
|
|
4338
|
-
return entityToRow(row);
|
|
4390
|
+
if (!row && !options?.where && !options?.ignoreDuplicates) throw new Error(`Upsert into "${slug}" returned no row.`);
|
|
4391
|
+
return row ? entityToRow(row) : void 0;
|
|
4339
4392
|
},
|
|
4340
4393
|
async update(id, data, options) {
|
|
4341
4394
|
refuseUnhonouredWriteOptions("update", slug, options);
|
|
@@ -4355,6 +4408,16 @@ function toSdkCollectionClient(snap, slug = "collection") {
|
|
|
4355
4408
|
refuseUnhonouredWriteOptions("delete", slug, options);
|
|
4356
4409
|
return snap.delete(id);
|
|
4357
4410
|
},
|
|
4411
|
+
async updateWhere(query, data, options) {
|
|
4412
|
+
refuseUnhonouredWriteOptions("updateWhere", slug, options);
|
|
4413
|
+
if (!snap.updateWhere) throw new Error("Filtered updates are not supported by this collection's data source. Read the rows, then updateMany() them.");
|
|
4414
|
+
return (await snap.updateWhere(query, data)).map(entityToRow);
|
|
4415
|
+
},
|
|
4416
|
+
async deleteWhere(query, options) {
|
|
4417
|
+
refuseUnhonouredWriteOptions("deleteWhere", slug, options);
|
|
4418
|
+
if (!snap.deleteWhere) throw new Error("Filtered deletes are not supported by this collection's data source. Read the rows, then deleteMany() their ids.");
|
|
4419
|
+
return snap.deleteWhere(query);
|
|
4420
|
+
},
|
|
4358
4421
|
async deleteMany(ids, options) {
|
|
4359
4422
|
refuseUnhonouredWriteOptions("deleteMany", slug, options);
|
|
4360
4423
|
if (!Array.isArray(ids)) throw new RebaseClientError("deleteMany expects an array of ids.", { code: "INVALID_BULK_BODY" });
|
|
@@ -4468,11 +4531,35 @@ function wrapAsSdkData(entityData, options) {
|
|
|
4468
4531
|
}
|
|
4469
4532
|
return accessor;
|
|
4470
4533
|
}
|
|
4471
|
-
|
|
4534
|
+
const slugOf = (accessor) => options?.resolveAccessor?.(accessor) ?? toSnakeCase(accessor);
|
|
4535
|
+
const batch = async (operations) => {
|
|
4536
|
+
if (!Array.isArray(operations)) throw new RebaseClientError("batch expects an array of operations.", { code: "INVALID_BULK_BODY" });
|
|
4537
|
+
if (operations.length === 0) return {
|
|
4538
|
+
data: [],
|
|
4539
|
+
meta: { operations: 0 }
|
|
4540
|
+
};
|
|
4541
|
+
if (!options?.batchWrite) throw new RebaseClientError("This data source cannot write a batch atomically.", { code: "BATCH_UNSUPPORTED" });
|
|
4542
|
+
return {
|
|
4543
|
+
data: await options.batchWrite({ operations: operations.map((operation) => ({
|
|
4544
|
+
op: operation.op,
|
|
4545
|
+
path: slugOf(operation.collection),
|
|
4546
|
+
..."id" in operation ? { id: operation.id } : {},
|
|
4547
|
+
..."values" in operation ? { values: operation.values } : {},
|
|
4548
|
+
...operation.op === "upsert" && operation.onConflict ? { onConflict: operation.onConflict } : {},
|
|
4549
|
+
...operation.ref ? { ref: operation.ref } : {}
|
|
4550
|
+
})) }),
|
|
4551
|
+
meta: { operations: operations.length }
|
|
4552
|
+
};
|
|
4553
|
+
};
|
|
4554
|
+
return new Proxy({
|
|
4555
|
+
collection: getAccessor,
|
|
4556
|
+
batch
|
|
4557
|
+
}, { get(_target, prop) {
|
|
4472
4558
|
if (prop === "collection") return getAccessor;
|
|
4559
|
+
if (prop === "batch") return batch;
|
|
4473
4560
|
if (typeof prop === "symbol") return void 0;
|
|
4474
4561
|
if (prop === "then" || prop === "toJSON" || prop === "$$typeof") return void 0;
|
|
4475
|
-
return getAccessor(
|
|
4562
|
+
return getAccessor(slugOf(prop));
|
|
4476
4563
|
} });
|
|
4477
4564
|
}
|
|
4478
4565
|
/**
|
|
@@ -4496,7 +4583,10 @@ function wrapAsSdkData(entityData, options) {
|
|
|
4496
4583
|
* sets it (see {@link wrapAsSdkData}); untyped by default.
|
|
4497
4584
|
*/
|
|
4498
4585
|
function buildSdkData(driver, options) {
|
|
4499
|
-
return wrapAsSdkData(buildRebaseData(driver),
|
|
4586
|
+
return wrapAsSdkData(buildRebaseData(driver), {
|
|
4587
|
+
...options,
|
|
4588
|
+
...driver.batchWrite ? { batchWrite: (props) => driver.batchWrite(props) } : {}
|
|
4589
|
+
});
|
|
4500
4590
|
}
|
|
4501
4591
|
//#endregion
|
|
4502
4592
|
//#region ../common/src/data/call-context.ts
|
|
@@ -6984,7 +7074,7 @@ function createAuth(transport, options) {
|
|
|
6984
7074
|
*
|
|
6985
7075
|
* This is where an MFA-enrolled account's real session is minted, at
|
|
6986
7076
|
* `aal2` — so this client adopts the returned tokens and announces
|
|
6987
|
-
* `SIGNED_IN`, exactly
|
|
7077
|
+
* `SIGNED_IN`, exactly like any other sign-in. Pass the same
|
|
6988
7078
|
* `mfaToken` the challenge was opened with when finishing a sign-in.
|
|
6989
7079
|
*/
|
|
6990
7080
|
async verifyChallenge(challengeId, code, options) {
|
|
@@ -8722,7 +8812,7 @@ var RebaseWebSocketClient = class {
|
|
|
8722
8812
|
this.ws.onmessage = (event) => {
|
|
8723
8813
|
this.lastFrameAt = Date.now();
|
|
8724
8814
|
try {
|
|
8725
|
-
const message = parseRebaseJson(event.data);
|
|
8815
|
+
const message = parseRebaseJson(String(event.data));
|
|
8726
8816
|
this.handleWebSocketMessage(message);
|
|
8727
8817
|
} catch (error) {
|
|
8728
8818
|
console.error("Error parsing WebSocket message:", error);
|
|
@@ -10539,7 +10629,7 @@ var LazyOfflineManager = class {
|
|
|
10539
10629
|
keepsLastUser;
|
|
10540
10630
|
constructor(config, createInner) {
|
|
10541
10631
|
this.keepsLastUser = config.keepLastUser === true;
|
|
10542
|
-
import("./offline-
|
|
10632
|
+
import("./offline-B6J1YUWF-CEJLzvJw.js").then(({ OfflineManager: Engine }) => {
|
|
10543
10633
|
const engine = new Engine(config, createInner);
|
|
10544
10634
|
this.engine = engine;
|
|
10545
10635
|
const queued = this.queued;
|
|
@@ -10651,6 +10741,8 @@ var LazyOfflineManager = class {
|
|
|
10651
10741
|
upsert: async (data, options) => (await client()).upsert(data, options),
|
|
10652
10742
|
updateMany: async (updates, options) => (await client()).updateMany(updates, options),
|
|
10653
10743
|
deleteMany: async (ids, options) => (await client()).deleteMany(ids, options),
|
|
10744
|
+
updateWhere: async (query, data, options) => (await client()).updateWhere(query, data, options),
|
|
10745
|
+
deleteWhere: async (query, options) => (await client()).deleteWhere(query, options),
|
|
10654
10746
|
update: async (id, data, options) => (await client()).update(id, data, options),
|
|
10655
10747
|
delete: async (id, options) => (await client()).delete(id, options),
|
|
10656
10748
|
count: async (params) => (await client()).count(params),
|
|
@@ -11212,7 +11304,8 @@ var PROPERTY_KEYS_BY_TYPE = {
|
|
|
11212
11304
|
"columnType",
|
|
11213
11305
|
"mode",
|
|
11214
11306
|
"timezone",
|
|
11215
|
-
"autoValue"
|
|
11307
|
+
"autoValue",
|
|
11308
|
+
"isId"
|
|
11216
11309
|
],
|
|
11217
11310
|
geopoint: [],
|
|
11218
11311
|
binary: [],
|
|
@@ -11805,7 +11898,7 @@ var TENANT_FIELD_TYPES = /* @__PURE__ */ new Set([
|
|
|
11805
11898
|
* record, and `getTableName` and `getEffectiveSecurityRules` are both typed on
|
|
11806
11899
|
* the finished type. Nothing structural bridges the two, so the conversion is
|
|
11807
11900
|
* irreducible here; what it should not be is scattered, which is how two call
|
|
11808
|
-
* sites came to spell
|
|
11901
|
+
* sites came to spell the double cast to `CollectionConfig` independently.
|
|
11809
11902
|
*
|
|
11810
11903
|
* Both helpers read fields this module has already checked by the time they are
|
|
11811
11904
|
* called, and both are total on a record that is missing them — `getTableName`
|
|
@@ -11824,7 +11917,7 @@ function asCollectionConfig(collection) {
|
|
|
11824
11917
|
* `{ dataSource?: string; engine?: string; databaseId?: string }` — and what
|
|
11825
11918
|
* this file holds is a `Record<string, unknown>` straight out of the user's
|
|
11826
11919
|
* config, whose values are `unknown`. The call sites answered that mismatch
|
|
11827
|
-
* with `collection
|
|
11920
|
+
* with a double cast of `collection` to `CollectionConfig`, which names a type nothing
|
|
11828
11921
|
* here asks for and asserts far more than the question needs: a config
|
|
11829
11922
|
* declaring `engine: 42` was read as an engine and routed on.
|
|
11830
11923
|
*
|
|
@@ -11931,6 +12024,7 @@ function checkPrimaryKeyStrategy(collection, at, collect) {
|
|
|
11931
12024
|
const needs = property.isId === "increment" ? "number" : "string";
|
|
11932
12025
|
collect.error(`${at}.properties.${key}.isId`, `\`isId: "${property.isId}"\` needs a ${needs} property, and this one is \`type: "${String(property.type)}"\`. Any other string is read as a raw SQL default, so the column would get \`DEFAULT ${property.isId}\`, which Postgres refuses. ` + (property.isId === "increment" ? "Make the key `type: \"number\"`, or use `isId: \"uuid\"` for a string key." : "Make the key `type: \"string\"`, or use `isId: \"increment\"` for a number key."));
|
|
11933
12026
|
}
|
|
12027
|
+
if (property.type === "date" && (property.columnType !== "date" || property.isId !== true && property.isId !== "manual")) collect.error(`${at}.properties.${key}.isId`, "A `date` property can be part of the key only as a calendar day the caller supplies: `columnType: \"date\"` and `isId: \"manual\"` (or `true`)" + (property.columnType !== "date" ? `, and this one is \`columnType: "${String(property.columnType ?? "timestamp")}"\`.` : ".") + " To key on an instant, key on a string or number and keep the timestamp beside it.");
|
|
11934
12028
|
if (property.isId === "increment" && property.columnType !== void 0) collect.warn(`${at}.properties.${key}.columnType`, `\`columnType: "${String(property.columnType)}"\` is not read beside \`isId: "increment"\`. An increment key is \`INTEGER GENERATED BY DEFAULT AS IDENTITY\` on every path, because every foreign key and junction column that points at a numeric primary key is INTEGER — a wider key would be referenced by narrower columns. Remove the \`columnType\`.`);
|
|
11935
12029
|
}
|
|
11936
12030
|
}
|
|
@@ -14820,7 +14914,7 @@ function containsBatchRef(value) {
|
|
|
14820
14914
|
* of its own. (The Postgres socket calls the adapter's methods directly.)
|
|
14821
14915
|
*
|
|
14822
14916
|
* Every function here leaves any other collection, and an adapter without the
|
|
14823
|
-
* step, exactly as it was: the rows are then written
|
|
14917
|
+
* step, exactly as it was: the rows are then written like any table's.
|
|
14824
14918
|
*/
|
|
14825
14919
|
/** Whether `collection` is the auth collection — its rows are the users. */
|
|
14826
14920
|
function isAuthCollection(collection) {
|
|
@@ -14834,7 +14928,7 @@ function collectionAuthConfig(collection) {
|
|
|
14834
14928
|
/**
|
|
14835
14929
|
* Whether a create on `collection` is a user creation `adapter` performs: the
|
|
14836
14930
|
* collection is the auth collection and the adapter has the step. When not,
|
|
14837
|
-
* the door writes the row
|
|
14931
|
+
* the door writes the row like any other.
|
|
14838
14932
|
*/
|
|
14839
14933
|
function createsUsers(adapter, collection) {
|
|
14840
14934
|
return !!adapter?.prepareUserCreation && isAuthCollection(collection);
|
|
@@ -14966,7 +15060,7 @@ async function completeUserCreations(adapter, prepared, rows) {
|
|
|
14966
15060
|
* then {@link completeUserCreations}.
|
|
14967
15061
|
*
|
|
14968
15062
|
* `undefined` when the create is not a user creation ({@link createsUsers}) —
|
|
14969
|
-
* the door then writes the row
|
|
15063
|
+
* the door then writes the row like any other.
|
|
14970
15064
|
*/
|
|
14971
15065
|
async function createUserThroughAuthCollection(adapter, collection, body, caller, save) {
|
|
14972
15066
|
if (!createsUsers(adapter, collection)) return void 0;
|
|
@@ -15276,7 +15370,7 @@ var RestApiGenerator = class RestApiGenerator {
|
|
|
15276
15370
|
const userCreations = [];
|
|
15277
15371
|
operations.forEach((operation, index) => {
|
|
15278
15372
|
this.enforceApiKeyPermission({
|
|
15279
|
-
get:
|
|
15373
|
+
get: c.get,
|
|
15280
15374
|
req: { method: operation.op === "delete" ? "DELETE" : "POST" }
|
|
15281
15375
|
}, operation.collection, operation.op === "delete" ? "delete" : "write");
|
|
15282
15376
|
const collection = bySlug.get(operation.collection);
|
|
@@ -15384,6 +15478,18 @@ var RestApiGenerator = class RestApiGenerator {
|
|
|
15384
15478
|
throw ApiError.badRequest(`Operation ${index}: an ${operation.op} on "${collection.slug}", whose rows are the users, cannot carry a \`\$ref\`. Its user-administration checks run before the batch's transaction opens, where a reference is not yet a value. Name the user and the values directly.`, "INVALID_BATCH_REF");
|
|
15385
15479
|
}
|
|
15386
15480
|
/**
|
|
15481
|
+
* Refuse a filtered write on the collection whose rows are the users.
|
|
15482
|
+
*
|
|
15483
|
+
* A user update or delete runs administration checks per user before the
|
|
15484
|
+
* write's transaction opens (the last administrator, sessions to end), and
|
|
15485
|
+
* a filter does not name the users until it runs. Name them: `updateMany`
|
|
15486
|
+
* and `deleteMany` with their ids.
|
|
15487
|
+
*/
|
|
15488
|
+
assertNoFilteredUserWrite(collection) {
|
|
15489
|
+
if (!isAuthCollection(collection)) return;
|
|
15490
|
+
throw ApiError.badRequest(`"${collection.slug}" holds the users, whose updates and deletes are checked user by user before they run. A filter names no user until it runs: read the users, then update or delete them by id.`, "FILTERED_USER_WRITE");
|
|
15491
|
+
}
|
|
15492
|
+
/**
|
|
15387
15493
|
* A 404 that says which row was not found, and names the other reason.
|
|
15388
15494
|
*
|
|
15389
15495
|
* "Entity not found" was the entire message on five routes. It does not say
|
|
@@ -16085,6 +16191,12 @@ var RestApiGenerator = class RestApiGenerator {
|
|
|
16085
16191
|
if (body.upsert === true) assertNoUserUpsert(this.authAdapter, resolvedCollection);
|
|
16086
16192
|
const onConflict = resolveConflictTarget(body.onConflict, resolvedCollection);
|
|
16087
16193
|
if (onConflict && body.upsert !== true) throw ApiError.badRequest("`onConflict` names where an upsert matches, but `upsert` is not set. Send `upsert: true`, or drop `onConflict`.", "INVALID_BULK_BODY");
|
|
16194
|
+
if (body.ignoreDuplicates !== void 0 && typeof body.ignoreDuplicates !== "boolean") throw ApiError.badRequest("`ignoreDuplicates` must be a boolean.", "INVALID_BULK_BODY");
|
|
16195
|
+
const conflictWhere = body.where !== void 0 ? parseWriteFilter({ where: body.where }, {
|
|
16196
|
+
collection: resolvedCollection,
|
|
16197
|
+
viewer: requestViewer(c)
|
|
16198
|
+
}).filter : void 0;
|
|
16199
|
+
if ((conflictWhere || body.ignoreDuplicates === true) && body.upsert !== true) throw ApiError.badRequest("`where` and `ignoreDuplicates` say what an upsert does to a stored row, but `upsert` is not set. Send `upsert: true`, or drop them.", "INVALID_BULK_BODY");
|
|
16088
16200
|
if (!driver.saveMany) throw ApiError.badRequest("This collection's data source does not support bulk writes.", "BULK_UNSUPPORTED");
|
|
16089
16201
|
const userAdapter = body.upsert !== true && createsUsers(this.authAdapter, resolvedCollection) ? this.authAdapter : void 0;
|
|
16090
16202
|
rows.forEach((row, rowIndex) => {
|
|
@@ -16108,7 +16220,9 @@ var RestApiGenerator = class RestApiGenerator {
|
|
|
16108
16220
|
rows,
|
|
16109
16221
|
collection: resolvedCollection,
|
|
16110
16222
|
upsert: body.upsert === true,
|
|
16111
|
-
onConflict
|
|
16223
|
+
onConflict,
|
|
16224
|
+
...conflictWhere ? { conflictWhere } : {},
|
|
16225
|
+
...body.ignoreDuplicates === true ? { ignoreDuplicates: true } : {}
|
|
16112
16226
|
});
|
|
16113
16227
|
return {
|
|
16114
16228
|
data: written.map((row) => this.formatResponse(row)),
|
|
@@ -16121,6 +16235,32 @@ var RestApiGenerator = class RestApiGenerator {
|
|
|
16121
16235
|
const driver = this.getScopedDriver(c);
|
|
16122
16236
|
const path = collection.slug;
|
|
16123
16237
|
const body = await parseJsonBody(c);
|
|
16238
|
+
if (body?.updates === void 0 && (body?.where !== void 0 || body?.logical !== void 0)) {
|
|
16239
|
+
this.assertNoFilteredUserWrite(resolvedCollection);
|
|
16240
|
+
const { filter, logical } = parseWriteFilter(body, {
|
|
16241
|
+
collection: resolvedCollection,
|
|
16242
|
+
viewer: requestViewer(c)
|
|
16243
|
+
});
|
|
16244
|
+
if (typeof body.data !== "object" || body.data === null || Array.isArray(body.data)) throw ApiError.badRequest("A filtered update needs `data`: an object of the fields to set.", "INVALID_BULK_BODY");
|
|
16245
|
+
const data = body.data;
|
|
16246
|
+
assertKnownWriteFields(data, resolvedCollection, { viewer: requestViewer(c) });
|
|
16247
|
+
assertWriteValuesValid(data, resolvedCollection, {});
|
|
16248
|
+
assertFieldOpsValid(data, resolvedCollection, {});
|
|
16249
|
+
if (!driver.updateWhere) throw ApiError.badRequest("This collection's data source does not support filtered updates.", "BULK_UNSUPPORTED");
|
|
16250
|
+
return this.runIdempotent(c, body, async () => {
|
|
16251
|
+
const written = await driver.updateWhere({
|
|
16252
|
+
path,
|
|
16253
|
+
filter,
|
|
16254
|
+
logical,
|
|
16255
|
+
values: data,
|
|
16256
|
+
collection: resolvedCollection
|
|
16257
|
+
});
|
|
16258
|
+
return {
|
|
16259
|
+
data: written.map((row) => this.formatResponse(row)),
|
|
16260
|
+
meta: { written: written.length }
|
|
16261
|
+
};
|
|
16262
|
+
}, (result) => this.respondBulk(c, result, resolvedCollection));
|
|
16263
|
+
}
|
|
16124
16264
|
assertBulkShape(body?.updates, "updates", true);
|
|
16125
16265
|
const updates = body.updates;
|
|
16126
16266
|
if (updates.length === 0) return c.json({
|
|
@@ -16162,6 +16302,23 @@ var RestApiGenerator = class RestApiGenerator {
|
|
|
16162
16302
|
const driver = this.getScopedDriver(c);
|
|
16163
16303
|
const path = collection.slug;
|
|
16164
16304
|
const body = await parseJsonBody(c);
|
|
16305
|
+
if (body?.ids === void 0 && (body?.where !== void 0 || body?.logical !== void 0)) {
|
|
16306
|
+
this.assertNoFilteredUserWrite(resolvedCollection);
|
|
16307
|
+
const { filter, logical } = parseWriteFilter(body, {
|
|
16308
|
+
collection: resolvedCollection,
|
|
16309
|
+
viewer: requestViewer(c)
|
|
16310
|
+
});
|
|
16311
|
+
if (!driver.deleteWhere) throw ApiError.badRequest("This collection's data source does not support filtered deletes.", "BULK_UNSUPPORTED");
|
|
16312
|
+
return this.runIdempotent(c, body, async () => {
|
|
16313
|
+
return { meta: { deleted: await driver.deleteWhere({
|
|
16314
|
+
hard: parseHardDelete(c.req.query(HARD_DELETE_QUERY_PARAM)),
|
|
16315
|
+
path,
|
|
16316
|
+
filter,
|
|
16317
|
+
logical,
|
|
16318
|
+
collection: resolvedCollection
|
|
16319
|
+
}) } };
|
|
16320
|
+
}, (result) => this.respondBulk(c, result, resolvedCollection));
|
|
16321
|
+
}
|
|
16165
16322
|
assertBulkShape(body?.ids, "ids", false);
|
|
16166
16323
|
const ids = body.ids;
|
|
16167
16324
|
if (ids.length === 0) return c.json({ meta: { deleted: 0 } });
|
|
@@ -16306,7 +16463,7 @@ var RestApiGenerator = class RestApiGenerator {
|
|
|
16306
16463
|
if (parsed.id === "query") {
|
|
16307
16464
|
const nested = this.resolveNestedPath(parsed.collectionPath);
|
|
16308
16465
|
this.enforceSubcollectionApiKeyPermission({
|
|
16309
|
-
get:
|
|
16466
|
+
get: c.get,
|
|
16310
16467
|
req: { method: "GET" }
|
|
16311
16468
|
}, nested);
|
|
16312
16469
|
return this.listRows(c, nested.chain[nested.chain.length - 1], await this.queryDictFromRequest(c), nested.path);
|
|
@@ -16314,7 +16471,7 @@ var RestApiGenerator = class RestApiGenerator {
|
|
|
16314
16471
|
if (parsed.id === "count") {
|
|
16315
16472
|
const nested = this.resolveNestedPath(parsed.collectionPath);
|
|
16316
16473
|
this.enforceSubcollectionApiKeyPermission({
|
|
16317
|
-
get:
|
|
16474
|
+
get: c.get,
|
|
16318
16475
|
req: { method: "GET" }
|
|
16319
16476
|
}, nested);
|
|
16320
16477
|
return this.countRows(c, nested.chain[nested.chain.length - 1], await this.queryDictFromRequest(c), nested.path);
|
|
@@ -16492,10 +16649,16 @@ var RestApiGenerator = class RestApiGenerator {
|
|
|
16492
16649
|
const fetchService = driver.restFetchService;
|
|
16493
16650
|
if (!fetchService?.aggregate) throw new ApiError(501, "AGGREGATE_NOT_SUPPORTED", "Aggregates are not implemented for this backend's data driver.");
|
|
16494
16651
|
const groups = parseGroupBy(groupBy);
|
|
16495
|
-
const
|
|
16496
|
-
|
|
16652
|
+
const columnOf = (field) => field.split("->")[0].trim();
|
|
16653
|
+
const groupFields = (groups ?? []).map((group) => columnOf(typeof group === "string" ? group : group.field));
|
|
16654
|
+
const selected = aggregates.map((a) => ({
|
|
16655
|
+
fn: a.fn,
|
|
16656
|
+
field: a.field === void 0 ? void 0 : columnOf(a.field)
|
|
16657
|
+
}));
|
|
16658
|
+
assertReadableFields(selected.map((a) => a.field), collection, viewer, "select");
|
|
16497
16659
|
assertReadableFields(groupFields, collection, viewer, "groupBy");
|
|
16498
|
-
assertNoHiddenAggregateNames(
|
|
16660
|
+
assertNoHiddenAggregateNames(selected, groupFields, collection);
|
|
16661
|
+
for (const aggregate of aggregates) if (aggregate.filter) assertQueryFieldsReadable({ where: aggregate.filter }, collection, viewer);
|
|
16499
16662
|
const grouped = groups !== void 0 && groups.length > 0;
|
|
16500
16663
|
const orderBy = orderByEntriesToTuples(queryOptions.orderBy);
|
|
16501
16664
|
if (queryOptions.cursor || !grouped && (queryOptions.offset || orderBy)) throw ApiError.badRequest(queryOptions.cursor ? "An aggregate is not paged by cursor: `after` continues after a row, and a group is not one. Page the groups with `offset` or `page`." : "`offset`, `page` and `orderBy` page through the groups of an aggregate, and without `groupBy` it has one row. Add `groupBy`, or drop them.", "INVALID_AGGREGATE_WINDOW");
|
|
@@ -16733,14 +16896,14 @@ async function isHonoDefaultNotFound(res) {
|
|
|
16733
16896
|
}
|
|
16734
16897
|
/** Whether `onError` has been called on this app. */
|
|
16735
16898
|
function hasOwnErrorHandler(app) {
|
|
16736
|
-
const current = app
|
|
16899
|
+
const current = Reflect.get(app, "errorHandler");
|
|
16737
16900
|
if (typeof current !== "function") return true;
|
|
16738
16901
|
return current !== defaultErrorHandler();
|
|
16739
16902
|
}
|
|
16740
16903
|
/** Hono's own default, read once off an app nobody has configured. */
|
|
16741
16904
|
var cachedDefault;
|
|
16742
16905
|
function defaultErrorHandler() {
|
|
16743
|
-
if (cachedDefault === void 0) cachedDefault = new Hono()
|
|
16906
|
+
if (cachedDefault === void 0) cachedDefault = Reflect.get(new Hono(), "errorHandler");
|
|
16744
16907
|
return cachedDefault;
|
|
16745
16908
|
}
|
|
16746
16909
|
//#endregion
|
|
@@ -16765,12 +16928,29 @@ function defaultErrorHandler() {
|
|
|
16765
16928
|
* segment by segment, so the answer is the concrete prefix (`/acme/data`).
|
|
16766
16929
|
*/
|
|
16767
16930
|
function requestMountPath(c) {
|
|
16768
|
-
const pattern =
|
|
16931
|
+
const pattern = handlerRoutePath(c).replace(/\/?\*$/, "");
|
|
16769
16932
|
if (!/[:*{]/.test(pattern)) return pattern;
|
|
16770
16933
|
const depth = pattern.split("/").filter(Boolean).length;
|
|
16771
16934
|
return `/${c.req.path.split("/").filter(Boolean).slice(0, depth).join("/")}`;
|
|
16772
16935
|
}
|
|
16773
16936
|
/**
|
|
16937
|
+
* The path the running handler was registered under.
|
|
16938
|
+
*
|
|
16939
|
+
* `routePath(c)` reads the match result under a `Symbol()` private to the copy
|
|
16940
|
+
* of hono it came from. A host app that mounts these groups may run on another
|
|
16941
|
+
* physical copy (a linked checkout, an install pnpm could not dedupe); its
|
|
16942
|
+
* requests carry the match under that copy's symbol, the helper finds nothing
|
|
16943
|
+
* and throws, and every request through the group answered 500. The request's
|
|
16944
|
+
* own `routePath` getter reads the same value from whichever copy built it.
|
|
16945
|
+
*/
|
|
16946
|
+
function handlerRoutePath(c) {
|
|
16947
|
+
try {
|
|
16948
|
+
return routePath(c);
|
|
16949
|
+
} catch {
|
|
16950
|
+
return c.req.routePath;
|
|
16951
|
+
}
|
|
16952
|
+
}
|
|
16953
|
+
/**
|
|
16774
16954
|
* A group's first middleware: record where the group is mounted as
|
|
16775
16955
|
* `c.var.mountPath`, for everything after it in the same request.
|
|
16776
16956
|
*
|
|
@@ -20593,11 +20773,11 @@ async function createStorageController(config) {
|
|
|
20593
20773
|
switch (config.type) {
|
|
20594
20774
|
case "local": return new LocalStorageController(config);
|
|
20595
20775
|
case "s3": {
|
|
20596
|
-
const { S3StorageController } = await import("./S3StorageController-
|
|
20776
|
+
const { S3StorageController } = await import("./S3StorageController-B27ibWz8.js").then((n) => n.n);
|
|
20597
20777
|
return new S3StorageController(config);
|
|
20598
20778
|
}
|
|
20599
20779
|
case "gcs": {
|
|
20600
|
-
const { GCSStorageController } = await import("./GCSStorageController-
|
|
20780
|
+
const { GCSStorageController } = await import("./GCSStorageController-Bgrcn6Uh.js").then((n) => n.n);
|
|
20601
20781
|
return new GCSStorageController(config);
|
|
20602
20782
|
}
|
|
20603
20783
|
default: throw new Error(`Unknown storage type: ${config.type}. Built-in types: local, s3, gcs. For other providers, implement the StorageController interface directly.`);
|
|
@@ -20839,7 +21019,7 @@ function noCollectionsCause(unprotected) {
|
|
|
20839
21019
|
* routes wherever and as often as the application asks.
|
|
20840
21020
|
*/
|
|
20841
21021
|
async function loadOpenApiGenerator() {
|
|
20842
|
-
const { generateOpenApiSpec } = await import("./openapi-generator-
|
|
21022
|
+
const { generateOpenApiSpec } = await import("./openapi-generator-1s5sWUnN.js").then((n) => n.i);
|
|
20843
21023
|
return generateOpenApiSpec;
|
|
20844
21024
|
}
|
|
20845
21025
|
/**
|
|
@@ -23268,11 +23448,10 @@ function resolveSurfaces(options, env = {}) {
|
|
|
23268
23448
|
* `options` decide.
|
|
23269
23449
|
*/
|
|
23270
23450
|
function resolveOwnership(options, env = {}) {
|
|
23271
|
-
const cronFromEnv = parseEnvBoolean(env.REBASE_CRON_SCHEDULER);
|
|
23272
23451
|
return {
|
|
23273
|
-
cronScheduler: options?.cronScheduler ??
|
|
23274
|
-
jobWorkers: options?.jobWorkers ?? true,
|
|
23275
|
-
rlsAudit: options?.rlsAudit ?? true
|
|
23452
|
+
cronScheduler: options?.cronScheduler ?? parseEnvBoolean(env.REBASE_CRON_SCHEDULER) ?? true,
|
|
23453
|
+
jobWorkers: options?.jobWorkers ?? parseEnvBoolean(env.REBASE_JOB_WORKERS) ?? true,
|
|
23454
|
+
rlsAudit: options?.rlsAudit ?? parseEnvBoolean(env.REBASE_RLS_AUDIT) ?? true
|
|
23276
23455
|
};
|
|
23277
23456
|
}
|
|
23278
23457
|
/** The surfaces a process is not serving. Literal: off is off, however it got there. */
|
|
@@ -26315,6 +26494,32 @@ function relationTargetSlug(holder) {
|
|
|
26315
26494
|
function isRecord$1(value) {
|
|
26316
26495
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26317
26496
|
}
|
|
26497
|
+
//#endregion
|
|
26498
|
+
//#region src/mcp/show-app-guide.ts
|
|
26499
|
+
/**
|
|
26500
|
+
* How to write show_app's code: the modules an app imports, and what each
|
|
26501
|
+
* gives it. The guide is what {@link SHOW_APP_GUIDE_TOOL} returns; show_app's
|
|
26502
|
+
* own description carries only {@link SHOW_APP_ESSENTIALS}, because a host
|
|
26503
|
+
* cuts a long description short (claude.ai at about 4,000 characters, which
|
|
26504
|
+
* left the UI kit's half of the guide unread). The hosted connector serves
|
|
26505
|
+
* the same two.
|
|
26506
|
+
*
|
|
26507
|
+
* Every name it imports or documents is one the view serves
|
|
26508
|
+
* (`MCP_APP_MODULES` in `@rebasepro/types`); `test/mcp-app-guide.test.ts`
|
|
26509
|
+
* holds it to that list, both ways.
|
|
26510
|
+
*/
|
|
26511
|
+
/** The tool that returns {@link SHOW_APP_CODE_GUIDE}. */
|
|
26512
|
+
var SHOW_APP_GUIDE_TOOL = "show_app_guide";
|
|
26513
|
+
/**
|
|
26514
|
+
* What show_app's description says of the code: where the guide is, and the
|
|
26515
|
+
* mistakes an app written without it makes. Short enough to be read whole.
|
|
26516
|
+
*/
|
|
26517
|
+
var SHOW_APP_ESSENTIALS = `
|
|
26518
|
+
Call ${SHOW_APP_GUIDE_TOOL} before writing the code: it gives every hook, component and prop an app may use, with a worked example. Props guessed from other libraries draw nothing. In short:
|
|
26519
|
+
- One TSX module, default-exporting a React component with no props. Its only imports: "react"; "@rebasepro/app" (useRows, useRow, useRowCount, useAggregate, useRowWrites: the project's rows as the user); "@rebasepro/cms" (CollectionPanel, RecordForm, FormField, RecordDetail, FieldValue, useSidePanel: the admin panel's own views and forms); "@rebasepro/ui" (the UI kit: SplitView, KpiGrid, KpiTile, ChartCard, BarChart, TimeSeriesChart, Card, Button, Tabs, …).
|
|
26520
|
+
- A list and a form: <SplitView master={…} detail={…} selected={…} onClearSelection={…} /> inside a parent with a height (style={{ height: 560 }}), never grid columns side by side.
|
|
26521
|
+
- Figures and charts: KpiTile and BarChart, not drawn by hand.
|
|
26522
|
+
- Tailwind's standard utilities only: an arbitrary value (h-[560px]) does nothing.`;
|
|
26318
26523
|
var SHOW_APP_CODE_GUIDE = `
|
|
26319
26524
|
The app is one TSX module whose default export is a React component (hooks welcome, no props). It runs in the conversation inside the project's admin panel, as the user, and imports Rebase's own packages, so the same code works in the project. It may import only these names:
|
|
26320
26525
|
- "react".
|
|
@@ -26833,10 +27038,11 @@ function pick(args, names) {
|
|
|
26833
27038
|
return Object.fromEntries(names.filter((name) => args[name] !== void 0).map((name) => [name, args[name]]));
|
|
26834
27039
|
}
|
|
26835
27040
|
/** A screen's payload for its view: its block, and the configs it is drawn from, for this caller. */
|
|
26836
|
-
function viewPayload(resolved, ctx, title) {
|
|
27041
|
+
function viewPayload(resolved, ctx, title, readAt) {
|
|
26837
27042
|
return {
|
|
26838
27043
|
version: 1,
|
|
26839
27044
|
...title && { title },
|
|
27045
|
+
...readAt !== void 0 && { readAt },
|
|
26840
27046
|
blocks: [resolved.block],
|
|
26841
27047
|
collections: viewCollections(resolved.collections, ctx.collections, viewerOf(ctx), (collection) => ({
|
|
26842
27048
|
read: reaches(ctx, "data:read", collection),
|
|
@@ -26932,6 +27138,7 @@ var TOOLS = [
|
|
|
26932
27138
|
const collection = resolveCollection(ctx, args.collection, "data:read");
|
|
26933
27139
|
const { view, ...readArgs } = args;
|
|
26934
27140
|
const mode = view === void 0 ? void 0 : viewModeOf(view, "`view`");
|
|
27141
|
+
const readAt = Date.now();
|
|
26935
27142
|
const page = await readPage(readArgs, collection, ctx);
|
|
26936
27143
|
const block = {
|
|
26937
27144
|
collections: [collection],
|
|
@@ -26953,7 +27160,7 @@ var TOOLS = [
|
|
|
26953
27160
|
collection: collectionPath(collection),
|
|
26954
27161
|
title: collection.name,
|
|
26955
27162
|
...page,
|
|
26956
|
-
view: viewPayload(block, ctx),
|
|
27163
|
+
view: viewPayload(block, ctx, void 0, readAt),
|
|
26957
27164
|
idKey: idPropertyEntry(collection)?.[0] ?? "id",
|
|
26958
27165
|
columns: tableColumns(collection, ctx),
|
|
26959
27166
|
writable: reaches(ctx, "data:write", collection)
|
|
@@ -26995,7 +27202,7 @@ var TOOLS = [
|
|
|
26995
27202
|
{
|
|
26996
27203
|
name: "show_app",
|
|
26997
27204
|
title: "Build an app on the project's data",
|
|
26998
|
-
description: "Build a small app for what the user is doing — a triage queue, a dashboard, a review flow — and open it in the conversation: a React component you write, running on the project's data as the user, with the admin panel's own collection views and record forms to compose. Use it when one collection or one row is not enough (show_collection and show_record open those). The code is compiled before anything opens: a mistake comes back as this call's error, with its line, to fix and call again. A runtime error, and what the user changes, reach you with their next message. In a client that renders MCP Apps this opens in the conversation; elsewhere nothing is shown. The result does not say which happened, so do not tell the user a view appeared: report what the result says. Edits the person makes there are saved as them, each through the same checks as the write tools, and you are told what they changed.\n" +
|
|
27205
|
+
description: "Build a small app for what the user is doing — a triage queue, a dashboard, a review flow — and open it in the conversation: a React component you write, running on the project's data as the user, with the admin panel's own collection views and record forms to compose. Use it when one collection or one row is not enough (show_collection and show_record open those). The code is compiled before anything opens: a mistake comes back as this call's error, with its line, to fix and call again. A runtime error, and what the user changes, reach you with their next message. In a client that renders MCP Apps this opens in the conversation; elsewhere nothing is shown. The result does not say which happened, so do not tell the user a view appeared: report what the result says. Edits the person makes there are saved as them, each through the same checks as the write tools, and you are told what they changed.\n" + SHOW_APP_ESSENTIALS,
|
|
26999
27206
|
requiredScope: "data:read",
|
|
27000
27207
|
annotations: READS,
|
|
27001
27208
|
inputSchema: {
|
|
@@ -27023,17 +27230,36 @@ var TOOLS = [
|
|
|
27023
27230
|
async run(args, ctx) {
|
|
27024
27231
|
const title = optionalString(args.title, "`title`");
|
|
27025
27232
|
const block = await appBlock(args, ctx);
|
|
27233
|
+
const readAt = Date.now();
|
|
27026
27234
|
const seeds = await appSeeds(block.collections, ctx);
|
|
27027
27235
|
return {
|
|
27028
27236
|
...title && { title },
|
|
27029
27237
|
...block.summary,
|
|
27030
27238
|
view: {
|
|
27031
|
-
...viewPayload(block, ctx, title),
|
|
27239
|
+
...viewPayload(block, ctx, title, seeds.length > 0 ? readAt : void 0),
|
|
27032
27240
|
...seeds.length > 0 && { seeds }
|
|
27033
27241
|
}
|
|
27034
27242
|
};
|
|
27035
27243
|
}
|
|
27036
27244
|
},
|
|
27245
|
+
{
|
|
27246
|
+
name: "show_app_guide",
|
|
27247
|
+
title: "Read show_app's guide",
|
|
27248
|
+
description: "How to write show_app's code: the modules an app imports, every hook and component with its props, and a worked example. Read it before your first show_app call in a conversation.",
|
|
27249
|
+
requiredScope: "data:read",
|
|
27250
|
+
annotations: READS,
|
|
27251
|
+
inputSchema: {
|
|
27252
|
+
type: "object",
|
|
27253
|
+
properties: {},
|
|
27254
|
+
additionalProperties: false
|
|
27255
|
+
},
|
|
27256
|
+
offeredWithView: MCP_APP_URI,
|
|
27257
|
+
ownText: true,
|
|
27258
|
+
structuredContent: false,
|
|
27259
|
+
async run() {
|
|
27260
|
+
return SHOW_APP_CODE_GUIDE.trim();
|
|
27261
|
+
}
|
|
27262
|
+
},
|
|
27037
27263
|
{
|
|
27038
27264
|
name: "count_documents",
|
|
27039
27265
|
title: "Count rows",
|
|
@@ -27544,9 +27770,10 @@ function createMcpRoutes(config) {
|
|
|
27544
27770
|
compilerLoaded ??= compilerSource();
|
|
27545
27771
|
return (await compilerLoaded)(source);
|
|
27546
27772
|
} : void 0;
|
|
27547
|
-
/** Whether the view a tool opens, if any, is served here. A tool whose view is not does not exist here. */
|
|
27773
|
+
/** Whether the view a tool opens or goes with, if any, is served here. A tool whose view is not does not exist here. */
|
|
27548
27774
|
async function viewServed(tool) {
|
|
27549
|
-
|
|
27775
|
+
const view = tool.ui?.resourceUri ?? tool.offeredWithView;
|
|
27776
|
+
return view === void 0 || await appAt(view) !== void 0;
|
|
27550
27777
|
}
|
|
27551
27778
|
/** The tools this caller is offered: their scope, and the view a tool opens being served. */
|
|
27552
27779
|
async function offeredTools(scopes) {
|
|
@@ -27784,6 +28011,10 @@ function createMcpRoutes(config) {
|
|
|
27784
28011
|
});
|
|
27785
28012
|
const source = typeof args.collection === "string" ? `${name} on collection ${JSON.stringify(args.collection)}` : name;
|
|
27786
28013
|
const read = tool.modelResult ? tool.modelResult(result) : result;
|
|
28014
|
+
if (tool.ownText && typeof read === "string") return rpcResult(id, { content: [{
|
|
28015
|
+
type: "text",
|
|
28016
|
+
text: read
|
|
28017
|
+
}] });
|
|
27787
28018
|
return rpcResult(id, {
|
|
27788
28019
|
content: [{
|
|
27789
28020
|
type: "text",
|
|
@@ -28773,7 +29004,7 @@ var REPLACED_CONFIG_KEYS = {
|
|
|
28773
29004
|
*/
|
|
28774
29005
|
function assertNoReplacedResourceConfig(config) {
|
|
28775
29006
|
for (const [key, remedy] of Object.entries(REPLACED_CONFIG_KEYS)) {
|
|
28776
|
-
if (config
|
|
29007
|
+
if (Reflect.get(config, key) === void 0) continue;
|
|
28777
29008
|
throw new Error(`\`${key}\` is no longer read. Resources are declared in config code now, so that there is one place to look and nothing to merge.\n\n To migrate: ${remedy}.\n\nRefused rather than ignored: a key that is accepted and then does nothing is the failure this replaced.`);
|
|
28778
29009
|
}
|
|
28779
29010
|
}
|
|
@@ -29839,14 +30070,14 @@ function topicJobHandlers() {
|
|
|
29839
30070
|
const tasks = {};
|
|
29840
30071
|
for (const sub of declaredSubscriptions()) {
|
|
29841
30072
|
const task = topicTaskName(sub.topic, sub.name);
|
|
29842
|
-
tasks[task] =
|
|
30073
|
+
tasks[task] = async (ctx) => {
|
|
29843
30074
|
await sub.handler(ctx.payload, {
|
|
29844
30075
|
attempt: ctx.attempt,
|
|
29845
30076
|
topic: sub.topic,
|
|
29846
30077
|
subscription: sub.name,
|
|
29847
30078
|
signal: ctx.signal
|
|
29848
30079
|
});
|
|
29849
|
-
}
|
|
30080
|
+
};
|
|
29850
30081
|
}
|
|
29851
30082
|
return tasks;
|
|
29852
30083
|
}
|
|
@@ -30549,14 +30780,22 @@ async function buildRebaseBackend(options, announcements) {
|
|
|
30549
30780
|
logger.info("Authentication initialized");
|
|
30550
30781
|
} else logger.warn("Auth requested but default bootstrapper does not support initializeAuth");
|
|
30551
30782
|
}
|
|
30552
|
-
const
|
|
30783
|
+
const initializedTarget = (target) => {
|
|
30784
|
+
for (const [bootstrapper, initialized] of driverResults) if (bootstrapper === target.bootstrapper) return {
|
|
30785
|
+
...target,
|
|
30786
|
+
driverResult: initialized
|
|
30787
|
+
};
|
|
30788
|
+
return target;
|
|
30789
|
+
};
|
|
30790
|
+
const policyOutcome = await provisionCollectionPolicies(provisionable, initializedTarget(provisionTarget), {
|
|
30553
30791
|
introspecting: introspectCollections,
|
|
30554
30792
|
provision: provision.collections,
|
|
30555
30793
|
skipReason: provisionSkipReason
|
|
30556
30794
|
});
|
|
30557
|
-
for (const
|
|
30558
|
-
const mine = provisionableBy.get(
|
|
30795
|
+
for (const source of provisionTargets.slice(1)) {
|
|
30796
|
+
const mine = provisionableBy.get(source) ?? [];
|
|
30559
30797
|
if (mine.length === 0) continue;
|
|
30798
|
+
const target = initializedTarget(source);
|
|
30560
30799
|
if (provision.collections && !provisioningDisabled() && target.bootstrapper.ensureRlsRuntime) await target.bootstrapper.ensureRlsRuntime(target.driverResult);
|
|
30561
30800
|
await provisionCollectionPolicies(mine, target, {
|
|
30562
30801
|
introspecting: introspectCollections,
|
|
@@ -30624,7 +30863,7 @@ async function buildRebaseBackend(options, announcements) {
|
|
|
30624
30863
|
const platformTokenPreAuth = createPlatformTokenPreAuth(platformTokens);
|
|
30625
30864
|
let backupLinkRouter;
|
|
30626
30865
|
if (surfaces.admin) {
|
|
30627
|
-
const { createBackupLinkRoutes, backupDestinationFromEnv } = await import("./backup-
|
|
30866
|
+
const { createBackupLinkRoutes, backupDestinationFromEnv } = await import("./backup-D-ds7wml.js").then((n) => n.t);
|
|
30628
30867
|
backupLinkRouter = createBackupLinkRoutes({ getDestination: () => backupDestinationFromEnv(process.env) });
|
|
30629
30868
|
}
|
|
30630
30869
|
const apiKeyRouter = apiKeyStore && surfaces.admin ? createApiKeyRoutes({
|
|
@@ -30769,7 +31008,7 @@ async function buildRebaseBackend(options, announcements) {
|
|
|
30769
31008
|
]) {
|
|
30770
31009
|
const providerConfig = safeAuthConfig[key];
|
|
30771
31010
|
if (providerConfig && requiredFields.every((f) => Boolean(providerConfig[f]))) {
|
|
30772
|
-
const createFn = (await import("./auth-
|
|
31011
|
+
const createFn = (await import("./auth-C-RJT4VO.js").then((n) => n.t))[factory];
|
|
30773
31012
|
oauthProviders.push(createFn(providerConfig));
|
|
30774
31013
|
}
|
|
30775
31014
|
}
|
|
@@ -31003,7 +31242,7 @@ async function buildRebaseBackend(options, announcements) {
|
|
|
31003
31242
|
let schemaEditorRoutes;
|
|
31004
31243
|
let schemaSourceEditor;
|
|
31005
31244
|
if (!schemaEditorOff && config.collectionsDir) try {
|
|
31006
|
-
const editorModule = await import("./schema-editor-routes-
|
|
31245
|
+
const editorModule = await import("./schema-editor-routes-BFRh4mHu.js");
|
|
31007
31246
|
schemaSourceEditor = editorModule.createSchemaSourceEditor(config.collectionsDir);
|
|
31008
31247
|
schemaEditorRoutes = editorModule.createSchemaEditorRoutes(schemaSourceEditor);
|
|
31009
31248
|
} catch (err) {
|
|
@@ -31053,7 +31292,7 @@ async function buildRebaseBackend(options, announcements) {
|
|
|
31053
31292
|
let remoteEditingOff;
|
|
31054
31293
|
if (remoteRepo) {
|
|
31055
31294
|
try {
|
|
31056
|
-
remoteEditor = await import("./ast-schema-editor-
|
|
31295
|
+
remoteEditor = await import("./ast-schema-editor-C0n8s_Z6.js");
|
|
31057
31296
|
} catch (err) {
|
|
31058
31297
|
if (err?.code !== "ERR_MODULE_NOT_FOUND") throw err;
|
|
31059
31298
|
remoteEditingOff = {
|
|
@@ -31331,6 +31570,10 @@ async function buildRebaseBackend(options, announcements) {
|
|
|
31331
31570
|
resolveAccessor
|
|
31332
31571
|
});
|
|
31333
31572
|
Object.assign(serverClient, { dataAsAdmin: serverData });
|
|
31573
|
+
Object.assign(serverClient, { sqlAsAdmin: async (query, sqlOptions) => {
|
|
31574
|
+
if (!scopedDefaultDriver.sql) throw new Error(`rebase.sqlAsAdmin: the "${scopedDefaultDriver.key}" driver cannot run SQL under row-level security. Use rebase.dataAsAdmin, or rebase.sql for owner-level SQL.`);
|
|
31575
|
+
return scopedDefaultDriver.sql(query, sqlOptions);
|
|
31576
|
+
} });
|
|
31334
31577
|
delete serverClient.data;
|
|
31335
31578
|
logger.debug("Native data plane attached to singleton (bypasses HTTP loop)");
|
|
31336
31579
|
if (storageController) {
|
|
@@ -31391,7 +31634,7 @@ async function buildRebaseBackend(options, announcements) {
|
|
|
31391
31634
|
const loadFailures = [];
|
|
31392
31635
|
if ((config.functionsDir || config.functions) && surfaces.functions) {
|
|
31393
31636
|
const { functionList, readFunctionsDirectory } = await import("./function-loader-BzKo2Oiu.js").then((n) => n.t);
|
|
31394
|
-
const { createFunctionRoutes } = await import("./function-routes-
|
|
31637
|
+
const { createFunctionRoutes } = await import("./function-routes-mSmsW34_.js").then((n) => n.n);
|
|
31395
31638
|
const { createFunctionsRequestTimeout, resolveFunctionsTimeoutMs } = await import("./request-timeout-DW2OBWfJ.js").then((n) => n.t);
|
|
31396
31639
|
const { functions: functionRecord, problems, failed } = config.functions ? {
|
|
31397
31640
|
functions: config.functions,
|
|
@@ -31430,6 +31673,10 @@ async function buildRebaseBackend(options, announcements) {
|
|
|
31430
31673
|
if (c.get("user") && !c.get("scopes")) c.set("scopes", callerScopes(c));
|
|
31431
31674
|
return next();
|
|
31432
31675
|
});
|
|
31676
|
+
if (typeof adminIdentityRepo?.getUserById === "function" && typeof adminIdentityRepo.getUserIdentities === "function") {
|
|
31677
|
+
const { createUserProfileLoader } = await import("./user-profile-C1UkoaJe.js");
|
|
31678
|
+
functionsRouter.use("/*", createUserProfileLoader(adminIdentityRepo));
|
|
31679
|
+
}
|
|
31433
31680
|
if (rateLimitConfig) functionsRouter.use("/*", createDataRateLimiter({
|
|
31434
31681
|
...rateLimitConfig,
|
|
31435
31682
|
anonymous: rateLimitConfig.anonymousFunctions !== void 0 ? rateLimitConfig.anonymousFunctions : DEFAULT_FUNCTIONS_ANONYMOUS_LIMIT
|
|
@@ -31454,10 +31701,10 @@ async function buildRebaseBackend(options, announcements) {
|
|
|
31454
31701
|
/** How many cron jobs `start()` schedules in this process. */
|
|
31455
31702
|
let cronJobsToSchedule = 0;
|
|
31456
31703
|
if (surfaces.cron || (config.cronsDir || config.crons || storageSweepJobs.length > 0) && ownership.cronScheduler) {
|
|
31457
|
-
const { cronJobsFrom, readCronsDirectory, withHiddenPropertiesOf } = await import("./cron-loader-
|
|
31458
|
-
const { CronScheduler } = await import("./cron-scheduler-
|
|
31459
|
-
const { createCronRoutes } = await import("./cron-routes-
|
|
31460
|
-
const { createCronStore } = await import("./cron-store-
|
|
31704
|
+
const { cronJobsFrom, readCronsDirectory, withHiddenPropertiesOf } = await import("./cron-loader-BN24T-O1.js").then((n) => n.t);
|
|
31705
|
+
const { CronScheduler } = await import("./cron-scheduler-CM08t50L.js").then((n) => n.n);
|
|
31706
|
+
const { createCronRoutes } = await import("./cron-routes-CjCWNcX6.js").then((n) => n.n);
|
|
31707
|
+
const { createCronStore } = await import("./cron-store-iv5yn27j.js").then((n) => n.n);
|
|
31461
31708
|
const { crons: cronRecord, problems: cronProblems, failed: cronFailures } = config.crons ? {
|
|
31462
31709
|
crons: config.crons,
|
|
31463
31710
|
problems: [],
|
|
@@ -31522,7 +31769,7 @@ async function buildRebaseBackend(options, announcements) {
|
|
|
31522
31769
|
}
|
|
31523
31770
|
let metricsHistory;
|
|
31524
31771
|
try {
|
|
31525
|
-
const { createMetricsHistory } = await import("./history-recorder-
|
|
31772
|
+
const { createMetricsHistory } = await import("./history-recorder-BV34l2qf.js");
|
|
31526
31773
|
metricsHistory = createMetricsHistory(defaultDriver, { provision: provision.database });
|
|
31527
31774
|
if (metricsHistory) await metricsHistory.ensure();
|
|
31528
31775
|
} catch (err) {
|
|
@@ -31531,7 +31778,7 @@ async function buildRebaseBackend(options, announcements) {
|
|
|
31531
31778
|
}
|
|
31532
31779
|
let jobQueue;
|
|
31533
31780
|
if (jobsOptions?.enabled) {
|
|
31534
|
-
const { createJobStore, createJobQueue } = await import("./jobs-
|
|
31781
|
+
const { createJobStore, createJobQueue } = await import("./jobs-D9RBf3Yb.js").then((n) => n.t);
|
|
31535
31782
|
const store = createJobStore(defaultDriver, { provision: provision.database });
|
|
31536
31783
|
if (store) {
|
|
31537
31784
|
await store.ensureTable();
|
|
@@ -31576,7 +31823,7 @@ Use a driver that supports the job queue, or remove the declarations. Refusing t
|
|
|
31576
31823
|
let logsSurface;
|
|
31577
31824
|
let metaSurface;
|
|
31578
31825
|
if (surfaces.admin) {
|
|
31579
|
-
const { createBackupRoutes, backupDestinationFromEnv, readBackupSchedule } = await import("./backup-
|
|
31826
|
+
const { createBackupRoutes, backupDestinationFromEnv, readBackupSchedule } = await import("./backup-D-ds7wml.js").then((n) => n.t);
|
|
31580
31827
|
const backupRouter = new Hono();
|
|
31581
31828
|
applyAdminGate(backupRouter, "Backup", "backups:read");
|
|
31582
31829
|
const scheduler = cronScheduler;
|
|
@@ -31598,7 +31845,7 @@ Use a driver that supports the job queue, or remove the declarations. Refusing t
|
|
|
31598
31845
|
}
|
|
31599
31846
|
let rlsSimulatorSurface;
|
|
31600
31847
|
if (surfaces.admin) {
|
|
31601
|
-
const { createRlsSimulatorRoutes } = await import("./rls-simulator-routes-
|
|
31848
|
+
const { createRlsSimulatorRoutes } = await import("./rls-simulator-routes-C7C3f57E.js");
|
|
31602
31849
|
const rlsSimulatorRouter = new Hono();
|
|
31603
31850
|
applyAdminGate(rlsSimulatorRouter, "RLS simulator", "schema:read");
|
|
31604
31851
|
rlsSimulatorRouter.route("/", createRlsSimulatorRoutes({
|
|
@@ -31613,14 +31860,14 @@ Use a driver that supports the job queue, or remove the declarations. Refusing t
|
|
|
31613
31860
|
rlsSimulatorSurface = rlsSimulatorRouter;
|
|
31614
31861
|
}
|
|
31615
31862
|
if (surfaces.admin) {
|
|
31616
|
-
const { createSqlExportRoutes } = await import("./sql-export-routes-
|
|
31863
|
+
const { createSqlExportRoutes } = await import("./sql-export-routes-9nXTfyP_.js");
|
|
31617
31864
|
const sqlExportRouter = new Hono();
|
|
31618
31865
|
applyAdminGate(sqlExportRouter, "SQL export", "database:write");
|
|
31619
31866
|
sqlExportRouter.route("/", createSqlExportRoutes({ getAdmin: () => defaultDriver.admin }));
|
|
31620
31867
|
sqlExportSurface = sqlExportRouter;
|
|
31621
31868
|
}
|
|
31622
31869
|
if (surfaces.admin) {
|
|
31623
|
-
const { createBranchRoutes } = await import("./branch-routes-
|
|
31870
|
+
const { createBranchRoutes } = await import("./branch-routes-ClQrYUyP.js");
|
|
31624
31871
|
const branchRouter = new Hono();
|
|
31625
31872
|
applyAdminGate(branchRouter, "Branch review", "database:write");
|
|
31626
31873
|
branchRouter.route("/", createBranchRoutes({ getAdmin: () => defaultDriver.admin }));
|
|
@@ -31659,7 +31906,7 @@ Use a driver that supports the job queue, or remove the declarations. Refusing t
|
|
|
31659
31906
|
logsSurface = logsRouter;
|
|
31660
31907
|
}
|
|
31661
31908
|
if (surfaces.meta) {
|
|
31662
|
-
const { createContractRoutes } = await import("./contract-routes-
|
|
31909
|
+
const { createContractRoutes } = await import("./contract-routes-BGXR9D5C.js").then((n) => n.t);
|
|
31663
31910
|
const contractRouter = new Hono();
|
|
31664
31911
|
if (adminSurfacesGated) contractRouter.use("/contract", ...adminGate("schema:read"));
|
|
31665
31912
|
else {
|
|
@@ -31691,8 +31938,8 @@ Use a driver that supports the job queue, or remove the declarations. Refusing t
|
|
|
31691
31938
|
const callbackTargets = () => {
|
|
31692
31939
|
const targets = [collectionRegistry];
|
|
31693
31940
|
for (const key of [DEFAULT_DRIVER_ID, ...driverRegistry.list()]) {
|
|
31694
|
-
const
|
|
31695
|
-
if (
|
|
31941
|
+
const registry = collectionRegistryOf(driverRegistry.get(key));
|
|
31942
|
+
if (registry && !targets.includes(registry)) targets.push(registry);
|
|
31696
31943
|
}
|
|
31697
31944
|
return targets;
|
|
31698
31945
|
};
|
|
@@ -32053,7 +32300,7 @@ function realtimeSocketPath(basePath) {
|
|
|
32053
32300
|
* backend no MCP client calls never loads it.
|
|
32054
32301
|
*/
|
|
32055
32302
|
async function loadMcpApps() {
|
|
32056
|
-
const { MCP_APPS } = await import("./dist-
|
|
32303
|
+
const { MCP_APPS } = await import("./dist-2-J8_MGi.js");
|
|
32057
32304
|
return withProjectView(MCP_APPS, [...process.env.REBASE_MCP_VIEW ? [process.env.REBASE_MCP_VIEW] : [], ...servedFrontendPaths().map((frontend) => path.join(frontend, PROJECT_VIEW_FILE))], (file) => {
|
|
32058
32305
|
try {
|
|
32059
32306
|
return readFileSync(file, "utf8");
|
|
@@ -32067,9 +32314,18 @@ async function loadMcpApps() {
|
|
|
32067
32314
|
* app to the modules and names every view serves (`MCP_APP_MODULES`).
|
|
32068
32315
|
*/
|
|
32069
32316
|
async function loadAppCompiler() {
|
|
32070
|
-
const { compileApp } = await import("./dist-
|
|
32317
|
+
const { compileApp } = await import("./dist-2-J8_MGi.js");
|
|
32071
32318
|
return (source) => compileApp(source, MCP_APP_MODULES);
|
|
32072
32319
|
}
|
|
32320
|
+
/** The collection registry a driver carries, if it has one: not part of `DataDriver`, so found by looking. */
|
|
32321
|
+
function collectionRegistryOf(driver) {
|
|
32322
|
+
if (typeof driver !== "object" || driver === null || !("registry" in driver)) return void 0;
|
|
32323
|
+
const registry = driver.registry;
|
|
32324
|
+
return typeof registry === "object" && registry !== null && hasSlugGetter(registry) ? registry : void 0;
|
|
32325
|
+
}
|
|
32326
|
+
function hasSlugGetter(value) {
|
|
32327
|
+
return "get" in value && typeof value.get === "function";
|
|
32328
|
+
}
|
|
32073
32329
|
//#endregion
|
|
32074
32330
|
//#region src/backend/default-backend.ts
|
|
32075
32331
|
/**
|
|
@@ -37409,6 +37665,6 @@ function warnOnUnusableBundleShape(bundle) {
|
|
|
37409
37665
|
logger.warn(`This bundle declares collections at "${bundle.manifest.entry.collections}", but that directory did not resolve, so no collections were loaded and no tables will be created. Rebuild with \`rebase build\`.`);
|
|
37410
37666
|
}
|
|
37411
37667
|
//#endregion
|
|
37412
|
-
export { ACCOUNT_SCOPED_STORAGE_BASES, ApiError, BATCH_REF_KEY, BlockedUrlError, BundleError, CONCURRENT_DDL_SQLSTATES, CORS_EXPOSED_HEADERS, CollectionConfigError, CronScheduler, DATABASE_UNAVAILABLE_MESSAGE, DATA_SCOPE_VOCABULARY, DEFAULT_DRIVER_ID, DEFAULT_MAX_FILE_SIZE, DEFAULT_REFERRER_POLICY, DEFAULT_STORAGE_ID, DOCUMENT_MIME_TYPES, DefaultDriverRegistry, DefaultStorageRegistry, ETAG_HEADER, FIELD_OPERATORS, GCSStorageController, IF_MATCH_HEADER, IMAGE_MIME_TYPES, LocalStorageController, MCP_APP_URI, MCP_VIEW_TOOLS, McpToolError, MetricsRegistry, ObjectTooLargeError, PermanentJobError, RUNTIME_BUNDLE_MOUNT, RUNTIME_DEFAULT_MAX_BODY_SIZE, RUNTIME_HEALTH_PATH, RUNTIME_LIVENESS_PATH, RUNTIME_MIN_TERMINATION_GRACE_SECONDS, RUNTIME_PRESTOP_DRAIN_SECONDS, RUNTIME_PROBE_PATHS, RUNTIME_STARTUP_BUDGET_SECONDS, RawHtml, S3StorageController, SHOW_APP_CODE_GUIDE, SMTPEmailService, StoragePolicyError, TOPOLOGY_ENV_VARS, TransformCache, TusHandler, UPLOAD_COLLECTION_FIELD, UPLOAD_PROPERTY_FIELD, UnknownStorageSourceError, WEBHOOK_DELIVERY_TASK, WebhookDispatcher, _resetRebaseMock, _setRebaseMock, accessModelFromCollections, activeDevEmailSink, applyCollectionDefaults, assertAllowedOutboundUrl, assertCollectionConfigs, assertDistinctSuffixes, assertEmailLinkBases, assertEveryKindBindable, assertFieldOpsValid, assertIfMatch, assertNestedWriteAllowed, assertNoFieldOpsOnCreate, assertNoUserUpsert, assertQueryFieldsReadable, assertUploadWithinPathLimits, assertUploadWithinPropertyLimits, assertUserCreationBodyValid, assertWriteRequestValid, authJwt, authRoles, authUid, backupStorageFromEnv, blockedAddressReason, bootFromBundle, callerScopes, classifySurface, cleanupDevPortFile, clearActiveDevEmailSink, compileStoragePolicies, composeCallbacks, configureAccess, configureJwt, createAppleProvider, createBackupLinkRoutes, createBackupRoutes, createBitbucketProvider, createBuiltinAuthAdapter, createCallContext, createContractRoutes, createCronRoutes, createCronStore, createCustomAuthAdapter, createDdlBootstrapper, createDevEmailSink, createDiscordProvider, createEmailService, createFacebookProvider, createFunctionRoutes, createGitHubProvider, createGitLabProvider, createGoogleProvider, createHistoryRoutes, createJobQueue, createJobStore, createJwksRoutes, createJwtService, createLinkedinProvider, createMetricsMiddleware, createMetricsRoutes, createMicrosoftProvider, createRebaseBackend, createRlsAudit, createSlackProvider, createSourceBundle, createSpotifyProvider, createStorageController, createStorageRoutes, createTwitterProvider, createUnconfiguredEmailService, createUploadConstraintResolver, createUploadPathResolver, createUserThroughAuthCollection, decideImpersonation, declareCrons, declaredErrorAnswer, declaredUniqueTargets, defaultBackoff, defineCron, defineFunction, devEmailSinkFor, drainBackgroundWork, envSuffixForKey, errorHandler, escapeHtml, extractLinks, extractUserFromToken, fileTokenAuth, findCollectionConfigProblems, generateSecurePassword, getAccessModel, getApiKey, getDriver, getEmailChangeNoticeTemplate, getEmailChangeTemplate, getEmailOtpTemplate, getEmailVerificationTemplate, getEnv, getJwks, getMagicLinkTemplate, getPasswordResetTemplate, getRequestId, getRoles, getUser, getUserId, getUserInvitationTemplate, getWelcomeEmailTemplate, hasAsymmetricSigningKey, hasFieldOps, hasRole, hasScope, hashPassword, html, httpMethodToOperation, identityResolved, implicitDeclaration, initializeDataSource, initializeDataSources, initializeRebaseBackend, installShutdownHandlers, installUnhandledRejectionHandler, isAcceptedFile, isAdmin, isApiKeyToken, isAuthAdapter, isAuthenticated, isConcurrentDdlRace, isDataException, isDatabaseAdapter, isDatabaseUnreachable, isDuplicateObjectRace, isLocalhostOrigin, isNodeRuntime, isTopologyEnvVar, isTransformableImage, isUncountedPath, lazyResource, listBackupObjects, listenWithPortRetry, loadBootEnv, loadBundle, loadBundleConfigExports, loadBundleSchema, loadCollectionsFromDirectory, loadCronJobsFromDirectory, loadCronJobsWithDiagnostics, loadCrons, loadEnv, loadFunctions, loadFunctionsFromDirectory, loadFunctionsWithDiagnostics, loadUsersCollection, logger, looksLikeFieldOp, mcpAppBaseUri, mcpViewToolInputSchema, oauthCodeFlowSchema, optionalAuth, overridableSecurityHeaders, parseBackupDestination, parseBackupTimestamp, parseFieldOp, parseTransformOptions, pendingBackgroundWork, pkceTokenParams, providerVerifiedEmail, queryTokenAuth, raw, rawQueryLoggingEnabled, readBackupBytes, readBundleManifest, readUploadPropertyContext, realtimeSocketPath, rebase, refuseUnhonouredImpersonation, registerDevEmailSink, registerResourceResolver, reportSimulatedContext, requireAdmin, requireAuth, requireDriver, requireEnv, requireRole, requireScope, resolveApiKey, resolveAuthHooks, resolveAuthOptions, resolveBatchRefs, resolveConflictTarget, resolveCorsOrigin, resolveDataSources, resolveEmailBranding, resolveEmailLinkBase, resolveEmailOptions, resolveRequireAuth, resolveStorageAccessControl, resolveStorageBackend, resolveStorageSources, resourceResolver, resourceResolvers, rowETag, runFromBundle, runtimeKey, safeCompare, schemaDriftRemedy, serveSPA, setDefaultBackend, setLogOutput, splitFieldOps, summarize as summarizeRlsScan, transformImage, tryVerifyOidcIdToken, unbindableKinds, unknownKeyPolicyFromEnv, validateApiKey, validateCronExpression, validatePasswordStrength, verifyCredential, verifyOidcIdToken, verifyPassword, versionProperty, versionedMcpAppUri, waitUntil, z };
|
|
37668
|
+
export { ACCOUNT_SCOPED_STORAGE_BASES, ApiError, BATCH_REF_KEY, BlockedUrlError, BundleError, CONCURRENT_DDL_SQLSTATES, CORS_EXPOSED_HEADERS, CollectionConfigError, CronScheduler, DATABASE_UNAVAILABLE_MESSAGE, DATA_SCOPE_VOCABULARY, DEFAULT_DRIVER_ID, DEFAULT_MAX_FILE_SIZE, DEFAULT_REFERRER_POLICY, DEFAULT_STORAGE_ID, DOCUMENT_MIME_TYPES, DefaultDriverRegistry, DefaultStorageRegistry, ETAG_HEADER, FIELD_OPERATORS, GCSStorageController, IF_MATCH_HEADER, IMAGE_MIME_TYPES, LocalStorageController, MCP_APP_URI, MCP_VIEW_TOOLS, McpToolError, MetricsRegistry, ObjectTooLargeError, PermanentJobError, RUNTIME_BUNDLE_MOUNT, RUNTIME_DEFAULT_MAX_BODY_SIZE, RUNTIME_HEALTH_PATH, RUNTIME_LIVENESS_PATH, RUNTIME_MIN_TERMINATION_GRACE_SECONDS, RUNTIME_PRESTOP_DRAIN_SECONDS, RUNTIME_PROBE_PATHS, RUNTIME_STARTUP_BUDGET_SECONDS, RawHtml, S3StorageController, SHOW_APP_CODE_GUIDE, SHOW_APP_ESSENTIALS, SHOW_APP_GUIDE_TOOL, SMTPEmailService, StoragePolicyError, TOPOLOGY_ENV_VARS, TransformCache, TusHandler, UPLOAD_COLLECTION_FIELD, UPLOAD_PROPERTY_FIELD, UnknownStorageSourceError, WEBHOOK_DELIVERY_TASK, WebhookDispatcher, _resetRebaseMock, _setRebaseMock, accessModelFromCollections, activeDevEmailSink, applyCollectionDefaults, assertAllowedOutboundUrl, assertCollectionConfigs, assertDistinctSuffixes, assertEmailLinkBases, assertEveryKindBindable, assertFieldOpsValid, assertIfMatch, assertNestedWriteAllowed, assertNoFieldOpsOnCreate, assertNoUserUpsert, assertQueryFieldsReadable, assertUploadWithinPathLimits, assertUploadWithinPropertyLimits, assertUserCreationBodyValid, assertWriteRequestValid, authJwt, authRoles, authUid, backupStorageFromEnv, blockedAddressReason, bootFromBundle, callerScopes, classifySurface, cleanupDevPortFile, clearActiveDevEmailSink, compileStoragePolicies, composeCallbacks, configureAccess, configureJwt, createAppleProvider, createBackupLinkRoutes, createBackupRoutes, createBitbucketProvider, createBuiltinAuthAdapter, createCallContext, createContractRoutes, createCronRoutes, createCronStore, createCustomAuthAdapter, createDdlBootstrapper, createDevEmailSink, createDiscordProvider, createEmailService, createFacebookProvider, createFunctionRoutes, createGitHubProvider, createGitLabProvider, createGoogleProvider, createHistoryRoutes, createJobQueue, createJobStore, createJwksRoutes, createJwtService, createLinkedinProvider, createMetricsMiddleware, createMetricsRoutes, createMicrosoftProvider, createRebaseBackend, createRlsAudit, createSlackProvider, createSourceBundle, createSpotifyProvider, createStorageController, createStorageRoutes, createTwitterProvider, createUnconfiguredEmailService, createUploadConstraintResolver, createUploadPathResolver, createUserThroughAuthCollection, decideImpersonation, declareCrons, declaredErrorAnswer, declaredUniqueTargets, defaultBackoff, defineCron, defineFunction, devEmailSinkFor, drainBackgroundWork, envSuffixForKey, errorHandler, escapeHtml, extractLinks, extractUserFromToken, fileTokenAuth, findCollectionConfigProblems, generateSecurePassword, getAccessModel, getApiKey, getDriver, getEmailChangeNoticeTemplate, getEmailChangeTemplate, getEmailOtpTemplate, getEmailVerificationTemplate, getEnv, getJwks, getMagicLinkTemplate, getPasswordResetTemplate, getRequestId, getRoles, getSql, getUser, getUserId, getUserInvitationTemplate, getUserProfile, getWelcomeEmailTemplate, hasAsymmetricSigningKey, hasFieldOps, hasRole, hasScope, hashPassword, html, httpMethodToOperation, identityResolved, implicitDeclaration, initializeDataSource, initializeDataSources, initializeRebaseBackend, installShutdownHandlers, installUnhandledRejectionHandler, isAcceptedFile, isAdmin, isApiKeyToken, isAuthAdapter, isAuthenticated, isConcurrentDdlRace, isDataException, isDatabaseAdapter, isDatabaseUnreachable, isDuplicateObjectRace, isLocalhostOrigin, isNodeRuntime, isTopologyEnvVar, isTransformableImage, isUncountedPath, lazyResource, listBackupObjects, listenWithPortRetry, loadBootEnv, loadBundle, loadBundleConfigExports, loadBundleSchema, loadCollectionsFromDirectory, loadCronJobsFromDirectory, loadCronJobsWithDiagnostics, loadCrons, loadEnv, loadFunctions, loadFunctionsFromDirectory, loadFunctionsWithDiagnostics, loadUsersCollection, logger, looksLikeFieldOp, mcpAppBaseUri, mcpViewToolInputSchema, oauthCodeFlowSchema, optionalAuth, overridableSecurityHeaders, parseBackupDestination, parseBackupTimestamp, parseFieldOp, parseTransformOptions, pendingBackgroundWork, pkceTokenParams, providerVerifiedEmail, queryTokenAuth, raw, rawQueryLoggingEnabled, readBackupBytes, readBundleManifest, readUploadPropertyContext, realtimeSocketPath, rebase, refuseUnhonouredImpersonation, registerDevEmailSink, registerResourceResolver, reportSimulatedContext, requireAdmin, requireAuth, requireDriver, requireEnv, requireRole, requireScope, resolveApiKey, resolveAuthHooks, resolveAuthOptions, resolveBatchRefs, resolveConflictTarget, resolveCorsOrigin, resolveDataSources, resolveEmailBranding, resolveEmailLinkBase, resolveEmailOptions, resolveRequireAuth, resolveStorageAccessControl, resolveStorageBackend, resolveStorageSources, resourceResolver, resourceResolvers, rowETag, runFromBundle, runtimeKey, safeCompare, schemaDriftRemedy, serveSPA, setDefaultBackend, setLogOutput, splitFieldOps, summarize as summarizeRlsScan, transformImage, tryVerifyOidcIdToken, unbindableKinds, unknownKeyPolicyFromEnv, validateApiKey, validateCronExpression, validatePasswordStrength, verifyCredential, verifyOidcIdToken, verifyPassword, versionProperty, versionedMcpAppUri, waitUntil, z };
|
|
37413
37669
|
|
|
37414
37670
|
//# sourceMappingURL=index.es.js.map
|