@timbereye/sdk 0.0.0-stage → 0.2.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/CHANGELOG.md +123 -0
- package/LICENSE +202 -0
- package/README.md +346 -2
- package/dist/cjs/case.d.ts +23 -0
- package/dist/cjs/case.js +54 -0
- package/dist/cjs/client.d.ts +98 -0
- package/dist/cjs/client.js +132 -0
- package/dist/cjs/errors.d.ts +63 -0
- package/dist/cjs/errors.js +107 -0
- package/dist/cjs/generated/schema.d.ts +14862 -0
- package/dist/cjs/generated/schema.js +6 -0
- package/dist/cjs/http.d.ts +104 -0
- package/dist/cjs/http.js +253 -0
- package/dist/cjs/index.d.ts +14 -0
- package/dist/cjs/index.js +29 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/pagination.d.ts +31 -0
- package/dist/cjs/pagination.js +52 -0
- package/dist/cjs/resources.d.ts +11195 -0
- package/dist/cjs/resources.js +506 -0
- package/dist/cjs/runtime.d.ts +20 -0
- package/dist/cjs/runtime.js +74 -0
- package/dist/cjs/types.d.ts +649 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/units.d.ts +26 -0
- package/dist/cjs/units.js +45 -0
- package/dist/cjs/webhooks.d.ts +67 -0
- package/dist/cjs/webhooks.js +213 -0
- package/dist/esm/case.d.ts +23 -0
- package/dist/esm/case.js +47 -0
- package/dist/esm/client.d.ts +98 -0
- package/dist/esm/client.js +128 -0
- package/dist/esm/errors.d.ts +63 -0
- package/dist/esm/errors.js +93 -0
- package/dist/esm/generated/schema.d.ts +14862 -0
- package/dist/esm/generated/schema.js +5 -0
- package/dist/esm/http.d.ts +104 -0
- package/dist/esm/http.js +247 -0
- package/dist/esm/index.d.ts +14 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/pagination.d.ts +31 -0
- package/dist/esm/pagination.js +49 -0
- package/dist/esm/resources.d.ts +11195 -0
- package/dist/esm/resources.js +503 -0
- package/dist/esm/runtime.d.ts +20 -0
- package/dist/esm/runtime.js +46 -0
- package/dist/esm/types.d.ts +649 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/units.d.ts +26 -0
- package/dist/esm/units.js +38 -0
- package/dist/esm/webhooks.d.ts +67 -0
- package/dist/esm/webhooks.js +208 -0
- package/package.json +51 -5
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
function resolve(u) {
|
|
2
|
+
return typeof u === "string" ? u : u.displayUnits;
|
|
3
|
+
}
|
|
4
|
+
export const M_PER_FOOT = 0.3048;
|
|
5
|
+
export const M_PER_INCH = 0.0254;
|
|
6
|
+
export const KG_PER_POUND = 0.45359237;
|
|
7
|
+
export const KG_PER_SHORT_TON = 907.18474;
|
|
8
|
+
export const M3_PER_CUBIC_FOOT = 0.028316846592;
|
|
9
|
+
function fmt(n, digits) {
|
|
10
|
+
return String(Number(n.toFixed(digits)));
|
|
11
|
+
}
|
|
12
|
+
/** Lengths: metres, or feet. */
|
|
13
|
+
export function formatLength(valueM, source, digits = 2) {
|
|
14
|
+
const units = resolve(source);
|
|
15
|
+
return units === "imperial" ? `${fmt(valueM / M_PER_FOOT, digits)} ft` : `${fmt(valueM, digits)} m`;
|
|
16
|
+
}
|
|
17
|
+
/** Diameters: centimetres, or inches. */
|
|
18
|
+
export function formatDiameter(valueM, source, digits = 1) {
|
|
19
|
+
const units = resolve(source);
|
|
20
|
+
return units === "imperial" ? `${fmt(valueM / M_PER_INCH, digits)} in` : `${fmt(valueM * 100, digits)} cm`;
|
|
21
|
+
}
|
|
22
|
+
/** Weights: kilograms below one tonne and tonnes above; pounds below one short ton and short tons above. */
|
|
23
|
+
export function formatWeight(valueKg, source, digits = 2) {
|
|
24
|
+
const units = resolve(source);
|
|
25
|
+
if (units === "imperial") {
|
|
26
|
+
return Math.abs(valueKg) >= KG_PER_SHORT_TON
|
|
27
|
+
? `${fmt(valueKg / KG_PER_SHORT_TON, digits)} short tons`
|
|
28
|
+
: `${fmt(valueKg / KG_PER_POUND, digits)} lb`;
|
|
29
|
+
}
|
|
30
|
+
return Math.abs(valueKg) >= 1000 ? `${fmt(valueKg / 1000, digits)} t` : `${fmt(valueKg, digits)} kg`;
|
|
31
|
+
}
|
|
32
|
+
/** Volumes: cubic metres, or cubic feet. Board-foot rule outputs are shown from `volume.native`, not converted. */
|
|
33
|
+
export function formatVolume(valueM3, source, digits = 3) {
|
|
34
|
+
const units = resolve(source);
|
|
35
|
+
return units === "imperial"
|
|
36
|
+
? `${fmt(valueM3 / M3_PER_CUBIC_FOOT, digits)} ft³`
|
|
37
|
+
: `${fmt(valueM3, digits)} m³`;
|
|
38
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { WebhookEvent } from "./types.js";
|
|
2
|
+
export type HeadersInput = {
|
|
3
|
+
get(name: string): string | null;
|
|
4
|
+
} | Record<string, string | string[] | undefined>;
|
|
5
|
+
export interface VerifyOptions {
|
|
6
|
+
/** Maximum age (and clock skew) of `webhook-timestamp` in seconds. Default 300. */
|
|
7
|
+
toleranceSeconds?: number;
|
|
8
|
+
/** Advanced (used by tests): the clock, in milliseconds. */
|
|
9
|
+
now?: () => number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A request a webhook arrived on, for `te.webhooks.verify(req)`:
|
|
13
|
+
*
|
|
14
|
+
* - a Fetch `Request` (Next.js route handlers, Hono, Cloudflare Workers, Deno, Bun): its body is read here;
|
|
15
|
+
* - a Node `IncomingMessage` (Express, Fastify, plain `http`) whose `body` is the raw bytes, as
|
|
16
|
+
* `express.raw({ type: "application/json" })` leaves it, or whose body has not been read by anything yet.
|
|
17
|
+
*/
|
|
18
|
+
export type WebhookRequest = {
|
|
19
|
+
headers: {
|
|
20
|
+
get(name: string): string | null;
|
|
21
|
+
};
|
|
22
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
23
|
+
bodyUsed?: boolean;
|
|
24
|
+
} | {
|
|
25
|
+
headers: Record<string, string | string[] | undefined>;
|
|
26
|
+
body?: unknown;
|
|
27
|
+
readableEnded?: boolean;
|
|
28
|
+
on?: (event: string, listener: (...args: any[]) => void) => unknown;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The raw body and headers of a webhook request, or a {@link WebhookSignatureError} (`raw_body_required`)
|
|
32
|
+
* that says how to get the raw body when the request's body was already parsed or consumed.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readWebhookRequest(req: WebhookRequest): Promise<{
|
|
35
|
+
body: Uint8Array | string;
|
|
36
|
+
headers: HeadersInput;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Verify a Standard Webhooks delivery and return the event. Pass the raw body exactly as received
|
|
40
|
+
* (string, Uint8Array, a Node buffer or ArrayBuffer), never a re-serialised parse.
|
|
41
|
+
*
|
|
42
|
+
* It is async because Web Crypto is: `await te.webhooks.verify(...)`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function verifyWebhook(rawBody: string | Uint8Array | ArrayBuffer, headers: HeadersInput, secret: string | string[], options?: VerifyOptions): Promise<WebhookEvent>;
|
|
45
|
+
/** What {@link generateTestWebhookHeaders} signs. */
|
|
46
|
+
export interface TestWebhookParams {
|
|
47
|
+
/** The raw body to sign, exactly as your handler will receive it (a string or bytes, not an object). */
|
|
48
|
+
payload: string | Uint8Array | ArrayBuffer;
|
|
49
|
+
/** The `whsec_…` secret your handler verifies with. */
|
|
50
|
+
secret: string;
|
|
51
|
+
/** `webhook-id`. Default: the payload's `id` when it is an event (as in a real delivery), else `msg_` and random hex. */
|
|
52
|
+
id?: string;
|
|
53
|
+
/** `webhook-timestamp`, in Unix seconds. Default: now. Pass an old one to test your handler's tolerance. */
|
|
54
|
+
timestamp?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The headers Timbereye would send with `payload`, signed with `secret` (Standard Webhooks: `webhook-id`,
|
|
58
|
+
* `webhook-timestamp`, `webhook-signature`), for testing your webhook handler without the network. `verifyWebhook`
|
|
59
|
+
* accepts them. Never use it to accept a request: it signs, it does not check.
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* const body = JSON.stringify(event)
|
|
63
|
+
* const headers = await generateTestWebhookHeaders({ payload: body, secret: "whsec_…" })
|
|
64
|
+
* await handler(new Request("http://localhost/webhooks", { method: "POST", body, headers }))
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function generateTestWebhookHeaders(params: TestWebhookParams): Promise<Record<string, string>>;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { toCamel } from "./case.js";
|
|
2
|
+
import { WebhookSignatureError } from "./errors.js";
|
|
3
|
+
import { getWebCrypto, randomUUID } from "./runtime.js";
|
|
4
|
+
function header(headers, name) {
|
|
5
|
+
if (typeof headers.get === "function") {
|
|
6
|
+
return headers.get(name) ?? undefined;
|
|
7
|
+
}
|
|
8
|
+
for (const [k, v] of Object.entries(headers)) {
|
|
9
|
+
if (k.toLowerCase() === name)
|
|
10
|
+
return Array.isArray(v) ? v.join(" ") : v;
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
function b64decode(s) {
|
|
15
|
+
const bin = atob(s);
|
|
16
|
+
const out = new Uint8Array(bin.length);
|
|
17
|
+
for (let i = 0; i < bin.length; i++)
|
|
18
|
+
out[i] = bin.charCodeAt(i);
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
const RAW_BODY_HELP = "Webhook signatures are computed over the exact bytes Timbereye sent, so verify needs the raw body. " +
|
|
22
|
+
"In Express, give the webhook route the raw parser instead of express.json(): " +
|
|
23
|
+
'app.post("/webhooks/timbereye", express.raw({ type: "application/json" }), handler). ' +
|
|
24
|
+
"Or call verify(rawBody, headers, secret) with the body as received.";
|
|
25
|
+
function isBytes(value) {
|
|
26
|
+
return value instanceof Uint8Array || value instanceof ArrayBuffer;
|
|
27
|
+
}
|
|
28
|
+
function isFetchRequest(req) {
|
|
29
|
+
return (typeof req.arrayBuffer === "function" &&
|
|
30
|
+
typeof req.headers.get === "function");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The raw body and headers of a webhook request, or a {@link WebhookSignatureError} (`raw_body_required`)
|
|
34
|
+
* that says how to get the raw body when the request's body was already parsed or consumed.
|
|
35
|
+
*/
|
|
36
|
+
export async function readWebhookRequest(req) {
|
|
37
|
+
if (req === null || typeof req !== "object" || req.headers === undefined) {
|
|
38
|
+
throw new WebhookSignatureError("invalid_request", "verify(req) needs a Fetch Request or a Node request with headers.");
|
|
39
|
+
}
|
|
40
|
+
if (isFetchRequest(req)) {
|
|
41
|
+
if (req.bodyUsed === true) {
|
|
42
|
+
throw new WebhookSignatureError("raw_body_required", `The request's body was already read. ${RAW_BODY_HELP}`);
|
|
43
|
+
}
|
|
44
|
+
return { body: new Uint8Array(await req.arrayBuffer()), headers: req.headers };
|
|
45
|
+
}
|
|
46
|
+
const node = req;
|
|
47
|
+
const body = node.body;
|
|
48
|
+
if (typeof body === "string" || isBytes(body)) {
|
|
49
|
+
return { body: body instanceof ArrayBuffer ? new Uint8Array(body) : body, headers: node.headers };
|
|
50
|
+
}
|
|
51
|
+
if (body !== undefined && body !== null && typeof body === "object" && Object.keys(body).length === 0) {
|
|
52
|
+
// express.raw and express.json leave {} when the content type did not match them.
|
|
53
|
+
throw new WebhookSignatureError("raw_body_required", `req.body is an empty object: no raw parser read this request (check its type option). ${RAW_BODY_HELP}`);
|
|
54
|
+
}
|
|
55
|
+
if (body !== undefined && body !== null) {
|
|
56
|
+
throw new WebhookSignatureError("raw_body_required", `The request's body was already parsed (req.body is ${Array.isArray(body) ? "an array" : typeof body}). ${RAW_BODY_HELP}`);
|
|
57
|
+
}
|
|
58
|
+
if (typeof node.on === "function" && node.readableEnded !== true) {
|
|
59
|
+
const bytes = await new Promise((resolve, reject) => {
|
|
60
|
+
const chunks = [];
|
|
61
|
+
node.on("data", (chunk) => chunks.push(typeof chunk === "string" ? new TextEncoder().encode(chunk) : chunk));
|
|
62
|
+
node.on("end", () => {
|
|
63
|
+
const out = new Uint8Array(chunks.reduce((n, c) => n + c.length, 0));
|
|
64
|
+
let offset = 0;
|
|
65
|
+
for (const c of chunks) {
|
|
66
|
+
out.set(c, offset);
|
|
67
|
+
offset += c.length;
|
|
68
|
+
}
|
|
69
|
+
resolve(out);
|
|
70
|
+
});
|
|
71
|
+
node.on("error", reject);
|
|
72
|
+
});
|
|
73
|
+
return { body: bytes, headers: node.headers };
|
|
74
|
+
}
|
|
75
|
+
throw new WebhookSignatureError("raw_body_required", `The request has no body to verify. ${RAW_BODY_HELP}`);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Verify a Standard Webhooks delivery and return the event. Pass the raw body exactly as received
|
|
79
|
+
* (string, Uint8Array, a Node buffer or ArrayBuffer), never a re-serialised parse.
|
|
80
|
+
*
|
|
81
|
+
* It is async because Web Crypto is: `await te.webhooks.verify(...)`.
|
|
82
|
+
*/
|
|
83
|
+
export async function verifyWebhook(rawBody, headers, secret, options = {}) {
|
|
84
|
+
const id = header(headers, "webhook-id");
|
|
85
|
+
const timestamp = header(headers, "webhook-timestamp");
|
|
86
|
+
const signature = header(headers, "webhook-signature");
|
|
87
|
+
if (!id || !timestamp || !signature) {
|
|
88
|
+
throw new WebhookSignatureError("missing_headers", "Missing webhook-id, webhook-timestamp or webhook-signature header");
|
|
89
|
+
}
|
|
90
|
+
if (!/^\d+$/.test(timestamp))
|
|
91
|
+
throw new WebhookSignatureError("invalid_timestamp", "webhook-timestamp is not an integer");
|
|
92
|
+
const tolerance = options.toleranceSeconds ?? 300;
|
|
93
|
+
const nowSeconds = Math.floor((options.now ?? Date.now)() / 1000);
|
|
94
|
+
if (Math.abs(nowSeconds - Number(timestamp)) > tolerance) {
|
|
95
|
+
throw new WebhookSignatureError("timestamp_out_of_tolerance", "webhook-timestamp is outside the tolerance window");
|
|
96
|
+
}
|
|
97
|
+
const bodyBytes = typeof rawBody === "string"
|
|
98
|
+
? new TextEncoder().encode(rawBody)
|
|
99
|
+
: rawBody instanceof Uint8Array
|
|
100
|
+
? rawBody
|
|
101
|
+
: new Uint8Array(rawBody);
|
|
102
|
+
const prefix = new TextEncoder().encode(`${id}.${timestamp}.`);
|
|
103
|
+
const signed = new Uint8Array(prefix.length + bodyBytes.length);
|
|
104
|
+
signed.set(prefix);
|
|
105
|
+
signed.set(bodyBytes, prefix.length);
|
|
106
|
+
// Candidate signatures: "v1,<base64>" entries separated by spaces; other versions are ignored.
|
|
107
|
+
const candidates = [];
|
|
108
|
+
for (const part of signature.split(" ")) {
|
|
109
|
+
const [version, value] = part.split(",", 2);
|
|
110
|
+
if (version !== "v1" || !value)
|
|
111
|
+
continue;
|
|
112
|
+
try {
|
|
113
|
+
candidates.push(b64decode(value));
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// malformed base64: cannot match
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const crypto = await getWebCrypto();
|
|
120
|
+
const secrets = Array.isArray(secret) ? secret : [secret];
|
|
121
|
+
let valid = false;
|
|
122
|
+
for (const s of secrets) {
|
|
123
|
+
let keyBytes;
|
|
124
|
+
try {
|
|
125
|
+
keyBytes = b64decode(s.startsWith("whsec_") ? s.slice(6) : s);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
throw new WebhookSignatureError("invalid_secret", "Webhook secret is not whsec_<base64>");
|
|
129
|
+
}
|
|
130
|
+
const key = await crypto.subtle.importKey("raw", keyBytes, { name: "HMAC", hash: "SHA-256" }, false, ["verify"]);
|
|
131
|
+
for (const sig of candidates) {
|
|
132
|
+
// subtle.verify compares in constant time.
|
|
133
|
+
if (await crypto.subtle.verify("HMAC", key, sig, signed))
|
|
134
|
+
valid = true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (!valid)
|
|
138
|
+
throw new WebhookSignatureError("signature_mismatch", "No matching signature found for the payload");
|
|
139
|
+
try {
|
|
140
|
+
return toCamel(JSON.parse(new TextDecoder().decode(bodyBytes)));
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
throw new WebhookSignatureError("invalid_payload", "Webhook body is not valid JSON");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function bytesOf(payload) {
|
|
147
|
+
return typeof payload === "string"
|
|
148
|
+
? new TextEncoder().encode(payload)
|
|
149
|
+
: payload instanceof Uint8Array
|
|
150
|
+
? payload
|
|
151
|
+
: new Uint8Array(payload);
|
|
152
|
+
}
|
|
153
|
+
function b64encode(bytes) {
|
|
154
|
+
let bin = "";
|
|
155
|
+
for (let i = 0; i < bytes.length; i++)
|
|
156
|
+
bin += String.fromCharCode(bytes[i]);
|
|
157
|
+
return btoa(bin);
|
|
158
|
+
}
|
|
159
|
+
function defaultMessageId(body) {
|
|
160
|
+
try {
|
|
161
|
+
const parsed = JSON.parse(new TextDecoder().decode(body));
|
|
162
|
+
if (typeof parsed?.id === "string" && parsed.id !== "")
|
|
163
|
+
return parsed.id;
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// not JSON: a random id
|
|
167
|
+
}
|
|
168
|
+
return `msg_${randomUUID().replace(/-/g, "").slice(0, 24)}`;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* The headers Timbereye would send with `payload`, signed with `secret` (Standard Webhooks: `webhook-id`,
|
|
172
|
+
* `webhook-timestamp`, `webhook-signature`), for testing your webhook handler without the network. `verifyWebhook`
|
|
173
|
+
* accepts them. Never use it to accept a request: it signs, it does not check.
|
|
174
|
+
*
|
|
175
|
+
* ```ts
|
|
176
|
+
* const body = JSON.stringify(event)
|
|
177
|
+
* const headers = await generateTestWebhookHeaders({ payload: body, secret: "whsec_…" })
|
|
178
|
+
* await handler(new Request("http://localhost/webhooks", { method: "POST", body, headers }))
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
export async function generateTestWebhookHeaders(params) {
|
|
182
|
+
const { secret } = params;
|
|
183
|
+
if (typeof secret !== "string" || secret === "")
|
|
184
|
+
throw new WebhookSignatureError("invalid_secret", "generateTestWebhookHeaders needs the whsec_… secret");
|
|
185
|
+
const body = bytesOf(params.payload);
|
|
186
|
+
const id = params.id ?? defaultMessageId(body);
|
|
187
|
+
const timestamp = String(Math.floor(params.timestamp ?? Date.now() / 1000));
|
|
188
|
+
let keyBytes;
|
|
189
|
+
try {
|
|
190
|
+
keyBytes = b64decode(secret.startsWith("whsec_") ? secret.slice(6) : secret);
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
throw new WebhookSignatureError("invalid_secret", "Webhook secret is not whsec_<base64>");
|
|
194
|
+
}
|
|
195
|
+
const prefix = new TextEncoder().encode(`${id}.${timestamp}.`);
|
|
196
|
+
const signed = new Uint8Array(prefix.length + body.length);
|
|
197
|
+
signed.set(prefix);
|
|
198
|
+
signed.set(body, prefix.length);
|
|
199
|
+
const crypto = await getWebCrypto();
|
|
200
|
+
const key = await crypto.subtle.importKey("raw", keyBytes, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
201
|
+
const signature = new Uint8Array(await crypto.subtle.sign("HMAC", key, signed));
|
|
202
|
+
return {
|
|
203
|
+
"content-type": "application/json",
|
|
204
|
+
"webhook-id": id,
|
|
205
|
+
"webhook-timestamp": timestamp,
|
|
206
|
+
"webhook-signature": `v1,${b64encode(signature)}`,
|
|
207
|
+
};
|
|
208
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@timbereye/sdk",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "TypeScript SDK for the Timbereye API: measurements of logs and loads, groups, scans, places and webhooks.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/cjs/index.js",
|
|
8
|
+
"types": "./dist/esm/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/esm/index.d.ts",
|
|
13
|
+
"default": "./dist/esm/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/cjs/index.d.ts",
|
|
17
|
+
"default": "./dist/cjs/index.js"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"CHANGELOG.md"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"timbereye",
|
|
33
|
+
"forestry",
|
|
34
|
+
"logs",
|
|
35
|
+
"timber",
|
|
36
|
+
"measurement",
|
|
37
|
+
"sdk"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"generate": "node scripts/generate.mjs",
|
|
41
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && tsc -p tsconfig.cjs.json && node -e \"require('fs').writeFileSync('dist/cjs/package.json','{\\\"type\\\":\\\"commonjs\\\"}\\n')\"",
|
|
42
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
43
|
+
"test": "mocha",
|
|
44
|
+
"prepack": "npm run build"
|
|
45
|
+
},
|
|
46
|
+
"module": "./dist/esm/index.js",
|
|
47
|
+
"author": "Timbereye",
|
|
48
|
+
"homepage": "https://www.timbereye.com/docs/typescript-sdk/",
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
}
|
|
52
|
+
}
|