@junando/core 0.11.0 → 0.12.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/dist/index.d.ts +771 -1918
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2190 -10364
- package/dist/index.js.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/shared/metrics/index.d.ts +29 -0
- package/dist/shared/metrics/index.d.ts.map +1 -0
- package/dist/shared/metrics/index.js +131 -0
- package/dist/shared/metrics/index.js.map +1 -0
- package/package.json +11 -11
- package/dist/chunk-3OJNTHWB.js +0 -225
- package/dist/chunk-5LNMHOUT.js +0 -229
- package/dist/chunk-72FU6SG6.js +0 -236
- package/dist/chunk-7SYJ764U.js +0 -579
- package/dist/chunk-AZU6S4RC.js +0 -11
- package/dist/chunk-BGPI5BQ5.js +0 -27
- package/dist/chunk-DKQSWD3S.js +0 -46
- package/dist/chunk-H4ND7Z4R.js +0 -504
- package/dist/chunk-HVICRLMN.js +0 -742
- package/dist/chunk-ID7PWYSN.js +0 -12
- package/dist/chunk-KU245W3C.js +0 -16
- package/dist/chunk-L67CO4EG.js +0 -1038
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-MQ4JUE6V.js +0 -447
- package/dist/chunk-N5AJP37P.js +0 -385
- package/dist/chunk-SIDCDO4Q.js +0 -1315
- package/dist/chunk-TDZF3WAT.js +0 -3824
- package/dist/chunk-VMBT3R2K.js +0 -0
- package/dist/chunk-WWHXKECU.js +0 -100
- package/dist/chunk-ZKH7AMP3.js +0 -42
- package/dist/chunk-ZOU3QHNL.js +0 -28
- package/dist/dist-es-CBFEDVZZ.js +0 -493
- package/dist/dist-es-ROXOWRKX.js +0 -22
- package/dist/dist-es-S3QCFNII.js +0 -327
- package/dist/dist-es-SQCUDQ4Y.js +0 -90
- package/dist/dist-es-UWOSB3KA.js +0 -72
- package/dist/dist-es-VXERFT35.js +0 -172
- package/dist/dist-es-Y44CAW7E.js +0 -385
- package/dist/event-streams-2IMLK3TK.js +0 -252
- package/dist/event-streams-NLZW3NHF.js +0 -1376
- package/dist/loadSso-T6VCDGCZ.js +0 -558
- package/dist/signin-BC6ZNJCV.js +0 -653
- package/dist/sso-oidc-PTS5E3NX.js +0 -793
- package/dist/sts-JSJ57UXB.js +0 -6108
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { Counter, Gauge, Histogram, Registry } from "prom-client";
|
|
3
|
+
//#region src/shared/metrics/index.ts
|
|
4
|
+
var metrics_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
alertClusters: () => alertClusters,
|
|
6
|
+
alertsProcessed: () => alertsProcessed,
|
|
7
|
+
alertsReceived: () => alertsReceived,
|
|
8
|
+
dedupDuplicate: () => dedupDuplicate,
|
|
9
|
+
dedupNew: () => dedupNew,
|
|
10
|
+
dedupRedisFailoverTotal: () => dedupRedisFailoverTotal,
|
|
11
|
+
latency: () => latency,
|
|
12
|
+
llmInferenceDuration: () => llmInferenceDuration,
|
|
13
|
+
llmInferenceTotal: () => llmInferenceTotal,
|
|
14
|
+
notificationsTotal: () => notificationsTotal,
|
|
15
|
+
pipelineInlineFailuresTotal: () => pipelineInlineFailuresTotal,
|
|
16
|
+
registry: () => registry,
|
|
17
|
+
sqsQueueLag: () => sqsQueueLag,
|
|
18
|
+
suppressedClusters: () => suppressedClusters,
|
|
19
|
+
webhookRequestsTotal: () => webhookRequestsTotal
|
|
20
|
+
});
|
|
21
|
+
const registry = new Registry();
|
|
22
|
+
const alertsReceived = new Counter({
|
|
23
|
+
name: "junando_alerts_received_total",
|
|
24
|
+
help: "Total number of alerts received via webhook",
|
|
25
|
+
labelNames: ["status"],
|
|
26
|
+
registers: [registry]
|
|
27
|
+
});
|
|
28
|
+
const webhookRequestsTotal = new Counter({
|
|
29
|
+
name: "junando_webhooks_total",
|
|
30
|
+
help: "Total number of webhook HTTP requests",
|
|
31
|
+
labelNames: ["endpoint", "status"],
|
|
32
|
+
registers: [registry]
|
|
33
|
+
});
|
|
34
|
+
const alertsProcessed = new Counter({
|
|
35
|
+
name: "junando_alerts_processed_total",
|
|
36
|
+
help: "Total number of alerts processed successfully",
|
|
37
|
+
labelNames: ["result"],
|
|
38
|
+
registers: [registry]
|
|
39
|
+
});
|
|
40
|
+
const alertClusters = new Gauge({
|
|
41
|
+
name: "junando_alert_clusters",
|
|
42
|
+
help: "Current number of alert clusters",
|
|
43
|
+
registers: [registry]
|
|
44
|
+
});
|
|
45
|
+
const latency = new Histogram({
|
|
46
|
+
name: "junando_webhook_duration_seconds",
|
|
47
|
+
help: "Webhook request duration in seconds",
|
|
48
|
+
labelNames: ["status"],
|
|
49
|
+
buckets: [
|
|
50
|
+
.005,
|
|
51
|
+
.01,
|
|
52
|
+
.025,
|
|
53
|
+
.05,
|
|
54
|
+
.1,
|
|
55
|
+
.25,
|
|
56
|
+
.5
|
|
57
|
+
],
|
|
58
|
+
registers: [registry]
|
|
59
|
+
});
|
|
60
|
+
const llmInferenceDuration = new Histogram({
|
|
61
|
+
name: "junando_llm_inference_duration_seconds",
|
|
62
|
+
help: "LLM inference duration in seconds",
|
|
63
|
+
labelNames: ["model"],
|
|
64
|
+
buckets: [
|
|
65
|
+
.5,
|
|
66
|
+
1,
|
|
67
|
+
2,
|
|
68
|
+
5,
|
|
69
|
+
10,
|
|
70
|
+
30
|
|
71
|
+
],
|
|
72
|
+
registers: [registry]
|
|
73
|
+
});
|
|
74
|
+
const llmInferenceTotal = new Counter({
|
|
75
|
+
name: "junando_llm_inference_total",
|
|
76
|
+
help: "Total number of LLM inference calls",
|
|
77
|
+
labelNames: ["status"],
|
|
78
|
+
registers: [registry]
|
|
79
|
+
});
|
|
80
|
+
/** Tracks inline pipeline failures in local dev mode. */
|
|
81
|
+
const pipelineInlineFailuresTotal = new Counter({
|
|
82
|
+
name: "junando_pipeline_inline_failures_total",
|
|
83
|
+
help: "Total number of inline pipeline failures in dev mode",
|
|
84
|
+
labelNames: ["reason"],
|
|
85
|
+
registers: [registry]
|
|
86
|
+
});
|
|
87
|
+
/** Tracks Redis dedup fallback activations. */
|
|
88
|
+
const dedupRedisFailoverTotal = new Counter({
|
|
89
|
+
name: "junando_dedup_redis_failover_total",
|
|
90
|
+
help: "Total number of Redis dedup fallback activations",
|
|
91
|
+
registers: [registry]
|
|
92
|
+
});
|
|
93
|
+
/** Tracks new alert clusters (dedup: first-time fingerprint). */
|
|
94
|
+
const dedupNew = new Counter({
|
|
95
|
+
name: "junando_dedup_new_total",
|
|
96
|
+
help: "Total number of new alert clusters (not yet seen)",
|
|
97
|
+
labelNames: ["source"],
|
|
98
|
+
registers: [registry]
|
|
99
|
+
});
|
|
100
|
+
/** Tracks duplicate alert clusters (dedup: fingerprint already seen). */
|
|
101
|
+
const dedupDuplicate = new Counter({
|
|
102
|
+
name: "junando_dedup_duplicate_total",
|
|
103
|
+
help: "Total number of duplicate alert clusters skipped by dedup",
|
|
104
|
+
labelNames: ["source"],
|
|
105
|
+
registers: [registry]
|
|
106
|
+
});
|
|
107
|
+
/** Tracks outbound notification attempts by channel and outcome. */
|
|
108
|
+
const notificationsTotal = new Counter({
|
|
109
|
+
name: "junando_notifications_total",
|
|
110
|
+
help: "Total number of notification attempts",
|
|
111
|
+
labelNames: ["channel", "outcome"],
|
|
112
|
+
registers: [registry]
|
|
113
|
+
});
|
|
114
|
+
/** Tracks approximate number of unprocessed SQS messages (queue lag). */
|
|
115
|
+
const sqsQueueLag = new Gauge({
|
|
116
|
+
name: "junando_sqs_queue_lag",
|
|
117
|
+
help: "Approximate number of unprocessed messages in the SQS queue",
|
|
118
|
+
labelNames: ["queue_name"],
|
|
119
|
+
registers: [registry]
|
|
120
|
+
});
|
|
121
|
+
/** Tracks clusters suppressed by the rule engine, segmented by rule ID. */
|
|
122
|
+
const suppressedClusters = new Gauge({
|
|
123
|
+
name: "junando_suppressed_clusters",
|
|
124
|
+
help: "Current number of clusters suppressed by the rule engine",
|
|
125
|
+
labelNames: ["rule_id"],
|
|
126
|
+
registers: [registry]
|
|
127
|
+
});
|
|
128
|
+
//#endregion
|
|
129
|
+
export { alertClusters, alertsProcessed, alertsReceived, dedupDuplicate, dedupNew, dedupRedisFailoverTotal, latency, llmInferenceDuration, llmInferenceTotal, notificationsTotal, pipelineInlineFailuresTotal, registry, sqsQueueLag, suppressedClusters, metrics_exports as t, webhookRequestsTotal };
|
|
130
|
+
|
|
131
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/shared/metrics/index.ts"],"sourcesContent":["import { Registry, Counter, Gauge, Histogram } from 'prom-client';\n\nexport const registry = new Registry();\n\nexport const alertsReceived = new Counter({\n name: 'junando_alerts_received_total',\n help: 'Total number of alerts received via webhook',\n labelNames: ['status'],\n registers: [registry],\n});\n\nexport const webhookRequestsTotal = new Counter({\n name: 'junando_webhooks_total',\n help: 'Total number of webhook HTTP requests',\n labelNames: ['endpoint', 'status'],\n registers: [registry],\n});\n\nexport const alertsProcessed = new Counter({\n name: 'junando_alerts_processed_total',\n help: 'Total number of alerts processed successfully',\n labelNames: ['result'],\n registers: [registry],\n});\n\nexport const alertClusters = new Gauge({\n name: 'junando_alert_clusters',\n help: 'Current number of alert clusters',\n registers: [registry],\n});\n\nexport const latency = new Histogram({\n name: 'junando_webhook_duration_seconds',\n help: 'Webhook request duration in seconds',\n labelNames: ['status'],\n buckets: [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5],\n registers: [registry],\n});\n\nexport const llmInferenceDuration = new Histogram({\n name: 'junando_llm_inference_duration_seconds',\n help: 'LLM inference duration in seconds',\n labelNames: ['model'],\n buckets: [0.5, 1, 2, 5, 10, 30],\n registers: [registry],\n});\n\nexport const llmInferenceTotal = new Counter({\n name: 'junando_llm_inference_total',\n help: 'Total number of LLM inference calls',\n labelNames: ['status'],\n registers: [registry],\n});\n\n/** Tracks inline pipeline failures in local dev mode. */\nexport const pipelineInlineFailuresTotal = new Counter({\n name: 'junando_pipeline_inline_failures_total',\n help: 'Total number of inline pipeline failures in dev mode',\n labelNames: ['reason'],\n registers: [registry],\n});\n\n/** Tracks Redis dedup fallback activations. */\nexport const dedupRedisFailoverTotal = new Counter({\n name: 'junando_dedup_redis_failover_total',\n help: 'Total number of Redis dedup fallback activations',\n registers: [registry],\n});\n\n/** Tracks new alert clusters (dedup: first-time fingerprint). */\nexport const dedupNew = new Counter({\n name: 'junando_dedup_new_total',\n help: 'Total number of new alert clusters (not yet seen)',\n labelNames: ['source'],\n registers: [registry],\n});\n\n/** Tracks duplicate alert clusters (dedup: fingerprint already seen). */\nexport const dedupDuplicate = new Counter({\n name: 'junando_dedup_duplicate_total',\n help: 'Total number of duplicate alert clusters skipped by dedup',\n labelNames: ['source'],\n registers: [registry],\n});\n\n/** Tracks outbound notification attempts by channel and outcome. */\nexport const notificationsTotal = new Counter({\n name: 'junando_notifications_total',\n help: 'Total number of notification attempts',\n labelNames: ['channel', 'outcome'],\n registers: [registry],\n});\n\n/** Tracks approximate number of unprocessed SQS messages (queue lag). */\nexport const sqsQueueLag = new Gauge({\n name: 'junando_sqs_queue_lag',\n help: 'Approximate number of unprocessed messages in the SQS queue',\n labelNames: ['queue_name'],\n registers: [registry],\n});\n\n/** Tracks clusters suppressed by the rule engine, segmented by rule ID. */\nexport const suppressedClusters = new Gauge({\n name: 'junando_suppressed_clusters',\n help: 'Current number of clusters suppressed by the rule engine',\n labelNames: ['rule_id'],\n registers: [registry],\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA,MAAa,WAAW,IAAI,SAAS;AAErC,MAAa,iBAAiB,IAAI,QAAQ;CACxC,MAAM;CACN,MAAM;CACN,YAAY,CAAC,QAAQ;CACrB,WAAW,CAAC,QAAQ;AACtB,CAAC;AAED,MAAa,uBAAuB,IAAI,QAAQ;CAC9C,MAAM;CACN,MAAM;CACN,YAAY,CAAC,YAAY,QAAQ;CACjC,WAAW,CAAC,QAAQ;AACtB,CAAC;AAED,MAAa,kBAAkB,IAAI,QAAQ;CACzC,MAAM;CACN,MAAM;CACN,YAAY,CAAC,QAAQ;CACrB,WAAW,CAAC,QAAQ;AACtB,CAAC;AAED,MAAa,gBAAgB,IAAI,MAAM;CACrC,MAAM;CACN,MAAM;CACN,WAAW,CAAC,QAAQ;AACtB,CAAC;AAED,MAAa,UAAU,IAAI,UAAU;CACnC,MAAM;CACN,MAAM;CACN,YAAY,CAAC,QAAQ;CACrB,SAAS;EAAC;EAAO;EAAM;EAAO;EAAM;EAAK;EAAM;CAAG;CAClD,WAAW,CAAC,QAAQ;AACtB,CAAC;AAED,MAAa,uBAAuB,IAAI,UAAU;CAChD,MAAM;CACN,MAAM;CACN,YAAY,CAAC,OAAO;CACpB,SAAS;EAAC;EAAK;EAAG;EAAG;EAAG;EAAI;CAAE;CAC9B,WAAW,CAAC,QAAQ;AACtB,CAAC;AAED,MAAa,oBAAoB,IAAI,QAAQ;CAC3C,MAAM;CACN,MAAM;CACN,YAAY,CAAC,QAAQ;CACrB,WAAW,CAAC,QAAQ;AACtB,CAAC;;AAGD,MAAa,8BAA8B,IAAI,QAAQ;CACrD,MAAM;CACN,MAAM;CACN,YAAY,CAAC,QAAQ;CACrB,WAAW,CAAC,QAAQ;AACtB,CAAC;;AAGD,MAAa,0BAA0B,IAAI,QAAQ;CACjD,MAAM;CACN,MAAM;CACN,WAAW,CAAC,QAAQ;AACtB,CAAC;;AAGD,MAAa,WAAW,IAAI,QAAQ;CAClC,MAAM;CACN,MAAM;CACN,YAAY,CAAC,QAAQ;CACrB,WAAW,CAAC,QAAQ;AACtB,CAAC;;AAGD,MAAa,iBAAiB,IAAI,QAAQ;CACxC,MAAM;CACN,MAAM;CACN,YAAY,CAAC,QAAQ;CACrB,WAAW,CAAC,QAAQ;AACtB,CAAC;;AAGD,MAAa,qBAAqB,IAAI,QAAQ;CAC5C,MAAM;CACN,MAAM;CACN,YAAY,CAAC,WAAW,SAAS;CACjC,WAAW,CAAC,QAAQ;AACtB,CAAC;;AAGD,MAAa,cAAc,IAAI,MAAM;CACnC,MAAM;CACN,MAAM;CACN,YAAY,CAAC,YAAY;CACzB,WAAW,CAAC,QAAQ;AACtB,CAAC;;AAGD,MAAa,qBAAqB,IAAI,MAAM;CAC1C,MAAM;CACN,MAAM;CACN,YAAY,CAAC,SAAS;CACtB,WAAW,CAAC,QAAQ;AACtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junando/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Core domain types, interfaces, and shared utilities for the Junando alerting platform",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -19,20 +19,20 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@anthropic-ai/sdk": "^0.
|
|
23
|
-
"@google/generative-ai": "^0.
|
|
22
|
+
"@anthropic-ai/sdk": "^0.112.3",
|
|
23
|
+
"@google/generative-ai": "^0.24.1",
|
|
24
24
|
"@types/opossum": "^8.1.9",
|
|
25
|
-
"ioredis": "^5.
|
|
26
|
-
"opossum": "^
|
|
27
|
-
"pino": "^
|
|
25
|
+
"ioredis": "^5.11.1",
|
|
26
|
+
"opossum": "^10.0.0",
|
|
27
|
+
"pino": "^10.3.1",
|
|
28
28
|
"prom-client": "^15.1.3",
|
|
29
29
|
"yaml": "^2.9.0",
|
|
30
|
-
"zod": "^
|
|
30
|
+
"zod": "^4.4.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"
|
|
35
|
-
"typescript": "^
|
|
33
|
+
"@types/node": "^26.1.1",
|
|
34
|
+
"tsdown": "^0.22.12",
|
|
35
|
+
"typescript": "^7.0.2"
|
|
36
36
|
},
|
|
37
37
|
"exports": {
|
|
38
38
|
".": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
|
-
"build": "
|
|
48
|
+
"build": "tsdown",
|
|
49
49
|
"typecheck": "tsc --noEmit",
|
|
50
50
|
"clean": "rm -rf dist"
|
|
51
51
|
}
|
package/dist/chunk-3OJNTHWB.js
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
fromBase64,
|
|
3
|
-
toBase64,
|
|
4
|
-
toHex
|
|
5
|
-
} from "./chunk-H4ND7Z4R.js";
|
|
6
|
-
import {
|
|
7
|
-
fromArrayBuffer,
|
|
8
|
-
toUtf8
|
|
9
|
-
} from "./chunk-ZKH7AMP3.js";
|
|
10
|
-
|
|
11
|
-
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.6.1/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js
|
|
12
|
-
import { Writable } from "stream";
|
|
13
|
-
var Collector = class extends Writable {
|
|
14
|
-
bufferedBytes = [];
|
|
15
|
-
_write(chunk, encoding, callback) {
|
|
16
|
-
this.bufferedBytes.push(chunk);
|
|
17
|
-
callback();
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// ../../node_modules/.pnpm/@smithy+node-http-handler@4.6.1/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js
|
|
22
|
-
var streamCollector = (stream) => {
|
|
23
|
-
if (isReadableStreamInstance(stream)) {
|
|
24
|
-
return collectReadableStream(stream);
|
|
25
|
-
}
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
const collector = new Collector();
|
|
28
|
-
stream.pipe(collector);
|
|
29
|
-
stream.on("error", (err) => {
|
|
30
|
-
collector.end();
|
|
31
|
-
reject(err);
|
|
32
|
-
});
|
|
33
|
-
collector.on("error", reject);
|
|
34
|
-
collector.on("finish", function() {
|
|
35
|
-
const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
|
|
36
|
-
resolve(bytes);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
var isReadableStreamInstance = (stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream;
|
|
41
|
-
async function collectReadableStream(stream) {
|
|
42
|
-
const chunks = [];
|
|
43
|
-
const reader = stream.getReader();
|
|
44
|
-
let isDone = false;
|
|
45
|
-
let length = 0;
|
|
46
|
-
while (!isDone) {
|
|
47
|
-
const { done, value } = await reader.read();
|
|
48
|
-
if (value) {
|
|
49
|
-
chunks.push(value);
|
|
50
|
-
length += value.length;
|
|
51
|
-
}
|
|
52
|
-
isDone = done;
|
|
53
|
-
}
|
|
54
|
-
const collected = new Uint8Array(length);
|
|
55
|
-
let offset = 0;
|
|
56
|
-
for (const chunk of chunks) {
|
|
57
|
-
collected.set(chunk, offset);
|
|
58
|
-
offset += chunk.length;
|
|
59
|
-
}
|
|
60
|
-
return collected;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// ../../node_modules/.pnpm/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-es/sdk-stream-mixin.js
|
|
64
|
-
import { Readable } from "stream";
|
|
65
|
-
|
|
66
|
-
// ../../node_modules/.pnpm/@smithy+fetch-http-handler@5.3.17/node_modules/@smithy/fetch-http-handler/dist-es/stream-collector.js
|
|
67
|
-
var streamCollector2 = async (stream) => {
|
|
68
|
-
if (typeof Blob === "function" && stream instanceof Blob || stream.constructor?.name === "Blob") {
|
|
69
|
-
if (Blob.prototype.arrayBuffer !== void 0) {
|
|
70
|
-
return new Uint8Array(await stream.arrayBuffer());
|
|
71
|
-
}
|
|
72
|
-
return collectBlob(stream);
|
|
73
|
-
}
|
|
74
|
-
return collectStream(stream);
|
|
75
|
-
};
|
|
76
|
-
async function collectBlob(blob) {
|
|
77
|
-
const base64 = await readToBase64(blob);
|
|
78
|
-
const arrayBuffer = fromBase64(base64);
|
|
79
|
-
return new Uint8Array(arrayBuffer);
|
|
80
|
-
}
|
|
81
|
-
async function collectStream(stream) {
|
|
82
|
-
const chunks = [];
|
|
83
|
-
const reader = stream.getReader();
|
|
84
|
-
let isDone = false;
|
|
85
|
-
let length = 0;
|
|
86
|
-
while (!isDone) {
|
|
87
|
-
const { done, value } = await reader.read();
|
|
88
|
-
if (value) {
|
|
89
|
-
chunks.push(value);
|
|
90
|
-
length += value.length;
|
|
91
|
-
}
|
|
92
|
-
isDone = done;
|
|
93
|
-
}
|
|
94
|
-
const collected = new Uint8Array(length);
|
|
95
|
-
let offset = 0;
|
|
96
|
-
for (const chunk of chunks) {
|
|
97
|
-
collected.set(chunk, offset);
|
|
98
|
-
offset += chunk.length;
|
|
99
|
-
}
|
|
100
|
-
return collected;
|
|
101
|
-
}
|
|
102
|
-
function readToBase64(blob) {
|
|
103
|
-
return new Promise((resolve, reject) => {
|
|
104
|
-
const reader = new FileReader();
|
|
105
|
-
reader.onloadend = () => {
|
|
106
|
-
if (reader.readyState !== 2) {
|
|
107
|
-
return reject(new Error("Reader aborted too early"));
|
|
108
|
-
}
|
|
109
|
-
const result = reader.result ?? "";
|
|
110
|
-
const commaIndex = result.indexOf(",");
|
|
111
|
-
const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;
|
|
112
|
-
resolve(result.substring(dataOffset));
|
|
113
|
-
};
|
|
114
|
-
reader.onabort = () => reject(new Error("Read aborted"));
|
|
115
|
-
reader.onerror = () => reject(reader.error);
|
|
116
|
-
reader.readAsDataURL(blob);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// ../../node_modules/.pnpm/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-es/stream-type-check.js
|
|
121
|
-
var isReadableStream = (stream) => typeof ReadableStream === "function" && (stream?.constructor?.name === ReadableStream.name || stream instanceof ReadableStream);
|
|
122
|
-
|
|
123
|
-
// ../../node_modules/.pnpm/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-es/sdk-stream-mixin.browser.js
|
|
124
|
-
var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed.";
|
|
125
|
-
var sdkStreamMixin = (stream) => {
|
|
126
|
-
if (!isBlobInstance(stream) && !isReadableStream(stream)) {
|
|
127
|
-
const name = stream?.__proto__?.constructor?.name || stream;
|
|
128
|
-
throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${name}`);
|
|
129
|
-
}
|
|
130
|
-
let transformed = false;
|
|
131
|
-
const transformToByteArray = async () => {
|
|
132
|
-
if (transformed) {
|
|
133
|
-
throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
|
|
134
|
-
}
|
|
135
|
-
transformed = true;
|
|
136
|
-
return await streamCollector2(stream);
|
|
137
|
-
};
|
|
138
|
-
const blobToWebStream = (blob) => {
|
|
139
|
-
if (typeof blob.stream !== "function") {
|
|
140
|
-
throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\nIf you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");
|
|
141
|
-
}
|
|
142
|
-
return blob.stream();
|
|
143
|
-
};
|
|
144
|
-
return Object.assign(stream, {
|
|
145
|
-
transformToByteArray,
|
|
146
|
-
transformToString: async (encoding) => {
|
|
147
|
-
const buf = await transformToByteArray();
|
|
148
|
-
if (encoding === "base64") {
|
|
149
|
-
return toBase64(buf);
|
|
150
|
-
} else if (encoding === "hex") {
|
|
151
|
-
return toHex(buf);
|
|
152
|
-
} else if (encoding === void 0 || encoding === "utf8" || encoding === "utf-8") {
|
|
153
|
-
return toUtf8(buf);
|
|
154
|
-
} else if (typeof TextDecoder === "function") {
|
|
155
|
-
return new TextDecoder(encoding).decode(buf);
|
|
156
|
-
} else {
|
|
157
|
-
throw new Error("TextDecoder is not available, please make sure polyfill is provided.");
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
transformToWebStream: () => {
|
|
161
|
-
if (transformed) {
|
|
162
|
-
throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
|
|
163
|
-
}
|
|
164
|
-
transformed = true;
|
|
165
|
-
if (isBlobInstance(stream)) {
|
|
166
|
-
return blobToWebStream(stream);
|
|
167
|
-
} else if (isReadableStream(stream)) {
|
|
168
|
-
return stream;
|
|
169
|
-
} else {
|
|
170
|
-
throw new Error(`Cannot transform payload to web stream, got ${stream}`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
var isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob;
|
|
176
|
-
|
|
177
|
-
// ../../node_modules/.pnpm/@smithy+util-stream@4.5.25/node_modules/@smithy/util-stream/dist-es/sdk-stream-mixin.js
|
|
178
|
-
var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED2 = "The stream has already been transformed.";
|
|
179
|
-
var sdkStreamMixin2 = (stream) => {
|
|
180
|
-
if (!(stream instanceof Readable)) {
|
|
181
|
-
try {
|
|
182
|
-
return sdkStreamMixin(stream);
|
|
183
|
-
} catch (e) {
|
|
184
|
-
const name = stream?.__proto__?.constructor?.name || stream;
|
|
185
|
-
throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
let transformed = false;
|
|
189
|
-
const transformToByteArray = async () => {
|
|
190
|
-
if (transformed) {
|
|
191
|
-
throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED2);
|
|
192
|
-
}
|
|
193
|
-
transformed = true;
|
|
194
|
-
return await streamCollector(stream);
|
|
195
|
-
};
|
|
196
|
-
return Object.assign(stream, {
|
|
197
|
-
transformToByteArray,
|
|
198
|
-
transformToString: async (encoding) => {
|
|
199
|
-
const buf = await transformToByteArray();
|
|
200
|
-
if (encoding === void 0 || Buffer.isEncoding(encoding)) {
|
|
201
|
-
return fromArrayBuffer(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding);
|
|
202
|
-
} else {
|
|
203
|
-
const decoder = new TextDecoder(encoding);
|
|
204
|
-
return decoder.decode(buf);
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
transformToWebStream: () => {
|
|
208
|
-
if (transformed) {
|
|
209
|
-
throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED2);
|
|
210
|
-
}
|
|
211
|
-
if (stream.readableFlowing !== null) {
|
|
212
|
-
throw new Error("The stream has been consumed by other callbacks.");
|
|
213
|
-
}
|
|
214
|
-
if (typeof Readable.toWeb !== "function") {
|
|
215
|
-
throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");
|
|
216
|
-
}
|
|
217
|
-
transformed = true;
|
|
218
|
-
return Readable.toWeb(stream);
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
export {
|
|
224
|
-
sdkStreamMixin2 as sdkStreamMixin
|
|
225
|
-
};
|
package/dist/chunk-5LNMHOUT.js
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Uint8ArrayBlobAdapter
|
|
3
|
-
} from "./chunk-MQ4JUE6V.js";
|
|
4
|
-
|
|
5
|
-
// ../../node_modules/.pnpm/@smithy+core@3.24.1/node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/httpRequest.js
|
|
6
|
-
var HttpRequest = class _HttpRequest {
|
|
7
|
-
method;
|
|
8
|
-
protocol;
|
|
9
|
-
hostname;
|
|
10
|
-
port;
|
|
11
|
-
path;
|
|
12
|
-
query;
|
|
13
|
-
headers;
|
|
14
|
-
username;
|
|
15
|
-
password;
|
|
16
|
-
fragment;
|
|
17
|
-
body;
|
|
18
|
-
constructor(options) {
|
|
19
|
-
this.method = options.method || "GET";
|
|
20
|
-
this.hostname = options.hostname || "localhost";
|
|
21
|
-
this.port = options.port;
|
|
22
|
-
this.query = options.query || {};
|
|
23
|
-
this.headers = options.headers || {};
|
|
24
|
-
this.body = options.body;
|
|
25
|
-
this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:";
|
|
26
|
-
this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/";
|
|
27
|
-
this.username = options.username;
|
|
28
|
-
this.password = options.password;
|
|
29
|
-
this.fragment = options.fragment;
|
|
30
|
-
}
|
|
31
|
-
static clone(request) {
|
|
32
|
-
const cloned = new _HttpRequest({
|
|
33
|
-
...request,
|
|
34
|
-
headers: { ...request.headers }
|
|
35
|
-
});
|
|
36
|
-
if (cloned.query) {
|
|
37
|
-
cloned.query = cloneQuery(cloned.query);
|
|
38
|
-
}
|
|
39
|
-
return cloned;
|
|
40
|
-
}
|
|
41
|
-
static isInstance(request) {
|
|
42
|
-
if (!request) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
const req = request;
|
|
46
|
-
return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object";
|
|
47
|
-
}
|
|
48
|
-
clone() {
|
|
49
|
-
return _HttpRequest.clone(this);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
function cloneQuery(query) {
|
|
53
|
-
return Object.keys(query).reduce((carry, paramName) => {
|
|
54
|
-
const param = query[paramName];
|
|
55
|
-
return {
|
|
56
|
-
...carry,
|
|
57
|
-
[paramName]: Array.isArray(param) ? [...param] : param
|
|
58
|
-
};
|
|
59
|
-
}, {});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ../../node_modules/.pnpm/@smithy+core@3.24.1/node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/httpResponse.js
|
|
63
|
-
var HttpResponse = class {
|
|
64
|
-
statusCode;
|
|
65
|
-
reason;
|
|
66
|
-
headers;
|
|
67
|
-
body;
|
|
68
|
-
constructor(options) {
|
|
69
|
-
this.statusCode = options.statusCode;
|
|
70
|
-
this.reason = options.reason;
|
|
71
|
-
this.headers = options.headers || {};
|
|
72
|
-
this.body = options.body;
|
|
73
|
-
}
|
|
74
|
-
static isInstance(response) {
|
|
75
|
-
if (!response)
|
|
76
|
-
return false;
|
|
77
|
-
const resp = response;
|
|
78
|
-
return typeof resp.statusCode === "number" && typeof resp.headers === "object";
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// ../../node_modules/.pnpm/@smithy+core@3.24.1/node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.js
|
|
83
|
-
var getHttpHandlerExtensionConfiguration = (runtimeConfig) => {
|
|
84
|
-
return {
|
|
85
|
-
setHttpHandler(handler) {
|
|
86
|
-
runtimeConfig.httpHandler = handler;
|
|
87
|
-
},
|
|
88
|
-
httpHandler() {
|
|
89
|
-
return runtimeConfig.httpHandler;
|
|
90
|
-
},
|
|
91
|
-
updateHttpClientConfig(key, value) {
|
|
92
|
-
runtimeConfig.httpHandler?.updateHttpClientConfig(key, value);
|
|
93
|
-
},
|
|
94
|
-
httpHandlerConfigs() {
|
|
95
|
-
return runtimeConfig.httpHandler.httpHandlerConfigs();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
var resolveHttpHandlerRuntimeConfig = (httpHandlerExtensionConfiguration) => {
|
|
100
|
-
return {
|
|
101
|
-
httpHandler: httpHandlerExtensionConfiguration.httpHandler()
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// ../../node_modules/.pnpm/@smithy+core@3.24.1/node_modules/@smithy/core/dist-es/submodules/protocols/middleware-content-length/contentLengthMiddleware.js
|
|
106
|
-
var CONTENT_LENGTH_HEADER = "content-length";
|
|
107
|
-
function contentLengthMiddleware(bodyLengthChecker) {
|
|
108
|
-
return (next) => async (args) => {
|
|
109
|
-
const request = args.request;
|
|
110
|
-
if (HttpRequest.isInstance(request)) {
|
|
111
|
-
const { body, headers } = request;
|
|
112
|
-
if (body && Object.keys(headers).map((str) => str.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER) === -1) {
|
|
113
|
-
try {
|
|
114
|
-
const length = bodyLengthChecker(body);
|
|
115
|
-
request.headers = {
|
|
116
|
-
...request.headers,
|
|
117
|
-
[CONTENT_LENGTH_HEADER]: String(length)
|
|
118
|
-
};
|
|
119
|
-
} catch (error) {
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return next({
|
|
124
|
-
...args,
|
|
125
|
-
request
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
var contentLengthMiddlewareOptions = {
|
|
130
|
-
step: "build",
|
|
131
|
-
tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"],
|
|
132
|
-
name: "contentLengthMiddleware",
|
|
133
|
-
override: true
|
|
134
|
-
};
|
|
135
|
-
var getContentLengthPlugin = (options) => ({
|
|
136
|
-
applyToStack: (clientStack) => {
|
|
137
|
-
clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions);
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
// ../../node_modules/.pnpm/@smithy+core@3.24.1/node_modules/@smithy/core/dist-es/submodules/protocols/util-uri-escape/escape-uri.js
|
|
142
|
-
var escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode);
|
|
143
|
-
var hexEncode = (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`;
|
|
144
|
-
|
|
145
|
-
// ../../node_modules/.pnpm/@smithy+core@3.24.1/node_modules/@smithy/core/dist-es/submodules/protocols/querystring-builder/buildQueryString.js
|
|
146
|
-
function buildQueryString(query) {
|
|
147
|
-
const parts = [];
|
|
148
|
-
for (let key of Object.keys(query).sort()) {
|
|
149
|
-
const value = query[key];
|
|
150
|
-
key = escapeUri(key);
|
|
151
|
-
if (Array.isArray(value)) {
|
|
152
|
-
for (let i = 0, iLen = value.length; i < iLen; i++) {
|
|
153
|
-
parts.push(`${key}=${escapeUri(value[i])}`);
|
|
154
|
-
}
|
|
155
|
-
} else {
|
|
156
|
-
let qsEntry = key;
|
|
157
|
-
if (value || typeof value === "string") {
|
|
158
|
-
qsEntry += `=${escapeUri(value)}`;
|
|
159
|
-
}
|
|
160
|
-
parts.push(qsEntry);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return parts.join("&");
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// ../../node_modules/.pnpm/@smithy+core@3.24.1/node_modules/@smithy/core/dist-es/submodules/protocols/querystring-parser/parseQueryString.js
|
|
167
|
-
function parseQueryString(querystring) {
|
|
168
|
-
const query = {};
|
|
169
|
-
querystring = querystring.replace(/^\?/, "");
|
|
170
|
-
if (querystring) {
|
|
171
|
-
for (const pair of querystring.split("&")) {
|
|
172
|
-
let [key, value = null] = pair.split("=");
|
|
173
|
-
key = decodeURIComponent(key);
|
|
174
|
-
if (value) {
|
|
175
|
-
value = decodeURIComponent(value);
|
|
176
|
-
}
|
|
177
|
-
if (!(key in query)) {
|
|
178
|
-
query[key] = value;
|
|
179
|
-
} else if (Array.isArray(query[key])) {
|
|
180
|
-
query[key].push(value);
|
|
181
|
-
} else {
|
|
182
|
-
query[key] = [query[key], value];
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return query;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// ../../node_modules/.pnpm/@smithy+core@3.24.1/node_modules/@smithy/core/dist-es/submodules/protocols/url-parser/parseUrl.js
|
|
190
|
-
var parseUrl = (url) => {
|
|
191
|
-
if (typeof url === "string") {
|
|
192
|
-
return parseUrl(new URL(url));
|
|
193
|
-
}
|
|
194
|
-
const { hostname, pathname, port, protocol, search } = url;
|
|
195
|
-
let query;
|
|
196
|
-
if (search) {
|
|
197
|
-
query = parseQueryString(search);
|
|
198
|
-
}
|
|
199
|
-
return {
|
|
200
|
-
hostname,
|
|
201
|
-
port: port ? parseInt(port) : void 0,
|
|
202
|
-
protocol,
|
|
203
|
-
path: pathname,
|
|
204
|
-
query
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
// ../../node_modules/.pnpm/@smithy+core@3.24.1/node_modules/@smithy/core/dist-es/submodules/protocols/collect-stream-body.js
|
|
209
|
-
var collectBody = async (streamBody = new Uint8Array(), context) => {
|
|
210
|
-
if (streamBody instanceof Uint8Array) {
|
|
211
|
-
return Uint8ArrayBlobAdapter.mutate(streamBody);
|
|
212
|
-
}
|
|
213
|
-
if (!streamBody) {
|
|
214
|
-
return Uint8ArrayBlobAdapter.mutate(new Uint8Array());
|
|
215
|
-
}
|
|
216
|
-
const fromContext = context.streamCollector(streamBody);
|
|
217
|
-
return Uint8ArrayBlobAdapter.mutate(await fromContext);
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
export {
|
|
221
|
-
collectBody,
|
|
222
|
-
HttpRequest,
|
|
223
|
-
HttpResponse,
|
|
224
|
-
getHttpHandlerExtensionConfiguration,
|
|
225
|
-
resolveHttpHandlerRuntimeConfig,
|
|
226
|
-
getContentLengthPlugin,
|
|
227
|
-
buildQueryString,
|
|
228
|
-
parseUrl
|
|
229
|
-
};
|