Skip to content

Commit

Permalink
refactor(core): make options parameter optional in `getLookupPipeli…
Browse files Browse the repository at this point in the history
…ne()`
  • Loading branch information
minenwerfer committed Nov 17, 2024
1 parent 5edb271 commit fdc0888
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-spoons-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@aeriajs/core": patch
---

Make `options` parameter optional in `getLookupPipeline()`'
6 changes: 3 additions & 3 deletions packages/core/src/collection/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const getTempName = (path: PathSegment[]) => {
const referenceMemo: Record<string, ReferenceMap | undefined> = {}
const lookupMemo: Record<string, Awaited<ReturnType<typeof buildLookupPipeline>> | undefined> = {}

export const getReferences = async (properties: FixedObjectProperty['properties'], options: GetReferenceOptions = {}) => {
export const getReferences = async (properties: FixedObjectProperty['properties'], options: GetReferenceOptions = {} as GetReferenceOptions) => {
const {
depth = 0,
maxDepth = 3,
Expand Down Expand Up @@ -349,7 +349,7 @@ export const recurseSetStage = (reference: Reference, path: PathSegment[], paren
}
}

export const buildLookupPipeline = (refMap: ReferenceMap, options: BuildLookupPipelineOptions = {}): Document[] => {
export const buildLookupPipeline = (refMap: ReferenceMap, options: BuildLookupPipelineOptions = {} as BuildLookupPipelineOptions): Document[] => {
const {
rootPipeline = [],
path = [],
Expand Down Expand Up @@ -462,7 +462,7 @@ export const buildLookupPipeline = (refMap: ReferenceMap, options: BuildLookupPi
return pipeline
}

export const getLookupPipeline = async (description: Description, options: BuildLookupPipelineOptions) => {
export const getLookupPipeline = async (description: Description, options?: BuildLookupPipelineOptions) => {
const refMap = await getReferences(description.properties)
return buildLookupPipeline(refMap, options)
}
Expand Down

0 comments on commit fdc0888

Please sign in to comment.