@spfn/monitor 0.1.0-beta.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.
@@ -0,0 +1,57 @@
1
+ CREATE SCHEMA "spfn_monitor";
2
+ --> statement-breakpoint
3
+ CREATE TABLE "spfn_monitor"."error_events" (
4
+ "id" bigserial PRIMARY KEY NOT NULL,
5
+ "group_id" bigserial NOT NULL,
6
+ "request_id" text,
7
+ "user_id" text,
8
+ "status_code" integer NOT NULL,
9
+ "headers" jsonb,
10
+ "query" jsonb,
11
+ "stack_trace" text,
12
+ "metadata" jsonb,
13
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
14
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
15
+ );
16
+ --> statement-breakpoint
17
+ CREATE TABLE "spfn_monitor"."error_groups" (
18
+ "id" bigserial PRIMARY KEY NOT NULL,
19
+ "fingerprint" text NOT NULL,
20
+ "name" text NOT NULL,
21
+ "message" text NOT NULL,
22
+ "path" text NOT NULL,
23
+ "method" text NOT NULL,
24
+ "status_code" integer NOT NULL,
25
+ "status" text DEFAULT 'active' NOT NULL,
26
+ "count" integer DEFAULT 1 NOT NULL,
27
+ "first_seen_at" timestamp with time zone NOT NULL,
28
+ "last_seen_at" timestamp with time zone NOT NULL,
29
+ "resolved_at" timestamp with time zone,
30
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
31
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
32
+ CONSTRAINT "error_groups_fingerprint_unique" UNIQUE("fingerprint")
33
+ );
34
+ --> statement-breakpoint
35
+ CREATE TABLE "spfn_monitor"."logs" (
36
+ "id" bigserial PRIMARY KEY NOT NULL,
37
+ "level" text NOT NULL,
38
+ "message" text NOT NULL,
39
+ "source" text,
40
+ "request_id" text,
41
+ "user_id" text,
42
+ "metadata" jsonb,
43
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
44
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
45
+ );
46
+ --> statement-breakpoint
47
+ ALTER TABLE "spfn_monitor"."error_events" ADD CONSTRAINT "error_events_group_id_error_groups_id_fk" FOREIGN KEY ("group_id") REFERENCES "spfn_monitor"."error_groups"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
48
+ CREATE INDEX "monitor_ee_group_id_idx" ON "spfn_monitor"."error_events" USING btree ("group_id");--> statement-breakpoint
49
+ CREATE INDEX "monitor_ee_created_at_idx" ON "spfn_monitor"."error_events" USING btree ("created_at");--> statement-breakpoint
50
+ CREATE INDEX "monitor_ee_user_id_idx" ON "spfn_monitor"."error_events" USING btree ("user_id");--> statement-breakpoint
51
+ CREATE INDEX "monitor_eg_fingerprint_idx" ON "spfn_monitor"."error_groups" USING btree ("fingerprint");--> statement-breakpoint
52
+ CREATE INDEX "monitor_eg_status_idx" ON "spfn_monitor"."error_groups" USING btree ("status");--> statement-breakpoint
53
+ CREATE INDEX "monitor_eg_last_seen_at_idx" ON "spfn_monitor"."error_groups" USING btree ("last_seen_at");--> statement-breakpoint
54
+ CREATE INDEX "monitor_eg_path_idx" ON "spfn_monitor"."error_groups" USING btree ("path");--> statement-breakpoint
55
+ CREATE INDEX "monitor_log_level_idx" ON "spfn_monitor"."logs" USING btree ("level");--> statement-breakpoint
56
+ CREATE INDEX "monitor_log_source_idx" ON "spfn_monitor"."logs" USING btree ("source");--> statement-breakpoint
57
+ CREATE INDEX "monitor_log_created_at_idx" ON "spfn_monitor"."logs" USING btree ("created_at");
@@ -0,0 +1,448 @@
1
+ {
2
+ "id": "c4e0ee8f-f83c-4e94-80c3-11bc2a0fa671",
3
+ "prevId": "00000000-0000-0000-0000-000000000000",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "spfn_monitor.error_events": {
8
+ "name": "error_events",
9
+ "schema": "spfn_monitor",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "bigserial",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "group_id": {
18
+ "name": "group_id",
19
+ "type": "bigserial",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "request_id": {
24
+ "name": "request_id",
25
+ "type": "text",
26
+ "primaryKey": false,
27
+ "notNull": false
28
+ },
29
+ "user_id": {
30
+ "name": "user_id",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": false
34
+ },
35
+ "status_code": {
36
+ "name": "status_code",
37
+ "type": "integer",
38
+ "primaryKey": false,
39
+ "notNull": true
40
+ },
41
+ "headers": {
42
+ "name": "headers",
43
+ "type": "jsonb",
44
+ "primaryKey": false,
45
+ "notNull": false
46
+ },
47
+ "query": {
48
+ "name": "query",
49
+ "type": "jsonb",
50
+ "primaryKey": false,
51
+ "notNull": false
52
+ },
53
+ "stack_trace": {
54
+ "name": "stack_trace",
55
+ "type": "text",
56
+ "primaryKey": false,
57
+ "notNull": false
58
+ },
59
+ "metadata": {
60
+ "name": "metadata",
61
+ "type": "jsonb",
62
+ "primaryKey": false,
63
+ "notNull": false
64
+ },
65
+ "created_at": {
66
+ "name": "created_at",
67
+ "type": "timestamp with time zone",
68
+ "primaryKey": false,
69
+ "notNull": true,
70
+ "default": "now()"
71
+ },
72
+ "updated_at": {
73
+ "name": "updated_at",
74
+ "type": "timestamp with time zone",
75
+ "primaryKey": false,
76
+ "notNull": true,
77
+ "default": "now()"
78
+ }
79
+ },
80
+ "indexes": {
81
+ "monitor_ee_group_id_idx": {
82
+ "name": "monitor_ee_group_id_idx",
83
+ "columns": [
84
+ {
85
+ "expression": "group_id",
86
+ "isExpression": false,
87
+ "asc": true,
88
+ "nulls": "last"
89
+ }
90
+ ],
91
+ "isUnique": false,
92
+ "concurrently": false,
93
+ "method": "btree",
94
+ "with": {}
95
+ },
96
+ "monitor_ee_created_at_idx": {
97
+ "name": "monitor_ee_created_at_idx",
98
+ "columns": [
99
+ {
100
+ "expression": "created_at",
101
+ "isExpression": false,
102
+ "asc": true,
103
+ "nulls": "last"
104
+ }
105
+ ],
106
+ "isUnique": false,
107
+ "concurrently": false,
108
+ "method": "btree",
109
+ "with": {}
110
+ },
111
+ "monitor_ee_user_id_idx": {
112
+ "name": "monitor_ee_user_id_idx",
113
+ "columns": [
114
+ {
115
+ "expression": "user_id",
116
+ "isExpression": false,
117
+ "asc": true,
118
+ "nulls": "last"
119
+ }
120
+ ],
121
+ "isUnique": false,
122
+ "concurrently": false,
123
+ "method": "btree",
124
+ "with": {}
125
+ }
126
+ },
127
+ "foreignKeys": {
128
+ "error_events_group_id_error_groups_id_fk": {
129
+ "name": "error_events_group_id_error_groups_id_fk",
130
+ "tableFrom": "error_events",
131
+ "tableTo": "error_groups",
132
+ "schemaTo": "spfn_monitor",
133
+ "columnsFrom": [
134
+ "group_id"
135
+ ],
136
+ "columnsTo": [
137
+ "id"
138
+ ],
139
+ "onDelete": "cascade",
140
+ "onUpdate": "no action"
141
+ }
142
+ },
143
+ "compositePrimaryKeys": {},
144
+ "uniqueConstraints": {},
145
+ "policies": {},
146
+ "checkConstraints": {},
147
+ "isRLSEnabled": false
148
+ },
149
+ "spfn_monitor.error_groups": {
150
+ "name": "error_groups",
151
+ "schema": "spfn_monitor",
152
+ "columns": {
153
+ "id": {
154
+ "name": "id",
155
+ "type": "bigserial",
156
+ "primaryKey": true,
157
+ "notNull": true
158
+ },
159
+ "fingerprint": {
160
+ "name": "fingerprint",
161
+ "type": "text",
162
+ "primaryKey": false,
163
+ "notNull": true
164
+ },
165
+ "name": {
166
+ "name": "name",
167
+ "type": "text",
168
+ "primaryKey": false,
169
+ "notNull": true
170
+ },
171
+ "message": {
172
+ "name": "message",
173
+ "type": "text",
174
+ "primaryKey": false,
175
+ "notNull": true
176
+ },
177
+ "path": {
178
+ "name": "path",
179
+ "type": "text",
180
+ "primaryKey": false,
181
+ "notNull": true
182
+ },
183
+ "method": {
184
+ "name": "method",
185
+ "type": "text",
186
+ "primaryKey": false,
187
+ "notNull": true
188
+ },
189
+ "status_code": {
190
+ "name": "status_code",
191
+ "type": "integer",
192
+ "primaryKey": false,
193
+ "notNull": true
194
+ },
195
+ "status": {
196
+ "name": "status",
197
+ "type": "text",
198
+ "primaryKey": false,
199
+ "notNull": true,
200
+ "default": "'active'"
201
+ },
202
+ "count": {
203
+ "name": "count",
204
+ "type": "integer",
205
+ "primaryKey": false,
206
+ "notNull": true,
207
+ "default": 1
208
+ },
209
+ "first_seen_at": {
210
+ "name": "first_seen_at",
211
+ "type": "timestamp with time zone",
212
+ "primaryKey": false,
213
+ "notNull": true
214
+ },
215
+ "last_seen_at": {
216
+ "name": "last_seen_at",
217
+ "type": "timestamp with time zone",
218
+ "primaryKey": false,
219
+ "notNull": true
220
+ },
221
+ "resolved_at": {
222
+ "name": "resolved_at",
223
+ "type": "timestamp with time zone",
224
+ "primaryKey": false,
225
+ "notNull": false
226
+ },
227
+ "created_at": {
228
+ "name": "created_at",
229
+ "type": "timestamp with time zone",
230
+ "primaryKey": false,
231
+ "notNull": true,
232
+ "default": "now()"
233
+ },
234
+ "updated_at": {
235
+ "name": "updated_at",
236
+ "type": "timestamp with time zone",
237
+ "primaryKey": false,
238
+ "notNull": true,
239
+ "default": "now()"
240
+ }
241
+ },
242
+ "indexes": {
243
+ "monitor_eg_fingerprint_idx": {
244
+ "name": "monitor_eg_fingerprint_idx",
245
+ "columns": [
246
+ {
247
+ "expression": "fingerprint",
248
+ "isExpression": false,
249
+ "asc": true,
250
+ "nulls": "last"
251
+ }
252
+ ],
253
+ "isUnique": false,
254
+ "concurrently": false,
255
+ "method": "btree",
256
+ "with": {}
257
+ },
258
+ "monitor_eg_status_idx": {
259
+ "name": "monitor_eg_status_idx",
260
+ "columns": [
261
+ {
262
+ "expression": "status",
263
+ "isExpression": false,
264
+ "asc": true,
265
+ "nulls": "last"
266
+ }
267
+ ],
268
+ "isUnique": false,
269
+ "concurrently": false,
270
+ "method": "btree",
271
+ "with": {}
272
+ },
273
+ "monitor_eg_last_seen_at_idx": {
274
+ "name": "monitor_eg_last_seen_at_idx",
275
+ "columns": [
276
+ {
277
+ "expression": "last_seen_at",
278
+ "isExpression": false,
279
+ "asc": true,
280
+ "nulls": "last"
281
+ }
282
+ ],
283
+ "isUnique": false,
284
+ "concurrently": false,
285
+ "method": "btree",
286
+ "with": {}
287
+ },
288
+ "monitor_eg_path_idx": {
289
+ "name": "monitor_eg_path_idx",
290
+ "columns": [
291
+ {
292
+ "expression": "path",
293
+ "isExpression": false,
294
+ "asc": true,
295
+ "nulls": "last"
296
+ }
297
+ ],
298
+ "isUnique": false,
299
+ "concurrently": false,
300
+ "method": "btree",
301
+ "with": {}
302
+ }
303
+ },
304
+ "foreignKeys": {},
305
+ "compositePrimaryKeys": {},
306
+ "uniqueConstraints": {
307
+ "error_groups_fingerprint_unique": {
308
+ "name": "error_groups_fingerprint_unique",
309
+ "nullsNotDistinct": false,
310
+ "columns": [
311
+ "fingerprint"
312
+ ]
313
+ }
314
+ },
315
+ "policies": {},
316
+ "checkConstraints": {},
317
+ "isRLSEnabled": false
318
+ },
319
+ "spfn_monitor.logs": {
320
+ "name": "logs",
321
+ "schema": "spfn_monitor",
322
+ "columns": {
323
+ "id": {
324
+ "name": "id",
325
+ "type": "bigserial",
326
+ "primaryKey": true,
327
+ "notNull": true
328
+ },
329
+ "level": {
330
+ "name": "level",
331
+ "type": "text",
332
+ "primaryKey": false,
333
+ "notNull": true
334
+ },
335
+ "message": {
336
+ "name": "message",
337
+ "type": "text",
338
+ "primaryKey": false,
339
+ "notNull": true
340
+ },
341
+ "source": {
342
+ "name": "source",
343
+ "type": "text",
344
+ "primaryKey": false,
345
+ "notNull": false
346
+ },
347
+ "request_id": {
348
+ "name": "request_id",
349
+ "type": "text",
350
+ "primaryKey": false,
351
+ "notNull": false
352
+ },
353
+ "user_id": {
354
+ "name": "user_id",
355
+ "type": "text",
356
+ "primaryKey": false,
357
+ "notNull": false
358
+ },
359
+ "metadata": {
360
+ "name": "metadata",
361
+ "type": "jsonb",
362
+ "primaryKey": false,
363
+ "notNull": false
364
+ },
365
+ "created_at": {
366
+ "name": "created_at",
367
+ "type": "timestamp with time zone",
368
+ "primaryKey": false,
369
+ "notNull": true,
370
+ "default": "now()"
371
+ },
372
+ "updated_at": {
373
+ "name": "updated_at",
374
+ "type": "timestamp with time zone",
375
+ "primaryKey": false,
376
+ "notNull": true,
377
+ "default": "now()"
378
+ }
379
+ },
380
+ "indexes": {
381
+ "monitor_log_level_idx": {
382
+ "name": "monitor_log_level_idx",
383
+ "columns": [
384
+ {
385
+ "expression": "level",
386
+ "isExpression": false,
387
+ "asc": true,
388
+ "nulls": "last"
389
+ }
390
+ ],
391
+ "isUnique": false,
392
+ "concurrently": false,
393
+ "method": "btree",
394
+ "with": {}
395
+ },
396
+ "monitor_log_source_idx": {
397
+ "name": "monitor_log_source_idx",
398
+ "columns": [
399
+ {
400
+ "expression": "source",
401
+ "isExpression": false,
402
+ "asc": true,
403
+ "nulls": "last"
404
+ }
405
+ ],
406
+ "isUnique": false,
407
+ "concurrently": false,
408
+ "method": "btree",
409
+ "with": {}
410
+ },
411
+ "monitor_log_created_at_idx": {
412
+ "name": "monitor_log_created_at_idx",
413
+ "columns": [
414
+ {
415
+ "expression": "created_at",
416
+ "isExpression": false,
417
+ "asc": true,
418
+ "nulls": "last"
419
+ }
420
+ ],
421
+ "isUnique": false,
422
+ "concurrently": false,
423
+ "method": "btree",
424
+ "with": {}
425
+ }
426
+ },
427
+ "foreignKeys": {},
428
+ "compositePrimaryKeys": {},
429
+ "uniqueConstraints": {},
430
+ "policies": {},
431
+ "checkConstraints": {},
432
+ "isRLSEnabled": false
433
+ }
434
+ },
435
+ "enums": {},
436
+ "schemas": {
437
+ "spfn_monitor": "spfn_monitor"
438
+ },
439
+ "sequences": {},
440
+ "roles": {},
441
+ "policies": {},
442
+ "views": {},
443
+ "_meta": {
444
+ "columns": {},
445
+ "schemas": {},
446
+ "tables": {}
447
+ }
448
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1771397528484,
9
+ "tag": "0000_slow_mandrill",
10
+ "breakpoints": true
11
+ }
12
+ ]
13
+ }
package/package.json ADDED
@@ -0,0 +1,103 @@
1
+ {
2
+ "name": "@spfn/monitor",
3
+ "version": "0.1.0-beta.1",
4
+ "type": "module",
5
+ "description": "Error tracking, log management, and monitoring dashboard for SPFN",
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
+ "require": "./dist/index.js"
13
+ },
14
+ "./server": {
15
+ "types": "./dist/server.d.ts",
16
+ "import": "./dist/server.js",
17
+ "require": "./dist/server.js"
18
+ },
19
+ "./config": {
20
+ "types": "./dist/config/index.d.ts",
21
+ "import": "./dist/config/index.js",
22
+ "require": "./dist/config/index.js"
23
+ },
24
+ "./nextjs/client": {
25
+ "types": "./dist/nextjs/client.d.ts",
26
+ "import": "./dist/nextjs/client.js",
27
+ "require": "./dist/nextjs/client.js"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "migrations",
33
+ "README.md"
34
+ ],
35
+ "keywords": [
36
+ "spfn",
37
+ "monitor",
38
+ "error-tracking",
39
+ "logging",
40
+ "dashboard"
41
+ ],
42
+ "author": "Ray Im <rayim@inflike.com>",
43
+ "license": "MIT",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "https://github.com/spfn/spfn.git",
47
+ "directory": "packages/monitor"
48
+ },
49
+ "bugs": {
50
+ "url": "https://github.com/spfn/spfn/issues"
51
+ },
52
+ "homepage": "https://github.com/spfn/spfn/tree/main/packages/monitor#readme",
53
+ "spfn": {
54
+ "schemas": [
55
+ "./dist/server/entities/*.js"
56
+ ],
57
+ "migrations": {
58
+ "dir": "./migrations"
59
+ }
60
+ },
61
+ "dependencies": {
62
+ "@spfn/auth": "0.2.0-beta.20",
63
+ "@spfn/notification": "0.1.0-beta.3",
64
+ "@spfn/core": "0.2.0-beta.16"
65
+ },
66
+ "devDependencies": {
67
+ "@sinclair/typebox": "^0.34.30",
68
+ "@types/node": "^20.11.0",
69
+ "@types/react": "^19.2.2",
70
+ "@types/react-dom": "^19.2.2",
71
+ "drizzle-kit": "^0.31.6",
72
+ "drizzle-orm": "^0.44.2",
73
+ "madge": "^8.0.0",
74
+ "tsup": "^8.5.0",
75
+ "typescript": "^5.3.3",
76
+ "vitest": "^4.0.6"
77
+ },
78
+ "peerDependencies": {
79
+ "next": "^15.0.0 || ^16.0.0"
80
+ },
81
+ "peerDependenciesMeta": {
82
+ "next": {
83
+ "optional": true
84
+ }
85
+ },
86
+ "publishConfig": {
87
+ "access": "public",
88
+ "tag": "beta"
89
+ },
90
+ "scripts": {
91
+ "build": "pnpm check:circular && tsup && tsup --config tsup.client.config.ts",
92
+ "dev": "tsup --watch",
93
+ "type-check": "tsc --noEmit",
94
+ "clean": "rm -rf dist",
95
+ "db:generate": "drizzle-kit generate",
96
+ "test": "vitest run",
97
+ "test:watch": "vitest",
98
+ "check:circular": "madge --circular --extensions ts src/",
99
+ "publish:alpha": "npm publish --access public --tag alpha",
100
+ "publish:beta": "npm publish --access public --tag beta",
101
+ "publish:latest": "npm publish --access public"
102
+ }
103
+ }