@teever/ez-hook-effect 0.5.0 → 0.5.1

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.
Files changed (56) hide show
  1. package/dist/errors/WebhookError.d.ts +295 -0
  2. package/dist/errors/WebhookError.js +322 -0
  3. package/dist/errors/WebhookError.js.map +1 -0
  4. package/dist/errors/index.d.ts +1 -0
  5. package/dist/errors/index.js +2 -0
  6. package/dist/errors/index.js.map +1 -0
  7. package/dist/index.d.ts +89 -0
  8. package/dist/layers/Config.d.ts +48 -0
  9. package/dist/layers/Config.js +166 -0
  10. package/dist/layers/Config.js.map +1 -0
  11. package/dist/layers/Default.d.ts +6 -0
  12. package/dist/layers/Default.js +9 -0
  13. package/dist/layers/Default.js.map +1 -0
  14. package/dist/layers/HttpClient.d.ts +84 -0
  15. package/dist/layers/HttpClient.js +209 -0
  16. package/dist/layers/HttpClient.js.map +1 -0
  17. package/dist/layers/index.d.ts +2 -0
  18. package/dist/layers/index.js +3 -0
  19. package/dist/layers/index.js.map +1 -0
  20. package/dist/pipes/Embed.d.ts +51 -0
  21. package/dist/pipes/Embed.js +198 -0
  22. package/dist/pipes/Embed.js.map +1 -0
  23. package/dist/pipes/Webhook.d.ts +38 -0
  24. package/dist/pipes/Webhook.js +46 -0
  25. package/dist/pipes/Webhook.js.map +1 -0
  26. package/dist/pipes/index.d.ts +2 -0
  27. package/dist/pipes/index.js +3 -0
  28. package/dist/pipes/index.js.map +1 -0
  29. package/dist/schemas/Common.d.ts +10 -0
  30. package/dist/schemas/Common.js +30 -0
  31. package/dist/schemas/Common.js.map +1 -0
  32. package/dist/schemas/Discord.d.ts +16 -0
  33. package/dist/schemas/Discord.js +19 -0
  34. package/dist/schemas/Discord.js.map +1 -0
  35. package/dist/schemas/Embed.d.ts +143 -0
  36. package/dist/schemas/Embed.js +139 -0
  37. package/dist/schemas/Embed.js.map +1 -0
  38. package/dist/schemas/Field.d.ts +24 -0
  39. package/dist/schemas/Field.js +25 -0
  40. package/dist/schemas/Field.js.map +1 -0
  41. package/dist/schemas/Webhook.d.ts +88 -0
  42. package/dist/schemas/Webhook.js +87 -0
  43. package/dist/schemas/Webhook.js.map +1 -0
  44. package/dist/schemas/index.d.ts +5 -0
  45. package/dist/schemas/index.js +6 -0
  46. package/dist/schemas/index.js.map +1 -0
  47. package/dist/services/WebhookService.d.ts +94 -0
  48. package/dist/services/WebhookService.js +116 -0
  49. package/dist/services/WebhookService.js.map +1 -0
  50. package/dist/services/index.d.ts +1 -0
  51. package/dist/services/index.js +2 -0
  52. package/dist/services/index.js.map +1 -0
  53. package/dist/utils/normalize.d.ts +1 -0
  54. package/dist/utils/normalize.js +17 -0
  55. package/dist/utils/normalize.js.map +1 -0
  56. package/package.json +3 -2
@@ -0,0 +1,139 @@
1
+ import { Schema } from "effect";
2
+ import { ColorCode, ISO8601Timestamp, maxLength, positiveInt, UrlString, } from "./Common";
3
+ import { FieldArray } from "./Field";
4
+ /**
5
+ * Attachment schema - represents file attachments or URLs
6
+ */
7
+ export class Attachment extends Schema.Class("Attachment")({
8
+ url: Schema.String,
9
+ proxyUrl: Schema.optionalKey(Schema.String),
10
+ filename: Schema.optionalKey(Schema.String),
11
+ size: Schema.optionalKey(positiveInt),
12
+ height: Schema.optionalKey(positiveInt),
13
+ width: Schema.optionalKey(positiveInt),
14
+ }) {
15
+ }
16
+ // Union type for URL or Attachment
17
+ export const UrlOrAttachment = Schema.Union([UrlString, Attachment]);
18
+ /**
19
+ * Author information schema
20
+ */
21
+ export class Author extends Schema.Class("Author")({
22
+ name: Schema.optionalKey(maxLength(256)),
23
+ url: Schema.optionalKey(UrlString),
24
+ icon_url: Schema.optionalKey(UrlOrAttachment),
25
+ proxy_icon_url: Schema.optionalKey(Schema.String),
26
+ }) {
27
+ }
28
+ /**
29
+ * Footer information schema
30
+ */
31
+ export class Footer extends Schema.Class("Footer")({
32
+ text: maxLength(2048),
33
+ icon_url: Schema.optionalKey(UrlOrAttachment),
34
+ proxy_icon_url: Schema.optionalKey(Schema.String),
35
+ }) {
36
+ }
37
+ /**
38
+ * Image information schema
39
+ */
40
+ export class Image extends Schema.Class("Image")({
41
+ url: UrlOrAttachment,
42
+ proxy_url: Schema.optionalKey(Schema.String),
43
+ height: Schema.optionalKey(positiveInt),
44
+ width: Schema.optionalKey(positiveInt),
45
+ }) {
46
+ }
47
+ /**
48
+ * Thumbnail information schema
49
+ */
50
+ export class Thumbnail extends Schema.Class("Thumbnail")({
51
+ url: UrlOrAttachment,
52
+ proxy_url: Schema.optionalKey(Schema.String),
53
+ height: Schema.optionalKey(positiveInt),
54
+ width: Schema.optionalKey(positiveInt),
55
+ }) {
56
+ }
57
+ /**
58
+ * Video information schema
59
+ */
60
+ export class Video extends Schema.Class("Video")({
61
+ url: Schema.optionalKey(UrlString),
62
+ proxy_url: Schema.optionalKey(Schema.String),
63
+ height: Schema.optionalKey(positiveInt),
64
+ width: Schema.optionalKey(positiveInt),
65
+ }) {
66
+ }
67
+ /**
68
+ * Provider information schema
69
+ */
70
+ export class Provider extends Schema.Class("Provider")({
71
+ name: Schema.optionalKey(Schema.String),
72
+ url: Schema.optionalKey(UrlString),
73
+ }) {
74
+ }
75
+ /**
76
+ * Main Embed schema
77
+ */
78
+ export class Embed extends Schema.Class("Embed")({
79
+ /**
80
+ * Title of the embed.
81
+ * Up to 256 characters.
82
+ */
83
+ title: Schema.optionalKey(maxLength(256)),
84
+ /**
85
+ * Embed type.
86
+ * (Always "rich" for webhook embeds)
87
+ */
88
+ type: Schema.optionalKey(Schema.Literal("rich")),
89
+ /**
90
+ * URL of embed.
91
+ */
92
+ url: Schema.optionalKey(UrlString),
93
+ /**
94
+ * Description of the embed.
95
+ * Up to 4096 characters.
96
+ */
97
+ description: Schema.optionalKey(maxLength(4096)),
98
+ /**
99
+ * ISO8601 timestamp of the embed content.
100
+ */
101
+ timestamp: Schema.optionalKey(ISO8601Timestamp),
102
+ /**
103
+ * Color code of the embed.
104
+ */
105
+ color: Schema.optionalKey(ColorCode),
106
+ /**
107
+ * Footer information.
108
+ */
109
+ footer: Schema.optionalKey(Footer),
110
+ /**
111
+ * Image information.
112
+ */
113
+ image: Schema.optionalKey(Image),
114
+ /**
115
+ * Thumbnail information.
116
+ */
117
+ thumbnail: Schema.optionalKey(Thumbnail),
118
+ /**
119
+ * Video information.
120
+ */
121
+ video: Schema.optionalKey(Video),
122
+ /**
123
+ * Provider information.
124
+ */
125
+ provider: Schema.optionalKey(Provider),
126
+ /**
127
+ * Author information.
128
+ */
129
+ author: Schema.optionalKey(Author),
130
+ /**
131
+ * Fields information.
132
+ * Up to 25 fields.
133
+ */
134
+ fields: Schema.optionalKey(FieldArray),
135
+ }) {
136
+ }
137
+ // Array of embeds with max 10 constraint
138
+ export const EmbedArray = Schema.Array(Embed).pipe(Schema.check(Schema.isMaxLength(10)));
139
+ //# sourceMappingURL=Embed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Embed.js","sourceRoot":"","sources":["../../src/schemas/Embed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EACN,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,SAAS,GACT,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC,KAAK,CAAa,YAAY,CAAC,CAAC;IACtE,GAAG,EAAE,MAAM,CAAC,MAAM;IAClB,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC,WAAW,C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AE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC;IAEpC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;IAElC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC;IAEhC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC;IAExC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;IAEtC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;IAElC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;CACtC,CAAC;CAAG;AAEL,yCAAyC;AACzC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CACjD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CACpC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Schema } from "effect";
2
+ declare const Field_base: Schema.ExtendableClass<Field, Schema.Struct<{
3
+ /**
4
+ * Name of the field.
5
+ * Up to 256 characters.
6
+ */
7
+ readonly name: Schema.String;
8
+ /**
9
+ * Value of the field.
10
+ * Up to 1024 characters.
11
+ */
12
+ readonly value: Schema.String;
13
+ /**
14
+ * Whether or not this field should be displayed inline.
15
+ */
16
+ readonly inline: Schema.optionalKey<Schema.Boolean>;
17
+ }>, {}>;
18
+ /**
19
+ * Discord embed field schema
20
+ */
21
+ export declare class Field extends Field_base {
22
+ }
23
+ export declare const FieldArray: Schema.$Array<typeof Field>;
24
+ export {};
@@ -0,0 +1,25 @@
1
+ import { Schema } from "effect";
2
+ import { maxLength } from "./Common";
3
+ /**
4
+ * Discord embed field schema
5
+ */
6
+ export class Field extends Schema.Class("Field")({
7
+ /**
8
+ * Name of the field.
9
+ * Up to 256 characters.
10
+ */
11
+ name: maxLength(256),
12
+ /**
13
+ * Value of the field.
14
+ * Up to 1024 characters.
15
+ */
16
+ value: maxLength(1024),
17
+ /**
18
+ * Whether or not this field should be displayed inline.
19
+ */
20
+ inline: Schema.optionalKey(Schema.Boolean),
21
+ }) {
22
+ }
23
+ // Array of fields with max 25 constraint
24
+ export const FieldArray = Schema.Array(Field).pipe(Schema.check(Schema.isMaxLength(25)));
25
+ //# sourceMappingURL=Field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Field.js","sourceRoot":"","sources":["../../src/schemas/Field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,MAAM,CAAC,KAAK,CAAQ,OAAO,CAAC,CAAC;IACvD;;;OAGG;IACH,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC;IAEpB;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC;IAEtB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC;CAC1C,CAAC;CAAG;AAEL,yCAAyC;AACzC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CACjD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CACpC,CAAC"}
@@ -0,0 +1,88 @@
1
+ import { Schema } from "effect";
2
+ import { Attachment } from "./Embed";
3
+ /**
4
+ * File attachment for webhooks
5
+ */
6
+ export declare const WebhookFile: Schema.Union<readonly [Schema.String, typeof Attachment, Schema.Struct<{
7
+ readonly name: Schema.String;
8
+ readonly data: Schema.Union<readonly [Schema.String, Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
9
+ }>]>;
10
+ declare const Webhook_base: Schema.ExtendableClass<Webhook, Schema.Struct<{
11
+ /**
12
+ * Webhook username override.
13
+ */
14
+ readonly username: Schema.optionalKey<Schema.String>;
15
+ /**
16
+ * Webhook avatar URL override.
17
+ */
18
+ readonly avatar_url: Schema.optionalKey<Schema.String>;
19
+ /**
20
+ * Whether or not this notification should be read as text to speech.
21
+ */
22
+ readonly tts: Schema.optionalKey<Schema.Boolean>;
23
+ /**
24
+ * Message contents.
25
+ * Max 2000 characters
26
+ */
27
+ readonly content: Schema.optionalKey<Schema.String>;
28
+ /**
29
+ * Contents of a file being sent.
30
+ */
31
+ readonly file: Schema.optionalKey<Schema.Union<readonly [Schema.String, typeof Attachment, Schema.Struct<{
32
+ readonly name: Schema.String;
33
+ readonly data: Schema.Union<readonly [Schema.String, Schema.instanceOf<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
34
+ }>]>>;
35
+ /**
36
+ * Embedded "rich" content.
37
+ * Max 10 embeds
38
+ */
39
+ readonly embeds: Schema.optionalKey<Schema.$Array<typeof import("./Embed").Embed>>;
40
+ }>, {}>;
41
+ /**
42
+ * Main Webhook schema
43
+ */
44
+ export declare class Webhook extends Webhook_base {
45
+ }
46
+ declare const WebhookParameter_base: Schema.ExtendableClass<WebhookParameter, Schema.Struct<{
47
+ readonly name: Schema.optionalKey<Schema.String>;
48
+ readonly avatar: Schema.optionalKey<Schema.String>;
49
+ readonly channel_id: Schema.optionalKey<Schema.String>;
50
+ }>, {}>;
51
+ /**
52
+ * Webhook parameter schema (for modify operations)
53
+ */
54
+ export declare class WebhookParameter extends WebhookParameter_base {
55
+ }
56
+ declare const WebhookResponse_base: Schema.ExtendableClass<WebhookResponse, Schema.Struct<{
57
+ readonly id: Schema.String;
58
+ readonly type: Schema.Number;
59
+ readonly guild_id: Schema.optionalKey<Schema.String>;
60
+ readonly channel_id: Schema.String;
61
+ readonly user: Schema.optionalKey<Schema.Struct<{
62
+ readonly id: Schema.String;
63
+ readonly username: Schema.String;
64
+ readonly avatar: Schema.optionalKey<Schema.String>;
65
+ readonly discriminator: Schema.String;
66
+ readonly public_flags: Schema.optionalKey<Schema.Number>;
67
+ }>>;
68
+ readonly name: Schema.optionalKey<Schema.String>;
69
+ readonly avatar: Schema.optionalKey<Schema.String>;
70
+ readonly token: Schema.optionalKey<Schema.String>;
71
+ readonly application_id: Schema.optionalKey<Schema.String>;
72
+ readonly source_guild: Schema.optionalKey<Schema.Struct<{
73
+ readonly id: Schema.String;
74
+ readonly name: Schema.String;
75
+ readonly icon: Schema.optionalKey<Schema.String>;
76
+ }>>;
77
+ readonly source_channel: Schema.optionalKey<Schema.Struct<{
78
+ readonly id: Schema.String;
79
+ readonly name: Schema.String;
80
+ }>>;
81
+ readonly url: Schema.optionalKey<Schema.String>;
82
+ }>, {}>;
83
+ /**
84
+ * Webhook response schema
85
+ */
86
+ export declare class WebhookResponse extends WebhookResponse_base {
87
+ }
88
+ export {};
@@ -0,0 +1,87 @@
1
+ import { Schema } from "effect";
2
+ import { maxLength, Uint8ArraySchema, UrlString } from "./Common";
3
+ import { Attachment, EmbedArray } from "./Embed";
4
+ /**
5
+ * File attachment for webhooks
6
+ */
7
+ export const WebhookFile = Schema.Union([
8
+ Schema.String,
9
+ Attachment,
10
+ Schema.Struct({
11
+ name: Schema.String,
12
+ data: Schema.Union([Schema.String, Uint8ArraySchema]),
13
+ }),
14
+ ]);
15
+ /**
16
+ * Main Webhook schema
17
+ */
18
+ export class Webhook extends Schema.Class("Webhook")({
19
+ /**
20
+ * Webhook username override.
21
+ */
22
+ username: Schema.optionalKey(maxLength(80)),
23
+ /**
24
+ * Webhook avatar URL override.
25
+ */
26
+ avatar_url: Schema.optionalKey(UrlString),
27
+ /**
28
+ * Whether or not this notification should be read as text to speech.
29
+ */
30
+ tts: Schema.optionalKey(Schema.Boolean),
31
+ /**
32
+ * Message contents.
33
+ * Max 2000 characters
34
+ */
35
+ content: Schema.optionalKey(maxLength(2000)),
36
+ /**
37
+ * Contents of a file being sent.
38
+ */
39
+ file: Schema.optionalKey(WebhookFile),
40
+ /**
41
+ * Embedded "rich" content.
42
+ * Max 10 embeds
43
+ */
44
+ embeds: Schema.optionalKey(EmbedArray),
45
+ }) {
46
+ }
47
+ /**
48
+ * Webhook parameter schema (for modify operations)
49
+ */
50
+ export class WebhookParameter extends Schema.Class("WebhookParameter")({
51
+ name: Schema.optionalKey(maxLength(80)),
52
+ avatar: Schema.optionalKey(UrlString),
53
+ channel_id: Schema.optionalKey(Schema.String),
54
+ }) {
55
+ }
56
+ /**
57
+ * Webhook response schema
58
+ */
59
+ export class WebhookResponse extends Schema.Class("WebhookResponse")({
60
+ id: Schema.String,
61
+ type: Schema.Number,
62
+ guild_id: Schema.optionalKey(Schema.String),
63
+ channel_id: Schema.String,
64
+ user: Schema.optionalKey(Schema.Struct({
65
+ id: Schema.String,
66
+ username: Schema.String,
67
+ avatar: Schema.optionalKey(Schema.String),
68
+ discriminator: Schema.String,
69
+ public_flags: Schema.optionalKey(Schema.Number),
70
+ })),
71
+ name: Schema.optionalKey(Schema.String),
72
+ avatar: Schema.optionalKey(Schema.String),
73
+ token: Schema.optionalKey(Schema.String),
74
+ application_id: Schema.optionalKey(Schema.String),
75
+ source_guild: Schema.optionalKey(Schema.Struct({
76
+ id: Schema.String,
77
+ name: Schema.String,
78
+ icon: Schema.optionalKey(Schema.String),
79
+ })),
80
+ source_channel: Schema.optionalKey(Schema.Struct({
81
+ id: Schema.String,
82
+ name: Schema.String,
83
+ })),
84
+ url: Schema.optionalKey(UrlString),
85
+ }) {
86
+ }
87
+ //# sourceMappingURL=Webhook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Webhook.js","sourceRoot":"","sources":["../../src/schemas/Webhook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,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MAAM;KACnB,CAAC,CACF;IACD,GAAG,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC;CAClC,CAAC;CAAG"}
@@ -0,0 +1,5 @@
1
+ export * from "./Common";
2
+ export * from "./Discord";
3
+ export * from "./Embed";
4
+ export * from "./Field";
5
+ export * from "./Webhook";
@@ -0,0 +1,6 @@
1
+ export * from "./Common";
2
+ export * from "./Discord";
3
+ export * from "./Embed";
4
+ export * from "./Field";
5
+ export * from "./Webhook";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,94 @@
1
+ import { Effect, Layer, ServiceMap } from "effect";
2
+ import { HttpError, NetworkError, RateLimitError, ValidationError, WebhookError } from "../errors";
3
+ import { Config } from "../layers/Config";
4
+ import { HttpClient } from "../layers/HttpClient";
5
+ import { Webhook, WebhookParameter, WebhookResponse } from "../schemas";
6
+ declare const WebhookService_base: ServiceMap.ServiceClass<WebhookService, "WebhookService", {
7
+ /**
8
+ * Send a webhook message
9
+ */
10
+ readonly sendWebhook: (webhook: Webhook) => Effect.Effect<void, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError>;
11
+ /**
12
+ * Send a webhook message and return the raw response.
13
+ */
14
+ readonly sendWebhookRaw: (webhook: Webhook) => Effect.Effect<SendWebhookRawResult, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError>;
15
+ /**
16
+ * Modify webhook settings
17
+ */
18
+ readonly modifyWebhook: (params: WebhookParameter) => Effect.Effect<WebhookResponse, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError>;
19
+ /**
20
+ * Get webhook information
21
+ */
22
+ readonly getWebhook: () => Effect.Effect<WebhookResponse, WebhookError | NetworkError | HttpError | RateLimitError>;
23
+ /**
24
+ * Delete the webhook
25
+ */
26
+ readonly deleteWebhook: () => Effect.Effect<boolean, WebhookError | NetworkError | HttpError | RateLimitError>;
27
+ /**
28
+ * Validate webhook by checking if it exists and is accessible
29
+ */
30
+ readonly validateWebhook: () => Effect.Effect<boolean, never>;
31
+ }>;
32
+ /**
33
+ * Webhook service tag
34
+ */
35
+ export declare class WebhookService extends WebhookService_base {
36
+ }
37
+ export type SendWebhookRawResult = {
38
+ status: number;
39
+ ok: boolean;
40
+ headers: Record<string, string>;
41
+ body: unknown;
42
+ text: string;
43
+ };
44
+ /**
45
+ * Create webhook service implementation
46
+ */
47
+ export declare const makeWebhookService: Effect.Effect<{
48
+ sendWebhook: (webhook: Webhook) => Effect.Effect<void, WebhookError | ValidationError | NetworkError | RateLimitError | HttpError, never>;
49
+ sendWebhookRaw: (webhook: Webhook) => Effect.Effect<{
50
+ status: number;
51
+ ok: boolean;
52
+ headers: Record<string, string>;
53
+ body: unknown;
54
+ text: string;
55
+ }, ValidationError | NetworkError | RateLimitError | HttpError, never>;
56
+ modifyWebhook: (params: WebhookParameter) => Effect.Effect<WebhookResponse, WebhookError | ValidationError | NetworkError | RateLimitError | HttpError, never>;
57
+ getWebhook: () => Effect.Effect<WebhookResponse, WebhookError | NetworkError | RateLimitError | HttpError, never>;
58
+ deleteWebhook: () => Effect.Effect<boolean, NetworkError | RateLimitError | HttpError, never>;
59
+ validateWebhook: () => Effect.Effect<boolean, never, never>;
60
+ }, never, Config | HttpClient>;
61
+ /**
62
+ * Live webhook service layer
63
+ */
64
+ export declare const WebhookServiceLive: Layer.Layer<WebhookService, never, Config | HttpClient>;
65
+ /**
66
+ * Send a webhook message
67
+ * Module-level accessor that reads from context
68
+ */
69
+ export declare const sendWebhook: (webhook: Webhook) => Effect.Effect<void, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError, WebhookService>;
70
+ /**
71
+ * Send a webhook message and return the raw response.
72
+ */
73
+ export declare const sendWebhookRaw: (webhook: Webhook) => Effect.Effect<SendWebhookRawResult, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError, WebhookService>;
74
+ /**
75
+ * Modify webhook settings
76
+ * Module-level accessor that reads from context
77
+ */
78
+ export declare const modifyWebhook: (params: WebhookParameter) => Effect.Effect<WebhookResponse, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError, WebhookService>;
79
+ /**
80
+ * Get webhook information
81
+ * Module-level accessor that reads from context
82
+ */
83
+ export declare const getWebhook: () => Effect.Effect<WebhookResponse, WebhookError | NetworkError | HttpError | RateLimitError, WebhookService>;
84
+ /**
85
+ * Delete the webhook
86
+ * Module-level accessor that reads from context
87
+ */
88
+ export declare const deleteWebhook: () => Effect.Effect<boolean, WebhookError | NetworkError | HttpError | RateLimitError, WebhookService>;
89
+ /**
90
+ * Validate webhook by checking if it exists and is accessible
91
+ * Module-level accessor that reads from context
92
+ */
93
+ export declare const validateWebhook: () => Effect.Effect<boolean, never, WebhookService>;
94
+ export {};
@@ -0,0 +1,116 @@
1
+ import { Duration, Effect, Layer, pipe, Schedule, Schema, ServiceMap, } from "effect";
2
+ import { HttpError, NetworkError, RateLimitError, ValidationError, WebhookError, } from "../errors";
3
+ import { Config } from "../layers/Config";
4
+ import { createRetrySchedule, HttpClient } from "../layers/HttpClient";
5
+ import { Webhook, WebhookParameter, WebhookResponse } from "../schemas";
6
+ import { stripUndefined } from "../utils/normalize";
7
+ /**
8
+ * Webhook service tag
9
+ */
10
+ export class WebhookService extends ServiceMap.Service()("WebhookService") {
11
+ }
12
+ /**
13
+ * Create webhook service implementation
14
+ */
15
+ export const makeWebhookService = Effect.gen(function* () {
16
+ // body unchanged
17
+ const config = yield* Config;
18
+ const httpClient = yield* HttpClient;
19
+ const webhookUrl = config.webhook.webhookUrl;
20
+ // Create retry schedule based on config
21
+ const retrySchedule = createRetrySchedule({
22
+ maxRetries: config.webhook.maxRetries ?? httpClient.retryConfig.maxRetries,
23
+ baseDelay: Duration.millis(config.webhook.baseDelayMs ??
24
+ Duration.toMillis(httpClient.retryConfig.baseDelay)),
25
+ maxDelay: Duration.millis(config.webhook.maxDelayMs ??
26
+ Duration.toMillis(httpClient.retryConfig.maxDelay)),
27
+ jitter: config.webhook.enableJitter ?? httpClient.retryConfig.jitter,
28
+ });
29
+ const sendWebhookRaw = (webhook) => pipe(Schema.decodeUnknownEffect(Webhook)(stripUndefined(webhook)), Effect.mapError((e) => ValidationError.fromParseError(e, { field: "webhook", value: webhook })), Effect.flatMap((validatedWebhook) => httpClient
30
+ .request({
31
+ method: "POST",
32
+ url: webhookUrl,
33
+ body: validatedWebhook,
34
+ })
35
+ .pipe(Effect.retry(Schedule.while(retrySchedule, (meta) => Effect.succeed(meta.input instanceof NetworkError ||
36
+ meta.input instanceof RateLimitError ||
37
+ (meta.input instanceof HttpError &&
38
+ (meta.input.response?.status ?? 0) >= 500)))))), Effect.map((response) => ({
39
+ status: response.status,
40
+ ok: response.status >= 200 && response.status < 300,
41
+ headers: response.headers,
42
+ body: response.body,
43
+ text: response.text,
44
+ })));
45
+ const sendWebhook = (webhook) => pipe(sendWebhookRaw(webhook), Effect.flatMap((response) => response.status === 204 && response.text === ""
46
+ ? Effect.void
47
+ : Effect.fail(new WebhookError({
48
+ message: `Unexpected webhook response: ${response.status}`,
49
+ cause: response,
50
+ }))));
51
+ const modifyWebhook = (params) => pipe(Schema.decodeUnknownEffect(WebhookParameter)(stripUndefined(params)), Effect.mapError((e) => ValidationError.fromParseError(e, { field: "params", value: params })), Effect.flatMap((validatedParams) => httpClient.request({
52
+ method: "PATCH",
53
+ url: webhookUrl,
54
+ body: validatedParams,
55
+ })), Effect.flatMap((response) => Schema.decodeUnknownEffect(WebhookResponse)(response.body).pipe(Effect.mapError(() => new WebhookError({
56
+ message: "Invalid webhook response",
57
+ cause: response.body,
58
+ })))));
59
+ const getWebhook = () => pipe(httpClient.request({
60
+ method: "GET",
61
+ url: webhookUrl,
62
+ }), Effect.flatMap((response) => Schema.decodeUnknownEffect(WebhookResponse)(response.body).pipe(Effect.mapError(() => new WebhookError({
63
+ message: "Invalid webhook response",
64
+ cause: response.body,
65
+ })))));
66
+ const validateWebhook = () => pipe(httpClient.request({
67
+ method: "GET",
68
+ url: webhookUrl,
69
+ }), Effect.as(true), Effect.catch(() => Effect.succeed(false)));
70
+ const deleteWebhook = () => pipe(httpClient.request({
71
+ method: "DELETE",
72
+ url: webhookUrl,
73
+ }), Effect.map((response) => response.status === 204));
74
+ return {
75
+ sendWebhook,
76
+ sendWebhookRaw,
77
+ modifyWebhook,
78
+ getWebhook,
79
+ deleteWebhook,
80
+ validateWebhook,
81
+ };
82
+ });
83
+ /**
84
+ * Live webhook service layer
85
+ */
86
+ export const WebhookServiceLive = Layer.effect(WebhookService, makeWebhookService);
87
+ /**
88
+ * Send a webhook message
89
+ * Module-level accessor that reads from context
90
+ */
91
+ export const sendWebhook = (webhook) => WebhookService.use((service) => service.sendWebhook(webhook));
92
+ /**
93
+ * Send a webhook message and return the raw response.
94
+ */
95
+ export const sendWebhookRaw = (webhook) => WebhookService.use((service) => service.sendWebhookRaw(webhook));
96
+ /**
97
+ * Modify webhook settings
98
+ * Module-level accessor that reads from context
99
+ */
100
+ export const modifyWebhook = (params) => WebhookService.use((service) => service.modifyWebhook(params));
101
+ /**
102
+ * Get webhook information
103
+ * Module-level accessor that reads from context
104
+ */
105
+ export const getWebhook = () => WebhookService.use((service) => service.getWebhook());
106
+ /**
107
+ * Delete the webhook
108
+ * Module-level accessor that reads from context
109
+ */
110
+ export const deleteWebhook = () => WebhookService.use((service) => service.deleteWebhook());
111
+ /**
112
+ * Validate webhook by checking if it exists and is accessible
113
+ * Module-level accessor that reads from context
114
+ */
115
+ export const validateWebhook = () => WebhookService.use((service) => service.validateWebhook());
116
+ //# sourceMappingURL=WebhookService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebhookService.js","sourceRoot":"","sources":["../../src/services/WebhookService.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,QAAQ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AM,CAAC,MAAM,WAAW,GAAG,CAC1B,OAAgB,EAKf,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC7B,OAAgB,EAKf,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;AAEtE;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC5B,MAAwB,EAKvB,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAEpE;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAIxB,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAI3B,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAI7B,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./WebhookService";
@@ -0,0 +1,2 @@
1
+ export * from "./WebhookService";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const stripUndefined: (input: unknown) => unknown;
@@ -0,0 +1,17 @@
1
+ export const stripUndefined = (input) => {
2
+ if (Array.isArray(input)) {
3
+ return input.map(stripUndefined);
4
+ }
5
+ if (input && typeof input === "object") {
6
+ const proto = Object.getPrototypeOf(input);
7
+ if (proto !== Object.prototype && proto !== null) {
8
+ return input;
9
+ }
10
+ const entries = Object.entries(input)
11
+ .filter(([, value]) => value !== undefined)
12
+ .map(([key, value]) => [key, stripUndefined(value)]);
13
+ return Object.fromEntries(entries);
14
+ }
15
+ return input;
16
+ };
17
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../src/utils/normalize.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAc,EAAW,EAAE;IACzD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAClD,OAAO,KAAK,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC;aAC9D,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC;aAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,CAAU,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC"}