@toddledev/ssr
Advanced tools
Comparing version 0.0.3-alpha.7 to 0.0.3-alpha.8
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getPathSegments = exports.get404Page = exports.getRouteDestination = exports.matchRoutes = exports.matchRouteForUrl = exports.matchPageForUrl = void 0; | ||
const formula_1 = require("@toddledev/core/dist/formula/formula"); | ||
const url_1 = require("@toddledev/core/dist/utils/url"); | ||
const api_1 = require("@toddledev/core/dist/api/api"); | ||
const util_1 = require("@toddledev/core/dist/utils/util"); | ||
@@ -54,14 +53,19 @@ const formulaContext_1 = require("../rendering/formulaContext"); | ||
const getRouteDestination = ({ files, req, route, }) => { | ||
return (0, url_1.validateUrl)((0, formula_1.applyFormula)(route.destination.formula, | ||
// destination formulas should only have access to URL parameters from | ||
// the route's source definition. Not from anything else atm. | ||
{ | ||
data: { | ||
'URL parameters': (0, formulaContext_1.getDataUrlParameters)({ | ||
route: route.source, | ||
req, | ||
}), | ||
}, | ||
toddle: (0, formulaContext_1.getServerToddleObject)(files), | ||
})); | ||
try { | ||
return (0, api_1.getUrl)(route.destination, | ||
// destination formulas should only have access to URL parameters from | ||
// the route's source definition. Not from anything else atm. | ||
{ | ||
data: { | ||
'URL parameters': (0, formulaContext_1.getDataUrlParameters)({ | ||
route: route.source, | ||
req, | ||
}), | ||
}, | ||
toddle: (0, formulaContext_1.getServerToddleObject)(files), | ||
}); | ||
} | ||
catch { | ||
return false; | ||
} | ||
}; | ||
@@ -68,0 +72,0 @@ exports.getRouteDestination = getRouteDestination; |
@@ -0,1 +1,2 @@ | ||
import type { ApiBase } from '@toddledev/core/dist/api/apiTypes'; | ||
import type { Component, RouteDeclaration } from '@toddledev/core/dist/component/component.types'; | ||
@@ -64,5 +65,3 @@ import type { Formula } from '@toddledev/core/dist/formula/formula'; | ||
source: RouteDeclaration; | ||
destination: { | ||
formula: Formula; | ||
}; | ||
destination: ApiBase; | ||
} |
@@ -15,7 +15,7 @@ { | ||
"dependencies": { | ||
"@toddledev/core": "0.0.3-alpha.7", | ||
"@toddledev/core": "0.0.3-alpha.8", | ||
"cookie": "1.0.2", | ||
"xss": "1.0.15" | ||
}, | ||
"version": "0.0.3-alpha.7" | ||
"version": "0.0.3-alpha.8" | ||
} |
@@ -0,1 +1,2 @@ | ||
import { getUrl } from '@toddledev/core/dist/api/api' | ||
import { | ||
@@ -5,4 +6,2 @@ PageComponent, | ||
} from '@toddledev/core/dist/component/component.types' | ||
import { applyFormula } from '@toddledev/core/dist/formula/formula' | ||
import { validateUrl } from '@toddledev/core/dist/utils/url' | ||
import { isDefined } from '@toddledev/core/dist/utils/util' | ||
@@ -96,5 +95,5 @@ import { | ||
}) => { | ||
return validateUrl( | ||
applyFormula( | ||
route.destination.formula, | ||
try { | ||
return getUrl( | ||
route.destination, | ||
// destination formulas should only have access to URL parameters from | ||
@@ -111,4 +110,6 @@ // the route's source definition. Not from anything else atm. | ||
} as any, | ||
), | ||
) | ||
) | ||
} catch { | ||
return false | ||
} | ||
} | ||
@@ -115,0 +116,0 @@ |
@@ -0,1 +1,2 @@ | ||
import type { ApiBase } from '@toddledev/core/dist/api/apiTypes' | ||
import type { | ||
@@ -67,5 +68,3 @@ Component, | ||
source: RouteDeclaration | ||
destination: { | ||
formula: Formula | ||
} | ||
destination: ApiBase | ||
} |
Sorry, the diff of this file is not supported yet
183825
3793
+ Added@toddledev/core@0.0.3-alpha.8(transitive)
- Removed@toddledev/core@0.0.3-alpha.7(transitive)