Skip to content

Commit

Permalink
schemata + js-ajv validator
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Jan 7, 2025
1 parent 227c219 commit 32e4db9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/gui/src/lib/services/SchemaValidationService/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export class SchemaValidationService {

constructor(){}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Ajv from 'ajv'

const validate = async (relay: string, checks: string[]): Promise<any> => {
const nocap = new Nocap(relay)
return nocap.check(checks)
}

self.onmessage = ({ data }) => {
const { relay, checks } = data as NocapRequestMessage;
check(relay, checks)
.then( (results: any) => {
const message: NocapResultMessage = {relay, results}
self.postMessage(message)
})
.catch( (error: any) => {
const message: NocapResultMessage = {relay, error}
self.postMessage(message)
})
}

0 comments on commit 32e4db9

Please sign in to comment.