@teever/ez-hook-effect 0.4.4 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,56 +1,57 @@
1
1
  {
2
- "name": "@teever/ez-hook-effect",
3
- "version": "0.4.4",
4
- "description": "A Discord webhook library built with Effect - type-safe, composable, and resilient",
5
- "module": "src/index.ts",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "type": "module",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js"
13
- }
14
- },
15
- "sideEffects": false,
16
- "files": [
17
- "dist",
18
- "README.md",
19
- "LICENSE"
20
- ],
21
- "author": "github.com/teeverc",
22
- "license": "MIT",
23
- "scripts": {
24
- "dev": "bun src/index.ts",
25
- "lint": "bun biome check ./src ./examples ./tests --write --unsafe",
26
- "jsr": "bunx jsr publish --allow-slow-types --allow-dirty",
27
- "build": "bun run clean && bun run build:bundle",
28
- "build:tsc": "tsc --project tsconfig.build.json",
29
- "build:bundle": "bun build ./src/index.ts --outdir ./dist --target node --format esm --sourcemap --external effect",
30
- "build:standalone": "bun build ./src/index.ts --compile --outfile ez-hook-effect",
31
- "clean": "rm -rf dist ez-hook-effect",
32
- "test": "bun test",
33
- "test:watch": "bun test --watch",
34
- "test:coverage": "bun test --coverage",
35
- "typecheck": "tsc --noEmit",
36
- "example": "bun run examples/05-complete-showcase.ts",
37
- "example:simple": "bun run examples/02-simple-demo.ts",
38
- "example:working": "bun run examples/04-comprehensive-demo.ts",
39
- "example:pipe": "bun run examples/03-pipe-style.ts",
40
- "sync:effect": "bun run ./scripts/update-effect-version.ts"
41
- },
42
- "devDependencies": {
43
- "@biomejs/biome": "^2.3.13",
44
- "@types/bun": "^1.3.8",
45
- "effect": "^3.19.15",
46
- "typescript": "^5.9.3"
47
- },
48
- "peerDependencies": {
49
- "effect": ">=3.19.15 <4"
50
- },
51
- "peerDependenciesMeta": {
52
- "effect": {
53
- "optional": false
54
- }
55
- }
2
+ "name": "@teever/ez-hook-effect",
3
+ "version": "0.5.0",
4
+ "description": "A Discord webhook library built with Effect - type-safe, composable, and resilient",
5
+ "module": "src/index.ts",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "sideEffects": false,
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "author": "github.com/teeverc",
22
+ "license": "MIT",
23
+ "scripts": {
24
+ "dev": "bun src/index.ts",
25
+ "lint": "bun biome check ./src ./examples ./tests --write --unsafe",
26
+ "jsr": "bunx jsr publish --allow-slow-types --allow-dirty",
27
+ "build": "bun run clean && bun run build:bundle",
28
+ "build:tsc": "tsc --project tsconfig.build.json",
29
+ "build:bundle": "bun build ./src/index.ts --outdir ./dist --target node --format esm --sourcemap --external effect",
30
+ "build:standalone": "bun build ./src/index.ts --compile --outfile ez-hook-effect",
31
+ "clean": "rm -rf dist ez-hook-effect",
32
+ "test": "bun test",
33
+ "test:watch": "bun test --watch",
34
+ "test:coverage": "bun test --coverage",
35
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.examples.json",
36
+ "typecheck:examples": "tsc --noEmit -p tsconfig.examples.json",
37
+ "example": "bun run examples/05-complete-showcase.ts",
38
+ "example:simple": "bun run examples/02-simple-demo.ts",
39
+ "example:working": "bun run examples/04-comprehensive-demo.ts",
40
+ "example:pipe": "bun run examples/03-pipe-style.ts",
41
+ "sync:effect": "bun run ./scripts/update-effect-version.ts"
42
+ },
43
+ "devDependencies": {
44
+ "@biomejs/biome": "^2.3.13",
45
+ "@types/bun": "^1.3.8",
46
+ "effect": "^4.0.0-beta.9",
47
+ "typescript": "^5.9.3"
48
+ },
49
+ "peerDependencies": {
50
+ "effect": ">=4.0.0-beta.9 <5"
51
+ },
52
+ "peerDependenciesMeta": {
53
+ "effect": {
54
+ "optional": false
55
+ }
56
+ }
56
57
  }
@@ -1,156 +0,0 @@
1
- import { type ParseResult } from "effect";
2
- declare const WebhookError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
3
- readonly _tag: "WebhookError";
4
- } & Readonly<A>;
5
- /**
6
- * Base error class for all webhook-related errors
7
- */
8
- export declare class WebhookError extends WebhookError_base<{
9
- message: string;
10
- cause?: unknown;
11
- }> {
12
- }
13
- /**
14
- * Structured validation issue with path and constraint details
15
- */
16
- export interface ValidationIssue {
17
- /** JSONPath-style path to the invalid field, e.g. "$.embeds[0].fields[2].name" */
18
- readonly path: string;
19
- /** Human-readable error message */
20
- readonly message: string;
21
- /** Constraint name, e.g. "MaxLength", "MinItems", "Required" */
22
- readonly constraint?: string;
23
- /** Expected value or constraint description */
24
- readonly expected?: string;
25
- /** Actual value (truncated for large values) */
26
- readonly actual?: unknown;
27
- }
28
- /**
29
- * Convert Effect Schema ParseError to ValidationIssue array
30
- */
31
- export declare const parseErrorToIssues: (error: ParseResult.ParseError) => ValidationIssue[];
32
- /**
33
- * Create a single ValidationIssue from simple field validation
34
- */
35
- export declare const makeIssue: (field: string, message: string, options?: {
36
- constraint?: string;
37
- expected?: string;
38
- actual?: unknown;
39
- }) => ValidationIssue;
40
- declare const ValidationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
41
- readonly _tag: "ValidationError";
42
- } & Readonly<A>;
43
- /**
44
- * Validation errors for webhook data with structured issues
45
- */
46
- export declare class ValidationError extends ValidationError_base<{
47
- /** Human-readable summary message */
48
- message: string;
49
- /** Structured validation issues */
50
- issues: ReadonlyArray<ValidationIssue>;
51
- /** Legacy: primary field that failed (for backward compatibility) */
52
- field?: string;
53
- /** Legacy: value that failed validation (for backward compatibility) */
54
- value?: unknown;
55
- }> {
56
- /**
57
- * Format issues as a human-readable string
58
- */
59
- format(options?: {
60
- maxIssues?: number;
61
- }): string;
62
- /**
63
- * Create ValidationError from Effect Schema ParseError
64
- */
65
- static fromParseError(parseError: ParseResult.ParseError, context?: {
66
- field?: string;
67
- value?: unknown;
68
- }): ValidationError;
69
- /**
70
- * Create ValidationError from a single issue
71
- */
72
- static fromIssue(field: string, message: string, options?: {
73
- constraint?: string;
74
- expected?: string;
75
- actual?: unknown;
76
- }): ValidationError;
77
- }
78
- declare const NetworkError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
79
- readonly _tag: "NetworkError";
80
- } & Readonly<A>;
81
- /**
82
- * Network-related errors
83
- */
84
- export declare class NetworkError extends NetworkError_base<{
85
- message: string;
86
- statusCode?: number;
87
- response?: unknown;
88
- }> {
89
- }
90
- declare const RateLimitError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
91
- readonly _tag: "RateLimitError";
92
- } & Readonly<A>;
93
- /**
94
- * Rate limit errors
95
- */
96
- export declare class RateLimitError extends RateLimitError_base<{
97
- message: string;
98
- retryAfter: number;
99
- limit?: number;
100
- remaining?: number;
101
- reset?: Date;
102
- }> {
103
- }
104
- declare const ConfigError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
105
- readonly _tag: "ConfigError";
106
- } & Readonly<A>;
107
- /**
108
- * Configuration errors
109
- */
110
- export declare class ConfigError extends ConfigError_base<{
111
- message: string;
112
- parameter: string;
113
- }> {
114
- }
115
- declare const FileError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
116
- readonly _tag: "FileError";
117
- } & Readonly<A>;
118
- /**
119
- * File-related errors
120
- */
121
- export declare class FileError extends FileError_base<{
122
- message: string;
123
- filename?: string;
124
- size?: number;
125
- maxSize?: number;
126
- }> {
127
- }
128
- /**
129
- * HTTP response error details
130
- */
131
- export interface HttpErrorResponse {
132
- status: number;
133
- statusText: string;
134
- headers: Record<string, string>;
135
- body?: unknown;
136
- }
137
- declare const HttpError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
138
- readonly _tag: "HttpError";
139
- } & Readonly<A>;
140
- /**
141
- * HTTP errors with detailed response information
142
- */
143
- export declare class HttpError extends HttpError_base<{
144
- message: string;
145
- request: {
146
- method: string;
147
- url: string;
148
- };
149
- response?: HttpErrorResponse;
150
- }> {
151
- }
152
- /**
153
- * All possible webhook errors
154
- */
155
- export type WebhookErrors = WebhookError | ValidationError | NetworkError | RateLimitError | ConfigError | FileError | HttpError;
156
- export {};
@@ -1 +0,0 @@
1
- export * from "./WebhookError";
package/dist/index.d.ts DELETED
@@ -1,85 +0,0 @@
1
- /**
2
- * ez-hook-effect - Discord webhook library built with Effect
3
- *
4
- * Type-safe, composable, and resilient Discord webhook client.
5
- *
6
- * @example
7
- * ```ts
8
- * import { Webhook, Embed, sendWebhook, WebhookServiceLive, makeConfigLayer, HttpClientLive } from "ez-hook-effect";
9
- * import { Effect, Layer, pipe } from "effect";
10
- *
11
- * const webhook = pipe(
12
- * Webhook.make,
13
- * Webhook.setContent("Hello from Effect!"),
14
- * Webhook.build
15
- * );
16
- *
17
- * const layer = WebhookServiceLive.pipe(
18
- * Layer.provide(makeConfigLayer("https://discord.com/api/webhooks/...")),
19
- * Layer.provide(HttpClientLive)
20
- * );
21
- *
22
- * Effect.gen(function* () {
23
- * const msg = yield* webhook;
24
- * yield* sendWebhook(msg);
25
- * }).pipe(Effect.provide(layer), Effect.runPromise);
26
- * ```
27
- *
28
- * @packageDocumentation
29
- */
30
- /** Error types for handling webhook failures */
31
- export { ConfigError, FileError, HttpError, type HttpErrorResponse, makeIssue, NetworkError, parseErrorToIssues, RateLimitError, ValidationError, type ValidationIssue, WebhookError, type WebhookErrors, } from "./errors";
32
- /**
33
- * Configuration service and layers.
34
- * Use makeConfigLayer for programmatic config or ConfigFromEnv for environment variables.
35
- */
36
- export { Config, ConfigFromEnv, makeConfig, makeConfigLayer, parseWebhookUrl, type WebhookConfig, } from "./layers/Config";
37
- /**
38
- * HTTP client service and layers.
39
- * Provides fetch-based HTTP client with retry and rate limit support.
40
- */
41
- export { createRetrySchedule, defaultRetryConfig, FetchHttpClient, HttpClient, HttpClientLive, type HttpRequest, type HttpResponse, makeHttpClientLayer, parseRateLimitHeaders, type RateLimitInfo, type RetryConfig, } from "./layers/HttpClient";
42
- /**
43
- * Embed builder namespace.
44
- * Pipe-first API for building Discord embed objects.
45
- *
46
- * @example
47
- * ```ts
48
- * import { Embed } from "ez-hook-effect";
49
- * import { pipe } from "effect";
50
- *
51
- * const embed = pipe(
52
- * Embed.make,
53
- * Embed.setTitle("Hello"),
54
- * Embed.setDescription("World"),
55
- * Embed.setColor("#5865F2"),
56
- * Embed.build
57
- * );
58
- * ```
59
- */
60
- export * as Embed from "./pipes/Embed";
61
- /**
62
- * Webhook builder namespace.
63
- * Pipe-first API for building Discord webhook payloads.
64
- *
65
- * @example
66
- * ```ts
67
- * import { Webhook } from "ez-hook-effect";
68
- * import { pipe } from "effect";
69
- *
70
- * const webhook = pipe(
71
- * Webhook.make,
72
- * Webhook.setUsername("Bot"),
73
- * Webhook.setContent("Hello!"),
74
- * Webhook.build
75
- * );
76
- * ```
77
- */
78
- export * as Webhook from "./pipes/Webhook";
79
- /** Schema types for Discord webhook payloads */
80
- export * from "./schemas";
81
- /**
82
- * Webhook service and module-level accessors.
83
- * Use these with Effect.flatMap or Effect.gen for sending webhooks.
84
- */
85
- export { deleteWebhook, getWebhook, makeWebhookService, modifyWebhook, sendWebhook, validateWebhook, WebhookService, WebhookServiceLive, } from "./services/WebhookService";
@@ -1,48 +0,0 @@
1
- import { Context, Effect, Layer } from "effect";
2
- import { ConfigError } from "../errors";
3
- /**
4
- * Webhook configuration
5
- */
6
- export interface WebhookConfig {
7
- readonly webhookUrl: string;
8
- readonly maxRetries?: number;
9
- readonly baseDelayMs?: number;
10
- readonly maxDelayMs?: number;
11
- readonly enableJitter?: boolean;
12
- }
13
- declare const Config_base: Context.TagClass<Config, "Config", {
14
- readonly webhook: WebhookConfig;
15
- }>;
16
- /**
17
- * Config service tag
18
- */
19
- export declare class Config extends Config_base {
20
- }
21
- /**
22
- * Create configuration from webhook URL
23
- */
24
- export declare const makeConfig: (webhookUrl: string, options?: Partial<WebhookConfig>) => Effect.Effect<{
25
- webhook: {
26
- webhookUrl: string;
27
- maxRetries: number;
28
- baseDelayMs: number;
29
- maxDelayMs: number;
30
- enableJitter: boolean;
31
- };
32
- }, ConfigError, never>;
33
- /**
34
- * Configuration layer from webhook URL
35
- */
36
- export declare const makeConfigLayer: (webhookUrl: string, options?: Partial<WebhookConfig>) => Layer.Layer<Config, ConfigError, never>;
37
- /**
38
- * Configuration layer from environment variables
39
- */
40
- export declare const ConfigFromEnv: Layer.Layer<Config, ConfigError | import("effect/ConfigError").ConfigError, never>;
41
- /**
42
- * Extract webhook ID and token from URL
43
- */
44
- export declare const parseWebhookUrl: (url: string) => Effect.Effect<{
45
- id: string;
46
- token: string;
47
- }, ConfigError>;
48
- export {};
@@ -1,80 +0,0 @@
1
- import { Context, Duration, Effect, Layer, Schedule } from "effect";
2
- import { HttpError, NetworkError, RateLimitError } from "../errors";
3
- /**
4
- * HTTP request configuration
5
- */
6
- export interface HttpRequest {
7
- method: "GET" | "POST" | "PATCH" | "DELETE";
8
- url: string;
9
- headers?: Record<string, string>;
10
- body?: unknown;
11
- timeout?: Duration.Duration;
12
- }
13
- /**
14
- * HTTP response
15
- */
16
- export interface HttpResponse {
17
- status: number;
18
- statusText: string;
19
- headers: Record<string, string>;
20
- body: unknown;
21
- text: string;
22
- }
23
- /**
24
- * Retry configuration for HTTP requests
25
- */
26
- export interface RetryConfig {
27
- maxRetries: number;
28
- baseDelay: Duration.Duration;
29
- maxDelay: Duration.Duration;
30
- jitter: boolean;
31
- }
32
- declare const HttpClient_base: Context.TagClass<HttpClient, "HttpClient", {
33
- readonly request: (request: HttpRequest) => Effect.Effect<HttpResponse, HttpError | NetworkError | RateLimitError>;
34
- readonly retryConfig: RetryConfig;
35
- }>;
36
- /**
37
- * HTTP Client service tag
38
- */
39
- export declare class HttpClient extends HttpClient_base {
40
- }
41
- /**
42
- * Parse rate limit headers from Discord API response
43
- */
44
- export interface RateLimitInfo {
45
- /** Retry after in milliseconds */
46
- retryAfter: number;
47
- /** Total rate limit for this endpoint */
48
- limit?: number;
49
- /** Remaining requests before rate limit */
50
- remaining?: number;
51
- /** When the rate limit resets */
52
- reset?: Date;
53
- /** Whether this is a global rate limit */
54
- global?: boolean;
55
- }
56
- /**
57
- * Parse rate limit information from response headers
58
- */
59
- export declare const parseRateLimitHeaders: (headers: Record<string, string>) => RateLimitInfo | null;
60
- /**
61
- * Default retry configuration
62
- */
63
- export declare const defaultRetryConfig: RetryConfig;
64
- /**
65
- * Create retry schedule based on configuration
66
- */
67
- export declare const createRetrySchedule: (config: RetryConfig) => Schedule.Schedule<Duration.Duration, unknown, never>;
68
- /**
69
- * Fetch-based HTTP client implementation
70
- */
71
- export declare const FetchHttpClient: (retryConfig?: RetryConfig) => Context.Tag.Service<typeof HttpClient>;
72
- /**
73
- * Live HTTP client layer with default configuration
74
- */
75
- export declare const HttpClientLive: Layer.Layer<HttpClient, never, never>;
76
- /**
77
- * HTTP client layer with custom retry configuration
78
- */
79
- export declare const makeHttpClientLayer: (retryConfig: Partial<RetryConfig>) => Layer.Layer<HttpClient, never, never>;
80
- export {};
@@ -1,2 +0,0 @@
1
- export * from "./Config";
2
- export * from "./HttpClient";
@@ -1,51 +0,0 @@
1
- import { Effect, Schema } from "effect";
2
- import { ValidationError } from "../errors";
3
- import { Author, Embed as EmbedSchema, Field, Footer, Image, Provider, Thumbnail, Video } from "../schemas";
4
- type EmbedDraft = Partial<Schema.Schema.Type<typeof EmbedSchema>>;
5
- export declare const addFieldImpl: (fieldOrName: Field | string, value?: string, inline?: boolean) => (d: EmbedDraft) => Effect.Effect<{
6
- fields: Field[];
7
- url?: string;
8
- title?: string;
9
- description?: string;
10
- type?: "rich";
11
- timestamp?: string;
12
- color?: number;
13
- footer?: Footer;
14
- image?: Image;
15
- thumbnail?: Thumbnail;
16
- video?: Video;
17
- provider?: Provider;
18
- author?: Author;
19
- }, ValidationError, never>;
20
- export declare const buildDirect: (d: EmbedDraft) => Effect.Effect<EmbedSchema, ValidationError, never>;
21
- export declare const addFieldDirect: (fieldOrName: Field | string, value?: string, inline?: boolean) => (d: EmbedDraft) => Effect.Effect<{
22
- fields: Field[];
23
- url?: string;
24
- title?: string;
25
- description?: string;
26
- type?: "rich";
27
- timestamp?: string;
28
- color?: number;
29
- footer?: Footer;
30
- image?: Image;
31
- thumbnail?: Thumbnail;
32
- video?: Video;
33
- provider?: Provider;
34
- author?: Author;
35
- }, ValidationError, never>;
36
- export declare const make: Effect.Effect<EmbedDraft, never>;
37
- export declare const setTitle: (title: string) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
38
- export declare const setURL: (url: string) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
39
- export declare const setDescription: (description: string) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
40
- export declare const setTimestamp: (date?: Date) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
41
- export declare const setColor: (color: number | string) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
42
- export declare const setFooter: (footer: Footer | string, icon_url?: string, proxy_icon_url?: string) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
43
- export declare const setImage: (image: Image | string, height?: number, width?: number) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
44
- export declare const setThumbnail: (thumbnail: Thumbnail | string, height?: number, width?: number) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
45
- export declare const setVideo: (video: Video | string, height?: number, width?: number) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
46
- export declare const setProvider: (provider: Provider | string, url?: string) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
47
- export declare const setAuthor: (author: Author | string, url?: string, icon_url?: string) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
48
- export declare const addField: (field: Field | string, value?: string, inline?: boolean) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
49
- export declare const setFields: (fields: ReadonlyArray<Field>) => (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<Partial<EmbedSchema>, ValidationError, never>;
50
- export declare const build: (self: Effect.Effect<EmbedDraft, ValidationError>) => Effect.Effect<EmbedSchema, ValidationError, never>;
51
- export {};
@@ -1,37 +0,0 @@
1
- import { Effect, Schema } from "effect";
2
- import { ValidationError } from "../errors";
3
- import { type Embed as EmbedSchema, type WebhookFile, WebhookParameter, Webhook as WebhookSchema } from "../schemas";
4
- type WebhookDraft = Partial<Schema.Schema.Type<typeof WebhookSchema>>;
5
- export declare const addEmbedImpl: (embed: Schema.Schema.Type<typeof EmbedSchema>) => (d: WebhookDraft) => Effect.Effect<{
6
- embeds: EmbedSchema[];
7
- username?: string;
8
- avatar_url?: string;
9
- tts?: boolean;
10
- content?: string;
11
- file?: string | import("..").Attachment | {
12
- readonly name: string;
13
- readonly data: string | Uint8Array<ArrayBuffer>;
14
- };
15
- }, ValidationError, never>;
16
- export declare const buildDirect: (d: WebhookDraft) => Effect.Effect<WebhookSchema, ValidationError, never>;
17
- export declare const addEmbedDirect: (embed: Schema.Schema.Type<typeof EmbedSchema>) => (d: WebhookDraft) => Effect.Effect<{
18
- embeds: EmbedSchema[];
19
- username?: string;
20
- avatar_url?: string;
21
- tts?: boolean;
22
- content?: string;
23
- file?: string | import("..").Attachment | {
24
- readonly name: string;
25
- readonly data: string | Uint8Array<ArrayBuffer>;
26
- };
27
- }, ValidationError, never>;
28
- export declare const modifyParams: (p: Schema.Schema.Type<typeof WebhookParameter>) => Effect.Effect<WebhookParameter, ValidationError, never>;
29
- export declare const make: Effect.Effect<WebhookDraft, never>;
30
- export declare const setUsername: (username: string) => (self: Effect.Effect<WebhookDraft, ValidationError>) => Effect.Effect<Partial<WebhookSchema>, ValidationError, never>;
31
- export declare const setAvatarUrl: (url: string) => (self: Effect.Effect<WebhookDraft, ValidationError>) => Effect.Effect<Partial<WebhookSchema>, ValidationError, never>;
32
- export declare const setContent: (content: string) => (self: Effect.Effect<WebhookDraft, ValidationError>) => Effect.Effect<Partial<WebhookSchema>, ValidationError, never>;
33
- export declare const setTTS: (tts: boolean) => (self: Effect.Effect<WebhookDraft, ValidationError>) => Effect.Effect<Partial<WebhookSchema>, ValidationError, never>;
34
- export declare const addEmbed: (embed: Schema.Schema.Type<typeof EmbedSchema>) => (self: Effect.Effect<WebhookDraft, ValidationError>) => Effect.Effect<Partial<WebhookSchema>, ValidationError, never>;
35
- export declare const setFile: (file: Schema.Schema.Type<typeof WebhookFile>) => (self: Effect.Effect<WebhookDraft, ValidationError>) => Effect.Effect<Partial<WebhookSchema>, ValidationError, never>;
36
- export declare const build: (self: Effect.Effect<WebhookDraft, ValidationError>) => Effect.Effect<WebhookSchema, ValidationError, never>;
37
- export {};
@@ -1,2 +0,0 @@
1
- export * as Embed from "./Embed";
2
- export * as Webhook from "./Webhook";
@@ -1,10 +0,0 @@
1
- import { Schema } from "effect";
2
- /**
3
- * Common schema definitions and constraints
4
- */
5
- export declare const maxLength: (max: number) => Schema.filter<typeof Schema.String>;
6
- export declare const positiveInt: Schema.filter<Schema.filter<typeof Schema.Number>>;
7
- export declare const UrlString: Schema.refine<string, typeof Schema.String>;
8
- export declare const ISO8601Timestamp: Schema.refine<string, typeof Schema.String>;
9
- export declare const ColorCode: Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>;
10
- export declare const Uint8ArraySchema: Schema.instanceOf<Uint8Array<ArrayBuffer>>;
@@ -1,16 +0,0 @@
1
- import { Schema } from "effect";
2
- /**
3
- * Discord webhook URL regex
4
- * Matches:
5
- * - https://discord.com/api/webhooks/ID/TOKEN
6
- * - Optional canary/ptb subdomains
7
- * - Optional /v{number} API version segment
8
- * - Optional trailing slash
9
- * - Supports legacy discordapp.com domain
10
- * Exposes named capture groups `id` and `token` for callers that need them.
11
- */
12
- export declare const DISCORD_WEBHOOK_REGEX: RegExp;
13
- /**
14
- * Effect Schema for validating Discord webhook URLs.
15
- */
16
- export declare const DiscordWebhookUrl: Schema.filter<typeof Schema.String>;