uptime-tracker-sdk 0.0.0-stage → 0.1.1
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/README.md +141 -3
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -0
- package/package.json +30 -6
package/README.md
CHANGED
|
@@ -1,3 +1,141 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# UpTimeTracker SDK for Node.js
|
|
2
|
+
|
|
3
|
+
Send application errors from Node.js and TypeScript services to the
|
|
4
|
+
UpTimeTracker API. The SDK uses Node.js's built-in `fetch` and includes
|
|
5
|
+
TypeScript declarations.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Node.js 18 or newer
|
|
10
|
+
- An UpTimeTracker API deployment reachable from your application
|
|
11
|
+
- An UpTimeTracker project ID
|
|
12
|
+
- An API key with the `sdk:write` scope
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install uptime-tracker-sdk
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
Keep the API key in your server's environment or secret manager. Do not expose
|
|
23
|
+
it in browser code or commit it to source control.
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import { UptimeTrackerClient } from "uptime-tracker-sdk";
|
|
27
|
+
|
|
28
|
+
const apiKey = process.env.UPTIME_TRACKER_API_KEY;
|
|
29
|
+
const projectId = process.env.UPTIME_TRACKER_PROJECT_ID;
|
|
30
|
+
const baseUrl = process.env.UPTIME_TRACKER_URL;
|
|
31
|
+
|
|
32
|
+
if (!apiKey || !projectId || !baseUrl) {
|
|
33
|
+
throw new Error("UpTimeTracker configuration is missing");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const uptimeTracker = new UptimeTrackerClient({
|
|
37
|
+
apiKey,
|
|
38
|
+
projectId,
|
|
39
|
+
baseUrl, // API origin only, for example https://uptime.example.com
|
|
40
|
+
environment: process.env.NODE_ENV ?? "production",
|
|
41
|
+
appVersion: process.env.APP_VERSION,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
await runApplicationTask();
|
|
46
|
+
} catch (error) {
|
|
47
|
+
try {
|
|
48
|
+
const result = await uptimeTracker.captureException(error, {
|
|
49
|
+
feature: "background-task",
|
|
50
|
+
context: { task: "daily-reconciliation" },
|
|
51
|
+
});
|
|
52
|
+
console.info("UpTimeTracker incident result:", result.action);
|
|
53
|
+
} catch (reportingError) {
|
|
54
|
+
// Keep an SDK/network failure from hiding the original application error.
|
|
55
|
+
console.error("Could not report the error to UpTimeTracker:", reportingError);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`captureException` accepts an `Error` or another thrown value. It sends the
|
|
63
|
+
exception message, type, stack trace, feature, context, environment, and app
|
|
64
|
+
version to the SDK events endpoint. The call is asynchronous; await it when you
|
|
65
|
+
need to know whether the API accepted the report.
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
|
|
69
|
+
| Option | Required | Description |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| `apiKey` | Yes | API key with the `sdk:write` scope. |
|
|
72
|
+
| `projectId` | Yes | UUID of the project that should receive incidents. |
|
|
73
|
+
| `baseUrl` | Recommended | API origin, without `/v1`. Defaults to `http://localhost:8000`. |
|
|
74
|
+
| `environment` | No | Environment label, such as `production` or `staging`. Defaults to `production`. |
|
|
75
|
+
| `appVersion` | No | Version of the application sending events. |
|
|
76
|
+
|
|
77
|
+
Set `baseUrl` to your deployed API in production. The localhost default is
|
|
78
|
+
intended for local development.
|
|
79
|
+
|
|
80
|
+
## Send custom events
|
|
81
|
+
|
|
82
|
+
Use `sendEvent` for one event or `sendEvents` for a batch of up to 100:
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
await uptimeTracker.sendEvent({
|
|
86
|
+
eventType: "error",
|
|
87
|
+
level: "error",
|
|
88
|
+
message: "Payment provider request failed",
|
|
89
|
+
exceptionType: "PaymentProviderError",
|
|
90
|
+
feature: "checkout",
|
|
91
|
+
context: { provider: "example-payments" },
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Events support `eventType` values `error`, `exception`, `critical`, `resolved`,
|
|
96
|
+
and `warning`; levels are `error`, `critical`, `warning`, and `info`. Timestamps
|
|
97
|
+
can be supplied as a `Date` or an ISO-8601 string. The API accepts batches of
|
|
98
|
+
up to 100 events.
|
|
99
|
+
|
|
100
|
+
## Incident behavior
|
|
101
|
+
|
|
102
|
+
The API opens a project-level incident for `error`, `exception`, or `critical`
|
|
103
|
+
events with an `error` or `critical` level. A `resolved` event resolves the
|
|
104
|
+
currently open SDK incident for that project. The methods return a result with
|
|
105
|
+
an `action` (`opened`, `resolved`, or `none`), an `incidentId`, and a message.
|
|
106
|
+
Repeated qualifying errors while an incident is open do not open additional
|
|
107
|
+
incidents.
|
|
108
|
+
|
|
109
|
+
**Current backend limitation:** the API uses the event message and feature to
|
|
110
|
+
create the incident, but does not currently retain or display the submitted
|
|
111
|
+
stack trace or context in incident details. This SDK is therefore for incident
|
|
112
|
+
reporting, not a searchable, long-term application log store.
|
|
113
|
+
|
|
114
|
+
## Errors and privacy
|
|
115
|
+
|
|
116
|
+
HTTP failures reject with `UptimeTrackerError`, which includes `statusCode` for
|
|
117
|
+
HTTP responses. Network failures also reject. Handle reporting errors so they
|
|
118
|
+
do not mask the application error being reported.
|
|
119
|
+
|
|
120
|
+
Error messages, stack traces, and context may contain sensitive data. Remove
|
|
121
|
+
passwords, tokens, personal data, and request payloads before sending events.
|
|
122
|
+
Use only server-side code to keep the API key private.
|
|
123
|
+
|
|
124
|
+
## Troubleshooting
|
|
125
|
+
|
|
126
|
+
- **401 / 403:** check that the key is active and includes the `sdk:write` scope.
|
|
127
|
+
- **404:** check that the project exists and belongs to the API key's
|
|
128
|
+
organization.
|
|
129
|
+
- **Connection error:** verify `baseUrl`, network access, and that the API is
|
|
130
|
+
running.
|
|
131
|
+
- **No incident opened:** check that the event type is `error`, `exception`, or
|
|
132
|
+
`critical` and the level is `error` or `critical`.
|
|
133
|
+
|
|
134
|
+
## Development
|
|
135
|
+
|
|
136
|
+
From this directory, install development dependencies and run the test suite:
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
npm install
|
|
140
|
+
npm test
|
|
141
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type SDKEventType = "error" | "exception" | "critical" | "resolved" | "warning";
|
|
2
|
+
export type SDKEventLevel = "error" | "critical" | "warning" | "info";
|
|
3
|
+
export interface SDKConfig {
|
|
4
|
+
apiKey: string;
|
|
5
|
+
projectId: string;
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
environment?: string;
|
|
8
|
+
appVersion?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SDKEvent {
|
|
11
|
+
eventType: SDKEventType;
|
|
12
|
+
level: SDKEventLevel;
|
|
13
|
+
message: string;
|
|
14
|
+
exceptionType?: string | null;
|
|
15
|
+
stackTrace?: string | null;
|
|
16
|
+
feature?: string | null;
|
|
17
|
+
context?: Record<string, unknown> | null;
|
|
18
|
+
timestamp?: string | Date;
|
|
19
|
+
}
|
|
20
|
+
export interface SDKEventResult {
|
|
21
|
+
action: "opened" | "resolved" | "none";
|
|
22
|
+
incidentId: string | null;
|
|
23
|
+
message: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class UptimeTrackerError extends Error {
|
|
26
|
+
readonly statusCode?: number | undefined;
|
|
27
|
+
constructor(message: string, statusCode?: number | undefined);
|
|
28
|
+
}
|
|
29
|
+
export declare class UptimeTrackerClient {
|
|
30
|
+
private readonly fetchImpl;
|
|
31
|
+
private readonly config;
|
|
32
|
+
constructor(config: SDKConfig, fetchImpl?: typeof fetch);
|
|
33
|
+
sendEvent(event: SDKEvent): Promise<SDKEventResult>;
|
|
34
|
+
sendEvents(events: SDKEvent[]): Promise<SDKEventResult[]>;
|
|
35
|
+
captureException(exception: unknown, options?: {
|
|
36
|
+
feature?: string;
|
|
37
|
+
context?: Record<string, unknown>;
|
|
38
|
+
}): Promise<SDKEventResult>;
|
|
39
|
+
private serializeEvent;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB,OAAO,GACP,WAAW,GACX,UAAU,GACV,UAAU,GACV,SAAS,CAAC;AAEd,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAEtE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IACvC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AA0BD,qBAAa,kBAAmB,SAAQ,KAAK;aAGzB,UAAU,CAAC,EAAE,MAAM;IAFrC,YACE,OAAO,EAAE,MAAM,EACC,UAAU,CAAC,EAAE,MAAM,YAAA,EAIpC;CACF;AAED,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAJ5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAE7C,YACE,MAAM,EAAE,SAAS,EACA,SAAS,GAAE,OAAO,KAAwB,EA8B5D;IAEK,SAAS,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CAMxD;IAEK,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAyC9D;IAEK,gBAAgB,CACpB,SAAS,EAAE,OAAO,EAClB,OAAO,GAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC9B,GACL,OAAO,CAAC,cAAc,CAAC,CAazB;IAED,OAAO,CAAC,cAAc;CAkBvB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const MAX_BATCH_SIZE = 100;
|
|
2
|
+
export class UptimeTrackerError extends Error {
|
|
3
|
+
statusCode;
|
|
4
|
+
constructor(message, statusCode) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.statusCode = statusCode;
|
|
7
|
+
this.name = "UptimeTrackerError";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export class UptimeTrackerClient {
|
|
11
|
+
fetchImpl;
|
|
12
|
+
config;
|
|
13
|
+
constructor(config, fetchImpl = globalThis.fetch) {
|
|
14
|
+
this.fetchImpl = fetchImpl;
|
|
15
|
+
if (!config.apiKey.trim()) {
|
|
16
|
+
throw new TypeError("apiKey must not be empty");
|
|
17
|
+
}
|
|
18
|
+
if (!config.projectId.trim()) {
|
|
19
|
+
throw new TypeError("projectId must not be empty");
|
|
20
|
+
}
|
|
21
|
+
const baseUrl = config.baseUrl ?? "http://localhost:8000";
|
|
22
|
+
let parsedBaseUrl;
|
|
23
|
+
try {
|
|
24
|
+
parsedBaseUrl = new URL(baseUrl);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
throw new TypeError("baseUrl must be a valid HTTP or HTTPS URL");
|
|
28
|
+
}
|
|
29
|
+
if (!["http:", "https:"].includes(parsedBaseUrl.protocol)) {
|
|
30
|
+
throw new TypeError("baseUrl must use HTTP or HTTPS");
|
|
31
|
+
}
|
|
32
|
+
if (typeof fetchImpl !== "function") {
|
|
33
|
+
throw new TypeError("A fetch implementation is required");
|
|
34
|
+
}
|
|
35
|
+
this.config = {
|
|
36
|
+
apiKey: config.apiKey,
|
|
37
|
+
projectId: config.projectId,
|
|
38
|
+
baseUrl: baseUrl.replace(/\/+$/, ""),
|
|
39
|
+
environment: config.environment ?? "production",
|
|
40
|
+
appVersion: config.appVersion ?? "",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
async sendEvent(event) {
|
|
44
|
+
const [result] = await this.sendEvents([event]);
|
|
45
|
+
if (!result) {
|
|
46
|
+
throw new UptimeTrackerError("The API returned no result for the event");
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
async sendEvents(events) {
|
|
51
|
+
if (events.length === 0) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
if (events.length > MAX_BATCH_SIZE) {
|
|
55
|
+
throw new RangeError(`At most ${MAX_BATCH_SIZE} events can be sent at once`);
|
|
56
|
+
}
|
|
57
|
+
const serializedEvents = events.map((event) => this.serializeEvent(event));
|
|
58
|
+
const response = await this.fetchImpl(`${this.config.baseUrl}/v1/sdk/events`, {
|
|
59
|
+
method: "POST",
|
|
60
|
+
headers: {
|
|
61
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
62
|
+
"Content-Type": "application/json",
|
|
63
|
+
},
|
|
64
|
+
body: JSON.stringify({ events: serializedEvents }),
|
|
65
|
+
});
|
|
66
|
+
if (!response.ok) {
|
|
67
|
+
const body = (await response.text()).slice(0, 500);
|
|
68
|
+
throw new UptimeTrackerError(`SDK event request failed with HTTP ${response.status}${body ? `: ${body}` : ""}`, response.status);
|
|
69
|
+
}
|
|
70
|
+
const payload = await response.json();
|
|
71
|
+
if (!isSDKEventResponseEnvelope(payload, events.length)) {
|
|
72
|
+
throw new UptimeTrackerError("The API returned an invalid SDK event response");
|
|
73
|
+
}
|
|
74
|
+
return payload.data.map((result) => ({
|
|
75
|
+
action: result.action,
|
|
76
|
+
incidentId: result.incident_id,
|
|
77
|
+
message: result.message,
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
async captureException(exception, options = {}) {
|
|
81
|
+
const error = exception instanceof Error ? exception : new Error(String(exception));
|
|
82
|
+
return this.sendEvent({
|
|
83
|
+
eventType: "error",
|
|
84
|
+
level: "error",
|
|
85
|
+
message: error.message || error.name,
|
|
86
|
+
exceptionType: error.name,
|
|
87
|
+
stackTrace: error.stack ?? null,
|
|
88
|
+
feature: options.feature ?? null,
|
|
89
|
+
context: options.context ?? null,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
serializeEvent(event) {
|
|
93
|
+
return {
|
|
94
|
+
project_id: this.config.projectId,
|
|
95
|
+
environment: this.config.environment,
|
|
96
|
+
app_version: this.config.appVersion || null,
|
|
97
|
+
event_type: event.eventType,
|
|
98
|
+
level: event.level,
|
|
99
|
+
message: event.message,
|
|
100
|
+
exception_type: event.exceptionType ?? null,
|
|
101
|
+
stack_trace: event.stackTrace ?? null,
|
|
102
|
+
feature: event.feature ?? null,
|
|
103
|
+
context: event.context ?? null,
|
|
104
|
+
timestamp: event.timestamp instanceof Date
|
|
105
|
+
? event.timestamp.toISOString()
|
|
106
|
+
: (event.timestamp ?? new Date().toISOString()),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function isSDKEventResponseEnvelope(value, expectedResults) {
|
|
111
|
+
if (!isRecord(value) || !Array.isArray(value.data)) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
return (value.data.length === expectedResults &&
|
|
115
|
+
value.data.every((item) => isRecord(item) &&
|
|
116
|
+
["opened", "resolved", "none"].includes(String(item.action)) &&
|
|
117
|
+
(typeof item.incident_id === "string" || item.incident_id === null) &&
|
|
118
|
+
typeof item.message === "string"));
|
|
119
|
+
}
|
|
120
|
+
function isRecord(value) {
|
|
121
|
+
return typeof value === "object" && value !== null;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwDA,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAGzB,UAAU;IAF5B,YACE,OAAe,EACC,UAAmB;QAEnC,KAAK,CAAC,OAAO,CAAC,CAAC;0BAFC,UAAU;QAG1B,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,MAAM,OAAO,mBAAmB;IAKX,SAAS;IAJX,MAAM,CAAsB;IAE7C,YACE,MAAiB,EACA,SAAS,GAAiB,UAAU,CAAC,KAAK;yBAA1C,SAAS;QAE1B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;YAC1B,MAAM,IAAI,SAAS,CAAC,0BAA0B,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;YAC7B,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC,CAAC;QACrD,CAA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I;gBAC7B,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE;gBAC/B,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SACpD,CAAC;IACJ,CAAC;CACF;AAED,SAAS,0BAA0B,CACjC,KAAc,EACd,eAAuB;IAEvB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CACL,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,eAAe;QACrC,KAAK,CAAC,IAAI,CAAC,KAAK,CACd,CAAC,IAAI,EAAE,EAAE,CACP,QAAQ,CAAC,IAAI,CAAC;YACd,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC5D,CAAC,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,CAAC;YACnE,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CACnC,CACF,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "uptime-tracker-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "uptime-tracker-sdk",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Node.js SDK for sending application errors to UpTimeTracker",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc --project tsconfig.json",
|
|
23
|
+
"test": "npm run build && node --test test/*.test.mjs",
|
|
24
|
+
"prepack": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^26.6.11",
|
|
28
|
+
"typescript": "^7.0.2"
|
|
29
|
+
}
|
|
30
|
+
}
|