Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/db/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,23 @@ export class InvalidSourceTypeError extends QueryBuilderError {
}
}

export class UnionKeyConflictError extends TanStackDBError {
constructor(
unionId: string,
key: string | number,
existingCollectionId: string,
incomingCollectionId: string,
) {
super(
`Union "${unionId}" cannot merge key "${String(
key,
)}" from collection "${incomingCollectionId}" because it already exists in "${existingCollectionId}". ` +
`Ensure union sources have unique keys or handle duplicates before unioning.`,
)
this.name = `UnionKeyConflictError`
}
}

export class JoinConditionMustBeEqualityError extends QueryBuilderError {
constructor() {
super(`Join condition must be an equality expression`)
Expand Down
2 changes: 2 additions & 0 deletions packages/db/src/query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export {
export { type LiveQueryCollectionConfig } from './live/types.js'
export { type LiveQueryCollectionUtils } from './live/collection-config-builder.js'

export { union, unionFromLiveQuery } from './union.js'

// Predicate utilities for predicate push-down
export {
isWhereSubset,
Expand Down
Loading