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
78 lines
2.2 KiB
Plaintext
78 lines
2.2 KiB
Plaintext
'use strict';
|
|
|
|
import transformData from './transformData.js';
|
|
import isCancel from '../cancel/isCancel.js';
|
|
import defaults from '../defaults/index.js';
|
|
import CanceledError from '../cancel/CanceledError.js';
|
|
import AxiosHeaders from '../core/AxiosHeaders.js';
|
|
import adapters from '../adapters/adapters.js';
|
|
|
|
/**
|
|
* Throws a `CanceledError` if cancellation has been requested.
|
|
*
|
|
* @param {Object} config The config that is to be used for the request
|
|
*
|
|
* @returns {void}
|
|
*/
|
|
function throwIfCancellationRequested(config) {
|
|
if (config.cancelToken) {
|
|
config.cancelToken.throwIfRequested();
|
|
}
|
|
|
|
if (config.signal && config.signal.aborted) {
|
|
throw new CanceledError(null, config);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Dispatch a request to the server using the configured adapter.
|
|
*
|
|
* @param {object} config The config that is to be used for the request
|
|
*
|
|
* @returns {Promise} The Promise to be fulfilled
|
|
*/
|
|
export default function dispatchRequest(config) {
|
|
throwIfCancellationRequested(config);
|
|
|
|
config.headers = AxiosHeaders.from(config.headers);
|
|
|
|
// Transform request data
|
|
config.data = transformData.call(config, config.transformRequest);
|
|
|
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
}
|
|
|
|
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
|
|
return adapter(config).then(
|
|
function onAdapterResolution(response) {
|
|
throwIfCancellationRequested(config);
|
|
|
|
// Transform response data
|
|
response.data = transformData.call(config, config.transformResponse, response);
|
|
|
|
response.headers = AxiosHeaders.from(response.headers);
|
|
|
|
return response;
|
|
},
|
|
function onAdapterRejection(reason) {
|
|
if (!isCancel(reason)) {
|
|
throwIfCancellationRequested(config);
|
|
|
|
// Transform response data
|
|
if (reason && reason.response) {
|
|
reason.response.data = transformData.call(
|
|
config,
|
|
config.transformResponse,
|
|
reason.response
|
|
);
|
|
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
}
|
|
}
|
|
|
|
return Promise.reject(reason);
|
|
}
|
|
);
|
|
}
|