@eik/service 5.1.51 → 5.1.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [5.1.52](https://github.com/eik-lib/service/compare/v5.1.51...v5.1.52) (2026-05-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Bump dependencies ([#758](https://github.com/eik-lib/service/issues/758)) ([8033f28](https://github.com/eik-lib/service/commit/8033f28362da2c2a59634d9ac4e47c22b6483584))
7
+
1
8
  ## [5.1.51](https://github.com/eik-lib/service/compare/v5.1.50...v5.1.51) (2026-05-25)
2
9
 
3
10
 
package/lib/config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-unused-vars */
2
2
  import convict from "convict";
3
- import yaml from "js-yaml";
3
+ import yaml from "yaml";
4
4
  import pino from "pino";
5
5
  import path from "path";
6
6
  import fs from "fs";
@@ -8,29 +8,31 @@ import os from "os";
8
8
 
9
9
  const CWD = process.cwd();
10
10
 
11
- let pack = {};
11
+ let pack = /** @type {{ name?: string }} */ ({});
12
12
  try {
13
13
  pack = JSON.parse(fs.readFileSync(path.join(CWD, "package.json"), "utf-8"));
14
14
  } catch (error) {
15
15
  /* empty */
16
16
  }
17
17
 
18
- convict.addParser({ extension: ["yml", "yaml"], parse: yaml.load });
18
+ convict.addParser({ extension: ["yml", "yaml"], parse: yaml.parse });
19
19
 
20
20
  convict.addFormat({
21
21
  name: "secret-string",
22
- validate: (value) => {
22
+ validate: (/** @type {any} */ value) => {
23
23
  if (typeof value !== "string") {
24
24
  throw new Error("Value must be a String");
25
25
  }
26
26
  },
27
- coerce: (value) => {
27
+ coerce: (/** @type {any} */ value) => {
28
28
  if (path.isAbsolute(value)) {
29
29
  try {
30
30
  const file = fs.readFileSync(value);
31
31
  return file.toString();
32
32
  } catch (error) {
33
- throw new Error(`Config could not load secret from path: ${value}`);
33
+ throw new Error(`Config could not load secret from path: ${value}`, {
34
+ cause: error,
35
+ });
34
36
  }
35
37
  }
36
38
  return value;
package/lib/main.js CHANGED
@@ -71,10 +71,15 @@ const EikService = class EikService {
71
71
  });
72
72
  }
73
73
 
74
+ if (!sink) throw new Error("No sink configured");
75
+
74
76
  // Transform organization config
75
77
  const organizations = config
76
78
  .get("organization.hostnames")
77
- .map((hostname) => [hostname, config.get("organization.name")]);
79
+ .map((/** @type {string} */ hostname) => [
80
+ hostname,
81
+ config.get("organization.name"),
82
+ ]);
78
83
 
79
84
  this._versionsGet = new eik.http.VersionsGet({
80
85
  organizations,
@@ -127,7 +132,7 @@ const EikService = class EikService {
127
132
  mapMaxFileSize,
128
133
  });
129
134
 
130
- const mergeStreams = (...streams) => {
135
+ const mergeStreams = (/** @type {any[]} */ ...streams) => {
131
136
  const str = new PassThrough({ objectMode: true });
132
137
 
133
138
  // Avoid hitting the max listeners limit when multiple
@@ -141,7 +146,7 @@ const EikService = class EikService {
141
146
  });
142
147
 
143
148
  for (const stm of streams) {
144
- stm.on("error", (err) => {
149
+ stm.on("error", (/** @type {any} */ err) => {
145
150
  logger.error(err);
146
151
  });
147
152
  stm.pipe(str);
@@ -230,13 +235,16 @@ const EikService = class EikService {
230
235
  },
231
236
  });
232
237
 
233
- app.decorate("authenticate", async (request, reply) => {
234
- try {
235
- await request.jwtVerify();
236
- } catch (error) {
237
- reply.send(error);
238
- }
239
- });
238
+ app.decorate(
239
+ "authenticate",
240
+ async (/** @type {any} */ request, /** @type {any} */ reply) => {
241
+ try {
242
+ await request.jwtVerify();
243
+ } catch (error) {
244
+ reply.send(error);
245
+ }
246
+ },
247
+ );
240
248
 
241
249
  const authOptions = {
242
250
  // @ts-expect-error We decorate it above
@@ -246,7 +254,11 @@ const EikService = class EikService {
246
254
  // Handle multipart upload
247
255
  const _multipart = Symbol("multipart");
248
256
 
249
- function setMultipart(req, payload, cb) {
257
+ function setMultipart(
258
+ /** @type {any} */ req,
259
+ /** @type {any} */ payload,
260
+ /** @type {any} */ cb,
261
+ ) {
250
262
  req.raw[_multipart] = true;
251
263
  cb();
252
264
  }
@@ -264,38 +276,46 @@ const EikService = class EikService {
264
276
  });
265
277
 
266
278
  // 404 handling
267
- app.setNotFoundHandler((request, reply) => {
268
- reply.header("cache-control", this._notFoundCacheControl);
269
- reply.type("text/plain");
270
- reply.code(404);
271
- reply.send("Not found");
272
- });
279
+ app.setNotFoundHandler(
280
+ (/** @type {any} */ request, /** @type {any} */ reply) => {
281
+ reply.header("cache-control", this._notFoundCacheControl);
282
+ reply.type("text/plain");
283
+ reply.code(404);
284
+ reply.send("Not found");
285
+ },
286
+ );
273
287
 
274
288
  // Error handling
275
- app.setErrorHandler((error, request, reply) => {
276
- this.logger.debug(
277
- "Error occured during request. Error is available on trace log level.",
278
- );
279
- this.logger.trace(error);
280
- reply.header("cache-control", "no-store");
281
- // @ts-expect-error
282
- if (error.statusCode) {
283
- // @ts-expect-error
284
- if (error.statusCode === 404) {
285
- reply.header("cache-control", this._notFoundCacheControl);
289
+ app.setErrorHandler(
290
+ (
291
+ /** @type {any} */ error,
292
+ /** @type {any} */ request,
293
+ /** @type {any} */ reply,
294
+ ) => {
295
+ this.logger.debug(
296
+ "Error occured during request. Error is available on trace log level.",
297
+ );
298
+ this.logger.trace(error);
299
+ reply.header("cache-control", "no-store");
300
+ if (error.statusCode) {
301
+ if (error.statusCode === 404) {
302
+ reply.header("cache-control", this._notFoundCacheControl);
303
+ }
304
+ reply.send(error);
305
+ return;
286
306
  }
287
- reply.send(error);
288
- return;
289
- }
290
- // @ts-expect-error
291
- reply.send(createError(error.statusCode || 500));
292
- });
307
+ reply.send(createError(error.statusCode || 500));
308
+ },
309
+ );
293
310
 
294
311
  //
295
312
  // Routes
296
313
  //
297
314
 
298
- const authPostRoutes = async (request, reply) => {
315
+ const authPostRoutes = async (
316
+ /** @type {any} */ request,
317
+ /** @type {any} */ reply,
318
+ ) => {
299
319
  const outgoing = await this._authPost.handler(request.raw);
300
320
 
301
321
  // Workaround due to .jwt.sign() being able to only
@@ -312,7 +332,10 @@ const EikService = class EikService {
312
332
  reply.send({ token });
313
333
  };
314
334
 
315
- const pkgGetRoute = async (request, reply) => {
335
+ const pkgGetRoute = async (
336
+ /** @type {any} */ request,
337
+ /** @type {any} */ reply,
338
+ ) => {
316
339
  const params = utils.sanitizeParameters(request.raw.url);
317
340
  const outgoing = await this._pkgGet.handler(
318
341
  request.raw,
@@ -328,7 +351,10 @@ const EikService = class EikService {
328
351
  return reply.send(outgoing.stream);
329
352
  };
330
353
 
331
- const pkgLogRoute = async (request, reply) => {
354
+ const pkgLogRoute = async (
355
+ /** @type {any} */ request,
356
+ /** @type {any} */ reply,
357
+ ) => {
332
358
  const params = utils.sanitizeParameters(request.raw.url);
333
359
  const outgoing = await this._pkgLog.handler(
334
360
  request.raw,
@@ -343,7 +369,10 @@ const EikService = class EikService {
343
369
  return reply.send(outgoing.stream);
344
370
  };
345
371
 
346
- const versionsGetRoute = async (request, reply) => {
372
+ const versionsGetRoute = async (
373
+ /** @type {any} */ request,
374
+ /** @type {any} */ reply,
375
+ ) => {
347
376
  const params = utils.sanitizeParameters(request.raw.url);
348
377
  const outgoing = await this._versionsGet.handler(
349
378
  request.raw,
@@ -357,7 +386,10 @@ const EikService = class EikService {
357
386
  return reply.send(outgoing.stream);
358
387
  };
359
388
 
360
- const pkgPutRoute = async (request, reply) => {
389
+ const pkgPutRoute = async (
390
+ /** @type {any} */ request,
391
+ /** @type {any} */ reply,
392
+ ) => {
361
393
  const params = utils.sanitizeParameters(request.raw.url);
362
394
  const outgoing = await this._pkgPut.handler(
363
395
  request.raw,
@@ -372,7 +404,10 @@ const EikService = class EikService {
372
404
  reply.redirect(outgoing.location);
373
405
  };
374
406
 
375
- const imgPutRoute = async (request, reply) => {
407
+ const imgPutRoute = async (
408
+ /** @type {any} */ request,
409
+ /** @type {any} */ reply,
410
+ ) => {
376
411
  const params = utils.sanitizeParameters(request.raw.url);
377
412
  const outgoing = await this._imgPut.handler(
378
413
  request.raw,
@@ -387,7 +422,10 @@ const EikService = class EikService {
387
422
  reply.redirect(outgoing.location);
388
423
  };
389
424
 
390
- const mapGetRoute = async (request, reply) => {
425
+ const mapGetRoute = async (
426
+ /** @type {any} */ request,
427
+ /** @type {any} */ reply,
428
+ ) => {
391
429
  const params = utils.sanitizeParameters(request.raw.url);
392
430
  const outgoing = await this._mapGet.handler(
393
431
  request.raw,
@@ -401,7 +439,10 @@ const EikService = class EikService {
401
439
  return reply.send(outgoing.stream);
402
440
  };
403
441
 
404
- const mapPutRoute = async (request, reply) => {
442
+ const mapPutRoute = async (
443
+ /** @type {any} */ request,
444
+ /** @type {any} */ reply,
445
+ ) => {
405
446
  const params = utils.sanitizeParameters(request.raw.url);
406
447
  const outgoing = await this._mapPut.handler(
407
448
  request.raw,
@@ -415,7 +456,10 @@ const EikService = class EikService {
415
456
  reply.redirect(outgoing.location);
416
457
  };
417
458
 
418
- const aliasGetRoute = async (request, reply) => {
459
+ const aliasGetRoute = async (
460
+ /** @type {any} */ request,
461
+ /** @type {any} */ reply,
462
+ ) => {
419
463
  const params = utils.sanitizeParameters(request.raw.url);
420
464
  const outgoing = await this._aliasGet.handler(
421
465
  request.raw,
@@ -431,7 +475,10 @@ const EikService = class EikService {
431
475
  };
432
476
 
433
477
  // Relies on stale-while-revalidate to serve the aliased asset without a redirect
434
- const aliasGetSWRRoute = async (request, reply) => {
478
+ const aliasGetSWRRoute = async (
479
+ /** @type {any} */ request,
480
+ /** @type {any} */ reply,
481
+ ) => {
435
482
  const params = utils.sanitizeParameters(request.raw.url);
436
483
  const outgoing = await this._aliasGetSWR.handler(
437
484
  request.raw,
@@ -447,7 +494,10 @@ const EikService = class EikService {
447
494
  return reply.send(outgoing.stream);
448
495
  };
449
496
 
450
- const aliasPutRoute = async (request, reply) => {
497
+ const aliasPutRoute = async (
498
+ /** @type {any} */ request,
499
+ /** @type {any} */ reply,
500
+ ) => {
451
501
  const params = utils.sanitizeParameters(request.raw.url);
452
502
  const outgoing = await this._aliasPut.handler(
453
503
  request.raw,
@@ -462,7 +512,10 @@ const EikService = class EikService {
462
512
  reply.redirect(outgoing.location);
463
513
  };
464
514
 
465
- const aliasPostRoute = async (request, reply) => {
515
+ const aliasPostRoute = async (
516
+ /** @type {any} */ request,
517
+ /** @type {any} */ reply,
518
+ ) => {
466
519
  const params = utils.sanitizeParameters(request.raw.url);
467
520
  const outgoing = await this._aliasPost.handler(
468
521
  request.raw,
@@ -477,7 +530,10 @@ const EikService = class EikService {
477
530
  reply.redirect(outgoing.location);
478
531
  };
479
532
 
480
- const aliasDelRoute = async (request, reply) => {
533
+ const aliasDelRoute = async (
534
+ /** @type {any} */ request,
535
+ /** @type {any} */ reply,
536
+ ) => {
481
537
  const params = utils.sanitizeParameters(request.raw.url);
482
538
  const outgoing = await this._aliasDel.handler(
483
539
  request.raw,
package/lib/utils.js CHANGED
@@ -1,17 +1,23 @@
1
1
  import path from "path";
2
2
 
3
- function doJoin(a, b) {
3
+ function doJoin(/** @type {string} */ a, /** @type {string} */ b) {
4
4
  return path.join(a, b).replace(/\\/g, "/");
5
5
  }
6
6
 
7
- const sanitizeExtras = (extras, version) => {
7
+ const sanitizeExtras = (
8
+ /** @type {string} */ extras,
9
+ /** @type {string} */ version = "",
10
+ ) => {
8
11
  if (version && extras) {
9
12
  return doJoin(version, extras);
10
13
  }
11
14
  return extras || "";
12
15
  };
13
16
 
14
- const sanitizeName = (scope, name) => {
17
+ const sanitizeName = (
18
+ /** @type {string} */ scope,
19
+ /** @type {string} */ name = "",
20
+ ) => {
15
21
  if (scope && name) {
16
22
  return doJoin(scope, name);
17
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eik/service",
3
- "version": "5.1.51",
3
+ "version": "5.1.52",
4
4
  "description": "Eik REST API as a standalone HTTP service",
5
5
  "type": "module",
6
6
  "main": "./lib/main.js",
@@ -14,7 +14,7 @@
14
14
  "node": ">=20.5.0"
15
15
  },
16
16
  "scripts": {
17
- "clean": "rimraf .tap node_modules types",
17
+ "clean": "node -e \"['.tap', 'node_modules', 'types'].forEach(d => require('fs').rmSync(d, {recursive: true, force: true}))\"",
18
18
  "lint": "eslint .",
19
19
  "lint:fix": "eslint --fix .",
20
20
  "start": "node ./bin/eik-server.js | pino-pretty",
@@ -44,36 +44,32 @@
44
44
  },
45
45
  "homepage": "https://github.com/eik-lib/service#readme",
46
46
  "dependencies": {
47
- "@eik/core": "2.1.46",
48
- "@eik/sink": "1.2.5",
49
- "@eik/sink-file-system": "2.0.32",
50
- "@eik/sink-memory": "2.0.28",
47
+ "@eik/core": "2.1.47",
48
+ "@eik/sink": "1.2.6",
49
+ "@eik/sink-file-system": "2.0.33",
50
+ "@eik/sink-memory": "2.0.30",
51
51
  "@fastify/compress": "8.3.1",
52
- "@fastify/cors": "10.1.0",
53
- "@fastify/jwt": "10.0.0",
52
+ "@fastify/cors": "11.2.0",
53
+ "@fastify/jwt": "10.1.0",
54
54
  "convict": "6.2.5",
55
55
  "fastify": "5.8.5",
56
56
  "http-errors": "2.0.1",
57
- "js-yaml": "4.1.1",
57
+ "yaml": "2.9.0",
58
58
  "pino": "10.3.1"
59
59
  },
60
60
  "devDependencies": {
61
- "@eik/eslint-config": "1.0.25",
62
- "@eik/prettier-config": "1.0.1",
63
- "@eik/semantic-release-config": "1.0.15",
64
- "@eik/typescript-config": "1.0.1",
61
+ "@eik/eslint-config": "2.0.6",
62
+ "@eik/prettier-config": "1.0.2",
63
+ "@eik/semantic-release-config": "1.0.17",
64
+ "@eik/typescript-config": "1.0.2",
65
65
  "@types/readable-stream": "4.0.23",
66
66
  "cross-env": "10.1.0",
67
- "eslint": "9.39.4",
68
- "form-data": "4.0.5",
69
- "node-fetch": "3.3.2",
70
- "npm-run-all2": "8.0.4",
67
+ "eslint": "10.4.0",
68
+ "npm-run-all2": "9.0.1",
71
69
  "pino-pretty": "13.1.3",
72
- "prettier": "3.7.4",
73
- "rimraf": "6.1.3",
74
- "semantic-release": "25.0.2",
75
- "tap": "21.5.0",
76
- "typescript": "5.9.3",
77
- "unique-slug": "6.0.0"
70
+ "prettier": "3.8.3",
71
+ "semantic-release": "25.0.3",
72
+ "tap": "21.7.4",
73
+ "typescript": "6.0.3"
78
74
  }
79
75
  }
package/types/main.d.ts CHANGED
@@ -1,29 +1,29 @@
1
1
  export default EikService;
2
2
  export type EikServiceOptions = {
3
- sink?: import("@eik/sink").default;
4
- logger?: import("pino").Logger;
3
+ sink?: import("@eik/sink").default | undefined;
4
+ logger?: pino.Logger<never, boolean> | undefined;
5
5
  /**
6
6
  * [Deprecated] Use sink instead
7
7
  */
8
- customSink?: import("@eik/sink").default;
9
- aliasCacheControl?: string;
8
+ customSink?: import("@eik/sink").default | undefined;
9
+ aliasCacheControl?: string | undefined;
10
10
  /**
11
11
  * Set the cache-control header used by the stale-while-revalidate alias GET URLs
12
12
  */
13
- staleWhileRevalidateCacheControl?: string;
14
- notFoundCacheControl?: string;
13
+ staleWhileRevalidateCacheControl?: string | undefined;
14
+ notFoundCacheControl?: string | undefined;
15
15
  /**
16
16
  * The limit in bytes before PUT /pkg/ starts returning 413 Content Too Large
17
17
  */
18
- pkgMaxFileSize?: number;
18
+ pkgMaxFileSize?: number | undefined;
19
19
  /**
20
20
  * The limit in bytes before PUT /map/ starts returning 413 Content Too Large
21
21
  */
22
- mapMaxFileSize?: number;
22
+ mapMaxFileSize?: number | undefined;
23
23
  /**
24
24
  * The limit in bytes before PUT /img/ starts returning 413 Content Too Large
25
25
  */
26
- imgMaxFileSize?: number;
26
+ imgMaxFileSize?: number | undefined;
27
27
  };
28
28
  /**
29
29
  * @typedef {object} EikServiceOptions
@@ -43,19 +43,19 @@ declare const EikService: {
43
43
  _versionsGet: {
44
44
  _organizations: [string, string][];
45
45
  _cacheControl: string;
46
- _sink: import("@eik/sink").default;
46
+ _sink: import("@eik/sink").default | undefined;
47
47
  _etag: boolean;
48
48
  _log: import("abslog").ValidLogger;
49
49
  _metrics: import("@metrics/client");
50
50
  _histogram: import("@metrics/client").MetricsHistogram;
51
51
  _orgRegistry: Map<string, string>;
52
52
  readonly metrics: import("@metrics/client");
53
- handler(req: any, type: any, name: any): Promise<{
53
+ handler(req: any, type: string, name: string): Promise<{
54
54
  _cacheControl: string;
55
55
  _statusCode: number;
56
56
  _mimeType: string;
57
57
  _location: string;
58
- _stream: any;
58
+ _stream: import("stream").Readable | undefined;
59
59
  _body: any;
60
60
  _etag: string;
61
61
  get cacheControl(): string;
@@ -66,8 +66,8 @@ declare const EikService: {
66
66
  set location(value: string): any;
67
67
  get mimeType(): string;
68
68
  set mimeType(value: string): any;
69
- get stream(): any;
70
- set stream(value: any): any;
69
+ get stream(): import("stream").Readable | undefined;
70
+ set stream(value: import("stream").Readable | undefined): any;
71
71
  get body(): any;
72
72
  set body(value: any): any;
73
73
  get etag(): string;
@@ -77,17 +77,17 @@ declare const EikService: {
77
77
  };
78
78
  _aliasPost: {
79
79
  _organizations: [string, string][];
80
- _cacheControl: string;
81
- _sink: import("@eik/sink").default;
80
+ _cacheControl: string | undefined;
81
+ _sink: import("@eik/sink").default | undefined;
82
82
  _log: import("abslog").ValidLogger;
83
83
  _metrics: import("@metrics/client");
84
84
  _histogram: import("@metrics/client").MetricsHistogram;
85
85
  _orgRegistry: Map<string, string>;
86
86
  _multipart: {
87
- _pkgMaxFileSize: number;
87
+ _pkgMaxFileSize: number | undefined;
88
88
  _legalFields: string[];
89
89
  _legalFiles: string[];
90
- _sink: import("@eik/sink").default;
90
+ _sink: import("@eik/sink").default | undefined;
91
91
  _log: import("abslog").ValidLogger;
92
92
  parse(incoming: any): Promise<any>;
93
93
  _handleField({ name, value }: {
@@ -119,12 +119,12 @@ declare const EikService: {
119
119
  readonly metrics: import("@metrics/client");
120
120
  _parser(incoming: any): Promise<any>;
121
121
  _exist(incoming: any): Promise<boolean>;
122
- handler(req: any, user: any, type: any, name: any, alias: any): Promise<{
122
+ handler(req: any, user: any, type: string, name: string, alias: string): Promise<{
123
123
  _cacheControl: string;
124
124
  _statusCode: number;
125
125
  _mimeType: string;
126
126
  _location: string;
127
- _stream: any;
127
+ _stream: import("stream").Readable | undefined;
128
128
  _body: any;
129
129
  _etag: string;
130
130
  get cacheControl(): string;
@@ -135,8 +135,8 @@ declare const EikService: {
135
135
  set location(value: string): any;
136
136
  get mimeType(): string;
137
137
  set mimeType(value: string): any;
138
- get stream(): any;
139
- set stream(value: any): any;
138
+ get stream(): import("stream").Readable | undefined;
139
+ set stream(value: import("stream").Readable | undefined): any;
140
140
  get body(): any;
141
141
  set body(value: any): any;
142
142
  get etag(): string;
@@ -146,31 +146,31 @@ declare const EikService: {
146
146
  };
147
147
  _aliasDel: {
148
148
  _organizations: [string, string][];
149
- _cacheControl: string;
150
- _sink: import("@eik/sink").default;
149
+ _cacheControl: string | undefined;
150
+ _sink: import("@eik/sink").default | undefined;
151
151
  _log: import("abslog").ValidLogger;
152
152
  _metrics: import("@metrics/client");
153
153
  _histogram: import("@metrics/client").MetricsHistogram;
154
154
  _orgRegistry: Map<string, string>;
155
155
  readonly metrics: import("@metrics/client");
156
156
  _exist(path?: string): Promise<boolean>;
157
- handler(req: any, user: any, type: any, name: any, alias: any): Promise<any>;
157
+ handler(req: any, user: any, type: string, name: string, alias: string): Promise<any>;
158
158
  };
159
159
  _aliasGet: {
160
160
  _organizations: [string, string][];
161
161
  _cacheControl: string;
162
- _sink: import("@eik/sink").default;
162
+ _sink: import("@eik/sink").default | undefined;
163
163
  _log: import("abslog").ValidLogger;
164
164
  _metrics: import("@metrics/client");
165
165
  _histogram: import("@metrics/client").MetricsHistogram;
166
166
  _orgRegistry: Map<string, string>;
167
167
  readonly metrics: import("@metrics/client");
168
- handler(req: any, type: any, name: any, alias: any, extra: any): Promise<{
168
+ handler(req: any, type: string, name: string, alias: string, extra: string): Promise<{
169
169
  _cacheControl: string;
170
170
  _statusCode: number;
171
171
  _mimeType: string;
172
172
  _location: string;
173
- _stream: any;
173
+ _stream: import("stream").Readable | undefined;
174
174
  _body: any;
175
175
  _etag: string;
176
176
  get cacheControl(): string;
@@ -181,8 +181,8 @@ declare const EikService: {
181
181
  set location(value: string): any;
182
182
  get mimeType(): string;
183
183
  set mimeType(value: string): any;
184
- get stream(): any;
185
- set stream(value: any): any;
184
+ get stream(): import("stream").Readable | undefined;
185
+ set stream(value: import("stream").Readable | undefined): any;
186
186
  get body(): any;
187
187
  set body(value: any): any;
188
188
  get etag(): string;
@@ -193,19 +193,19 @@ declare const EikService: {
193
193
  _aliasGetSWR: {
194
194
  _organizations: [string, string][];
195
195
  _cacheControl: string;
196
- _sink: import("@eik/sink").default;
196
+ _sink: import("@eik/sink").default | undefined;
197
197
  _etag: boolean;
198
198
  _log: import("abslog").ValidLogger;
199
199
  _metrics: import("@metrics/client");
200
200
  _histogram: import("@metrics/client").MetricsHistogram;
201
201
  _orgRegistry: Map<string, string>;
202
202
  readonly metrics: import("@metrics/client");
203
- handler(req: any, type: any, name: any, alias: any, extra: any): Promise<{
203
+ handler(req: any, type: string, name: string, alias: string, extra: string): Promise<{
204
204
  _cacheControl: string;
205
205
  _statusCode: number;
206
206
  _mimeType: string;
207
207
  _location: string;
208
- _stream: any;
208
+ _stream: import("stream").Readable | undefined;
209
209
  _body: any;
210
210
  _etag: string;
211
211
  get cacheControl(): string;
@@ -216,8 +216,8 @@ declare const EikService: {
216
216
  set location(value: string): any;
217
217
  get mimeType(): string;
218
218
  set mimeType(value: string): any;
219
- get stream(): any;
220
- set stream(value: any): any;
219
+ get stream(): import("stream").Readable | undefined;
220
+ set stream(value: import("stream").Readable | undefined): any;
221
221
  get body(): any;
222
222
  set body(value: any): any;
223
223
  get etag(): string;
@@ -227,17 +227,17 @@ declare const EikService: {
227
227
  };
228
228
  _aliasPut: {
229
229
  _organizations: [string, string][];
230
- _cacheControl: string;
231
- _sink: import("@eik/sink").default;
230
+ _cacheControl: string | undefined;
231
+ _sink: import("@eik/sink").default | undefined;
232
232
  _log: import("abslog").ValidLogger;
233
233
  _metrics: import("@metrics/client");
234
234
  _histogram: import("@metrics/client").MetricsHistogram;
235
235
  _orgRegistry: Map<string, string>;
236
236
  _multipart: {
237
- _pkgMaxFileSize: number;
237
+ _pkgMaxFileSize: number | undefined;
238
238
  _legalFields: string[];
239
239
  _legalFiles: string[];
240
- _sink: import("@eik/sink").default;
240
+ _sink: import("@eik/sink").default | undefined;
241
241
  _log: import("abslog").ValidLogger;
242
242
  parse(incoming: any): Promise<any>;
243
243
  _handleField({ name, value }: {
@@ -269,12 +269,12 @@ declare const EikService: {
269
269
  readonly metrics: import("@metrics/client");
270
270
  _parser(incoming: any): Promise<any>;
271
271
  _exist(incoming: any): Promise<boolean>;
272
- handler(req: any, user: any, type: any, name: any, alias: any): Promise<{
272
+ handler(req: any, user: any, type: string, name: string, alias: string): Promise<{
273
273
  _cacheControl: string;
274
274
  _statusCode: number;
275
275
  _mimeType: string;
276
276
  _location: string;
277
- _stream: any;
277
+ _stream: import("stream").Readable | undefined;
278
278
  _body: any;
279
279
  _etag: string;
280
280
  get cacheControl(): string;
@@ -285,8 +285,8 @@ declare const EikService: {
285
285
  set location(value: string): any;
286
286
  get mimeType(): string;
287
287
  set mimeType(value: string): any;
288
- get stream(): any;
289
- set stream(value: any): any;
288
+ get stream(): import("stream").Readable | undefined;
289
+ set stream(value: import("stream").Readable | undefined): any;
290
290
  get body(): any;
291
291
  set body(value: any): any;
292
292
  get etag(): string;
@@ -296,17 +296,17 @@ declare const EikService: {
296
296
  };
297
297
  _authPost: {
298
298
  _organizations: [string, string][];
299
- _cacheControl: string;
299
+ _cacheControl: string | undefined;
300
300
  _authKey: string;
301
301
  _log: import("abslog").ValidLogger;
302
302
  _metrics: import("@metrics/client");
303
303
  _histogram: import("@metrics/client").MetricsHistogram;
304
304
  _orgRegistry: Map<string, string>;
305
305
  _multipart: {
306
- _pkgMaxFileSize: number;
306
+ _pkgMaxFileSize: number | undefined;
307
307
  _legalFields: string[];
308
308
  _legalFiles: string[];
309
- _sink: import("@eik/sink").default;
309
+ _sink: import("@eik/sink").default | undefined;
310
310
  _log: import("abslog").ValidLogger;
311
311
  parse(incoming: any): Promise<any>;
312
312
  _handleField({ name, value }: {
@@ -342,7 +342,7 @@ declare const EikService: {
342
342
  _statusCode: number;
343
343
  _mimeType: string;
344
344
  _location: string;
345
- _stream: any;
345
+ _stream: import("stream").Readable | undefined;
346
346
  _body: any;
347
347
  _etag: string;
348
348
  get cacheControl(): string;
@@ -353,8 +353,8 @@ declare const EikService: {
353
353
  set location(value: string): any;
354
354
  get mimeType(): string;
355
355
  set mimeType(value: string): any;
356
- get stream(): any;
357
- set stream(value: any): any;
356
+ get stream(): import("stream").Readable | undefined;
357
+ set stream(value: import("stream").Readable | undefined): any;
358
358
  get body(): any;
359
359
  set body(value: any): any;
360
360
  get etag(): string;
@@ -365,19 +365,19 @@ declare const EikService: {
365
365
  _pkgLog: {
366
366
  _organizations: [string, string][];
367
367
  _cacheControl: string;
368
- _sink: import("@eik/sink").default;
368
+ _sink: import("@eik/sink").default | undefined;
369
369
  _etag: boolean;
370
370
  _log: import("abslog").ValidLogger;
371
371
  _metrics: import("@metrics/client");
372
372
  _histogram: import("@metrics/client").MetricsHistogram;
373
373
  _orgRegistry: Map<string, string>;
374
374
  readonly metrics: import("@metrics/client");
375
- handler(req: any, type: any, name: any, version: any): Promise<{
375
+ handler(req: any, type: string, name: string, version: string): Promise<{
376
376
  _cacheControl: string;
377
377
  _statusCode: number;
378
378
  _mimeType: string;
379
379
  _location: string;
380
- _stream: any;
380
+ _stream: import("stream").Readable | undefined;
381
381
  _body: any;
382
382
  _etag: string;
383
383
  get cacheControl(): string;
@@ -388,8 +388,8 @@ declare const EikService: {
388
388
  set location(value: string): any;
389
389
  get mimeType(): string;
390
390
  set mimeType(value: string): any;
391
- get stream(): any;
392
- set stream(value: any): any;
391
+ get stream(): import("stream").Readable | undefined;
392
+ set stream(value: import("stream").Readable | undefined): any;
393
393
  get body(): any;
394
394
  set body(value: any): any;
395
395
  get etag(): string;
@@ -400,19 +400,19 @@ declare const EikService: {
400
400
  _pkgGet: {
401
401
  _organizations: [string, string][];
402
402
  _cacheControl: string;
403
- _sink: import("@eik/sink").default;
403
+ _sink: import("@eik/sink").default | undefined;
404
404
  _etag: boolean;
405
405
  _log: import("abslog").ValidLogger;
406
406
  _metrics: import("@metrics/client");
407
407
  _histogram: import("@metrics/client").MetricsHistogram;
408
408
  _orgRegistry: Map<string, string>;
409
409
  readonly metrics: import("@metrics/client");
410
- handler(req: any, type: any, name: any, version: any, extra: any): Promise<{
410
+ handler(req: any, type: string, name: string, version: string, extra: string): Promise<{
411
411
  _cacheControl: string;
412
412
  _statusCode: number;
413
413
  _mimeType: string;
414
414
  _location: string;
415
- _stream: any;
415
+ _stream: import("stream").Readable | undefined;
416
416
  _body: any;
417
417
  _etag: string;
418
418
  get cacheControl(): string;
@@ -423,8 +423,8 @@ declare const EikService: {
423
423
  set location(value: string): any;
424
424
  get mimeType(): string;
425
425
  set mimeType(value: string): any;
426
- get stream(): any;
427
- set stream(value: any): any;
426
+ get stream(): import("stream").Readable | undefined;
427
+ set stream(value: import("stream").Readable | undefined): any;
428
428
  get body(): any;
429
429
  set body(value: any): any;
430
430
  get etag(): string;
@@ -435,17 +435,17 @@ declare const EikService: {
435
435
  _pkgPut: {
436
436
  _pkgMaxFileSize: number;
437
437
  _organizations: [string, string][];
438
- _cacheControl: string;
439
- _sink: import("@eik/sink").default;
438
+ _cacheControl: string | undefined;
439
+ _sink: import("@eik/sink").default | undefined;
440
440
  _log: import("abslog").ValidLogger;
441
441
  _metrics: import("@metrics/client");
442
442
  _histogram: import("@metrics/client").MetricsHistogram;
443
443
  _orgRegistry: Map<string, string>;
444
444
  _multipart: {
445
- _pkgMaxFileSize: number;
445
+ _pkgMaxFileSize: number | undefined;
446
446
  _legalFields: string[];
447
447
  _legalFiles: string[];
448
- _sink: import("@eik/sink").default;
448
+ _sink: import("@eik/sink").default | undefined;
449
449
  _log: import("abslog").ValidLogger;
450
450
  parse(incoming: any): Promise<any>;
451
451
  _handleField({ name, value }: {
@@ -485,9 +485,9 @@ declare const EikService: {
485
485
  get type(): string;
486
486
  get name(): string;
487
487
  get org(): string;
488
- setVersion(version: any, integrity: any): void;
489
- getVersion(major: any): any;
490
- check(version: any): boolean;
488
+ setVersion(version: string, integrity: string): void;
489
+ getVersion(major: number): any;
490
+ check(version: string): boolean;
491
491
  toJSON(): {
492
492
  versions: [any, any][];
493
493
  type: string;
@@ -498,12 +498,12 @@ declare const EikService: {
498
498
  }>;
499
499
  _readVersion(incoming: any): Promise<boolean>;
500
500
  _writeVersions(incoming: any, versions: any): Promise<void>;
501
- handler(req: any, user: any, type: any, name: any, version: any): Promise<{
501
+ handler(req: any, user: any, type: string, name: string, version: string): Promise<{
502
502
  _cacheControl: string;
503
503
  _statusCode: number;
504
504
  _mimeType: string;
505
505
  _location: string;
506
- _stream: any;
506
+ _stream: import("stream").Readable | undefined;
507
507
  _body: any;
508
508
  _etag: string;
509
509
  get cacheControl(): string;
@@ -514,8 +514,8 @@ declare const EikService: {
514
514
  set location(value: string): any;
515
515
  get mimeType(): string;
516
516
  set mimeType(value: string): any;
517
- get stream(): any;
518
- set stream(value: any): any;
517
+ get stream(): import("stream").Readable | undefined;
518
+ set stream(value: import("stream").Readable | undefined): any;
519
519
  get body(): any;
520
520
  set body(value: any): any;
521
521
  get etag(): string;
@@ -526,17 +526,17 @@ declare const EikService: {
526
526
  _imgPut: {
527
527
  _pkgMaxFileSize: number;
528
528
  _organizations: [string, string][];
529
- _cacheControl: string;
530
- _sink: import("@eik/sink").default;
529
+ _cacheControl: string | undefined;
530
+ _sink: import("@eik/sink").default | undefined;
531
531
  _log: import("abslog").ValidLogger;
532
532
  _metrics: import("@metrics/client");
533
533
  _histogram: import("@metrics/client").MetricsHistogram;
534
534
  _orgRegistry: Map<string, string>;
535
535
  _multipart: {
536
- _pkgMaxFileSize: number;
536
+ _pkgMaxFileSize: number | undefined;
537
537
  _legalFields: string[];
538
538
  _legalFiles: string[];
539
- _sink: import("@eik/sink").default;
539
+ _sink: import("@eik/sink").default | undefined;
540
540
  _log: import("abslog").ValidLogger;
541
541
  parse(incoming: any): Promise<any>;
542
542
  _handleField({ name, value }: {
@@ -576,9 +576,9 @@ declare const EikService: {
576
576
  get type(): string;
577
577
  get name(): string;
578
578
  get org(): string;
579
- setVersion(version: any, integrity: any): void;
580
- getVersion(major: any): any;
581
- check(version: any): boolean;
579
+ setVersion(version: string, integrity: string): void;
580
+ getVersion(major: number): any;
581
+ check(version: string): boolean;
582
582
  toJSON(): {
583
583
  versions: [any, any][];
584
584
  type: string;
@@ -589,12 +589,12 @@ declare const EikService: {
589
589
  }>;
590
590
  _readVersion(incoming: any): Promise<boolean>;
591
591
  _writeVersions(incoming: any, versions: any): Promise<void>;
592
- handler(req: any, user: any, type: any, name: any, version: any): Promise<{
592
+ handler(req: any, user: any, type: string, name: string, version: string): Promise<{
593
593
  _cacheControl: string;
594
594
  _statusCode: number;
595
595
  _mimeType: string;
596
596
  _location: string;
597
- _stream: any;
597
+ _stream: import("stream").Readable | undefined;
598
598
  _body: any;
599
599
  _etag: string;
600
600
  get cacheControl(): string;
@@ -605,8 +605,8 @@ declare const EikService: {
605
605
  set location(value: string): any;
606
606
  get mimeType(): string;
607
607
  set mimeType(value: string): any;
608
- get stream(): any;
609
- set stream(value: any): any;
608
+ get stream(): import("stream").Readable | undefined;
609
+ set stream(value: import("stream").Readable | undefined): any;
610
610
  get body(): any;
611
611
  set body(value: any): any;
612
612
  get etag(): string;
@@ -617,19 +617,19 @@ declare const EikService: {
617
617
  _mapGet: {
618
618
  _organizations: [string, string][];
619
619
  _cacheControl: string;
620
- _sink: import("@eik/sink").default;
620
+ _sink: import("@eik/sink").default | undefined;
621
621
  _etag: boolean;
622
622
  _log: import("abslog").ValidLogger;
623
623
  _metrics: import("@metrics/client");
624
624
  _histogram: import("@metrics/client").MetricsHistogram;
625
625
  _orgRegistry: Map<string, string>;
626
626
  readonly metrics: import("@metrics/client");
627
- handler(req: any, name: any, version: any): Promise<{
627
+ handler(req: any, name: string, version: string): Promise<{
628
628
  _cacheControl: string;
629
629
  _statusCode: number;
630
630
  _mimeType: string;
631
631
  _location: string;
632
- _stream: any;
632
+ _stream: import("stream").Readable | undefined;
633
633
  _body: any;
634
634
  _etag: string;
635
635
  get cacheControl(): string;
@@ -640,8 +640,8 @@ declare const EikService: {
640
640
  set location(value: string): any;
641
641
  get mimeType(): string;
642
642
  set mimeType(value: string): any;
643
- get stream(): any;
644
- set stream(value: any): any;
643
+ get stream(): import("stream").Readable | undefined;
644
+ set stream(value: import("stream").Readable | undefined): any;
645
645
  get body(): any;
646
646
  set body(value: any): any;
647
647
  get etag(): string;
@@ -652,8 +652,8 @@ declare const EikService: {
652
652
  _mapPut: {
653
653
  _mapMaxFileSize: number;
654
654
  _organizations: [string, string][];
655
- _cacheControl: string;
656
- _sink: import("@eik/sink").default;
655
+ _cacheControl: string | undefined;
656
+ _sink: import("@eik/sink").default | undefined;
657
657
  _log: import("abslog").ValidLogger;
658
658
  _metrics: import("@metrics/client");
659
659
  _histogram: import("@metrics/client").MetricsHistogram;
@@ -674,9 +674,9 @@ declare const EikService: {
674
674
  get type(): string;
675
675
  get name(): string;
676
676
  get org(): string;
677
- setVersion(version: any, integrity: any): void;
678
- getVersion(major: any): any;
679
- check(version: any): boolean;
677
+ setVersion(version: string, integrity: string): void;
678
+ getVersion(major: number): any;
679
+ check(version: string): boolean;
680
680
  toJSON(): {
681
681
  versions: [any, any][];
682
682
  type: string;
@@ -686,12 +686,12 @@ declare const EikService: {
686
686
  get [Symbol.toStringTag](): string;
687
687
  }>;
688
688
  _writeVersions(incoming: any, versions: any): Promise<void>;
689
- handler(req: any, user: any, name: any, version: any): Promise<{
689
+ handler(req: any, user: any, name: string, version: string): Promise<{
690
690
  _cacheControl: string;
691
691
  _statusCode: number;
692
692
  _mimeType: string;
693
693
  _location: string;
694
- _stream: any;
694
+ _stream: import("stream").Readable | undefined;
695
695
  _body: any;
696
696
  _etag: string;
697
697
  get cacheControl(): string;
@@ -702,8 +702,8 @@ declare const EikService: {
702
702
  set location(value: string): any;
703
703
  get mimeType(): string;
704
704
  set mimeType(value: string): any;
705
- get stream(): any;
706
- set stream(value: any): any;
705
+ get stream(): import("stream").Readable | undefined;
706
+ set stream(value: import("stream").Readable | undefined): any;
707
707
  get body(): any;
708
708
  set body(value: any): any;
709
709
  get etag(): string;
@@ -719,5 +719,5 @@ declare const EikService: {
719
719
  api(): (app: import("fastify").FastifyInstance) => Promise<void>;
720
720
  };
721
721
  };
722
- import { PassThrough } from "stream";
723
722
  import pino from "pino";
723
+ import { PassThrough } from "stream";
package/types/utils.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  export function sanitizeParameters(url?: string): {
2
2
  version: string;
3
- extras: any;
3
+ extras: string;
4
4
  alias: string;
5
- name: any;
5
+ name: string;
6
6
  type: string;
7
7
  };
8
- export function sanitizeExtras(extras: any, version: any): any;
8
+ export function sanitizeExtras(extras: string, version?: string): string;
9
9
  export function sanitizeAlias(alias?: string): string;
10
- export function sanitizeName(scope: any, name: any): any;
10
+ export function sanitizeName(scope: string, name?: string): string;