Initial commit
This commit is contained in:
20
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-boundary.d.ts
generated
vendored
Normal file
20
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-boundary.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* HTTPAccessFallbackBoundary is a boundary that catches errors and renders a
|
||||
* fallback component for HTTP errors.
|
||||
*
|
||||
* It receives the status code, and determine if it should render fallbacks for few HTTP 4xx errors.
|
||||
*
|
||||
* e.g. 404
|
||||
* 404 represents not found, and the fallback component pair contains the component and its styles.
|
||||
*
|
||||
*/
|
||||
import React from 'react';
|
||||
interface HTTPAccessFallbackBoundaryProps {
|
||||
notFound?: React.ReactNode;
|
||||
forbidden?: React.ReactNode;
|
||||
unauthorized?: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
missingSlots?: Set<string>;
|
||||
}
|
||||
export declare function HTTPAccessFallbackBoundary({ notFound, forbidden, unauthorized, children, }: HTTPAccessFallbackBoundaryProps): import("react/jsx-runtime").JSX.Element;
|
||||
export {};
|
||||
126
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js
generated
vendored
Normal file
126
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
'use client';
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "HTTPAccessFallbackBoundary", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return HTTPAccessFallbackBoundary;
|
||||
}
|
||||
});
|
||||
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
||||
const _navigationuntracked = require("../navigation-untracked");
|
||||
const _httpaccessfallback = require("./http-access-fallback");
|
||||
const _warnonce = require("../../../shared/lib/utils/warn-once");
|
||||
const _approutercontextsharedruntime = require("../../../shared/lib/app-router-context.shared-runtime");
|
||||
class HTTPAccessFallbackErrorBoundary extends _react.default.Component {
|
||||
componentDidCatch() {
|
||||
if (process.env.NODE_ENV === 'development' && this.props.missingSlots && this.props.missingSlots.size > 0 && // A missing children slot is the typical not-found case, so no need to warn
|
||||
!this.props.missingSlots.has('children')) {
|
||||
let warningMessage = 'No default component was found for a parallel route rendered on this page. Falling back to nearest NotFound boundary.\n' + 'Learn more: https://nextjs.org/docs/app/building-your-application/routing/parallel-routes#defaultjs\n\n';
|
||||
const formattedSlots = Array.from(this.props.missingSlots).sort((a, b)=>a.localeCompare(b)).map((slot)=>"@" + slot).join(', ');
|
||||
warningMessage += 'Missing slots: ' + formattedSlots;
|
||||
(0, _warnonce.warnOnce)(warningMessage);
|
||||
}
|
||||
}
|
||||
static getDerivedStateFromError(error) {
|
||||
if ((0, _httpaccessfallback.isHTTPAccessFallbackError)(error)) {
|
||||
const httpStatus = (0, _httpaccessfallback.getAccessFallbackHTTPStatus)(error);
|
||||
return {
|
||||
triggeredStatus: httpStatus
|
||||
};
|
||||
}
|
||||
// Re-throw if error is not for 404
|
||||
throw error;
|
||||
}
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
/**
|
||||
* Handles reset of the error boundary when a navigation happens.
|
||||
* Ensures the error boundary does not stay enabled when navigating to a new page.
|
||||
* Approach of setState in render is safe as it checks the previous pathname and then overrides
|
||||
* it as outlined in https://react.dev/reference/react/useState#storing-information-from-previous-renders
|
||||
*/ if (props.pathname !== state.previousPathname && state.triggeredStatus) {
|
||||
return {
|
||||
triggeredStatus: undefined,
|
||||
previousPathname: props.pathname
|
||||
};
|
||||
}
|
||||
return {
|
||||
triggeredStatus: state.triggeredStatus,
|
||||
previousPathname: props.pathname
|
||||
};
|
||||
}
|
||||
render() {
|
||||
const { notFound, forbidden, unauthorized, children } = this.props;
|
||||
const { triggeredStatus } = this.state;
|
||||
const errorComponents = {
|
||||
[_httpaccessfallback.HTTPAccessErrorStatus.NOT_FOUND]: notFound,
|
||||
[_httpaccessfallback.HTTPAccessErrorStatus.FORBIDDEN]: forbidden,
|
||||
[_httpaccessfallback.HTTPAccessErrorStatus.UNAUTHORIZED]: unauthorized
|
||||
};
|
||||
if (triggeredStatus) {
|
||||
const isNotFound = triggeredStatus === _httpaccessfallback.HTTPAccessErrorStatus.NOT_FOUND && notFound;
|
||||
const isForbidden = triggeredStatus === _httpaccessfallback.HTTPAccessErrorStatus.FORBIDDEN && forbidden;
|
||||
const isUnauthorized = triggeredStatus === _httpaccessfallback.HTTPAccessErrorStatus.UNAUTHORIZED && unauthorized;
|
||||
// If there's no matched boundary in this layer, keep throwing the error by rendering the children
|
||||
if (!(isNotFound || isForbidden || isUnauthorized)) {
|
||||
return children;
|
||||
}
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
|
||||
name: "robots",
|
||||
content: "noindex"
|
||||
}),
|
||||
process.env.NODE_ENV === 'development' && /*#__PURE__*/ (0, _jsxruntime.jsx)("meta", {
|
||||
name: "boundary-next-error",
|
||||
content: (0, _httpaccessfallback.getAccessFallbackErrorTypeByStatus)(triggeredStatus)
|
||||
}),
|
||||
errorComponents[triggeredStatus]
|
||||
]
|
||||
});
|
||||
}
|
||||
return children;
|
||||
}
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state = {
|
||||
triggeredStatus: undefined,
|
||||
previousPathname: props.pathname
|
||||
};
|
||||
}
|
||||
}
|
||||
function HTTPAccessFallbackBoundary(param) {
|
||||
let { notFound, forbidden, unauthorized, children } = param;
|
||||
// When we're rendering the missing params shell, this will return null. This
|
||||
// is because we won't be rendering any not found boundaries or error
|
||||
// boundaries for the missing params shell. When this runs on the client
|
||||
// (where these error can occur), we will get the correct pathname.
|
||||
const pathname = (0, _navigationuntracked.useUntrackedPathname)();
|
||||
const missingSlots = (0, _react.useContext)(_approutercontextsharedruntime.MissingSlotContext);
|
||||
const hasErrorFallback = !!(notFound || forbidden || unauthorized);
|
||||
if (hasErrorFallback) {
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(HTTPAccessFallbackErrorBoundary, {
|
||||
pathname: pathname,
|
||||
notFound: notFound,
|
||||
forbidden: forbidden,
|
||||
unauthorized: unauthorized,
|
||||
missingSlots: missingSlots,
|
||||
children: children
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
|
||||
children: children
|
||||
});
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=error-boundary.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-fallback.d.ts
generated
vendored
Normal file
4
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-fallback.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare function HTTPAccessErrorFallback({ status, message, }: {
|
||||
status: number;
|
||||
message: string;
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
97
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-fallback.js
generated
vendored
Normal file
97
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-fallback.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "HTTPAccessErrorFallback", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return HTTPAccessErrorFallback;
|
||||
}
|
||||
});
|
||||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
||||
const _jsxruntime = require("react/jsx-runtime");
|
||||
const _react = /*#__PURE__*/ _interop_require_default._(require("react"));
|
||||
const styles = {
|
||||
error: {
|
||||
// https://github.com/sindresorhus/modern-normalize/blob/main/modern-normalize.css#L38-L52
|
||||
fontFamily: 'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',
|
||||
height: '100vh',
|
||||
textAlign: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
desc: {
|
||||
display: 'inline-block'
|
||||
},
|
||||
h1: {
|
||||
display: 'inline-block',
|
||||
margin: '0 20px 0 0',
|
||||
padding: '0 23px 0 0',
|
||||
fontSize: 24,
|
||||
fontWeight: 500,
|
||||
verticalAlign: 'top',
|
||||
lineHeight: '49px'
|
||||
},
|
||||
h2: {
|
||||
fontSize: 14,
|
||||
fontWeight: 400,
|
||||
lineHeight: '49px',
|
||||
margin: 0
|
||||
}
|
||||
};
|
||||
function HTTPAccessErrorFallback(param) {
|
||||
let { status, message } = param;
|
||||
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("title", {
|
||||
children: status + ": " + message
|
||||
}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
||||
style: styles.error,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
|
||||
children: [
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("style", {
|
||||
dangerouslySetInnerHTML: {
|
||||
/* Minified CSS from
|
||||
body { margin: 0; color: #000; background: #fff; }
|
||||
.next-error-h1 {
|
||||
border-right: 1px solid rgba(0, 0, 0, .3);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body { color: #fff; background: #000; }
|
||||
.next-error-h1 {
|
||||
border-right: 1px solid rgba(255, 255, 255, .3);
|
||||
}
|
||||
}
|
||||
*/ __html: "body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"
|
||||
}
|
||||
}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("h1", {
|
||||
className: "next-error-h1",
|
||||
style: styles.h1,
|
||||
children: status
|
||||
}),
|
||||
/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
||||
style: styles.desc,
|
||||
children: /*#__PURE__*/ (0, _jsxruntime.jsx)("h2", {
|
||||
style: styles.h2,
|
||||
children: message
|
||||
})
|
||||
})
|
||||
]
|
||||
})
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=error-fallback.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-fallback.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/error-fallback.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/client/components/http-access-fallback/error-fallback.tsx"],"sourcesContent":["import React from 'react'\n\nconst styles: Record<string, React.CSSProperties> = {\n error: {\n // https://github.com/sindresorhus/modern-normalize/blob/main/modern-normalize.css#L38-L52\n fontFamily:\n 'system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"',\n height: '100vh',\n textAlign: 'center',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n },\n\n desc: {\n display: 'inline-block',\n },\n\n h1: {\n display: 'inline-block',\n margin: '0 20px 0 0',\n padding: '0 23px 0 0',\n fontSize: 24,\n fontWeight: 500,\n verticalAlign: 'top',\n lineHeight: '49px',\n },\n\n h2: {\n fontSize: 14,\n fontWeight: 400,\n lineHeight: '49px',\n margin: 0,\n },\n}\n\nexport function HTTPAccessErrorFallback({\n status,\n message,\n}: {\n status: number\n message: string\n}) {\n return (\n <>\n {/* <head> */}\n <title>{`${status}: ${message}`}</title>\n {/* </head> */}\n <div style={styles.error}>\n <div>\n <style\n dangerouslySetInnerHTML={{\n /* Minified CSS from\n body { margin: 0; color: #000; background: #fff; }\n .next-error-h1 {\n border-right: 1px solid rgba(0, 0, 0, .3);\n }\n\n @media (prefers-color-scheme: dark) {\n body { color: #fff; background: #000; }\n .next-error-h1 {\n border-right: 1px solid rgba(255, 255, 255, .3);\n }\n }\n */\n __html: `body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}`,\n }}\n />\n <h1 className=\"next-error-h1\" style={styles.h1}>\n {status}\n </h1>\n <div style={styles.desc}>\n <h2 style={styles.h2}>{message}</h2>\n </div>\n </div>\n </div>\n </>\n )\n}\n"],"names":["HTTPAccessErrorFallback","styles","error","fontFamily","height","textAlign","display","flexDirection","alignItems","justifyContent","desc","h1","margin","padding","fontSize","fontWeight","verticalAlign","lineHeight","h2","status","message","title","div","style","dangerouslySetInnerHTML","__html","className"],"mappings":";;;;+BAqCgBA;;;eAAAA;;;;;gEArCE;AAElB,MAAMC,SAA8C;IAClDC,OAAO;QACL,0FAA0F;QAC1FC,YACE;QACFC,QAAQ;QACRC,WAAW;QACXC,SAAS;QACTC,eAAe;QACfC,YAAY;QACZC,gBAAgB;IAClB;IAEAC,MAAM;QACJJ,SAAS;IACX;IAEAK,IAAI;QACFL,SAAS;QACTM,QAAQ;QACRC,SAAS;QACTC,UAAU;QACVC,YAAY;QACZC,eAAe;QACfC,YAAY;IACd;IAEAC,IAAI;QACFJ,UAAU;QACVC,YAAY;QACZE,YAAY;QACZL,QAAQ;IACV;AACF;AAEO,SAASZ,wBAAwB,KAMvC;IANuC,IAAA,EACtCmB,MAAM,EACNC,OAAO,EAIR,GANuC;IAOtC,qBACE;;0BAEE,qBAACC;0BAAO,AAAGF,SAAO,OAAIC;;0BAEtB,qBAACE;gBAAIC,OAAOtB,OAAOC,KAAK;0BACtB,cAAA,sBAACoB;;sCACC,qBAACC;4BACCC,yBAAyB;gCACvB;;;;;;;;;;;;cAYA,GACAC,QAAS;4BACX;;sCAEF,qBAACd;4BAAGe,WAAU;4BAAgBH,OAAOtB,OAAOU,EAAE;sCAC3CQ;;sCAEH,qBAACG;4BAAIC,OAAOtB,OAAOS,IAAI;sCACrB,cAAA,qBAACQ;gCAAGK,OAAOtB,OAAOiB,EAAE;0CAAGE;;;;;;;;AAMnC"}
|
||||
19
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/http-access-fallback.d.ts
generated
vendored
Normal file
19
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/http-access-fallback.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export declare const HTTPAccessErrorStatus: {
|
||||
NOT_FOUND: number;
|
||||
FORBIDDEN: number;
|
||||
UNAUTHORIZED: number;
|
||||
};
|
||||
export declare const HTTP_ERROR_FALLBACK_ERROR_CODE = "NEXT_HTTP_ERROR_FALLBACK";
|
||||
export type HTTPAccessFallbackError = Error & {
|
||||
digest: `${typeof HTTP_ERROR_FALLBACK_ERROR_CODE};${string}`;
|
||||
};
|
||||
/**
|
||||
* Checks an error to determine if it's an error generated by
|
||||
* the HTTP navigation APIs `notFound()`, `forbidden()` or `unauthorized()`.
|
||||
*
|
||||
* @param error the error that may reference a HTTP access error
|
||||
* @returns true if the error is a HTTP access error
|
||||
*/
|
||||
export declare function isHTTPAccessFallbackError(error: unknown): error is HTTPAccessFallbackError;
|
||||
export declare function getAccessFallbackHTTPStatus(error: HTTPAccessFallbackError): number;
|
||||
export declare function getAccessFallbackErrorTypeByStatus(status: number): 'not-found' | 'forbidden' | 'unauthorized' | undefined;
|
||||
72
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/http-access-fallback.js
generated
vendored
Normal file
72
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/http-access-fallback.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
HTTPAccessErrorStatus: null,
|
||||
HTTP_ERROR_FALLBACK_ERROR_CODE: null,
|
||||
getAccessFallbackErrorTypeByStatus: null,
|
||||
getAccessFallbackHTTPStatus: null,
|
||||
isHTTPAccessFallbackError: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
HTTPAccessErrorStatus: function() {
|
||||
return HTTPAccessErrorStatus;
|
||||
},
|
||||
HTTP_ERROR_FALLBACK_ERROR_CODE: function() {
|
||||
return HTTP_ERROR_FALLBACK_ERROR_CODE;
|
||||
},
|
||||
getAccessFallbackErrorTypeByStatus: function() {
|
||||
return getAccessFallbackErrorTypeByStatus;
|
||||
},
|
||||
getAccessFallbackHTTPStatus: function() {
|
||||
return getAccessFallbackHTTPStatus;
|
||||
},
|
||||
isHTTPAccessFallbackError: function() {
|
||||
return isHTTPAccessFallbackError;
|
||||
}
|
||||
});
|
||||
const HTTPAccessErrorStatus = {
|
||||
NOT_FOUND: 404,
|
||||
FORBIDDEN: 403,
|
||||
UNAUTHORIZED: 401
|
||||
};
|
||||
const ALLOWED_CODES = new Set(Object.values(HTTPAccessErrorStatus));
|
||||
const HTTP_ERROR_FALLBACK_ERROR_CODE = 'NEXT_HTTP_ERROR_FALLBACK';
|
||||
function isHTTPAccessFallbackError(error) {
|
||||
if (typeof error !== 'object' || error === null || !('digest' in error) || typeof error.digest !== 'string') {
|
||||
return false;
|
||||
}
|
||||
const [prefix, httpStatus] = error.digest.split(';');
|
||||
return prefix === HTTP_ERROR_FALLBACK_ERROR_CODE && ALLOWED_CODES.has(Number(httpStatus));
|
||||
}
|
||||
function getAccessFallbackHTTPStatus(error) {
|
||||
const httpStatus = error.digest.split(';')[1];
|
||||
return Number(httpStatus);
|
||||
}
|
||||
function getAccessFallbackErrorTypeByStatus(status) {
|
||||
switch(status){
|
||||
case 401:
|
||||
return 'unauthorized';
|
||||
case 403:
|
||||
return 'forbidden';
|
||||
case 404:
|
||||
return 'not-found';
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=http-access-fallback.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/http-access-fallback.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/client/components/http-access-fallback/http-access-fallback.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/client/components/http-access-fallback/http-access-fallback.ts"],"sourcesContent":["export const HTTPAccessErrorStatus = {\n NOT_FOUND: 404,\n FORBIDDEN: 403,\n UNAUTHORIZED: 401,\n}\n\nconst ALLOWED_CODES = new Set(Object.values(HTTPAccessErrorStatus))\n\nexport const HTTP_ERROR_FALLBACK_ERROR_CODE = 'NEXT_HTTP_ERROR_FALLBACK'\n\nexport type HTTPAccessFallbackError = Error & {\n digest: `${typeof HTTP_ERROR_FALLBACK_ERROR_CODE};${string}`\n}\n\n/**\n * Checks an error to determine if it's an error generated by\n * the HTTP navigation APIs `notFound()`, `forbidden()` or `unauthorized()`.\n *\n * @param error the error that may reference a HTTP access error\n * @returns true if the error is a HTTP access error\n */\nexport function isHTTPAccessFallbackError(\n error: unknown\n): error is HTTPAccessFallbackError {\n if (\n typeof error !== 'object' ||\n error === null ||\n !('digest' in error) ||\n typeof error.digest !== 'string'\n ) {\n return false\n }\n const [prefix, httpStatus] = error.digest.split(';')\n\n return (\n prefix === HTTP_ERROR_FALLBACK_ERROR_CODE &&\n ALLOWED_CODES.has(Number(httpStatus))\n )\n}\n\nexport function getAccessFallbackHTTPStatus(\n error: HTTPAccessFallbackError\n): number {\n const httpStatus = error.digest.split(';')[1]\n return Number(httpStatus)\n}\n\nexport function getAccessFallbackErrorTypeByStatus(\n status: number\n): 'not-found' | 'forbidden' | 'unauthorized' | undefined {\n switch (status) {\n case 401:\n return 'unauthorized'\n case 403:\n return 'forbidden'\n case 404:\n return 'not-found'\n default:\n return\n }\n}\n"],"names":["HTTPAccessErrorStatus","HTTP_ERROR_FALLBACK_ERROR_CODE","getAccessFallbackErrorTypeByStatus","getAccessFallbackHTTPStatus","isHTTPAccessFallbackError","NOT_FOUND","FORBIDDEN","UNAUTHORIZED","ALLOWED_CODES","Set","Object","values","error","digest","prefix","httpStatus","split","has","Number","status"],"mappings":";;;;;;;;;;;;;;;;;;IAAaA,qBAAqB;eAArBA;;IAQAC,8BAA8B;eAA9BA;;IAuCGC,kCAAkC;eAAlCA;;IAPAC,2BAA2B;eAA3BA;;IAnBAC,yBAAyB;eAAzBA;;;AArBT,MAAMJ,wBAAwB;IACnCK,WAAW;IACXC,WAAW;IACXC,cAAc;AAChB;AAEA,MAAMC,gBAAgB,IAAIC,IAAIC,OAAOC,MAAM,CAACX;AAErC,MAAMC,iCAAiC;AAavC,SAASG,0BACdQ,KAAc;IAEd,IACE,OAAOA,UAAU,YACjBA,UAAU,QACV,CAAE,CAAA,YAAYA,KAAI,KAClB,OAAOA,MAAMC,MAAM,KAAK,UACxB;QACA,OAAO;IACT;IACA,MAAM,CAACC,QAAQC,WAAW,GAAGH,MAAMC,MAAM,CAACG,KAAK,CAAC;IAEhD,OACEF,WAAWb,kCACXO,cAAcS,GAAG,CAACC,OAAOH;AAE7B;AAEO,SAASZ,4BACdS,KAA8B;IAE9B,MAAMG,aAAaH,MAAMC,MAAM,CAACG,KAAK,CAAC,IAAI,CAAC,EAAE;IAC7C,OAAOE,OAAOH;AAChB;AAEO,SAASb,mCACdiB,MAAc;IAEd,OAAQA;QACN,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT;YACE;IACJ;AACF"}
|
||||
Reference in New Issue
Block a user