Skip to content

Commit

Permalink
Merge pull request #789 from lunasec-io/bun-blog
Browse files Browse the repository at this point in the history
fix link and attempt to fix guides

Former-commit-id: 86a50c9
Former-commit-id: 0781d60289a7a454b38d25642d86e69366852efa
  • Loading branch information
factoidforrest authored Jul 20, 2022
2 parents 71bad96 + e8b8c57 commit a5f7f45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 1 addition & 2 deletions docs/blog/2022-07-20-bun-first-look.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ Bun also adds some things you'd usually think of as frameworks to the standard l

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).
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.
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.
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.

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,
but it's not that bad. Bun's solution looks a bit cleaner, and I won't even bother checking if it's faster.
Expand Down
13 changes: 10 additions & 3 deletions lunatrace/bsl/backend/src/guide-ingester/upsert-guides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import process from 'process';
import { hasura } from '../hasura-api';
import {
Guide_Related_Guides_Constraint,
Guide_Related_Guides_Update_Column,
Guide_Vulnerabilities_Constraint,
Guide_Vulnerabilities_Update_Column,
Guides_Insert_Input,
} from '../hasura-api/generated';
import { log } from '../utils/log';
Expand Down Expand Up @@ -62,7 +64,6 @@ async function buildGuideWithRelations(guide: Guide): Promise<Guides_Insert_Inpu
function convertGuidesToHasuraFormat(guide: Guide): Guides_Insert_Input {
return {
guide_unique_id: guide.guide_unique_id,

body: guide.body,
title: guide.metadata.name,
metadata: guide.metadata,
Expand All @@ -87,7 +88,10 @@ async function buildGuideVulnerabilities(
return false;
}
return {
on_conflict: { constraint: Guide_Vulnerabilities_Constraint.GuideVulnerabilitiesUnique, update_columns: [] },
on_conflict: {
constraint: Guide_Vulnerabilities_Constraint.GuideVulnerabilitiesUnique,
update_columns: [Guide_Vulnerabilities_Update_Column.VulnerabilityId],
},
data: vulns.map((vuln) => {
return {
vulnerability_id: vuln.id,
Expand All @@ -99,7 +103,10 @@ async function buildGuideVulnerabilities(
// builds the self join table
function buildRelatedGuides(relatedNames: Guide['metadata']['relatedGuides']): Guides_Insert_Input['related_guides'] {
return {
on_conflict: { constraint: Guide_Related_Guides_Constraint.GuideRelatedGuidesUnique, update_columns: [] },
on_conflict: {
constraint: Guide_Related_Guides_Constraint.GuideRelatedGuidesUnique,
update_columns: [Guide_Related_Guides_Update_Column.ToGuideUniqueId],
},
data: relatedNames.map((r) => {
return {
to_guide_unique_id: r,
Expand Down

0 comments on commit a5f7f45

Please sign in to comment.