@suveren/gateway 0.40.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/control-plane/index.mjs +182 -37
- package/dist/mcp-server/http.mjs +355 -71
- package/dist/ui/assets/{index-C-lA_7Lt.js → index-CO-dj98E.js} +27 -27
- package/dist/ui/index.html +1 -1
- package/node_modules/@hap/core/README.md +3 -3
- package/node_modules/@hap/core/dist/index.d.mts +567 -123
- package/node_modules/@hap/core/dist/index.d.ts +567 -123
- package/node_modules/@hap/core/dist/index.js +869 -23
- package/node_modules/@hap/core/dist/index.mjs +829 -22
- package/node_modules/@hap/core/node_modules/@hpke/core/LICENSE +21 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/README.md +263 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/mod.js +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/package.json +3 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.d.ts +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/aesGcm.js +167 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.d.ts +34 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/aeads/exportOnly.js +56 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.d.ts +145 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/cipherSuiteNative.js +326 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.d.ts +15 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/encryptionContext.js +68 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.d.ts +19 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/exporterContext.js +62 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/aeadParams.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.d.ts +13 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/cipherSuiteParams.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.d.ts +8 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encapsulator.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.d.ts +40 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/encryptionContext.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/exporter.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.d.ts +7 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/keyInfo.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.d.ts +10 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/interfaces/responses.js +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.d.ts +26 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemNative.js +112 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js +214 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js +214 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX25519.js +66 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/kems/dhkemX448.js +66 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.d.ts +5 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/mutex.js +28 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.d.ts +236 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/native.js +235 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.d.ts +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/recipientContext.js +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/senderContext.js +45 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.d.ts +2 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/esm/src/utils/emitNotSupported.js +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/package.json +46 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/mod.js +47 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/package.json +3 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.d.ts +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/aesGcm.js +183 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.d.ts +34 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/aeads/exportOnly.js +70 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.d.ts +145 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/cipherSuiteNative.js +340 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.d.ts +15 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/encryptionContext.js +82 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.d.ts +19 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/exporterContext.js +78 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/aeadParams.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.d.ts +13 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/cipherSuiteParams.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.d.ts +8 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encapsulator.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.d.ts +40 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/encryptionContext.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.d.ts +17 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/exporter.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.d.ts +7 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/keyInfo.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.d.ts +10 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/interfaces/responses.js +12 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.d.ts +26 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemNative.js +128 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.js +228 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts +24 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.js +228 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX25519.js +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.d.ts +38 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/kems/dhkemX448.js +80 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.d.ts +5 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/mutex.js +42 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.d.ts +236 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/native.js +255 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.d.ts +6 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/recipientContext.js +52 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.d.ts +11 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/senderContext.js +59 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.d.ts +2 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.d.ts.map +1 -0
- package/node_modules/@hap/core/node_modules/@hpke/core/script/src/utils/emitNotSupported.js +19 -0
- package/node_modules/@hap/core/package.json +2 -1
- package/node_modules/@hap/core/src/canonicalize.ts +9 -0
- package/node_modules/@hap/core/src/commitment-modes.ts +21 -9
- package/node_modules/@hap/core/src/errors.ts +24 -8
- package/node_modules/@hap/core/src/gatekeeper.ts +52 -8
- package/node_modules/@hap/core/src/index.ts +5 -1
- package/node_modules/@hap/core/src/issuance.ts +250 -0
- package/node_modules/@hap/core/src/mandate.ts +52 -14
- package/node_modules/@hap/core/src/owner-signature.ts +86 -39
- package/node_modules/@hap/core/src/profile.ts +45 -0
- package/node_modules/@hap/core/src/proposal-content.ts +219 -0
- package/node_modules/@hap/core/src/ticket-projection.ts +167 -0
- package/node_modules/@hap/core/src/ticket.ts +254 -20
- package/node_modules/@hap/core/src/types.ts +33 -5
- package/node_modules/@hap/core/src/verifier-policy.ts +178 -0
- package/node_modules/@hap/core/src/versions.ts +50 -19
- package/node_modules/@hono/node-server/dist/index.cjs +31 -6
- package/node_modules/@hono/node-server/dist/index.mjs +31 -6
- package/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@hpke/common/esm/package.json +5 -1
- package/node_modules/@hpke/common/esm/src/curve/montgomery.d.ts +2 -2
- package/node_modules/@hpke/common/esm/src/curve/montgomery.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/curve/montgomery.js +41 -26
- package/node_modules/@hpke/common/esm/src/hash/sha3.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/hash/sha3.js +0 -15
- package/node_modules/@hpke/common/esm/src/kdfs/hkdf.d.ts +2 -1
- package/node_modules/@hpke/common/esm/src/kdfs/hkdf.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/kdfs/hkdf.js +12 -2
- package/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/xCurve.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/xCurve.js +14 -3
- package/node_modules/@hpke/common/esm/src/utils/misc.d.ts +6 -0
- package/node_modules/@hpke/common/esm/src/utils/misc.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/utils/misc.js +43 -10
- package/node_modules/@hpke/common/esm/src/utils/noble.d.ts +1 -1
- package/node_modules/@hpke/common/esm/src/utils/noble.d.ts.map +1 -1
- package/node_modules/@hpke/common/esm/src/utils/noble.js +21 -10
- package/node_modules/@hpke/common/package.json +5 -1
- package/node_modules/@hpke/common/script/src/curve/montgomery.d.ts +2 -2
- package/node_modules/@hpke/common/script/src/curve/montgomery.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/curve/montgomery.js +40 -25
- package/node_modules/@hpke/common/script/src/hash/sha3.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/hash/sha3.js +0 -15
- package/node_modules/@hpke/common/script/src/kdfs/hkdf.d.ts +2 -1
- package/node_modules/@hpke/common/script/src/kdfs/hkdf.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/kdfs/hkdf.js +12 -2
- package/node_modules/@hpke/common/script/src/kems/dhkemPrimitives/xCurve.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/kems/dhkemPrimitives/xCurve.js +13 -2
- package/node_modules/@hpke/common/script/src/utils/misc.d.ts +6 -0
- package/node_modules/@hpke/common/script/src/utils/misc.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/utils/misc.js +43 -9
- package/node_modules/@hpke/common/script/src/utils/noble.d.ts +1 -1
- package/node_modules/@hpke/common/script/src/utils/noble.d.ts.map +1 -1
- package/node_modules/@hpke/common/script/src/utils/noble.js +22 -11
- package/node_modules/@hpke/core/README.md +56 -56
- package/node_modules/@hpke/core/esm/package.json +2 -1
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts +3 -21
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -1
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js +3 -201
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts +3 -21
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.d.ts.map +1 -1
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js +3 -201
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.d.ts +26 -0
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.d.ts.map +1 -0
- package/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/xCurveNative.js +216 -0
- package/node_modules/@hpke/core/package.json +6 -2
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts +3 -21
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.d.ts.map +1 -1
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x25519.js +4 -202
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts +3 -21
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.d.ts.map +1 -1
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/x448.js +4 -202
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.d.ts +26 -0
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.d.ts.map +1 -0
- package/node_modules/@hpke/core/script/src/kems/dhkemPrimitives/xCurveNative.js +230 -0
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +752 -0
- package/node_modules/encodeurl/README.md +14 -0
- package/node_modules/encodeurl/index.js +5 -10
- package/node_modules/encodeurl/package.json +10 -6
- package/node_modules/express-rate-limit/dist/index.cjs +7 -3
- package/node_modules/express-rate-limit/dist/index.mjs +7 -3
- package/node_modules/express-rate-limit/package.json +10 -10
- package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +1 -1
- package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +1 -1
- package/node_modules/hono/dist/cjs/context.js +1 -1
- package/node_modules/hono/dist/cjs/helper/css/common.js +3 -5
- package/node_modules/hono/dist/cjs/hono-base.js +4 -10
- package/node_modules/hono/dist/cjs/hono.js +0 -1
- package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/csrf/index.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/mount/index.js +4 -4
- package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +13 -11
- package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +4 -4
- package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +39 -51
- package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +15 -5
- package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +2 -1
- package/node_modules/hono/dist/cjs/utils/mount.js +35 -0
- package/node_modules/hono/dist/cjs/utils/url.js +10 -0
- package/node_modules/hono/dist/cjs/validator/validator.js +1 -1
- package/node_modules/hono/dist/context.js +1 -1
- package/node_modules/hono/dist/helper/css/common.js +3 -5
- package/node_modules/hono/dist/hono-base.js +4 -10
- package/node_modules/hono/dist/hono.js +0 -1
- package/node_modules/hono/dist/middleware/basic-auth/index.js +1 -1
- package/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
- package/node_modules/hono/dist/middleware/csrf/index.js +2 -2
- package/node_modules/hono/dist/middleware/jwk/jwk.js +2 -2
- package/node_modules/hono/dist/middleware/jwt/jwt.js +2 -2
- package/node_modules/hono/dist/middleware/language/language.js +1 -1
- package/node_modules/hono/dist/middleware/mount/index.js +4 -4
- package/node_modules/hono/dist/router/reg-exp-router/node.js +13 -11
- package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +5 -5
- package/node_modules/hono/dist/router/reg-exp-router/router.js +40 -52
- package/node_modules/hono/dist/router/reg-exp-router/trie.js +15 -5
- package/node_modules/hono/dist/types/middleware/mount/index.d.ts +1 -0
- package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -3
- package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +1 -1
- package/node_modules/hono/dist/types/utils/mount.d.ts +4 -0
- package/node_modules/hono/dist/types/utils/url.d.ts +1 -0
- package/node_modules/hono/dist/utils/jwt/jwt.js +2 -1
- package/node_modules/hono/dist/utils/mount.js +34 -0
- package/node_modules/hono/dist/utils/url.js +10 -1
- package/node_modules/hono/dist/validator/validator.js +1 -1
- package/node_modules/hono/package.json +1 -1
- package/node_modules/ip-address/README.md +39 -39
- package/node_modules/ip-address/dist/ipv6.js +1 -1
- package/node_modules/ip-address/dist/ipv6.js.map +1 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +3 -0
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +2 -0
- package/node_modules/jose/dist/types/jwt/verify.d.ts +3 -0
- package/node_modules/jose/dist/types/types.d.ts +8 -0
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +1 -0
- package/node_modules/jose/dist/webapi/jwks/remote.js +3 -1
- package/node_modules/jose/dist/webapi/lib/deflate.js +2 -1
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +2 -1
- package/node_modules/jose/package.json +1 -1
- package/node_modules/qs/CHANGELOG.md +29 -22
- package/node_modules/qs/dist/qs.js +14 -14
- package/node_modules/qs/eslint.config.mjs +6 -0
- package/node_modules/qs/lib/stringify.js +1 -1
- package/node_modules/qs/package.json +5 -5
- package/node_modules/qs/test/stringify.js +74 -0
- package/package.json +2 -2
|
@@ -198,6 +198,648 @@ declare module "node:zlib" {
|
|
|
198
198
|
constructor(options?: ZlibOptions);
|
|
199
199
|
}
|
|
200
200
|
interface Unzip extends stream.Transform, Zlib {}
|
|
201
|
+
type ZipInputType = ArrayBuffer | NodeJS.ArrayBufferView;
|
|
202
|
+
interface ZipEntryContentOptions {
|
|
203
|
+
/**
|
|
204
|
+
* Verify the entry's CRC-32 checksum.
|
|
205
|
+
* @default true
|
|
206
|
+
* @since v26.8.0
|
|
207
|
+
*/
|
|
208
|
+
verify?: boolean | undefined;
|
|
209
|
+
/**
|
|
210
|
+
* Reject content declaring more than this many uncompressed bytes, before allocating anything.
|
|
211
|
+
* @default zlib.getMaxZipContentSize()
|
|
212
|
+
* @since v26.8.0
|
|
213
|
+
*/
|
|
214
|
+
maxSize?: number | undefined;
|
|
215
|
+
}
|
|
216
|
+
interface ZipEntryContentIterOptions {
|
|
217
|
+
/**
|
|
218
|
+
* Verify the entry's CRC-32 checksum.
|
|
219
|
+
* @default true
|
|
220
|
+
* @since v26.8.0
|
|
221
|
+
*/
|
|
222
|
+
verify?: boolean | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Reject content declaring more than this many uncompressed bytes, before decompressing anything.
|
|
225
|
+
* @default no limit
|
|
226
|
+
* @since v26.8.0
|
|
227
|
+
*/
|
|
228
|
+
maxSize?: number | undefined;
|
|
229
|
+
}
|
|
230
|
+
interface ZipEntryCreateOptionsBase {
|
|
231
|
+
/**
|
|
232
|
+
* An entry comment.
|
|
233
|
+
* @since v26.8.0
|
|
234
|
+
*/
|
|
235
|
+
comment?: string | undefined;
|
|
236
|
+
/**
|
|
237
|
+
* Unix permission bits.
|
|
238
|
+
* @default 0o644; except 0o755 for directories, 0o777 for symlinks
|
|
239
|
+
* @since v26.8.0
|
|
240
|
+
*/
|
|
241
|
+
mode?: number | undefined;
|
|
242
|
+
/**
|
|
243
|
+
* The entry's modification time.
|
|
244
|
+
* @default the current time
|
|
245
|
+
* @since v26.8.0
|
|
246
|
+
*/
|
|
247
|
+
modified?: Date | undefined;
|
|
248
|
+
}
|
|
249
|
+
interface ZipEntryCreateOptions extends ZipEntryCreateOptionsBase {
|
|
250
|
+
/**
|
|
251
|
+
* Compression method.
|
|
252
|
+
* @default "deflate"; except "store" for directories and empty content
|
|
253
|
+
* @since v26.8.0
|
|
254
|
+
*/
|
|
255
|
+
method?: "deflate" | "store" | "zstd" | undefined;
|
|
256
|
+
}
|
|
257
|
+
interface ZipEntryCreateStreamOptions extends ZipEntryCreateOptionsBase {
|
|
258
|
+
/**
|
|
259
|
+
* Compression method.
|
|
260
|
+
* @default "deflate"
|
|
261
|
+
* @since v26.8.0
|
|
262
|
+
*/
|
|
263
|
+
method?: "deflate" | "store" | "zstd" | undefined;
|
|
264
|
+
}
|
|
265
|
+
interface ZipEntryCreateSymlinkOptions extends ZipEntryCreateOptionsBase {}
|
|
266
|
+
/**
|
|
267
|
+
* An in-memory, zero-copy view over the entries of a ZIP archive already held in a `Buffer`, `TypedArray`,
|
|
268
|
+
* `DataView`, or `ArrayBuffer`. Its set of entries can be edited - entries added or removed - but, unlike
|
|
269
|
+
* `ZipFile`, those edits are not written into the source buffer: a newly added entry is held as a separate
|
|
270
|
+
* in-memory `ZipEntry` (the passed buffer is a fixed-size view with no room to append to), and removal just drops
|
|
271
|
+
* the entry from `ZipBuffer`'s index. The original bytes are never modified. `zipBuffer.toBuffer()` serializes the
|
|
272
|
+
* current set of entries into a fresh archive.
|
|
273
|
+
*
|
|
274
|
+
* `ZipBuffer` does not copy the archive you hand it. It keeps a view onto that memory and reads each entry's
|
|
275
|
+
* content lazily and directly from it, which is what makes construction cheap regardless of archive size. The
|
|
276
|
+
* trade-off is that you must not modify or reuse that memory - including the `ArrayBuffer` backing a
|
|
277
|
+
* `TypedArray`/`DataView` - while the `ZipBuffer`, or any `ZipEntry` obtained from it, is still in use: a later
|
|
278
|
+
* read would observe the change and may fail or return corrupt data. Pass a copy (for example
|
|
279
|
+
* `Buffer.from(source)`) if the source might be mutated or reused.
|
|
280
|
+
*
|
|
281
|
+
* `add()` and `toBuffer()` each have a `*Sync` counterpart (`addSync()`, `toBufferSync()`) that performs the same
|
|
282
|
+
* compression work synchronously. As with the synchronous `node:fs` APIs, these block the Node.js event loop and
|
|
283
|
+
* further JavaScript execution until the operation completes; use them only where synchronous execution is
|
|
284
|
+
* appropriate (for example, short-lived scripts or startup code), not in code that must stay responsive.
|
|
285
|
+
* @since v26.8.0
|
|
286
|
+
* @experimental
|
|
287
|
+
*/
|
|
288
|
+
class ZipBuffer {
|
|
289
|
+
/**
|
|
290
|
+
* Parses the archive's central directory. Throws an `ERR_ZIP_INVALID_ARCHIVE` or `ERR_ZIP_UNSUPPORTED_FEATURE`
|
|
291
|
+
* error if `buffer` is not a well-formed, supported archive.
|
|
292
|
+
*
|
|
293
|
+
* `buffer` is not copied: the `ZipBuffer` retains a zero-copy view of it (for a `TypedArray`, `DataView`, or
|
|
294
|
+
* `ArrayBuffer`, of the underlying `ArrayBuffer`) and reads entry content directly from it on demand. Do not
|
|
295
|
+
* mutate or reuse that memory while the `ZipBuffer` or any entry read from it is still live; pass a copy if it
|
|
296
|
+
* might change.
|
|
297
|
+
* @param buffer A complete ZIP archive.
|
|
298
|
+
* @since v26.8.0
|
|
299
|
+
*/
|
|
300
|
+
constructor(buffer: ZipInputType);
|
|
301
|
+
/**
|
|
302
|
+
* @since v26.8.0
|
|
303
|
+
*/
|
|
304
|
+
[Symbol.iterator](): NodeJS.Iterator<[name: string, entry: ZipEntry]>;
|
|
305
|
+
/**
|
|
306
|
+
* Equivalent to `zipBuffer.addEntry(await zlib.ZipEntry.create(filename, data, options))`.
|
|
307
|
+
* @param filename The entry's name within the archive. A trailing `/` marks a directory entry.
|
|
308
|
+
* @param data The entry's complete, uncompressed content.
|
|
309
|
+
* @param options See `zlib.ZipEntry.create()`.
|
|
310
|
+
* @returns `Promise` fulfilled with the created `ZipEntry`.
|
|
311
|
+
* @since v26.8.0
|
|
312
|
+
*/
|
|
313
|
+
add(filename: string, data: ZipInputType, options?: ZipEntryCreateOptions): Promise<ZipEntry>;
|
|
314
|
+
/**
|
|
315
|
+
* The synchronous version of `zipBuffer.add()`.
|
|
316
|
+
* Equivalent to `zipBuffer.addEntry(zlib.ZipEntry.createSync(filename, data, options))`.
|
|
317
|
+
* @param filename The entry's name within the archive. A trailing `/` marks a directory entry.
|
|
318
|
+
* @param data The entry's complete, uncompressed content.
|
|
319
|
+
* @param options See `zlib.ZipEntry.createSync()`.
|
|
320
|
+
* @returns The created entry.
|
|
321
|
+
* @since v26.8.0
|
|
322
|
+
*/
|
|
323
|
+
addSync(filename: string, data: ZipInputType, options?: ZipEntryCreateOptions): ZipEntry;
|
|
324
|
+
/**
|
|
325
|
+
* Adds an already-built entry, keyed by its own `zipEntry.name`. Replaces any existing entry of that name.
|
|
326
|
+
* @returns `entry`
|
|
327
|
+
* @since v26.8.0
|
|
328
|
+
*/
|
|
329
|
+
addEntry(entry: ZipEntry): ZipEntry;
|
|
330
|
+
/**
|
|
331
|
+
* Removes every entry.
|
|
332
|
+
* @since v26.8.0
|
|
333
|
+
*/
|
|
334
|
+
clear(): void;
|
|
335
|
+
/**
|
|
336
|
+
* @returns `true` if an entry named `name` existed and was removed.
|
|
337
|
+
* @since v26.8.0
|
|
338
|
+
*/
|
|
339
|
+
delete(name: string): boolean;
|
|
340
|
+
/**
|
|
341
|
+
* @returns `Iterator` of `[name, entry]` pairs, where `entry` is a `ZipEntry`.
|
|
342
|
+
* @since v26.8.0
|
|
343
|
+
*/
|
|
344
|
+
entries(): NodeJS.Iterator<[name: string, entry: ZipEntry]>;
|
|
345
|
+
/**
|
|
346
|
+
* Calls `callback` once for each entry, in the order the archive lists them.
|
|
347
|
+
* @since v26.8.0
|
|
348
|
+
*/
|
|
349
|
+
forEach(callback: (entry: ZipEntry, name: string, zipBuffer: this) => void, thisArg?: any): void;
|
|
350
|
+
/**
|
|
351
|
+
* Throws `ERR_ZIP_ENTRY_NOT_FOUND` if the archive has no entry named `name`.
|
|
352
|
+
* @since v26.8.0
|
|
353
|
+
*/
|
|
354
|
+
get(name: string): ZipEntry;
|
|
355
|
+
/**
|
|
356
|
+
* @since v26.8.0
|
|
357
|
+
*/
|
|
358
|
+
has(name: string): boolean;
|
|
359
|
+
/**
|
|
360
|
+
* @returns `Iterator` of entry names.
|
|
361
|
+
* @since v26.8.0
|
|
362
|
+
*/
|
|
363
|
+
keys(): NodeJS.Iterator<string>;
|
|
364
|
+
/**
|
|
365
|
+
* Serializes the current set of entries - in the order they were added or read - into a fresh archive,
|
|
366
|
+
* switching to Zip64 structures automatically as needed (see `zlib.createZipArchive()`).
|
|
367
|
+
* @param options An archive comment, as a shorthand for `{ comment: options }`. The comment defaults to
|
|
368
|
+
* `zipBuffer.comment`.
|
|
369
|
+
* @returns `Promise` fulfilled with a `Buffer` containing the serialized archive.
|
|
370
|
+
* @since v26.8.0
|
|
371
|
+
*/
|
|
372
|
+
toBuffer(options?: string | CreateZipArchiveOptions): Promise<NonSharedBuffer>;
|
|
373
|
+
/**
|
|
374
|
+
* The synchronous version of `zipBuffer.toBuffer()` (see `zlib.createZipArchiveSync()`).
|
|
375
|
+
* @param options See `zipBuffer.toBuffer()`.
|
|
376
|
+
* @returns The serialized archive.
|
|
377
|
+
* @since v26.8.0
|
|
378
|
+
*/
|
|
379
|
+
toBufferSync(options?: string | CreateZipArchiveOptions): NonSharedBuffer;
|
|
380
|
+
/**
|
|
381
|
+
* @returns `Iterator` of `ZipEntry`.
|
|
382
|
+
* @since v26.8.0
|
|
383
|
+
*/
|
|
384
|
+
values(): NodeJS.Iterator<ZipEntry>;
|
|
385
|
+
/**
|
|
386
|
+
* The archive-level comment, preserved byte-for-byte across `zipBuffer.toBuffer()` calls unless overridden.
|
|
387
|
+
* The bytes are decoded as UTF-8 when they are valid UTF-8 and as CP437 otherwise (the field carries no
|
|
388
|
+
* encoding flag of its own).
|
|
389
|
+
* @since v26.8.0
|
|
390
|
+
*/
|
|
391
|
+
readonly comment: string;
|
|
392
|
+
/**
|
|
393
|
+
* The number of entries in the archive.
|
|
394
|
+
* @since v26.8.0
|
|
395
|
+
*/
|
|
396
|
+
readonly size: number;
|
|
397
|
+
/**
|
|
398
|
+
* Always `true`.
|
|
399
|
+
* @since v26.8.0
|
|
400
|
+
*/
|
|
401
|
+
readonly writable: true;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* A single file or directory inside a ZIP archive. Instances are produced by `ZipBuffer` and `ZipFile`, or created
|
|
405
|
+
* directly for writing with `ZipEntry.create()`/`ZipEntry.createStream()`.
|
|
406
|
+
*
|
|
407
|
+
* `create()` and `content()` each have a `*Sync` counterpart (the streaming `contentIterator()` does not). As with
|
|
408
|
+
* the synchronous `node:fs` APIs, these block the Node.js event loop and further JavaScript execution until the
|
|
409
|
+
* operation (including any deflate/inflate pass) completes; use them only where synchronous execution is
|
|
410
|
+
* appropriate (for example, short-lived scripts or startup code), not in code that must stay responsive.
|
|
411
|
+
* @since v26.8.0
|
|
412
|
+
* @experimental
|
|
413
|
+
*/
|
|
414
|
+
class ZipEntry {
|
|
415
|
+
/**
|
|
416
|
+
* Compresses `data` (unless `method` is `'store'`, or compression would not reduce its size) and computes its
|
|
417
|
+
* CRC-32.
|
|
418
|
+
*
|
|
419
|
+
* When the entry ends up stored uncompressed (because `method` is `'store'`, or because compression would not
|
|
420
|
+
* reduce the size), the entry retains a zero-copy view of `data` rather than a copy, and its CRC-32 has already
|
|
421
|
+
* been recorded. Do not mutate `data` after creating the entry; pass a copy if it might change.
|
|
422
|
+
*
|
|
423
|
+
* The MS-DOS date/time fields ZIP uses for `modified` have 2-second resolution and no time zone. When
|
|
424
|
+
* `modified` does not fall on a whole 2-second boundary, an Info-ZIP extended-timestamp extra field is written
|
|
425
|
+
* as well, recording the whole (UTC) second so the time round-trips more precisely (see `zipEntry.modified`).
|
|
426
|
+
* This applies to every entry-creation path.
|
|
427
|
+
* @param filename The entry's name within the archive. A trailing `/` marks a directory entry.
|
|
428
|
+
* @param data The entry's complete, uncompressed content. Must be empty when `filename` names a directory.
|
|
429
|
+
* @since v26.8.0
|
|
430
|
+
*/
|
|
431
|
+
static create(filename: string, data: ZipInputType, options?: ZipEntryCreateOptions): Promise<ZipEntry>;
|
|
432
|
+
/**
|
|
433
|
+
* Creates an entry whose content is compressed on the fly as it is serialized by `zlib.createZipArchive()`,
|
|
434
|
+
* without buffering `source` in memory. Its `size`, `compressedSize`, and `crc32` only become available once
|
|
435
|
+
* serialization has finished. There is no synchronous counterpart: streaming entries only make sense with an
|
|
436
|
+
* asynchronous, incrementally-produced `source`.
|
|
437
|
+
*
|
|
438
|
+
* `source` is drained exactly once, during serialization. Until that happens the entry has no readable content,
|
|
439
|
+
* so `zipEntry.content()`, `zipEntry.contentSync()`, and `zipEntry.contentIterator()` throw
|
|
440
|
+
* `ERR_INVALID_STATE`. If the entry is serialized by adding it to a writable `ZipFile` with
|
|
441
|
+
* `zipFile.addEntry()` (or `addEntrySync()`), it is then promoted in place to a file-backed entry pointing at
|
|
442
|
+
* the copy just written, so it becomes readable (and can be serialized again) for as long as that `ZipFile`
|
|
443
|
+
* stays open. Serializing it any other way (for example directly through `zlib.createZipArchive()`) leaves it
|
|
444
|
+
* spent and unreadable.
|
|
445
|
+
*
|
|
446
|
+
* Because `source` may hold an operating-system resource (a file read stream, say), a streaming entry is
|
|
447
|
+
* disposable: its `Symbol.dispose` and `Symbol.asyncDispose` methods destroy `source` if it has not been
|
|
448
|
+
* consumed. An entry passed to an archive is disposed by that archive (see `zlib.createZipArchive()`); dispose
|
|
449
|
+
* an entry directly only when it was built but never handed to one. Disposal is a no-op for non-streaming
|
|
450
|
+
* entries - in particular a file-backed entry never closes the `ZipFile` descriptor it borrows.
|
|
451
|
+
* @param filename The entry's name within the archive. Must not end in `/`.
|
|
452
|
+
* @param source Yields the entry's uncompressed content as `Uint8Array` chunks.
|
|
453
|
+
* @since v26.8.0
|
|
454
|
+
*/
|
|
455
|
+
static createStream(
|
|
456
|
+
filename: string,
|
|
457
|
+
source: AsyncIterable<Uint8Array>,
|
|
458
|
+
options?: ZipEntryCreateStreamOptions,
|
|
459
|
+
): ZipEntry;
|
|
460
|
+
/**
|
|
461
|
+
* Creates a symbolic-link entry: a stored entry whose content is `target` and whose Unix mode type bits mark
|
|
462
|
+
* it as a symlink, so `zipEntry.isSymlink` is `true` when it is read back. Extraction tools that honor symlink
|
|
463
|
+
* entries recreate the link; treat `target` as untrusted (see `zipEntry.name` on path safety).
|
|
464
|
+
* @param filename The entry's name within the archive.
|
|
465
|
+
* @param target The symbolic link's target path.
|
|
466
|
+
* @since v26.8.0
|
|
467
|
+
*/
|
|
468
|
+
static createSymlink(filename: string, target: string, options?: ZipEntryCreateSymlinkOptions): ZipEntry;
|
|
469
|
+
/**
|
|
470
|
+
* The synchronous version of `zlib.ZipEntry.create()`.
|
|
471
|
+
* @param filename The entry's name within the archive. A trailing `/` marks a directory entry.
|
|
472
|
+
* @param data The entry's complete, uncompressed content. Must be empty when `filename` names a directory.
|
|
473
|
+
* @param options See `zlib.ZipEntry.create()`.
|
|
474
|
+
* @since v26.8.0
|
|
475
|
+
*/
|
|
476
|
+
static createSync(filename: string, data: ZipInputType, options?: ZipEntryCreateOptions): ZipEntry;
|
|
477
|
+
/**
|
|
478
|
+
* Parses every entry out of `buffer` directly, without indexing it into a `ZipBuffer`. Like `ZipBuffer`, the
|
|
479
|
+
* yielded entries hold zero-copy views of `buffer` rather than copies of their content, so the same rule
|
|
480
|
+
* applies: do not mutate or reuse `buffer` while any of them is still in use.
|
|
481
|
+
* @param buffer A complete ZIP archive.
|
|
482
|
+
* @returns `Iterator` of `ZipEntry`.
|
|
483
|
+
* @since v26.8.0
|
|
484
|
+
*/
|
|
485
|
+
static read(buffer: ZipInputType): NodeJS.Iterator<ZipEntry>;
|
|
486
|
+
private constructor();
|
|
487
|
+
/**
|
|
488
|
+
* @since v26.8.0
|
|
489
|
+
*/
|
|
490
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
491
|
+
/**
|
|
492
|
+
* @since v26.8.0
|
|
493
|
+
*/
|
|
494
|
+
[Symbol.dispose](): void;
|
|
495
|
+
/**
|
|
496
|
+
* Throws an `ERR_ZIP_ENTRY_TOO_LARGE` error if the entry's declared size exceeds `maxSize`, an
|
|
497
|
+
* `ERR_ZIP_ENTRY_CORRUPT` error if the content fails CRC-32 verification or does not match its declared size,
|
|
498
|
+
* and an `ERR_INVALID_STATE` error for a streaming entry (`zlib.ZipEntry.createStream()`) whose content is not
|
|
499
|
+
* yet available (see that method for when a streaming entry becomes readable).
|
|
500
|
+
* @returns `Promise` fulfilled with a `Buffer` containing the entry's decompressed content. The buffer is a
|
|
501
|
+
* fresh copy that shares no memory with the archive or with data the entry was created from.
|
|
502
|
+
* @since v26.8.0
|
|
503
|
+
*/
|
|
504
|
+
content(options?: ZipEntryContentOptions): Promise<NonSharedBuffer>;
|
|
505
|
+
/**
|
|
506
|
+
* The synchronous version of `zipEntry.content()`.
|
|
507
|
+
* @param options See `zipEntry.content()`.
|
|
508
|
+
* @returns The entry's decompressed content.
|
|
509
|
+
* @since v26.8.0
|
|
510
|
+
*/
|
|
511
|
+
contentSync(options?: ZipEntryContentOptions): NonSharedBuffer;
|
|
512
|
+
/**
|
|
513
|
+
* Unlike `zipEntry.content()`, this does not buffer the whole member in memory. For a file-backed entry (one
|
|
514
|
+
* returned by `zipFile.get()`) the compressed bytes are read from disk as the iterator is consumed and nothing
|
|
515
|
+
* is retained; the entry is valid only while its `ZipFile` is open.
|
|
516
|
+
*
|
|
517
|
+
* Because streaming is the bounded-memory path for arbitrarily large members, it is not capped by
|
|
518
|
+
* `zlib.getMaxZipContentSize()` the way `zipEntry.content()` is - that default guards a single large
|
|
519
|
+
* allocation, which streaming never makes. Output is still bounded per chunk to the declared uncompressed size;
|
|
520
|
+
* pass `maxSize` to impose an explicit ceiling.
|
|
521
|
+
*
|
|
522
|
+
* For an in-memory entry stored without compression, the yielded chunks are zero-copy views of the entry's
|
|
523
|
+
* retained content (see `zipEntry.rawContent`); do not mutate them.
|
|
524
|
+
*
|
|
525
|
+
* The yielded chunks are provisional until the iterator completes. CRC-32 verification (and the final
|
|
526
|
+
* declared-size check) can only run once every byte has been read, so a corrupt or truncated entry is reported
|
|
527
|
+
* by the iterator throwing after the last chunk, not before the first. Each chunk is still bounded so the total
|
|
528
|
+
* never exceeds the declared size or `maxSize`, but a consumer that must not act on unverified bytes should
|
|
529
|
+
* buffer them (or use `zipEntry.content()`, which verifies before returning anything) rather than processing
|
|
530
|
+
* chunks as they arrive.
|
|
531
|
+
* @returns `AsyncIterator` of `Buffer` chunks of the entry's decompressed content.
|
|
532
|
+
* @since v26.8.0
|
|
533
|
+
*/
|
|
534
|
+
contentIterator(options?: ZipEntryContentIterOptions): NodeJS.AsyncIterator<Buffer>;
|
|
535
|
+
/**
|
|
536
|
+
* @since v26.8.0
|
|
537
|
+
*/
|
|
538
|
+
readonly comment: string;
|
|
539
|
+
/**
|
|
540
|
+
* `true` if the entry's content is stored in compressed form (any compression method, currently deflate or
|
|
541
|
+
* Zstandard); `false` if it is stored uncompressed.
|
|
542
|
+
* @since v26.8.0
|
|
543
|
+
*/
|
|
544
|
+
readonly compressed: boolean;
|
|
545
|
+
/**
|
|
546
|
+
* @since v26.8.0
|
|
547
|
+
*/
|
|
548
|
+
readonly compressedSize: number;
|
|
549
|
+
/**
|
|
550
|
+
* @since v26.8.0
|
|
551
|
+
*/
|
|
552
|
+
readonly crc32: number;
|
|
553
|
+
/**
|
|
554
|
+
* The entry's raw general-purpose bit flag.
|
|
555
|
+
* @since v26.8.0
|
|
556
|
+
*/
|
|
557
|
+
readonly flags: number;
|
|
558
|
+
/**
|
|
559
|
+
* `true` if the entry is a directory (its name ends with `/`).
|
|
560
|
+
* @since v26.8.0
|
|
561
|
+
*/
|
|
562
|
+
readonly isDirectory: boolean;
|
|
563
|
+
/**
|
|
564
|
+
* `true` if the entry is a regular file - that is, neither a directory nor a symbolic link.
|
|
565
|
+
* @since v26.8.0
|
|
566
|
+
*/
|
|
567
|
+
readonly isFile: boolean;
|
|
568
|
+
/**
|
|
569
|
+
* `true` if the entry is a symbolic link (its Unix mode type bits are `S_IFLNK`); its content is the link
|
|
570
|
+
* target. Always `false` for archives not written on a Unix-like system. When extracting, treat a symlink's
|
|
571
|
+
* target as untrusted - see `zipEntry.name` on path safety.
|
|
572
|
+
* @since v26.8.0
|
|
573
|
+
*/
|
|
574
|
+
readonly isSymlink: boolean;
|
|
575
|
+
/**
|
|
576
|
+
* The entry's raw compression method: `0` for stored, `8` for deflate, `93` for Zstandard.
|
|
577
|
+
* @since v26.8.0
|
|
578
|
+
*/
|
|
579
|
+
readonly method: number;
|
|
580
|
+
/**
|
|
581
|
+
* The entry's Unix mode permission bits, including the setuid, setgid, and sticky bits (the low 12 bits,
|
|
582
|
+
* `0o7777`), or `0` if the archive was not written on a Unix-like system. The file-type bits are not included
|
|
583
|
+
* here; use `zipEntry.isDirectory` / `zipEntry.isSymlink` for the type.
|
|
584
|
+
* @since v26.8.0
|
|
585
|
+
*/
|
|
586
|
+
readonly mode: number;
|
|
587
|
+
/**
|
|
588
|
+
* The entry's last-modification time. When the archive carries a higher-fidelity timestamp in an extra field -
|
|
589
|
+
* an NTFS (`0x000a`), Info-ZIP extended (`0x5455`), or Info-ZIP Unix (`0x5855`) field, as most modern tools
|
|
590
|
+
* write - that absolute (UTC) time is used; otherwise the coarse, local-time MS-DOS date/time field (2-second
|
|
591
|
+
* resolution) is used.
|
|
592
|
+
*
|
|
593
|
+
* Some tools store their high-fidelity timestamp only in the local file header, so on a file-backed entry (one
|
|
594
|
+
* returned by `zipFile.get()`) the first read of this property may perform a small synchronous positioned disk
|
|
595
|
+
* read to resolve that header. If that read fails, the value silently falls back to the central-directory
|
|
596
|
+
* data.
|
|
597
|
+
* @since v26.8.0
|
|
598
|
+
*/
|
|
599
|
+
readonly modified: Date;
|
|
600
|
+
/**
|
|
601
|
+
* The entry's name, decoded from the central directory, which is treated as authoritative - a local file header
|
|
602
|
+
* that disagrees is ignored, so a mismatched-header ("ZIP-confusion") archive cannot make `name` disagree with
|
|
603
|
+
* what is read. The bytes are decoded from a valid Info-ZIP Unicode Path extra field (`0x7075`) when one is
|
|
604
|
+
* present; otherwise as UTF-8 when the language-encoding flag (general-purpose bit 11) is set or the bytes are
|
|
605
|
+
* valid UTF-8 (plenty of tools wrote UTF-8 names without ever setting the flag); and as CP437 - the historical
|
|
606
|
+
* default - only when they are not. See `zipEntry.nameBuffer` for the raw bytes.
|
|
607
|
+
*
|
|
608
|
+
* The name is returned verbatim: it is never normalized, and a name containing `..`, a leading `/`, a drive
|
|
609
|
+
* letter, or backslashes is neither rewritten nor rejected. A `ZipFile`/`ZipBuffer` never writes to disk, so
|
|
610
|
+
* guarding against path traversal ("Zip Slip") when extracting is the caller's responsibility.
|
|
611
|
+
* @since v26.8.0
|
|
612
|
+
*/
|
|
613
|
+
readonly name: string;
|
|
614
|
+
/**
|
|
615
|
+
* The entry's raw name bytes, before any character decoding. Useful when the archive's names are in an encoding
|
|
616
|
+
* other than UTF-8 or CP437 and the caller wants to decode them itself.
|
|
617
|
+
* @since v26.8.0
|
|
618
|
+
*/
|
|
619
|
+
readonly nameBuffer: Buffer;
|
|
620
|
+
/**
|
|
621
|
+
* The entry's raw (still compressed, if applicable) content when it is held in memory, or `null` when there is
|
|
622
|
+
* no in-memory buffer to expose - for an entry created with `zlib.ZipEntry.createStream()`, or a file-backed
|
|
623
|
+
* entry returned by `zipFile.get()`, whose bytes are read from disk on demand rather than retained. Use
|
|
624
|
+
* `zipEntry.content()` or `zipEntry.contentIterator()` to read a file-backed entry.
|
|
625
|
+
* @since v26.8.0
|
|
626
|
+
*/
|
|
627
|
+
readonly rawContent: Buffer | null;
|
|
628
|
+
/**
|
|
629
|
+
* The entry's uncompressed size, in bytes.
|
|
630
|
+
* @since v26.8.0
|
|
631
|
+
*/
|
|
632
|
+
readonly size: number;
|
|
633
|
+
}
|
|
634
|
+
interface ZipFileOpenOptions {
|
|
635
|
+
/**
|
|
636
|
+
* Open the underlying file for both reading and writing (`'r+'`), enabling `zipFile.addEntry()`,
|
|
637
|
+
* `zipFile.add()`, and `zipFile.delete()`.
|
|
638
|
+
* @default false
|
|
639
|
+
* @since v26.8.0
|
|
640
|
+
*/
|
|
641
|
+
writable?: boolean | undefined;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* A random-access view over the entries of a ZIP archive on disk. Only the archive's tail and central directory are
|
|
645
|
+
* read up front; member content is read from disk lazily, on demand. Writable when opened with
|
|
646
|
+
* `{ writable: true }`: `zipFile.addEntry()`/`zipFile.add()` append the new member's data where the central
|
|
647
|
+
* directory used to be, then rewrite the central directory immediately after it; `zipFile.delete()` just rewrites
|
|
648
|
+
* the central directory. Both mean the file is altered as soon as the method's returned `Promise` fulfills. Deleted
|
|
649
|
+
* or replaced members are left behind as dead space; `zipFile.compact()` produces a stream with none.
|
|
650
|
+
*
|
|
651
|
+
* These in-place edits are not crash-atomic. Rewriting the central directory happens in place, so a write that
|
|
652
|
+
* fails partway - the disk fills, the device disconnects, the process is killed - can leave the archive on disk
|
|
653
|
+
* with a partial or missing central directory, i.e. unreadable, even though the member data before it is intact.
|
|
654
|
+
* The rejected call surfaces the underlying error and the `ZipFile` object is left usable (its in-memory view is
|
|
655
|
+
* not discarded, so a caller can attempt recovery - for example re-writing the entries elsewhere with
|
|
656
|
+
* `zipFile.compact()`), but that in-memory view may no longer match the bytes on disk. Write to a copy, or
|
|
657
|
+
* `compact()` into a fresh file, when durability across a failure matters.
|
|
658
|
+
*
|
|
659
|
+
* As with the synchronous `node:fs` APIs, every `*Sync` method blocks the Node.js event loop and further JavaScript
|
|
660
|
+
* execution until the operation completes; use them only where synchronous execution is appropriate (for example,
|
|
661
|
+
* short-lived scripts or startup code), not in code that must stay responsive. A synchronous method throws
|
|
662
|
+
* `ERR_INVALID_STATE` if called while an asynchronous `add()`, `addEntry()`, `delete()`, or `close()` on the same
|
|
663
|
+
* `ZipFile` has not settled yet, since letting the two interleave could corrupt the archive.
|
|
664
|
+
* @since v26.8.0
|
|
665
|
+
* @experimental
|
|
666
|
+
*/
|
|
667
|
+
class ZipFile {
|
|
668
|
+
/**
|
|
669
|
+
* Throws an `ERR_ZIP_ARCHIVE_TOO_LARGE` error if the archive's central directory is too large to buffer in
|
|
670
|
+
* memory.
|
|
671
|
+
* @since v26.8.0
|
|
672
|
+
*/
|
|
673
|
+
static open(filename: string, options?: ZipFileOpenOptions): Promise<ZipFile>;
|
|
674
|
+
/**
|
|
675
|
+
* The synchronous version of `zlib.ZipFile.open()`.
|
|
676
|
+
* @since v26.8.0
|
|
677
|
+
*/
|
|
678
|
+
static openSync(filename: string, options?: ZipFileOpenOptions): ZipFile;
|
|
679
|
+
private constructor();
|
|
680
|
+
/**
|
|
681
|
+
* Equivalent to `zipFile.addEntry(await zlib.ZipEntry.create(filename, data, options))`.
|
|
682
|
+
* @param filename The entry's name within the archive. A trailing `/` marks a directory entry.
|
|
683
|
+
* @param data The entry's complete, uncompressed content.
|
|
684
|
+
* @param options See `zlib.ZipEntry.create()`.
|
|
685
|
+
* @returns `Promise` fulfilled with the created `ZipEntry`.
|
|
686
|
+
* @since v26.8.0
|
|
687
|
+
*/
|
|
688
|
+
add(filename: string, data: ZipInputType, options?: ZipEntryCreateOptions): Promise<ZipEntry>;
|
|
689
|
+
/**
|
|
690
|
+
* Writes `entry` where the central directory currently starts, then rewrites the central directory to include
|
|
691
|
+
* it, replacing any existing entry of the same name. Throws `ERR_ZIP_NOT_WRITABLE` if the `ZipFile` was not
|
|
692
|
+
* opened with `{ writable: true }`.
|
|
693
|
+
*
|
|
694
|
+
* The returned (same) `entry` is left readable: a streaming entry created with `zlib.ZipEntry.createStream()`,
|
|
695
|
+
* which would otherwise be spent once serialized, is promoted in place to a file-backed entry pointing at the
|
|
696
|
+
* copy just written (valid while this `ZipFile` is open). In-memory entries keep their own buffer unchanged.
|
|
697
|
+
* @returns `Promise` fulfilled with `entry`.
|
|
698
|
+
* @since v26.8.0
|
|
699
|
+
*/
|
|
700
|
+
addEntry(entry: ZipEntry): Promise<ZipEntry>;
|
|
701
|
+
/**
|
|
702
|
+
* The synchronous version of `zipFile.addEntry()`. `entry` must not be a pending streaming entry (one created
|
|
703
|
+
* with `zlib.ZipEntry.createStream()`) - there is no synchronous way to drain its asynchronous source.
|
|
704
|
+
* @returns `entry`
|
|
705
|
+
* @since v26.8.0
|
|
706
|
+
*/
|
|
707
|
+
addEntrySync(entry: ZipEntry): ZipEntry;
|
|
708
|
+
/**
|
|
709
|
+
* The synchronous version of `zipFile.add()`. Equivalent to
|
|
710
|
+
* `zipFile.addEntrySync(zlib.ZipEntry.createSync(filename, data, options))`.
|
|
711
|
+
* @param filename The entry's name within the archive. A trailing `/` marks a directory entry.
|
|
712
|
+
* @param data The entry's complete, uncompressed content.
|
|
713
|
+
* @param options See `zlib.ZipEntry.createSync()`.
|
|
714
|
+
* @returns The created entry.
|
|
715
|
+
* @since v26.8.0
|
|
716
|
+
*/
|
|
717
|
+
addSync(filename: string, data: ZipInputType, options?: ZipEntryCreateOptions): ZipEntry;
|
|
718
|
+
/**
|
|
719
|
+
* Closes the underlying file handle.
|
|
720
|
+
* @since v26.8.0
|
|
721
|
+
*/
|
|
722
|
+
close(): Promise<void>;
|
|
723
|
+
/**
|
|
724
|
+
* The synchronous version of `zipFile.close()`.
|
|
725
|
+
* @since v26.8.0
|
|
726
|
+
*/
|
|
727
|
+
closeSync(): void;
|
|
728
|
+
/**
|
|
729
|
+
* Does not modify the open file; pipe the result into a new one.
|
|
730
|
+
* @param comment An archive comment. @default zipFile.comment
|
|
731
|
+
* @returns A stream of the currently live entries, serialized as a fresh archive with no dead space left by
|
|
732
|
+
* prior `zipFile.addEntry()`/`zipFile.delete()` calls.
|
|
733
|
+
* @since v26.8.0
|
|
734
|
+
*/
|
|
735
|
+
compact(comment?: string): stream.Readable;
|
|
736
|
+
/**
|
|
737
|
+
* The synchronous version of `zipFile.compact()`. Does not modify the open file.
|
|
738
|
+
* @param comment An archive comment. @default zipFile.comment
|
|
739
|
+
* @returns The currently live entries, serialized as a fresh archive with no dead space left by prior
|
|
740
|
+
* `zipFile.addEntry()`/`zipFile.delete()` calls.
|
|
741
|
+
* @since v26.8.0
|
|
742
|
+
*/
|
|
743
|
+
compactSync(comment?: string): NonSharedBuffer;
|
|
744
|
+
/**
|
|
745
|
+
* Rewrites the central directory without writing any new content - the archive does not grow. Throws
|
|
746
|
+
* `ERR_ZIP_NOT_WRITABLE` if the `ZipFile` was not opened with `{ writable: true }`.
|
|
747
|
+
* @returns `Promise` fulfilled with `true` if an entry named `name` existed and was removed, `false`
|
|
748
|
+
* otherwise.
|
|
749
|
+
* @since v26.8.0
|
|
750
|
+
*/
|
|
751
|
+
delete(name: string): Promise<boolean>;
|
|
752
|
+
/**
|
|
753
|
+
* The synchronous version of `zipFile.delete()`.
|
|
754
|
+
* @returns `true` if an entry named `name` existed and was removed, `false` otherwise.
|
|
755
|
+
* @since v26.8.0
|
|
756
|
+
*/
|
|
757
|
+
deleteSync(name: string): boolean;
|
|
758
|
+
/**
|
|
759
|
+
* @returns `Iterator` of `[name, entry]` pairs, where `entry` is a `Promise` fulfilled with a `ZipEntry`.
|
|
760
|
+
* @since v26.8.0
|
|
761
|
+
*/
|
|
762
|
+
entries(): NodeJS.Iterator<[name: string, entry: Promise<ZipEntry>]>;
|
|
763
|
+
/**
|
|
764
|
+
* The synchronous version of `zipFile.entries()`.
|
|
765
|
+
* @returns `Iterator` of `[name, entry]` pairs, where `entry` is a resolved `ZipEntry` (not a `Promise`).
|
|
766
|
+
* @since v26.8.0
|
|
767
|
+
*/
|
|
768
|
+
entriesSync(): NodeJS.Iterator<[name: string, entry: ZipEntry]>;
|
|
769
|
+
/**
|
|
770
|
+
* @since v26.8.0
|
|
771
|
+
*/
|
|
772
|
+
forEach(callback: (entry: Promise<ZipEntry>, name: string, zipFile: this) => void, thisArg?: any): void;
|
|
773
|
+
/**
|
|
774
|
+
* The synchronous version of `zipFile.forEach()`: `callback` is invoked with a resolved `ZipEntry` instead of a
|
|
775
|
+
* `Promise`.
|
|
776
|
+
* @since v26.8.0
|
|
777
|
+
*/
|
|
778
|
+
forEachSync(callback: (entry: ZipEntry, name: string, zipFile: this) => void, thisArg?: any): void;
|
|
779
|
+
/**
|
|
780
|
+
* Returns a lazy, file-backed `ZipEntry` for `name`. Nothing is read from disk here and no content is buffered:
|
|
781
|
+
* the returned entry reads (and, for `zipEntry.content()`, decompresses) its member straight from the file on
|
|
782
|
+
* each access, and the `ZipFile` retains no member content. The entry is valid only while this `ZipFile` is
|
|
783
|
+
* open. Reading its content later may throw `ERR_ZIP_ENTRY_TOO_LARGE` if the member is too large to hold in a
|
|
784
|
+
* single buffer; use `zipEntry.contentIterator()` (or `zipFile.stream()`) instead. Throws
|
|
785
|
+
* `ERR_ZIP_ENTRY_NOT_FOUND` if the archive has no entry named `name`.
|
|
786
|
+
* @since v26.8.0
|
|
787
|
+
*/
|
|
788
|
+
get(name: string): Promise<ZipEntry>;
|
|
789
|
+
/**
|
|
790
|
+
* The synchronous version of `zipFile.get()`. Like `get()`, it reads nothing up front and only builds the lazy
|
|
791
|
+
* handle, so it does not itself block on I/O - but reads performed later through the returned entry (such as
|
|
792
|
+
* `zipEntry.contentSync()`) do; see the `ZipFile` class documentation note on synchronous methods.
|
|
793
|
+
* @since v26.8.0
|
|
794
|
+
*/
|
|
795
|
+
getSync(name: string): ZipEntry;
|
|
796
|
+
/**
|
|
797
|
+
* @since v26.8.0
|
|
798
|
+
*/
|
|
799
|
+
has(name: string): boolean;
|
|
800
|
+
/**
|
|
801
|
+
* @returns `Iterator` of entry names.
|
|
802
|
+
* @since v26.8.0
|
|
803
|
+
*/
|
|
804
|
+
keys(): NodeJS.Iterator<string>;
|
|
805
|
+
/**
|
|
806
|
+
* Convenience wrapper that resolves to a `Readable` over `zipEntry.contentIterator()` of `zipFile.get(name)`;
|
|
807
|
+
* the compressed bytes are read from disk as the stream is consumed. The returned promise rejects with
|
|
808
|
+
* `ERR_ZIP_ENTRY_NOT_FOUND` if the archive has no entry named `name`.
|
|
809
|
+
* @returns `Promise` fulfilled with a `stream.Readable` of the member's decompressed content, without buffering
|
|
810
|
+
* the whole member in memory.
|
|
811
|
+
* @since v26.8.0
|
|
812
|
+
*/
|
|
813
|
+
stream(name: string, options?: ZipEntryContentIterOptions): Promise<stream.Readable>;
|
|
814
|
+
/**
|
|
815
|
+
* @returns `Iterator` of `Promise` objects, each fulfilled with a `ZipEntry`.
|
|
816
|
+
* @since v26.8.0
|
|
817
|
+
*/
|
|
818
|
+
values(): NodeJS.Iterator<Promise<ZipEntry>>;
|
|
819
|
+
/**
|
|
820
|
+
* The synchronous version of `zipFile.values()`.
|
|
821
|
+
* @returns `Iterator` of resolved `ZipEntry` values (not `Promise`s).
|
|
822
|
+
* @since v26.8.0
|
|
823
|
+
*/
|
|
824
|
+
valuesSync(): NodeJS.Iterator<ZipEntry>;
|
|
825
|
+
/**
|
|
826
|
+
* The archive-level comment, preserved byte-for-byte across `zipFile.addEntry()`/`zipFile.delete()` calls. The
|
|
827
|
+
* bytes are decoded as UTF-8 when they are valid UTF-8 and as CP437 otherwise (the field carries no encoding
|
|
828
|
+
* flag of its own).
|
|
829
|
+
* @since v26.8.0
|
|
830
|
+
*/
|
|
831
|
+
readonly comment: string;
|
|
832
|
+
/**
|
|
833
|
+
* The number of entries in the archive.
|
|
834
|
+
* @since v26.8.0
|
|
835
|
+
*/
|
|
836
|
+
readonly size: number;
|
|
837
|
+
/**
|
|
838
|
+
* Whether this `ZipFile` was opened with `{ writable: true }`.
|
|
839
|
+
* @since v26.8.0
|
|
840
|
+
*/
|
|
841
|
+
readonly writable: boolean;
|
|
842
|
+
}
|
|
201
843
|
/**
|
|
202
844
|
* @since v22.15.0
|
|
203
845
|
* @experimental
|
|
@@ -275,6 +917,72 @@ declare module "node:zlib" {
|
|
|
275
917
|
* @since v0.5.8
|
|
276
918
|
*/
|
|
277
919
|
function createUnzip(options?: ZlibOptions): Unzip;
|
|
920
|
+
interface CreateZipArchiveOptions {
|
|
921
|
+
/**
|
|
922
|
+
* An archive comment.
|
|
923
|
+
* @since v26.8.0
|
|
924
|
+
*/
|
|
925
|
+
comment?: string | undefined;
|
|
926
|
+
/**
|
|
927
|
+
* Shifts every local/central header offset the archive records by this many bytes.
|
|
928
|
+
* @default 0
|
|
929
|
+
* @since v26.8.0
|
|
930
|
+
*/
|
|
931
|
+
baseOffset?: number | undefined;
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Serializes `entries` into a ZIP archive, switching to Zip64 structures automatically once the entry count, or any
|
|
935
|
+
* offset or size, exceeds what the classic 32-/16-bit ZIP fields can hold. The returned `Readable` is also an
|
|
936
|
+
* `AsyncIterable` of the same `Buffer` chunks it streams.
|
|
937
|
+
*
|
|
938
|
+
* Entries are written in iteration order and nothing deduplicates names: an iterable that yields two entries with
|
|
939
|
+
* the same name produces an archive containing both, and most extraction tools keep the one that appears later.
|
|
940
|
+
* `ZipBuffer` and `ZipFile` `add()` methods replace entries by name instead.
|
|
941
|
+
*
|
|
942
|
+
* The entries are owned by the returned stream: each is consumed as the archive is produced and must not be reused
|
|
943
|
+
* afterwards. This matters for streaming entries (from `zlib.ZipEntry.createStream()`), which hold an underlying
|
|
944
|
+
* source such as a file read stream. If the returned stream is destroyed before it is fully consumed - for example,
|
|
945
|
+
* the destination of a `pipeline()` fails - it disposes the entry it was serializing and every entry still queued
|
|
946
|
+
* behind it, destroying their sources so no descriptor leaks. Consume the stream to the end, or destroy it
|
|
947
|
+
* (directly, through a failed `pipeline()`, or with `await using`), to guarantee this cleanup; a stream that is
|
|
948
|
+
* neither consumed nor destroyed cannot release anything. A `ZipEntry` that is never handed to an archive can be
|
|
949
|
+
* released directly with `Symbol.dispose` / `Symbol.asyncDispose`.
|
|
950
|
+
*
|
|
951
|
+
* Throws an `ERR_ZIP_ARCHIVE_TOO_LARGE` error if the archive comment exceeds 65,535 bytes when encoded as UTF-8.
|
|
952
|
+
*
|
|
953
|
+
* Passing `options.baseOffset` produces an archive that is valid immediately when placed after other content in the
|
|
954
|
+
* same file, without relying on a reader's self-extracting-archive detection to compensate for the shift.
|
|
955
|
+
* @param entries `Iterable` | `AsyncIterable` of `ZipEntry`.
|
|
956
|
+
* @param options An archive comment, as a shorthand for `{ comment: options }`.
|
|
957
|
+
* @returns A byte stream of the serialized archive.
|
|
958
|
+
* @since v26.8.0
|
|
959
|
+
* @experimental
|
|
960
|
+
*/
|
|
961
|
+
function createZipArchive(
|
|
962
|
+
entries: Iterable<ZipEntry> | AsyncIterable<ZipEntry>,
|
|
963
|
+
options?: string | CreateZipArchiveOptions,
|
|
964
|
+
): stream.Readable;
|
|
965
|
+
/**
|
|
966
|
+
* The synchronous version of `zlib.createZipArchive()`. Blocks the Node.js event loop and further JavaScript
|
|
967
|
+
* execution until the whole archive (including any deflate passes) has been produced; use only where synchronous
|
|
968
|
+
* execution is appropriate (for example, short-lived scripts or startup code), not in code that must stay
|
|
969
|
+
* responsive. `entries` must be a plain (synchronous) `Iterable` - a streaming entry created with
|
|
970
|
+
* `zlib.ZipEntry.createStream()` throws when its turn to serialize comes up, since draining its asynchronous source
|
|
971
|
+
* has no synchronous equivalent.
|
|
972
|
+
*
|
|
973
|
+
* As with `zlib.createZipArchive()`, the entries are owned by the returned iterator and must not be reused. If
|
|
974
|
+
* iteration stops early - including the throw on a streaming entry - the entry that stopped it and every entry
|
|
975
|
+
* still queued behind it are disposed, releasing any sources they hold.
|
|
976
|
+
* @param entries `Iterable` of `ZipEntry`.
|
|
977
|
+
* @param options See `zlib.createZipArchive()`.
|
|
978
|
+
* @returns `Iterator` of `Buffer` chunks making up the serialized archive.
|
|
979
|
+
* @since v26.8.0
|
|
980
|
+
* @experimental
|
|
981
|
+
*/
|
|
982
|
+
function createZipArchiveSync(
|
|
983
|
+
entries: Iterable<ZipEntry>,
|
|
984
|
+
options?: string | CreateZipArchiveOptions,
|
|
985
|
+
): NodeJS.Iterator<Buffer>;
|
|
278
986
|
/**
|
|
279
987
|
* Creates and returns a new `ZstdCompress` object.
|
|
280
988
|
* @since v22.15.0
|
|
@@ -339,6 +1047,22 @@ declare module "node:zlib" {
|
|
|
339
1047
|
* @since v0.11.12
|
|
340
1048
|
*/
|
|
341
1049
|
function deflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
|
1050
|
+
/**
|
|
1051
|
+
* The current default ceiling, in bytes, applied by `zipEntry.content()` when no explicit `maxSize` is given.
|
|
1052
|
+
* Default: `268435456` (256 MiB).
|
|
1053
|
+
* @since v26.8.0
|
|
1054
|
+
* @experimental
|
|
1055
|
+
*/
|
|
1056
|
+
function getMaxZipContentSize(): number;
|
|
1057
|
+
/**
|
|
1058
|
+
* Sets the default ceiling used by `zipEntry.content()` when no explicit `maxSize` option is given. This is a guard
|
|
1059
|
+
* against zip bombs: an archive whose central directory declares a member larger than this is rejected before
|
|
1060
|
+
* allocating memory for it. Streaming reads (`zipEntry.contentIterator()`, `zipFile.stream()`) are bounded-memory
|
|
1061
|
+
* by design and are not affected by this setting.
|
|
1062
|
+
* @since v26.8.0
|
|
1063
|
+
* @experimental
|
|
1064
|
+
*/
|
|
1065
|
+
function setMaxZipContentSize(size: number): void;
|
|
342
1066
|
/**
|
|
343
1067
|
* @since v0.6.0
|
|
344
1068
|
*/
|
|
@@ -404,6 +1128,34 @@ declare module "node:zlib" {
|
|
|
404
1128
|
* @since v0.11.12
|
|
405
1129
|
*/
|
|
406
1130
|
function unzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
|
|
1131
|
+
interface ZipFilesOptions extends CreateZipArchiveOptions {
|
|
1132
|
+
/**
|
|
1133
|
+
* Resolve a symbolic link and archive the file it points to, rather than storing the link itself.
|
|
1134
|
+
* @default true
|
|
1135
|
+
* @since v26.8.0
|
|
1136
|
+
*/
|
|
1137
|
+
followSymlinks?: boolean | undefined;
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Builds an archive from files on disk. For each `[sourcePath, entryName]` pair it reads `sourcePath` and adds an
|
|
1141
|
+
* entry named `entryName`, capturing the file's Unix mode and modification time. A directory becomes a directory
|
|
1142
|
+
* entry; a regular file's contents are streamed in (as a `zlib.ZipEntry.createStream()` entry) without being
|
|
1143
|
+
* buffered in memory. Directory contents are not walked recursively - list each path you want included.
|
|
1144
|
+
*
|
|
1145
|
+
* When `followSymlinks` is `true` (the default) a symbolic link is resolved and archived as its target file; when
|
|
1146
|
+
* it is `false` the link itself is stored as a symbolic-link entry whose content is the target path (see
|
|
1147
|
+
* `zlib.ZipEntry.createSymlink()`).
|
|
1148
|
+
* @param files `Iterable` of `[sourcePath, entryName]` string pairs. Any iterable works - an array, a `Map`, the
|
|
1149
|
+
* result of `Object.entries()`, a generator.
|
|
1150
|
+
* @param options An archive comment, as a shorthand for `{ comment: options }`.
|
|
1151
|
+
* @returns `stream.Readable` of `Buffer` chunks making up the serialized archive.
|
|
1152
|
+
* @since v26.8.0
|
|
1153
|
+
* @experimental
|
|
1154
|
+
*/
|
|
1155
|
+
function zipFiles(
|
|
1156
|
+
files: Iterable<readonly [sourcePath: string, entryName: string]>,
|
|
1157
|
+
options?: string | ZipFilesOptions,
|
|
1158
|
+
): stream.Readable;
|
|
407
1159
|
/**
|
|
408
1160
|
* @since v22.15.0
|
|
409
1161
|
* @experimental
|