@krak-stack/registry 0.1.51 → 0.1.53
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 +26 -0
- package/dist/components/ui/data-table.d.ts +20 -1
- package/dist/components/ui/data-table.js +52 -1
- package/dist/services/events/browser.js +269 -113
- 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 +147 -11
- package/dist/services/events/index.js +442 -173
- package/dist/services/events/record.d.ts +3 -0
- package/dist/services/events/record.js +14 -0
- package/dist/services/events/schema.d.ts +47 -6
- package/dist/services/events/schema.js +361 -0
- package/package.json +13 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Context, DateTime, Effect, Layer, Redacted, Schema } from "effect";
|
|
1
|
+
import { Config, Context, Crypto, DateTime, Effect, Layer, Redacted, Schema } from "effect";
|
|
2
2
|
import { HttpServerRequest } from "effect/http";
|
|
3
3
|
import { OtlpLogsProcessor, OtlpProcessingError } from "../opentelemetry/processor.js";
|
|
4
4
|
import { Otlp } from "../opentelemetry/index.js";
|
|
5
5
|
import { EventIdentity, EventGeolocation, EventConflictError, EventsPersistenceError } from "./schema.js";
|
|
6
6
|
export declare const SESSION_TIMEOUT_MS: number;
|
|
7
7
|
export type { EventGeolocation } from "./schema.js";
|
|
8
|
+
export { AuditTarget, TrackEvent, EventLogRecord, ListAudit } from "./schema.js";
|
|
8
9
|
export type EventGeolocationResolver = (request: HttpServerRequest.HttpServerRequest) => Effect.Effect<EventGeolocation | null, unknown>;
|
|
9
10
|
export interface EventsOptions {
|
|
10
11
|
/** Defaults to the server's OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES. */
|
|
@@ -28,14 +29,14 @@ export declare const dailyVisitorId: (input: {
|
|
|
28
29
|
readonly userAgent: string;
|
|
29
30
|
readonly day: string;
|
|
30
31
|
readonly secret: Redacted.Redacted<string>;
|
|
31
|
-
}) => string
|
|
32
|
+
}) => Effect.Effect<string, import("effect/PlatformError").PlatformError, Crypto.Crypto>;
|
|
32
33
|
declare const Events_base: Context.ServiceClass<Events, "krakstack/events/Events", {
|
|
33
34
|
process: (body: Uint8Array<ArrayBufferLike>) => Effect.Effect<{
|
|
34
35
|
body: Uint8Array<ArrayBufferLike>;
|
|
35
36
|
persisted: boolean;
|
|
36
37
|
}, OtlpProcessingError, HttpServerRequest.HttpServerRequest>;
|
|
37
38
|
track: (input: {
|
|
38
|
-
readonly eventId
|
|
39
|
+
readonly eventId?: string | undefined;
|
|
39
40
|
readonly name: string;
|
|
40
41
|
readonly properties?: {
|
|
41
42
|
readonly [x: string]: string | number | boolean | readonly string[] | readonly number[] | readonly boolean[];
|
|
@@ -45,11 +46,77 @@ declare const Events_base: Context.ServiceClass<Events, "krakstack/events/Events
|
|
|
45
46
|
readonly organizationId?: string | undefined;
|
|
46
47
|
} | undefined;
|
|
47
48
|
readonly timestamp?: DateTime.Utc | undefined;
|
|
48
|
-
readonly category?: "analytics" |
|
|
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
|
+
};
|
|
49
67
|
}) => Effect.Effect<{
|
|
50
68
|
eventId: string;
|
|
51
69
|
inserted: boolean;
|
|
52
|
-
}, EventConflictError | EventsPersistenceError | Schema.SchemaError, never>;
|
|
70
|
+
}, EventConflictError | EventsPersistenceError | import("effect/PlatformError").PlatformError | 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>;
|
|
53
120
|
}> & {
|
|
54
121
|
readonly make: (options: EventsOptions) => Effect.Effect<{
|
|
55
122
|
process: (body: Uint8Array<ArrayBufferLike>) => Effect.Effect<{
|
|
@@ -57,7 +124,7 @@ declare const Events_base: Context.ServiceClass<Events, "krakstack/events/Events
|
|
|
57
124
|
persisted: boolean;
|
|
58
125
|
}, OtlpProcessingError, HttpServerRequest.HttpServerRequest>;
|
|
59
126
|
track: (input: {
|
|
60
|
-
readonly eventId
|
|
127
|
+
readonly eventId?: string | undefined;
|
|
61
128
|
readonly name: string;
|
|
62
129
|
readonly properties?: {
|
|
63
130
|
readonly [x: string]: string | number | boolean | readonly string[] | readonly number[] | readonly boolean[];
|
|
@@ -67,16 +134,85 @@ declare const Events_base: Context.ServiceClass<Events, "krakstack/events/Events
|
|
|
67
134
|
readonly organizationId?: string | undefined;
|
|
68
135
|
} | undefined;
|
|
69
136
|
readonly timestamp?: DateTime.Utc | undefined;
|
|
70
|
-
readonly category?: "analytics" |
|
|
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
|
+
};
|
|
71
155
|
}) => Effect.Effect<{
|
|
72
156
|
eventId: string;
|
|
73
157
|
inserted: boolean;
|
|
74
|
-
}, EventConflictError | EventsPersistenceError | Schema.SchemaError, never>;
|
|
75
|
-
|
|
158
|
+
}, EventConflictError | EventsPersistenceError | import("effect/PlatformError").PlatformError | 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, Crypto.Crypto | Otlp>;
|
|
76
209
|
};
|
|
77
210
|
export declare class Events extends Events_base {
|
|
78
|
-
|
|
211
|
+
/** Missing options resolve from APP_SECRET, VITE_SITE_URL and Otlp. */
|
|
212
|
+
static readonly baseLayerWith: (options?: Partial<EventsOptions>) => Layer.Layer<Events, Config.ConfigError | EventsConfigurationError, Crypto.Crypto | Otlp>;
|
|
213
|
+
static readonly baseLayer: Layer.Layer<Events, Config.ConfigError | EventsConfigurationError, Crypto.Crypto | Otlp>;
|
|
79
214
|
/** An injected PostgreSQL/SQLite SqlClient enables persistence and the initial migration. */
|
|
80
|
-
static readonly
|
|
215
|
+
static readonly layerWith: (options?: Partial<EventsOptions>) => Layer.Layer<Events, Config.ConfigError | EventsConfigurationError | import("effect/sql/Migrator").MigrationError | import("effect/sql/SqlError").SqlError, Crypto.Crypto | Otlp>;
|
|
216
|
+
static readonly layer: Layer.Layer<Events, Config.ConfigError | EventsConfigurationError | import("effect/sql/Migrator").MigrationError | import("effect/sql/SqlError").SqlError, Crypto.Crypto | Otlp>;
|
|
81
217
|
static readonly ingestionLayer: Layer.Layer<OtlpLogsProcessor, never, Events>;
|
|
82
218
|
}
|