feat(firestore): decouple handwritten sdk wrapper from embedded gapic clients - #8928
feat(firestore): decouple handwritten sdk wrapper from embedded gapic clients#8928quirogas wants to merge 15 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes auto-generated configuration and proto files, transitioning the Firestore library to depend on the external @google-cloud/firestore-api package. Imports and lazy-loading getters for v1 and v1beta1 are updated accordingly. The review feedback highlights opportunities to optimize performance and code cleanliness: first, by directly requiring @google-cloud/firestore-api in the client factory to avoid repeatedly triggering lazy getters; and second, by caching the loaded modules in the lazy getters for v1 and v1beta1 to prevent redundant module loading and property copying on multiple accesses.
…store-handwritten
|
|
||
| logging.basicConfig(level=logging.DEBUG) | ||
|
|
||
| staging = Path("owl-bot-staging") |
There was a problem hiding this comment.
We no longer need to copy the gapic files into dev, as they are now live in their own separate library: https://www.npmjs.com/package/@google-cloud/firestore-api.
…g JSDoc deprecation guidance
a1fc42e to
f995b89
Compare
…eslintrc (googleapis#8928) - Update typescript import namespace in bin/linter.mjs (Option 2) to fix ts.sys undefined error - Execute ESLint and tsc via child process inside target package directory using package local compilers when available - Update handwritten/firestore/.eslintrc.json to extend root gts config instead of local node_modules
f995b89 to
a833777
Compare
…obuf reflection serialization (googleapis#8928)
… delegating google protos (googleapis#8928)
… callsite modernization (googleapis#8928)
…v1beta1 generation (googleapis#8928)
…e local declarations (googleapis#8928) - Remove dev/protos/firestore_v1_proto_api.* and dev/protos/v1.json to transition @google-cloud/firestore-api into our automated Single Source of Truth for TypeScript declarations - Extract custom offline bundle persistence interface definitions into standalone dev/src/bundle-proto.* modules - Update query operator dictionaries (directionOperators, comparisonOperators) and internal comparators to consume native GAPIC enum objects and 64-bit Long structures - Verify 100% clean compilation and passing unit test suites across watch, partition-query, aggregate-query, and transaction operations
…onfiguration file mappings (googleapis#8928) - Remove wildcard asterisk export entries (./v1/*, ./protos/*, ./build/*) to prevent external reliance on private implementation scripts - Add explicit named subpath export mappings for firestore_client_config.json and protos.json to ensure zero breaking changes across internal wrapper consumers - Verify 100% passing test execution across all client and admin service operations
…cy, and discontinue v1beta1 (#9073) Parallel architectural update to `@google-cloud/firestore-api` supporting the handwritten Firestore SDK disentanglement (#8928). ### Summary of Changes - **Runtime `long` Dependency**: Moves `"long"` from `devDependencies` to runtime `"dependencies"`. Generated declaration files (`protos.d.ts`) explicitly import `long`. In environments using strict package managers with node_modules isolation (such as `pnpm`), omitting `long` from runtime dependencies causes TypeScript compilation to fail with `error TS2307: Cannot find module 'long'` (per structural context in `googleapis/nodejs-firestore#2322`). - **Subpath Exports**: Configures conditional subpath exports (`./v1`, `./client_v1`, `./admin_v1`, `./protos`, and configuration files) with the `"types"` condition placed before `"default"`. This ensures declaration files resolve correctly for consumers using modern TypeScript module resolution (`"moduleResolution": "nodenext"`). - **Discontinue `v1beta1`**: Removed `v1beta1` from `librarian.yaml` and regenerated the library via `librarian` to stop generating beta client code. Internal: b/531788771
MarkDuckworth
left a comment
There was a problem hiding this comment.
Looks good in context of the stacked PRs
|
Labeling as "do not merge" to make sure we merge all stacked prs before merging this one. |
Decouple the handwritten Firestore SDK wrapper from embedded GAPIC client implementations by transitioning to the standalone
@google-cloud/firestore-apipackage. Standalone-apipackages are now generated and versioned independently.Summary of Changes
@google-cloud/firestore-api(^0.2.0).dev/protos/*.js(firestore_v1,firestore_admin_v1,firestore_v1beta1) with dynamic forwarding exports directly to@google-cloud/firestore-api/build/protos/protos, removing 76,572 lines of static JavaScript.dev/src/index.tsto ensure referential equality (===) and avoid redundant module require andObject.assignexecution on repeated accesses.@deprecatedannotations directing consumers to import@google-cloud/firestore-apidirectly instead of relying on re-exported client properties (Firestore.v1).owlbot.py,.OwlBot.yaml) and proto compilation scripts (dev/protos/update.sh).Why Local Types Remain in This Commit
Historically,
dev/protos/update.shcompiled static protobuf TypeScript interfaces (firestore_v1_proto_api.d.ts) using custom post-processing: passing--force-enum-stringto force protobuf enums into string literal unions ('ASCENDING' | 'DESCENDING'), and executing a Perl regex to replace 64-bit integerLongreferences withstring. Modern GAPIC packages generate standard numeric enums andnumber | Long.In this initial pull request, we intentionally retain
firestore_v1_proto_api.d.tswhile delegating.jsruntime files to@google-cloud/firestore-api. This is done specifically in PR #1 to separate the mechanical work of separating the library dependency from the deeper call-site refactoring required to transition from string literals to native GAPIC enums. Once the entire stacked series merges, the final state will be complete reliance on@google-cloud/firestore-apias our single source of truth for all types and runtime models.Internal: b/531788771
📚 Stack Navigation Index