@interactive-inc/flume 0.4.0 → 0.6.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/README.md +129 -86
- package/dist/discord.d.ts +5 -13
- package/dist/discord.js +46 -107
- package/dist/flume-source-DUvt9aJt.js +341 -0
- package/dist/flume-source-DuUFPhSe.d.ts +228 -0
- package/dist/github.d.ts +4 -12
- package/dist/github.js +24 -84
- package/dist/index.d.ts +26 -38
- package/dist/index.js +92 -18
- package/dist/safe-json-parse-CfJjt-RY.js +11 -0
- package/dist/{safe-read-text-DgrJ4Uhl.js → safe-read-text-JQd_5vbd.js} +1 -1
- package/dist/{safe-stringify-BWS-uXZP.js → safe-stringify-DbWQw9qe.js} +2 -17
- package/dist/slack.d.ts +5 -13
- package/dist/slack.js +56 -114
- package/package.json +2 -1
- package/dist/safe-invoke-callback-EpWXwfwp.js +0 -170
- package/dist/serial-queue-B9LoBc64.js +0 -162
- package/dist/types-D-tO-Mh2.d.ts +0 -154
package/dist/types-D-tO-Mh2.d.ts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v4";
|
|
2
|
-
|
|
3
|
-
//#region lib/discord/discord-gateway-message-schema.d.ts
|
|
4
|
-
declare const FlumeGatewayMessageSchema: z.ZodObject<{
|
|
5
|
-
op: z.ZodNumber;
|
|
6
|
-
d: z.ZodUnknown;
|
|
7
|
-
s: z.ZodNullable<z.ZodNumber>;
|
|
8
|
-
t: z.ZodNullable<z.ZodString>;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region lib/github/github-notification-schema.d.ts
|
|
12
|
-
declare const FlumeGitHubNotificationSchema: z.ZodObject<{
|
|
13
|
-
id: z.ZodString;
|
|
14
|
-
reason: z.ZodString;
|
|
15
|
-
unread: z.ZodBoolean;
|
|
16
|
-
updated_at: z.ZodString;
|
|
17
|
-
subject: z.ZodObject<{
|
|
18
|
-
title: z.ZodString;
|
|
19
|
-
url: z.ZodNullable<z.ZodString>;
|
|
20
|
-
type: z.ZodString;
|
|
21
|
-
}, z.core.$strip>;
|
|
22
|
-
repository: z.ZodObject<{
|
|
23
|
-
full_name: z.ZodString;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
}, z.core.$strip>;
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region lib/slack/slack-connection-response-schema.d.ts
|
|
28
|
-
declare const FlumeSlackConnectionResponseSchema: z.ZodObject<{
|
|
29
|
-
ok: z.ZodBoolean;
|
|
30
|
-
url: z.ZodOptional<z.ZodString>;
|
|
31
|
-
error: z.ZodOptional<z.ZodString>;
|
|
32
|
-
}, z.core.$strip>;
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region lib/slack/slack-envelope-schema.d.ts
|
|
35
|
-
declare const FlumeSlackEnvelopeSchema: z.ZodObject<{
|
|
36
|
-
envelope_id: z.ZodString;
|
|
37
|
-
type: z.ZodString;
|
|
38
|
-
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
39
|
-
accepts_response_payload: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
-
retry_attempt: z.ZodOptional<z.ZodNumber>;
|
|
41
|
-
retry_reason: z.ZodOptional<z.ZodString>;
|
|
42
|
-
}, z.core.$strip>;
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region lib/types.d.ts
|
|
45
|
-
type FlumeTimerHandle = unknown;
|
|
46
|
-
type FlumeRuntimeDeps = {
|
|
47
|
-
fetch(url: string | URL, init?: RequestInit): Promise<Response>;
|
|
48
|
-
WebSocket: (new (url: string | URL) => WebSocket) | null;
|
|
49
|
-
now(): number;
|
|
50
|
-
random(): number;
|
|
51
|
-
setTimeout(fn: () => void, ms: number): FlumeTimerHandle;
|
|
52
|
-
clearTimeout(id: FlumeTimerHandle): void;
|
|
53
|
-
setInterval(fn: () => void, ms: number): FlumeTimerHandle;
|
|
54
|
-
clearInterval(id: FlumeTimerHandle): void;
|
|
55
|
-
};
|
|
56
|
-
type FlumeSourceName = "discord" | "slack" | "github";
|
|
57
|
-
type FlumeDiscordEvent = {
|
|
58
|
-
source: "discord";
|
|
59
|
-
type: string;
|
|
60
|
-
data: Record<string, unknown>;
|
|
61
|
-
meta: Record<string, string>;
|
|
62
|
-
receivedAt: number;
|
|
63
|
-
};
|
|
64
|
-
type FlumeSlackEvent = {
|
|
65
|
-
source: "slack";
|
|
66
|
-
type: string;
|
|
67
|
-
data: Record<string, unknown>;
|
|
68
|
-
meta: Record<string, string>;
|
|
69
|
-
receivedAt: number;
|
|
70
|
-
};
|
|
71
|
-
type FlumeGitHubEvent = {
|
|
72
|
-
source: "github";
|
|
73
|
-
type: "notification";
|
|
74
|
-
data: FlumeGitHubNotification;
|
|
75
|
-
meta: Record<string, string>;
|
|
76
|
-
receivedAt: number;
|
|
77
|
-
};
|
|
78
|
-
type FlumeEvent = FlumeDiscordEvent | FlumeSlackEvent | FlumeGitHubEvent;
|
|
79
|
-
type FlumeHandler = (event: FlumeEvent) => void | Promise<void>;
|
|
80
|
-
type FlumeSourceStartOptions = {
|
|
81
|
-
signal?: AbortSignal;
|
|
82
|
-
};
|
|
83
|
-
type FlumeSource = {
|
|
84
|
-
readonly name: FlumeSourceName;
|
|
85
|
-
start(handler: FlumeHandler, options?: FlumeSourceStartOptions): Promise<Error | null>;
|
|
86
|
-
stop(): Promise<void>;
|
|
87
|
-
status(): FlumeStatus;
|
|
88
|
-
};
|
|
89
|
-
type FlumeSourceStatus = {
|
|
90
|
-
/**
|
|
91
|
-
* 多くは `FlumeSourceName` のいずれかだが、`source.name` getter が throw する
|
|
92
|
-
* 第三者 `FlumeSource` 実装に備えて `string` まで広げてある (fallback で `"?"`)
|
|
93
|
-
*/
|
|
94
|
-
source: string;
|
|
95
|
-
status: FlumeStatus;
|
|
96
|
-
};
|
|
97
|
-
type FlumeStatus = "disconnected" | "connecting" | "connected" | "reconnecting";
|
|
98
|
-
type FlumeStatusHandler = (status: FlumeStatus, detail?: string) => void;
|
|
99
|
-
type FlumeLogLevel = "debug" | "info" | "warn" | "error";
|
|
100
|
-
type FlumeLog = {
|
|
101
|
-
level: FlumeLogLevel;
|
|
102
|
-
source: string;
|
|
103
|
-
action: string;
|
|
104
|
-
message: string;
|
|
105
|
-
error?: Error;
|
|
106
|
-
detail?: Record<string, unknown>;
|
|
107
|
-
timestamp: number;
|
|
108
|
-
};
|
|
109
|
-
type FlumeLogHandler = (log: FlumeLog) => void;
|
|
110
|
-
type FlumeLogInput = {
|
|
111
|
-
action: string;
|
|
112
|
-
message: string;
|
|
113
|
-
error?: Error;
|
|
114
|
-
detail?: Record<string, unknown>;
|
|
115
|
-
};
|
|
116
|
-
type FlumeReconnectOptions = {
|
|
117
|
-
maxAttempts?: number;
|
|
118
|
-
baseDelay?: number;
|
|
119
|
-
maxDelay?: number;
|
|
120
|
-
};
|
|
121
|
-
type FlumeReconnectConfig = {
|
|
122
|
-
maxAttempts: number;
|
|
123
|
-
baseDelay: number;
|
|
124
|
-
maxDelay: number;
|
|
125
|
-
};
|
|
126
|
-
type FlumeSourceOptions = {
|
|
127
|
-
reconnect?: boolean | FlumeReconnectOptions;
|
|
128
|
-
onStatus?: FlumeStatusHandler;
|
|
129
|
-
onLog?: FlumeLogHandler;
|
|
130
|
-
signal?: AbortSignal;
|
|
131
|
-
deps?: FlumeRuntimeDeps;
|
|
132
|
-
};
|
|
133
|
-
type FlumeDiscordSourceOptions = FlumeSourceOptions & {
|
|
134
|
-
token: string;
|
|
135
|
-
intents?: number;
|
|
136
|
-
};
|
|
137
|
-
type FlumeSlackSourceOptions = FlumeSourceOptions & {
|
|
138
|
-
appToken: string;
|
|
139
|
-
/**
|
|
140
|
-
* Bot token (`xoxb-`). Slack の Socket Mode (受信) には不要だが、ホスト側 (返信や
|
|
141
|
-
* `auth.test` での self 検出) が必ず使うため型で保持を強制する
|
|
142
|
-
*/
|
|
143
|
-
botToken: string;
|
|
144
|
-
};
|
|
145
|
-
type FlumeGitHubSourceOptions = FlumeSourceOptions & {
|
|
146
|
-
token: string;
|
|
147
|
-
pollInterval?: number;
|
|
148
|
-
};
|
|
149
|
-
type FlumeGatewayMessage = z.infer<typeof FlumeGatewayMessageSchema>;
|
|
150
|
-
type FlumeSlackEnvelope = z.infer<typeof FlumeSlackEnvelopeSchema>;
|
|
151
|
-
type FlumeSlackConnectionResponse = z.infer<typeof FlumeSlackConnectionResponseSchema>;
|
|
152
|
-
type FlumeGitHubNotification = z.infer<typeof FlumeGitHubNotificationSchema>;
|
|
153
|
-
//#endregion
|
|
154
|
-
export { FlumeSourceStartOptions as C, FlumeTimerHandle as D, FlumeStatusHandler as E, FlumeSourceOptions as S, FlumeStatus as T, FlumeSlackEnvelope as _, FlumeGitHubEvent as a, FlumeSource as b, FlumeHandler as c, FlumeLogInput as d, FlumeLogLevel as f, FlumeSlackConnectionResponse as g, FlumeRuntimeDeps as h, FlumeGatewayMessage as i, FlumeLog as l, FlumeReconnectOptions as m, FlumeDiscordSourceOptions as n, FlumeGitHubNotification as o, FlumeReconnectConfig as p, FlumeEvent as r, FlumeGitHubSourceOptions as s, FlumeDiscordEvent as t, FlumeLogHandler as u, FlumeSlackEvent as v, FlumeSourceStatus as w, FlumeSourceName as x, FlumeSlackSourceOptions as y };
|