@owlmetry/node 0.1.4 → 0.1.6
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 +21 -0
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.js +4 -4
- package/dist/src/operation.d.ts +1 -1
- package/dist/src/operation.js +1 -1
- package/dist/src/types.d.ts +2 -2
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Adapted Hub LLC
|
|
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/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { OwlConfiguration } from "./types.js";
|
|
2
|
-
import {
|
|
3
|
-
export type { OwlConfiguration,
|
|
4
|
-
export {
|
|
2
|
+
import { OwlOperation } from "./operation.js";
|
|
3
|
+
export type { OwlConfiguration, OwlLogLevel, LogEvent } from "./types.js";
|
|
4
|
+
export { OwlOperation } from "./operation.js";
|
|
5
5
|
/**
|
|
6
6
|
* A scoped logger instance that automatically sets a user ID on all events.
|
|
7
7
|
*/
|
|
@@ -22,7 +22,7 @@ export declare class ScopedOwl {
|
|
|
22
22
|
* numbers, and hyphens (e.g. "photo-conversion", "api-request"). Invalid characters
|
|
23
23
|
* are auto-corrected with a warning logged in debug mode.
|
|
24
24
|
*/
|
|
25
|
-
startOperation(metric: string, attrs?: Record<string, unknown>):
|
|
25
|
+
startOperation(metric: string, attrs?: Record<string, unknown>): OwlOperation;
|
|
26
26
|
/**
|
|
27
27
|
* Record a single-shot metric. The `metric` slug should contain only lowercase letters,
|
|
28
28
|
* numbers, and hyphens (e.g. "onboarding", "checkout"). Invalid characters are
|
|
@@ -76,7 +76,7 @@ export declare const Owl: {
|
|
|
76
76
|
* numbers, and hyphens (e.g. "photo-conversion", "api-request"). Invalid characters
|
|
77
77
|
* are auto-corrected with a warning logged in debug mode.
|
|
78
78
|
*/
|
|
79
|
-
startOperation(metric: string, attrs?: Record<string, unknown>):
|
|
79
|
+
startOperation(metric: string, attrs?: Record<string, unknown>): OwlOperation;
|
|
80
80
|
/**
|
|
81
81
|
* Record a single-shot metric. The `metric` slug should contain only lowercase letters,
|
|
82
82
|
* numbers, and hyphens (e.g. "onboarding", "checkout"). Invalid characters are
|
package/dist/src/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { join } from "node:path";
|
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { validateConfiguration } from "./configuration.js";
|
|
6
6
|
import { Transport } from "./transport.js";
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
7
|
+
import { OwlOperation } from "./operation.js";
|
|
8
|
+
export { OwlOperation } from "./operation.js";
|
|
9
9
|
const MAX_ATTRIBUTE_VALUE_LENGTH = 200;
|
|
10
10
|
const SLUG_REGEX = /^[a-z0-9-]+$/;
|
|
11
11
|
const TRACK_MESSAGE_PREFIX = "track:";
|
|
@@ -159,7 +159,7 @@ export class ScopedOwl {
|
|
|
159
159
|
* are auto-corrected with a warning logged in debug mode.
|
|
160
160
|
*/
|
|
161
161
|
startOperation(metric, attrs) {
|
|
162
|
-
return new
|
|
162
|
+
return new OwlOperation(log, normalizeSlug(metric), attrs, this.userId);
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
165
|
* Record a single-shot metric. The `metric` slug should contain only lowercase letters,
|
|
@@ -271,7 +271,7 @@ export const Owl = {
|
|
|
271
271
|
* are auto-corrected with a warning logged in debug mode.
|
|
272
272
|
*/
|
|
273
273
|
startOperation(metric, attrs) {
|
|
274
|
-
return new
|
|
274
|
+
return new OwlOperation(log, normalizeSlug(metric), attrs);
|
|
275
275
|
},
|
|
276
276
|
/**
|
|
277
277
|
* Record a single-shot metric. The `metric` slug should contain only lowercase letters,
|
package/dist/src/operation.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type LogFn = (level: "info" | "error", message: string, attrs?: Record<st
|
|
|
3
3
|
* Tracks a metric operation lifecycle (start → complete/fail/cancel).
|
|
4
4
|
* Created by `Owl.startOperation()` or `ScopedOwl.startOperation()`.
|
|
5
5
|
*/
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class OwlOperation {
|
|
7
7
|
readonly trackingId: string;
|
|
8
8
|
private metric;
|
|
9
9
|
private startTime;
|
package/dist/src/operation.js
CHANGED
|
@@ -3,7 +3,7 @@ import { randomUUID } from "node:crypto";
|
|
|
3
3
|
* Tracks a metric operation lifecycle (start → complete/fail/cancel).
|
|
4
4
|
* Created by `Owl.startOperation()` or `ScopedOwl.startOperation()`.
|
|
5
5
|
*/
|
|
6
|
-
export class
|
|
6
|
+
export class OwlOperation {
|
|
7
7
|
trackingId;
|
|
8
8
|
metric;
|
|
9
9
|
startTime;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type OwlLogLevel = "info" | "debug" | "warn" | "error";
|
|
2
2
|
export interface OwlConfiguration {
|
|
3
3
|
/** OwlMetry server endpoint URL */
|
|
4
4
|
endpoint: string;
|
|
@@ -23,7 +23,7 @@ export interface LogEvent {
|
|
|
23
23
|
client_event_id: string;
|
|
24
24
|
session_id: string;
|
|
25
25
|
user_id?: string;
|
|
26
|
-
level:
|
|
26
|
+
level: OwlLogLevel;
|
|
27
27
|
source_module?: string;
|
|
28
28
|
message: string;
|
|
29
29
|
custom_attributes?: Record<string, string>;
|