Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solana/codecs-core

Package Overview
Dependencies
Maintainers
14
Versions
1192
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/codecs-core - npm Package Compare versions

Comparing version 2.0.0-experimental.71a42a7 to 2.0.0-experimental.7297b81

183

dist/index.browser.js

@@ -13,7 +13,2 @@ // src/assertions.ts

}
function assertFixedSizeCodec(data, message) {
if (data.fixedSize === null) {
throw new Error(message ?? "Expected a fixed-size codec, got a variable-size one.");
}
}

@@ -47,5 +42,56 @@ // src/bytes.ts

// src/codec.ts
function getEncodedSize(value, encoder) {
return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);
}
function createEncoder(encoder) {
return Object.freeze({
...encoder,
encode: (value) => {
const bytes = new Uint8Array(getEncodedSize(value, encoder));
encoder.write(value, bytes, 0);
return bytes;
}
});
}
function createDecoder(decoder) {
return Object.freeze({
...decoder,
decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0]
});
}
function createCodec(codec) {
return Object.freeze({
...codec,
decode: (bytes, offset = 0) => codec.read(bytes, offset)[0],
encode: (value) => {
const bytes = new Uint8Array(getEncodedSize(value, codec));
codec.write(value, bytes, 0);
return bytes;
}
});
}
function isFixedSize(codec) {
return "fixedSize" in codec && typeof codec.fixedSize === "number";
}
function assertIsFixedSize(codec, message) {
if (!isFixedSize(codec)) {
throw new Error(message ?? "Expected a fixed-size codec, got a variable-size one.");
}
}
function isVariableSize(codec) {
return !isFixedSize(codec);
}
function assertIsVariableSize(codec, message) {
if (!isVariableSize(codec)) {
throw new Error(message ?? "Expected a variable-size codec, got a fixed-size one.");
}
}
// src/combine-codec.ts
function combineCodec(encoder, decoder, description) {
if (encoder.fixedSize !== decoder.fixedSize) {
function combineCodec(encoder, decoder) {
if (isFixedSize(encoder) !== isFixedSize(decoder)) {
throw new Error(`Encoder and decoder must either both be fixed-size or variable-size.`);
}
if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {
throw new Error(

@@ -55,3 +101,3 @@ `Encoder and decoder must have the same fixed size, got [${encoder.fixedSize}] and [${decoder.fixedSize}].`

}
if (encoder.maxSize !== decoder.maxSize) {
if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {
throw new Error(

@@ -61,13 +107,9 @@ `Encoder and decoder must have the same max size, got [${encoder.maxSize}] and [${decoder.maxSize}].`

}
if (description === void 0 && encoder.description !== decoder.description) {
throw new Error(
`Encoder and decoder must have the same description, got [${encoder.description}] and [${decoder.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`
);
}
return {
...decoder,
...encoder,
decode: decoder.decode,
description: description ?? encoder.description,
encode: encoder.encode,
fixedSize: encoder.fixedSize,
maxSize: encoder.maxSize
read: decoder.read,
write: encoder.write
};

@@ -77,19 +119,17 @@ }

// src/fix-codec.ts
function fixCodecHelper(data, fixedBytes, description) {
return {
description: description ?? `fixed(${fixedBytes}, ${data.description})`,
function fixEncoder(encoder, fixedBytes) {
return createEncoder({
fixedSize: fixedBytes,
maxSize: fixedBytes
};
write: (value, bytes, offset) => {
const variableByteArray = encoder.encode(value);
const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;
bytes.set(fixedByteArray, offset);
return offset + fixedBytes;
}
});
}
function fixEncoder(encoder, fixedBytes, description) {
return {
...fixCodecHelper(encoder, fixedBytes, description),
encode: (value) => fixBytes(encoder.encode(value), fixedBytes)
};
}
function fixDecoder(decoder, fixedBytes, description) {
return {
...fixCodecHelper(decoder, fixedBytes, description),
decode: (bytes, offset = 0) => {
function fixDecoder(decoder, fixedBytes) {
return createDecoder({
fixedSize: fixedBytes,
read: (bytes, offset) => {
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset);

@@ -99,12 +139,12 @@ if (offset > 0 || bytes.length > fixedBytes) {

}
if (decoder.fixedSize !== null) {
if (isFixedSize(decoder)) {
bytes = fixBytes(bytes, decoder.fixedSize);
}
const [value] = decoder.decode(bytes, 0);
const [value] = decoder.read(bytes, 0);
return [value, offset + fixedBytes];
}
};
});
}
function fixCodec(codec, fixedBytes, description) {
return combineCodec(fixEncoder(codec, fixedBytes, description), fixDecoder(codec, fixedBytes, description));
function fixCodec(codec, fixedBytes) {
return combineCodec(fixEncoder(codec, fixedBytes), fixDecoder(codec, fixedBytes));
}

@@ -114,28 +154,21 @@

function mapEncoder(encoder, unmap) {
return {
description: encoder.description,
encode: (value) => encoder.encode(unmap(value)),
fixedSize: encoder.fixedSize,
maxSize: encoder.maxSize
};
return createEncoder({
...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder,
write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset)
});
}
function mapDecoder(decoder, map) {
return {
decode: (bytes, offset = 0) => {
const [value, length] = decoder.decode(bytes, offset);
return [map(value, bytes, offset), length];
},
description: decoder.description,
fixedSize: decoder.fixedSize,
maxSize: decoder.maxSize
};
return createDecoder({
...decoder,
read: (bytes, offset) => {
const [value, newOffset] = decoder.read(bytes, offset);
return [map(value, bytes, offset), newOffset];
}
});
}
function mapCodec(codec, unmap, map) {
return {
decode: map ? mapDecoder(codec, map).decode : codec.decode,
description: codec.description,
encode: mapEncoder(codec, unmap).encode,
fixedSize: codec.fixedSize,
maxSize: codec.maxSize
};
return createCodec({
...mapEncoder(codec, unmap),
read: map ? mapDecoder(codec, map).read : codec.read
});
}

@@ -145,25 +178,27 @@

function reverseEncoder(encoder) {
assertFixedSizeCodec(encoder, "Cannot reverse a codec of variable size.");
return {
assertIsFixedSize(encoder, "Cannot reverse a codec of variable size.");
return createEncoder({
...encoder,
encode: (value) => encoder.encode(value).reverse()
};
write: (value, bytes, offset) => {
const newOffset = encoder.write(value, bytes, offset);
const slice = bytes.slice(offset, offset + encoder.fixedSize).reverse();
bytes.set(slice, offset);
return newOffset;
}
});
}
function reverseDecoder(decoder) {
assertFixedSizeCodec(decoder, "Cannot reverse a codec of variable size.");
return {
assertIsFixedSize(decoder, "Cannot reverse a codec of variable size.");
return createDecoder({
...decoder,
decode: (bytes, offset = 0) => {
read: (bytes, offset) => {
const reverseEnd = offset + decoder.fixedSize;
if (offset === 0 && bytes.length === reverseEnd) {
return decoder.decode(bytes.reverse(), offset);
return decoder.read(bytes.reverse(), offset);
}
const newBytes = mergeBytes([
...offset === 0 ? [] : [bytes.slice(0, offset)],
bytes.slice(offset, reverseEnd).reverse(),
...bytes.length === reverseEnd ? [] : [bytes.slice(reverseEnd)]
]);
return decoder.decode(newBytes, offset);
const reversedBytes = bytes.slice();
reversedBytes.set(bytes.slice(offset, reverseEnd).reverse(), offset);
return decoder.read(reversedBytes, offset);
}
};
});
}

@@ -174,4 +209,4 @@ function reverseCodec(codec) {

export { assertByteArrayHasEnoughBytesForCodec, assertByteArrayIsNotEmptyForCodec, assertFixedSizeCodec, combineCodec, fixBytes, fixCodec, fixDecoder, fixEncoder, mapCodec, mapDecoder, mapEncoder, mergeBytes, padBytes, reverseCodec, reverseDecoder, reverseEncoder };
export { assertByteArrayHasEnoughBytesForCodec, assertByteArrayIsNotEmptyForCodec, assertIsFixedSize, assertIsVariableSize, combineCodec, createCodec, createDecoder, createEncoder, fixBytes, fixCodec, fixDecoder, fixEncoder, getEncodedSize, isFixedSize, isVariableSize, mapCodec, mapDecoder, mapEncoder, mergeBytes, padBytes, reverseCodec, reverseDecoder, reverseEncoder };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.browser.js.map

@@ -13,7 +13,2 @@ // src/assertions.ts

}
function assertFixedSizeCodec(data, message) {
if (data.fixedSize === null) {
throw new Error(message ?? "Expected a fixed-size codec, got a variable-size one.");
}
}

@@ -47,5 +42,56 @@ // src/bytes.ts

// src/codec.ts
function getEncodedSize(value, encoder) {
return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);
}
function createEncoder(encoder) {
return Object.freeze({
...encoder,
encode: (value) => {
const bytes = new Uint8Array(getEncodedSize(value, encoder));
encoder.write(value, bytes, 0);
return bytes;
}
});
}
function createDecoder(decoder) {
return Object.freeze({
...decoder,
decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0]
});
}
function createCodec(codec) {
return Object.freeze({
...codec,
decode: (bytes, offset = 0) => codec.read(bytes, offset)[0],
encode: (value) => {
const bytes = new Uint8Array(getEncodedSize(value, codec));
codec.write(value, bytes, 0);
return bytes;
}
});
}
function isFixedSize(codec) {
return "fixedSize" in codec && typeof codec.fixedSize === "number";
}
function assertIsFixedSize(codec, message) {
if (!isFixedSize(codec)) {
throw new Error(message ?? "Expected a fixed-size codec, got a variable-size one.");
}
}
function isVariableSize(codec) {
return !isFixedSize(codec);
}
function assertIsVariableSize(codec, message) {
if (!isVariableSize(codec)) {
throw new Error(message ?? "Expected a variable-size codec, got a fixed-size one.");
}
}
// src/combine-codec.ts
function combineCodec(encoder, decoder, description) {
if (encoder.fixedSize !== decoder.fixedSize) {
function combineCodec(encoder, decoder) {
if (isFixedSize(encoder) !== isFixedSize(decoder)) {
throw new Error(`Encoder and decoder must either both be fixed-size or variable-size.`);
}
if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {
throw new Error(

@@ -55,3 +101,3 @@ `Encoder and decoder must have the same fixed size, got [${encoder.fixedSize}] and [${decoder.fixedSize}].`

}
if (encoder.maxSize !== decoder.maxSize) {
if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {
throw new Error(

@@ -61,13 +107,9 @@ `Encoder and decoder must have the same max size, got [${encoder.maxSize}] and [${decoder.maxSize}].`

}
if (description === void 0 && encoder.description !== decoder.description) {
throw new Error(
`Encoder and decoder must have the same description, got [${encoder.description}] and [${decoder.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`
);
}
return {
...decoder,
...encoder,
decode: decoder.decode,
description: description ?? encoder.description,
encode: encoder.encode,
fixedSize: encoder.fixedSize,
maxSize: encoder.maxSize
read: decoder.read,
write: encoder.write
};

@@ -77,19 +119,17 @@ }

// src/fix-codec.ts
function fixCodecHelper(data, fixedBytes, description) {
return {
description: description ?? `fixed(${fixedBytes}, ${data.description})`,
function fixEncoder(encoder, fixedBytes) {
return createEncoder({
fixedSize: fixedBytes,
maxSize: fixedBytes
};
write: (value, bytes, offset) => {
const variableByteArray = encoder.encode(value);
const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;
bytes.set(fixedByteArray, offset);
return offset + fixedBytes;
}
});
}
function fixEncoder(encoder, fixedBytes, description) {
return {
...fixCodecHelper(encoder, fixedBytes, description),
encode: (value) => fixBytes(encoder.encode(value), fixedBytes)
};
}
function fixDecoder(decoder, fixedBytes, description) {
return {
...fixCodecHelper(decoder, fixedBytes, description),
decode: (bytes, offset = 0) => {
function fixDecoder(decoder, fixedBytes) {
return createDecoder({
fixedSize: fixedBytes,
read: (bytes, offset) => {
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset);

@@ -99,12 +139,12 @@ if (offset > 0 || bytes.length > fixedBytes) {

}
if (decoder.fixedSize !== null) {
if (isFixedSize(decoder)) {
bytes = fixBytes(bytes, decoder.fixedSize);
}
const [value] = decoder.decode(bytes, 0);
const [value] = decoder.read(bytes, 0);
return [value, offset + fixedBytes];
}
};
});
}
function fixCodec(codec, fixedBytes, description) {
return combineCodec(fixEncoder(codec, fixedBytes, description), fixDecoder(codec, fixedBytes, description));
function fixCodec(codec, fixedBytes) {
return combineCodec(fixEncoder(codec, fixedBytes), fixDecoder(codec, fixedBytes));
}

@@ -114,28 +154,21 @@

function mapEncoder(encoder, unmap) {
return {
description: encoder.description,
encode: (value) => encoder.encode(unmap(value)),
fixedSize: encoder.fixedSize,
maxSize: encoder.maxSize
};
return createEncoder({
...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder,
write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset)
});
}
function mapDecoder(decoder, map) {
return {
decode: (bytes, offset = 0) => {
const [value, length] = decoder.decode(bytes, offset);
return [map(value, bytes, offset), length];
},
description: decoder.description,
fixedSize: decoder.fixedSize,
maxSize: decoder.maxSize
};
return createDecoder({
...decoder,
read: (bytes, offset) => {
const [value, newOffset] = decoder.read(bytes, offset);
return [map(value, bytes, offset), newOffset];
}
});
}
function mapCodec(codec, unmap, map) {
return {
decode: map ? mapDecoder(codec, map).decode : codec.decode,
description: codec.description,
encode: mapEncoder(codec, unmap).encode,
fixedSize: codec.fixedSize,
maxSize: codec.maxSize
};
return createCodec({
...mapEncoder(codec, unmap),
read: map ? mapDecoder(codec, map).read : codec.read
});
}

@@ -145,25 +178,27 @@

function reverseEncoder(encoder) {
assertFixedSizeCodec(encoder, "Cannot reverse a codec of variable size.");
return {
assertIsFixedSize(encoder, "Cannot reverse a codec of variable size.");
return createEncoder({
...encoder,
encode: (value) => encoder.encode(value).reverse()
};
write: (value, bytes, offset) => {
const newOffset = encoder.write(value, bytes, offset);
const slice = bytes.slice(offset, offset + encoder.fixedSize).reverse();
bytes.set(slice, offset);
return newOffset;
}
});
}
function reverseDecoder(decoder) {
assertFixedSizeCodec(decoder, "Cannot reverse a codec of variable size.");
return {
assertIsFixedSize(decoder, "Cannot reverse a codec of variable size.");
return createDecoder({
...decoder,
decode: (bytes, offset = 0) => {
read: (bytes, offset) => {
const reverseEnd = offset + decoder.fixedSize;
if (offset === 0 && bytes.length === reverseEnd) {
return decoder.decode(bytes.reverse(), offset);
return decoder.read(bytes.reverse(), offset);
}
const newBytes = mergeBytes([
...offset === 0 ? [] : [bytes.slice(0, offset)],
bytes.slice(offset, reverseEnd).reverse(),
...bytes.length === reverseEnd ? [] : [bytes.slice(reverseEnd)]
]);
return decoder.decode(newBytes, offset);
const reversedBytes = bytes.slice();
reversedBytes.set(bytes.slice(offset, reverseEnd).reverse(), offset);
return decoder.read(reversedBytes, offset);
}
};
});
}

@@ -174,4 +209,4 @@ function reverseCodec(codec) {

export { assertByteArrayHasEnoughBytesForCodec, assertByteArrayIsNotEmptyForCodec, assertFixedSizeCodec, combineCodec, fixBytes, fixCodec, fixDecoder, fixEncoder, mapCodec, mapDecoder, mapEncoder, mergeBytes, padBytes, reverseCodec, reverseDecoder, reverseEncoder };
export { assertByteArrayHasEnoughBytesForCodec, assertByteArrayIsNotEmptyForCodec, assertIsFixedSize, assertIsVariableSize, combineCodec, createCodec, createDecoder, createEncoder, fixBytes, fixCodec, fixDecoder, fixEncoder, getEncodedSize, isFixedSize, isVariableSize, mapCodec, mapDecoder, mapEncoder, mergeBytes, padBytes, reverseCodec, reverseDecoder, reverseEncoder };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.native.js.map

@@ -13,7 +13,2 @@ // src/assertions.ts

}
function assertFixedSizeCodec(data, message) {
if (data.fixedSize === null) {
throw new Error(message ?? "Expected a fixed-size codec, got a variable-size one.");
}
}

@@ -47,5 +42,56 @@ // src/bytes.ts

// src/codec.ts
function getEncodedSize(value, encoder) {
return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);
}
function createEncoder(encoder) {
return Object.freeze({
...encoder,
encode: (value) => {
const bytes = new Uint8Array(getEncodedSize(value, encoder));
encoder.write(value, bytes, 0);
return bytes;
}
});
}
function createDecoder(decoder) {
return Object.freeze({
...decoder,
decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0]
});
}
function createCodec(codec) {
return Object.freeze({
...codec,
decode: (bytes, offset = 0) => codec.read(bytes, offset)[0],
encode: (value) => {
const bytes = new Uint8Array(getEncodedSize(value, codec));
codec.write(value, bytes, 0);
return bytes;
}
});
}
function isFixedSize(codec) {
return "fixedSize" in codec && typeof codec.fixedSize === "number";
}
function assertIsFixedSize(codec, message) {
if (!isFixedSize(codec)) {
throw new Error(message ?? "Expected a fixed-size codec, got a variable-size one.");
}
}
function isVariableSize(codec) {
return !isFixedSize(codec);
}
function assertIsVariableSize(codec, message) {
if (!isVariableSize(codec)) {
throw new Error(message ?? "Expected a variable-size codec, got a fixed-size one.");
}
}
// src/combine-codec.ts
function combineCodec(encoder, decoder, description) {
if (encoder.fixedSize !== decoder.fixedSize) {
function combineCodec(encoder, decoder) {
if (isFixedSize(encoder) !== isFixedSize(decoder)) {
throw new Error(`Encoder and decoder must either both be fixed-size or variable-size.`);
}
if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {
throw new Error(

@@ -55,3 +101,3 @@ `Encoder and decoder must have the same fixed size, got [${encoder.fixedSize}] and [${decoder.fixedSize}].`

}
if (encoder.maxSize !== decoder.maxSize) {
if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {
throw new Error(

@@ -61,13 +107,9 @@ `Encoder and decoder must have the same max size, got [${encoder.maxSize}] and [${decoder.maxSize}].`

}
if (description === void 0 && encoder.description !== decoder.description) {
throw new Error(
`Encoder and decoder must have the same description, got [${encoder.description}] and [${decoder.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`
);
}
return {
...decoder,
...encoder,
decode: decoder.decode,
description: description ?? encoder.description,
encode: encoder.encode,
fixedSize: encoder.fixedSize,
maxSize: encoder.maxSize
read: decoder.read,
write: encoder.write
};

@@ -77,19 +119,17 @@ }

// src/fix-codec.ts
function fixCodecHelper(data, fixedBytes, description) {
return {
description: description ?? `fixed(${fixedBytes}, ${data.description})`,
function fixEncoder(encoder, fixedBytes) {
return createEncoder({
fixedSize: fixedBytes,
maxSize: fixedBytes
};
write: (value, bytes, offset) => {
const variableByteArray = encoder.encode(value);
const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;
bytes.set(fixedByteArray, offset);
return offset + fixedBytes;
}
});
}
function fixEncoder(encoder, fixedBytes, description) {
return {
...fixCodecHelper(encoder, fixedBytes, description),
encode: (value) => fixBytes(encoder.encode(value), fixedBytes)
};
}
function fixDecoder(decoder, fixedBytes, description) {
return {
...fixCodecHelper(decoder, fixedBytes, description),
decode: (bytes, offset = 0) => {
function fixDecoder(decoder, fixedBytes) {
return createDecoder({
fixedSize: fixedBytes,
read: (bytes, offset) => {
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset);

@@ -99,12 +139,12 @@ if (offset > 0 || bytes.length > fixedBytes) {

}
if (decoder.fixedSize !== null) {
if (isFixedSize(decoder)) {
bytes = fixBytes(bytes, decoder.fixedSize);
}
const [value] = decoder.decode(bytes, 0);
const [value] = decoder.read(bytes, 0);
return [value, offset + fixedBytes];
}
};
});
}
function fixCodec(codec, fixedBytes, description) {
return combineCodec(fixEncoder(codec, fixedBytes, description), fixDecoder(codec, fixedBytes, description));
function fixCodec(codec, fixedBytes) {
return combineCodec(fixEncoder(codec, fixedBytes), fixDecoder(codec, fixedBytes));
}

@@ -114,28 +154,21 @@

function mapEncoder(encoder, unmap) {
return {
description: encoder.description,
encode: (value) => encoder.encode(unmap(value)),
fixedSize: encoder.fixedSize,
maxSize: encoder.maxSize
};
return createEncoder({
...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder,
write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset)
});
}
function mapDecoder(decoder, map) {
return {
decode: (bytes, offset = 0) => {
const [value, length] = decoder.decode(bytes, offset);
return [map(value, bytes, offset), length];
},
description: decoder.description,
fixedSize: decoder.fixedSize,
maxSize: decoder.maxSize
};
return createDecoder({
...decoder,
read: (bytes, offset) => {
const [value, newOffset] = decoder.read(bytes, offset);
return [map(value, bytes, offset), newOffset];
}
});
}
function mapCodec(codec, unmap, map) {
return {
decode: map ? mapDecoder(codec, map).decode : codec.decode,
description: codec.description,
encode: mapEncoder(codec, unmap).encode,
fixedSize: codec.fixedSize,
maxSize: codec.maxSize
};
return createCodec({
...mapEncoder(codec, unmap),
read: map ? mapDecoder(codec, map).read : codec.read
});
}

@@ -145,25 +178,27 @@

function reverseEncoder(encoder) {
assertFixedSizeCodec(encoder, "Cannot reverse a codec of variable size.");
return {
assertIsFixedSize(encoder, "Cannot reverse a codec of variable size.");
return createEncoder({
...encoder,
encode: (value) => encoder.encode(value).reverse()
};
write: (value, bytes, offset) => {
const newOffset = encoder.write(value, bytes, offset);
const slice = bytes.slice(offset, offset + encoder.fixedSize).reverse();
bytes.set(slice, offset);
return newOffset;
}
});
}
function reverseDecoder(decoder) {
assertFixedSizeCodec(decoder, "Cannot reverse a codec of variable size.");
return {
assertIsFixedSize(decoder, "Cannot reverse a codec of variable size.");
return createDecoder({
...decoder,
decode: (bytes, offset = 0) => {
read: (bytes, offset) => {
const reverseEnd = offset + decoder.fixedSize;
if (offset === 0 && bytes.length === reverseEnd) {
return decoder.decode(bytes.reverse(), offset);
return decoder.read(bytes.reverse(), offset);
}
const newBytes = mergeBytes([
...offset === 0 ? [] : [bytes.slice(0, offset)],
bytes.slice(offset, reverseEnd).reverse(),
...bytes.length === reverseEnd ? [] : [bytes.slice(reverseEnd)]
]);
return decoder.decode(newBytes, offset);
const reversedBytes = bytes.slice();
reversedBytes.set(bytes.slice(offset, reverseEnd).reverse(), offset);
return decoder.read(reversedBytes, offset);
}
};
});
}

@@ -174,4 +209,4 @@ function reverseCodec(codec) {

export { assertByteArrayHasEnoughBytesForCodec, assertByteArrayIsNotEmptyForCodec, assertFixedSizeCodec, combineCodec, fixBytes, fixCodec, fixDecoder, fixEncoder, mapCodec, mapDecoder, mapEncoder, mergeBytes, padBytes, reverseCodec, reverseDecoder, reverseEncoder };
export { assertByteArrayHasEnoughBytesForCodec, assertByteArrayIsNotEmptyForCodec, assertIsFixedSize, assertIsVariableSize, combineCodec, createCodec, createDecoder, createEncoder, fixBytes, fixCodec, fixDecoder, fixEncoder, getEncodedSize, isFixedSize, isVariableSize, mapCodec, mapDecoder, mapEncoder, mergeBytes, padBytes, reverseCodec, reverseDecoder, reverseEncoder };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.node.js.map

@@ -1,2 +0,1 @@

import { CodecData } from './codec';
/**

@@ -10,8 +9,2 @@ * Asserts that a given byte array is not empty.

export declare function assertByteArrayHasEnoughBytesForCodec(codecDescription: string, expected: number, bytes: Uint8Array, offset?: number): void;
/**
* Asserts that a given codec is fixed-size codec.
*/
export declare function assertFixedSizeCodec(data: Pick<CodecData, 'fixedSize'>, message?: string): asserts data is {
fixedSize: number;
};
//# sourceMappingURL=assertions.d.ts.map

@@ -5,30 +5,48 @@ /**

export type Offset = number;
/**
* The shared attributes between codecs, encoders and decoders.
*/
export type CodecData = {
/** A description for the codec. */
description: string;
/** The fixed size of the encoded value in bytes, or `null` if it is variable. */
fixedSize: number | null;
/** The maximum size an encoded value can be in bytes, or `null` if it is variable. */
maxSize: number | null;
type BaseEncoder<TFrom> = {
/** Encode the provided value and return the encoded bytes directly. */
readonly encode: (value: TFrom) => Uint8Array;
/**
* Writes the encoded value into the provided byte array at the given offset.
* Returns the offset of the next byte after the encoded value.
*/
readonly write: (value: TFrom, bytes: Uint8Array, offset: Offset) => Offset;
};
export type FixedSizeEncoder<TFrom, TSize extends number = number> = BaseEncoder<TFrom> & {
/** The fixed size of the encoded value in bytes. */
readonly fixedSize: TSize;
};
export type VariableSizeEncoder<TFrom> = BaseEncoder<TFrom> & {
/** The total size of the encoded value in bytes. */
readonly getSizeFromValue: (value: TFrom) => number;
/** The maximum size an encoded value can be in bytes, if applicable. */
readonly maxSize?: number;
};
/**
* An object that can encode a value to a `Uint8Array`.
*/
export type Encoder<T> = CodecData & {
/** The function that encodes a value into bytes. */
encode: (value: T) => Uint8Array;
export type Encoder<TFrom> = FixedSizeEncoder<TFrom> | VariableSizeEncoder<TFrom>;
type BaseDecoder<TTo> = {
/** Decodes the provided byte array at the given offset (or zero) and returns the value directly. */
readonly decode: (bytes: Uint8Array, offset?: Offset) => TTo;
/**
* Reads the encoded value from the provided byte array at the given offset.
* Returns the decoded value and the offset of the next byte after the encoded value.
*/
readonly read: (bytes: Uint8Array, offset: Offset) => [TTo, Offset];
};
export type FixedSizeDecoder<TTo, TSize extends number = number> = BaseDecoder<TTo> & {
/** The fixed size of the encoded value in bytes. */
readonly fixedSize: TSize;
};
export type VariableSizeDecoder<TTo> = BaseDecoder<TTo> & {
/** The maximum size an encoded value can be in bytes, if applicable. */
readonly maxSize?: number;
};
/**
* An object that can decode a value from a `Uint8Array`.
*/
export type Decoder<T> = CodecData & {
/**
* The function that decodes a value from bytes.
* It returns the decoded value and the number of bytes read.
*/
decode: (bytes: Uint8Array, offset?: Offset) => [T, Offset];
};
export type Decoder<TTo> = FixedSizeDecoder<TTo> | VariableSizeDecoder<TTo>;
export type FixedSizeCodec<TFrom, TTo extends TFrom = TFrom, TSize extends number = number> = FixedSizeEncoder<TFrom, TSize> & FixedSizeDecoder<TTo, TSize>;
export type VariableSizeCodec<TFrom, TTo extends TFrom = TFrom> = VariableSizeEncoder<TFrom> & VariableSizeDecoder<TTo>;
/**

@@ -40,19 +58,67 @@ * An object that can encode and decode a value to and from a `Uint8Array`.

*
* @typeParam From - The type of the value to encode.
* @typeParam To - The type of the decoded value. Defaults to `From`.
* @typeParam TFrom - The type of the value to encode.
* @typeParam TTo - The type of the decoded value. Defaults to `TFrom`.
*/
export type Codec<From, To extends From = From> = Encoder<From> & Decoder<To>;
export type Codec<TFrom, TTo extends TFrom = TFrom> = FixedSizeCodec<TFrom, TTo> | VariableSizeCodec<TFrom, TTo>;
/**
* Defines common options for codec factories.
* Get the encoded size of a given value in bytes.
*/
export type BaseCodecOptions = {
/** A custom description for the Codec. */
description?: string;
export declare function getEncodedSize<TFrom>(value: TFrom, encoder: {
fixedSize: number;
} | {
getSizeFromValue: (value: TFrom) => number;
}): number;
/** Fills the missing `encode` function using the existing `write` function. */
export declare function createEncoder<TFrom, TSize extends number>(encoder: Omit<FixedSizeEncoder<TFrom, TSize>, 'encode'>): FixedSizeEncoder<TFrom, TSize>;
export declare function createEncoder<TFrom>(encoder: Omit<VariableSizeEncoder<TFrom>, 'encode'>): VariableSizeEncoder<TFrom>;
export declare function createEncoder<TFrom>(encoder: Omit<FixedSizeEncoder<TFrom>, 'encode'> | Omit<VariableSizeEncoder<TFrom>, 'encode'>): Encoder<TFrom>;
/** Fills the missing `decode` function using the existing `read` function. */
export declare function createDecoder<TTo, TSize extends number>(decoder: Omit<FixedSizeDecoder<TTo, TSize>, 'decode'>): FixedSizeDecoder<TTo, TSize>;
export declare function createDecoder<TTo>(decoder: Omit<VariableSizeDecoder<TTo>, 'decode'>): VariableSizeDecoder<TTo>;
export declare function createDecoder<TTo>(decoder: Omit<FixedSizeDecoder<TTo>, 'decode'> | Omit<VariableSizeDecoder<TTo>, 'decode'>): Decoder<TTo>;
/** Fills the missing `encode` and `decode` function using the existing `write` and `read` functions. */
export declare function createCodec<TFrom, TTo extends TFrom = TFrom, TSize extends number = number>(codec: Omit<FixedSizeCodec<TFrom, TTo, TSize>, 'encode' | 'decode'>): FixedSizeCodec<TFrom, TTo, TSize>;
export declare function createCodec<TFrom, TTo extends TFrom = TFrom>(codec: Omit<VariableSizeCodec<TFrom, TTo>, 'encode' | 'decode'>): VariableSizeCodec<TFrom, TTo>;
export declare function createCodec<TFrom, TTo extends TFrom = TFrom>(codec: Omit<FixedSizeCodec<TFrom, TTo>, 'encode' | 'decode'> | Omit<VariableSizeCodec<TFrom, TTo>, 'encode' | 'decode'>): Codec<TFrom, TTo>;
export declare function isFixedSize<TFrom, TSize extends number>(encoder: FixedSizeEncoder<TFrom, TSize> | VariableSizeEncoder<TFrom>): encoder is FixedSizeEncoder<TFrom, TSize>;
export declare function isFixedSize<TTo, TSize extends number>(decoder: FixedSizeDecoder<TTo, TSize> | VariableSizeDecoder<TTo>): decoder is FixedSizeDecoder<TTo, TSize>;
export declare function isFixedSize<TFrom, TTo extends TFrom, TSize extends number>(codec: FixedSizeCodec<TFrom, TTo, TSize> | VariableSizeCodec<TFrom, TTo>): codec is FixedSizeCodec<TFrom, TTo, TSize>;
export declare function isFixedSize<TSize extends number>(codec: {
fixedSize: TSize;
} | {
maxSize?: number;
}): codec is {
fixedSize: TSize;
};
/**
* Wraps all the attributes of an object in Codecs.
*/
export type WrapInCodec<T, U extends T = T> = {
[P in keyof T]: Codec<T[P], U[P]>;
export declare function assertIsFixedSize<TFrom, TSize extends number>(encoder: FixedSizeEncoder<TFrom, TSize> | VariableSizeEncoder<TFrom>, message?: string): asserts encoder is FixedSizeEncoder<TFrom, TSize>;
export declare function assertIsFixedSize<TTo, TSize extends number>(decoder: FixedSizeDecoder<TTo, TSize> | VariableSizeDecoder<TTo>, message?: string): asserts decoder is FixedSizeDecoder<TTo, TSize>;
export declare function assertIsFixedSize<TFrom, TTo extends TFrom, TSize extends number>(codec: FixedSizeCodec<TFrom, TTo, TSize> | VariableSizeCodec<TFrom, TTo>, message?: string): asserts codec is FixedSizeCodec<TFrom, TTo, TSize>;
export declare function assertIsFixedSize<TSize extends number>(codec: {
fixedSize: TSize;
} | {
maxSize?: number;
}, message?: string): asserts codec is {
fixedSize: TSize;
};
export declare function isVariableSize<TFrom>(encoder: Encoder<TFrom>): encoder is VariableSizeEncoder<TFrom>;
export declare function isVariableSize<TTo>(decoder: Decoder<TTo>): decoder is VariableSizeDecoder<TTo>;
export declare function isVariableSize<TFrom, TTo extends TFrom>(codec: Codec<TFrom, TTo>): codec is VariableSizeCodec<TFrom, TTo>;
export declare function isVariableSize(codec: {
fixedSize: number;
} | {
maxSize?: number;
}): codec is {
maxSize?: number;
};
export declare function assertIsVariableSize<T>(encoder: Encoder<T>, message?: string): asserts encoder is VariableSizeEncoder<T>;
export declare function assertIsVariableSize<T>(decoder: Decoder<T>, message?: string): asserts decoder is VariableSizeDecoder<T>;
export declare function assertIsVariableSize<TFrom, TTo extends TFrom>(codec: Codec<TFrom, TTo>, message?: string): asserts codec is VariableSizeCodec<TFrom, TTo>;
export declare function assertIsVariableSize(codec: {
fixedSize: number;
} | {
maxSize?: number;
}, message?: string): asserts codec is {
maxSize?: number;
};
export {};
//# sourceMappingURL=codec.d.ts.map

@@ -1,2 +0,2 @@

import { Codec, Decoder, Encoder } from './codec';
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from './codec.js';
/**

@@ -7,3 +7,5 @@ * Combines an encoder and a decoder into a codec.

*/
export declare function combineCodec<From, To extends From = From>(encoder: Encoder<From>, decoder: Decoder<To>, description?: string): Codec<From, To>;
export declare function combineCodec<TFrom, TTo extends TFrom, TSize extends number>(encoder: FixedSizeEncoder<TFrom, TSize>, decoder: FixedSizeDecoder<TTo, TSize>): FixedSizeCodec<TFrom, TTo, TSize>;
export declare function combineCodec<TFrom, TTo extends TFrom>(encoder: VariableSizeEncoder<TFrom>, decoder: VariableSizeDecoder<TTo>): VariableSizeCodec<TFrom, TTo>;
export declare function combineCodec<TFrom, TTo extends TFrom>(encoder: Encoder<TFrom>, decoder: Decoder<TTo>): Codec<TFrom, TTo>;
//# sourceMappingURL=combine-codec.d.ts.map

@@ -1,2 +0,2 @@

import { Codec, Decoder, Encoder } from './codec';
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder } from './codec.js';
/**

@@ -7,5 +7,4 @@ * Creates a fixed-size encoder from a given encoder.

* @param fixedBytes - The fixed number of bytes to write.
* @param description - A custom description for the encoder.
*/
export declare function fixEncoder<T>(encoder: Encoder<T>, fixedBytes: number, description?: string): Encoder<T>;
export declare function fixEncoder<TFrom, TSize extends number>(encoder: Encoder<TFrom>, fixedBytes: TSize): FixedSizeEncoder<TFrom, TSize>;
/**

@@ -16,5 +15,4 @@ * Creates a fixed-size decoder from a given decoder.

* @param fixedBytes - The fixed number of bytes to read.
* @param description - A custom description for the decoder.
*/
export declare function fixDecoder<T>(decoder: Decoder<T>, fixedBytes: number, description?: string): Decoder<T>;
export declare function fixDecoder<TTo, TSize extends number>(decoder: Decoder<TTo>, fixedBytes: TSize): FixedSizeDecoder<TTo, TSize>;
/**

@@ -25,5 +23,4 @@ * Creates a fixed-size codec from a given codec.

* @param fixedBytes - The fixed number of bytes to read/write.
* @param description - A custom description for the codec.
*/
export declare function fixCodec<T, U extends T = T>(codec: Codec<T, U>, fixedBytes: number, description?: string): Codec<T, U>;
export declare function fixCodec<TFrom, TTo extends TFrom, TSize extends number>(codec: Codec<TFrom, TTo>, fixedBytes: TSize): FixedSizeCodec<TFrom, TTo, TSize>;
//# sourceMappingURL=fix-codec.d.ts.map

@@ -1,8 +0,8 @@

export * from './assertions';
export * from './bytes';
export * from './codec';
export * from './combine-codec';
export * from './fix-codec';
export * from './map-codec';
export * from './reverse-codec';
export * from './assertions.js';
export * from './bytes.js';
export * from './codec.js';
export * from './combine-codec.js';
export * from './fix-codec.js';
export * from './map-codec.js';
export * from './reverse-codec.js';
//# sourceMappingURL=index.d.ts.map

@@ -1,15 +0,23 @@

import { Codec, Decoder, Encoder } from './codec';
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from './codec.js';
/**
* Converts an encoder A to a encoder B by mapping their values.
*/
export declare function mapEncoder<T, U>(encoder: Encoder<T>, unmap: (value: U) => T): Encoder<U>;
export declare function mapEncoder<TOldFrom, TNewFrom, TSize extends number>(encoder: FixedSizeEncoder<TOldFrom, TSize>, unmap: (value: TNewFrom) => TOldFrom): FixedSizeEncoder<TNewFrom, TSize>;
export declare function mapEncoder<TOldFrom, TNewFrom>(encoder: VariableSizeEncoder<TOldFrom>, unmap: (value: TNewFrom) => TOldFrom): VariableSizeEncoder<TNewFrom>;
export declare function mapEncoder<TOldFrom, TNewFrom>(encoder: Encoder<TOldFrom>, unmap: (value: TNewFrom) => TOldFrom): Encoder<TNewFrom>;
/**
* Converts an decoder A to a decoder B by mapping their values.
*/
export declare function mapDecoder<T, U>(decoder: Decoder<T>, map: (value: T, bytes: Uint8Array, offset: number) => U): Decoder<U>;
export declare function mapDecoder<TOldTo, TNewTo, TSize extends number>(decoder: FixedSizeDecoder<TOldTo, TSize>, map: (value: TOldTo, bytes: Uint8Array, offset: number) => TNewTo): FixedSizeDecoder<TNewTo, TSize>;
export declare function mapDecoder<TOldTo, TNewTo>(decoder: VariableSizeDecoder<TOldTo>, map: (value: TOldTo, bytes: Uint8Array, offset: number) => TNewTo): VariableSizeDecoder<TNewTo>;
export declare function mapDecoder<TOldTo, TNewTo>(decoder: Decoder<TOldTo>, map: (value: TOldTo, bytes: Uint8Array, offset: number) => TNewTo): Decoder<TNewTo>;
/**
* Converts a codec A to a codec B by mapping their values.
*/
export declare function mapCodec<NewFrom, OldFrom, To extends NewFrom & OldFrom>(codec: Codec<OldFrom, To>, unmap: (value: NewFrom) => OldFrom): Codec<NewFrom, To>;
export declare function mapCodec<NewFrom, OldFrom, NewTo extends NewFrom = NewFrom, OldTo extends OldFrom = OldFrom>(codec: Codec<OldFrom, OldTo>, unmap: (value: NewFrom) => OldFrom, map: (value: OldTo, bytes: Uint8Array, offset: number) => NewTo): Codec<NewFrom, NewTo>;
export declare function mapCodec<TOldFrom, TNewFrom, TTo extends TNewFrom & TOldFrom, TSize extends number>(codec: FixedSizeCodec<TOldFrom, TTo, TSize>, unmap: (value: TNewFrom) => TOldFrom): FixedSizeCodec<TNewFrom, TTo, TSize>;
export declare function mapCodec<TOldFrom, TNewFrom, TTo extends TNewFrom & TOldFrom>(codec: VariableSizeCodec<TOldFrom, TTo>, unmap: (value: TNewFrom) => TOldFrom): VariableSizeCodec<TNewFrom, TTo>;
export declare function mapCodec<TOldFrom, TNewFrom, TTo extends TNewFrom & TOldFrom>(codec: Codec<TOldFrom, TTo>, unmap: (value: TNewFrom) => TOldFrom): Codec<TNewFrom, TTo>;
export declare function mapCodec<TOldFrom, TNewFrom, TOldTo extends TOldFrom, TNewTo extends TNewFrom, TSize extends number>(codec: FixedSizeCodec<TOldFrom, TOldTo, TSize>, unmap: (value: TNewFrom) => TOldFrom, map: (value: TOldTo, bytes: Uint8Array, offset: number) => TNewTo): FixedSizeCodec<TNewFrom, TNewTo, TSize>;
export declare function mapCodec<TOldFrom, TNewFrom, TOldTo extends TOldFrom, TNewTo extends TNewFrom>(codec: VariableSizeCodec<TOldFrom, TOldTo>, unmap: (value: TNewFrom) => TOldFrom, map: (value: TOldTo, bytes: Uint8Array, offset: number) => TNewTo): VariableSizeCodec<TNewFrom, TNewTo>;
export declare function mapCodec<TOldFrom, TNewFrom, TOldTo extends TOldFrom, TNewTo extends TNewFrom>(codec: Codec<TOldFrom, TOldTo>, unmap: (value: TNewFrom) => TOldFrom, map: (value: TOldTo, bytes: Uint8Array, offset: number) => TNewTo): Codec<TNewFrom, TNewTo>;
//# sourceMappingURL=map-codec.d.ts.map

@@ -1,14 +0,14 @@

import { Codec, Decoder, Encoder } from './codec';
import { FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder } from './codec.js';
/**
* Reverses the bytes of a fixed-size encoder.
*/
export declare function reverseEncoder<T>(encoder: Encoder<T>): Encoder<T>;
export declare function reverseEncoder<TFrom, TSize extends number>(encoder: FixedSizeEncoder<TFrom, TSize>): FixedSizeEncoder<TFrom, TSize>;
/**
* Reverses the bytes of a fixed-size decoder.
*/
export declare function reverseDecoder<T>(decoder: Decoder<T>): Decoder<T>;
export declare function reverseDecoder<TTo, TSize extends number>(decoder: FixedSizeDecoder<TTo, TSize>): FixedSizeDecoder<TTo, TSize>;
/**
* Reverses the bytes of a fixed-size codec.
*/
export declare function reverseCodec<T, U extends T = T>(codec: Codec<T, U>): Codec<T, U>;
export declare function reverseCodec<TFrom, TTo extends TFrom, TSize extends number>(codec: FixedSizeCodec<TFrom, TTo, TSize>): FixedSizeCodec<TFrom, TTo, TSize>;
//# sourceMappingURL=reverse-codec.d.ts.map
{
"name": "@solana/codecs-core",
"version": "2.0.0-experimental.71a42a7",
"version": "2.0.0-experimental.7297b81",
"description": "Core types and helpers for encoding and decoding byte arrays on Solana",

@@ -53,16 +53,16 @@ "exports": {

"@solana/eslint-config-solana": "^1.0.2",
"@swc/jest": "^0.2.28",
"@types/jest": "^29.5.5",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@swc/jest": "^0.2.29",
"@types/jest": "^29.5.11",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.3.0",
"agadoo": "^3.0.0",
"eslint": "^8.45.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jest": "^27.4.2",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.6.4",
"jest-runner-eslint": "^2.1.0",
"jest-environment-jsdom": "^29.7.0",
"jest-runner-eslint": "^2.1.2",
"jest-runner-prettier": "^1.0.0",
"prettier": "^2.8",
"tsup": "7.2.0",
"prettier": "^3.1",
"tsup": "^8.0.1",
"typescript": "^5.2.2",

@@ -83,4 +83,4 @@ "version-from-git": "^1.1.1",

"scripts": {
"compile:js": "tsup --config build-scripts/tsup.config.library.ts",
"compile:typedefs": "tsc -p ./tsconfig.declarations.json",
"compile:js": "tsup --config build-scripts/tsup.config.package.ts",
"compile:typedefs": "tsc -p ./tsconfig.declarations.json && node node_modules/build-scripts/add-js-extension-to-types.mjs",
"dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch",

@@ -87,0 +87,0 @@ "publish-packages": "pnpm publish --tag experimental --access public --no-git-checks",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc