@apinecka/logs-client 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tomáš Cupák
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,71 @@
1
- # Temporary Holding Version
1
+ # @apinecka/logs-client
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Client for the ingest endpoint (`POST /logs`) of Apinecka Logs:
4
+ a small framework-free HTTP client and a NestJS logger that ships every log line to logs-api.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm install @apinecka/logs-client
10
+ # for the NestJS logger (an optional peer dependency):
11
+ npm install @nestjs/common
12
+ ```
13
+
14
+ ## NestJS
15
+
16
+ ```ts
17
+ import { LogsClient } from '@apinecka/logs-client'
18
+ import { LogsApiLogger } from '@apinecka/logs-client/nest'
19
+ import { NestFactory } from '@nestjs/core'
20
+
21
+ const app = await NestFactory.create(AppModule, {
22
+ logger: new LogsApiLogger(
23
+ { prefix: 'API' },
24
+ new LogsClient({ baseUrl: 'https://logs.apinecka.com', apiKey: process.env.LOGS_API_KEY }),
25
+ ),
26
+ })
27
+ ```
28
+
29
+ `LogsApiLogger` extends Nest's `ConsoleLogger`: it still prints to the console and additionally sends
30
+ `log`, `warn`, `error` and `fatal` entries (not `debug`/`verbose`). The `prefix` becomes the log's
31
+ `appName`. Errors are sent as their stack (an `AxiosError` without its request config, so credentials
32
+ never leave the process). A failed send is swallowed - logging never crashes the app.
33
+
34
+ ## Plain usage
35
+
36
+ ```ts
37
+ import { LogLevel, LogsClient } from '@apinecka/logs-client'
38
+
39
+ const client = new LogsClient({ baseUrl: 'https://logs.apinecka.com', apiKey: 'ingest-token' })
40
+
41
+ await client.create({ level: LogLevel.error, message: 'Something broke', appName: 'billing' })
42
+ ```
43
+
44
+ ## Options
45
+
46
+ `new LogsClient(options)`:
47
+
48
+ - `baseUrl` - logs-api URL.
49
+ - `apiKey` - an ingest token (Tokens page of the logs UI), sent as `Authorization: Bearer ...`. The token
50
+ decides the account and the default env.
51
+ - `timeoutMs` - per-request timeout, default 5000.
52
+
53
+ Every client owns its HTTP connection pool (keep-alive), so several clients never share state.
54
+ `ApiLogsClient` is an alias of `LogsClient`.
55
+
56
+ ## Log entry
57
+
58
+ `client.create(entry)` takes a `CreateLogRequest` (generated from logs-api's OpenAPI document):
59
+
60
+ | field | type | note |
61
+ |-------------|------------|-------------------------------------------------------------------|
62
+ | `level` | `LogLevel` | `log`, `error`, `warn`, `debug`, `verbose`, `fatal` |
63
+ | `message` | `string` | |
64
+ | `appName` | `string` | up to 50 characters; the app is created on its first log |
65
+ | `context` | `string?` | up to 255 characters |
66
+ | `timestamp` | `string?` | ISO 8601, defaults to now on the server |
67
+ | `env` | `string?` | overrides the env of the ingest token (default `production`) |
68
+
69
+ ## License
70
+
71
+ MIT
@@ -0,0 +1,9 @@
1
+ import type { CreateLogRequest, LogsClientOptions } from './types';
2
+ /** Sends log entries to logs-api. Every instance owns its axios instance, so clients never share state. */
3
+ export declare class LogsClient {
4
+ private readonly http;
5
+ constructor(options: LogsClientOptions);
6
+ create(entry: CreateLogRequest): Promise<void>;
7
+ }
8
+ /** Former name of {@link LogsClient}, kept so switching to this package is only an import change. */
9
+ export { LogsClient as ApiLogsClient };
package/dist/client.js ADDED
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ApiLogsClient = exports.LogsClient = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const http_1 = require("http");
9
+ const https_1 = require("https");
10
+ /** Sends log entries to logs-api. Every instance owns its axios instance, so clients never share state. */
11
+ class LogsClient {
12
+ constructor(options) {
13
+ this.http = axios_1.default.create({
14
+ baseURL: options.baseUrl,
15
+ headers: options.apiKey ? { Authorization: `Bearer ${options.apiKey}` } : {},
16
+ timeout: options.timeoutMs ?? 5_000,
17
+ // Logs are posted on every log line - keep TCP/TLS connections warm instead of
18
+ // renegotiating a new one per call.
19
+ httpAgent: new http_1.Agent({ keepAlive: true, keepAliveMsecs: 30_000 }),
20
+ httpsAgent: new https_1.Agent({ keepAlive: true, keepAliveMsecs: 30_000 }),
21
+ });
22
+ }
23
+ async create(entry) {
24
+ await this.http.post('/logs', entry, { headers: { 'Content-Type': 'application/json' } });
25
+ }
26
+ }
27
+ exports.LogsClient = LogsClient;
28
+ exports.ApiLogsClient = LogsClient;
29
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA4C;AAC5C,+BAAyC;AACzC,iCAA2C;AAI3C,2GAA2G;AAC3G,MAAa,UAAU;IAGtB,YAAY,OAA0B;QACrC,IAAI,CAAC,IAAI,GAAG,eAAK,CAAC,MAAM,CAAC;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE;YAC5E,OAAO,EAAE,OAAO,CAAC,SAAS,IAAI,KAAK;YACnC,+EAA+E;YAC/E,oCAAoC;YACpC,SAAS,EAAE,IAAI,YAAS,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC;YACrE,UAAU,EAAE,IAAI,aAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC;SACvE,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAuB;QACnC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAA;IAC1F,CAAC;CACD;AAlBD,gCAkBC;AAGsB,mCAAa"}
@@ -0,0 +1,3 @@
1
+ export * from './client';
2
+ export * from './schema/models';
3
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client"), exports);
18
+ __exportStar(require("./schema/models"), exports);
19
+ __exportStar(require("./types"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,kDAA+B;AAC/B,0CAAuB"}
@@ -0,0 +1 @@
1
+ export * from './logs.logger';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./logs.logger"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nest/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B"}
@@ -0,0 +1,16 @@
1
+ import { ConsoleLogger, ConsoleLoggerOptions } from '@nestjs/common';
2
+ import type { LogsClient } from '../client';
3
+ /** What the logger needs from a client - `LogsClient` (or `ApiLogsClient`) fits. */
4
+ export type LogsPublisher = Pick<LogsClient, 'create'>;
5
+ export declare class LogsApiLogger extends ConsoleLogger {
6
+ private readonly apiLogsClient;
7
+ constructor(options: ConsoleLoggerOptions, apiLogsClient: LogsPublisher);
8
+ log(message: unknown, ...optionalParams: unknown[]): void;
9
+ error(message: unknown, ...optionalParams: unknown[]): void;
10
+ warn(message: unknown, ...optionalParams: unknown[]): void;
11
+ debug(message: unknown, ...optionalParams: unknown[]): void;
12
+ verbose(message: unknown, ...optionalParams: unknown[]): void;
13
+ fatal(message: unknown, ...optionalParams: unknown[]): void;
14
+ private compact;
15
+ private publish;
16
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LogsApiLogger = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const axios_1 = require("axios");
6
+ const models_1 = require("../schema/models");
7
+ class LogsApiLogger extends common_1.ConsoleLogger {
8
+ constructor(options, apiLogsClient) {
9
+ super(options);
10
+ this.apiLogsClient = apiLogsClient;
11
+ }
12
+ log(message, ...optionalParams) {
13
+ const compacted = this.compact(message);
14
+ super.log(compacted, ...optionalParams);
15
+ this.publish(models_1.LogLevel.log, compacted, optionalParams);
16
+ }
17
+ error(message, ...optionalParams) {
18
+ const compacted = this.compact(message);
19
+ super.error(compacted, ...optionalParams);
20
+ this.publish(models_1.LogLevel.error, compacted, optionalParams);
21
+ }
22
+ warn(message, ...optionalParams) {
23
+ const compacted = this.compact(message);
24
+ super.warn(compacted, ...optionalParams);
25
+ this.publish(models_1.LogLevel.warn, compacted, optionalParams);
26
+ }
27
+ debug(message, ...optionalParams) {
28
+ super.debug(this.compact(message), ...optionalParams);
29
+ }
30
+ verbose(message, ...optionalParams) {
31
+ super.verbose(this.compact(message), ...optionalParams);
32
+ }
33
+ fatal(message, ...optionalParams) {
34
+ const compacted = this.compact(message);
35
+ super.fatal(compacted, ...optionalParams);
36
+ this.publish(models_1.LogLevel.fatal, compacted, optionalParams);
37
+ }
38
+ // An AxiosError serializes its whole request config, request headers (credentials) included.
39
+ compact(message) {
40
+ if (!(message instanceof Error))
41
+ return message;
42
+ const stack = message.stack ?? `${message.name}: ${message.message}`;
43
+ if (!(0, axios_1.isAxiosError)(message))
44
+ return stack;
45
+ const request = `${message.config?.method?.toUpperCase() ?? ''} ${message.config?.url ?? ''}`.trim();
46
+ return `${stack}\n request: ${request} -> ${message.response?.status ?? message.code ?? 'no response'}`;
47
+ }
48
+ publish(level, message, optionalParams) {
49
+ const context = typeof optionalParams[0] === 'string' ? optionalParams[0] : undefined;
50
+ this.apiLogsClient
51
+ .create({
52
+ level,
53
+ message: typeof message === 'string' ? message : JSON.stringify(message),
54
+ context,
55
+ appName: String(this.options?.prefix ?? 'unknown'),
56
+ timestamp: new Date().toISOString(),
57
+ })
58
+ // A transient failure of the external logs API must never crash the app over a fire-and-forget log call.
59
+ .catch(() => { });
60
+ }
61
+ }
62
+ exports.LogsApiLogger = LogsApiLogger;
63
+ //# sourceMappingURL=logs.logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.logger.js","sourceRoot":"","sources":["../../src/nest/logs.logger.ts"],"names":[],"mappings":";;;AAAA,2CAAoE;AACpE,iCAAoC;AAGpC,6CAA2C;AAK3C,MAAa,aAAc,SAAQ,sBAAa;IAC/C,YACC,OAA6B,EACZ,aAA4B;QAE7C,KAAK,CAAC,OAAO,CAAC,CAAA;QAFG,kBAAa,GAAb,aAAa,CAAe;IAG9C,CAAC;IAEQ,GAAG,CAAC,OAAgB,EAAE,GAAG,cAAyB;QAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACvC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,cAAc,CAAC,CAAA;QACvC,IAAI,CAAC,OAAO,CAAC,iBAAQ,CAAC,GAAG,EAAE,SAAS,EAAE,cAAc,CAAC,CAAA;IACtD,CAAC;IAEQ,KAAK,CAAC,OA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1.0.0
7
+ */
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Generated by orval 🍺
4
+ * Do not edit manually.
5
+ * Apinecka Logs API
6
+ * Apinecka Logs API
7
+ * OpenAPI spec version: 1.0.0
8
+ */
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Apinecka Logs API
5
+ * Apinecka Logs API
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import type { LogLevel } from './logLevel';
9
+ export interface CreateLog {
10
+ level: LogLevel;
11
+ message: string;
12
+ context?: string;
13
+ /** @maxLength 50 */
14
+ appName: string;
15
+ /** Defaults to now */
16
+ timestamp?: string;
17
+ /**
18
+ * Overrides the env of the ingest token
19
+ * @maxLength 30
20
+ */
21
+ env?: string;
22
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=createLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createLog.js","sourceRoot":"","sources":["../../../src/schema/models/createLog.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Apinecka Logs API
5
+ * Apinecka Logs API
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ export * from './createLog';
9
+ export * from './logLevel';
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * Generated by orval 🍺
4
+ * Do not edit manually.
5
+ * Apinecka Logs API
6
+ * Apinecka Logs API
7
+ * OpenAPI spec version: 1.0.0
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ __exportStar(require("./createLog"), exports);
25
+ __exportStar(require("./logLevel"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schema/models/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;AAEH,8CAA2B;AAC3B,6CAA0B"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Apinecka Logs API
5
+ * Apinecka Logs API
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ export type LogLevel = typeof LogLevel[keyof typeof LogLevel];
9
+ export declare const LogLevel: {
10
+ readonly log: "log";
11
+ readonly error: "error";
12
+ readonly warn: "warn";
13
+ readonly debug: "debug";
14
+ readonly verbose: "verbose";
15
+ readonly fatal: "fatal";
16
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * Generated by orval 🍺
4
+ * Do not edit manually.
5
+ * Apinecka Logs API
6
+ * Apinecka Logs API
7
+ * OpenAPI spec version: 1.0.0
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.LogLevel = void 0;
11
+ exports.LogLevel = {
12
+ log: 'log',
13
+ error: 'error',
14
+ warn: 'warn',
15
+ debug: 'debug',
16
+ verbose: 'verbose',
17
+ fatal: 'fatal',
18
+ };
19
+ //# sourceMappingURL=logLevel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logLevel.js","sourceRoot":"","sources":["../../../src/schema/models/logLevel.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAKU,QAAA,QAAQ,GAAG;IACvB,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACL,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { CreateLog } from './schema/models';
2
+ export interface LogsClientOptions {
3
+ /** Base URL of logs-api, e.g. `https://logs.apinecka.com`. */
4
+ baseUrl: string;
5
+ /** An ingest token (sent as a Bearer token) - it decides the account and the default env of the logs. */
6
+ apiKey?: string;
7
+ /** Per-request timeout, default 5000 ms. */
8
+ timeoutMs?: number;
9
+ }
10
+ /** @deprecated Name from the pre-package era, use {@link LogsClientOptions}. */
11
+ export type ApiClientOptions = LogsClientOptions;
12
+ /** The body of `POST /logs`. */
13
+ export type CreateLogRequest = CreateLog;
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,70 @@
1
1
  {
2
- "name": "@apinecka/logs-client",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@apinecka/logs-client",
3
+ "version": "1.0.0",
4
+ "description": "Client for the Apinecka logs-api ingest endpoint: a small HTTP client and a NestJS logger that ships logs to it.",
5
+ "keywords": [
6
+ "logs",
7
+ "logging",
8
+ "nestjs",
9
+ "logger",
10
+ "apinecka"
11
+ ],
12
+ "main": "dist/index.js",
13
+ "types": "dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./nest": {
20
+ "types": "./dist/nest/index.d.ts",
21
+ "default": "./dist/nest/index.js"
22
+ }
23
+ },
24
+ "typesVersions": {
25
+ "*": {
26
+ "nest": ["dist/nest/index.d.ts"]
27
+ }
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "README.md",
32
+ "LICENSE"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsc -p tsconfig.build.json",
36
+ "clean": "del-cli dist",
37
+ "test": "jest",
38
+ "prepublishOnly": "npm run clean && npm test && npm run build"
39
+ },
40
+ "author": "Tomáš Cupák <tomcupak@gmail.com>",
41
+ "license": "MIT",
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "engines": {
46
+ "node": ">=20"
47
+ },
48
+ "dependencies": {
49
+ "axios": "^1.10.0"
50
+ },
51
+ "peerDependencies": {
52
+ "@nestjs/common": "^11.0.0"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "@nestjs/common": {
56
+ "optional": true
57
+ }
58
+ },
59
+ "devDependencies": {
60
+ "@nestjs/common": "^11.1.7",
61
+ "@types/jest": "^30.0.0",
62
+ "@types/node": "^22.15.33",
63
+ "del-cli": "^7.0.0",
64
+ "jest": "^30.0.2",
65
+ "reflect-metadata": "^0.2.2",
66
+ "rxjs": "^7.8.2",
67
+ "ts-jest": "^29.4.0",
68
+ "typescript": "^5.8.3"
69
+ }
70
+ }