store: ESB getter boilerplate: ~120-140 lines shared across getters, future extraction candidate

This commit is contained in:
Cal Corum 2026-02-26 12:57:36 -06:00
parent db9ce0c07e
commit 66df2aad41

View File

@ -0,0 +1,36 @@
---
id: 83e29321-7215-47a1-813e-a73187bda39f
type: insight
title: "ESB getter boilerplate: ~120-140 lines shared across getters, future extraction candidate"
tags: [esb-monorepo, getter-pattern, refactoring, technical-debt, insight, code-pattern]
importance: 0.55
confidence: 0.8
created: "2026-02-26T18:57:36.520923+00:00"
updated: "2026-02-26T18:57:36.520923+00:00"
---
# ESB Getter Boilerplate: Shared Code Pattern
## Observation
Comparing poolbrain-customers getter (~250 lines) with the upcoming SF-CA getter, approximately 120-140 lines are near-identical boilerplate.
## Shared Boilerplate Breakdown
| Section | ~Lines |
|---|---|
| GCP client init | 15 |
| createLogger() wrapper | 40 |
| getSecret() | 15 |
| Env var validation | 20 |
| Pub/Sub publishing loop | 20 |
| fromLastModifiedDate parsing | 25 |
| correlationId | 3 |
## Future Extraction Target
`packages/getter-utils/` with proposed exports:
- `createLogger(logName)`
- `getSecret(secretName, logger)`
- `parsePollerMessage(cloudEvent)`
- `publishRecords(records, opts)`
## Current Stance
Not abstracting yet — only 2 getters exist. Revisit when SF-CA getter is built and the pattern is confirmed across both implementations. Two data points is the minimum to validate the abstraction boundary.