Some checks failed
Main Confidence / confidence (push) Failing after 45s
## Summary - introduce surface-aware compressed governance outcomes and reuse the shared truth/explanation seams for operator-first summaries - apply the compressed outcome hierarchy across baseline, evidence, review, review-pack, canonical review/evidence, and artifact-oriented operation-run surfaces - expand spec 214 fixtures and Pest coverage, and fix tenant-panel route assertions by generating explicit tenant-panel URLs in the affected Filament tests ## Validation - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` - focused governance compression suite from `specs/214-governance-outcome-compression/quickstart.md` passed (`68` tests, `445` assertions) - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Filament/InventoryItemResourceTest.php tests/Feature/Filament/BackupSetUiEnforcementTest.php tests/Feature/Filament/RestoreRunUiEnforcementTest.php` passed (`18` tests, `81` assertions) Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #253
74 lines
1.8 KiB
Plaintext
74 lines
1.8 KiB
Plaintext
'use strict'
|
|
|
|
const Client = require('./client')
|
|
const defaults = require('./defaults')
|
|
const Connection = require('./connection')
|
|
const Result = require('./result')
|
|
const utils = require('./utils')
|
|
const Pool = require('pg-pool')
|
|
const TypeOverrides = require('./type-overrides')
|
|
const { DatabaseError } = require('pg-protocol')
|
|
const { escapeIdentifier, escapeLiteral } = require('./utils')
|
|
|
|
const poolFactory = (Client) => {
|
|
return class BoundPool extends Pool {
|
|
constructor(options) {
|
|
super(options, Client)
|
|
}
|
|
}
|
|
}
|
|
|
|
const PG = function (clientConstructor) {
|
|
this.defaults = defaults
|
|
this.Client = clientConstructor
|
|
this.Query = this.Client.Query
|
|
this.Pool = poolFactory(this.Client)
|
|
this._pools = []
|
|
this.Connection = Connection
|
|
this.types = require('pg-types')
|
|
this.DatabaseError = DatabaseError
|
|
this.TypeOverrides = TypeOverrides
|
|
this.escapeIdentifier = escapeIdentifier
|
|
this.escapeLiteral = escapeLiteral
|
|
this.Result = Result
|
|
this.utils = utils
|
|
}
|
|
|
|
let clientConstructor = Client
|
|
|
|
let forceNative = false
|
|
try {
|
|
forceNative = !!process.env.NODE_PG_FORCE_NATIVE
|
|
} catch {
|
|
// ignore, e.g., Deno without --allow-env
|
|
}
|
|
|
|
if (forceNative) {
|
|
clientConstructor = require('./native')
|
|
}
|
|
|
|
module.exports = new PG(clientConstructor)
|
|
|
|
// lazy require native module...the native module may not have installed
|
|
Object.defineProperty(module.exports, 'native', {
|
|
configurable: true,
|
|
enumerable: false,
|
|
get() {
|
|
let native = null
|
|
try {
|
|
native = new PG(require('./native'))
|
|
} catch (err) {
|
|
if (err.code !== 'MODULE_NOT_FOUND') {
|
|
throw err
|
|
}
|
|
}
|
|
|
|
// overwrite module.exports.native so that getter is never called again
|
|
Object.defineProperty(module.exports, 'native', {
|
|
value: native,
|
|
})
|
|
|
|
return native
|
|
},
|
|
})
|