Skip to content

Commit a5f7f45

Browse files
Merge pull request #789 from lunasec-io/bun-blog
fix link and attempt to fix guides Former-commit-id: 86a50c9 Former-commit-id: 0781d60289a7a454b38d25642d86e69366852efa
2 parents 71bad96 + e8b8c57 commit a5f7f45

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

docs/blog/2022-07-20-bun-first-look.mdx

+1-2
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ Bun also adds some things you'd usually think of as frameworks to the standard l
171171

172172
Bun's webserver looks pretty bare-bones. Express still works fine for most of the community, even if it is a bit behind the times. (They just added promise support this year).
173173
Bun's server appears to be very similar to a Cloudflare Worker. Maybe Bun's creator will circle back around to more work on the webserver once every other problem in the entire JavaScript world is fixed.
174-
It's worth noting that clever system calls can make Bun's webserver [twice as fast in some cases](https://twitter.
175-
com/jarredsumner/status/1506182333459693571), particularly when working with files.
174+
It's worth noting that clever system calls can make Bun's webserver [twice as fast in some cases](https://twitter.com/jarredsumner/status/1506182333459693571), particularly when working with files.
176175

177176
As for the new SQLite adapter, I guess the normal way to do sqlite in Node is a bit confusing. Most people combine the older `sqlite3` package with the `sqlite` wrapper to add promise support,
178177
but it's not that bad. Bun's solution looks a bit cleaner, and I won't even bother checking if it's faster.

lunatrace/bsl/backend/src/guide-ingester/upsert-guides.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ import process from 'process';
1616
import { hasura } from '../hasura-api';
1717
import {
1818
Guide_Related_Guides_Constraint,
19+
Guide_Related_Guides_Update_Column,
1920
Guide_Vulnerabilities_Constraint,
21+
Guide_Vulnerabilities_Update_Column,
2022
Guides_Insert_Input,
2123
} from '../hasura-api/generated';
2224
import { log } from '../utils/log';
@@ -62,7 +64,6 @@ async function buildGuideWithRelations(guide: Guide): Promise<Guides_Insert_Inpu
6264
function convertGuidesToHasuraFormat(guide: Guide): Guides_Insert_Input {
6365
return {
6466
guide_unique_id: guide.guide_unique_id,
65-
6667
body: guide.body,
6768
title: guide.metadata.name,
6869
metadata: guide.metadata,
@@ -87,7 +88,10 @@ async function buildGuideVulnerabilities(
8788
return false;
8889
}
8990
return {
90-
on_conflict: { constraint: Guide_Vulnerabilities_Constraint.GuideVulnerabilitiesUnique, update_columns: [] },
91+
on_conflict: {
92+
constraint: Guide_Vulnerabilities_Constraint.GuideVulnerabilitiesUnique,
93+
update_columns: [Guide_Vulnerabilities_Update_Column.VulnerabilityId],
94+
},
9195
data: vulns.map((vuln) => {
9296
return {
9397
vulnerability_id: vuln.id,
@@ -99,7 +103,10 @@ async function buildGuideVulnerabilities(
99103
// builds the self join table
100104
function buildRelatedGuides(relatedNames: Guide['metadata']['relatedGuides']): Guides_Insert_Input['related_guides'] {
101105
return {
102-
on_conflict: { constraint: Guide_Related_Guides_Constraint.GuideRelatedGuidesUnique, update_columns: [] },
106+
on_conflict: {
107+
constraint: Guide_Related_Guides_Constraint.GuideRelatedGuidesUnique,
108+
update_columns: [Guide_Related_Guides_Update_Column.ToGuideUniqueId],
109+
},
103110
data: relatedNames.map((r) => {
104111
return {
105112
to_guide_unique_id: r,

0 commit comments

Comments
 (0)