feat(geocoding): migrate to Places API (New), add server-side geocoding for agents#78
Draft
feat(geocoding): migrate to Places API (New), add server-side geocoding for agents#78
Conversation
…completeElement Google deprecated google.maps.places.AutocompleteService as of March 2025. This replaces the react-google-places-autocomplete dependency with Google's new PlaceAutocompleteElement web component and fetchFields API. https://claude.ai/code/session_01TZQpaQ1MNq3SQ8uEU7iCSt
…ration Also fix prettier config and lint-staged to handle .md files correctly (default parser was set to typescript, causing markdown formatting to fail). https://claude.ai/code/session_01TZQpaQ1MNq3SQ8uEU7iCSt
…ad of PlaceAutocompleteElement
…nt/API usage
Adds two server-side geocoding mechanisms for AI agents and API consumers:
- GET /api/geocoding-plugin/search?q=<address> — authenticated endpoint
with custom access function support
- {field}_address virtual field with beforeChange hooks — auto-geocodes
address strings on create/update, populates point + _meta fields
Uses the new _meta field shape (name, formattedAddress, googlePlaceId, types).
Both hooks share a single API call via req.context promise caching.
Also adds:
- Full test infrastructure: 27 unit tests + 10 integration tests (SQLite)
- Articles collection with Lexical block for testing geocoding in blocks
- test-geocoding CI job
- "Usage with AI Agents / API" README section
https://claude.ai/code/session_01Ja3JVC48ozET22Z7yJkyY6
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Places API (New) Migration
react-google-places-autocompletewith Google's Places API (New)AutocompleteSuggestionAPI and Payload's built-inReactSelect_googlePlacesDatafield to_metawith a clean flat schema:{ name, formattedAddress, googlePlaceId, types }geoDataFieldOverrideconfig option tolocationMetaOverridemigrations/migrate-to-0.3.0.ts)Server-Side Geocoding for AI Agents / API
GET /api/geocoding-plugin/search?q=<address>— authenticated endpoint with custom access function support (geocodingEndpoint.access){field}_addressvirtual field — everygeocodingFieldincludes a hidden virtual_addresstext field; submitting an address string via the API auto-geocodes it and populates the point +_metafieldsgeocodeAddress()exported service — server-side Google Geocoding HTTP API client, usable in custom codereq.contextpromise caching (Payload processes row fields in parallel)Test Infrastructure
test-geocodingCI job added to workflowBreaking Changes
_googlePlacesDatafield renamed to_metawith new data shapegeoDataFieldOverrideconfig renamed tolocationMetaOverridereact-google-places-autocompletedependency removedTest plan
_addresson create and updatetsc --noEmit)test-geocodingjob passes_metafield stores{ name, formattedAddress, googlePlaceId, types }