@stacksjs/database 0.75.484 → 0.75.487

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,3 @@
1
+ import type { ErrorReporter } from '@stacksjs/types';
2
+ /** A bounded, buffered reporter for the dashboard's native Error model table. */
3
+ export declare function createDatabaseErrorReporter(): ErrorReporter;
@@ -0,0 +1,2 @@
1
+ import process from"node:process";export function createDatabaseErrorReporter(){let pending=0,writing=Promise.resolve(),warned=!1;const warn=(message)=>{if(warned)return;warned=!0;process.stderr.write(`[error-reporting] Local error storage unavailable: ${message}
2
+ `)};return{name:"database",report(event){if(pending>=100){warn("buffer full; further errors will be dropped until it drains.");return}const context={};for(const key of["requestId","method","status","label","userId"]){const value=event.context?.[key];if(typeof value==="string"||typeof value==="number")context[key]=value}const occurredAt=new Date,row={type:event.error.name||"Error",message:event.error.message,stack:event.error.stack??"",status:typeof event.context?.status==="number"?event.context.status:null,resolution:"unresolved",additional_info:JSON.stringify(context)};pending++;writing=writing.then(async()=>{const{db,sqlDateTime}=await import("./runtime"),timestamp=sqlDateTime(occurredAt);await db.insertInto("errors").values({...row,created_at:timestamp,updated_at:timestamp}).execute()}).catch((error)=>{warn(error instanceof Error?error.message:String(error))}).finally(()=>{pending--})},async flush(){await writing}}}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/database",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.484",
5
+ "version": "0.75.487",
6
6
  "description": "The Stacks database integration.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -66,26 +66,26 @@
66
66
  "prepublishOnly": "bun run build"
67
67
  },
68
68
  "dependencies": {
69
- "@stacksjs/config": "0.75.484",
70
- "@stacksjs/env": "0.75.484",
71
- "@stacksjs/error-handling": "0.75.484",
72
- "@stacksjs/faker": "0.75.484",
73
- "@stacksjs/features": "0.75.484",
74
- "@stacksjs/logging": "0.75.484",
75
- "@stacksjs/model-meta": "0.75.484",
76
- "@stacksjs/path": "0.75.484",
77
- "@stacksjs/query-builder": "0.75.484",
78
- "@stacksjs/security": "0.75.484",
79
- "@stacksjs/storage": "0.75.484",
80
- "@stacksjs/strings": "0.75.484",
69
+ "@stacksjs/config": "0.75.487",
70
+ "@stacksjs/env": "0.75.487",
71
+ "@stacksjs/error-handling": "0.75.487",
72
+ "@stacksjs/faker": "0.75.487",
73
+ "@stacksjs/features": "0.75.487",
74
+ "@stacksjs/logging": "0.75.487",
75
+ "@stacksjs/model-meta": "0.75.487",
76
+ "@stacksjs/path": "0.75.487",
77
+ "@stacksjs/query-builder": "0.75.487",
78
+ "@stacksjs/security": "0.75.487",
79
+ "@stacksjs/storage": "0.75.487",
80
+ "@stacksjs/strings": "0.75.487",
81
81
  "@stacksjs/ts-validation": "^0.5.7",
82
82
  "bun-query-builder": "^0.3.38",
83
83
  "dynamodb-tooling": "^0.3.6"
84
84
  },
85
85
  "devDependencies": {
86
- "@stacksjs/cli": "0.75.484",
87
- "@stacksjs/router": "0.75.484",
88
- "@stacksjs/utils": "0.75.484",
86
+ "@stacksjs/cli": "0.75.487",
87
+ "@stacksjs/router": "0.75.487",
88
+ "@stacksjs/utils": "0.75.487",
89
89
  "better-dx": "^0.2.24"
90
90
  }
91
91
  }