@snyxex/pipex 0.0.0-stage → 1.0.2
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 +30 -0
- package/LICENSE +21 -0
- package/README.md +220 -2
- package/SECURITY.md +41 -0
- package/dist/index.d.mts +765 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/docs/architecture.md +124 -0
- package/docs/encryption-v4-migration.md +45 -0
- package/docs/enterprise.md +280 -0
- package/package.json +91 -4
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,765 @@
|
|
|
1
|
+
import { Duplex, Readable, Transform, TransformCallback, Writable } from "node:stream";
|
|
2
|
+
import { Packr, PackrStream, Unpackr, UnpackrStream } from "msgpackr";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { EventEmitter } from "node:events";
|
|
5
|
+
|
|
6
|
+
//#region src/core/types.d.ts
|
|
7
|
+
interface Logger {
|
|
8
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
9
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
10
|
+
error(message: string, context?: Record<string, unknown>): void;
|
|
11
|
+
debug(message: string, context?: Record<string, unknown>): void;
|
|
12
|
+
}
|
|
13
|
+
interface Span {
|
|
14
|
+
setAttribute(key: string, value: unknown): this;
|
|
15
|
+
addEvent(name: string, attributes?: Record<string, unknown>): this;
|
|
16
|
+
end(): void;
|
|
17
|
+
}
|
|
18
|
+
interface Tracer {
|
|
19
|
+
startSpan(name: string, context?: ProcessorContext): Span;
|
|
20
|
+
}
|
|
21
|
+
interface RetryOptions {
|
|
22
|
+
attempts: number;
|
|
23
|
+
backoff: 'exponential' | 'fixed';
|
|
24
|
+
delayMs: number;
|
|
25
|
+
}
|
|
26
|
+
interface EngineLimits {
|
|
27
|
+
maxInputBytes: number;
|
|
28
|
+
maxOutputBytes: number;
|
|
29
|
+
maxFrameBytes: number;
|
|
30
|
+
maxFrames: number;
|
|
31
|
+
maxConcurrentOperations: number;
|
|
32
|
+
operationTimeoutMs: number;
|
|
33
|
+
maxRetryAttempts: number;
|
|
34
|
+
maxRetryDelayMs: number;
|
|
35
|
+
/** Maximum provider-wrapped data-key bytes accepted in a KMS envelope. */
|
|
36
|
+
maxKmsEncryptedKeyBytes: number;
|
|
37
|
+
/** Maximum UTF-8 bytes accepted for a provider key identifier. */
|
|
38
|
+
maxKmsKeyIdBytes: number;
|
|
39
|
+
}
|
|
40
|
+
interface OperationOptions {
|
|
41
|
+
signal?: AbortSignal;
|
|
42
|
+
timeoutMs?: number;
|
|
43
|
+
}
|
|
44
|
+
/** expectedType must come from trusted application configuration, never the received result. */
|
|
45
|
+
interface BinaryUndoOptions extends OperationOptions {
|
|
46
|
+
expectedType?: string;
|
|
47
|
+
}
|
|
48
|
+
interface StreamPluginContext {
|
|
49
|
+
/** Engine-owned accounting for work that continues after cancellation. */
|
|
50
|
+
readonly track?: (pending: Promise<unknown>) => void;
|
|
51
|
+
readonly requestId: string;
|
|
52
|
+
readonly signal: AbortSignal;
|
|
53
|
+
readonly limits: Readonly<EngineLimits>;
|
|
54
|
+
readonly logger?: Logger;
|
|
55
|
+
readonly tracer?: Tracer;
|
|
56
|
+
}
|
|
57
|
+
interface AuditRecord {
|
|
58
|
+
requestId: string;
|
|
59
|
+
operation: 'pack' | 'unpack' | 'process' | 'reverse';
|
|
60
|
+
pluginChain: string[];
|
|
61
|
+
timestamp: number;
|
|
62
|
+
metadata: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
interface AuditLogger {
|
|
65
|
+
log(record: AuditRecord): void | Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
type KmsOperation = 'encrypt' | 'decrypt' | 'generateDataKey';
|
|
68
|
+
interface KmsProviderCapabilities {
|
|
69
|
+
readonly encrypt: boolean;
|
|
70
|
+
readonly decrypt: boolean;
|
|
71
|
+
readonly generateDataKey: boolean;
|
|
72
|
+
}
|
|
73
|
+
interface KmsProvider {
|
|
74
|
+
/** Explicit false disables an operation even when a compatibility stub exists. */
|
|
75
|
+
readonly capabilities?: Partial<KmsProviderCapabilities>;
|
|
76
|
+
encrypt?(data: Buffer, keyId: string, options?: KmsRequestOptions): Promise<Buffer>;
|
|
77
|
+
decrypt?(data: Buffer, keyId: string, options?: KmsRequestOptions): Promise<Buffer>;
|
|
78
|
+
generateDataKey?(keyId: string, options?: KmsRequestOptions): Promise<{
|
|
79
|
+
plaintext: Buffer;
|
|
80
|
+
ciphertext: Buffer;
|
|
81
|
+
}>;
|
|
82
|
+
}
|
|
83
|
+
interface KmsRequestOptions {
|
|
84
|
+
signal?: AbortSignal;
|
|
85
|
+
}
|
|
86
|
+
interface SchemaRegistry {
|
|
87
|
+
getSchema(subject: string, version?: number): Promise<z.ZodType<any>>;
|
|
88
|
+
}
|
|
89
|
+
interface EngineConfig {
|
|
90
|
+
plugins?: {
|
|
91
|
+
name: string;
|
|
92
|
+
options?: unknown;
|
|
93
|
+
}[];
|
|
94
|
+
limits?: Partial<EngineLimits>;
|
|
95
|
+
logger?: Logger;
|
|
96
|
+
tracer?: Tracer;
|
|
97
|
+
auditLogger?: AuditLogger;
|
|
98
|
+
/** Optional caller-owned failure sink; `dlq` is retained for compatibility. */
|
|
99
|
+
dlq?: Writable;
|
|
100
|
+
schema?: z.ZodType<any>;
|
|
101
|
+
schemaRegistry?: SchemaRegistry;
|
|
102
|
+
}
|
|
103
|
+
interface ProcessorContext {
|
|
104
|
+
readonly requestId: string;
|
|
105
|
+
readonly timestamp: number;
|
|
106
|
+
readonly signal?: AbortSignal;
|
|
107
|
+
readonly limits?: Readonly<EngineLimits>;
|
|
108
|
+
metadata: Record<string, unknown>;
|
|
109
|
+
logger?: Logger;
|
|
110
|
+
span?: Span;
|
|
111
|
+
}
|
|
112
|
+
interface ProcessorPlugin {
|
|
113
|
+
readonly name: string;
|
|
114
|
+
readonly version: string;
|
|
115
|
+
readonly reversible?: boolean;
|
|
116
|
+
readonly streaming?: boolean;
|
|
117
|
+
process(data: Buffer, ctx: ProcessorContext): Promise<Buffer> | Buffer;
|
|
118
|
+
reverse?(data: Buffer, ctx: ProcessorContext): Promise<Buffer> | Buffer;
|
|
119
|
+
createStream?(mode: 'compress' | 'decompress', context?: StreamPluginContext): Duplex;
|
|
120
|
+
retryOptions?: RetryOptions;
|
|
121
|
+
}
|
|
122
|
+
type PluginOperation = 'process' | 'reverse' | 'stream';
|
|
123
|
+
/** Normalized, runtime-validated operations exposed by a plugin. */
|
|
124
|
+
interface PluginCapabilities {
|
|
125
|
+
readonly process: true;
|
|
126
|
+
readonly reverse: boolean;
|
|
127
|
+
readonly streaming: boolean;
|
|
128
|
+
readonly streamMode: 'native' | 'fallback' | 'none';
|
|
129
|
+
}
|
|
130
|
+
/** Capability view for a plugin registered with a DataEngine. */
|
|
131
|
+
interface RegisteredPluginCapabilities extends PluginCapabilities {
|
|
132
|
+
readonly plugin: string;
|
|
133
|
+
}
|
|
134
|
+
interface EngineResult {
|
|
135
|
+
readonly data: Buffer;
|
|
136
|
+
readonly originalType: string;
|
|
137
|
+
readonly pipeline: string[];
|
|
138
|
+
readonly metrics: {
|
|
139
|
+
durationMs: number;
|
|
140
|
+
steps: Record<string, number>;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
interface PipeXManifest {
|
|
144
|
+
readonly __pipex_v: 1;
|
|
145
|
+
readonly plugins: string[];
|
|
146
|
+
readonly ts: number;
|
|
147
|
+
}
|
|
148
|
+
declare function isManifest(value: unknown): value is PipeXManifest;
|
|
149
|
+
interface EngineEvents {
|
|
150
|
+
start: [requestId: string];
|
|
151
|
+
'plugin:after': [name: string, durationMs: number];
|
|
152
|
+
progress: [bytes: number, requestId: string];
|
|
153
|
+
error: [err: Error, requestId: string];
|
|
154
|
+
end: [requestId: string, durationMs: number];
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/core/frameLimits.d.ts
|
|
158
|
+
declare function assertMessagePackFrameLimits(input: Buffer | Uint8Array, maxFrameBytes: number, maxFrames?: number): number;
|
|
159
|
+
declare function buildFrameLimitTransform(maxFrameBytes: number, maxFrames: number): Transform;
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/core/resourceLimits.d.ts
|
|
162
|
+
declare const DEFAULT_LIMITS: Readonly<EngineLimits>;
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/core/core.d.ts
|
|
165
|
+
/**
|
|
166
|
+
* Executes a function with automatic retries and backoff.
|
|
167
|
+
*/
|
|
168
|
+
declare function withRetry<T>(fn: () => Promise<T> | T, options?: RetryOptions, logger?: Logger, control?: {
|
|
169
|
+
signal?: AbortSignal;
|
|
170
|
+
limits?: Pick<EngineLimits, 'maxRetryAttempts' | 'maxRetryDelayMs'>;
|
|
171
|
+
track?: (pending: Promise<unknown>) => void;
|
|
172
|
+
}): Promise<T>;
|
|
173
|
+
declare const PIPEX_MANIFEST_KEY: "__pipex_v";
|
|
174
|
+
declare const PACKR: Packr;
|
|
175
|
+
declare const UNPACKR: Unpackr;
|
|
176
|
+
/** @deprecated Use `DEFAULT_LIMITS.maxFrameBytes` or an engine-specific limit. */
|
|
177
|
+
declare const MAX_FRAME_BYTES: number;
|
|
178
|
+
declare const DEFAULT_HIGH_WATER: number;
|
|
179
|
+
type PluginWithStream = ProcessorPlugin & {
|
|
180
|
+
createStream(mode: 'compress' | 'decompress', context?: StreamPluginContext): Duplex;
|
|
181
|
+
};
|
|
182
|
+
declare function hasStreamSupport(p: ProcessorPlugin): p is PluginWithStream;
|
|
183
|
+
/**
|
|
184
|
+
* Returns the effective capabilities of a plugin after validating declarations.
|
|
185
|
+
* Explicit `false` declarations are authoritative, which supports plugins whose
|
|
186
|
+
* implementation is present but disabled by configuration (for example workers).
|
|
187
|
+
*/
|
|
188
|
+
declare function getPluginCapabilities(plugin: ProcessorPlugin): Readonly<PluginCapabilities>;
|
|
189
|
+
/** Query an operation without attempting to execute it. Invalid declarations fail closed. */
|
|
190
|
+
declare function supportsOperation(plugin: ProcessorPlugin, operation: PluginOperation): boolean;
|
|
191
|
+
declare function supportsReverse(plugin: ProcessorPlugin): plugin is ProcessorPlugin & Required<Pick<ProcessorPlugin, 'reverse'>>;
|
|
192
|
+
declare function assertReversiblePipeline(plugins: readonly ProcessorPlugin[]): void;
|
|
193
|
+
declare function assertStreamingPipeline(plugins: readonly ProcessorPlugin[]): void;
|
|
194
|
+
declare function detectType(input: unknown): string;
|
|
195
|
+
declare function toBuffer(input: unknown): Buffer;
|
|
196
|
+
declare const ORIGINAL_TYPES: readonly ["buffer", "object", "array", "string", "number", "boolean", "null", "undefined", "bigint", "json"];
|
|
197
|
+
declare function assertOriginalType(value: unknown): asserts value is string;
|
|
198
|
+
declare function fromBuffer(buffer: Buffer, targetType: string, maxFrameBytes?: number): unknown;
|
|
199
|
+
declare function makeContext(requestId: string, extra?: Record<string, unknown>, logger?: Logger, span?: Span, signal?: AbortSignal, limits?: Readonly<EngineLimits>): ProcessorContext;
|
|
200
|
+
declare function buildManifest(plugins: readonly ProcessorPlugin[]): PipeXManifest;
|
|
201
|
+
/**
|
|
202
|
+
* A passthrough Transform that prepends a single msgpack-encoded manifest frame
|
|
203
|
+
* to the byte stream before forwarding any data chunks.
|
|
204
|
+
* Inserted between PackrStream output and the file destination.
|
|
205
|
+
*/
|
|
206
|
+
declare function buildManifestHeaderTransform(manifest: PipeXManifest): Transform;
|
|
207
|
+
/**
|
|
208
|
+
* Object-mode Transform that sits after UnpackrStream.
|
|
209
|
+
* Intercepts the first decoded frame: if it is a PipeXManifest, captures it
|
|
210
|
+
* via onManifest() and drops it from the output; all other frames pass through.
|
|
211
|
+
*/
|
|
212
|
+
declare function buildManifestExtractTransform(onManifest: (m: PipeXManifest) => void): Transform;
|
|
213
|
+
/** DoS-safe UnpackrStream subclass — rejects oversized raw chunks before decode. */
|
|
214
|
+
declare class GuardedUnpackrStream extends UnpackrStream {
|
|
215
|
+
#private;
|
|
216
|
+
constructor(options?: Record<string, unknown>, maxInputBytes?: number);
|
|
217
|
+
_transform(chunk: Buffer, enc: BufferEncoding, cb: TransformCallback): void;
|
|
218
|
+
}
|
|
219
|
+
/** PackrStream with useRecords disabled (safe default). */
|
|
220
|
+
declare function createPackrStream(): PackrStream;
|
|
221
|
+
/** GuardedUnpackrStream with useRecords disabled. */
|
|
222
|
+
declare function createUnpackrStream(maxInputBytes?: number): GuardedUnpackrStream;
|
|
223
|
+
declare function buildByteLimitTransform(maxBytes: number, label: string): Transform;
|
|
224
|
+
declare function buildObjectLimitTransform(maxFrames: number): Transform;
|
|
225
|
+
/** Rejects known byte-backed values before MessagePack copies their payload. */
|
|
226
|
+
declare function assertKnownValueByteLimit(value: unknown, maxBytes: number, label: string): void;
|
|
227
|
+
declare function buildKnownValueByteLimitTransform(maxBytes: number, label: string): Transform;
|
|
228
|
+
/**
|
|
229
|
+
* Wraps a plugin's process/reverse call in a Transform.
|
|
230
|
+
* requestId is fixed per stream instance — not per chunk — to avoid
|
|
231
|
+
* 60× randomUUID() overhead on high-throughput paths.
|
|
232
|
+
*/
|
|
233
|
+
declare function buildFallbackTransform(plugin: ProcessorPlugin, reverse: boolean, emitProgress?: (bytes: number) => void, logger?: Logger, tracer?: Tracer, dlq?: Writable, streamContext?: StreamPluginContext): Transform;
|
|
234
|
+
/** Serialises JS objects to NDJSON lines. */
|
|
235
|
+
declare function buildNdjsonTransform(): Transform;
|
|
236
|
+
/**
|
|
237
|
+
* Builds the ordered Transform chain from a plugin list.
|
|
238
|
+
* Uses native createStream() when available; falls back to buildFallbackTransform.
|
|
239
|
+
*/
|
|
240
|
+
declare function buildTransformChain(plugins: readonly ProcessorPlugin[], mode: 'compress' | 'decompress', reverse?: boolean, onProgress?: (bytes: number) => void, logger?: Logger, tracer?: Tracer, dlq?: Writable, streamContext?: StreamPluginContext): (Duplex | Transform | PackrStream | GuardedUnpackrStream)[];
|
|
241
|
+
/**
|
|
242
|
+
* Runs an arbitrary pipeline: Source → [...Transforms] → Destination.
|
|
243
|
+
* The `any` cast is scoped to this single call site — nowhere else.
|
|
244
|
+
*/
|
|
245
|
+
declare function runPipeline(source: Readable, transforms: (Duplex | Transform | PackrStream | GuardedUnpackrStream)[], destination: Writable, options?: {
|
|
246
|
+
signal?: AbortSignal;
|
|
247
|
+
}): Promise<void>;
|
|
248
|
+
declare function assertExists(inputPath: string, allowedRoot?: string): string;
|
|
249
|
+
declare function resolveOutputPath(outputPath: string, allowedRoot?: string): string;
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/core/controllers/FileController.d.ts
|
|
252
|
+
declare class FileController {
|
|
253
|
+
#private;
|
|
254
|
+
constructor(engine: DataEngine);
|
|
255
|
+
/**
|
|
256
|
+
* Source file → Plugin pipeline (compress) → Destination file.
|
|
257
|
+
*/
|
|
258
|
+
process(inputPath: string, outputPath: string, allowedRoot?: string, options?: OperationOptions): Promise<void>;
|
|
259
|
+
/**
|
|
260
|
+
* Source file → Plugin pipeline (decompress, reversed) → Destination file.
|
|
261
|
+
*/
|
|
262
|
+
reverse(inputPath: string, outputPath: string, allowedRoot?: string, options?: OperationOptions): Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Source file → PackrStream → manifest header → Destination msgpack file.
|
|
265
|
+
*
|
|
266
|
+
* Output format: [ PipeXManifest frame ][ ...data frames ]
|
|
267
|
+
* The serialization-only manifest declares an empty plugin chain.
|
|
268
|
+
*/
|
|
269
|
+
pack(inputPath: string, outputPath: string, allowedRoot?: string, options?: OperationOptions): Promise<void>;
|
|
270
|
+
/**
|
|
271
|
+
* Source msgpack file → UnpackrStream → manifest extraction → NDJSON → Destination file.
|
|
272
|
+
*
|
|
273
|
+
* Fires 'manifest' event with the recovered PipeXManifest before streaming data.
|
|
274
|
+
*/
|
|
275
|
+
unpack(inputPath: string, outputPath: string, allowedRoot?: string, options?: OperationOptions): Promise<void>;
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/core/controllers/BinaryController.d.ts
|
|
279
|
+
declare class BinaryController {
|
|
280
|
+
#private;
|
|
281
|
+
constructor(engine: DataEngine);
|
|
282
|
+
/**
|
|
283
|
+
* Serialise a supported JS value to a msgpack Buffer (synchronous).
|
|
284
|
+
* For streaming large datasets use engine.stream or engine.file.pack instead.
|
|
285
|
+
*/
|
|
286
|
+
pack(data: unknown): Buffer;
|
|
287
|
+
/**
|
|
288
|
+
* Deserialise a msgpack Buffer back to T (synchronous).
|
|
289
|
+
*/
|
|
290
|
+
unpack<T = unknown>(input: Buffer | Uint8Array): T;
|
|
291
|
+
run(input: unknown, options?: OperationOptions): Promise<EngineResult>;
|
|
292
|
+
undo<T = unknown>(result: EngineResult, options?: BinaryUndoOptions): Promise<T>;
|
|
293
|
+
undo<T = unknown>(input: Buffer, forceType: string, options?: OperationOptions): Promise<T>;
|
|
294
|
+
/**
|
|
295
|
+
* Pack data AND embed a manifest header as the first msgpack frame.
|
|
296
|
+
* Mirrors what file.pack writes to disk — useful for in-memory transport.
|
|
297
|
+
*/
|
|
298
|
+
packWithManifest(data: unknown): Buffer;
|
|
299
|
+
/**
|
|
300
|
+
* Unpack a buffer that begins with a PipeXManifest frame.
|
|
301
|
+
* Returns { manifest, data } — callers can inspect the manifest to verify
|
|
302
|
+
* the pipeline that produced the buffer before consuming data.
|
|
303
|
+
*/
|
|
304
|
+
unpackWithManifest<T = unknown>(input: Buffer): {
|
|
305
|
+
manifest: PipeXManifest;
|
|
306
|
+
data: T;
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/core/controllers/StreamController.d.ts
|
|
311
|
+
declare class StreamController {
|
|
312
|
+
#private;
|
|
313
|
+
constructor(engine: DataEngine);
|
|
314
|
+
/**
|
|
315
|
+
* Returns a Writable that pumps incoming bytes through the plugin pipeline
|
|
316
|
+
* (compress direction) and forwards them to `destination`.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* readableSource.pipe(engine.stream.into(createWriteStream('out')));
|
|
320
|
+
*/
|
|
321
|
+
into(destination: Writable, options?: OperationOptions): Writable;
|
|
322
|
+
/**
|
|
323
|
+
* Returns a Writable that pumps bytes through the reversed plugin pipeline
|
|
324
|
+
* (decompress direction) and forwards to `destination`.
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* readableSource.pipe(engine.stream.reverseInto(createWriteStream('restored')));
|
|
328
|
+
*/
|
|
329
|
+
reverseInto(destination: Writable, options?: OperationOptions): Writable;
|
|
330
|
+
/**
|
|
331
|
+
* Returns a PackrStream: write JS objects, read msgpack bytes.
|
|
332
|
+
* A manifest header frame is prepended automatically.
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* objectSource.pipe(engine.stream.pack()).pipe(tcpSocket);
|
|
336
|
+
*/
|
|
337
|
+
pack(options?: OperationOptions): Duplex;
|
|
338
|
+
/**
|
|
339
|
+
* Returns a GuardedUnpackrStream: write msgpack bytes, read JS objects.
|
|
340
|
+
* Fires the engine's 'manifest' event when the header frame is detected.
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* tcpSocket.pipe(engine.stream.unpack()).on('data', obj => console.log(obj));
|
|
344
|
+
*/
|
|
345
|
+
unpack(options?: OperationOptions): Duplex;
|
|
346
|
+
/**
|
|
347
|
+
* Orchestrate a complete pipeline: Readable → plugin chain → Writable.
|
|
348
|
+
* This is the primary low-level entry point — file/binary controllers
|
|
349
|
+
* build on top of this.
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* await engine.stream.pipe(
|
|
353
|
+
* createReadStream('input.bin'),
|
|
354
|
+
* createWriteStream('output.bin'),
|
|
355
|
+
* );
|
|
356
|
+
*/
|
|
357
|
+
pipe(source: Readable, destination: Writable, reverse?: boolean, options?: OperationOptions): Promise<void>;
|
|
358
|
+
}
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/core/dataEngine.d.ts
|
|
361
|
+
interface PipeXEventMap {
|
|
362
|
+
start: [requestId: string];
|
|
363
|
+
'plugin:after': [name: string, durationMs: number];
|
|
364
|
+
progress: [bytes: number, requestId: string];
|
|
365
|
+
error: [err: Error, requestId: string];
|
|
366
|
+
end: [requestId: string, durationMs?: number];
|
|
367
|
+
manifest: [manifest: unknown, requestId?: string];
|
|
368
|
+
}
|
|
369
|
+
type PluginConstructor<TOptions = unknown> = new (options: TOptions) => ProcessorPlugin;
|
|
370
|
+
declare class DataEngine extends EventEmitter {
|
|
371
|
+
#private;
|
|
372
|
+
/** Built-in plugin registry for config-driven bootstrap. */
|
|
373
|
+
private static readonly pluginRegistry;
|
|
374
|
+
/** Register a plugin class for use in fromConfig(). */
|
|
375
|
+
static registerPlugin<TOptions>(name: string, pluginClass: PluginConstructor<TOptions>): void;
|
|
376
|
+
/**
|
|
377
|
+
* Bootstrap a DataEngine from a configuration object.
|
|
378
|
+
*/
|
|
379
|
+
static fromConfig(config: EngineConfig): Promise<DataEngine>;
|
|
380
|
+
readonly file: FileController;
|
|
381
|
+
readonly binary: BinaryController;
|
|
382
|
+
readonly stream: StreamController;
|
|
383
|
+
constructor(limits?: Partial<EngineLimits>);
|
|
384
|
+
get limits(): Readonly<EngineLimits>;
|
|
385
|
+
setLimits(limits: Partial<EngineLimits>): this;
|
|
386
|
+
createOperationSignal(options?: OperationOptions): AbortSignal;
|
|
387
|
+
/**
|
|
388
|
+
* Set the optional, caller-owned failure sink (legacy DLQ terminology).
|
|
389
|
+
* A failed fallback-transform chunk is written after retries are exhausted;
|
|
390
|
+
* the operation still rejects. PipeX does not persist, replay, end, or own
|
|
391
|
+
* the supplied Writable.
|
|
392
|
+
*
|
|
393
|
+
* @param stream The caller-provided Writable used as a failure sink.
|
|
394
|
+
*/
|
|
395
|
+
setDlq(stream: Writable): this;
|
|
396
|
+
/** The current caller-provided failure sink, if any. */
|
|
397
|
+
get dlq(): Writable | undefined;
|
|
398
|
+
/**
|
|
399
|
+
* Set the engine's logger for structured observability.
|
|
400
|
+
* Compatible with Pino, Winston, or any logger implementing the Logger interface.
|
|
401
|
+
*
|
|
402
|
+
* @param logger The logger instance.
|
|
403
|
+
*/
|
|
404
|
+
setLogger(logger: Logger): this;
|
|
405
|
+
/** The current logger instance. */
|
|
406
|
+
get logger(): Logger | undefined;
|
|
407
|
+
/**
|
|
408
|
+
* Set the engine's tracer for OpenTelemetry-compatible tracing.
|
|
409
|
+
*
|
|
410
|
+
* @param tracer The tracer instance.
|
|
411
|
+
*/
|
|
412
|
+
setTracer(tracer: Tracer): this;
|
|
413
|
+
/** The current tracer instance. */
|
|
414
|
+
get tracer(): Tracer | undefined;
|
|
415
|
+
/**
|
|
416
|
+
* Set the engine's audit logger for compliance and security auditing.
|
|
417
|
+
*
|
|
418
|
+
* @param logger The audit logger instance.
|
|
419
|
+
*/
|
|
420
|
+
setAuditLogger(logger: AuditLogger): this;
|
|
421
|
+
/**
|
|
422
|
+
* Emits an audit record if an audit logger is configured.
|
|
423
|
+
* This is called automatically by controllers.
|
|
424
|
+
*
|
|
425
|
+
* @param record The audit record metadata.
|
|
426
|
+
*/
|
|
427
|
+
emitAudit(record: Omit<AuditRecord, 'pluginChain' | 'timestamp'>): Promise<void>;
|
|
428
|
+
/**
|
|
429
|
+
* Set a Schema Registry to fetch schemas dynamically.
|
|
430
|
+
*
|
|
431
|
+
* @param registry The schema registry provider.
|
|
432
|
+
*/
|
|
433
|
+
setSchemaRegistry(registry: SchemaRegistry): this;
|
|
434
|
+
/**
|
|
435
|
+
* Fetch a schema from the registry and set it as the engine's active schema.
|
|
436
|
+
*
|
|
437
|
+
* @param subject The name of the schema to fetch.
|
|
438
|
+
* @param version Optional version of the schema.
|
|
439
|
+
*/
|
|
440
|
+
loadSchema(subject: string, version?: number): Promise<void>;
|
|
441
|
+
/**
|
|
442
|
+
* Set a global Zod schema for input/output validation.
|
|
443
|
+
* When set, controllers will automatically validate data against this schema.
|
|
444
|
+
*/
|
|
445
|
+
setSchema(schema: z.ZodType<any>): this;
|
|
446
|
+
get schema(): z.ZodType<any> | undefined;
|
|
447
|
+
/** Validates data against the registered schema (if any). Throws on failure. */
|
|
448
|
+
validate(data: unknown): void;
|
|
449
|
+
/** Register a plugin and return this for fluent chaining. */
|
|
450
|
+
use(plugin: ProcessorPlugin): this;
|
|
451
|
+
/**
|
|
452
|
+
* Read-only view of the registered plugins.
|
|
453
|
+
* Exposed so controllers can iterate without mutating the list.
|
|
454
|
+
*/
|
|
455
|
+
get plugins(): readonly ProcessorPlugin[];
|
|
456
|
+
/** Human-readable plugin identifiers in execution order. */
|
|
457
|
+
get pipeline(): readonly string[];
|
|
458
|
+
/** Runtime-validated capabilities in pipeline order. */
|
|
459
|
+
get pluginCapabilities(): readonly Readonly<RegisteredPluginCapabilities>[];
|
|
460
|
+
/** Generates a requestId, emits 'start', returns the id. */
|
|
461
|
+
startRequest(metadata?: Record<string, unknown>): string;
|
|
462
|
+
/** Keep capacity reserved for accepted non-cooperative work after caller cancellation. */
|
|
463
|
+
trackWork(requestId: string, pending: Promise<unknown>): void;
|
|
464
|
+
/** Idempotent cleanup, including error paths that fail before transformation starts. */
|
|
465
|
+
releaseRequest(requestId: string): void;
|
|
466
|
+
/** Emits 'end' with optional duration. */
|
|
467
|
+
endRequest(requestId: string, durationMs?: number): void;
|
|
468
|
+
/** Emits 'progress'. */
|
|
469
|
+
emitProgress(bytes: number, requestId: string): void;
|
|
470
|
+
/** Normalises unknown throws → Error and emits 'error'. */
|
|
471
|
+
emitError(err: unknown, requestId: string): void;
|
|
472
|
+
emit<K extends keyof PipeXEventMap>(event: K, ...args: PipeXEventMap[K]): boolean;
|
|
473
|
+
on<K extends keyof PipeXEventMap>(event: K, listener: (...args: PipeXEventMap[K]) => void): this;
|
|
474
|
+
once<K extends keyof PipeXEventMap>(event: K, listener: (...args: PipeXEventMap[K]) => void): this;
|
|
475
|
+
}
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/core/plugin.d.ts
|
|
478
|
+
declare abstract class BasePlugin implements ProcessorPlugin {
|
|
479
|
+
protected options: any;
|
|
480
|
+
abstract readonly name: string;
|
|
481
|
+
abstract readonly version: string;
|
|
482
|
+
retryOptions?: RetryOptions;
|
|
483
|
+
get reversible(): boolean;
|
|
484
|
+
constructor(options?: any);
|
|
485
|
+
abstract process(data: Buffer, context: ProcessorContext): Promise<Buffer> | Buffer;
|
|
486
|
+
/** Unsupported by default. Subclasses must implement reverse explicitly. */
|
|
487
|
+
reverse(_data: Buffer, _context: ProcessorContext): Promise<Buffer> | Buffer;
|
|
488
|
+
}
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region src/core/errors.d.ts
|
|
491
|
+
type PipeXErrorCode = 'UNSUPPORTED_REVERSE' | 'UNSUPPORTED_STREAMING' | 'INVALID_PLUGIN_CAPABILITY' | 'OPERATION_ABORTED' | 'OPERATION_TIMEOUT' | 'KMS_PROVIDER_FAILURE' | 'KMS_AUTHENTICATION_FAILED' | 'KMS_PROVIDER_AUTHENTICATION_FAILED' | 'KMS_PROVIDER_UNAVAILABLE' | 'UNSUPPORTED_KMS_OPERATION' | 'INVALID_KMS_PROVIDER_CAPABILITY' | 'WORKER_POOL_CLOSED' | 'WORKER_QUEUE_FULL' | 'WORKER_POOL_CLOSE_FAILURE' | 'WORKER_TASK_FAILURE';
|
|
492
|
+
declare class PipeXError extends Error {
|
|
493
|
+
readonly code: PipeXErrorCode;
|
|
494
|
+
readonly name: string;
|
|
495
|
+
constructor(code: PipeXErrorCode, message: string, options?: ErrorOptions);
|
|
496
|
+
}
|
|
497
|
+
declare class UnsupportedReverseError extends PipeXError {
|
|
498
|
+
readonly plugin: string;
|
|
499
|
+
readonly name: string;
|
|
500
|
+
constructor(plugin: string);
|
|
501
|
+
}
|
|
502
|
+
declare class UnsupportedStreamingError extends PipeXError {
|
|
503
|
+
readonly plugin: string;
|
|
504
|
+
readonly name: string;
|
|
505
|
+
constructor(plugin: string);
|
|
506
|
+
}
|
|
507
|
+
type InvalidPluginCapabilityIssue = 'MUST_BE_BOOLEAN' | 'MISSING_IMPLEMENTATION' | 'CONFLICTING_IMPLEMENTATION';
|
|
508
|
+
declare class InvalidPluginCapabilityError extends PipeXError {
|
|
509
|
+
readonly plugin: string;
|
|
510
|
+
readonly capability: 'reversible' | 'streaming';
|
|
511
|
+
readonly issue: InvalidPluginCapabilityIssue;
|
|
512
|
+
readonly name: string;
|
|
513
|
+
constructor(plugin: string, capability: 'reversible' | 'streaming', issue: InvalidPluginCapabilityIssue);
|
|
514
|
+
}
|
|
515
|
+
declare class OperationAbortedError extends PipeXError {
|
|
516
|
+
readonly name: string;
|
|
517
|
+
constructor(options?: ErrorOptions);
|
|
518
|
+
}
|
|
519
|
+
declare class OperationTimeoutError extends PipeXError {
|
|
520
|
+
readonly name: string;
|
|
521
|
+
constructor(options?: ErrorOptions);
|
|
522
|
+
}
|
|
523
|
+
declare class KmsProviderError extends PipeXError {
|
|
524
|
+
readonly operation: 'generateDataKey' | 'decrypt' | 'encrypt';
|
|
525
|
+
readonly name: string;
|
|
526
|
+
constructor(operation: 'generateDataKey' | 'decrypt' | 'encrypt', options?: ErrorOptions);
|
|
527
|
+
}
|
|
528
|
+
declare class KmsAuthenticationError extends PipeXError {
|
|
529
|
+
readonly name: string;
|
|
530
|
+
constructor();
|
|
531
|
+
}
|
|
532
|
+
declare class KmsProviderAuthenticationError extends PipeXError {
|
|
533
|
+
readonly operation: 'generateDataKey' | 'decrypt' | 'encrypt';
|
|
534
|
+
readonly name: string;
|
|
535
|
+
constructor(operation: 'generateDataKey' | 'decrypt' | 'encrypt');
|
|
536
|
+
}
|
|
537
|
+
declare class KmsProviderUnavailableError extends PipeXError {
|
|
538
|
+
readonly operation: 'generateDataKey' | 'decrypt' | 'encrypt';
|
|
539
|
+
readonly name: string;
|
|
540
|
+
constructor(operation: 'generateDataKey' | 'decrypt' | 'encrypt');
|
|
541
|
+
}
|
|
542
|
+
declare class UnsupportedKmsOperationError extends PipeXError {
|
|
543
|
+
readonly operation: 'generateDataKey' | 'decrypt' | 'encrypt';
|
|
544
|
+
readonly name: string;
|
|
545
|
+
constructor(operation: 'generateDataKey' | 'decrypt' | 'encrypt');
|
|
546
|
+
}
|
|
547
|
+
type InvalidKmsProviderCapabilityIssue = 'MUST_BE_BOOLEAN' | 'MISSING_IMPLEMENTATION';
|
|
548
|
+
declare class InvalidKmsProviderCapabilityError extends PipeXError {
|
|
549
|
+
readonly operation: 'generateDataKey' | 'decrypt' | 'encrypt';
|
|
550
|
+
readonly issue: InvalidKmsProviderCapabilityIssue;
|
|
551
|
+
readonly name: string;
|
|
552
|
+
constructor(operation: 'generateDataKey' | 'decrypt' | 'encrypt', issue: InvalidKmsProviderCapabilityIssue);
|
|
553
|
+
}
|
|
554
|
+
declare class WorkerPoolClosedError extends PipeXError {
|
|
555
|
+
readonly name: string;
|
|
556
|
+
constructor();
|
|
557
|
+
}
|
|
558
|
+
declare class WorkerQueueFullError extends PipeXError {
|
|
559
|
+
readonly maxQueue: number;
|
|
560
|
+
readonly name: string;
|
|
561
|
+
constructor(maxQueue: number);
|
|
562
|
+
}
|
|
563
|
+
declare class WorkerPoolCloseError extends PipeXError {
|
|
564
|
+
readonly name: string;
|
|
565
|
+
constructor(options?: ErrorOptions);
|
|
566
|
+
}
|
|
567
|
+
declare class WorkerTaskError extends PipeXError {
|
|
568
|
+
readonly taskName: string;
|
|
569
|
+
readonly name: string;
|
|
570
|
+
constructor(taskName: string, options?: ErrorOptions);
|
|
571
|
+
}
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region src/core/kmsCapabilities.d.ts
|
|
574
|
+
/**
|
|
575
|
+
* Returns an immutable, runtime-validated view of a generic KMS provider.
|
|
576
|
+
* Explicit false declarations support legacy provider stubs that exist only
|
|
577
|
+
* to throw; such methods are never invoked through PipeX.
|
|
578
|
+
*/
|
|
579
|
+
declare function getKmsProviderCapabilities(provider: KmsProvider): Readonly<KmsProviderCapabilities>;
|
|
580
|
+
declare function supportsKmsOperation(provider: KmsProvider, operation: KmsOperation): boolean;
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/plugin/hashing.d.ts
|
|
583
|
+
type HashAlgorithm = 'sha256' | 'sha512';
|
|
584
|
+
interface HashingOptions {
|
|
585
|
+
algorithm: HashAlgorithm;
|
|
586
|
+
secret: string;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* HashingPlugin — Standard library plugin for HMAC integrity checks.
|
|
590
|
+
* Appends a digest to the end of the buffer/stream.
|
|
591
|
+
*/
|
|
592
|
+
declare class HashingPlugin extends BasePlugin {
|
|
593
|
+
protected options: HashingOptions;
|
|
594
|
+
readonly name = "hashing";
|
|
595
|
+
readonly version = "3.0.0";
|
|
596
|
+
constructor(options: HashingOptions);
|
|
597
|
+
process(data: Buffer, context: ProcessorContext): Promise<Buffer>;
|
|
598
|
+
reverse(data: Buffer, context: ProcessorContext): Promise<Buffer>;
|
|
599
|
+
createStream(mode: 'compress' | 'decompress', context?: StreamPluginContext): Transform;
|
|
600
|
+
}
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region src/plugin/encryptionFormat.d.ts
|
|
603
|
+
type EncryptionAlgorithm = 'aes-256-gcm' | 'chacha20-poly1305';
|
|
604
|
+
interface EncryptionFormatOptions {
|
|
605
|
+
readonly algorithm: EncryptionAlgorithm;
|
|
606
|
+
readonly key: Buffer;
|
|
607
|
+
readonly frameSizeBytes?: number;
|
|
608
|
+
readonly allowLegacyDecrypt?: boolean;
|
|
609
|
+
}
|
|
610
|
+
//#endregion
|
|
611
|
+
//#region src/plugin/encryption.d.ts
|
|
612
|
+
interface EncryptionOptions extends EncryptionFormatOptions {
|
|
613
|
+
/** Maximum plaintext bytes in each authenticated frame. Defaults to 64 KiB. */
|
|
614
|
+
frameSizeBytes?: number;
|
|
615
|
+
/** Temporarily accept the unversioned v3 format while migrating. Defaults to true. */
|
|
616
|
+
allowLegacyDecrypt?: boolean;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Authenticated, bounded-memory stream encryption.
|
|
620
|
+
*
|
|
621
|
+
* Version 4 writes the versioned PXAE framed format. The legacy unversioned
|
|
622
|
+
* format remains readable by default for migration, but is never written.
|
|
623
|
+
*/
|
|
624
|
+
declare class EncryptionPlugin extends BasePlugin {
|
|
625
|
+
protected options: EncryptionOptions;
|
|
626
|
+
readonly name = "encryption";
|
|
627
|
+
readonly version = "4.0.0";
|
|
628
|
+
constructor(options: EncryptionOptions);
|
|
629
|
+
process(data: Buffer, context: ProcessorContext): Promise<Buffer>;
|
|
630
|
+
reverse(data: Buffer, context: ProcessorContext): Promise<Buffer>;
|
|
631
|
+
createStream(mode: 'compress' | 'decompress', context?: StreamPluginContext): Transform;
|
|
632
|
+
}
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/plugin/compression.d.ts
|
|
635
|
+
type CompressionType = 'gzip' | 'brotli' | 'none';
|
|
636
|
+
interface CompressionOptions {
|
|
637
|
+
type: CompressionType;
|
|
638
|
+
level?: number;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* CompressionPlugin — Standard library plugin for Gzip and Brotli.
|
|
642
|
+
* Prepends a 1-byte header to identify the compression type.
|
|
643
|
+
*/
|
|
644
|
+
declare class CompressionPlugin extends BasePlugin {
|
|
645
|
+
protected options: CompressionOptions;
|
|
646
|
+
readonly name = "compression";
|
|
647
|
+
readonly version = "3.0.0";
|
|
648
|
+
constructor(options: CompressionOptions);
|
|
649
|
+
process(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
650
|
+
reverse(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
651
|
+
createStream(mode: 'compress' | 'decompress', context?: StreamPluginContext): Duplex;
|
|
652
|
+
}
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region src/plugin/performance.d.ts
|
|
655
|
+
/**
|
|
656
|
+
* BenchmarkPlugin — Standard library plugin for monitoring data throughput.
|
|
657
|
+
* Records input/output byte counts in context metadata.
|
|
658
|
+
*/
|
|
659
|
+
declare class BenchmarkPlugin extends BasePlugin {
|
|
660
|
+
readonly name = "benchmark";
|
|
661
|
+
readonly version = "2.0.0";
|
|
662
|
+
process(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
663
|
+
reverse(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
664
|
+
}
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region src/plugin/worker.d.ts
|
|
667
|
+
interface WorkerPoolOptions {
|
|
668
|
+
/** Absolute path or file URL to a caller-owned ESM/CJS worker module. */
|
|
669
|
+
filename: string | URL;
|
|
670
|
+
/** Export used for forward processing. Omit to use the worker's default export. */
|
|
671
|
+
processName?: string;
|
|
672
|
+
/** Export used for reverse processing. When omitted, reverse is unsupported. */
|
|
673
|
+
reverseName?: string;
|
|
674
|
+
maxThreads?: number;
|
|
675
|
+
/** Maximum queued tasks. Defaults to 64. */
|
|
676
|
+
maxQueue?: number;
|
|
677
|
+
/** Per-task timeout in milliseconds. Zero disables the plugin-level timeout. */
|
|
678
|
+
taskTimeoutMs?: number;
|
|
679
|
+
/** Grace period used by Piscina when closing the pool. Defaults to 30 seconds. */
|
|
680
|
+
closeTimeoutMs?: number;
|
|
681
|
+
}
|
|
682
|
+
/** Runs caller-owned CPU transforms in a bounded, persistent Piscina pool. */
|
|
683
|
+
declare class WorkerPoolPlugin extends BasePlugin {
|
|
684
|
+
#private;
|
|
685
|
+
readonly name = "worker-pool";
|
|
686
|
+
readonly version = "5.0.0";
|
|
687
|
+
constructor(options: WorkerPoolOptions);
|
|
688
|
+
get reversible(): boolean;
|
|
689
|
+
process(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
690
|
+
reverse(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
691
|
+
createStream(mode: 'compress' | 'decompress', context?: StreamPluginContext): Transform;
|
|
692
|
+
/** Rejects new tasks and waits for queued/running work unless force is true. */
|
|
693
|
+
close(options?: {
|
|
694
|
+
force?: boolean;
|
|
695
|
+
}): Promise<void>;
|
|
696
|
+
}
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region src/core/validation.d.ts
|
|
699
|
+
interface ValidationOptions {
|
|
700
|
+
schema: z.ZodType<any>;
|
|
701
|
+
/**
|
|
702
|
+
* Whether to validate during the reverse (decompress) phase.
|
|
703
|
+
* Useful if you want to ensure the restored data still matches the schema.
|
|
704
|
+
*/
|
|
705
|
+
validateOnReverse?: boolean;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* ValidationPlugin — Core plugin for schema-based data validation.
|
|
709
|
+
* Uses Zod to verify the structure of the data passing through the engine.
|
|
710
|
+
*
|
|
711
|
+
* Note: This plugin assumes the data is MsgPack-encoded (default PipeX behavior).
|
|
712
|
+
*/
|
|
713
|
+
declare class ValidationPlugin extends BasePlugin {
|
|
714
|
+
protected options: ValidationOptions;
|
|
715
|
+
readonly name = "validation";
|
|
716
|
+
readonly version = "1.0.0";
|
|
717
|
+
constructor(options: ValidationOptions);
|
|
718
|
+
process(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
719
|
+
reverse(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
720
|
+
private validate;
|
|
721
|
+
createStream(mode?: 'compress' | 'decompress', context?: StreamPluginContext): Transform;
|
|
722
|
+
}
|
|
723
|
+
//#endregion
|
|
724
|
+
//#region src/plugin/kms_encryption.d.ts
|
|
725
|
+
interface KmsEncryptionOptions {
|
|
726
|
+
kms: KmsProvider;
|
|
727
|
+
keyId: string;
|
|
728
|
+
/** Temporarily accept the unversioned v1 envelope while migrating. Defaults to true. */
|
|
729
|
+
allowLegacyDecrypt?: boolean;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* KmsEncryptionPlugin — Enterprise-grade encryption using Envelope Encryption.
|
|
733
|
+
*
|
|
734
|
+
* 1. Generate a data key via KMS.
|
|
735
|
+
* 2. Encrypt data locally using the plaintext data key.
|
|
736
|
+
* 3. Prepend the encrypted data key (ciphertext) to the payload.
|
|
737
|
+
*
|
|
738
|
+
* Packet format: [PXKM][version][algorithm][flags][key_len][ciphertext_len]
|
|
739
|
+
* [12B IV][Encrypted Data Key][Ciphertext][16B Tag]
|
|
740
|
+
*/
|
|
741
|
+
declare class KmsEncryptionPlugin extends BasePlugin {
|
|
742
|
+
protected options: KmsEncryptionOptions;
|
|
743
|
+
readonly name = "kms-encryption";
|
|
744
|
+
readonly version = "2.1.0";
|
|
745
|
+
readonly streaming = false;
|
|
746
|
+
get providerCapabilities(): Readonly<KmsProviderCapabilities>;
|
|
747
|
+
get reversible(): boolean;
|
|
748
|
+
constructor(options: KmsEncryptionOptions);
|
|
749
|
+
process(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
750
|
+
reverse(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
751
|
+
}
|
|
752
|
+
//#endregion
|
|
753
|
+
//#region src/index.d.ts
|
|
754
|
+
declare const Plugins: {
|
|
755
|
+
readonly Hashing: typeof HashingPlugin;
|
|
756
|
+
readonly Encryption: typeof EncryptionPlugin;
|
|
757
|
+
readonly Compression: typeof CompressionPlugin;
|
|
758
|
+
readonly Benchmark: typeof BenchmarkPlugin;
|
|
759
|
+
readonly WorkerPool: typeof WorkerPoolPlugin;
|
|
760
|
+
readonly Validation: typeof ValidationPlugin;
|
|
761
|
+
readonly KmsEncryption: typeof KmsEncryptionPlugin;
|
|
762
|
+
};
|
|
763
|
+
//#endregion
|
|
764
|
+
export { type AuditLogger, type AuditRecord, BasePlugin, BenchmarkPlugin, type BinaryUndoOptions, type CompressionOptions, CompressionPlugin, type CompressionType, DEFAULT_HIGH_WATER, DEFAULT_LIMITS, DataEngine, type EncryptionAlgorithm, type EncryptionOptions, EncryptionPlugin, type EngineConfig, type EngineEvents, type EngineLimits, type EngineResult, GuardedUnpackrStream, type HashAlgorithm, type HashingOptions, HashingPlugin, InvalidKmsProviderCapabilityError, type InvalidKmsProviderCapabilityIssue, InvalidPluginCapabilityError, type InvalidPluginCapabilityIssue, KmsAuthenticationError, type KmsEncryptionOptions, KmsEncryptionPlugin, type KmsOperation, type KmsProvider, KmsProviderAuthenticationError, type KmsProviderCapabilities, KmsProviderError, KmsProviderUnavailableError, type KmsRequestOptions, type Logger, MAX_FRAME_BYTES, ORIGINAL_TYPES, OperationAbortedError, type OperationOptions, OperationTimeoutError, PACKR, PIPEX_MANIFEST_KEY, PipeXError, type PipeXErrorCode, type PipeXManifest, type PluginCapabilities, type PluginConstructor, type PluginOperation, Plugins, type ProcessorContext, type ProcessorPlugin, type RegisteredPluginCapabilities, type RetryOptions, type SchemaRegistry, type Span, type StreamPluginContext, type Tracer, UNPACKR, UnsupportedKmsOperationError, UnsupportedReverseError, UnsupportedStreamingError, type ValidationOptions, ValidationPlugin, WorkerPoolCloseError, WorkerPoolClosedError, type WorkerPoolOptions, WorkerPoolPlugin, WorkerQueueFullError, WorkerTaskError, assertExists, assertKnownValueByteLimit, assertMessagePackFrameLimits, assertOriginalType, assertReversiblePipeline, assertStreamingPipeline, buildByteLimitTransform, buildFallbackTransform, buildFrameLimitTransform, buildKnownValueByteLimitTransform, buildManifest, buildManifestExtractTransform, buildManifestHeaderTransform, buildNdjsonTransform, buildObjectLimitTransform, buildTransformChain, createPackrStream, createUnpackrStream, detectType, fromBuffer, getKmsProviderCapabilities, getPluginCapabilities, hasStreamSupport, isManifest, makeContext, resolveOutputPath, runPipeline, supportsKmsOperation, supportsOperation, supportsReverse, toBuffer, withRetry };
|
|
765
|
+
//# sourceMappingURL=index.d.mts.map
|