Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@eik/core

Package Overview
Dependencies
Maintainers
5
Versions
209
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eik/core - npm Package Compare versions

Comparing version
2.1.46
to
2.1.47
+7
-0
CHANGELOG.md

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

## [2.1.47](https://github.com/eik-lib/core/compare/v2.1.46...v2.1.47) (2026-05-27)
### Bug Fixes
* Bump dependencies ([#587](https://github.com/eik-lib/core/issues/587)) ([c81b101](https://github.com/eik-lib/core/commit/c81b10179c6e6fc8d4f4a2ee82b95f1c0e1533e7))
## [2.1.46](https://github.com/eik-lib/core/compare/v2.1.45...v2.1.46) (2026-05-22)

@@ -2,0 +9,0 @@

+4
-0

@@ -7,2 +7,6 @@ /**

const HttpIncoming = class HttpIncoming {
/**
* @param {any} [request]
* @param {{ version?: string, extras?: string, author?: object, alias?: string, type?: string, name?: string, org?: string }} [options]
*/
constructor(

@@ -9,0 +13,0 @@ request,

@@ -17,3 +17,5 @@ import { stream } from "@eik/common";

this._location = "";
/** @type {import("node:stream").Readable | undefined} */
this._stream = undefined;
/** @type {any} */
this._body = undefined;

@@ -67,2 +69,3 @@ this._etag = "";

/** @returns {import("node:stream").Readable | undefined} */
get stream() {

@@ -76,2 +79,3 @@ return this._stream;

/** @returns {any} */
get body() {

@@ -78,0 +82,0 @@ return this._body;

@@ -20,3 +20,5 @@ import crypto from "node:crypto";

this._org = org;
/** @type {import("./asset.js").default[]} */
this._files = [];
/** @type {import("./meta.js").default[]} */
this._meta = [];

@@ -60,2 +62,5 @@ }

/**
* @param {import("./asset.js").default} asset
*/
setAsset(asset) {

@@ -67,2 +72,5 @@ if (!(asset instanceof Asset))

/**
* @param {import("./meta.js").default} meta
*/
setMeta(meta) {

@@ -69,0 +77,0 @@ if (!(meta instanceof Meta))

import semver from "semver";
const Versions = class Versions {
/**
* @param {{ versions?: [any, any][], type?: string, name?: string, org?: string }} [options]
*/
constructor({ versions = [], type = "", name = "", org = "" } = {}) {

@@ -12,4 +15,5 @@ this._versions = new Map(versions);

get versions() {
return Array.from(this._versions.entries()).sort((a, b) =>
a[0] > b[0] ? -1 : 1,
return [...this._versions.entries()].toSorted(
(/** @type {[any, any]} */ a, /** @type {[any, any]} */ b) =>
a[0] > b[0] ? -1 : 1,
);

@@ -30,2 +34,6 @@ }

/**
* @param {string} version
* @param {string} integrity
*/
setVersion(version, integrity) {

@@ -39,2 +47,5 @@ const major = semver.major(version);

/**
* @param {number} major
*/
getVersion(major) {

@@ -44,2 +55,5 @@ return this._versions.get(major);

/**
* @param {string} version
*/
check(version) {

@@ -46,0 +60,0 @@ const major = semver.major(version);

+13
-4

@@ -49,3 +49,3 @@ import { validators } from "@eik/common";

try {
await this._sink.exist(path);
if (this._sink) await this._sink.exist(path);
return true;

@@ -58,2 +58,9 @@ // eslint-disable-next-line no-unused-vars

/**
* @param {any} req
* @param {any} user
* @param {string} type
* @param {string} name
* @param {string} alias
*/
async handler(req, user, type, name, alias) {

@@ -70,3 +77,5 @@ const end = this._histogram.timer();

} catch (error) {
this._log.info(`alias:del - Validation failed - ${error.message}`);
this._log.info(
`alias:del - Validation failed - ${error instanceof Error ? error.message : String(error)}`,
);
const e = new HttpError.NotFound();

@@ -109,3 +118,3 @@ end({ labels: { success: false, status: e.status } });

);
await this._sink.delete(path);
if (this._sink) await this._sink.delete(path);
} catch (error) {

@@ -126,3 +135,3 @@ this._log.error(

const outgoing = new HttpOutgoing();
outgoing.cacheControl = this._cacheControl;
outgoing.cacheControl = this._cacheControl || "";
outgoing.statusCode = 204;

@@ -129,0 +138,0 @@

@@ -55,2 +55,9 @@ import { validators } from "@eik/common";

/**
* @param {any} req
* @param {string} type
* @param {string} name
* @param {string} alias
* @param {string} extra
*/
async handler(req, type, name, alias, extra) {

@@ -69,3 +76,5 @@ const end = this._histogram.timer();

} catch (error) {
this._log.debug(`alias:get - Validation failed - ${error.message}`);
this._log.debug(
`alias:get - Validation failed - ${error instanceof Error ? error.message : String(error)}`,
);
const e = new HttpError.NotFound();

@@ -108,3 +117,3 @@ end({ labels: { success: false, status: e.status } });

const file = await this._sink.read(assetPath);
const file = await (this._sink && this._sink.read(assetPath));
const outgoing = new HttpOutgoing();

@@ -125,10 +134,13 @@ outgoing.cacheControl = this._cacheControl;

outgoing.stream.on("error", (err) => {
this._log.info(`alias:get - File stream error - ${err}`);
end({ labels: { success: false, status: 503, type } });
});
const outgoingStream = outgoing.stream;
if (outgoingStream) {
outgoingStream.on("error", (err) => {
this._log.info(`alias:get - File stream error - ${err}`);
end({ labels: { success: false, status: 503, type } });
});
outgoing.stream.on("end", () => {
end({ labels: { status: outgoing.statusCode, type } });
});
outgoingStream.on("end", () => {
end({ labels: { status: outgoing.statusCode, type } });
});
}
}

@@ -135,0 +147,0 @@

@@ -48,2 +48,9 @@ import { validators } from "@eik/common";

/**
* @param {any} req
* @param {string} type
* @param {string} name
* @param {string} alias
* @param {string} extra
*/
async handler(req, type, name, alias, extra) {

@@ -62,3 +69,5 @@ const end = this._histogram.timer();

} catch (error) {
this._log.debug(`alias:get - Validation failed - ${error.message}`);
this._log.debug(
`alias:get - Validation failed - ${error instanceof Error ? error.message : String(error)}`,
);
const e = new HttpError.NotFound();

@@ -65,0 +74,0 @@ end({ labels: { success: false, status: e.status } });

@@ -60,2 +60,5 @@ import { validators } from "@eik/common";

/**
* @param {any} incoming
*/
_parser(incoming) {

@@ -92,3 +95,3 @@ return new Promise((resolve, reject) => {

});
await this._sink.read(path);
if (this._sink) await this._sink.read(path);
} catch (error) {

@@ -132,6 +135,9 @@ this._log.error(

/**
* @param {any} incoming
*/
async _exist(incoming) {
try {
const path = createFilePathToAlias(incoming);
await this._sink.exist(path);
if (this._sink) await this._sink.exist(path);
return true;

@@ -144,2 +150,9 @@ // eslint-disable-next-line no-unused-vars

/**
* @param {any} req
* @param {any} user
* @param {string} type
* @param {string} name
* @param {string} alias
*/
async handler(req, user, type, name, alias) {

@@ -156,3 +169,5 @@ const end = this._histogram.timer();

} catch (error) {
this._log.info(`alias:post - Validation failed - ${error.message}`);
this._log.info(
`alias:post - Validation failed - ${error instanceof Error ? error.message : String(error)}`,
);
const e = new HttpError.NotFound();

@@ -198,3 +213,3 @@ end({ labels: { success: false, status: e.status } });

const outgoing = new HttpOutgoing();
outgoing.cacheControl = this._cacheControl;
outgoing.cacheControl = this._cacheControl || "";
outgoing.statusCode = 303;

@@ -201,0 +216,0 @@ outgoing.location = createURIToAlias(incoming);

@@ -60,2 +60,5 @@ import { validators } from "@eik/common";

/**
* @param {any} incoming
*/
_parser(incoming) {

@@ -92,3 +95,3 @@ return new Promise((resolve, reject) => {

});
await this._sink.read(path);
if (this._sink) await this._sink.read(path);
} catch (error) {

@@ -132,6 +135,9 @@ this._log.error(

/**
* @param {any} incoming
*/
async _exist(incoming) {
try {
const path = createFilePathToAlias(incoming);
await this._sink.exist(path);
if (this._sink) await this._sink.exist(path);
return true;

@@ -144,2 +150,9 @@ // eslint-disable-next-line no-unused-vars

/**
* @param {any} req
* @param {any} user
* @param {string} type
* @param {string} name
* @param {string} alias
*/
async handler(req, user, type, name, alias) {

@@ -156,3 +169,5 @@ const end = this._histogram.timer();

} catch (error) {
this._log.info(`alias:put - Validation failed - ${error.message}`);
this._log.info(
`alias:put - Validation failed - ${error instanceof Error ? error.message : String(error)}`,
);
const e = new HttpError.BadRequest();

@@ -198,3 +213,3 @@ end({ labels: { success: false, status: e.status } });

const outgoing = new HttpOutgoing();
outgoing.cacheControl = this._cacheControl;
outgoing.cacheControl = this._cacheControl || "";
outgoing.statusCode = 303;

@@ -201,0 +216,0 @@ outgoing.location = createURIToAlias(incoming);

@@ -51,2 +51,5 @@ import originalUrl from "original-url";

/**
* @param {any} incoming
*/
_parser(incoming) {

@@ -80,2 +83,5 @@ return new Promise((resolve, reject) => {

/**
* @param {any} req
*/
async handler(req) {

@@ -103,3 +109,3 @@ const end = this._histogram.timer();

const outgoing = new HttpOutgoing();
outgoing.cacheControl = this._cacheControl;
outgoing.cacheControl = this._cacheControl || "";
outgoing.statusCode = 200;

@@ -106,0 +112,0 @@ outgoing.mimeType = "application/json";

@@ -49,2 +49,7 @@ import { validators } from "@eik/common";

/**
* @param {any} req
* @param {string} name
* @param {string} version
*/
async handler(req, name, version) {

@@ -60,3 +65,5 @@ const end = this._histogram.timer();

} catch (error) {
this._log.debug(`map:get - Validation failed - ${error.message}`);
this._log.debug(
`map:get - Validation failed - ${error instanceof Error ? error.message : String(error)}`,
);
const e = new HttpError.NotFound();

@@ -86,3 +93,3 @@ end({ labels: { success: false, status: e.status } });

try {
const file = await this._sink.read(path);
const file = await (this._sink && this._sink.read(path));
const outgoing = new HttpOutgoing();

@@ -103,10 +110,13 @@ outgoing.cacheControl = this._cacheControl;

outgoing.stream.on("error", (err) => {
this._log.info(`map:get - File stream error - ${err}`);
end({ labels: { success: false, status: 503, type: "map" } });
});
const outgoingStream = outgoing.stream;
if (outgoingStream) {
outgoingStream.on("error", (err) => {
this._log.info(`map:get - File stream error - ${err}`);
end({ labels: { success: false, status: 503, type: "map" } });
});
outgoing.stream.on("end", () => {
end({ labels: { status: outgoing.statusCode, type: "map" } });
});
outgoingStream.on("end", () => {
end({ labels: { status: outgoing.statusCode, type: "map" } });
});
}
}

@@ -113,0 +123,0 @@

@@ -70,5 +70,9 @@ import { validators } from "@eik/common";

/**
* @param {any} incoming
*/
_parser(incoming) {
return new Promise((resolve, reject) => {
const path = createFilePathToImportMap(incoming);
/** @type {Promise<any>[]} */
const queue = [];

@@ -85,11 +89,14 @@

busboy.on("file", (fieldname, file) => {
queue.push(
this._handleFile({
fieldname,
file,
path,
}),
);
});
busboy.on(
"file",
(/** @type {any} */ fieldname, /** @type {any} */ file) => {
queue.push(
this._handleFile({
fieldname,
file,
path,
}),
);
},
);

@@ -108,3 +115,3 @@ busboy.on("close", () => {

busboy.on("error", (error) => {
busboy.on("error", (/** @type {any} */ error) => {
reject(error);

@@ -120,2 +127,5 @@ });

/**
* @param {{ fieldname: any, file: any, path: any }} options
*/
async _handleFile({ fieldname, file, path }) {

@@ -135,3 +145,3 @@ // We accept only one file on this given fieldname.

// parse it as JSON or not.
let obj = {};
let obj;
try {

@@ -168,2 +178,5 @@ const str = await streamCollector(file);

/**
* @param {any} incoming
*/
async _readVersions(incoming) {

@@ -189,2 +202,6 @@ const path = createFilePathToVersion(incoming);

/**
* @param {any} incoming
* @param {any} versions
*/
async _writeVersions(incoming, versions) {

@@ -198,2 +215,8 @@ const path = createFilePathToVersion(incoming);

/**
* @param {any} req
* @param {any} user
* @param {string} name
* @param {string} version
*/
async handler(req, user, name, version) {

@@ -209,3 +232,5 @@ const end = this._histogram.timer();

} catch (error) {
this._log.info(`map:put - Validation failed - ${error.message}`);
this._log.info(
`map:put - Validation failed - ${error instanceof Error ? error.message : String(error)}`,
);
const e = new HttpError.BadRequest();

@@ -262,3 +287,3 @@ end({ labels: { success: false, status: e.status } });

const outgoing = new HttpOutgoing();
outgoing.cacheControl = this._cacheControl;
outgoing.cacheControl = this._cacheControl || "";
outgoing.statusCode = 303;

@@ -265,0 +290,0 @@ outgoing.location = createURIPathToImportMap(incoming);

@@ -51,2 +51,9 @@ import { validators } from "@eik/common";

/**
* @param {any} req
* @param {string} type
* @param {string} name
* @param {string} version
* @param {string} extra
*/
async handler(req, type, name, version, extra) {

@@ -65,3 +72,5 @@ const end = this._histogram.timer();

} catch (error) {
this._log.debug(`pkg:get - Validation failed - ${error.message}`);
this._log.debug(
`pkg:get - Validation failed - ${error instanceof Error ? error.message : String(error)}`,
);
const e = new HttpError.NotFound();

@@ -95,3 +104,3 @@ end({ labels: { success: false, status: e.status } });

try {
const file = await this._sink.read(path);
const file = await (this._sink && this._sink.read(path));
const outgoing = new HttpOutgoing();

@@ -112,10 +121,13 @@ outgoing.cacheControl = this._cacheControl;

outgoing.stream.on("error", (err) => {
this._log.info(`pkg:get - File stream error - ${err}`);
end({ labels: { success: false, status: 503, type } });
});
const outgoingStream = outgoing.stream;
if (outgoingStream) {
outgoingStream.on("error", (err) => {
this._log.info(`pkg:get - File stream error - ${err}`);
end({ labels: { success: false, status: 503, type } });
});
outgoing.stream.on("end", () => {
end({ labels: { status: outgoing.statusCode, type } });
});
outgoingStream.on("end", () => {
end({ labels: { status: outgoing.statusCode, type } });
});
}
}

@@ -122,0 +134,0 @@

@@ -49,2 +49,8 @@ import { validators } from "@eik/common";

/**
* @param {any} req
* @param {string} type
* @param {string} name
* @param {string} version
*/
async handler(req, type, name, version) {

@@ -61,3 +67,5 @@ const end = this._histogram.timer();

} catch (error) {
this._log.debug(`pkg:log - Validation failed - ${error.message}`);
this._log.debug(
`pkg:log - Validation failed - ${error instanceof Error ? error.message : String(error)}`,
);
const e = new HttpError.NotFound();

@@ -88,3 +96,3 @@ end({ labels: { success: false, status: e.status, type } });

try {
const file = await this._sink.read(path);
const file = await (this._sink && this._sink.read(path));
const outgoing = new HttpOutgoing();

@@ -105,10 +113,13 @@ outgoing.cacheControl = this._cacheControl;

outgoing.stream.on("error", (err) => {
this._log.info(`pkg:log - File stream error - ${err}`);
end({ labels: { success: false, status: 503, type } });
});
const outgoingStream = outgoing.stream;
if (outgoingStream) {
outgoingStream.on("error", (err) => {
this._log.info(`pkg:log - File stream error - ${err}`);
end({ labels: { success: false, status: 503, type } });
});
outgoing.stream.on("end", () => {
end({ labels: { status: outgoing.statusCode, type } });
});
outgoingStream.on("end", () => {
end({ labels: { status: outgoing.statusCode, type } });
});
}
}

@@ -115,0 +126,0 @@

@@ -76,2 +76,5 @@ import { validators } from "@eik/common";

/**
* @param {any} incoming
*/
async _parser(incoming) {

@@ -83,3 +86,3 @@ return new Promise((resolve, reject) => {

const pkg = new Package(incoming);
result.forEach((obj) => {
result.forEach((/** @type {any} */ obj) => {
if (obj.constructor.name === "FormField") {

@@ -89,3 +92,3 @@ pkg.setMeta(obj);

if (obj.constructor.name === "FormFile") {
obj.value.forEach((o) => {
obj.value.forEach((/** @type {any} */ o) => {
pkg.setAsset(o);

@@ -113,2 +116,5 @@ });

/**
* @param {any} incoming
*/
async _readVersions(incoming) {

@@ -134,2 +140,5 @@ const path = createFilePathToVersion(incoming);

/**
* @param {any} incoming
*/
async _readVersion(incoming) {

@@ -153,2 +162,6 @@ const path = createFilePathToEikJson(incoming);

/**
* @param {any} incoming
* @param {any} versions
*/
async _writeVersions(incoming, versions) {

@@ -162,2 +175,9 @@ const path = createFilePathToVersion(incoming);

/**
* @param {any} req
* @param {any} user
* @param {string} type
* @param {string} name
* @param {string} version
*/
async handler(req, user, type, name, version) {

@@ -174,3 +194,5 @@ const end = this._histogram.timer();

} catch (error) {
this._log.info(`pkg:put - Validation failed - ${error.message}`);
this._log.info(
`pkg:put - Validation failed - ${error instanceof Error ? error.message : String(error)}`,
);
const e = new HttpError.BadRequest();

@@ -228,3 +250,3 @@ end({ labels: { success: false, status: e.status } });

const outgoing = new HttpOutgoing();
outgoing.cacheControl = this._cacheControl;
outgoing.cacheControl = this._cacheControl || "";
outgoing.statusCode = 303;

@@ -231,0 +253,0 @@ outgoing.location = createURIPathToPkgLog(pkg);

@@ -49,2 +49,7 @@ import { validators } from "@eik/common";

/**
* @param {any} req
* @param {string} type
* @param {string} name
*/
async handler(req, type, name) {

@@ -59,3 +64,5 @@ const end = this._histogram.timer();

} catch (error) {
this._log.debug(`pkg:latest - Validation failed - ${error.message}`);
this._log.debug(
`pkg:latest - Validation failed - ${error instanceof Error ? error.message : String(error)}`,
);
const e = new HttpError.NotFound();

@@ -80,3 +87,3 @@ end({ labels: { success: false, status: e.status } });

try {
const file = await this._sink.read(path);
const file = await (this._sink && this._sink.read(path));
const outgoing = new HttpOutgoing();

@@ -97,10 +104,13 @@ outgoing.cacheControl = this._cacheControl;

outgoing.stream.on("error", (err) => {
this._log.info(`pkg:latest - File stream error - ${err}`);
end({ labels: { success: false, status: 503, type } });
});
const outgoingStream = outgoing.stream;
if (outgoingStream) {
outgoingStream.on("error", (err) => {
this._log.info(`pkg:latest - File stream error - ${err}`);
end({ labels: { success: false, status: 503, type } });
});
outgoing.stream.on("end", () => {
end({ labels: { status: outgoing.statusCode, type } });
});
outgoingStream.on("end", () => {
end({ labels: { status: outgoing.statusCode, type } });
});
}
}

@@ -107,0 +117,0 @@

const FormFile = class FormFile {
/**
* @param {{ value?: any[], name?: string }} [options]
*/
constructor({ value = [], name = "" } = {}) {

@@ -3,0 +6,0 @@ if (!Array.isArray(value))

@@ -38,4 +38,8 @@ import { pipeline } from "node:stream";

/**
* @param {any} incoming
*/
parse(incoming) {
return new Promise((resolve, reject) => {
/** @type {any[]} */
const queue = [];

@@ -52,43 +56,53 @@

busboy.on("field", (name, value) => {
if (!this._legalFields.includes(name.toLowerCase())) {
busboy.emit("error", new HttpError.BadRequest());
return;
}
busboy.on(
"field",
(/** @type {any} */ name, /** @type {any} */ value) => {
if (!this._legalFields.includes(name.toLowerCase())) {
busboy.emit("error", new HttpError.BadRequest());
return;
}
queue.push(
this._handleField({
value,
name,
}),
);
});
queue.push(
this._handleField({
value,
name,
}),
);
},
);
busboy.on("file", (fieldname, file, filename) => {
if (!this._legalFiles.includes(fieldname.toLowerCase())) {
busboy.emit("error", new HttpError.BadRequest());
return;
}
busboy.on(
"file",
(
/** @type {any} */ fieldname,
/** @type {any} */ file,
/** @type {any} */ filename,
) => {
if (!this._legalFiles.includes(fieldname.toLowerCase())) {
busboy.emit("error", new HttpError.BadRequest());
return;
}
queue.push(
new Promise((done) => {
this._handleFile({
fieldname,
file,
filename,
incoming,
})
.then((item) => {
done(item);
queue.push(
new Promise((done) => {
this._handleFile({
fieldname,
file,
filename,
incoming,
})
.catch((error) => {
// Emit an error on busboy instead of rejecting
// This will break and terminate the stream stright away
busboy.emit("error", error);
});
}),
);
});
.then((item) => {
done(item);
})
.catch((error) => {
// Emit an error on busboy instead of rejecting
// This will break and terminate the stream stright away
busboy.emit("error", error);
});
}),
);
},
);
busboy.once("error", (error) => {
busboy.once("error", (/** @type {any} */ error) => {
reject(error);

@@ -114,2 +128,5 @@ });

/**
* @param {{ name: any, value: any }} options
*/
_handleField({ name, value }) {

@@ -122,2 +139,5 @@ this._log.info(

/**
* @param {{ fieldname: any, file: any, filename: any, incoming: any }} options
*/
_handleFile({ fieldname, file, filename, incoming }) {

@@ -129,2 +149,3 @@ return new Promise((resolve, reject) => {

/** @type {Promise<any>[]} */
const queue = [];

@@ -187,2 +208,5 @@

/**
* @param {{ incoming: any, entry: any }} options
*/
_persistFile({ incoming, entry }) {

@@ -207,2 +231,6 @@ // eslint-disable-next-line no-async-promise-executor

try {
if (!this._sink) {
reject(new Error("No sink configured"));
return;
}
const writer = await this._sink.write(path, asset.mimeType);

@@ -212,3 +240,3 @@

let hash = "";
integrityStream.once("integrity", (integrity) => {
integrityStream.once("integrity", (/** @type {any} */ integrity) => {
hash = integrity;

@@ -215,0 +243,0 @@ });

import crypto from "node:crypto";
const Entry = class Entry {
/**
* @param {{ mimeType?: string, payload?: any[] }} [options]
*/
constructor({ mimeType = "application/octet-stream", payload = [] } = {}) {

@@ -5,0 +8,0 @@ this._mimeType = mimeType;

@@ -35,6 +35,6 @@ import { Writable, Readable } from "node:stream";

// eslint-disable-next-line no-unused-vars
this._writeDelayResolve = (a) => -1;
// eslint-disable-next-line no-unused-vars
this._writeDelayChunks = (a) => -1;
/** @type {(count?: number) => number} */
this._writeDelayResolve = () => -1;
/** @type {(count?: number) => number} */
this._writeDelayChunks = () => -1;
}

@@ -46,2 +46,6 @@

/**
* @param {string} filePath
* @param {any} payload
*/
set(filePath, payload) {

@@ -62,2 +66,5 @@ const pathname = toUrlPathname(path.join(this._rootPath, filePath));

/**
* @param {string} filePath
*/
get(filePath) {

@@ -73,5 +80,8 @@ const pathname = toUrlPathname(path.join(this._rootPath, filePath));

dump() {
return Array.from(this._state.entries());
return [...this._state.entries()];
}
/**
* @param {any} items
*/
load(items) {

@@ -85,3 +95,3 @@ if (!Array.isArray(items)) {

/**
* @param {(count: number) => number} fn
* @param {(count?: number) => number} fn
*/

@@ -96,3 +106,3 @@ set writeDelayResolve(fn) {

/**
* @param {(count: number) => number} fn
* @param {(count?: number) => number} fn
*/

@@ -108,2 +118,6 @@ set writeDelayChunks(fn) {

/**
* @param {string} filePath
* @param {string} contentType
*/
write(filePath, contentType) {

@@ -131,2 +145,3 @@ return new Promise((resolve, reject) => {

const chunkDelay = this._writeDelayChunks;
/** @type {any[]} */
const payload = [];

@@ -179,2 +194,5 @@ let count = 0;

/**
* @param {string} filePath
*/
read(filePath) {

@@ -201,2 +219,6 @@ return new Promise((resolve, reject) => {

const entry = this._state.get(pathname);
if (!entry) {
reject(new Error(`${filePath} does not exist`));
return;
}
const payload = entry.payload || [];

@@ -213,3 +235,3 @@ const file = new ReadFile({

setTimeout(() => {
payload.forEach((item) => {
payload.forEach((/** @type {any} */ item) => {
this.push(item);

@@ -220,3 +242,3 @@ });

} else {
payload.forEach((item) => {
payload.forEach((/** @type {any} */ item) => {
this.push(item);

@@ -243,2 +265,6 @@ });

/**
* @param {string} filePath
* @returns {Promise<void>}
*/
delete(filePath) {

@@ -265,3 +291,3 @@ return new Promise((resolve, reject) => {

// Delete recursively
Array.from(this._state.keys()).forEach((key) => {
[...this._state.keys()].forEach((key) => {
if (key.startsWith(pathname)) {

@@ -284,2 +310,6 @@ this._state.delete(key);

/**
* @param {string} filePath
* @returns {Promise<void>}
*/
exist(filePath) {

@@ -286,0 +316,0 @@ return new Promise((resolve, reject) => {

import { Writable, pipeline } from "node:stream";
import { URL } from "node:url";
import abslog from "abslog";
import slug from "unique-slug";
import { randomBytes } from "node:crypto";
import fs from "node:fs";
const slug = () => randomBytes(4).toString("hex");
const fileReader = (file = "../../README.md") =>

@@ -26,4 +28,9 @@ fs.createReadStream(new URL(file, import.meta.url));

/** @returns {Promise<void>} */
_write() {
return new Promise((resolve, reject) => {
if (!this._sink) {
reject(new Error("No sink configured"));
return;
}
this._sink

@@ -44,4 +51,9 @@ .write(this._name, "text/plain")

/** @returns {Promise<void>} */
_read() {
return new Promise((resolve, reject) => {
if (!this._sink) {
reject(new Error("No sink configured"));
return;
}
this._sink

@@ -53,3 +65,3 @@ .read(this._name)

objectMode: false,
write(chunk, encoding, callback) {
write(chunk, _encoding, callback) {
buffer.push(chunk);

@@ -72,2 +84,3 @@ callback();

_delete() {
if (!this._sink) throw new Error("No sink configured");
return this._sink.delete(this._name);

@@ -77,2 +90,3 @@ }

_exist() {
if (!this._sink) throw new Error("No sink configured");
return this._sink.exist(this._name);

@@ -79,0 +93,0 @@ }

import { Writable, Readable, pipeline } from "node:stream";
/**
* @param {any} sink
* @param {string} path
*/
const readJSON = (sink, path) =>

@@ -7,2 +11,3 @@ // eslint-disable-next-line no-async-promise-executor

try {
/** @type {any[]} */
const buffer = [];

@@ -33,4 +38,14 @@ const from = await sink.read(path);

});
/**
* @param {any} sink
* @param {string} path
*/
const readEikJson = (sink, path) => sink.exist(path);
/**
* @param {any} sink
* @param {string} path
* @param {any} obj
* @param {string} contentType
*/
const writeJSON = (sink, path, obj, contentType) =>

@@ -60,4 +75,8 @@ // eslint-disable-next-line no-async-promise-executor

});
/**
* @param {any} from
*/
const streamCollector = (from) =>
new Promise((resolve, reject) => {
/** @type {any[]} */
const buffer = [];

@@ -77,2 +96,5 @@ const to = new Writable({

/**
* @param {any} stat
*/
const etagFromFsStat = (stat) => {

@@ -84,2 +106,5 @@ const mtime = stat.mtime.getTime().toString(16);

/**
* @param {any} value
*/
const decodeUriComponent = (value) => {

@@ -86,0 +111,0 @@ if (value === null || value === undefined) return value;

{
"name": "@eik/core",
"version": "2.1.46",
"version": "2.1.47",
"description": "Core server package",

@@ -15,3 +15,3 @@ "main": "lib/main.js",

"scripts": {
"clean": "rimraf .tap node_modules types",
"clean": "node -e \"['.tap', 'node_modules', 'types'].forEach(d => require('fs').rmSync(d, {recursive: true, force: true}))\"",
"lint": "eslint .",

@@ -33,6 +33,6 @@ "lint:fix": "eslint --fix .",

"dependencies": {
"@eik/common": "5.1.27",
"@eik/sink": "1.2.5",
"@eik/sink-file-system": "2.0.32",
"@eik/sink-memory": "2.0.29",
"@eik/common": "5.1.28",
"@eik/sink": "1.2.6",
"@eik/sink-file-system": "2.0.33",
"@eik/sink-memory": "2.0.30",
"@metrics/client": "2.5.5",

@@ -45,23 +45,19 @@ "abslog": "2.4.4",

"semver": "7.8.1",
"ssri": "12.0.0",
"tar": "7.5.15",
"unique-slug": "5.0.0"
"ssri": "14.0.0",
"tar": "7.5.15"
},
"devDependencies": {
"@eik/eslint-config": "1.0.25",
"@eik/prettier-config": "1.0.1",
"@eik/semantic-release-config": "1.0.16",
"@eik/typescript-config": "1.0.1",
"@eik/eslint-config": "2.0.6",
"@eik/prettier-config": "1.0.2",
"@eik/semantic-release-config": "1.0.17",
"@eik/typescript-config": "1.0.2",
"@types/readable-stream": "4.0.23",
"eslint": "9.39.4",
"form-data": "4.0.5",
"eslint": "10.4.0",
"mkdirp": "3.0.1",
"node-fetch": "3.3.2",
"npm-run-all2": "8.0.4",
"npm-run-all2": "9.0.1",
"prettier": "3.8.3",
"rimraf": "6.1.3",
"semantic-release": "25.0.3",
"tap": "21.7.1",
"typescript": "5.9.3"
"tap": "21.7.4",
"typescript": "6.0.3"
}
}
export default Alias;
declare const Alias: {
new ({ name, type, alias, org }?: {
name?: string;
type?: string;
alias?: string;
org?: string;
name?: string | undefined;
type?: string | undefined;
alias?: string | undefined;
org?: string | undefined;
}): {

@@ -9,0 +9,0 @@ _version: string;

export default Asset;
export type AssetOptions = {
pathname?: string;
version?: string;
name?: string;
type?: string;
org?: string;
pathname?: string | undefined;
version?: string | undefined;
name?: string | undefined;
type?: string | undefined;
org?: string | undefined;
};

@@ -9,0 +9,0 @@ /**

export default Author;
declare const Author: {
new ({ name, user }?: {
name?: string;
user?: string;
name?: string | undefined;
user?: string | undefined;
}): {

@@ -7,0 +7,0 @@ _name: string;

@@ -8,6 +8,6 @@ export default HttpIncoming;

declare const HttpIncoming: {
new (request: any, { version, extras, author, alias, type, name, org, }?: {
new (request?: any, { version, extras, author, alias, type, name, org, }?: {
version?: string;
extras?: string;
author?: {};
author?: object;
alias?: string;

@@ -20,3 +20,3 @@ type?: string;

_extras: string;
_author: {};
_author: object;
_alias: string;

@@ -30,3 +30,3 @@ _type: string;

get extras(): string;
get author(): {};
get author(): object;
get alias(): string;

@@ -33,0 +33,0 @@ get name(): string;

@@ -8,3 +8,5 @@ export default HttpOutgoing;

_location: string;
_stream: any;
/** @type {import("node:stream").Readable | undefined} */
_stream: import("node:stream").Readable | undefined;
/** @type {any} */
_body: any;

@@ -20,4 +22,6 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
/** @returns {import("node:stream").Readable | undefined} */
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
/** @returns {any} */
get body(): any;

@@ -24,0 +28,0 @@ set body(value: any);

export default Meta;
declare const Meta: {
new ({ value, name }?: {
value?: string;
name?: string;
value?: string | undefined;
name?: string | undefined;
}): {

@@ -7,0 +7,0 @@ _value: string;

export default Package;
declare const Package: {
new ({ version, type, name, org, author, }?: {
version?: string;
type?: string;
name?: string;
org?: string;
author?: {};
version?: string | undefined;
type?: string | undefined;
name?: string | undefined;
org?: string | undefined;
author?: {} | undefined;
}): {

@@ -16,4 +16,45 @@ _version: string;

_org: string;
_files: any[];
_meta: any[];
/** @type {import("./asset.js").default[]} */
_files: {
_mimeType: string;
_type: string;
_size: number;
_integrity: string;
_pathname: string;
_version: string;
_name: string;
_org: string;
get integrity(): string;
set integrity(value: string);
get pathname(): string;
get mimeType(): string;
get version(): string;
get asset(): string;
get name(): string;
get type(): string;
set type(value: string);
get size(): number;
set size(value: number);
get org(): string;
toJSON(): {
integrity: string;
pathname: string;
mimeType: string;
type: string;
size: number;
};
get [Symbol.toStringTag](): string;
}[];
/** @type {import("./meta.js").default[]} */
_meta: {
_value: string;
_name: string;
get value(): string;
get name(): string;
toJSON(): {
value: string;
name: string;
};
get [Symbol.toStringTag](): string;
}[];
get integrity(): string;

@@ -26,4 +67,49 @@ get version(): string;

get org(): string;
setAsset(asset: any): void;
setMeta(meta: any): void;
/**
* @param {import("./asset.js").default} asset
*/
setAsset(asset: {
_mimeType: string;
_type: string;
_size: number;
_integrity: string;
_pathname: string;
_version: string;
_name: string;
_org: string;
get integrity(): string;
set integrity(value: string);
get pathname(): string;
get mimeType(): string;
get version(): string;
get asset(): string;
get name(): string;
get type(): string;
set type(value: string);
get size(): number;
set size(value: number);
get org(): string;
toJSON(): {
integrity: string;
pathname: string;
mimeType: string;
type: string;
size: number;
};
get [Symbol.toStringTag](): string;
}): void;
/**
* @param {import("./meta.js").default} meta
*/
setMeta(meta: {
_value: string;
_name: string;
get value(): string;
get name(): string;
toJSON(): {
value: string;
name: string;
};
get [Symbol.toStringTag](): string;
}): void;
toJSON(): {

@@ -37,4 +123,43 @@ integrity: string;

org: string;
files: any[];
meta: any[];
files: {
_mimeType: string;
_type: string;
_size: number;
_integrity: string;
_pathname: string;
_version: string;
_name: string;
_org: string;
get integrity(): string;
set integrity(value: string);
get pathname(): string;
get mimeType(): string;
get version(): string;
get asset(): string;
get name(): string;
get type(): string;
set type(value: string);
get size(): number;
set size(value: number);
get org(): string;
toJSON(): {
integrity: string;
pathname: string;
mimeType: string;
type: string;
size: number;
};
get [Symbol.toStringTag](): string;
}[];
meta: {
_value: string;
_name: string;
get value(): string;
get name(): string;
toJSON(): {
value: string;
name: string;
};
get [Symbol.toStringTag](): string;
}[];
};

@@ -41,0 +166,0 @@ get [Symbol.toStringTag](): string;

export default Versions;
declare const Versions: {
new ({ versions, type, name, org }?: {
versions?: any[];
versions?: [any, any][];
type?: string;

@@ -17,5 +17,15 @@ name?: string;

get org(): string;
setVersion(version: any, integrity: any): void;
getVersion(major: any): any;
check(version: any): boolean;
/**
* @param {string} version
* @param {string} integrity
*/
setVersion(version: string, integrity: string): void;
/**
* @param {number} major
*/
getVersion(major: number): any;
/**
* @param {string} version
*/
check(version: string): boolean;
toJSON(): {

@@ -22,0 +32,0 @@ versions: [any, any][];

export default AliasDel;
export type AliasDeleteOptions = {
cacheControl?: string;
cacheControl?: string | undefined;
/**
* List of key-value pairs [hostname, organization]
*/
organizations?: Array<[string, string]>;
sink?: import("@eik/sink").default;
organizations?: [string, string][] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -21,4 +21,4 @@ };

_organizations: [string, string][];
_cacheControl: string;
_sink: import("@eik/sink").default;
_cacheControl: string | undefined;
_sink: import("@eik/sink").default | undefined;
_log: abslog.ValidLogger;

@@ -30,3 +30,10 @@ _metrics: Metrics;

_exist(path?: string): Promise<boolean>;
handler(req: any, user: any, type: any, name: any, alias: any): Promise<any>;
/**
* @param {any} req
* @param {any} user
* @param {string} type
* @param {string} name
* @param {string} alias
*/
handler(req: any, user: any, type: string, name: string, alias: string): Promise<any>;
};

@@ -33,0 +40,0 @@ };

export default AliasGet;
export type AliasGetOptions = {
etag?: boolean;
cacheControl?: string;
etag?: boolean | undefined;
cacheControl?: string | undefined;
/**
* List of key-value pairs [hostname, organization]
*/
organizations?: Array<[string, string]>;
sink?: import("@eik/sink").default;
organizations?: [string, string][] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -24,3 +24,3 @@ };

_cacheControl: string;
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_etag: boolean;

@@ -32,3 +32,10 @@ _log: abslog.ValidLogger;

get metrics(): Metrics;
handler(req: any, type: any, name: any, alias: any, extra: any): Promise<{
/**
* @param {any} req
* @param {string} type
* @param {string} name
* @param {string} alias
* @param {string} extra
*/
handler(req: any, type: string, name: string, alias: string, extra: string): Promise<{
_cacheControl: string;

@@ -38,3 +45,3 @@ _statusCode: number;

_location: string;
_stream: any;
_stream: import("node:stream").Readable | undefined;
_body: any;

@@ -50,4 +57,4 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
get body(): any;

@@ -54,0 +61,0 @@ set body(value: any);

export default AliasGet;
export type AliasGetOptions = {
cacheControl?: string;
cacheControl?: string | undefined;
/**
* List of key-value pairs [hostname, organization]
*/
organizations?: Array<[string, string]>;
sink?: import("@eik/sink").default;
organizations?: [string, string][] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -22,3 +22,3 @@ };

_cacheControl: string;
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_log: abslog.ValidLogger;

@@ -29,3 +29,10 @@ _metrics: Metrics;

get metrics(): Metrics;
handler(req: any, type: any, name: any, alias: any, extra: any): Promise<{
/**
* @param {any} req
* @param {string} type
* @param {string} name
* @param {string} alias
* @param {string} extra
*/
handler(req: any, type: string, name: string, alias: string, extra: string): Promise<{
_cacheControl: string;

@@ -35,3 +42,3 @@ _statusCode: number;

_location: string;
_stream: any;
_stream: import("node:stream").Readable | undefined;
_body: any;

@@ -47,4 +54,4 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
get body(): any;

@@ -51,0 +58,0 @@ set body(value: any);

export default AliasPost;
export type AliasPostOptions = {
cacheControl?: string;
cacheControl?: string | undefined;
/**
* List of key-value pairs [hostname, organization]
*/
organizations?: Array<[string, string]>;
sink?: import("@eik/sink").default;
organizations?: [string, string][] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -21,4 +21,4 @@ };

_organizations: [string, string][];
_cacheControl: string;
_sink: import("@eik/sink").default;
_cacheControl: string | undefined;
_sink: import("@eik/sink").default | undefined;
_log: abslog.ValidLogger;

@@ -29,6 +29,6 @@ _metrics: Metrics;

_multipart: {
_pkgMaxFileSize: number;
_pkgMaxFileSize: number | undefined;
_legalFields: string[];
_legalFiles: string[];
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_log: abslog.ValidLogger;

@@ -63,5 +63,18 @@ parse(incoming: any): Promise<any>;

get metrics(): Metrics;
/**
* @param {any} incoming
*/
_parser(incoming: any): Promise<any>;
/**
* @param {any} incoming
*/
_exist(incoming: any): Promise<boolean>;
handler(req: any, user: any, type: any, name: any, alias: any): Promise<{
/**
* @param {any} req
* @param {any} user
* @param {string} type
* @param {string} name
* @param {string} alias
*/
handler(req: any, user: any, type: string, name: string, alias: string): Promise<{
_cacheControl: string;

@@ -71,3 +84,3 @@ _statusCode: number;

_location: string;
_stream: any;
_stream: import("node:stream").Readable | undefined;
_body: any;

@@ -83,4 +96,4 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
get body(): any;

@@ -87,0 +100,0 @@ set body(value: any);

export default AliasPut;
export type AliasPutOptions = {
cacheControl?: string;
cacheControl?: string | undefined;
/**
* List of key-value pairs [hostname, organization]
*/
organizations?: Array<[string, string]>;
sink?: import("@eik/sink").default;
organizations?: [string, string][] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -21,4 +21,4 @@ };

_organizations: [string, string][];
_cacheControl: string;
_sink: import("@eik/sink").default;
_cacheControl: string | undefined;
_sink: import("@eik/sink").default | undefined;
_log: abslog.ValidLogger;

@@ -29,6 +29,6 @@ _metrics: Metrics;

_multipart: {
_pkgMaxFileSize: number;
_pkgMaxFileSize: number | undefined;
_legalFields: string[];
_legalFiles: string[];
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_log: abslog.ValidLogger;

@@ -63,5 +63,18 @@ parse(incoming: any): Promise<any>;

get metrics(): Metrics;
/**
* @param {any} incoming
*/
_parser(incoming: any): Promise<any>;
/**
* @param {any} incoming
*/
_exist(incoming: any): Promise<boolean>;
handler(req: any, user: any, type: any, name: any, alias: any): Promise<{
/**
* @param {any} req
* @param {any} user
* @param {string} type
* @param {string} name
* @param {string} alias
*/
handler(req: any, user: any, type: string, name: string, alias: string): Promise<{
_cacheControl: string;

@@ -71,3 +84,3 @@ _statusCode: number;

_location: string;
_stream: any;
_stream: import("node:stream").Readable | undefined;
_body: any;

@@ -83,4 +96,4 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
get body(): any;

@@ -87,0 +100,0 @@ set body(value: any);

export default AuthPost;
export type AuthPostOptions = {
authKey?: string;
cacheControl?: string;
authKey?: string | undefined;
cacheControl?: string | undefined;
/**
* List of key-value pairs [hostname, organization]
*/
organizations?: Array<[string, string]>;
organizations?: [string, string][] | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -21,3 +21,3 @@ };

_organizations: [string, string][];
_cacheControl: string;
_cacheControl: string | undefined;
_authKey: string;

@@ -29,6 +29,6 @@ _log: abslog.ValidLogger;

_multipart: {
_pkgMaxFileSize: number;
_pkgMaxFileSize: number | undefined;
_legalFields: string[];
_legalFiles: string[];
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_log: abslog.ValidLogger;

@@ -63,3 +63,9 @@ parse(incoming: any): Promise<any>;

get metrics(): Metrics;
/**
* @param {any} incoming
*/
_parser(incoming: any): Promise<any>;
/**
* @param {any} req
*/
handler(req: any): Promise<{

@@ -70,3 +76,3 @@ _cacheControl: string;

_location: string;
_stream: any;
_stream: import("node:stream").Readable | undefined;
_body: any;

@@ -82,4 +88,4 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
get body(): any;

@@ -86,0 +92,0 @@ set body(value: any);

export default MapGet;
export type MapGetOptions = {
etag?: boolean;
cacheControl?: string;
etag?: boolean | undefined;
cacheControl?: string | undefined;
/**
* List of key-value pairs [hostname, organization]
*/
organizations?: Array<[string, string]>;
sink?: import("@eik/sink").default;
organizations?: [string, string][] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -24,3 +24,3 @@ };

_cacheControl: string;
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_etag: boolean;

@@ -32,3 +32,8 @@ _log: abslog.ValidLogger;

get metrics(): Metrics;
handler(req: any, name: any, version: any): Promise<{
/**
* @param {any} req
* @param {string} name
* @param {string} version
*/
handler(req: any, name: string, version: string): Promise<{
_cacheControl: string;

@@ -38,3 +43,3 @@ _statusCode: number;

_location: string;
_stream: any;
_stream: import("node:stream").Readable | undefined;
_body: any;

@@ -50,4 +55,4 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
get body(): any;

@@ -54,0 +59,0 @@ set body(value: any);

export default MapPut;
export type MapPutOptions = {
mapMaxFileSize?: number;
cacheControl?: string;
mapMaxFileSize?: number | undefined;
cacheControl?: string | undefined;
/**
* List of key-value pairs [hostname, organization]
*/
organizations?: Array<[string, string]>;
sink?: import("@eik/sink").default;
organizations?: [string, string][] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -24,4 +24,4 @@ };

_organizations: [string, string][];
_cacheControl: string;
_sink: import("@eik/sink").default;
_cacheControl: string | undefined;
_sink: import("@eik/sink").default | undefined;
_log: abslog.ValidLogger;

@@ -32,3 +32,9 @@ _metrics: Metrics;

get metrics(): Metrics;
/**
* @param {any} incoming
*/
_parser(incoming: any): Promise<any>;
/**
* @param {{ fieldname: any, file: any, path: any }} options
*/
_handleFile({ fieldname, file, path }: {

@@ -39,2 +45,5 @@ fieldname: any;

}): Promise<string>;
/**
* @param {any} incoming
*/
_readVersions(incoming: any): Promise<{

@@ -49,5 +58,5 @@ _versions: Map<any, any>;

get org(): string;
setVersion(version: any, integrity: any): void;
getVersion(major: any): any;
check(version: any): boolean;
setVersion(version: string, integrity: string): void;
getVersion(major: number): any;
check(version: string): boolean;
toJSON(): {

@@ -61,4 +70,14 @@ versions: [any, any][];

}>;
/**
* @param {any} incoming
* @param {any} versions
*/
_writeVersions(incoming: any, versions: any): Promise<void>;
handler(req: any, user: any, name: any, version: any): Promise<{
/**
* @param {any} req
* @param {any} user
* @param {string} name
* @param {string} version
*/
handler(req: any, user: any, name: string, version: string): Promise<{
_cacheControl: string;

@@ -68,3 +87,3 @@ _statusCode: number;

_location: string;
_stream: any;
_stream: import("node:stream").Readable | undefined;
_body: any;

@@ -80,4 +99,4 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
get body(): any;

@@ -84,0 +103,0 @@ set body(value: any);

export default PkgGet;
export type PkgGetOptions = {
etag?: boolean;
cacheControl?: string;
etag?: boolean | undefined;
cacheControl?: string | undefined;
/**
* List of key-value pairs [hostname, organization]
*/
organizations?: Array<[string, string]>;
sink?: import("@eik/sink").default;
organizations?: [string, string][] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -24,3 +24,3 @@ };

_cacheControl: string;
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_etag: boolean;

@@ -32,3 +32,10 @@ _log: abslog.ValidLogger;

get metrics(): Metrics;
handler(req: any, type: any, name: any, version: any, extra: any): Promise<{
/**
* @param {any} req
* @param {string} type
* @param {string} name
* @param {string} version
* @param {string} extra
*/
handler(req: any, type: string, name: string, version: string, extra: string): Promise<{
_cacheControl: string;

@@ -38,3 +45,3 @@ _statusCode: number;

_location: string;
_stream: any;
_stream: import("node:stream").Readable | undefined;
_body: any;

@@ -50,4 +57,4 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
get body(): any;

@@ -54,0 +61,0 @@ set body(value: any);

export default PkgLog;
export type PkgLogOptions = {
etag?: boolean;
cacheControl?: string;
etag?: boolean | undefined;
cacheControl?: string | undefined;
/**
* List of key-value pairs [hostname, organization]
*/
organizations?: Array<[string, string]>;
sink?: import("@eik/sink").default;
organizations?: [string, string][] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -24,3 +24,3 @@ };

_cacheControl: string;
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_etag: boolean;

@@ -32,3 +32,9 @@ _log: abslog.ValidLogger;

get metrics(): Metrics;
handler(req: any, type: any, name: any, version: any): Promise<{
/**
* @param {any} req
* @param {string} type
* @param {string} name
* @param {string} version
*/
handler(req: any, type: string, name: string, version: string): Promise<{
_cacheControl: string;

@@ -38,3 +44,3 @@ _statusCode: number;

_location: string;
_stream: any;
_stream: import("node:stream").Readable | undefined;
_body: any;

@@ -50,4 +56,4 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
get body(): any;

@@ -54,0 +60,0 @@ set body(value: any);

export default PkgPut;
export type PkgPutOptions = {
pkgMaxFileSize?: number;
cacheControl?: string;
pkgMaxFileSize?: number | undefined;
cacheControl?: string | undefined;
/**
* List of key-value pairs [hostname, organization]
*/
organizations?: Array<[string, string]>;
sink?: import("@eik/sink").default;
organizations?: [string, string][] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -24,4 +24,4 @@ };

_organizations: [string, string][];
_cacheControl: string;
_sink: import("@eik/sink").default;
_cacheControl: string | undefined;
_sink: import("@eik/sink").default | undefined;
_log: abslog.ValidLogger;

@@ -32,6 +32,6 @@ _metrics: Metrics;

_multipart: {
_pkgMaxFileSize: number;
_pkgMaxFileSize: number | undefined;
_legalFields: string[];
_legalFiles: string[];
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_log: abslog.ValidLogger;

@@ -66,3 +66,9 @@ parse(incoming: any): Promise<any>;

get metrics(): Metrics;
/**
* @param {any} incoming
*/
_parser(incoming: any): Promise<any>;
/**
* @param {any} incoming
*/
_readVersions(incoming: any): Promise<{

@@ -77,5 +83,5 @@ _versions: Map<any, any>;

get org(): string;
setVersion(version: any, integrity: any): void;
getVersion(major: any): any;
check(version: any): boolean;
setVersion(version: string, integrity: string): void;
getVersion(major: number): any;
check(version: string): boolean;
toJSON(): {

@@ -89,5 +95,19 @@ versions: [any, any][];

}>;
/**
* @param {any} incoming
*/
_readVersion(incoming: any): Promise<boolean>;
/**
* @param {any} incoming
* @param {any} versions
*/
_writeVersions(incoming: any, versions: any): Promise<void>;
handler(req: any, user: any, type: any, name: any, version: any): Promise<{
/**
* @param {any} req
* @param {any} user
* @param {string} type
* @param {string} name
* @param {string} version
*/
handler(req: any, user: any, type: string, name: string, version: string): Promise<{
_cacheControl: string;

@@ -97,3 +117,3 @@ _statusCode: number;

_location: string;
_stream: any;
_stream: import("node:stream").Readable | undefined;
_body: any;

@@ -109,4 +129,4 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
get body(): any;

@@ -113,0 +133,0 @@ set body(value: any);

export default VersionsGet;
export type VersionsGetOptions = {
cacheControl?: string;
etag?: boolean;
organizations?: Array<[string, string]>;
sink?: import("@eik/sink").default;
cacheControl?: string | undefined;
etag?: boolean | undefined;
organizations?: [string, string][] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -21,3 +21,3 @@ };

_cacheControl: string;
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_etag: boolean;

@@ -29,3 +29,8 @@ _log: abslog.ValidLogger;

get metrics(): Metrics;
handler(req: any, type: any, name: any): Promise<{
/**
* @param {any} req
* @param {string} type
* @param {string} name
*/
handler(req: any, type: string, name: string): Promise<{
_cacheControl: string;

@@ -35,3 +40,3 @@ _statusCode: number;

_location: string;
_stream: any;
_stream: import("node:stream").Readable | undefined;
_body: any;

@@ -47,4 +52,4 @@ _etag: string;

set mimeType(value: string);
get stream(): any;
set stream(value: any);
get stream(): import("node:stream").Readable | undefined;
set stream(value: import("node:stream").Readable | undefined);
get body(): any;

@@ -51,0 +56,0 @@ set body(value: any);

@@ -48,1 +48,3 @@ declare namespace _default {

import TEST from "./sinks/test.js";
import MEM from "@eik/sink-memory";
import FS from "@eik/sink-file-system";
export default FormField;
declare const FormField: {
new ({ value, name }?: {
value?: string;
name?: string;
value?: string | undefined;
name?: string | undefined;
}): {

@@ -7,0 +7,0 @@ _value: string;

export default MultipartParser;
export type MultipartParserOptions = {
pkgMaxFileSize?: number;
legalFields?: string[];
legalFiles?: string[];
sink?: import("@eik/sink").default;
pkgMaxFileSize?: number | undefined;
legalFields?: string[] | undefined;
legalFiles?: string[] | undefined;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -19,8 +19,14 @@ };

new ({ pkgMaxFileSize, legalFields, legalFiles, logger, sink }?: MultipartParserOptions): {
_pkgMaxFileSize: number;
_pkgMaxFileSize: number | undefined;
_legalFields: string[];
_legalFiles: string[];
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_log: abslog.ValidLogger;
/**
* @param {any} incoming
*/
parse(incoming: any): Promise<any>;
/**
* @param {{ name: any, value: any }} options
*/
_handleField({ name, value }: {

@@ -40,2 +46,5 @@ name: any;

};
/**
* @param {{ fieldname: any, file: any, filename: any, incoming: any }} options
*/
_handleFile({ fieldname, file, filename, incoming }: {

@@ -47,2 +56,5 @@ fieldname: any;

}): Promise<any>;
/**
* @param {{ incoming: any, entry: any }} options
*/
_persistFile({ incoming, entry }: {

@@ -49,0 +61,0 @@ incoming: any;

@@ -6,3 +6,3 @@ /**

constructor({ rootPath }?: {
rootPath?: string;
rootPath?: string | undefined;
});

@@ -14,22 +14,35 @@ readDelay: number;

_counter: Metrics.MetricsCounter;
_writeDelayResolve: (a: any) => number;
_writeDelayChunks: (a: any) => number;
set(filePath: any, payload: any): void;
get(filePath: any): any;
/** @type {(count?: number) => number} */
_writeDelayResolve: (count?: number) => number;
/** @type {(count?: number) => number} */
_writeDelayChunks: (count?: number) => number;
/**
* @param {string} filePath
* @param {any} payload
*/
set(filePath: string, payload: any): void;
/**
* @param {string} filePath
*/
get(filePath: string): any;
dump(): [any, any][];
/**
* @param {any} items
*/
load(items: any): void;
/**
* @param {(count: number) => number} fn
* @param {(count?: number) => number} fn
*/
set writeDelayResolve(fn: (count: number) => number);
set writeDelayResolve(fn: (count?: number) => number);
/**
* @param {(count: number) => number} fn
* @param {(count?: number) => number} fn
*/
set writeDelayChunks(fn: (count: number) => number);
write(filePath: any, contentType: any): Promise<any>;
read(filePath: any): Promise<any>;
delete(filePath: any): Promise<any>;
exist(filePath: any): Promise<any>;
set writeDelayChunks(fn: (count?: number) => number);
/**
* @param {string} filePath
* @param {string} contentType
*/
write(filePath: string, contentType: string): Promise<any>;
}
import Sink from "@eik/sink";
import Metrics from "@metrics/client";
export default HealthCheck;
export type HealthCheckOptions = {
sink?: import("@eik/sink").default;
sink?: import("@eik/sink").default | undefined;
logger?: import("abslog").AbstractLoggerOptions;

@@ -13,7 +13,9 @@ };

new ({ sink, logger }?: HealthCheckOptions): {
_sink: import("@eik/sink").default;
_sink: import("@eik/sink").default | undefined;
_name: string;
_log: abslog.ValidLogger;
_write(): Promise<any>;
_read(): Promise<any>;
/** @returns {Promise<void>} */
_write(): Promise<void>;
/** @returns {Promise<void>} */
_read(): Promise<void>;
_delete(): Promise<void>;

@@ -20,0 +22,0 @@ _exist(): Promise<void>;

export function createFilePathToPackage({ org, type, name, version, }?: {
org?: string;
type?: string;
name?: string;
version?: string;
org?: string | undefined;
type?: string | undefined;
name?: string | undefined;
version?: string | undefined;
}): string;
export function createFilePathToAsset({ org, type, name, version, asset, }?: {
org?: string;
type?: string;
name?: string;
version?: string;
asset?: string;
org?: string | undefined;
type?: string | undefined;
name?: string | undefined;
version?: string | undefined;
asset?: string | undefined;
}): string;
export function createFilePathToImportMap({ org, name, version, }?: {
org?: string;
name?: string;
version?: string;
org?: string | undefined;
name?: string | undefined;
version?: string | undefined;
}): string;
export function createFilePathToAlias({ org, type, name, alias, }?: {
org?: string;
type?: string;
name?: string;
alias?: string;
org?: string | undefined;
type?: string | undefined;
name?: string | undefined;
alias?: string | undefined;
}): string;
export function createFilePathToVersion({ org, type, name }?: {
org?: string;
type?: string;
name?: string;
org?: string | undefined;
type?: string | undefined;
name?: string | undefined;
}): string;
export function createFilePathToAliasOrigin({ org, type, name, version, }?: {
org?: string;
type?: string;
name?: string;
version?: string;
org?: string | undefined;
type?: string | undefined;
name?: string | undefined;
version?: string | undefined;
}): string;
export function createFilePathToEikJson({ org, type, name, version, }?: {
org?: string;
type?: string;
name?: string;
version?: string;
org?: string | undefined;
type?: string | undefined;
name?: string | undefined;
version?: string | undefined;
}): string;
export function createURIPathToPkgLog({ type, name, version }?: {
type?: string;
name?: string;
version?: string;
type?: string | undefined;
name?: string | undefined;
version?: string | undefined;
}): string;
export function createURIPathToAsset({ type, name, version, asset, }?: {
type?: string;
name?: string;
version?: string;
asset?: string;
type?: string | undefined;
name?: string | undefined;
version?: string | undefined;
asset?: string | undefined;
}): string;
export function createURIPathToImportMap({ name, version }?: {
name?: string;
version?: string;
name?: string | undefined;
version?: string | undefined;
}): string;
export function createURIToAlias({ type, name, alias }?: {
type?: string;
name?: string;
alias?: string;
type?: string | undefined;
name?: string | undefined;
alias?: string | undefined;
}): string;
export function createURIToTargetOfAlias({ type, name, version, extra, }?: {
type?: string;
name?: string;
version?: string;
extra?: string;
type?: string | undefined;
name?: string | undefined;
version?: string | undefined;
extra?: string | undefined;
}): string;

@@ -1,6 +0,29 @@

export function readJSON(sink: any, path: any): Promise<any>;
export function writeJSON(sink: any, path: any, obj: any, contentType: any): Promise<any>;
/**
* @param {any} sink
* @param {string} path
*/
export function readJSON(sink: any, path: string): Promise<any>;
/**
* @param {any} sink
* @param {string} path
* @param {any} obj
* @param {string} contentType
*/
export function writeJSON(sink: any, path: string, obj: any, contentType: string): Promise<any>;
/**
* @param {any} from
*/
export function streamCollector(from: any): Promise<any>;
/**
* @param {any} stat
*/
export function etagFromFsStat(stat: any): string;
/**
* @param {any} value
*/
export function decodeUriComponent(value: any): any;
export function readEikJson(sink: any, path: any): any;
/**
* @param {any} sink
* @param {string} path
*/
export function readEikJson(sink: any, path: string): any;