This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| preload = ['./path/to/plugin.ts'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { z } from 'zod'; | |
| function transformFileProperty<T extends string>(key: T) { | |
| return (data: Record<string, string>) => { | |
| if (data[key]) { | |
| return { | |
| [key]: data[key], | |
| } as { | |
| [P in T]: string; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Err, Ok, PromiseResult } from 'path/to/module'; | |
| interface User { | |
| // ... | |
| } | |
| enum UserError { | |
| USER_NOT_FOUND = 'USER_NOT_FOUND', | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { env } from 'cloudflare:workers'; | |
| import type { z } from 'zod'; | |
| export type QueueBody = { | |
| payload?: unknown; | |
| type: string; | |
| }; | |
| type KeysOfType<T, V> = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default { | |
| fetch: async (request, env) => { | |
| if (request.method !== 'POST') | |
| return new Response('Method Not Allowed', { status: 405 }); | |
| const json = await request | |
| .json<{ | |
| alarm_id: string; | |
| events: Array<{ | |
| alert_id: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export interface ScheduleHandlerContext<E = Env> { | |
| /** | |
| * The scheduled event controller providing details about the cron trigger. | |
| */ | |
| controller: ScheduledController; | |
| /** | |
| * The environment bindings available to the worker. | |
| */ | |
| env: E; | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Or use the `osc-progress` package | |
| enum ProgressState { | |
| Hidden = 0, | |
| Normal = 1, | |
| Error = 2, | |
| Indeterminate = 3, | |
| Warning = 4, | |
| } |
OlderNewer