• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

typeorm / typeorm / 15219332477

23 May 2025 09:13PM UTC coverage: 17.216% (-59.1%) from 76.346%
15219332477

Pull #11332

github

naorpeled
cr comments - move if block
Pull Request #11332: feat: add new undefined and null behavior flags

1603 of 12759 branches covered (12.56%)

Branch coverage included in aggregate %.

0 of 31 new or added lines in 3 files covered. (0.0%)

14132 existing lines in 166 files now uncovered.

4731 of 24033 relevant lines covered (19.69%)

60.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.24
/src/decorator/tree/TreeChildren.ts
1
import { getMetadataArgsStorage } from "../../globals"
1✔
2
import { RelationMetadataArgs } from "../../metadata-args/RelationMetadataArgs"
3
import { RelationOptions } from "../options/RelationOptions"
4

5
/**
6
 * Marks a entity property as a children of the tree.
7
 * "Tree children" will contain all children (bind) of this entity.
8
 */
9
export function TreeChildren(options?: {
1✔
10
    cascade?:
11
        | boolean
12
        | ("insert" | "update" | "remove" | "soft-remove" | "recover")[]
13
}): PropertyDecorator {
14
    return function (object: Object, propertyName: string) {
36✔
15
        if (!options) options = {} as RelationOptions
36✔
16

17
        // now try to determine it its lazy relation
18
        const reflectedType =
19
            Reflect && (Reflect as any).getMetadata
36!
20
                ? Reflect.getMetadata("design:type", object, propertyName)
21
                : undefined
22
        const isLazy =
23
            (reflectedType &&
36✔
24
                typeof reflectedType.name === "string" &&
25
                reflectedType.name.toLowerCase() === "promise") ||
26
            false
27

28
        // add one-to-many relation for this
29
        getMetadataArgsStorage().relations.push({
36✔
30
            isTreeChildren: true,
31
            target: object.constructor,
32
            propertyName: propertyName,
33
            isLazy: isLazy,
34
            relationType: "one-to-many",
UNCOV
35
            type: () => object.constructor,
×
36
            options: options,
37
        } as RelationMetadataArgs)
38
    }
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc