@snyxex/pipex 0.0.0-stage → 1.0.3
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 +319 -2
- package/dist/compression-2mm0MhWY.mjs +1 -0
- package/dist/compression-CtrHxa9G.d.mts +38 -0
- package/dist/compression-DnVFu8TM.d.cts +38 -0
- package/dist/compression-DrgzribA.cjs +1 -0
- package/dist/compression.cjs +1 -0
- package/dist/compression.d.cts +2 -0
- package/dist/compression.d.mts +2 -0
- package/dist/compression.mjs +1 -0
- package/dist/core-BOdvxKBq.mjs +2 -0
- package/dist/core-B_z1gN5W.cjs +2 -0
- package/dist/dataEngine-4m6GTOLe.mjs +1 -0
- package/dist/dataEngine-Bvl6amzP.cjs +1 -0
- package/dist/dataEngine-D-fIXgE7.d.cts +232 -0
- package/dist/dataEngine-DUEmWp7a.d.mts +232 -0
- package/dist/encryption-BmmNECIc.d.cts +44 -0
- package/dist/encryption-CnSL1BEY.d.mts +44 -0
- package/dist/encryption-CqxtoqAD.mjs +1 -0
- package/dist/encryption-DdP1zFYl.cjs +1 -0
- package/dist/encryption.cjs +1 -0
- package/dist/encryption.d.cts +2 -0
- package/dist/encryption.d.mts +2 -0
- package/dist/encryption.mjs +1 -0
- package/dist/hashing-B6xGcbQR.d.mts +33 -0
- package/dist/hashing-ChrADfcH.mjs +1 -0
- package/dist/hashing-JtOHPybU.cjs +1 -0
- package/dist/hashing-LY-8x66g.d.cts +33 -0
- package/dist/hashing.cjs +1 -0
- package/dist/hashing.d.cts +2 -0
- package/dist/hashing.d.mts +2 -0
- package/dist/hashing.mjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +302 -0
- package/dist/index.d.mts +302 -0
- package/dist/index.mjs +1 -0
- package/dist/kms.cjs +1 -0
- package/dist/kms.d.cts +3 -0
- package/dist/kms.d.mts +3 -0
- package/dist/kms.mjs +1 -0
- package/dist/kms_encryption-Da-KqjKI.d.mts +33 -0
- package/dist/kms_encryption-Dh1LEHhk.d.cts +33 -0
- package/dist/kms_encryption-R9auKGW4.mjs +1 -0
- package/dist/kms_encryption-xyWi65rZ.cjs +1 -0
- package/dist/native.cjs +1 -0
- package/dist/native.d.cts +2 -0
- package/dist/native.d.mts +2 -0
- package/dist/native.mjs +1 -0
- package/dist/parallel.cjs +1 -0
- package/dist/parallel.d.cts +2 -0
- package/dist/parallel.d.mts +2 -0
- package/dist/parallel.mjs +1 -0
- package/dist/plugin-C9Kd9coY.d.cts +16 -0
- package/dist/plugin-CE94-p8P.d.mts +16 -0
- package/dist/resourceLimits-C1HHDwXQ.mjs +1 -0
- package/dist/resourceLimits-CI0Qrqdf.cjs +1 -0
- package/dist/types-Bytga6zd.d.mts +155 -0
- package/dist/types-ia4x-Dvp.d.cts +155 -0
- package/dist/validation-CqmhNHdW.d.cts +32 -0
- package/dist/validation-D17IkoHy.d.mts +32 -0
- package/dist/validation-P5WRSAUK.mjs +1 -0
- package/dist/validation-pEeJmCad.cjs +1 -0
- package/dist/validation.cjs +1 -0
- package/dist/validation.d.cts +2 -0
- package/dist/validation.d.mts +2 -0
- package/dist/validation.mjs +1 -0
- package/dist/worker-CbuCpSNc.d.cts +37 -0
- package/dist/worker-CgCC-BWG.d.mts +37 -0
- package/dist/worker-I_kqxWeK.cjs +1 -0
- package/dist/worker-c0_VZ9c7.mjs +1 -0
- package/package.json +188 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./core-B_z1gN5W.cjs`);const e=require(`./resourceLimits-CI0Qrqdf.cjs`);let t=require(`node:crypto`),n=require(`node:stream`);const r=Buffer.from(`PXAE`),i={"aes-256-gcm":1,"chacha20-poly1305":2},a={1:`aes-256-gcm`,2:`chacha20-poly1305`};function o(t){if(!Buffer.isBuffer(t)||t.length!==32)throw new e.l}function s(t){return{maxInputBytes:e.n(t),maxOutputBytes:e.r(t),maxFrameBytes:t?.limits?.maxFrameBytes??e.t.maxFrameBytes,maxFrames:t?.limits?.maxFrames??e.t.maxFrames}}function c(e,t){let n=t.maxFrameBytes-29;if(n<1||t.maxFrameBytes<28)throw Error(`[PipeX] Encryption frame limit ${t.maxFrameBytes} bytes is too small`);let r=e.frameSizeBytes??Math.min(65536,n);if(!Number.isSafeInteger(r)||r<1||r>4294967295)throw Error(`[PipeX] Encryption frameSizeBytes must be a positive 32-bit integer`);if(r>n)throw Error(`[PipeX] Encryption frameSizeBytes exceeds the ${t.maxFrameBytes}-byte frame limit`);return r}function l(e,t){let n=e===0?0:Math.ceil(e/t);return 28+e+(n+1)*29}function u(e,t){return e===0?0:Math.ceil(e/t)}function d(e,n,a=(0,t.randomBytes)(16)){let o=Buffer.alloc(28);return r.copy(o,0),o.writeUInt8(1,4),o.writeUInt8(i[e],5),o.writeUInt16BE(0,6),o.writeUInt32BE(n,8),a.copy(o,12),o}function f(e,t){if(e.length!==28||!e.subarray(0,4).equals(r))throw Error(`[PipeX] Decryption failed: invalid framed header`);if(e.readUInt8(4)!==1)throw Error(`[PipeX] Decryption failed: unsupported format version`);let n=a[e.readUInt8(5)];if(!n||e.readUInt16BE(6)!==0)throw Error(`[PipeX] Decryption failed: invalid framed header`);let i=e.readUInt32BE(8);if(i<1||i>t.maxFrameBytes-29)throw Error(`[PipeX] Decryption failed: invalid frame size`);return{bytes:e,algorithm:n,frameSizeBytes:i,salt:e.subarray(12,28)}}function p(e,n){let r=Buffer.from(`PipeX AEAD framed v1:${n.algorithm}`,`utf8`);return Buffer.from((0,t.hkdfSync)(`sha256`,e,n.salt,r,32))}function m(e){if(e<0n||e>18446744073709551615n)throw Error(`[PipeX] Encryption frame sequence exhausted`);let t=Buffer.alloc(12);return t.writeBigUInt64BE(e,4),t}function h(e,t,n){let r=Buffer.alloc(13);return r.writeUInt8(e,0),r.writeBigUInt64BE(t,1),r.writeUInt32BE(n,9),r}function g(e,n,r,i,a,o){let s=h(n,r,e.length),c=m(r);try{let n=(0,t.createCipheriv)(i,a,c,{authTagLength:16});n.setAAD(Buffer.concat([o,s]));let r=Buffer.concat([n.update(e),n.final()]);return Buffer.concat([s,r,n.getAuthTag()],29+r.length)}finally{c.fill(0)}}function _(n,r,i,a,o,s,c){let l=m(a),u=(0,t.createDecipheriv)(o,s,l,{authTagLength:16});if(u.setAAD(Buffer.concat([c,i])),r.length!==16)throw new e.a;u.setAuthTag(r);let d=u.update(n);try{let e=u.final();return e.length===0?d:Buffer.concat([d,e])}catch{throw d.fill(0),new e.a}finally{l.fill(0)}}function v(e,n,r){if(e.length<29)throw Error(`[PipeX] Decryption failed: packet too short`);if(e.length-29>r.maxOutputBytes)throw Error(`[PipeX] Decryption output exceeds ${r.maxOutputBytes} bytes`);let i=a[e.readUInt8(0)];if(!i)throw Error(`[PipeX] Decryption failed: unknown legacy algorithm`);let o=(0,t.createDecipheriv)(i,n,e.subarray(1,13),{authTagLength:16});o.setAuthTag(e.subarray(13,29));let s=o.update(e.subarray(29));try{let e=o.final();return e.length===0?s:Buffer.concat([s,e])}catch{throw s.fill(0),Error(`[PipeX] Decryption failed: authentication failed`)}}function y(e){return e.length>=r.length&&e.subarray(0,r.length).equals(r)}function b(e,t,n){o(t.key);let r=s(n);if(e.length>r.maxInputBytes)throw Error(`[PipeX] Encryption input exceeds ${r.maxInputBytes} bytes`);let i=c(t,r);if(u(e.length,i)>r.maxFrames)throw Error(`[PipeX] Encryption frame count exceeds ${r.maxFrames}`);let a=l(e.length,i);if(a>r.maxOutputBytes)throw Error(`[PipeX] Encryption output exceeds ${r.maxOutputBytes} bytes`);let m=d(t.algorithm,i),h=f(m,r),_=p(t.key,h),v=[m],y=0n;try{for(let n=0;n<e.length;n+=i)v.push(g(e.subarray(n,Math.min(e.length,n+i)),1,y++,t.algorithm,_,m));return v.push(g(Buffer.alloc(0),2,y,t.algorithm,_,m)),Buffer.concat(v,a)}finally{_.fill(0)}}function x(e,t,n){o(t.key);let i=s(n);if(e.length>i.maxInputBytes)throw Error(`[PipeX] Decryption input exceeds ${i.maxInputBytes} bytes`);if(e.length===0||!y(e)&&e.readUInt8(0)!==r.readUInt8(0)){if(t.allowLegacyDecrypt!==!0)throw Error(`[PipeX] Decryption failed: legacy format disabled`);return v(e,t.key,i)}if(e.length<28)throw Error(`[PipeX] Decryption failed: incomplete framed header`);let a=f(e.subarray(0,28),i),c=p(t.key,a),l=[],u=0,d=28,m=0n,h=0,g=!1;try{for(;d<e.length;){if(g||e.length-d<13)throw Error(`[PipeX] Decryption failed: incomplete or trailing frame`);let t=e.subarray(d,d+13);d+=13;let n=t.readUInt8(0),r=t.readBigUInt64BE(1),o=t.readUInt32BE(9);if(r!==m)throw Error(`[PipeX] Decryption failed: invalid frame sequence`);if(n!==1&&n!==2)throw Error(`[PipeX] Decryption failed: invalid frame type`);if(n===2&&o!==0)throw Error(`[PipeX] Decryption failed: invalid final frame`);if(o>a.frameSizeBytes||o>i.maxFrameBytes-29)throw Error(`[PipeX] Decryption failed: frame length exceeds configured limit`);if(n===1&&h>=i.maxFrames)throw Error(`[PipeX] Encryption frame count exceeds ${i.maxFrames}`);if(n===1&&o>i.maxOutputBytes-u)throw Error(`[PipeX] Decryption output exceeds ${i.maxOutputBytes} bytes`);if(e.length-d<o+16)throw Error(`[PipeX] Decryption failed: incomplete frame`);let s=e.subarray(d,d+o);d+=o;let f=e.subarray(d,d+16);d+=16;let p=_(s,f,t,r,a.algorithm,c,a.bytes);n===2?(p.fill(0),g=!0):(h++,u+=p.length,l.push(p)),m++}if(!g)throw Error(`[PipeX] Decryption failed: missing authenticated final frame`);let t=Buffer.concat(l,u);for(let e of l)e.fill(0);return t}catch(e){for(let e of l)e.fill(0);throw e}finally{c.fill(0)}}function S(e,t){o(e.key);let r=s(t),i=c(e,r);if(l(0,i)>r.maxOutputBytes)throw Error(`[PipeX] Encryption output exceeds ${r.maxOutputBytes} bytes`);let a=d(e.algorithm,i),m=f(a,r),h=p(e.key,m),_=Buffer.alloc(i),v=0,y=0,b=0,x=0n,S=!1,C=()=>{_.fill(0),h.fill(0)};return new n.Transform({transform(t,n,o){try{let n=Buffer.isBuffer(t)?t:Buffer.from(t);if(n.length>r.maxInputBytes-y)throw Error(`[PipeX] Encryption input exceeds ${r.maxInputBytes} bytes`);let s=y+n.length;if(u(s,i)>r.maxFrames)throw Error(`[PipeX] Encryption frame count exceeds ${r.maxFrames}`);if(l(s,i)>r.maxOutputBytes)throw Error(`[PipeX] Encryption output exceeds ${r.maxOutputBytes} bytes`);y=s,S||=(this.push(a),!0);let c=0;for(;c<n.length;){let t=Math.min(i-v,n.length-c);if(n.copy(_,v,c,c+t),v+=t,c+=t,v===i){if(++b>r.maxFrames)throw Error(`[PipeX] Encryption frame count exceeds ${r.maxFrames}`);this.push(g(_,1,x++,e.algorithm,h,a)),_.fill(0),v=0}}o()}catch(e){C(),o(e)}},flush(t){try{if(S||=(this.push(a),!0),v>0){if(++b>r.maxFrames)throw Error(`[PipeX] Encryption frame count exceeds ${r.maxFrames}`);this.push(g(_.subarray(0,v),1,x++,e.algorithm,h,a))}this.push(g(Buffer.alloc(0),2,x,e.algorithm,h,a)),C(),t()}catch(e){C(),t(e)}},destroy(e,t){C(),t(e)}})}function C(e,t){o(e.key);let i=s(t),a=`unknown`,c=0,l=0,u=Buffer.alloc(28),d=0,m,h,g=Buffer.alloc(13),y=0,b,x=0,S=0n,C=0,w=!1,T=[],E=()=>{h?.fill(0),b?.fill(0),u.fill(0),g.fill(0),T=[]},D=(t,n)=>{let r=0;for(;r<t.length;){if(w)throw Error(`[PipeX] Decryption failed: trailing data after final frame`);if(!m){let n=Math.min(28-d,t.length-r);t.copy(u,d,r,r+n),d+=n,r+=n,d===28&&(m=f(u,i),h=p(e.key,m));continue}if(y<13){let e=Math.min(13-y,t.length-r);if(t.copy(g,y,r,r+e),y+=e,r+=e,y<13)continue;let n=g.readUInt8(0),a=g.readBigUInt64BE(1),o=g.readUInt32BE(9);if(a!==S)throw Error(`[PipeX] Decryption failed: invalid frame sequence`);if(n!==1&&n!==2)throw Error(`[PipeX] Decryption failed: invalid frame type`);if(n===2&&o!==0)throw Error(`[PipeX] Decryption failed: invalid final frame`);if(o>m.frameSizeBytes||o>i.maxFrameBytes-29)throw Error(`[PipeX] Decryption failed: frame length exceeds configured limit`);if(n===1&&C>=i.maxFrames)throw Error(`[PipeX] Encryption frame count exceeds ${i.maxFrames}`);if(n===1&&o>i.maxOutputBytes-l)throw Error(`[PipeX] Decryption output exceeds ${i.maxOutputBytes} bytes`);b=Buffer.alloc(o+16),x=0}let a=Math.min(b.length-x,t.length-r);if(t.copy(b,x,r,r+a),x+=a,r+=a,x<b.length)continue;let o=g.readUInt8(0),s=g.readBigUInt64BE(1),c=g.readUInt32BE(9),v=_(b.subarray(0,c),b.subarray(c),g,s,m.algorithm,h,m.bytes);o===2?(v.fill(0),w=!0):(C++,l+=v.length,n.push(v)),S++,b.fill(0),b=void 0,x=0,g.fill(0),y=0}};return new n.Transform({transform(t,n,o){try{let n=Buffer.isBuffer(t)?t:Buffer.from(t);if(n.length>i.maxInputBytes-c)throw Error(`[PipeX] Decryption input exceeds ${i.maxInputBytes} bytes`);if(c+=n.length,n.length===0)return o();if(a===`unknown`&&(a=n.readUInt8(0)===r.readUInt8(0)?`framed`:`legacy`,a===`legacy`&&e.allowLegacyDecrypt===!1))throw Error(`[PipeX] Decryption failed: legacy format disabled`);a===`legacy`?T.push(n):D(n,this),o()}catch(e){E(),o(e)}},flush(t){try{if(a===`legacy`){let n=v(Buffer.concat(T,c),e.key,i);return this.push(n),E(),t()}if(a!==`framed`||!m||y!==0||b)throw Error(`[PipeX] Decryption failed: incomplete encrypted stream`);if(!w)throw Error(`[PipeX] Decryption failed: missing authenticated final frame`);E(),t()}catch(e){E(),t(e)}},destroy(e,t){E(),t(e)}})}var w=class extends e.i{name=`encryption`;version=`4.0.0`;constructor(t){if(super(t),this.options=t,!t||!Buffer.isBuffer(t.key)||t.key.length!==32)throw new e.l;if(![`aes-256-gcm`,`chacha20-poly1305`].includes(t.algorithm))throw new e.b({transformName:`encryption`,stage:`configuration`});if(t.frameSizeBytes!==void 0&&(!Number.isSafeInteger(t.frameSizeBytes)||t.frameSizeBytes<1||t.frameSizeBytes>4294967295))throw new e.s(`[PipeX] Invalid encryption frame size`);if(t.allowLegacyDecrypt!==void 0&&typeof t.allowLegacyDecrypt!=`boolean`)throw new e.s(`[PipeX] Invalid legacy decryption setting`)}async process(e,t){return b(e,this.options,t)}async reverse(e,t){return x(e,this.options,t)}createStream(e,t){return e===`compress`?S(this.options,t):C(this.options,t)}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return w}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./encryption-DdP1zFYl.cjs`);exports.EncryptionPlugin=e.t;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as EncryptionPlugin, i as EncryptionOptions, n as ChaCha20Poly1305Options, o as EncryptionAlgorithm, r as EncryptionCommonOptions, t as Aes256GcmOptions } from "./encryption-BmmNECIc.cjs";
|
|
2
|
+
export { type Aes256GcmOptions, type ChaCha20Poly1305Options, type EncryptionAlgorithm, type EncryptionCommonOptions, type EncryptionOptions, EncryptionPlugin };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as EncryptionPlugin, i as EncryptionOptions, n as ChaCha20Poly1305Options, o as EncryptionAlgorithm, r as EncryptionCommonOptions, t as Aes256GcmOptions } from "./encryption-CnSL1BEY.mjs";
|
|
2
|
+
export { type Aes256GcmOptions, type ChaCha20Poly1305Options, type EncryptionAlgorithm, type EncryptionCommonOptions, type EncryptionOptions, EncryptionPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./encryption-CqxtoqAD.mjs";export{e as EncryptionPlugin};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { C as StreamPluginContext, _ as ProcessorContext } from "./types-Bytga6zd.mjs";
|
|
2
|
+
import { t as BasePlugin } from "./plugin-CE94-p8P.mjs";
|
|
3
|
+
import { Transform } from "node:stream";
|
|
4
|
+
|
|
5
|
+
//#region src/plugin/hashing.d.ts
|
|
6
|
+
type HashAlgorithm = 'sha256' | 'sha512';
|
|
7
|
+
/** HMAC-SHA-256 options. Secret must be at least 16 characters at runtime. */
|
|
8
|
+
interface Sha256HashingOptions {
|
|
9
|
+
readonly algorithm: 'sha256';
|
|
10
|
+
readonly secret: string;
|
|
11
|
+
}
|
|
12
|
+
/** HMAC-SHA-512 options. Secret must be at least 16 characters at runtime. */
|
|
13
|
+
interface Sha512HashingOptions {
|
|
14
|
+
readonly algorithm: 'sha512';
|
|
15
|
+
readonly secret: string;
|
|
16
|
+
}
|
|
17
|
+
/** Algorithm-discriminated HMAC configuration. */
|
|
18
|
+
type HashingOptions = Sha256HashingOptions | Sha512HashingOptions;
|
|
19
|
+
/**
|
|
20
|
+
* HashingPlugin — Standard library plugin for HMAC integrity checks.
|
|
21
|
+
* Appends a digest to the end of the buffer/stream.
|
|
22
|
+
*/
|
|
23
|
+
declare class HashingPlugin extends BasePlugin {
|
|
24
|
+
protected options: HashingOptions;
|
|
25
|
+
readonly name = "hashing";
|
|
26
|
+
readonly version = "3.0.0";
|
|
27
|
+
constructor(options: HashingOptions);
|
|
28
|
+
process(data: Buffer, context: ProcessorContext): Promise<Buffer>;
|
|
29
|
+
reverse(data: Buffer, context: ProcessorContext): Promise<Buffer>;
|
|
30
|
+
createStream(mode: 'compress' | 'decompress', context?: StreamPluginContext): Transform;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Sha512HashingOptions as a, Sha256HashingOptions as i, HashingOptions as n, HashingPlugin as r, HashAlgorithm as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e,c as t,i as n,n as r,r as i}from"./resourceLimits-C1HHDwXQ.mjs";import{createHmac as a,timingSafeEqual as o}from"node:crypto";import{Transform as s}from"node:stream";const c={sha256:32,sha512:64};var l=class extends n{name=`hashing`;version=`3.0.0`;constructor(n){if(super(n),this.options=n,!(n.algorithm in c))throw new e({transformName:`hashing`,stage:`configuration`});if(!n.secret||n.secret.length<16)throw new t({transformName:`hashing`})}async process(e,n){let o=r(n),s=i(n),l=c[this.options.algorithm];if(e.length>o)throw new t({transformName:`hashing`,stage:`input`});if(e.length>s-l)throw new t({transformName:`hashing`,stage:`output`});n.metadata??={};let u=a(this.options.algorithm,this.options.secret).update(e).digest();return n.metadata.hmac=u.toString(`hex`),Buffer.concat([e,u])}async reverse(e,n){let s=c[this.options.algorithm],l=r(n),u=i(n);if(e.length>l)throw new t({transformName:`hashing`,stage:`input`});if(e.length<s)throw new t({transformName:`hashing`});if(e.length-s>u)throw new t({transformName:`hashing`,stage:`output`});let d=e.subarray(0,e.length-s),f=e.subarray(e.length-s),p=a(this.options.algorithm,this.options.secret).update(d).digest();try{if(!o(f,p))throw new t({transformName:`hashing`});return n.metadata??={},n.metadata.verified_hmac=f.toString(`hex`),d}finally{p.fill(0)}}createStream(e,n){let{algorithm:l,secret:u}=this.options,d=a(l,u),f=c[l],p=r(n),m=i(n);if(e===`compress`){let e=0;return new s({construct(e){e(m<f?new t({transformName:`hashing`,stage:`output`}):void 0)},transform(n,r,i){if(n.length>p-e)return i(new t({transformName:`hashing`,stage:`input`}));if(n.length>m-f-e)return i(new t({transformName:`hashing`,stage:`output`}));e+=n.length,d.update(n),this.push(n),i()},flush(e){this.push(d.digest()),e()}})}else{let e=[],n=0;return new s({transform(r,i,a){if(r.length>p-n)return a(new t({transformName:`hashing`,stage:`input`}));n+=r.length,e.push(r),a()},flush(r){let i=Buffer.concat(e,n);e=[];let a;try{if(i.length<f)throw new t({transformName:`hashing`});let e=i.subarray(0,i.length-f);if(e.length>m)throw new t({transformName:`hashing`,stage:`output`});let n=i.subarray(i.length-f);if(d.update(e),a=d.digest(),!o(n,a))throw new t({transformName:`hashing`});let s=Buffer.from(e);i.fill(0),this.push(s),r()}catch(e){i.fill(0),r(e)}finally{a?.fill(0)}},destroy(t,n){e=[],n(t)}})}}};export{l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./core-B_z1gN5W.cjs`);const e=require(`./resourceLimits-CI0Qrqdf.cjs`);let t=require(`node:crypto`),n=require(`node:stream`);const r={sha256:32,sha512:64};var i=class extends e.i{name=`hashing`;version=`3.0.0`;constructor(t){if(super(t),this.options=t,!(t.algorithm in r))throw new e.b({transformName:`hashing`,stage:`configuration`});if(!t.secret||t.secret.length<16)throw new e.c({transformName:`hashing`})}async process(n,i){let a=e.n(i),o=e.r(i),s=r[this.options.algorithm];if(n.length>a)throw new e.c({transformName:`hashing`,stage:`input`});if(n.length>o-s)throw new e.c({transformName:`hashing`,stage:`output`});i.metadata??={};let c=(0,t.createHmac)(this.options.algorithm,this.options.secret).update(n).digest();return i.metadata.hmac=c.toString(`hex`),Buffer.concat([n,c])}async reverse(n,i){let a=r[this.options.algorithm],o=e.n(i),s=e.r(i);if(n.length>o)throw new e.c({transformName:`hashing`,stage:`input`});if(n.length<a)throw new e.c({transformName:`hashing`});if(n.length-a>s)throw new e.c({transformName:`hashing`,stage:`output`});let c=n.subarray(0,n.length-a),l=n.subarray(n.length-a),u=(0,t.createHmac)(this.options.algorithm,this.options.secret).update(c).digest();try{if(!(0,t.timingSafeEqual)(l,u))throw new e.c({transformName:`hashing`});return i.metadata??={},i.metadata.verified_hmac=l.toString(`hex`),c}finally{u.fill(0)}}createStream(i,a){let{algorithm:o,secret:s}=this.options,c=(0,t.createHmac)(o,s),l=r[o],u=e.n(a),d=e.r(a);if(i===`compress`){let t=0;return new n.Transform({construct(t){t(d<l?new e.c({transformName:`hashing`,stage:`output`}):void 0)},transform(n,r,i){if(n.length>u-t)return i(new e.c({transformName:`hashing`,stage:`input`}));if(n.length>d-l-t)return i(new e.c({transformName:`hashing`,stage:`output`}));t+=n.length,c.update(n),this.push(n),i()},flush(e){this.push(c.digest()),e()}})}else{let r=[],i=0;return new n.Transform({transform(t,n,a){if(t.length>u-i)return a(new e.c({transformName:`hashing`,stage:`input`}));i+=t.length,r.push(t),a()},flush(n){let a=Buffer.concat(r,i);r=[];let o;try{if(a.length<l)throw new e.c({transformName:`hashing`});let r=a.subarray(0,a.length-l);if(r.length>d)throw new e.c({transformName:`hashing`,stage:`output`});let i=a.subarray(a.length-l);if(c.update(r),o=c.digest(),!(0,t.timingSafeEqual)(i,o))throw new e.c({transformName:`hashing`});let s=Buffer.from(r);a.fill(0),this.push(s),n()}catch(e){a.fill(0),n(e)}finally{o?.fill(0)}},destroy(e,t){r=[],t(e)}})}}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { C as StreamPluginContext, _ as ProcessorContext } from "./types-ia4x-Dvp.cjs";
|
|
2
|
+
import { t as BasePlugin } from "./plugin-C9Kd9coY.cjs";
|
|
3
|
+
import { Transform } from "node:stream";
|
|
4
|
+
|
|
5
|
+
//#region src/plugin/hashing.d.ts
|
|
6
|
+
type HashAlgorithm = 'sha256' | 'sha512';
|
|
7
|
+
/** HMAC-SHA-256 options. Secret must be at least 16 characters at runtime. */
|
|
8
|
+
interface Sha256HashingOptions {
|
|
9
|
+
readonly algorithm: 'sha256';
|
|
10
|
+
readonly secret: string;
|
|
11
|
+
}
|
|
12
|
+
/** HMAC-SHA-512 options. Secret must be at least 16 characters at runtime. */
|
|
13
|
+
interface Sha512HashingOptions {
|
|
14
|
+
readonly algorithm: 'sha512';
|
|
15
|
+
readonly secret: string;
|
|
16
|
+
}
|
|
17
|
+
/** Algorithm-discriminated HMAC configuration. */
|
|
18
|
+
type HashingOptions = Sha256HashingOptions | Sha512HashingOptions;
|
|
19
|
+
/**
|
|
20
|
+
* HashingPlugin — Standard library plugin for HMAC integrity checks.
|
|
21
|
+
* Appends a digest to the end of the buffer/stream.
|
|
22
|
+
*/
|
|
23
|
+
declare class HashingPlugin extends BasePlugin {
|
|
24
|
+
protected options: HashingOptions;
|
|
25
|
+
readonly name = "hashing";
|
|
26
|
+
readonly version = "3.0.0";
|
|
27
|
+
constructor(options: HashingOptions);
|
|
28
|
+
process(data: Buffer, context: ProcessorContext): Promise<Buffer>;
|
|
29
|
+
reverse(data: Buffer, context: ProcessorContext): Promise<Buffer>;
|
|
30
|
+
createStream(mode: 'compress' | 'decompress', context?: StreamPluginContext): Transform;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Sha512HashingOptions as a, Sha256HashingOptions as i, HashingOptions as n, HashingPlugin as r, HashAlgorithm as t };
|
package/dist/hashing.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./hashing-JtOHPybU.cjs`);exports.HashingPlugin=e.t;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as Sha512HashingOptions, i as Sha256HashingOptions, n as HashingOptions, r as HashingPlugin, t as HashAlgorithm } from "./hashing-LY-8x66g.cjs";
|
|
2
|
+
export { type HashAlgorithm, type HashingOptions, HashingPlugin, type Sha256HashingOptions, type Sha512HashingOptions };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as Sha512HashingOptions, i as Sha256HashingOptions, n as HashingOptions, r as HashingPlugin, t as HashAlgorithm } from "./hashing-B6xGcbQR.mjs";
|
|
2
|
+
export { type HashAlgorithm, type HashingOptions, HashingPlugin, type Sha256HashingOptions, type Sha512HashingOptions };
|
package/dist/hashing.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./hashing-ChrADfcH.mjs";export{e as HashingPlugin};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core-B_z1gN5W.cjs`),t=require(`./resourceLimits-CI0Qrqdf.cjs`),n=require(`./dataEngine-Bvl6amzP.cjs`),r=require(`./kms_encryption-xyWi65rZ.cjs`),i=require(`./hashing-JtOHPybU.cjs`),a=require(`./encryption-DdP1zFYl.cjs`),o=require(`./compression-DrgzribA.cjs`),s=require(`./worker-I_kqxWeK.cjs`),c=require(`./validation-pEeJmCad.cjs`);var l=class e{constructor(e){this.transforms=e}static from(t){return new e([t])}pipe(t){return new e([...this.transforms,t])}async run(e,n={}){let r=e,i=n.signal,a=()=>{if(i?.aborted)throw new t.g};a();for(let e of this.transforms){a();let o=Promise.resolve(e(r,n));r=i?await new Promise((e,n)=>{let r=()=>n(new t.g);i.addEventListener(`abort`,r,{once:!0}),o.then(e,n).finally(()=>i.removeEventListener(`abort`,r)).catch(()=>{}),i.aborted&&r()}):await o}return a(),r}};function u(e){return l.from(e)}var d=class extends t.i{name=`benchmark`;version=`2.0.0`;async process(e,t){t.metadata??={};let n=t.metadata[`benchmark:start`]||Date.now();return t.metadata[`benchmark:in_bytes`]=e.length,t.metadata[`benchmark:start`]=n,e}async reverse(e,t){t.metadata??={},t.metadata[`benchmark:out_bytes`]=e.length;let n=t.metadata[`benchmark:start`];return n&&(t.metadata[`benchmark:duration_ms`]=Date.now()-n),e}};const f={Hashing:i.t,Encryption:a.t,Compression:o.t,Benchmark:d,WorkerPool:s.t,Validation:c.t,KmsEncryption:r.t};n.t.registerPlugin(`hashing`,i.t),n.t.registerPlugin(`encryption`,a.t),n.t.registerPlugin(`compression`,o.t),n.t.registerPlugin(`benchmark`,d),n.t.registerPlugin(`worker-pool`,s.t),n.t.registerPlugin(`validation`,c.t),n.t.registerPlugin(`kms-encryption`,r.t),exports.AuthenticationError=t.a,exports.BasePlugin=t.i,exports.BenchmarkPlugin=d,exports.CompressionError=t.o,exports.CompressionPlugin=o.t,exports.DEFAULT_HIGH_WATER=e.t,exports.DEFAULT_LIMITS=t.t,exports.DataEngine=n.t,exports.EncryptionError=t.s,exports.EncryptionPlugin=a.t,exports.GuardedUnpackrStream=e.n,exports.HashingError=t.c,exports.HashingPlugin=i.t,exports.InvalidKeyError=t.l,exports.InvalidKmsProviderCapabilityError=t.u,exports.InvalidPluginCapabilityError=t.d,exports.KmsAuthenticationError=t.f,exports.KmsEncryptionPlugin=r.t,exports.KmsProviderAuthenticationError=t.p,exports.KmsProviderError=t.m,exports.KmsProviderUnavailableError=t.h,exports.MAX_FRAME_BYTES=e.r,exports.ORIGINAL_TYPES=e.i,exports.OperationAbortedError=t.g,exports.OperationTimeoutError=t._,exports.PACKR=e.a,exports.PIPEX_MANIFEST_KEY=e.o,exports.PipeXError=t.v,exports.PipelineAbortedError=t.y,exports.Plugins=f,exports.TypedPipeline=l,exports.UNPACKR=e.s,exports.UnsupportedAlgorithmError=t.b,exports.UnsupportedKmsOperationError=t.x,exports.UnsupportedReverseError=t.S,exports.UnsupportedStreamingError=t.C,exports.ValidationError=t.w,exports.ValidationPlugin=c.t,exports.WorkerPoolCloseError=t.T,exports.WorkerPoolClosedError=t.E,exports.WorkerPoolPlugin=s.t,exports.WorkerQueueFullError=t.D,exports.WorkerTaskError=t.O,exports.assertExists=e.c,exports.assertKnownValueByteLimit=e.l,exports.assertMessagePackFrameLimits=e.V,exports.assertOriginalType=e.u,exports.assertReversiblePipeline=e.d,exports.assertStreamingPipeline=e.f,exports.buildByteLimitTransform=e.p,exports.buildFallbackTransform=e.m,exports.buildFrameLimitTransform=e.H,exports.buildKnownValueByteLimitTransform=e.h,exports.buildManifest=e.g,exports.buildManifestExtractTransform=e._,exports.buildManifestHeaderTransform=e.v,exports.buildNdjsonTransform=e.y,exports.buildObjectLimitTransform=e.b,exports.buildTransformChain=e.x,exports.createPackrStream=e.S,exports.createUnpackrStream=e.C,exports.detectType=e.w,exports.fromBuffer=e.T,exports.getKmsProviderCapabilities=r.n,exports.getPluginCapabilities=e.E,exports.hasStreamSupport=e.D,exports.isManifest=e.U,exports.makeContext=e.O,exports.resolveOutputPath=e.k,exports.runPipeline=e.A,exports.supportsKmsOperation=r.r,exports.supportsOperation=e.j,exports.supportsReverse=e.M,exports.toBuffer=e.N,exports.typedPipeline=u,exports.withRetry=e.P;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { C as StreamPluginContext, S as Span, T as isManifest, _ as ProcessorContext, a as EngineEvents, b as RetryOptions, c as KmsOperation, d as KmsRequestOptions, f as Logger, g as PluginOperation, h as PluginCapabilities, i as EngineConfig, l as KmsProvider, m as PipeXManifest, n as AuditRecord, o as EngineLimits, p as OperationOptions, r as BinaryUndoOptions, s as EngineResult, t as AuditLogger, u as KmsProviderCapabilities, v as ProcessorPlugin, w as Tracer, x as SchemaRegistry, y as RegisteredPluginCapabilities } from "./types-ia4x-Dvp.cjs";
|
|
2
|
+
import { t as BasePlugin } from "./plugin-C9Kd9coY.cjs";
|
|
3
|
+
import { i as CompressionType, n as CompressionOptions, r as CompressionPlugin } from "./compression-DnVFu8TM.cjs";
|
|
4
|
+
import { a as EncryptionPlugin, i as EncryptionOptions, o as EncryptionAlgorithm } from "./encryption-BmmNECIc.cjs";
|
|
5
|
+
import { n as HashingOptions, r as HashingPlugin, t as HashAlgorithm } from "./hashing-LY-8x66g.cjs";
|
|
6
|
+
import { n as KmsEncryptionPlugin, t as KmsEncryptionOptions } from "./kms_encryption-Dh1LEHhk.cjs";
|
|
7
|
+
import { n as PluginConstructor, t as DataEngine } from "./dataEngine-D-fIXgE7.cjs";
|
|
8
|
+
import { n as WorkerPoolPlugin, t as WorkerPoolOptions } from "./worker-CbuCpSNc.cjs";
|
|
9
|
+
import { n as ValidationPlugin, t as ValidationOptions } from "./validation-CqmhNHdW.cjs";
|
|
10
|
+
import { Duplex, Readable, Transform, TransformCallback, Writable } from "node:stream";
|
|
11
|
+
import { Packr, PackrStream, Unpackr, UnpackrStream } from "msgpackr";
|
|
12
|
+
|
|
13
|
+
//#region src/core/frameLimits.d.ts
|
|
14
|
+
declare function assertMessagePackFrameLimits(input: Buffer | Uint8Array, maxFrameBytes: number, maxFrames?: number): number;
|
|
15
|
+
declare function buildFrameLimitTransform(maxFrameBytes: number, maxFrames: number): Transform;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/core/resourceLimits.d.ts
|
|
18
|
+
declare const DEFAULT_LIMITS: Readonly<EngineLimits>;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/core/core.d.ts
|
|
21
|
+
/**
|
|
22
|
+
* Executes a function with automatic retries and backoff.
|
|
23
|
+
*/
|
|
24
|
+
declare function withRetry<T>(fn: () => Promise<T> | T, options?: RetryOptions, logger?: Logger, control?: {
|
|
25
|
+
signal?: AbortSignal;
|
|
26
|
+
limits?: Pick<EngineLimits, 'maxRetryAttempts' | 'maxRetryDelayMs'>;
|
|
27
|
+
track?: (pending: Promise<unknown>) => void;
|
|
28
|
+
}): Promise<T>;
|
|
29
|
+
declare const PIPEX_MANIFEST_KEY: "__pipex_v";
|
|
30
|
+
declare const PACKR: Packr;
|
|
31
|
+
declare const UNPACKR: Unpackr;
|
|
32
|
+
/** @deprecated Use `DEFAULT_LIMITS.maxFrameBytes` or an engine-specific limit. */
|
|
33
|
+
declare const MAX_FRAME_BYTES: number;
|
|
34
|
+
declare const DEFAULT_HIGH_WATER: number;
|
|
35
|
+
type PluginWithStream = ProcessorPlugin & {
|
|
36
|
+
createStream(mode: 'compress' | 'decompress', context?: StreamPluginContext): Duplex;
|
|
37
|
+
};
|
|
38
|
+
declare function hasStreamSupport(p: ProcessorPlugin): p is PluginWithStream;
|
|
39
|
+
/**
|
|
40
|
+
* Returns the effective capabilities of a plugin after validating declarations.
|
|
41
|
+
* Explicit `false` declarations are authoritative, which supports plugins whose
|
|
42
|
+
* implementation is present but disabled by configuration (for example workers).
|
|
43
|
+
*/
|
|
44
|
+
declare function getPluginCapabilities(plugin: ProcessorPlugin): Readonly<PluginCapabilities>;
|
|
45
|
+
/** Query an operation without attempting to execute it. Invalid declarations fail closed. */
|
|
46
|
+
declare function supportsOperation(plugin: ProcessorPlugin, operation: PluginOperation): boolean;
|
|
47
|
+
declare function supportsReverse(plugin: ProcessorPlugin): plugin is ProcessorPlugin & Required<Pick<ProcessorPlugin, 'reverse'>>;
|
|
48
|
+
declare function assertReversiblePipeline(plugins: readonly ProcessorPlugin[]): void;
|
|
49
|
+
declare function assertStreamingPipeline(plugins: readonly ProcessorPlugin[]): void;
|
|
50
|
+
declare function detectType(input: unknown): string;
|
|
51
|
+
declare function toBuffer(input: unknown): Buffer;
|
|
52
|
+
declare const ORIGINAL_TYPES: readonly ["buffer", "object", "array", "string", "number", "boolean", "null", "undefined", "bigint", "json"];
|
|
53
|
+
declare function assertOriginalType(value: unknown): asserts value is string;
|
|
54
|
+
declare function fromBuffer(buffer: Buffer, targetType: string, maxFrameBytes?: number): unknown;
|
|
55
|
+
declare function makeContext(requestId: string, extra?: Record<string, unknown>, logger?: Logger, span?: Span, signal?: AbortSignal, limits?: Readonly<EngineLimits>): ProcessorContext;
|
|
56
|
+
declare function buildManifest(plugins: readonly ProcessorPlugin[]): PipeXManifest;
|
|
57
|
+
/**
|
|
58
|
+
* A passthrough Transform that prepends a single msgpack-encoded manifest frame
|
|
59
|
+
* to the byte stream before forwarding any data chunks.
|
|
60
|
+
* Inserted between PackrStream output and the file destination.
|
|
61
|
+
*/
|
|
62
|
+
declare function buildManifestHeaderTransform(manifest: PipeXManifest): Transform;
|
|
63
|
+
/**
|
|
64
|
+
* Object-mode Transform that sits after UnpackrStream.
|
|
65
|
+
* Intercepts the first decoded frame: if it is a PipeXManifest, captures it
|
|
66
|
+
* via onManifest() and drops it from the output; all other frames pass through.
|
|
67
|
+
*/
|
|
68
|
+
declare function buildManifestExtractTransform(onManifest: (m: PipeXManifest) => void): Transform;
|
|
69
|
+
/** DoS-safe UnpackrStream subclass — rejects oversized raw chunks before decode. */
|
|
70
|
+
declare class GuardedUnpackrStream extends UnpackrStream {
|
|
71
|
+
#private;
|
|
72
|
+
constructor(options?: Record<string, unknown>, maxInputBytes?: number);
|
|
73
|
+
_transform(chunk: Buffer, enc: BufferEncoding, cb: TransformCallback): void;
|
|
74
|
+
}
|
|
75
|
+
/** PackrStream with useRecords disabled (safe default). */
|
|
76
|
+
declare function createPackrStream(): PackrStream;
|
|
77
|
+
/** GuardedUnpackrStream with useRecords disabled. */
|
|
78
|
+
declare function createUnpackrStream(maxInputBytes?: number): GuardedUnpackrStream;
|
|
79
|
+
declare function buildByteLimitTransform(maxBytes: number, label: string): Transform;
|
|
80
|
+
declare function buildObjectLimitTransform(maxFrames: number): Transform;
|
|
81
|
+
/** Rejects known byte-backed values before MessagePack copies their payload. */
|
|
82
|
+
declare function assertKnownValueByteLimit(value: unknown, maxBytes: number, label: string): void;
|
|
83
|
+
declare function buildKnownValueByteLimitTransform(maxBytes: number, label: string): Transform;
|
|
84
|
+
/**
|
|
85
|
+
* Wraps a plugin's process/reverse call in a Transform.
|
|
86
|
+
* requestId is fixed per stream instance — not per chunk — to avoid
|
|
87
|
+
* 60× randomUUID() overhead on high-throughput paths.
|
|
88
|
+
*/
|
|
89
|
+
declare function buildFallbackTransform(plugin: ProcessorPlugin, reverse: boolean, emitProgress?: (bytes: number) => void, logger?: Logger, tracer?: Tracer, dlq?: Writable, streamContext?: StreamPluginContext): Transform;
|
|
90
|
+
/** Serialises JS objects to NDJSON lines. */
|
|
91
|
+
declare function buildNdjsonTransform(): Transform;
|
|
92
|
+
/**
|
|
93
|
+
* Builds the ordered Transform chain from a plugin list.
|
|
94
|
+
* Uses native createStream() when available; falls back to buildFallbackTransform.
|
|
95
|
+
*/
|
|
96
|
+
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)[];
|
|
97
|
+
/**
|
|
98
|
+
* Runs an arbitrary pipeline: Source → [...Transforms] → Destination.
|
|
99
|
+
* The `any` cast is scoped to this single call site — nowhere else.
|
|
100
|
+
*/
|
|
101
|
+
declare function runPipeline(source: Readable, transforms: (Duplex | Transform | PackrStream | GuardedUnpackrStream)[], destination: Writable, options?: {
|
|
102
|
+
signal?: AbortSignal;
|
|
103
|
+
}): Promise<void>;
|
|
104
|
+
declare function assertExists(inputPath: string, allowedRoot?: string): string;
|
|
105
|
+
declare function resolveOutputPath(outputPath: string, allowedRoot?: string): string;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/core/typedPipeline.d.ts
|
|
108
|
+
/** A synchronous or asynchronous transformation from Input to Output. */
|
|
109
|
+
type TypedTransform<Input, Output> = (input: Input, options: Readonly<OperationOptions>) => Output | Promise<Output>;
|
|
110
|
+
/** Cancellation options for typed application pipelines. */
|
|
111
|
+
type TypedPipelineOptions = Readonly<OperationOptions>;
|
|
112
|
+
/** An immutable pipeline whose input and output types are preserved across steps. */
|
|
113
|
+
declare class TypedPipeline<Input, Output> {
|
|
114
|
+
private readonly transforms;
|
|
115
|
+
private constructor();
|
|
116
|
+
/**
|
|
117
|
+
* Start a pipeline from an initial typed transform.
|
|
118
|
+
* @param transform First transformation; its input type becomes the pipeline input.
|
|
119
|
+
*/
|
|
120
|
+
static from<Input, Output>(transform: TypedTransform<Input, Output>): TypedPipeline<Input, Awaited<Output>>;
|
|
121
|
+
/**
|
|
122
|
+
* Append a transform. Its input must accept this pipeline's current output.
|
|
123
|
+
* The returned pipeline infers the appended asynchronous or synchronous output.
|
|
124
|
+
*/
|
|
125
|
+
pipe<Next>(transform: TypedTransform<Output, Next>): TypedPipeline<Input, Awaited<Next>>;
|
|
126
|
+
/** Execute all transforms in order, honouring cancellation between awaits. */
|
|
127
|
+
run(input: Input, options?: TypedPipelineOptions): Promise<Output>;
|
|
128
|
+
}
|
|
129
|
+
/** Create a typed pipeline with automatic end-to-end transform inference. */
|
|
130
|
+
declare function typedPipeline<Input, Output>(first: TypedTransform<Input, Output>): TypedPipeline<Input, Awaited<Output>>;
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/core/errors.d.ts
|
|
133
|
+
type PipeXErrorCode = 'VALIDATION_FAILED' | 'COMPRESSION_FAILED' | 'HASHING_FAILED' | 'UNSUPPORTED_ALGORITHM' | 'UNSUPPORTED_REVERSE' | 'UNSUPPORTED_STREAMING' | 'INVALID_PLUGIN_CAPABILITY' | 'ENCRYPTION_ERROR' | 'INVALID_ENCRYPTION_KEY' | 'ENCRYPTION_AUTHENTICATION_FAILED' | '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';
|
|
134
|
+
declare class PipeXError extends Error {
|
|
135
|
+
readonly code: PipeXErrorCode;
|
|
136
|
+
readonly name: string;
|
|
137
|
+
readonly transformName?: string;
|
|
138
|
+
readonly stage?: string;
|
|
139
|
+
constructor(code: PipeXErrorCode, message: string, options?: ErrorOptions & {
|
|
140
|
+
transformName?: string;
|
|
141
|
+
stage?: string;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/** Domain failures use fixed, non-sensitive messages. Never include input, keys or arbitrary provider errors. */
|
|
145
|
+
declare class ValidationError extends PipeXError {
|
|
146
|
+
readonly name = "ValidationError";
|
|
147
|
+
constructor(options?: ErrorOptions & {
|
|
148
|
+
transformName?: string;
|
|
149
|
+
stage?: string;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
declare class CompressionError extends PipeXError {
|
|
153
|
+
readonly name = "CompressionError";
|
|
154
|
+
constructor(options?: ErrorOptions & {
|
|
155
|
+
transformName?: string;
|
|
156
|
+
stage?: string;
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
declare class HashingError extends PipeXError {
|
|
160
|
+
readonly name = "HashingError";
|
|
161
|
+
constructor(options?: ErrorOptions & {
|
|
162
|
+
transformName?: string;
|
|
163
|
+
stage?: string;
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
declare class UnsupportedAlgorithmError extends PipeXError {
|
|
167
|
+
readonly name = "UnsupportedAlgorithmError";
|
|
168
|
+
constructor(options?: ErrorOptions & {
|
|
169
|
+
transformName?: string;
|
|
170
|
+
stage?: string;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/** Alias hierarchy: existing OperationAbortedError retains its code and instanceof contract. */
|
|
174
|
+
declare class PipelineAbortedError extends PipeXError {
|
|
175
|
+
readonly name: string;
|
|
176
|
+
constructor(options?: ErrorOptions & {
|
|
177
|
+
transformName?: string;
|
|
178
|
+
stage?: string;
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
declare class UnsupportedReverseError extends PipeXError {
|
|
182
|
+
readonly plugin: string;
|
|
183
|
+
readonly name: string;
|
|
184
|
+
constructor(plugin: string);
|
|
185
|
+
}
|
|
186
|
+
declare class UnsupportedStreamingError extends PipeXError {
|
|
187
|
+
readonly plugin: string;
|
|
188
|
+
readonly name: string;
|
|
189
|
+
constructor(plugin: string);
|
|
190
|
+
}
|
|
191
|
+
type InvalidPluginCapabilityIssue = 'MUST_BE_BOOLEAN' | 'MISSING_IMPLEMENTATION' | 'CONFLICTING_IMPLEMENTATION';
|
|
192
|
+
declare class InvalidPluginCapabilityError extends PipeXError {
|
|
193
|
+
readonly plugin: string;
|
|
194
|
+
readonly capability: 'reversible' | 'streaming';
|
|
195
|
+
readonly issue: InvalidPluginCapabilityIssue;
|
|
196
|
+
readonly name: string;
|
|
197
|
+
constructor(plugin: string, capability: 'reversible' | 'streaming', issue: InvalidPluginCapabilityIssue);
|
|
198
|
+
}
|
|
199
|
+
declare class OperationAbortedError extends PipelineAbortedError {
|
|
200
|
+
readonly name: string;
|
|
201
|
+
constructor(options?: ErrorOptions);
|
|
202
|
+
}
|
|
203
|
+
declare class OperationTimeoutError extends PipeXError {
|
|
204
|
+
readonly name: string;
|
|
205
|
+
constructor(options?: ErrorOptions);
|
|
206
|
+
}
|
|
207
|
+
declare class KmsProviderError extends PipeXError {
|
|
208
|
+
readonly operation: 'generateDataKey' | 'decrypt' | 'encrypt';
|
|
209
|
+
readonly name: string;
|
|
210
|
+
constructor(operation: 'generateDataKey' | 'decrypt' | 'encrypt', options?: ErrorOptions);
|
|
211
|
+
}
|
|
212
|
+
declare class KmsAuthenticationError extends PipeXError {
|
|
213
|
+
readonly name: string;
|
|
214
|
+
constructor();
|
|
215
|
+
}
|
|
216
|
+
declare class KmsProviderAuthenticationError extends PipeXError {
|
|
217
|
+
readonly operation: 'generateDataKey' | 'decrypt' | 'encrypt';
|
|
218
|
+
readonly name: string;
|
|
219
|
+
constructor(operation: 'generateDataKey' | 'decrypt' | 'encrypt');
|
|
220
|
+
}
|
|
221
|
+
declare class KmsProviderUnavailableError extends PipeXError {
|
|
222
|
+
readonly operation: 'generateDataKey' | 'decrypt' | 'encrypt';
|
|
223
|
+
readonly name: string;
|
|
224
|
+
constructor(operation: 'generateDataKey' | 'decrypt' | 'encrypt');
|
|
225
|
+
}
|
|
226
|
+
declare class UnsupportedKmsOperationError extends PipeXError {
|
|
227
|
+
readonly operation: 'generateDataKey' | 'decrypt' | 'encrypt';
|
|
228
|
+
readonly name: string;
|
|
229
|
+
constructor(operation: 'generateDataKey' | 'decrypt' | 'encrypt');
|
|
230
|
+
}
|
|
231
|
+
type InvalidKmsProviderCapabilityIssue = 'MUST_BE_BOOLEAN' | 'MISSING_IMPLEMENTATION';
|
|
232
|
+
declare class InvalidKmsProviderCapabilityError extends PipeXError {
|
|
233
|
+
readonly operation: 'generateDataKey' | 'decrypt' | 'encrypt';
|
|
234
|
+
readonly issue: InvalidKmsProviderCapabilityIssue;
|
|
235
|
+
readonly name: string;
|
|
236
|
+
constructor(operation: 'generateDataKey' | 'decrypt' | 'encrypt', issue: InvalidKmsProviderCapabilityIssue);
|
|
237
|
+
}
|
|
238
|
+
declare class WorkerPoolClosedError extends PipeXError {
|
|
239
|
+
readonly name: string;
|
|
240
|
+
constructor();
|
|
241
|
+
}
|
|
242
|
+
declare class WorkerQueueFullError extends PipeXError {
|
|
243
|
+
readonly maxQueue: number;
|
|
244
|
+
readonly name: string;
|
|
245
|
+
constructor(maxQueue: number);
|
|
246
|
+
}
|
|
247
|
+
declare class WorkerPoolCloseError extends PipeXError {
|
|
248
|
+
readonly name: string;
|
|
249
|
+
constructor(options?: ErrorOptions);
|
|
250
|
+
}
|
|
251
|
+
declare class WorkerTaskError extends PipeXError {
|
|
252
|
+
readonly taskName: string;
|
|
253
|
+
readonly name: string;
|
|
254
|
+
constructor(taskName: string, options?: ErrorOptions);
|
|
255
|
+
}
|
|
256
|
+
/** Public cryptographic failure categories; never include keys or ciphertext in messages. */
|
|
257
|
+
declare class EncryptionError extends PipeXError {
|
|
258
|
+
readonly name: string;
|
|
259
|
+
constructor(message?: string);
|
|
260
|
+
}
|
|
261
|
+
declare class InvalidKeyError extends PipeXError {
|
|
262
|
+
readonly name: string;
|
|
263
|
+
constructor();
|
|
264
|
+
}
|
|
265
|
+
declare class AuthenticationError extends PipeXError {
|
|
266
|
+
readonly name: string;
|
|
267
|
+
constructor();
|
|
268
|
+
}
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/core/kmsCapabilities.d.ts
|
|
271
|
+
/**
|
|
272
|
+
* Returns an immutable, runtime-validated view of a generic KMS provider.
|
|
273
|
+
* Explicit false declarations support legacy provider stubs that exist only
|
|
274
|
+
* to throw; such methods are never invoked through PipeX.
|
|
275
|
+
*/
|
|
276
|
+
declare function getKmsProviderCapabilities(provider: KmsProvider): Readonly<KmsProviderCapabilities>;
|
|
277
|
+
declare function supportsKmsOperation(provider: KmsProvider, operation: KmsOperation): boolean;
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/plugin/performance.d.ts
|
|
280
|
+
/**
|
|
281
|
+
* BenchmarkPlugin — Standard library plugin for monitoring data throughput.
|
|
282
|
+
* Records input/output byte counts in context metadata.
|
|
283
|
+
*/
|
|
284
|
+
declare class BenchmarkPlugin extends BasePlugin {
|
|
285
|
+
readonly name = "benchmark";
|
|
286
|
+
readonly version = "2.0.0";
|
|
287
|
+
process(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
288
|
+
reverse(data: Buffer, ctx: ProcessorContext): Promise<Buffer>;
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/index.d.ts
|
|
292
|
+
declare const Plugins: {
|
|
293
|
+
readonly Hashing: typeof HashingPlugin;
|
|
294
|
+
readonly Encryption: typeof EncryptionPlugin;
|
|
295
|
+
readonly Compression: typeof CompressionPlugin;
|
|
296
|
+
readonly Benchmark: typeof BenchmarkPlugin;
|
|
297
|
+
readonly WorkerPool: typeof WorkerPoolPlugin;
|
|
298
|
+
readonly Validation: typeof ValidationPlugin;
|
|
299
|
+
readonly KmsEncryption: typeof KmsEncryptionPlugin;
|
|
300
|
+
};
|
|
301
|
+
//#endregion
|
|
302
|
+
export { type AuditLogger, type AuditRecord, AuthenticationError, BasePlugin, BenchmarkPlugin, type BinaryUndoOptions, CompressionError, type CompressionOptions, CompressionPlugin, type CompressionType, DEFAULT_HIGH_WATER, DEFAULT_LIMITS, DataEngine, type EncryptionAlgorithm, EncryptionError, type EncryptionOptions, EncryptionPlugin, type EngineConfig, type EngineEvents, type EngineLimits, type EngineResult, GuardedUnpackrStream, type HashAlgorithm, HashingError, type HashingOptions, HashingPlugin, InvalidKeyError, 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, PipelineAbortedError, type PluginCapabilities, type PluginConstructor, type PluginOperation, Plugins, type ProcessorContext, type ProcessorPlugin, type RegisteredPluginCapabilities, type RetryOptions, type SchemaRegistry, type Span, type StreamPluginContext, type Tracer, TypedPipeline, type TypedPipelineOptions, type TypedTransform, UNPACKR, UnsupportedAlgorithmError, UnsupportedKmsOperationError, UnsupportedReverseError, UnsupportedStreamingError, ValidationError, 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, typedPipeline, withRetry };
|