@ironbee-ai/cli 0.5.2 → 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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/analysis/cross-session.d.ts +1 -1
- package/dist/analysis/cross-session.js +1 -1
- package/dist/analysis/cross-session.js.map +1 -1
- package/dist/analysis/time-analysis.js +3 -3
- package/dist/analysis/time-analysis.js.map +1 -1
- package/dist/analysis/verdict-details.d.ts +1 -1
- package/dist/clients/claude/hooks/clear-verdict.d.ts.map +1 -1
- package/dist/clients/claude/hooks/clear-verdict.js +17 -9
- package/dist/clients/claude/hooks/clear-verdict.js.map +1 -1
- package/dist/clients/claude/hooks/require-verification.d.ts.map +1 -1
- package/dist/clients/claude/hooks/require-verification.js +31 -4
- package/dist/clients/claude/hooks/require-verification.js.map +1 -1
- package/dist/clients/claude/hooks/session-end.d.ts.map +1 -1
- package/dist/clients/claude/hooks/session-end.js +6 -1
- package/dist/clients/claude/hooks/session-end.js.map +1 -1
- package/dist/clients/claude/hooks/session-start.d.ts.map +1 -1
- package/dist/clients/claude/hooks/session-start.js +9 -3
- package/dist/clients/claude/hooks/session-start.js.map +1 -1
- package/dist/clients/claude/hooks/track-action.d.ts +25 -4
- package/dist/clients/claude/hooks/track-action.d.ts.map +1 -1
- package/dist/clients/claude/hooks/track-action.js +160 -29
- package/dist/clients/claude/hooks/track-action.js.map +1 -1
- package/dist/clients/claude/hooks/verify-gate.d.ts.map +1 -1
- package/dist/clients/claude/hooks/verify-gate.js +5 -0
- package/dist/clients/claude/hooks/verify-gate.js.map +1 -1
- package/dist/clients/claude/index.d.ts.map +1 -1
- package/dist/clients/claude/index.js +18 -1
- package/dist/clients/claude/index.js.map +1 -1
- package/dist/clients/claude/util.d.ts +74 -0
- package/dist/clients/claude/util.d.ts.map +1 -0
- package/dist/clients/claude/util.js +352 -0
- package/dist/clients/claude/util.js.map +1 -0
- package/dist/clients/cursor/hooks/clear-verdict.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/clear-verdict.js +19 -10
- package/dist/clients/cursor/hooks/clear-verdict.js.map +1 -1
- package/dist/clients/cursor/hooks/require-verification.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/require-verification.js +28 -4
- package/dist/clients/cursor/hooks/require-verification.js.map +1 -1
- package/dist/clients/cursor/hooks/session-end.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/session-end.js +6 -1
- package/dist/clients/cursor/hooks/session-end.js.map +1 -1
- package/dist/clients/cursor/hooks/session-start.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/session-start.js +7 -2
- package/dist/clients/cursor/hooks/session-start.js.map +1 -1
- package/dist/clients/cursor/hooks/track-action.d.ts +30 -8
- package/dist/clients/cursor/hooks/track-action.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/track-action.js +192 -54
- package/dist/clients/cursor/hooks/track-action.js.map +1 -1
- package/dist/clients/cursor/hooks/verify-gate.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/verify-gate.js +4 -0
- package/dist/clients/cursor/hooks/verify-gate.js.map +1 -1
- package/dist/clients/cursor/index.d.ts.map +1 -1
- package/dist/clients/cursor/index.js +13 -2
- package/dist/clients/cursor/index.js.map +1 -1
- package/dist/clients/cursor/util.d.ts +52 -0
- package/dist/clients/cursor/util.d.ts.map +1 -0
- package/dist/clients/cursor/util.js +264 -0
- package/dist/clients/cursor/util.js.map +1 -0
- package/dist/commands/analyze.js +3 -3
- package/dist/commands/analyze.js.map +1 -1
- package/dist/commands/hook.js +1 -2
- package/dist/commands/hook.js.map +1 -1
- package/dist/commands/process-job-file.d.ts +10 -0
- package/dist/commands/process-job-file.d.ts.map +1 -0
- package/dist/commands/process-job-file.js +19 -0
- package/dist/commands/process-job-file.js.map +1 -0
- package/dist/commands/queue.d.ts +12 -0
- package/dist/commands/queue.d.ts.map +1 -0
- package/dist/commands/queue.js +495 -0
- package/dist/commands/queue.js.map +1 -0
- package/dist/hooks/core/actions.d.ts +168 -27
- package/dist/hooks/core/actions.d.ts.map +1 -1
- package/dist/hooks/core/actions.js +81 -4
- package/dist/hooks/core/actions.js.map +1 -1
- package/dist/hooks/core/activity.d.ts.map +1 -1
- package/dist/hooks/core/activity.js +13 -6
- package/dist/hooks/core/activity.js.map +1 -1
- package/dist/hooks/core/session-state.d.ts +19 -7
- package/dist/hooks/core/session-state.d.ts.map +1 -1
- package/dist/hooks/core/session-state.js +66 -12
- package/dist/hooks/core/session-state.js.map +1 -1
- package/dist/hooks/core/submit-verdict.d.ts.map +1 -1
- package/dist/hooks/core/submit-verdict.js +13 -4
- package/dist/hooks/core/submit-verdict.js.map +1 -1
- package/dist/hooks/core/verification-lifecycle.d.ts.map +1 -1
- package/dist/hooks/core/verification-lifecycle.js +14 -4
- package/dist/hooks/core/verification-lifecycle.js.map +1 -1
- package/dist/hooks/core/verify-gate.d.ts.map +1 -1
- package/dist/hooks/core/verify-gate.js +31 -19
- package/dist/hooks/core/verify-gate.js.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/collector.d.ts +64 -5
- package/dist/lib/collector.d.ts.map +1 -1
- package/dist/lib/collector.js +107 -44
- package/dist/lib/collector.js.map +1 -1
- package/dist/lib/config.d.ts +72 -8
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +40 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/queue/dead-letter.d.ts +26 -0
- package/dist/queue/dead-letter.d.ts.map +1 -0
- package/dist/queue/dead-letter.js +233 -0
- package/dist/queue/dead-letter.js.map +1 -0
- package/dist/queue/drain.d.ts +36 -0
- package/dist/queue/drain.d.ts.map +1 -0
- package/dist/queue/drain.js +170 -0
- package/dist/queue/drain.js.map +1 -0
- package/dist/queue/flush.d.ts +64 -0
- package/dist/queue/flush.d.ts.map +1 -0
- package/dist/queue/flush.js +119 -0
- package/dist/queue/flush.js.map +1 -0
- package/dist/queue/handlers/send-event.d.ts +23 -0
- package/dist/queue/handlers/send-event.d.ts.map +1 -0
- package/dist/queue/handlers/send-event.js +131 -0
- package/dist/queue/handlers/send-event.js.map +1 -0
- package/dist/queue/index.d.ts +30 -0
- package/dist/queue/index.d.ts.map +1 -0
- package/dist/queue/index.js +71 -0
- package/dist/queue/index.js.map +1 -0
- package/dist/queue/paths.d.ts +40 -0
- package/dist/queue/paths.d.ts.map +1 -0
- package/dist/queue/paths.js +107 -0
- package/dist/queue/paths.js.map +1 -0
- package/dist/queue/process-file.d.ts +22 -0
- package/dist/queue/process-file.d.ts.map +1 -0
- package/dist/queue/process-file.js +257 -0
- package/dist/queue/process-file.js.map +1 -0
- package/dist/queue/register-handlers.d.ts +26 -0
- package/dist/queue/register-handlers.d.ts.map +1 -0
- package/dist/queue/register-handlers.js +36 -0
- package/dist/queue/register-handlers.js.map +1 -0
- package/dist/queue/registry.d.ts +42 -0
- package/dist/queue/registry.d.ts.map +1 -0
- package/dist/queue/registry.js +36 -0
- package/dist/queue/registry.js.map +1 -0
- package/dist/queue/snapshot.d.ts +16 -0
- package/dist/queue/snapshot.d.ts.map +1 -0
- package/dist/queue/snapshot.js +39 -0
- package/dist/queue/snapshot.js.map +1 -0
- package/dist/queue/spawn.d.ts +15 -0
- package/dist/queue/spawn.d.ts.map +1 -0
- package/dist/queue/spawn.js +45 -0
- package/dist/queue/spawn.js.map +1 -0
- package/dist/queue/submit.d.ts +19 -0
- package/dist/queue/submit.d.ts.map +1 -0
- package/dist/queue/submit.js +94 -0
- package/dist/queue/submit.js.map +1 -0
- package/dist/queue/types.d.ts +77 -0
- package/dist/queue/types.d.ts.map +1 -0
- package/dist/queue/types.js +83 -0
- package/dist/queue/types.js.map +1 -0
- package/dist/queue/worker-log.d.ts +21 -0
- package/dist/queue/worker-log.d.ts.map +1 -0
- package/dist/queue/worker-log.js +140 -0
- package/dist/queue/worker-log.js.map +1 -0
- package/package.json +1 -1
package/dist/lib/collector.d.ts
CHANGED
|
@@ -1,11 +1,70 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* IronBee CLI — Collector Client
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Shared HTTP transport for pushing events to the IronBee Collector
|
|
5
|
+
* (`POST {url}/v1/events`). Two callers use it today:
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* - `sendToCollector(entry, …)` — fire-and-forget single-event send used
|
|
8
|
+
* by `appendAction` in the interactive path. Short timeout, resolves on
|
|
9
|
+
* ANY response (status ignored for backward-compat), rejects only on
|
|
10
|
+
* network / timeout errors.
|
|
11
|
+
*
|
|
12
|
+
* - `postEventsBatch(events, cc)` — low-level primitive returning
|
|
13
|
+
* `{ status, body }` so callers can classify the response. Used by the
|
|
14
|
+
* queue `send_event` handler for HTTP-status → TransientError /
|
|
15
|
+
* AuthError / BadRequestBatchError classification (spec §6).
|
|
16
|
+
*
|
|
17
|
+
* Both are no-ops when `IRONBEE_COLLECTOR=false` is set (jest harness).
|
|
18
|
+
*/
|
|
19
|
+
import { AppendActionInput } from "../hooks/core/actions";
|
|
20
|
+
export interface CollectorTarget {
|
|
21
|
+
url: string;
|
|
22
|
+
apiKey?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Max events per POST when the queue's `send_event` handler chunks a
|
|
25
|
+
* snapshot's jobs. Populated from `config.collector.batchSize`.
|
|
26
|
+
* Undefined → handler falls back to its built-in default (100).
|
|
27
|
+
*/
|
|
28
|
+
batchSize?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface PostEventsResult {
|
|
31
|
+
status: number;
|
|
32
|
+
body: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Low-level transport: POST a JSON array of events to the collector and
|
|
36
|
+
* resolve with the HTTP status + response body. Rejects on network error,
|
|
37
|
+
* connect timeout, or socket timeout. Does NOT throw on non-2xx — callers
|
|
38
|
+
* decide what HTTP status means for their use case.
|
|
39
|
+
*/
|
|
40
|
+
export declare function postEventsBatch(events: unknown[], target: CollectorTarget, opts?: {
|
|
41
|
+
timeoutMs?: number;
|
|
42
|
+
}): Promise<PostEventsResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Resolve the collector target from config, or `null` if disabled.
|
|
45
|
+
*
|
|
46
|
+
* Disabled when ANY of:
|
|
47
|
+
* - `IRONBEE_COLLECTOR=false` env (jest harness escape hatch)
|
|
48
|
+
* - no `collector` config section
|
|
49
|
+
* - `collector.enable: false` explicitly set
|
|
50
|
+
* - `collector.url` missing or empty
|
|
51
|
+
*
|
|
52
|
+
* Otherwise the section is treated as enabled (presence is the opt-in,
|
|
53
|
+
* symmetric with `jobQueue`). `apiKey` is optional — when absent, the
|
|
54
|
+
* `X-API-Key` header is simply omitted, allowing use against an
|
|
55
|
+
* auth-disabled collector.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getCollectorTarget(projectDir?: string): CollectorTarget | null;
|
|
58
|
+
/**
|
|
59
|
+
* Fire-and-forget single-event send. Resolves on any HTTP response (status is
|
|
60
|
+
* intentionally ignored so a 5xx from the collector does not propagate back
|
|
61
|
+
* into a hook that's writing to `actions.jsonl`). Rejects only on network
|
|
62
|
+
* / timeout errors.
|
|
63
|
+
*
|
|
64
|
+
* Emits a debug-level trace line per attempt to `session.log` (level filter
|
|
65
|
+
* does not gate file writes — see logger.ts) so operators can audit which
|
|
66
|
+
* lifecycle events made it to the collector. The line carries the event id
|
|
67
|
+
* and type to make grep'ing trivial; it does not include payload content.
|
|
8
68
|
*/
|
|
9
|
-
|
|
10
|
-
export declare function sendToCollector(entry: ActionEntry, sessionId: string, projectDir: string): Promise<void>;
|
|
69
|
+
export declare function sendToCollector(entry: AppendActionInput, _sessionId: string, projectDir: string): Promise<void>;
|
|
11
70
|
//# sourceMappingURL=collector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/lib/collector.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/lib/collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAK1D,MAAM,WAAW,eAAe;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACjC,MAAM,EAAE,OAAO,EAAE,EACjB,MAAM,EAAE,eAAe,EACvB,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CAgD3B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAsB9E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBrH"}
|
package/dist/lib/collector.js
CHANGED
|
@@ -2,81 +2,144 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* IronBee CLI — Collector Client
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Shared HTTP transport for pushing events to the IronBee Collector
|
|
6
|
+
* (`POST {url}/v1/events`). Two callers use it today:
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* - `sendToCollector(entry, …)` — fire-and-forget single-event send used
|
|
9
|
+
* by `appendAction` in the interactive path. Short timeout, resolves on
|
|
10
|
+
* ANY response (status ignored for backward-compat), rejects only on
|
|
11
|
+
* network / timeout errors.
|
|
12
|
+
*
|
|
13
|
+
* - `postEventsBatch(events, cc)` — low-level primitive returning
|
|
14
|
+
* `{ status, body }` so callers can classify the response. Used by the
|
|
15
|
+
* queue `send_event` handler for HTTP-status → TransientError /
|
|
16
|
+
* AuthError / BadRequestBatchError classification (spec §6).
|
|
17
|
+
*
|
|
18
|
+
* Both are no-ops when `IRONBEE_COLLECTOR=false` is set (jest harness).
|
|
9
19
|
*/
|
|
10
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.postEventsBatch = postEventsBatch;
|
|
22
|
+
exports.getCollectorTarget = getCollectorTarget;
|
|
11
23
|
exports.sendToCollector = sendToCollector;
|
|
12
24
|
const https_1 = require("https");
|
|
13
25
|
const http_1 = require("http");
|
|
14
|
-
const path_1 = require("path");
|
|
15
26
|
const config_1 = require("./config");
|
|
16
27
|
const logger_1 = require("./logger");
|
|
17
28
|
const SEND_TIMEOUT_MS = 3000;
|
|
18
29
|
const EVENTS_PATH = "/v1/events";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return (0, path_1.basename)(projectDir);
|
|
28
|
-
}
|
|
29
|
-
async function sendToCollector(entry, sessionId, projectDir) {
|
|
30
|
-
if (process.env.IRONBEE_COLLECTOR === "false") {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
30
|
+
/**
|
|
31
|
+
* Low-level transport: POST a JSON array of events to the collector and
|
|
32
|
+
* resolve with the HTTP status + response body. Rejects on network error,
|
|
33
|
+
* connect timeout, or socket timeout. Does NOT throw on non-2xx — callers
|
|
34
|
+
* decide what HTTP status means for their use case.
|
|
35
|
+
*/
|
|
36
|
+
async function postEventsBatch(events, target, opts) {
|
|
37
|
+
const timeoutMs = opts?.timeoutMs ?? SEND_TIMEOUT_MS;
|
|
33
38
|
return new Promise((resolve, reject) => {
|
|
34
39
|
try {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
resolve();
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const projectName = getProjectName(projectDir);
|
|
41
|
-
const event = {
|
|
42
|
-
...entry,
|
|
43
|
-
timestamp: entry.timestamp ? new Date(entry.timestamp).getTime() : Date.now(),
|
|
44
|
-
session_id: entry.session_id ?? sessionId,
|
|
45
|
-
project_name: projectName,
|
|
46
|
-
};
|
|
47
|
-
const body = JSON.stringify([event]);
|
|
48
|
-
const url = new URL(EVENTS_PATH, collectorConfig.url);
|
|
40
|
+
const body = JSON.stringify(events);
|
|
41
|
+
const url = new URL(EVENTS_PATH, target.url);
|
|
49
42
|
const isHttps = url.protocol === "https:";
|
|
50
43
|
const doRequest = isHttps ? https_1.request : http_1.request;
|
|
51
|
-
const
|
|
52
|
-
logger_1.logger.debug("collector: send timeout");
|
|
44
|
+
const timer = setTimeout(() => {
|
|
53
45
|
reject(new Error("collector: send timeout"));
|
|
54
|
-
},
|
|
46
|
+
}, timeoutMs);
|
|
55
47
|
const req = doRequest({
|
|
56
48
|
hostname: url.hostname,
|
|
57
49
|
port: url.port || (isHttps ? 443 : 80),
|
|
58
|
-
path: url.pathname,
|
|
50
|
+
path: url.pathname + url.search,
|
|
59
51
|
method: "POST",
|
|
60
52
|
headers: {
|
|
61
53
|
"Content-Type": "application/json",
|
|
62
54
|
"Content-Length": Buffer.byteLength(body),
|
|
63
|
-
...(
|
|
55
|
+
...(target.apiKey ? { "X-API-Key": target.apiKey } : {}),
|
|
64
56
|
},
|
|
65
|
-
timeout:
|
|
57
|
+
timeout: timeoutMs,
|
|
66
58
|
}, (res) => {
|
|
67
|
-
|
|
68
|
-
res.
|
|
69
|
-
res.on("
|
|
59
|
+
let chunks = "";
|
|
60
|
+
res.setEncoding("utf-8");
|
|
61
|
+
res.on("data", (d) => { chunks += d; });
|
|
62
|
+
res.on("end", () => {
|
|
63
|
+
clearTimeout(timer);
|
|
64
|
+
resolve({ status: res.statusCode ?? 0, body: chunks });
|
|
65
|
+
});
|
|
66
|
+
res.on("close", () => {
|
|
67
|
+
clearTimeout(timer);
|
|
68
|
+
resolve({ status: res.statusCode ?? 0, body: chunks });
|
|
69
|
+
});
|
|
70
70
|
});
|
|
71
|
-
req.on("error", (err) => { clearTimeout(
|
|
72
|
-
req.on("timeout", () => { clearTimeout(
|
|
71
|
+
req.on("error", (err) => { clearTimeout(timer); reject(err); });
|
|
72
|
+
req.on("timeout", () => { clearTimeout(timer); req.destroy(); reject(new Error("collector: request timeout")); });
|
|
73
73
|
req.write(body);
|
|
74
74
|
req.end();
|
|
75
75
|
}
|
|
76
76
|
catch (e) {
|
|
77
|
-
logger_1.logger.debug(`collector: sendToCollector failed: ${e}`);
|
|
78
77
|
reject(e instanceof Error ? e : new Error(String(e)));
|
|
79
78
|
}
|
|
80
79
|
});
|
|
81
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Resolve the collector target from config, or `null` if disabled.
|
|
83
|
+
*
|
|
84
|
+
* Disabled when ANY of:
|
|
85
|
+
* - `IRONBEE_COLLECTOR=false` env (jest harness escape hatch)
|
|
86
|
+
* - no `collector` config section
|
|
87
|
+
* - `collector.enable: false` explicitly set
|
|
88
|
+
* - `collector.url` missing or empty
|
|
89
|
+
*
|
|
90
|
+
* Otherwise the section is treated as enabled (presence is the opt-in,
|
|
91
|
+
* symmetric with `jobQueue`). `apiKey` is optional — when absent, the
|
|
92
|
+
* `X-API-Key` header is simply omitted, allowing use against an
|
|
93
|
+
* auth-disabled collector.
|
|
94
|
+
*/
|
|
95
|
+
function getCollectorTarget(projectDir) {
|
|
96
|
+
if (process.env.IRONBEE_COLLECTOR === "false") {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const config = (0, config_1.loadConfig)(projectDir);
|
|
100
|
+
const section = config.collector;
|
|
101
|
+
if (!section) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
// explicit kill switch — keeps url/apiKey/batchSize in config so the user
|
|
105
|
+
// can flip back on without re-typing them
|
|
106
|
+
if (section.enable === false) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
if (typeof section.url !== "string" || section.url.length === 0) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
url: section.url,
|
|
114
|
+
apiKey: section.apiKey,
|
|
115
|
+
batchSize: typeof section.batchSize === "number" ? section.batchSize : undefined,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Fire-and-forget single-event send. Resolves on any HTTP response (status is
|
|
120
|
+
* intentionally ignored so a 5xx from the collector does not propagate back
|
|
121
|
+
* into a hook that's writing to `actions.jsonl`). Rejects only on network
|
|
122
|
+
* / timeout errors.
|
|
123
|
+
*
|
|
124
|
+
* Emits a debug-level trace line per attempt to `session.log` (level filter
|
|
125
|
+
* does not gate file writes — see logger.ts) so operators can audit which
|
|
126
|
+
* lifecycle events made it to the collector. The line carries the event id
|
|
127
|
+
* and type to make grep'ing trivial; it does not include payload content.
|
|
128
|
+
*/
|
|
129
|
+
async function sendToCollector(entry, _sessionId, projectDir) {
|
|
130
|
+
const target = getCollectorTarget(projectDir);
|
|
131
|
+
if (!target) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const startedAt = Date.now();
|
|
135
|
+
try {
|
|
136
|
+
// entry is already enriched with id/session_id/project_name/timestamp by appendAction.
|
|
137
|
+
await postEventsBatch([entry], target, { timeoutMs: SEND_TIMEOUT_MS });
|
|
138
|
+
logger_1.logger.debug(`collector: posted type=${entry.type} id=${entry.id ?? "?"} in ${Date.now() - startedAt}ms`);
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
logger_1.logger.debug(`collector: sendToCollector failed type=${entry.type} id=${entry.id ?? "?"}: ${e}`);
|
|
142
|
+
throw e instanceof Error ? e : new Error(String(e));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
82
145
|
//# sourceMappingURL=collector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../../src/lib/collector.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../../src/lib/collector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAiCH,0CAoDC;AAgBD,gDAsBC;AAaD,0CAgBC;AAtJD,iCAAgD;AAChD,+BAA+D;AAC/D,qCAAqD;AACrD,qCAAkC;AAGlC,MAAM,eAAe,GAAW,IAAI,CAAC;AACrC,MAAM,WAAW,GAAW,YAAY,CAAC;AAkBzC;;;;;GAKG;AACI,KAAK,UAAU,eAAe,CACjC,MAAiB,EACjB,MAAuB,EACvB,IAA6B;IAE7B,MAAM,SAAS,GAAW,IAAI,EAAE,SAAS,IAAI,eAAe,CAAC;IAC7D,OAAO,IAAI,OAAO,CAAmB,CAAC,OAAsC,EAAE,MAA0B,EAAQ,EAAE;QAC9G,IAAI,CAAC;YACD,MAAM,IAAI,GAAW,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAC5C,MAAM,GAAG,GAAQ,IAAI,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;YAClD,MAAM,OAAO,GAAY,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;YACnD,MAAM,SAAS,GAAwB,OAAO,CAAC,CAAC,CAAC,eAAY,CAAC,CAAC,CAAC,cAAW,CAAC;YAE5E,MAAM,KAAK,GAAmB,UAAU,CAAC,GAAS,EAAE;gBAChD,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC;YACjD,CAAC,EAAE,SAAS,CAAC,CAAC;YAEd,MAAM,GAAG,GAAoC,SAAS,CAClD;gBACI,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CA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;QACtB,SAAS,EAAE,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;KACnF,CAAC;AACN,CAAC;AAED;;;;;;;;;;GAUG;AACI,KAAK,UAAU,eAAe,CAAC,KAAwB,EAAE,UAAkB,EAAE,UAAkB;IAClG,MAAM,MAAM,GAA2B,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACtE,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO;IACX,CAAC;IACD,MAAM,SAAS,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;IACrC,IAAI,CAAC;QACD,uFAAuF;QACvF,MAAM,eAAe,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;QACvE,eAAM,CAAC,KAAK,CACR,0BAA0B,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,EAAE,IAAI,GAAG,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,IAAI,CAC9F,CAAC;IACN,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QAClB,eAAM,CAAC,KAAK,CAAC,0CAA0C,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;QACjG,MAAM,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;AACL,CAAC"}
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -28,24 +28,68 @@ export interface IronBeeConfig {
|
|
|
28
28
|
/** Maximum retry attempts before allowing completion despite failures. */
|
|
29
29
|
maxRetries?: number;
|
|
30
30
|
/**
|
|
31
|
-
* IronBee Collector configuration for remote event ingestion.
|
|
32
|
-
*
|
|
31
|
+
* IronBee Collector configuration for remote event ingestion. When the
|
|
32
|
+
* section is present and `enable` is not explicitly `false`, events are
|
|
33
|
+
* sent to the collector in addition to local storage.
|
|
33
34
|
*/
|
|
34
35
|
collector?: {
|
|
35
|
-
/**
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Master switch. Defaults to `true` whenever this section is present,
|
|
38
|
+
* mirroring `jobQueue.enable`. Set explicitly to `false` to suspend
|
|
39
|
+
* the collector without removing `url` / `apiKey` / `batchSize` —
|
|
40
|
+
* useful for temporarily working offline while keeping the rest of
|
|
41
|
+
* the collector config around.
|
|
42
|
+
*/
|
|
43
|
+
enable?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Collector base URL (e.g. "https://service.ironbee.dev"). Required
|
|
46
|
+
* for `enable !== false`; the collector is treated as disabled when
|
|
47
|
+
* `url` is missing or empty.
|
|
48
|
+
*/
|
|
49
|
+
url?: string;
|
|
37
50
|
/** API key for authentication (X-API-Key header). Optional if auth is disabled on collector. */
|
|
38
51
|
apiKey?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Max events per POST in the queue's `send_event` handler. Jobs
|
|
54
|
+
* accumulated in a snapshot are chunked into batches of this size so
|
|
55
|
+
* the collector doesn't reject oversize bodies. Default 100.
|
|
56
|
+
* Set to a higher value if your collector tolerates big bodies.
|
|
57
|
+
*/
|
|
58
|
+
batchSize?: number;
|
|
39
59
|
};
|
|
40
60
|
/**
|
|
41
|
-
* Recording configuration.
|
|
42
|
-
*
|
|
43
|
-
*
|
|
61
|
+
* Recording enforcement configuration. When enabled, each verification
|
|
62
|
+
* cycle requires a browser recording (start-recording before browser
|
|
63
|
+
* tools, stop-recording before verdict).
|
|
64
|
+
*
|
|
65
|
+
* The presence of this section IS the opt-in signal — `"recording": {}`
|
|
66
|
+
* (or any sub-key) turns enforcement on. Set `enable: false` explicitly
|
|
67
|
+
* to disable while keeping the section around. Section absent → off.
|
|
68
|
+
* Symmetric with `jobQueue` and `collector`.
|
|
44
69
|
*/
|
|
45
70
|
recording?: {
|
|
46
|
-
/** Enable recording enforcement. Default: false. */
|
|
47
71
|
enable?: boolean;
|
|
48
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Job queue tuning. The presence of this section IS the opt-in signal —
|
|
75
|
+
* adding `"jobQueue": {}` (or any sub-key) enables the queue. To opt out
|
|
76
|
+
* after the section exists, set `enable: false` explicitly.
|
|
77
|
+
*
|
|
78
|
+
* `enable`: master switch. Defaults to `true` when this section is
|
|
79
|
+
* present, `false` when absent. Set explicitly to `false` to disable
|
|
80
|
+
* without removing the rest of the config (e.g. keep your custom
|
|
81
|
+
* `autoFlushSizeBytes` around for later).
|
|
82
|
+
*
|
|
83
|
+
* `autoFlushSizeBytes`: when the live `jobs.jsonl` size meets or exceeds
|
|
84
|
+
* this threshold after a submit, a detached worker is spawned in the
|
|
85
|
+
* background to snapshot and process it — providing mid-session flush
|
|
86
|
+
* without waiting for Stop / SessionEnd. Set to `0` (or a negative value)
|
|
87
|
+
* to disable size-based auto-flush. Default 32768 (32 KB).
|
|
88
|
+
*/
|
|
89
|
+
jobQueue?: {
|
|
90
|
+
enable?: boolean;
|
|
91
|
+
autoFlushSizeBytes?: number;
|
|
92
|
+
};
|
|
49
93
|
/** Allow additional config fields. */
|
|
50
94
|
[key: string]: unknown;
|
|
51
95
|
}
|
|
@@ -78,4 +122,24 @@ export interface BrowserDevToolsMCPConfig {
|
|
|
78
122
|
*/
|
|
79
123
|
export declare function getMcpServerEntry(projectDir?: string): BrowserDevToolsMCPConfig;
|
|
80
124
|
export declare function getMaxRetries(config: IronBeeConfig): number;
|
|
125
|
+
/**
|
|
126
|
+
* Returns true when the job queue layer is enabled for this project.
|
|
127
|
+
*
|
|
128
|
+
* Rule:
|
|
129
|
+
* - No `jobQueue` section in config → disabled (default-off).
|
|
130
|
+
* - `jobQueue` section present → enabled, unless `enable: false` is set
|
|
131
|
+
* explicitly. Adding any sub-key (e.g. `autoFlushSizeBytes`) implicitly
|
|
132
|
+
* opts in.
|
|
133
|
+
*
|
|
134
|
+
* Used as both a producer-side gate (track-action skips wire construction
|
|
135
|
+
* when off) and a defense-in-depth guard inside `submit()` itself.
|
|
136
|
+
*/
|
|
137
|
+
export declare function isJobQueueEnabled(projectDir?: string): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Returns true when recording enforcement is enabled for this project.
|
|
140
|
+
* Same presence-as-opt-in semantics as `isJobQueueEnabled`: the `recording`
|
|
141
|
+
* section being present in config.json turns enforcement on; set
|
|
142
|
+
* `enable: false` explicitly to suspend without removing the section.
|
|
143
|
+
*/
|
|
144
|
+
export declare function isRecordingEnabled(projectDir?: string): boolean;
|
|
81
145
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,MAAM,WAAW,aAAa;IAC1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjC,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,MAAM,WAAW,aAAa;IAC1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjC,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,SAAS,CAAC,EAAE;QACR;;;;;;WAMG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB;;;;WAIG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,gGAAgG;QAChG,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB;;;;;WAKG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IAEF;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;IAEF;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,EAAE;QACP,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC/B,CAAC;IAEF,sCAAsC;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AA6CD,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,aAAa,CAiB7D;AAyCD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAarF;AAED,MAAM,WAAW,wBAAwB;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAcD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,wBAAwB,CAuC/E;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAI3D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAG9D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAG/D"}
|
package/dist/lib/config.js
CHANGED
|
@@ -13,6 +13,8 @@ exports.loadConfig = loadConfig;
|
|
|
13
13
|
exports.requiresVerification = requiresVerification;
|
|
14
14
|
exports.getMcpServerEntry = getMcpServerEntry;
|
|
15
15
|
exports.getMaxRetries = getMaxRetries;
|
|
16
|
+
exports.isJobQueueEnabled = isJobQueueEnabled;
|
|
17
|
+
exports.isRecordingEnabled = isRecordingEnabled;
|
|
16
18
|
const fs_1 = require("fs");
|
|
17
19
|
const path_1 = require("path");
|
|
18
20
|
const os_1 = require("os");
|
|
@@ -191,4 +193,42 @@ function getMaxRetries(config) {
|
|
|
191
193
|
? config.maxRetries
|
|
192
194
|
: DEFAULT_MAX_RETRIES;
|
|
193
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Returns true when the job queue layer is enabled for this project.
|
|
198
|
+
*
|
|
199
|
+
* Rule:
|
|
200
|
+
* - No `jobQueue` section in config → disabled (default-off).
|
|
201
|
+
* - `jobQueue` section present → enabled, unless `enable: false` is set
|
|
202
|
+
* explicitly. Adding any sub-key (e.g. `autoFlushSizeBytes`) implicitly
|
|
203
|
+
* opts in.
|
|
204
|
+
*
|
|
205
|
+
* Used as both a producer-side gate (track-action skips wire construction
|
|
206
|
+
* when off) and a defense-in-depth guard inside `submit()` itself.
|
|
207
|
+
*/
|
|
208
|
+
function isJobQueueEnabled(projectDir) {
|
|
209
|
+
const config = loadConfig(projectDir);
|
|
210
|
+
return isPresenceEnabled(config.jobQueue);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Returns true when recording enforcement is enabled for this project.
|
|
214
|
+
* Same presence-as-opt-in semantics as `isJobQueueEnabled`: the `recording`
|
|
215
|
+
* section being present in config.json turns enforcement on; set
|
|
216
|
+
* `enable: false` explicitly to suspend without removing the section.
|
|
217
|
+
*/
|
|
218
|
+
function isRecordingEnabled(projectDir) {
|
|
219
|
+
const config = loadConfig(projectDir);
|
|
220
|
+
return isPresenceEnabled(config.recording);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Shared "section present + not explicitly disabled" check used by the
|
|
224
|
+
* three master-switch helpers (`jobQueue`, `recording`, and inline by
|
|
225
|
+
* `getCollectorTarget`). Defensive against malformed config values
|
|
226
|
+
* (null / non-object / array) — those are treated as disabled.
|
|
227
|
+
*/
|
|
228
|
+
function isPresenceEnabled(section) {
|
|
229
|
+
if (section === undefined || section === null || typeof section !== "object" || Array.isArray(section)) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
return section.enable !== false;
|
|
233
|
+
}
|
|
194
234
|
//# sourceMappingURL=config.js.map
|
package/dist/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAgJH,gCAiBC;AAiDD,oDAaC;AAgCD,8CAuCC;AAED,sCAIC;AAcD,8CAGC;AAQD,gDAGC;AAtUD,2BAA8C;AAC9C,+BAA4B;AAC5B,2BAA6B;AAC7B,qCAAkC;AAgGlC,MAAM,uBAAuB,GAAa;IACtC,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACjC,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,OAAO;IACjB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IAC/C,MAAM;IACN,MAAM,EAAE,OAAO;IACf,MAAM;IACN,MAAM;IACN,QAAQ,EAAE,MAAM,EAAE,OAAO;IACzB,SAAS;IACT,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO;IAC9B,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM,EAAE,OAAO;IACf,OAAO;IACP,OAAO;IACP,KAAK,EAAE,KAAK;IACZ,SAAS;IACT,OAAO,EAAE,QAAQ;IACjB,OAAO;IACP,OAAO;IACP,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ;IACnC,SAAS;CACZ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AAS,iBAAiB,CAAC,OAAgB;IACvC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACrG,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAQ,OAAgC,CAAC,MAAM,KAAK,KAAK,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IronBee CLI — Dead Letter Writer + Rotation
|
|
3
|
+
*
|
|
4
|
+
* See docs/job-queue.md §6.1 (entry shape), §6.2 (rotation + retention).
|
|
5
|
+
*/
|
|
6
|
+
import { DeadLetterEntry, Job } from "./types";
|
|
7
|
+
export interface DeadLetterInput {
|
|
8
|
+
projectDir: string;
|
|
9
|
+
sessionId: string;
|
|
10
|
+
sourceFile: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Append a parsed-job dead-letter entry. Enforces the 4 KB line ceiling via a
|
|
14
|
+
* cascade of three truncation fallbacks. The last fallback always fits — it
|
|
15
|
+
* replaces the entire entry with a minimal overflow marker — so the atomic
|
|
16
|
+
* append invariant (§6.1) always holds.
|
|
17
|
+
*/
|
|
18
|
+
export declare function deadLetterParsed(input: DeadLetterInput, job: Job, category: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Append a parse-error dead-letter entry. The raw line is truncated to 512
|
|
21
|
+
* chars and ASCII control chars are escaped.
|
|
22
|
+
*/
|
|
23
|
+
export declare function deadLetterParseError(input: DeadLetterInput, raw: string, category: string): void;
|
|
24
|
+
/** Exposed for tests and CLI tooling. */
|
|
25
|
+
export declare function readDeadLetterEntries(projectDir: string, sessionId: string): DeadLetterEntry[];
|
|
26
|
+
//# sourceMappingURL=dead-letter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dead-letter.d.ts","sourceRoot":"","sources":["../../src/queue/dead-letter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,OAAO,EAIH,eAAe,EAGf,GAAG,EAEN,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,eAAe;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CA4DzF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAYhG;AAyHD,yCAAyC;AACzC,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE,CAoB9F"}
|