@krak-stack/registry 0.1.50 → 0.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 +34 -0
- package/README.md +16 -424
- package/dist/components/ui/data-table.d.ts +20 -1
- package/dist/components/ui/data-table.js +52 -1
- package/dist/lib/docs.js +2 -2
- package/dist/services/agent/client/index.js +1 -1
- package/dist/services/events/browser.d.ts +26 -0
- package/dist/services/events/browser.js +579 -0
- package/dist/services/events/client/audit-log-table.d.ts +53 -0
- package/dist/services/events/client/audit-log-table.js +3655 -0
- package/dist/services/events/index.d.ts +215 -0
- package/dist/services/events/index.js +1046 -0
- package/dist/services/events/migrations.d.ts +4 -0
- package/dist/services/events/migrations.js +42 -0
- package/dist/services/events/record.d.ts +3 -0
- package/dist/services/events/record.js +14 -0
- package/dist/services/events/request-context.d.ts +6 -0
- package/dist/services/events/schema.d.ts +237 -0
- package/dist/services/events/schema.js +361 -0
- package/dist/services/opentelemetry/api.d.ts +3 -1
- package/dist/services/opentelemetry/api.js +133 -64
- package/dist/services/opentelemetry/browser.d.ts +17 -20
- package/dist/services/opentelemetry/browser.js +58 -162
- package/dist/services/opentelemetry/events.d.ts +3 -1
- package/dist/services/opentelemetry/{server.d.ts → index.d.ts} +8 -5
- package/dist/services/opentelemetry/{server.js → index.js} +66 -48
- package/dist/services/opentelemetry/processor.d.ts +19 -0
- package/dist/services/opentelemetry/schema.d.ts +8 -20
- package/dist/services/opentelemetry/web-vitals.d.ts +15 -0
- package/dist/services/opentelemetry/web-vitals.js +229 -0
- package/package.json +35 -5
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { Context, DateTime, Effect, Layer, Redacted, Schema } from "effect";
|
|
2
|
+
import { HttpServerRequest } from "effect/http";
|
|
3
|
+
import { OtlpLogsProcessor, OtlpProcessingError } from "../opentelemetry/processor.js";
|
|
4
|
+
import { Otlp } from "../opentelemetry/index.js";
|
|
5
|
+
import { EventIdentity, EventGeolocation, EventConflictError, EventsPersistenceError } from "./schema.js";
|
|
6
|
+
export declare const SESSION_TIMEOUT_MS: number;
|
|
7
|
+
export type { EventGeolocation } from "./schema.js";
|
|
8
|
+
export { AuditTarget, TrackEvent, EventLogRecord, ListAudit } from "./schema.js";
|
|
9
|
+
export type EventGeolocationResolver = (request: HttpServerRequest.HttpServerRequest) => Effect.Effect<EventGeolocation | null, unknown>;
|
|
10
|
+
export interface EventsOptions {
|
|
11
|
+
/** Defaults to the server's OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES. */
|
|
12
|
+
readonly serviceName?: string;
|
|
13
|
+
readonly origin: string;
|
|
14
|
+
/** Reuse a stable application secret; never sent to the browser. */
|
|
15
|
+
readonly secret: Redacted.Redacted<string>;
|
|
16
|
+
/** Omit to disable. Cloudflare requires verified ingress with origin-bypass protection. */
|
|
17
|
+
readonly geolocation?: "cloudflare" | EventGeolocationResolver;
|
|
18
|
+
/** Optional fallback for non-annotation auth integrations. Request auth annotations take precedence. */
|
|
19
|
+
readonly identity?: (request: HttpServerRequest.HttpServerRequest) => Effect.Effect<EventIdentity | null, unknown>;
|
|
20
|
+
}
|
|
21
|
+
declare const EventsConfigurationError_base: Schema.Class<EventsConfigurationError, Schema.TaggedStruct<"EventsConfigurationError", {
|
|
22
|
+
readonly message: Schema.String;
|
|
23
|
+
}>, import("effect/Cause").YieldableError>;
|
|
24
|
+
export declare class EventsConfigurationError extends EventsConfigurationError_base {
|
|
25
|
+
}
|
|
26
|
+
export declare const dailyVisitorId: (input: {
|
|
27
|
+
readonly serviceName: string;
|
|
28
|
+
readonly ip: string;
|
|
29
|
+
readonly userAgent: string;
|
|
30
|
+
readonly day: string;
|
|
31
|
+
readonly secret: Redacted.Redacted<string>;
|
|
32
|
+
}) => string;
|
|
33
|
+
declare const Events_base: Context.ServiceClass<Events, "krakstack/events/Events", {
|
|
34
|
+
process: (body: Uint8Array<ArrayBufferLike>) => Effect.Effect<{
|
|
35
|
+
body: Uint8Array<ArrayBufferLike>;
|
|
36
|
+
persisted: boolean;
|
|
37
|
+
}, OtlpProcessingError, HttpServerRequest.HttpServerRequest>;
|
|
38
|
+
track: (input: {
|
|
39
|
+
readonly eventId?: string | undefined;
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly properties?: {
|
|
42
|
+
readonly [x: string]: string | number | boolean | readonly string[] | readonly number[] | readonly boolean[];
|
|
43
|
+
} | undefined;
|
|
44
|
+
readonly identity?: {
|
|
45
|
+
readonly userId?: string | undefined;
|
|
46
|
+
readonly organizationId?: string | undefined;
|
|
47
|
+
} | undefined;
|
|
48
|
+
readonly timestamp?: DateTime.Utc | undefined;
|
|
49
|
+
readonly category?: "analytics" | undefined;
|
|
50
|
+
} | {
|
|
51
|
+
readonly eventId?: string | undefined;
|
|
52
|
+
readonly name: string;
|
|
53
|
+
readonly properties?: {
|
|
54
|
+
readonly [x: string]: string | number | boolean | readonly string[] | readonly number[] | readonly boolean[];
|
|
55
|
+
} | undefined;
|
|
56
|
+
readonly identity?: {
|
|
57
|
+
readonly userId?: string | undefined;
|
|
58
|
+
readonly organizationId?: string | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
readonly timestamp?: DateTime.Utc | undefined;
|
|
61
|
+
readonly category: "audit";
|
|
62
|
+
readonly target: {
|
|
63
|
+
readonly id: string;
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly type: string;
|
|
66
|
+
};
|
|
67
|
+
}) => Effect.Effect<{
|
|
68
|
+
eventId: string;
|
|
69
|
+
inserted: boolean;
|
|
70
|
+
}, EventConflictError | EventsPersistenceError | Schema.SchemaError, never>;
|
|
71
|
+
listAudit: (input: {
|
|
72
|
+
readonly page?: string | number | undefined;
|
|
73
|
+
readonly pageSize?: string | number | undefined;
|
|
74
|
+
readonly globalFilter?: string | undefined;
|
|
75
|
+
readonly sort?: readonly {
|
|
76
|
+
readonly id: string;
|
|
77
|
+
readonly direction: "asc" | "desc";
|
|
78
|
+
}[] | undefined;
|
|
79
|
+
readonly organizationId: string;
|
|
80
|
+
}) => Effect.Effect<{
|
|
81
|
+
data: {
|
|
82
|
+
readonly eventName: string;
|
|
83
|
+
readonly timeUnixNano: string;
|
|
84
|
+
readonly observedTimeUnixNano?: string | undefined;
|
|
85
|
+
readonly severityNumber?: number | undefined;
|
|
86
|
+
readonly traceId?: string | undefined;
|
|
87
|
+
readonly spanId?: string | undefined;
|
|
88
|
+
readonly attributes: readonly {
|
|
89
|
+
readonly key: string;
|
|
90
|
+
readonly value: {
|
|
91
|
+
readonly stringValue: string;
|
|
92
|
+
} | {
|
|
93
|
+
readonly intValue: string | number;
|
|
94
|
+
} | {
|
|
95
|
+
readonly doubleValue: number;
|
|
96
|
+
} | {
|
|
97
|
+
readonly boolValue: boolean;
|
|
98
|
+
} | {
|
|
99
|
+
readonly arrayValue: {
|
|
100
|
+
readonly values: readonly ({
|
|
101
|
+
readonly stringValue: string;
|
|
102
|
+
} | {
|
|
103
|
+
readonly intValue: string | number;
|
|
104
|
+
} | {
|
|
105
|
+
readonly doubleValue: number;
|
|
106
|
+
} | {
|
|
107
|
+
readonly boolValue: boolean;
|
|
108
|
+
})[];
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
}[];
|
|
112
|
+
}[];
|
|
113
|
+
meta: {
|
|
114
|
+
page: number;
|
|
115
|
+
pageSize: number;
|
|
116
|
+
total: number;
|
|
117
|
+
pageCount: number;
|
|
118
|
+
};
|
|
119
|
+
}, EventsPersistenceError | import("effect/Cause").NoSuchElementError | Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
120
|
+
}> & {
|
|
121
|
+
readonly make: (options: EventsOptions) => Effect.Effect<{
|
|
122
|
+
process: (body: Uint8Array<ArrayBufferLike>) => Effect.Effect<{
|
|
123
|
+
body: Uint8Array<ArrayBufferLike>;
|
|
124
|
+
persisted: boolean;
|
|
125
|
+
}, OtlpProcessingError, HttpServerRequest.HttpServerRequest>;
|
|
126
|
+
track: (input: {
|
|
127
|
+
readonly eventId?: string | undefined;
|
|
128
|
+
readonly name: string;
|
|
129
|
+
readonly properties?: {
|
|
130
|
+
readonly [x: string]: string | number | boolean | readonly string[] | readonly number[] | readonly boolean[];
|
|
131
|
+
} | undefined;
|
|
132
|
+
readonly identity?: {
|
|
133
|
+
readonly userId?: string | undefined;
|
|
134
|
+
readonly organizationId?: string | undefined;
|
|
135
|
+
} | undefined;
|
|
136
|
+
readonly timestamp?: DateTime.Utc | undefined;
|
|
137
|
+
readonly category?: "analytics" | undefined;
|
|
138
|
+
} | {
|
|
139
|
+
readonly eventId?: string | undefined;
|
|
140
|
+
readonly name: string;
|
|
141
|
+
readonly properties?: {
|
|
142
|
+
readonly [x: string]: string | number | boolean | readonly string[] | readonly number[] | readonly boolean[];
|
|
143
|
+
} | undefined;
|
|
144
|
+
readonly identity?: {
|
|
145
|
+
readonly userId?: string | undefined;
|
|
146
|
+
readonly organizationId?: string | undefined;
|
|
147
|
+
} | undefined;
|
|
148
|
+
readonly timestamp?: DateTime.Utc | undefined;
|
|
149
|
+
readonly category: "audit";
|
|
150
|
+
readonly target: {
|
|
151
|
+
readonly id: string;
|
|
152
|
+
readonly name: string;
|
|
153
|
+
readonly type: string;
|
|
154
|
+
};
|
|
155
|
+
}) => Effect.Effect<{
|
|
156
|
+
eventId: string;
|
|
157
|
+
inserted: boolean;
|
|
158
|
+
}, EventConflictError | EventsPersistenceError | Schema.SchemaError, never>;
|
|
159
|
+
listAudit: (input: {
|
|
160
|
+
readonly page?: string | number | undefined;
|
|
161
|
+
readonly pageSize?: string | number | undefined;
|
|
162
|
+
readonly globalFilter?: string | undefined;
|
|
163
|
+
readonly sort?: readonly {
|
|
164
|
+
readonly id: string;
|
|
165
|
+
readonly direction: "asc" | "desc";
|
|
166
|
+
}[] | undefined;
|
|
167
|
+
readonly organizationId: string;
|
|
168
|
+
}) => Effect.Effect<{
|
|
169
|
+
data: {
|
|
170
|
+
readonly eventName: string;
|
|
171
|
+
readonly timeUnixNano: string;
|
|
172
|
+
readonly observedTimeUnixNano?: string | undefined;
|
|
173
|
+
readonly severityNumber?: number | undefined;
|
|
174
|
+
readonly traceId?: string | undefined;
|
|
175
|
+
readonly spanId?: string | undefined;
|
|
176
|
+
readonly attributes: readonly {
|
|
177
|
+
readonly key: string;
|
|
178
|
+
readonly value: {
|
|
179
|
+
readonly stringValue: string;
|
|
180
|
+
} | {
|
|
181
|
+
readonly intValue: string | number;
|
|
182
|
+
} | {
|
|
183
|
+
readonly doubleValue: number;
|
|
184
|
+
} | {
|
|
185
|
+
readonly boolValue: boolean;
|
|
186
|
+
} | {
|
|
187
|
+
readonly arrayValue: {
|
|
188
|
+
readonly values: readonly ({
|
|
189
|
+
readonly stringValue: string;
|
|
190
|
+
} | {
|
|
191
|
+
readonly intValue: string | number;
|
|
192
|
+
} | {
|
|
193
|
+
readonly doubleValue: number;
|
|
194
|
+
} | {
|
|
195
|
+
readonly boolValue: boolean;
|
|
196
|
+
})[];
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
}[];
|
|
200
|
+
}[];
|
|
201
|
+
meta: {
|
|
202
|
+
page: number;
|
|
203
|
+
pageSize: number;
|
|
204
|
+
total: number;
|
|
205
|
+
pageCount: number;
|
|
206
|
+
};
|
|
207
|
+
}, EventsPersistenceError | import("effect/Cause").NoSuchElementError | Schema.SchemaError | import("effect/sql/SqlError").SqlError, never>;
|
|
208
|
+
}, EventsConfigurationError, Otlp>;
|
|
209
|
+
};
|
|
210
|
+
export declare class Events extends Events_base {
|
|
211
|
+
static readonly baseLayer: (options: EventsOptions) => Layer.Layer<Events, EventsConfigurationError, Otlp>;
|
|
212
|
+
/** An injected PostgreSQL/SQLite SqlClient enables persistence and the initial migration. */
|
|
213
|
+
static readonly layer: (options: EventsOptions) => Layer.Layer<Events, EventsConfigurationError | import("effect/sql/Migrator").MigrationError | import("effect/sql/SqlError").SqlError, Otlp>;
|
|
214
|
+
static readonly ingestionLayer: Layer.Layer<OtlpLogsProcessor, never, Events>;
|
|
215
|
+
}
|