If the values you are trying to insert conflict due to existing data the orUpdate function can be used to update specific values on the conflicted target.
await datasource
.createQueryBuilder()
.insert()
.into(User)
.values({
firstName: "Timber",
lastName: "Saw",
externalId: "abc123",
})
.orUpdate(
["firstName", "lastName"],
["externalId"],
)
.execute()