@gloocan/cat-inspector 0.1.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.
- package/dist/artifact-helpers.d.ts +4 -0
- package/dist/artifact-helpers.d.ts.map +1 -0
- package/dist/artifact-helpers.js +21 -0
- package/dist/artifact-helpers.js.map +1 -0
- package/dist/ast/get-all-ts-files.d.ts +5 -0
- package/dist/ast/get-all-ts-files.d.ts.map +1 -0
- package/dist/ast/get-all-ts-files.js +36 -0
- package/dist/ast/get-all-ts-files.js.map +1 -0
- package/dist/ast/merge-ast.d.ts +3 -0
- package/dist/ast/merge-ast.d.ts.map +1 -0
- package/dist/ast/merge-ast.js +40 -0
- package/dist/ast/merge-ast.js.map +1 -0
- package/dist/ast/run-ast-scanner.d.ts +15 -0
- package/dist/ast/run-ast-scanner.d.ts.map +1 -0
- package/dist/ast/run-ast-scanner.js +44 -0
- package/dist/ast/run-ast-scanner.js.map +1 -0
- package/dist/ast/scan-for-labels.d.ts +20 -0
- package/dist/ast/scan-for-labels.d.ts.map +1 -0
- package/dist/ast/scan-for-labels.js +88 -0
- package/dist/ast/scan-for-labels.js.map +1 -0
- package/dist/ast/scan-for-returns.d.ts +13 -0
- package/dist/ast/scan-for-returns.d.ts.map +1 -0
- package/dist/ast/scan-for-returns.js +48 -0
- package/dist/ast/scan-for-returns.js.map +1 -0
- package/dist/ast/type-expand.d.ts +16 -0
- package/dist/ast/type-expand.d.ts.map +1 -0
- package/dist/ast/type-expand.js +118 -0
- package/dist/ast/type-expand.js.map +1 -0
- package/dist/ast/visit-node.d.ts +31 -0
- package/dist/ast/visit-node.d.ts.map +1 -0
- package/dist/ast/visit-node.js +298 -0
- package/dist/ast/visit-node.js.map +1 -0
- package/dist/bootstrap.d.ts +105 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +121 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/catalog-bootstrap-cache.d.ts +23 -0
- package/dist/catalog-bootstrap-cache.d.ts.map +1 -0
- package/dist/catalog-bootstrap-cache.js +54 -0
- package/dist/catalog-bootstrap-cache.js.map +1 -0
- package/dist/catalog-fingerprint.d.ts +20 -0
- package/dist/catalog-fingerprint.d.ts.map +1 -0
- package/dist/catalog-fingerprint.js +57 -0
- package/dist/catalog-fingerprint.js.map +1 -0
- package/dist/coverage/compute-coverage.d.ts +41 -0
- package/dist/coverage/compute-coverage.d.ts.map +1 -0
- package/dist/coverage/compute-coverage.js +229 -0
- package/dist/coverage/compute-coverage.js.map +1 -0
- package/dist/coverage/scan-all-service-candidates.d.ts +15 -0
- package/dist/coverage/scan-all-service-candidates.d.ts.map +1 -0
- package/dist/coverage/scan-all-service-candidates.js +73 -0
- package/dist/coverage/scan-all-service-candidates.js.map +1 -0
- package/dist/coverage/scan-express-candidates.d.ts +17 -0
- package/dist/coverage/scan-express-candidates.d.ts.map +1 -0
- package/dist/coverage/scan-express-candidates.js +300 -0
- package/dist/coverage/scan-express-candidates.js.map +1 -0
- package/dist/coverage/scan-reachable-services.d.ts +13 -0
- package/dist/coverage/scan-reachable-services.d.ts.map +1 -0
- package/dist/coverage/scan-reachable-services.js +469 -0
- package/dist/coverage/scan-reachable-services.js.map +1 -0
- package/dist/coverage/types.d.ts +32 -0
- package/dist/coverage/types.d.ts.map +1 -0
- package/dist/coverage/types.js +2 -0
- package/dist/coverage/types.js.map +1 -0
- package/dist/decorators/cat-class.d.ts +11 -0
- package/dist/decorators/cat-class.d.ts.map +1 -0
- package/dist/decorators/cat-class.js +20 -0
- package/dist/decorators/cat-class.js.map +1 -0
- package/dist/decorators/cat.d.ts +3 -0
- package/dist/decorators/cat.d.ts.map +1 -0
- package/dist/decorators/cat.js +102 -0
- package/dist/decorators/cat.js.map +1 -0
- package/dist/express-inspector-correlation.d.ts +23 -0
- package/dist/express-inspector-correlation.d.ts.map +1 -0
- package/dist/express-inspector-correlation.js +50 -0
- package/dist/express-inspector-correlation.js.map +1 -0
- package/dist/express-playground-mocks.d.ts +28 -0
- package/dist/express-playground-mocks.d.ts.map +1 -0
- package/dist/express-playground-mocks.js +55 -0
- package/dist/express-playground-mocks.js.map +1 -0
- package/dist/express-qa-host-minio-upload.d.ts +16 -0
- package/dist/express-qa-host-minio-upload.d.ts.map +1 -0
- package/dist/express-qa-host-minio-upload.js +56 -0
- package/dist/express-qa-host-minio-upload.js.map +1 -0
- package/dist/express.d.ts +21 -0
- package/dist/express.d.ts.map +1 -0
- package/dist/express.js +167 -0
- package/dist/express.js.map +1 -0
- package/dist/functional.d.ts +15 -0
- package/dist/functional.d.ts.map +1 -0
- package/dist/functional.js +165 -0
- package/dist/functional.js.map +1 -0
- package/dist/graph/relationships.d.ts +9 -0
- package/dist/graph/relationships.d.ts.map +1 -0
- package/dist/graph/relationships.js +92 -0
- package/dist/graph/relationships.js.map +1 -0
- package/dist/http-bridge-registry.d.ts +26 -0
- package/dist/http-bridge-registry.d.ts.map +1 -0
- package/dist/http-bridge-registry.js +39 -0
- package/dist/http-bridge-registry.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/invoke-policy.d.ts +34 -0
- package/dist/invoke-policy.d.ts.map +1 -0
- package/dist/invoke-policy.js +72 -0
- package/dist/invoke-policy.js.map +1 -0
- package/dist/invoke-runtime-config.d.ts +4 -0
- package/dist/invoke-runtime-config.d.ts.map +1 -0
- package/dist/invoke-runtime-config.js +15 -0
- package/dist/invoke-runtime-config.js.map +1 -0
- package/dist/jobs/in-memory-job-registry.d.ts +21 -0
- package/dist/jobs/in-memory-job-registry.d.ts.map +1 -0
- package/dist/jobs/in-memory-job-registry.js +44 -0
- package/dist/jobs/in-memory-job-registry.js.map +1 -0
- package/dist/logger.d.ts +9 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +17 -0
- package/dist/logger.js.map +1 -0
- package/dist/openapi/registry-to-openapi.d.ts +11 -0
- package/dist/openapi/registry-to-openapi.d.ts.map +1 -0
- package/dist/openapi/registry-to-openapi.js +61 -0
- package/dist/openapi/registry-to-openapi.js.map +1 -0
- package/dist/registry-state.d.ts +107 -0
- package/dist/registry-state.d.ts.map +1 -0
- package/dist/registry-state.js +302 -0
- package/dist/registry-state.js.map +1 -0
- package/dist/return.d.ts +14 -0
- package/dist/return.d.ts.map +1 -0
- package/dist/return.js +107 -0
- package/dist/return.js.map +1 -0
- package/dist/rpc.d.ts +7 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +287 -0
- package/dist/rpc.js.map +1 -0
- package/dist/serialize-rpc-result.d.ts +38 -0
- package/dist/serialize-rpc-result.d.ts.map +1 -0
- package/dist/serialize-rpc-result.js +132 -0
- package/dist/serialize-rpc-result.js.map +1 -0
- package/dist/session-store.d.ts +9 -0
- package/dist/session-store.d.ts.map +1 -0
- package/dist/session-store.js +19 -0
- package/dist/session-store.js.map +1 -0
- package/dist/source-utils.d.ts +19 -0
- package/dist/source-utils.d.ts.map +1 -0
- package/dist/source-utils.js +65 -0
- package/dist/source-utils.js.map +1 -0
- package/dist/transport/remote-bridge-cli.d.ts +2 -0
- package/dist/transport/remote-bridge-cli.d.ts.map +1 -0
- package/dist/transport/remote-bridge-cli.js +12 -0
- package/dist/transport/remote-bridge-cli.js.map +1 -0
- package/dist/transport/remote-inspector-bridge.d.ts +18 -0
- package/dist/transport/remote-inspector-bridge.d.ts.map +1 -0
- package/dist/transport/remote-inspector-bridge.js +71 -0
- package/dist/transport/remote-inspector-bridge.js.map +1 -0
- package/dist/transport/socket-io-playground.d.ts +78 -0
- package/dist/transport/socket-io-playground.d.ts.map +1 -0
- package/dist/transport/socket-io-playground.js +875 -0
- package/dist/transport/socket-io-playground.js.map +1 -0
- package/dist/transport/socket-io.d.ts +4 -0
- package/dist/transport/socket-io.d.ts.map +1 -0
- package/dist/transport/socket-io.js +4 -0
- package/dist/transport/socket-io.js.map +1 -0
- package/dist/transport/ws-server.d.ts +42 -0
- package/dist/transport/ws-server.d.ts.map +1 -0
- package/dist/transport/ws-server.js +429 -0
- package/dist/transport/ws-server.js.map +1 -0
- package/dist/type-string-normalize.d.ts +24 -0
- package/dist/type-string-normalize.d.ts.map +1 -0
- package/dist/type-string-normalize.js +178 -0
- package/dist/type-string-normalize.js.map +1 -0
- package/dist/types.d.ts +218 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/upload/fetch-file-url.d.ts +24 -0
- package/dist/upload/fetch-file-url.d.ts.map +1 -0
- package/dist/upload/fetch-file-url.js +130 -0
- package/dist/upload/fetch-file-url.js.map +1 -0
- package/dist/upload/host-minio-client.d.ts +30 -0
- package/dist/upload/host-minio-client.d.ts.map +1 -0
- package/dist/upload/host-minio-client.js +56 -0
- package/dist/upload/host-minio-client.js.map +1 -0
- package/dist/upload/materialize.d.ts +110 -0
- package/dist/upload/materialize.d.ts.map +1 -0
- package/dist/upload/materialize.js +466 -0
- package/dist/upload/materialize.js.map +1 -0
- package/dist/upload/upload-store.d.ts +44 -0
- package/dist/upload/upload-store.d.ts.map +1 -0
- package/dist/upload/upload-store.js +86 -0
- package/dist/upload/upload-store.js.map +1 -0
- package/dist/validate-params-json-schema.d.ts +13 -0
- package/dist/validate-params-json-schema.d.ts.map +1 -0
- package/dist/validate-params-json-schema.js +37 -0
- package/dist/validate-params-json-schema.js.map +1 -0
- package/dist/validate-return-json-schema.d.ts +9 -0
- package/dist/validate-return-json-schema.d.ts.map +1 -0
- package/dist/validate-return-json-schema.js +33 -0
- package/dist/validate-return-json-schema.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize TypeScript `typeToString` output for comparison with `getType(result)` strings.
|
|
3
|
+
* Best-effort: peels `Labeled<"L", T>`, optional `Readonly<T>`, `Promise<T>`, and checks union membership.
|
|
4
|
+
*/
|
|
5
|
+
/** Split `a | b | c` at top-level `|` respecting `<>` and `()` depth. */
|
|
6
|
+
export function splitTopLevelUnion(s) {
|
|
7
|
+
const t = s.trim();
|
|
8
|
+
if (!t.includes('|'))
|
|
9
|
+
return [t];
|
|
10
|
+
const parts = [];
|
|
11
|
+
let depth = 0;
|
|
12
|
+
let start = 0;
|
|
13
|
+
for (let i = 0; i < t.length; i++) {
|
|
14
|
+
const c = t[i];
|
|
15
|
+
if (c === '<' || c === '(')
|
|
16
|
+
depth++;
|
|
17
|
+
else if (c === '>' || c === ')')
|
|
18
|
+
depth = Math.max(0, depth - 1);
|
|
19
|
+
else if (c === '|' && depth === 0) {
|
|
20
|
+
parts.push(t.slice(start, i).trim());
|
|
21
|
+
start = i + 1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
parts.push(t.slice(start).trim());
|
|
25
|
+
return parts.filter(Boolean);
|
|
26
|
+
}
|
|
27
|
+
function splitFirstGenericArg(content) {
|
|
28
|
+
let depth = 0;
|
|
29
|
+
for (let i = 0; i < content.length; i++) {
|
|
30
|
+
const c = content[i];
|
|
31
|
+
if (c === '<' || c === '(')
|
|
32
|
+
depth++;
|
|
33
|
+
else if (c === '>' || c === ')')
|
|
34
|
+
depth = Math.max(0, depth - 1);
|
|
35
|
+
else if (c === ',' && depth === 0) {
|
|
36
|
+
return [content.slice(0, i).trim(), content.slice(i + 1).trim()];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* If `s` starts with `Labeled<...>`, return the inner payload type `T` (second type arg).
|
|
43
|
+
*/
|
|
44
|
+
export function peelOuterLabeled(s) {
|
|
45
|
+
const t = s.trim();
|
|
46
|
+
const prefix = t.match(/^Labeled\s*</i);
|
|
47
|
+
if (!prefix)
|
|
48
|
+
return null;
|
|
49
|
+
const openAngle = prefix[0].length - 1;
|
|
50
|
+
let depth = 0;
|
|
51
|
+
for (let j = openAngle; j < t.length; j++) {
|
|
52
|
+
const c = t[j];
|
|
53
|
+
if (c === '<')
|
|
54
|
+
depth++;
|
|
55
|
+
else if (c === '>') {
|
|
56
|
+
depth--;
|
|
57
|
+
if (depth === 0) {
|
|
58
|
+
const inner = t.slice(openAngle + 1, j);
|
|
59
|
+
const pair = splitFirstGenericArg(inner);
|
|
60
|
+
if (!pair)
|
|
61
|
+
return null;
|
|
62
|
+
return pair[1].trim();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
/** Strip one layer of `Readonly<T>` / `Readonly<T >` if present. */
|
|
69
|
+
export function peelReadonly(s) {
|
|
70
|
+
const t = s.trim();
|
|
71
|
+
const m = /^Readonly\s*</i.exec(t);
|
|
72
|
+
if (!m || m.index !== 0)
|
|
73
|
+
return null;
|
|
74
|
+
const open = m[0].length - 1;
|
|
75
|
+
let depth = 0;
|
|
76
|
+
for (let j = open; j < t.length; j++) {
|
|
77
|
+
const c = t[j];
|
|
78
|
+
if (c === '<')
|
|
79
|
+
depth++;
|
|
80
|
+
else if (c === '>') {
|
|
81
|
+
depth--;
|
|
82
|
+
if (depth === 0) {
|
|
83
|
+
return t.slice(open + 1, j).trim();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
/** Strip one layer of `Promise<T>` if present (async functions use `Promise<...>` in catalog). */
|
|
90
|
+
export function peelPromise(s) {
|
|
91
|
+
const t = s.trim();
|
|
92
|
+
const m = /^Promise\s*</i.exec(t);
|
|
93
|
+
if (!m || m.index !== 0)
|
|
94
|
+
return null;
|
|
95
|
+
const open = m[0].length - 1;
|
|
96
|
+
let depth = 0;
|
|
97
|
+
for (let j = open; j < t.length; j++) {
|
|
98
|
+
const c = t[j];
|
|
99
|
+
if (c === '<')
|
|
100
|
+
depth++;
|
|
101
|
+
else if (c === '>') {
|
|
102
|
+
depth--;
|
|
103
|
+
if (depth === 0) {
|
|
104
|
+
return t.slice(open + 1, j).trim();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Recursively peel `Labeled`, `Readonly`, and `Promise` wrappers until stable, then trim.
|
|
112
|
+
*/
|
|
113
|
+
export function normalizeReturnTypeForRpcCompare(input) {
|
|
114
|
+
let s = input.trim();
|
|
115
|
+
let prev = '';
|
|
116
|
+
while (s !== prev) {
|
|
117
|
+
prev = s;
|
|
118
|
+
{
|
|
119
|
+
const lower = s.toLowerCase();
|
|
120
|
+
// Treat numeric aliases as `number` for runtime comparisons.
|
|
121
|
+
if (lower === 'int' ||
|
|
122
|
+
lower === 'integer' ||
|
|
123
|
+
lower === 'int32' ||
|
|
124
|
+
lower === 'int64' ||
|
|
125
|
+
lower === 'float' ||
|
|
126
|
+
lower === 'float32' ||
|
|
127
|
+
lower === 'float64' ||
|
|
128
|
+
lower === 'double' ||
|
|
129
|
+
lower === 'decimal') {
|
|
130
|
+
s = 'number';
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// JS runtime uses `undefined` for `void` returns.
|
|
135
|
+
if (s === 'void') {
|
|
136
|
+
s = 'undefined';
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
const l = peelOuterLabeled(s);
|
|
140
|
+
if (l !== null) {
|
|
141
|
+
s = l;
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
const r = peelReadonly(s);
|
|
145
|
+
if (r !== null) {
|
|
146
|
+
s = r;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
const p = peelPromise(s);
|
|
150
|
+
if (p !== null) {
|
|
151
|
+
s = p;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
// Runtime `returnType` is coarse for objects (`object`), while TypeScript
|
|
155
|
+
// declarations can be object-literals (`{ a: number }`). Treat object-literals as `object`.
|
|
156
|
+
if (s.startsWith('{') && s.endsWith('}')) {
|
|
157
|
+
s = 'object';
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return s.trim();
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* True if normalized `expected` equals normalized `actual`, or if `expected` is a union
|
|
165
|
+
* and `actual` matches any union member after normalization.
|
|
166
|
+
*/
|
|
167
|
+
export function typesMatchForRpc(expected, actual) {
|
|
168
|
+
const expN = normalizeReturnTypeForRpcCompare(expected);
|
|
169
|
+
const actN = normalizeReturnTypeForRpcCompare(actual);
|
|
170
|
+
if (expN === actN)
|
|
171
|
+
return true;
|
|
172
|
+
const members = splitTopLevelUnion(expN);
|
|
173
|
+
if (members.length > 1) {
|
|
174
|
+
return members.some((m) => normalizeReturnTypeForRpcCompare(m) === actN);
|
|
175
|
+
}
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=type-string-normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-string-normalize.js","sourceRoot":"","sources":["../src/type-string-normalize.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,yEAAyE;AACzE,MAAM,UAAU,kBAAkB,CAAC,CAAS;IAC3C,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;IAClB,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IAChC,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAA;QACf,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG;YAAE,KAAK,EAAE,CAA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C,GAAG,CAAC,CAAA;YACL,SAAQ;QACT,CAAC;QACD,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;QACxB,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAChB,CAAC,GAAG,CAAC,CAAA;YACL,SAAQ;QACT,CAAC;QACD,0EAA0E;QAC1E,4FAA4F;QAC5F,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,CAAC,GAAG,QAAQ,CAAA;YACZ,SAAQ;QACT,CAAC;IACF,CAAC;IACD,OAAO,CAAC,CAAC,IAAI,EAAE,CAAA;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,MAAc;IAChE,MAAM,IAAI,GAAG,gCAAgC,CAAC,QAAQ,CAAC,CAAA;IACvD,MAAM,IAAI,GAAG,gCAAgC,CAAC,MAAM,CAAC,CAAA;IACrD,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IAC9B,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAA;IACxC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gCAAgC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAA;IACzE,CAAC;IACD,OAAO,KAAK,CAAA;AACb,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
export declare const PROTOCOL_VERSION: 10;
|
|
2
|
+
export interface ReturnEntry {
|
|
3
|
+
label: string;
|
|
4
|
+
type: string | null;
|
|
5
|
+
status: 'pending' | 'resolved';
|
|
6
|
+
}
|
|
7
|
+
export interface ErrorEntry {
|
|
8
|
+
label: string;
|
|
9
|
+
type: string | null;
|
|
10
|
+
message: string | null;
|
|
11
|
+
status: 'pending' | 'resolved';
|
|
12
|
+
}
|
|
13
|
+
export interface ApiResponseEntry {
|
|
14
|
+
label: string;
|
|
15
|
+
statusCode: number | null;
|
|
16
|
+
bodyShape: string | null;
|
|
17
|
+
status: 'pending' | 'resolved';
|
|
18
|
+
}
|
|
19
|
+
export type CatMode = 'service' | 'api_candidate' | 'api';
|
|
20
|
+
export type ParamKind = 'json' | 'file' | 'files';
|
|
21
|
+
/** Wire encoding for file params on RPC; default on catalog is `ref`. */
|
|
22
|
+
export type QaFileWireMode = 'ref' | 'url';
|
|
23
|
+
/** Where tenant web uploads bytes before persisting `__qaFileUrl` (catalog hint only). */
|
|
24
|
+
export type QaMediaUploadTarget = 'admin' | 'host';
|
|
25
|
+
export type RegistryParam = {
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional richer classification for QA UIs and file materialization.
|
|
30
|
+
*
|
|
31
|
+
* - `file`: param value itself is a single file (File/Blob/Buffer/etc.)
|
|
32
|
+
* - `files`: param value itself is an array of files (File[]/Blob[]/Buffer[]/etc.)
|
|
33
|
+
* - `json`: default / everything else
|
|
34
|
+
*/
|
|
35
|
+
kind?: ParamKind;
|
|
36
|
+
/** Nested single-file fields inside an object param (e.g. `input.file`). */
|
|
37
|
+
filePaths?: string[];
|
|
38
|
+
/** Nested multi-file (array-of-file) fields inside an object param (e.g. `input.attachments`). */
|
|
39
|
+
fileArrayPaths?: string[];
|
|
40
|
+
/** Copied from host bootstrap for QA UI (scenario builder). Omitted for non-file params. */
|
|
41
|
+
qaFileWire?: QaFileWireMode;
|
|
42
|
+
/** When `qaFileWire` is `url`, which upload API the UI should use. */
|
|
43
|
+
qaMediaUpload?: QaMediaUploadTarget;
|
|
44
|
+
};
|
|
45
|
+
export interface RegistryEntry {
|
|
46
|
+
mode: CatMode;
|
|
47
|
+
className: string;
|
|
48
|
+
method: string;
|
|
49
|
+
style: 'class' | 'function';
|
|
50
|
+
body: string;
|
|
51
|
+
params: RegistryParam[];
|
|
52
|
+
declaredReturn: string;
|
|
53
|
+
returns: ReturnEntry[];
|
|
54
|
+
errors: ErrorEntry[];
|
|
55
|
+
children: string[];
|
|
56
|
+
parents: string[];
|
|
57
|
+
route: string | null;
|
|
58
|
+
httpMethod: string | null;
|
|
59
|
+
apiResponses: ApiResponseEntry[];
|
|
60
|
+
serviceLinks: string[];
|
|
61
|
+
pipelineId: string | null;
|
|
62
|
+
pipelineIndex: number | null;
|
|
63
|
+
/** Optional JSON Schema (draft-07 subset) for the entire positional `args` array (tuple-style). */
|
|
64
|
+
paramsJsonSchema?: Record<string, unknown> | null;
|
|
65
|
+
/** Optional JSON Schema (draft-07 subset) for QA validation of RPC `result` */
|
|
66
|
+
returnJsonSchema?: Record<string, unknown> | null;
|
|
67
|
+
/** When `http_synthetic`, `executeRPC` runs in-process HTTP via `registerHttpBridgeRoute` instead of `originalFn`. */
|
|
68
|
+
invokeKind?: 'rpc' | 'http_synthetic';
|
|
69
|
+
/** For Express handler matching (CatRouter / registerCatPipeline) */
|
|
70
|
+
originalFn: Function;
|
|
71
|
+
}
|
|
72
|
+
export interface RpcErrorDetail {
|
|
73
|
+
message: string;
|
|
74
|
+
stack: string | null;
|
|
75
|
+
layer: 'validation' | 'expected' | 'unexpected';
|
|
76
|
+
/** Machine-readable code (e.g. `FN_NOT_FOUND`, `RATE_LIMITED`); optional for back-compat. */
|
|
77
|
+
code?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface RpcArtifactRef {
|
|
80
|
+
kind: string;
|
|
81
|
+
uploadUrl?: string;
|
|
82
|
+
objectKey?: string;
|
|
83
|
+
expiresAt?: string;
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
}
|
|
86
|
+
export interface RpcResponse {
|
|
87
|
+
type: 'RPC_RESPONSE';
|
|
88
|
+
requestId: string;
|
|
89
|
+
fnKey: string;
|
|
90
|
+
status: 'ok' | 'error';
|
|
91
|
+
result: unknown;
|
|
92
|
+
returnType: string;
|
|
93
|
+
/** Runtime `getShape(result)` when status is ok; null on error */
|
|
94
|
+
returnShape: string | null;
|
|
95
|
+
label: string | null;
|
|
96
|
+
duration: string;
|
|
97
|
+
error: RpcErrorDetail | null;
|
|
98
|
+
/** Optional artifact handles (protocol v7+). */
|
|
99
|
+
artifacts?: RpcArtifactRef[];
|
|
100
|
+
}
|
|
101
|
+
export interface CoverageRequest {
|
|
102
|
+
type: 'COVERAGE_REQUEST';
|
|
103
|
+
}
|
|
104
|
+
export interface CoverageReportWire {
|
|
105
|
+
type: 'COVERAGE_REPORT';
|
|
106
|
+
protocolVersion: typeof PROTOCOL_VERSION;
|
|
107
|
+
/** Present on success */
|
|
108
|
+
report?: unknown;
|
|
109
|
+
/** Present on failure */
|
|
110
|
+
error?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface BootstrapEvent {
|
|
113
|
+
event: 'BOOTSTRAP';
|
|
114
|
+
protocolVersion: typeof PROTOCOL_VERSION;
|
|
115
|
+
registry: Record<string, RegistryEntry>;
|
|
116
|
+
tree: object[];
|
|
117
|
+
/** v9+: wire mode for file params (`ref` = __qaFileRef, `url` = __qaFileUrl). */
|
|
118
|
+
qaFileWire?: {
|
|
119
|
+
mode: QaFileWireMode;
|
|
120
|
+
};
|
|
121
|
+
/** v9+: catalog hint for URL-mode uploads (no secrets). */
|
|
122
|
+
qaMediaUpload?: {
|
|
123
|
+
target: QaMediaUploadTarget;
|
|
124
|
+
};
|
|
125
|
+
/** v9+: invoke-time URL fetch allowlist (hostnames only). */
|
|
126
|
+
fileUrl?: {
|
|
127
|
+
allowedHosts: string[];
|
|
128
|
+
maxDownloadBytes: number;
|
|
129
|
+
timeoutMs: number;
|
|
130
|
+
maxRedirects?: number;
|
|
131
|
+
allowHttp?: boolean;
|
|
132
|
+
};
|
|
133
|
+
/** v9+: HTTPS base for host-only Minio upload when `qaMediaUpload.target === 'host'` (no credentials). */
|
|
134
|
+
qaMediaUploadHostUploadUrl?: string;
|
|
135
|
+
/** v10+: when true, tenant may stream bytes over Socket.IO `qa:hostMedia:*` instead of HTTP `qaMediaUploadHostUploadUrl`. */
|
|
136
|
+
qaHostMediaUploadViaSocket?: boolean;
|
|
137
|
+
}
|
|
138
|
+
export interface ReturnResolvedEvent {
|
|
139
|
+
event: 'RETURN_RESOLVED';
|
|
140
|
+
protocolVersion: typeof PROTOCOL_VERSION;
|
|
141
|
+
fnKey: string;
|
|
142
|
+
label: string;
|
|
143
|
+
type: string;
|
|
144
|
+
timestamp: string;
|
|
145
|
+
/** Optional: attach correlation for HTTP-originated traces */
|
|
146
|
+
correlationId?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface ErrorThrownEvent {
|
|
149
|
+
event: 'ERROR_THROWN';
|
|
150
|
+
protocolVersion: typeof PROTOCOL_VERSION;
|
|
151
|
+
fnKey: string;
|
|
152
|
+
label: string;
|
|
153
|
+
layer: RpcErrorDetail['layer'];
|
|
154
|
+
message: string;
|
|
155
|
+
stack: string | null;
|
|
156
|
+
timestamp: string;
|
|
157
|
+
correlationId?: string;
|
|
158
|
+
}
|
|
159
|
+
export interface ApiResponseEvent {
|
|
160
|
+
event: 'API_RESPONSE';
|
|
161
|
+
protocolVersion: typeof PROTOCOL_VERSION;
|
|
162
|
+
endpointKey: string;
|
|
163
|
+
/**
|
|
164
|
+
* Optional: which pipeline handler produced this response.
|
|
165
|
+
* When middleware returns early (no next()), this should be that middleware fnKey so UI can mark it as fail/warn.
|
|
166
|
+
*/
|
|
167
|
+
producerFnKey?: string | null;
|
|
168
|
+
label: string;
|
|
169
|
+
statusCode: number;
|
|
170
|
+
bodyShape: string;
|
|
171
|
+
/**
|
|
172
|
+
* Optional JSON payload for debugging/QA (may be omitted/redacted/size-limited).
|
|
173
|
+
* Intended to help QA see validation issues without guessing from `bodyShape`.
|
|
174
|
+
*/
|
|
175
|
+
body?: unknown;
|
|
176
|
+
timestamp: string;
|
|
177
|
+
correlationId?: string;
|
|
178
|
+
}
|
|
179
|
+
export interface MiddlewareNextEvent {
|
|
180
|
+
event: 'MIDDLEWARE_NEXT';
|
|
181
|
+
protocolVersion: typeof PROTOCOL_VERSION;
|
|
182
|
+
/** Middleware fnKey (matches expected pipeline handler title) */
|
|
183
|
+
fnKey: string;
|
|
184
|
+
/** Optional label for display, e.g. NEXT */
|
|
185
|
+
label?: string;
|
|
186
|
+
timestamp: string;
|
|
187
|
+
correlationId?: string;
|
|
188
|
+
}
|
|
189
|
+
export interface RpcExecutedEvent {
|
|
190
|
+
event: 'RPC_EXECUTED';
|
|
191
|
+
protocolVersion: typeof PROTOCOL_VERSION;
|
|
192
|
+
requestId: string;
|
|
193
|
+
fnKey: string;
|
|
194
|
+
label: string | null;
|
|
195
|
+
status: 'ok' | 'error';
|
|
196
|
+
duration: string;
|
|
197
|
+
timestamp: string;
|
|
198
|
+
}
|
|
199
|
+
/** Server → client job progress (inspector broadcast / optional strict parsers). */
|
|
200
|
+
export interface JobProgressWireEvent {
|
|
201
|
+
event: 'JOB_PROGRESS';
|
|
202
|
+
protocolVersion: typeof PROTOCOL_VERSION;
|
|
203
|
+
jobId: string;
|
|
204
|
+
status: 'queued' | 'running' | 'done' | 'failed';
|
|
205
|
+
percent?: number;
|
|
206
|
+
detail?: string;
|
|
207
|
+
timestamp: string;
|
|
208
|
+
}
|
|
209
|
+
/** Server → client session snapshot after `SESSION_CREATE` / `SESSION_STEP` on WebSocket transport. */
|
|
210
|
+
export interface SessionStateWireMessage {
|
|
211
|
+
type: 'SESSION_STATE';
|
|
212
|
+
protocolVersion: typeof PROTOCOL_VERSION;
|
|
213
|
+
requestId: string;
|
|
214
|
+
sessionId: string;
|
|
215
|
+
data: Record<string, unknown>;
|
|
216
|
+
}
|
|
217
|
+
export type InspectorWireEvent = BootstrapEvent | ReturnResolvedEvent | ErrorThrownEvent | ApiResponseEvent | MiddlewareNextEvent | RpcExecutedEvent | RpcResponse | CoverageReportWire | JobProgressWireEvent;
|
|
218
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,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AAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC7B;AAED,MAAM,MAAM,kBAAkB,GAC3B,cAAc,GACd,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,WAAW,GACX,kBAAkB,GAClB,oBAAoB,CAAA"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAW,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTPS fetch for __qaFileUrl materialization (SSRF-safe allowlist, size cap, timeout).
|
|
3
|
+
*/
|
|
4
|
+
export type FetchFileUrlOptions = {
|
|
5
|
+
/** Hostnames allowed (exact match, case-insensitive). Entry starting with `.` matches hostname suffix (e.g. `.amazonaws.com`). */
|
|
6
|
+
allowedHosts: string[];
|
|
7
|
+
maxDownloadBytes: number;
|
|
8
|
+
timeoutMs: number;
|
|
9
|
+
/** Default 3 */
|
|
10
|
+
maxRedirects?: number;
|
|
11
|
+
/** When true, allow http: URLs (dev only). Default false. */
|
|
12
|
+
allowHttp?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function isHostnameAllowed(hostname: string, allowedHosts: string[]): boolean;
|
|
15
|
+
export type FetchedFileBytes = {
|
|
16
|
+
buffer: Buffer;
|
|
17
|
+
contentType: string;
|
|
18
|
+
filename: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* GET url, enforce allowlist + max bytes + timeout. Follows redirects up to maxRedirects.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fetchFileUrl(urlString: string, options: FetchFileUrlOptions): Promise<FetchedFileBytes>;
|
|
24
|
+
//# sourceMappingURL=fetch-file-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-file-url.d.ts","sourceRoot":"","sources":["../../src/upload/fetch-file-url.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,mBAAmB,GAAG;IACjC,kIAAkI;IAClI,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAMD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAYnF;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;CAChB,CAAA;AAOD;;GAEG;AACH,wBAAsB,YAAY,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,mBAAmB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,CAwG3B"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTPS fetch for __qaFileUrl materialization (SSRF-safe allowlist, size cap, timeout).
|
|
3
|
+
*/
|
|
4
|
+
function normalizeHost(hostname) {
|
|
5
|
+
return hostname.trim().toLowerCase();
|
|
6
|
+
}
|
|
7
|
+
export function isHostnameAllowed(hostname, allowedHosts) {
|
|
8
|
+
const h = normalizeHost(hostname);
|
|
9
|
+
for (const entry of allowedHosts) {
|
|
10
|
+
const e = entry.trim().toLowerCase();
|
|
11
|
+
if (!e)
|
|
12
|
+
continue;
|
|
13
|
+
if (e.startsWith('.')) {
|
|
14
|
+
if (h === e.slice(1) || h.endsWith(e))
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
else if (h === e) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
function filenameFromUrl(url) {
|
|
24
|
+
const last = url.pathname.split('/').filter(Boolean).pop();
|
|
25
|
+
return last && last.length > 0 ? decodeURIComponent(last) : 'download.bin';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* GET url, enforce allowlist + max bytes + timeout. Follows redirects up to maxRedirects.
|
|
29
|
+
*/
|
|
30
|
+
export async function fetchFileUrl(urlString, options) {
|
|
31
|
+
const { allowedHosts, maxDownloadBytes, timeoutMs, maxRedirects = 3, allowHttp = false } = options;
|
|
32
|
+
if (!allowedHosts.length) {
|
|
33
|
+
throw new Error('FILE_URL_FETCH_FAILED: fileUrl.allowedHosts is empty');
|
|
34
|
+
}
|
|
35
|
+
let current = urlString.trim();
|
|
36
|
+
let redirects = 0;
|
|
37
|
+
while (redirects <= maxRedirects) {
|
|
38
|
+
let url;
|
|
39
|
+
try {
|
|
40
|
+
url = new URL(current);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
throw new Error('FILE_URL_FETCH_FAILED: invalid URL');
|
|
44
|
+
}
|
|
45
|
+
if (url.protocol !== 'https:' && !(allowHttp && url.protocol === 'http:')) {
|
|
46
|
+
throw new Error(`FILE_URL_FETCH_FAILED: only ${allowHttp ? 'http and ' : ''}https URLs are allowed`);
|
|
47
|
+
}
|
|
48
|
+
if (!isHostnameAllowed(url.hostname, allowedHosts)) {
|
|
49
|
+
throw new Error(`FILE_URL_HOST_NOT_ALLOWED: ${url.hostname}`);
|
|
50
|
+
}
|
|
51
|
+
const controller = new AbortController();
|
|
52
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
53
|
+
let res;
|
|
54
|
+
try {
|
|
55
|
+
res = await fetch(current, {
|
|
56
|
+
method: 'GET',
|
|
57
|
+
redirect: 'manual',
|
|
58
|
+
signal: controller.signal,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
const msg = e instanceof Error ? e.message : 'fetch failed';
|
|
63
|
+
if (e?.name === 'AbortError') {
|
|
64
|
+
throw new Error(`FILE_URL_FETCH_FAILED: timeout after ${timeoutMs}ms`);
|
|
65
|
+
}
|
|
66
|
+
throw new Error(`FILE_URL_FETCH_FAILED: ${msg}`);
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
clearTimeout(timer);
|
|
70
|
+
}
|
|
71
|
+
if (res.status >= 300 && res.status < 400) {
|
|
72
|
+
const loc = res.headers.get('location');
|
|
73
|
+
if (!loc)
|
|
74
|
+
throw new Error('FILE_URL_FETCH_FAILED: redirect without Location');
|
|
75
|
+
redirects++;
|
|
76
|
+
if (redirects > maxRedirects)
|
|
77
|
+
throw new Error('FILE_URL_FETCH_FAILED: too many redirects');
|
|
78
|
+
current = new URL(loc, current).href;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (!res.ok) {
|
|
82
|
+
throw new Error(`FILE_URL_FETCH_FAILED: HTTP ${res.status}`);
|
|
83
|
+
}
|
|
84
|
+
const cl = res.headers.get('content-length');
|
|
85
|
+
if (cl !== null) {
|
|
86
|
+
const n = Number(cl);
|
|
87
|
+
if (Number.isFinite(n) && n > maxDownloadBytes) {
|
|
88
|
+
throw new Error(`FILE_URL_TOO_LARGE: Content-Length ${n} exceeds max ${maxDownloadBytes}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const reader = res.body?.getReader();
|
|
92
|
+
if (!reader) {
|
|
93
|
+
const buf = Buffer.from(await res.arrayBuffer());
|
|
94
|
+
if (buf.byteLength > maxDownloadBytes) {
|
|
95
|
+
throw new Error(`FILE_URL_TOO_LARGE: body exceeds max ${maxDownloadBytes}`);
|
|
96
|
+
}
|
|
97
|
+
const contentType = res.headers.get('content-type')?.split(';')[0]?.trim() || 'application/octet-stream';
|
|
98
|
+
return {
|
|
99
|
+
buffer: buf,
|
|
100
|
+
contentType,
|
|
101
|
+
filename: filenameFromUrl(new URL(current)),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const chunks = [];
|
|
105
|
+
let total = 0;
|
|
106
|
+
for (;;) {
|
|
107
|
+
const { done, value } = await reader.read();
|
|
108
|
+
if (done)
|
|
109
|
+
break;
|
|
110
|
+
if (!value)
|
|
111
|
+
continue;
|
|
112
|
+
const buf = Buffer.from(value);
|
|
113
|
+
total += buf.byteLength;
|
|
114
|
+
if (total > maxDownloadBytes) {
|
|
115
|
+
await reader.cancel().catch(() => { });
|
|
116
|
+
throw new Error(`FILE_URL_TOO_LARGE: body exceeds max ${maxDownloadBytes}`);
|
|
117
|
+
}
|
|
118
|
+
chunks.push(buf);
|
|
119
|
+
}
|
|
120
|
+
const buffer = Buffer.concat(chunks);
|
|
121
|
+
const contentType = res.headers.get('content-type')?.split(';')[0]?.trim() || 'application/octet-stream';
|
|
122
|
+
return {
|
|
123
|
+
buffer,
|
|
124
|
+
contentType,
|
|
125
|
+
filename: filenameFromUrl(new URL(current)),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
throw new Error('FILE_URL_FETCH_FAILED: redirect loop');
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=fetch-file-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-file-url.js","sourceRoot":"","sources":["../../src/upload/fetch-file-url.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,SAAS,aAAa,CAAC,QAAgB;IACtC,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;AACrC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,YAAsB;IACzE,MAAM,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IACjC,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;QAClC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;QACpC,IAAI,CAAC,CAAC;YAAE,SAAQ;QAChB,IAA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,GAAG,CAAC,OAAO,CAAC,CAAC;SAC3C,CAAA;IACF,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;AACxD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-held Minio/S3: parse {@link HostMinioOptions} and upload bytes + presign GET (never on catalog wire).
|
|
3
|
+
*/
|
|
4
|
+
import type { HostMinioOptions } from '../bootstrap.js';
|
|
5
|
+
export type ParsedHostMinioClientConfig = {
|
|
6
|
+
endPoint: string;
|
|
7
|
+
port: number;
|
|
8
|
+
useSSL: boolean;
|
|
9
|
+
accessKey: string;
|
|
10
|
+
secretKey: string;
|
|
11
|
+
region?: string;
|
|
12
|
+
pathStyle: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** Parse `HostMinioOptions.endpoint` into Minio `Client` fields (hostname, port, TLS). */
|
|
15
|
+
export declare function parseHostMinioEndpoint(host: HostMinioOptions): ParsedHostMinioClientConfig;
|
|
16
|
+
export type PutBufferAndPresignGetInput = {
|
|
17
|
+
objectKey: string;
|
|
18
|
+
buffer: Buffer;
|
|
19
|
+
contentType: string;
|
|
20
|
+
/** Default 24h */
|
|
21
|
+
getExpirySeconds?: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* `putObject` then `presignedGetObject`. Uses dynamic `import('minio')` so consumers can keep `minio` as optional peer.
|
|
25
|
+
*/
|
|
26
|
+
export declare function putBufferAndPresignGetUrl(host: HostMinioOptions, input: PutBufferAndPresignGetInput): Promise<{
|
|
27
|
+
getUrl: string;
|
|
28
|
+
objectKey: string;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=host-minio-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-minio-client.d.ts","sourceRoot":"","sources":["../../src/upload/host-minio-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAEvD,MAAM,MAAM,2BAA2B,GAAG;IACzC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,0FAA0F;AAC1F,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG,2BAA2B,CA8B1F;AAED,MAAM,MAAM,2BAA2B,GAAG;IACzC,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,kBAAkB;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC9C,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,2BAA2B,GAChC,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAiBhD"}
|