Skip to content

feat(api-headless-cms): postgre, utils and os - #5431

Merged
brunozoric merged 51 commits into
nextfrom
bruno/feat/api-headless-cms-pg-os
Jul 20, 2026
Merged

feat(api-headless-cms): postgre, utils and os#5431
brunozoric merged 51 commits into
nextfrom
bruno/feat/api-headless-cms-pg-os

Conversation

@brunozoric

@brunozoric brunozoric commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Changes

Extract OS stuff into utils-cms package.
Extract OS packages: api-opensearch and api-opensearch-aws.
Use base pg cms package and decorate with opensearch operations.

How Has This Been Tested?

Manually and vitest.

@brunozoric brunozoric self-assigned this Jul 17, 2026
brunozoric and others added 29 commits July 20, 2026 09:04
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ture from ddb-es

Moves 77 files: 9 feature directories (field indexing, filtering, sorting,
FTS, query/body/sort modifiers, value search), elasticsearch operations
directory (22 files), helpers, values, configurations, elasticsearch
index lifecycle, and transformEntryToIndex.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…, recordType

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…kage

All OpenSearch-related imports now point to @webiny/api-headless-cms-utils-os
instead of local ~/features/, ~/operations/entry/elasticsearch/, ~/helpers/,
~/configurations, ~/elasticsearch/ paths. CmsIndexEntry type import split
from ~/types.js to utils-os. Added utils-os as dependency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removed 76 files: 9 feature directories, operations/entry/elasticsearch/,
helpers/, values/, configurations.ts, elasticsearch/, and
transformEntryToIndex.ts. All now live in @webiny/api-headless-cms-utils-os.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…n + OS list

Wraps @webiny/api-headless-cms-sql entry storage operations: every write op
(create, createRevisionFrom, update, publish, unpublish, move, moveToBin,
restoreFromBin, delete, deleteRevision, deleteMultipleEntries) delegates to
SQL then writes/removes the corresponding sync-table rows via SyncWriter.
list/get/getUniqueFieldValues query OpenSearch directly, mirroring the
ddb-es package's OS query pattern. Point reads (getByIds, getRevisions,
etc.) pass straight through to the SQL operations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…istration

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…penSearch sync bridge

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Simplify vitest config to only load pg-os presets (not ddb-es)
- Fix syncWriter test index assertion to use toContain (accounts for OS prefix)
- Add pg-os keyword for preset discovery

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…reate as DI feature

Replace bare createElasticsearchIndex function with a proper DI abstraction
that resolves OpenSearchClient and CmsEntryOpenSearchIndex[] from the container.
Both ddb-es and pg-os consumers now resolve and call indexCreate.execute()
instead of passing client/indexConfigs manually.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…elete as DI feature

Replace bare deleteElasticsearchIndex function with a proper DI abstraction
that resolves OpenSearchClient from the container. Both ddb-es and pg-os
consumers now resolve and call indexDelete.execute(). Old bare functions in
elasticsearch/ directory deleted — no remaining callers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ilder as DI feature

Replace createElasticsearchBody bare function with a proper DI abstraction
that resolves all 10 OpenSearch registries/modifiers from the container.
Both ddb-es and pg-os callers now resolve bodyBuilder once and call
bodyBuilder.build({ model, params }) — down from 12+ params per call site.
Removed ~8 unused registry resolutions and type imports from each consumer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…athFactory as DI features

Add CmsEntryOpenSearchExecFiltering (wraps filtering pipeline with
operatorRegistry, valueSearchRegistry, filterRegistry from DI) and
CmsEntryOpenSearchFieldPathFactory (wraps field path computation with
valueSearchRegistry from DI). Update body.ts and sort.ts to accept these
DI features as params. BodyBuilderImpl now resolves ExecFiltering and
FieldPathFactory from container instead of operatorRegistry/filterRegistry
directly. Both consumers register the new features.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ratorList as DI features

Add CmsEntryOpenSearchValueTransformer (wraps transformValueForSearch with
valueSearchRegistry from DI) and CmsEntryOpenSearchOperatorList (wraps
createOperatorPluginList with operatorRegistry from DI). Update filtering
pipeline (exec.ts, applyFiltering.ts) to use these DI features instead of
bare functions. ExecFilteringImpl now resolves OperatorList, ValueTransformer,
and FieldPathFactory from container. Updated ddb-es test helpers to register
new features in test container.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…plementations

Move body.ts logic into BodyBuilderImpl.build(), exec.ts logic into
ExecFilteringImpl.execute(). Move sort.ts, applyFiltering.ts, populated.ts,
values.ts as helpers inside their respective feature folders. Delete old
files: body.ts, sort.ts, exec.ts, path.ts, transformValueForSearch.ts,
plugins/operator.ts, filtering/applyFiltering.ts, filtering/populated.ts,
filtering/values.ts. Keep filtering/index.ts as thin compatibility shim
for ddb-es test imports. Only shared utilities remain in operations/entry/
elasticsearch/ (fields, initialQuery, keyword, fullTextSearch, types, etc).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… helpers

Delete filtering/index.ts from utils-os (was only used by ddb-es tests).
Move CreateExecFilteringResponse type and createExecFiltering helper into
ddb-es test mock. Update 8 test files to import from local mock instead
of cross-package path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
brunozoric and others added 9 commits July 20, 2026 09:05
…UtilsFeature

Create single CmsEntryOpenSearchUtilsFeature that registers all 11
utils-os features. Consumers now call one .register() instead of 11.
Remove Impl exports from barrel — only abstractions and the composite
feature are public API. Update ddb-es and pg-os feature files and test
container to use the composite feature.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…bstractions

Add exports/api/cms/opensearch.ts as the canonical import path for all
OpenSearch abstractions. Update ddb-es and pg-os to import from
@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js instead
of deep feature paths. ddb-es re-export file updated to delegate to
the canonical path. Merged duplicate imports in all consumer files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…feature

Barrel index.ts now exports only CmsEntryOpenSearchUtilsFeature.
Abstractions are available via exports/api/cms/opensearch.js path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix api-headless-cms-es-tasks to import configurations and abstractions
from @webiny/api-headless-cms-utils-os instead of ddb-es (which moved
these in Phase 1). Drop unused ddb-es dep from es-tasks. Fix webiny
package to import OpenSearch abstractions from ddb-es canonical exports
path instead of deep feature paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AWS OpenSearch package is internal wiring, not user-facing API. Users
interact with base OpenSearch abstraction; AWS feature registers
automatically. Removed exports/ folder and regenerated webiny package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@brunozoric
brunozoric force-pushed the bruno/feat/api-headless-cms-pg-os branch from b029948 to 44b8e1a Compare July 20, 2026 07:06
brunozoric and others added 13 commits July 20, 2026 09:12
Add AwsOpenSearchClientFactoryFeature, createAwsOpenSearchClient, and
CmsEntryOpenSearchUtilsFeature entries to ai-context doc.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
One abstraction per file: EntryWriteOperations.ts and EntrySearchOperations.ts
in their own abstractions/ directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…on deps

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…vior

getUniqueFieldValues uses CmsModel directly, not StorageOperationsCmsModel.
Fix type definition and remove unnecessary model conversion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add writeEntry() and removeEntry() to SyncWriter that batch latest +
published rows into one SQL insert...onConflict().merge() call instead
of two sequential upserts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@brunozoric brunozoric added this to the 6.6.0 milestone Jul 20, 2026
@brunozoric
brunozoric marked this pull request as ready for review July 20, 2026 08:52
@brunozoric
brunozoric merged commit 7634329 into next Jul 20, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant