@rebasepro/types 0.28.2 → 0.29.0-canary.g0e3a0e7

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.
@@ -447,6 +447,31 @@ export interface DataDriver {
447
447
  * @return Function to cancel subscription
448
448
  */
449
449
  listenOne?<M extends Record<string, unknown> = Record<string, unknown>>(props: ListenOneProps<M>): () => void;
450
+ /**
451
+ * Let `<Rebase>` hear about changes this driver learns of that it did not
452
+ * write itself — rows another process wrote, or ones an agent changed
453
+ * through the driver's own backend.
454
+ *
455
+ * `<Rebase>` calls it once per driver it holds, while it is mounted, and
456
+ * calls the function it returns when it unmounts. The driver calls
457
+ * `onExternalChange(path)` with the path of each collection that changed
458
+ * (the path the driver stores it under, as {@link FetchCollectionProps.path}
459
+ * names it, or the collection's slug), and every view of that collection
460
+ * whose data source cannot subscribe reads it again: the row hooks
461
+ * (`useRows`, `useRow`, `useRowCount`, `useAggregate`) and the admin's
462
+ * collection views. A view that subscribes through
463
+ * {@link listenCollection} is left alone, so a driver that already pushes
464
+ * the change there gains nothing from announcing it here.
465
+ *
466
+ * Writes made through `<Rebase>` itself need no announcement: they are
467
+ * signalled as they succeed.
468
+ *
469
+ * Optional: a driver that learns of no outside changes leaves it out.
470
+ *
471
+ * @param onExternalChange call with a changed collection's path
472
+ * @return stop calling `onExternalChange`
473
+ */
474
+ subscribeToExternalChanges?(onExternalChange: (path: string) => void): () => void;
450
475
  /**
451
476
  * Save a row to the specified path
452
477
  * @param props
@@ -736,6 +761,11 @@ export interface RestFetchService {
736
761
  * read**. An aggregate is an efficient way to learn about rows you cannot
737
762
  * select, and `count(*)` over a table whose policies would return nothing
738
763
  * has to be zero.
764
+ *
765
+ * Nor may it read what `afterRead` hides. An aggregate does not pass
766
+ * through the callbacks, so on a collection any `afterRead` applies to
767
+ * (global, collection or property) only `count` with no field and no
768
+ * `groupBy` is served; anything else is refused with a 400.
739
769
  */
740
770
  aggregate?(collectionPath: string, options: {
741
771
  aggregates: {
package/dist/index.es.js CHANGED
@@ -1906,6 +1906,7 @@ amendResourceKind("database", { envBases: [
1906
1906
  "DATABASE_URL",
1907
1907
  "DATABASE_READ_URL",
1908
1908
  "DATABASE_DIRECT_URL",
1909
+ "DATABASE_POOLED",
1909
1910
  "ADMIN_CONNECTION_STRING",
1910
1911
  "REBASE_DRIVER",
1911
1912
  "DB_POOL_MAX",
@@ -2389,6 +2390,24 @@ function isLazyComponentRef(ref) {
2389
2390
  */
2390
2391
  var IMPERSONATE_HEADER = "x-rebase-impersonate";
2391
2392
  /**
2393
+ * The request header a client sends to the auth routes to say where it keeps
2394
+ * its refresh token. `json` asks for the token in the response body, and has
2395
+ * the token it presents read from the request body.
2396
+ *
2397
+ * It matters only on a server with `cookieAuth`, which otherwise puts the
2398
+ * token in an HttpOnly cookie and answers the body's with `""`, so a client
2399
+ * with no cookie jar (Node, React Native), or one that keeps its own sign-in
2400
+ * apart from the page's cookie session, held nothing to renew with. A request
2401
+ * that sends it is answered as a server without `cookieAuth` answers: the
2402
+ * cookie is neither read nor set. So it can never turn a cookie the page's
2403
+ * script cannot read into a token it can.
2404
+ *
2405
+ * `@rebasepro/client` sends it on every auth request in `authFlowMode: "json"`.
2406
+ *
2407
+ * @group Auth
2408
+ */
2409
+ var AUTH_FLOW_HEADER = "x-rebase-auth-flow";
2410
+ /**
2392
2411
  * The request header that asks for a data-plane request to run as a role —
2393
2412
  * the RLS simulator's "view as". Alone it runs as a signed-in holder of that
2394
2413
  * role who owns no rows; with {@link SIMULATE_USER_ID_HEADER} it runs as that
@@ -3357,6 +3376,50 @@ function computeSchemaVersion(collections) {
3357
3376
  return `v1:${hex(h1)}${hex(h2)}`;
3358
3377
  }
3359
3378
  //#endregion
3379
+ //#region src/types/mcp_app_modules.ts
3380
+ /**
3381
+ * The modules an app Claude writes for show_app may import, and from each the
3382
+ * names the MCP view serves.
3383
+ *
3384
+ * An app imports the real package names, so the code reads — and pastes into
3385
+ * a project — like every other piece of Rebase code. Inside the view each
3386
+ * name is the package's own part: `"*"` serves the whole module, a list
3387
+ * serves exactly those exports. The one list three readers share, so none
3388
+ * can drift from the others:
3389
+ *
3390
+ * - the view's module registry (`@rebasepro/cms/mcp-view`), which hands an
3391
+ * app these exports and no others;
3392
+ * - the server's compiler for show_app, which refuses any other import
3393
+ * before the app opens, naming it;
3394
+ * - show_app's guide (`SHOW_APP_CODE_GUIDE` in `@rebasepro/server`), which a
3395
+ * test holds to this list.
3396
+ */
3397
+ var MCP_APP_MODULES = {
3398
+ "react": "*",
3399
+ "react/jsx-runtime": "*",
3400
+ "@rebasepro/ui": "*",
3401
+ "@rebasepro/app": [
3402
+ "useRows",
3403
+ "useRow",
3404
+ "useRowCount",
3405
+ "useAggregate",
3406
+ "useRowWrites"
3407
+ ],
3408
+ "@rebasepro/cms": [
3409
+ "CollectionPanel",
3410
+ "CollectionToolbar",
3411
+ "CollectionSearchBar",
3412
+ "CollectionFiltersButton",
3413
+ "CollectionViewModeToggle",
3414
+ "CollectionAddButton",
3415
+ "RecordForm",
3416
+ "RecordDetail",
3417
+ "FormField",
3418
+ "FieldValue",
3419
+ "useSidePanel"
3420
+ ]
3421
+ };
3422
+ //#endregion
3360
3423
  //#region src/controllers/data.ts
3361
3424
  /**
3362
3425
  * Hops an {@link IncludeSpec} may nest. `comments.author` is two.
@@ -3855,6 +3918,6 @@ function resolverFromSources(client) {
3855
3918
  };
3856
3919
  }
3857
3920
  //#endregion
3858
- export { ADMIN_COLLECTION_KEYS, ADMIN_PROPERTY_KEYS, ADMIN_ROLE, ADMIN_SCOPES, ALL_WHERE_FILTER_OPS, ANONYMOUS_USER_ID, ANONYMOUS_USER_IDS, BATCH_REF_KEY, BUILT_IN_SCOPES, BUILT_IN_SCOPE_DESCRIPTIONS, BUNDLE_FORMAT_VERSION, CANONICAL_TO_REST, DATA_PLANE_SCOPES, DEFAULT_CAPABILITIES, DEFAULT_COMMIT_PATHS, DEFAULT_DATA_SOURCE_KEY, DEFAULT_FILTERABLE_RELATION_KINDS, DEFAULT_FUZZY_THRESHOLD, DEFAULT_LIST_LIMIT, DEFAULT_RESOURCE_KEY, DEFAULT_SEARCH_COLUMN, DEFAULT_SEARCH_LANGUAGE, DEFAULT_SEARCH_MODE, DEFAULT_SEARCH_WEIGHT, DEFAULT_STORAGE_SOURCE_KEY, DEFAULT_TENANT_BYPASS_ROLES, DEFAULT_VECTOR_LIST_LIMIT, EMPTY_ACCESS_MODEL, EntityReference, EntityRelation, FIELD_OPERATORS, FIREBASE_CAPABILITIES, GeoPoint, IMPERSONATE_HEADER, INCLUDE_COUNT_KEY, JUNCTION_PIVOT_KEY, KEY_MANAGEMENT_SCOPES, LEGACY_RLS_JWT_SQL, LEGACY_RLS_ROLES_SQL, LEGACY_RLS_SCHEMA, LEGACY_RLS_UID_SQL, LIST_OPS, ListLimitError, MAX_INCLUDE_DEPTH, MAX_LIST_LIMIT, MONGODB_CAPABILITIES, NULL_OPS, POSTGRES_CAPABILITIES, PUBLIC_STORAGE_PREFIX, REBASE_SCHEMA, RELEVANCE_SORT_FIELD, RESERVED_BACKEND_PREFIXES, RESOURCE_GRAPH_VERSION, REST_TO_CANONICAL, RLS_IS_ANONYMOUS_SQL, RLS_JWT_SQL, RLS_ROLES_SQL, RLS_UID_SQL, RUNTIME_CONTRACT_VERSION, RUNTIME_ONLY_COLLECTION_KEYS, RebaseApiError, RebaseClientError, SCHEMA_VERSION_HEADER, SCOPE_TARGETS, SIMULATED_CONTEXT_HEADER, SIMULATE_API_KEY_ID_HEADER, SIMULATE_ROLE_HEADER, SIMULATE_USER_ID_HEADER, STORAGE_REFERENCE_SCHEME, Vector, amendResourceKind, applyCollectionPatch, bucket, buildResourceGraph, canonicalSchemaPayload, collectionPatchProblems, computeSchemaVersion, database, declareCron, declareFunction, declareResource, declaredDataSources, declaredDatabaseExtensions, declaredQueueConsumers, declaredResources, declaredStorageSources, declaredSubscriptions, describeScope, deserializeCollections, diffCollections, diffJsonValues, encodeRelationAggregateSort, envBasesForResource, findEnvSuffixCollision, findStorageSuffixCollision, formatSimulatedContext, getCollectionDataPath, getDataSourceCapabilities, getDeclaredSubcollections, hasAdminRole, hasFieldOperation, hasForeignKeyOnTarget, intersectScopes, isAdminScope, isAnonymousUid, isBranchAdmin, isBuiltInScope, isChannelBusInstance, isCollectionPatch, isContentHashedFileName, isDataPlaneScope, isDocumentAdmin, isFieldOperation, isFirebaseCollectionConfig, isLazyComponentRef, isManyToMany, isMongoDBCollectionConfig, isPostgresCollectionConfig, isPublicStorageKey, isPublicStoragePath, isRelationAggregateSort, isRelationalCollectionConfig, isResourceHandle, isSQLAdmin, isSchemaAdmin, isSchemaEditingAdmin, isSerializedCollectionRef, isStorageReference, isTenantClaimSource, isTenantMembershipSource, isToMany, isUnsupported, isValidAppHost, isValidEngine, joinConditions, knownScopes, nestAdminCollectionKeys, nestAdminKeysOf, nestAdminPropertyKeys, nestCollectionPatchPaths, parseAppAddress, parseEnvBoolean, parseRelationAggregateSort, parseScope, parseSimulatedContext, parseStorageReference, policy, queue, registerDataSourceCapabilities, registerResourceKind, reservedPrefixFor, resetDeclaredQueueConsumers, resetDeclaredResources, resetDeclaredSubscriptions, resolveClientListLimit, resolveResourceRefs, resolveStorageReferences, resourceEnvSuffix, resourceId, resourceKeyOf, resourceKind, resourceKinds, resourceToDataSource, resourceToStorageSource, rewriteLegacyRlsFunctions, roleNameProblem, runtimeOnlyKeyIn, scopeAcceptsTarget, scopeGrants, scopeGrantsAny, scopeTargets, scopesBeyond, scopesForRoles, serializeCollections, setQueueRuntime, setTopicRuntime, simulationHeaders, soleJoinCondition, sortKeyToString, storageEnvSuffix, storageObjectPath, storageReference, storageReferencesForDownloadUrls, storageTargetOfDownloadUrl, storageTargetsInText, summarizeRoles, summarizeScopes, toCanonicalOp, toCollectionJson, topic, unsupportedMethod, usesLegacyRlsFunctions, validateScopes };
3921
+ export { ADMIN_COLLECTION_KEYS, ADMIN_PROPERTY_KEYS, ADMIN_ROLE, ADMIN_SCOPES, ALL_WHERE_FILTER_OPS, ANONYMOUS_USER_ID, ANONYMOUS_USER_IDS, AUTH_FLOW_HEADER, BATCH_REF_KEY, BUILT_IN_SCOPES, BUILT_IN_SCOPE_DESCRIPTIONS, BUNDLE_FORMAT_VERSION, CANONICAL_TO_REST, DATA_PLANE_SCOPES, DEFAULT_CAPABILITIES, DEFAULT_COMMIT_PATHS, DEFAULT_DATA_SOURCE_KEY, DEFAULT_FILTERABLE_RELATION_KINDS, DEFAULT_FUZZY_THRESHOLD, DEFAULT_LIST_LIMIT, DEFAULT_RESOURCE_KEY, DEFAULT_SEARCH_COLUMN, DEFAULT_SEARCH_LANGUAGE, DEFAULT_SEARCH_MODE, DEFAULT_SEARCH_WEIGHT, DEFAULT_STORAGE_SOURCE_KEY, DEFAULT_TENANT_BYPASS_ROLES, DEFAULT_VECTOR_LIST_LIMIT, EMPTY_ACCESS_MODEL, EntityReference, EntityRelation, FIELD_OPERATORS, FIREBASE_CAPABILITIES, GeoPoint, IMPERSONATE_HEADER, INCLUDE_COUNT_KEY, JUNCTION_PIVOT_KEY, KEY_MANAGEMENT_SCOPES, LEGACY_RLS_JWT_SQL, LEGACY_RLS_ROLES_SQL, LEGACY_RLS_SCHEMA, LEGACY_RLS_UID_SQL, LIST_OPS, ListLimitError, MAX_INCLUDE_DEPTH, MAX_LIST_LIMIT, MCP_APP_MODULES, MONGODB_CAPABILITIES, NULL_OPS, POSTGRES_CAPABILITIES, PUBLIC_STORAGE_PREFIX, REBASE_SCHEMA, RELEVANCE_SORT_FIELD, RESERVED_BACKEND_PREFIXES, RESOURCE_GRAPH_VERSION, REST_TO_CANONICAL, RLS_IS_ANONYMOUS_SQL, RLS_JWT_SQL, RLS_ROLES_SQL, RLS_UID_SQL, RUNTIME_CONTRACT_VERSION, RUNTIME_ONLY_COLLECTION_KEYS, RebaseApiError, RebaseClientError, SCHEMA_VERSION_HEADER, SCOPE_TARGETS, SIMULATED_CONTEXT_HEADER, SIMULATE_API_KEY_ID_HEADER, SIMULATE_ROLE_HEADER, SIMULATE_USER_ID_HEADER, STORAGE_REFERENCE_SCHEME, Vector, amendResourceKind, applyCollectionPatch, bucket, buildResourceGraph, canonicalSchemaPayload, collectionPatchProblems, computeSchemaVersion, database, declareCron, declareFunction, declareResource, declaredDataSources, declaredDatabaseExtensions, declaredQueueConsumers, declaredResources, declaredStorageSources, declaredSubscriptions, describeScope, deserializeCollections, diffCollections, diffJsonValues, encodeRelationAggregateSort, envBasesForResource, findEnvSuffixCollision, findStorageSuffixCollision, formatSimulatedContext, getCollectionDataPath, getDataSourceCapabilities, getDeclaredSubcollections, hasAdminRole, hasFieldOperation, hasForeignKeyOnTarget, intersectScopes, isAdminScope, isAnonymousUid, isBranchAdmin, isBuiltInScope, isChannelBusInstance, isCollectionPatch, isContentHashedFileName, isDataPlaneScope, isDocumentAdmin, isFieldOperation, isFirebaseCollectionConfig, isLazyComponentRef, isManyToMany, isMongoDBCollectionConfig, isPostgresCollectionConfig, isPublicStorageKey, isPublicStoragePath, isRelationAggregateSort, isRelationalCollectionConfig, isResourceHandle, isSQLAdmin, isSchemaAdmin, isSchemaEditingAdmin, isSerializedCollectionRef, isStorageReference, isTenantClaimSource, isTenantMembershipSource, isToMany, isUnsupported, isValidAppHost, isValidEngine, joinConditions, knownScopes, nestAdminCollectionKeys, nestAdminKeysOf, nestAdminPropertyKeys, nestCollectionPatchPaths, parseAppAddress, parseEnvBoolean, parseRelationAggregateSort, parseScope, parseSimulatedContext, parseStorageReference, policy, queue, registerDataSourceCapabilities, registerResourceKind, reservedPrefixFor, resetDeclaredQueueConsumers, resetDeclaredResources, resetDeclaredSubscriptions, resolveClientListLimit, resolveResourceRefs, resolveStorageReferences, resourceEnvSuffix, resourceId, resourceKeyOf, resourceKind, resourceKinds, resourceToDataSource, resourceToStorageSource, rewriteLegacyRlsFunctions, roleNameProblem, runtimeOnlyKeyIn, scopeAcceptsTarget, scopeGrants, scopeGrantsAny, scopeTargets, scopesBeyond, scopesForRoles, serializeCollections, setQueueRuntime, setTopicRuntime, simulationHeaders, soleJoinCondition, sortKeyToString, storageEnvSuffix, storageObjectPath, storageReference, storageReferencesForDownloadUrls, storageTargetOfDownloadUrl, storageTargetsInText, summarizeRoles, summarizeScopes, toCanonicalOp, toCollectionJson, topic, unsupportedMethod, usesLegacyRlsFunctions, validateScopes };
3859
3922
 
3860
3923
  //# sourceMappingURL=index.es.js.map