Skip to content

Commit

Permalink
feat(response): adding response
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlindquist committed Sep 26, 2024
1 parent eb42daf commit 3fcafbb
Show file tree
Hide file tree
Showing 6 changed files with 1,097 additions and 941 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"zx": "^8.1.8"
},
"devDependencies": {
"@biomejs/biome": "1.9.2",
"@types/debug": "4.1.12",
"@types/express": "4.17.21",
"@types/express-ws": "3.0.5",
Expand Down
91 changes: 91 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/api/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ global.send = (channel: Channel, value?: any) => {
}
}

global.sendResponse = (response: any) => {
return global.sendWait(Channel.RESPONSE, response)
}

let _consoleLog = global.console.log.bind(global.console)
let _consoleWarn = global.console.warn.bind(global.console)
let _consoleClear = global.console.clear.bind(
Expand All @@ -388,7 +392,7 @@ global.log = (...args) => {
Channel.KIT_LOG,
args
.map(a =>
typeof a != "string" ? JSONSafe.stringify(a) : a
typeof a !== "string" ? JSONSafe.stringify(a) : a
)
.join(" ")
)
Expand Down
1 change: 1 addition & 0 deletions src/core/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export enum Mode {
}

export enum Channel {
RESPONSE = "RESPONSE",
ABANDON = "ABANDON",
APP_CONFIG = "APP_CONFIG",
APP_DB = "APP_DB",
Expand Down
3 changes: 3 additions & 0 deletions src/types/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ export type CronExpression =
| `${string} ${string} ${string} ${string} ${string} ${string}`

export interface Metadata {
/** The author's name */
author?: string
/**
* Specifies the name of the script as it appears in the Script Kit interface.
* If not provided, the file name will be used.
Expand Down Expand Up @@ -562,6 +564,7 @@ export interface Metadata {
/** Specifies a cron expression for scheduling the script to run at specific times or intervals. */
schedule?: CronExpression
access?: "public" | "key" | "private"
response?: boolean
}

export interface ProcessInfo {
Expand Down
Loading

0 comments on commit 3fcafbb

Please sign in to comment.