mirror of
https://github.com/LaconicNetwork/laconic.com.git
synced 2026-03-06 01:54:07 +00:00
Signed-off-by: Traxus <shyidx@gmail.com>
This commit is contained in:
parent
6278a07e72
commit
a9b0c275ff
@ -24,7 +24,7 @@ function datocmsDateToIng(date : string) : number {
|
||||
|
||||
|
||||
//-----graphql query interception
|
||||
export async function datocmsQueryIntercept(query : any) {
|
||||
export async function datocmsQueryIntercept(query : any) : object {
|
||||
let parent = pluckFirstParentFromQuery(query);
|
||||
let pageQueryWhitelist = getPageQueryBypassWhitelist();
|
||||
let listingDirectory = getListingDirectoryByQueryParent(parent);
|
||||
@ -42,7 +42,7 @@ export async function datocmsQueryIntercept(query : any) {
|
||||
return interceptData;
|
||||
}
|
||||
|
||||
function getPageQueryBypassWhitelist() {
|
||||
function getPageQueryBypassWhitelist() : string[] {
|
||||
//-----stuff that has been (to the best of my knowledge) completley pulled over into JSON
|
||||
//-----does not include iterative stuff like blog posts or events etc...
|
||||
//-----this may only end up being scaffolding.
|
||||
@ -66,13 +66,13 @@ function getPageQueryBypassWhitelist() {
|
||||
return whitelist;
|
||||
}
|
||||
|
||||
function getListingQueryDirectories() {
|
||||
function getListingQueryDirectories() : string[] {
|
||||
//-----whitelist the listying types of content...
|
||||
|
||||
let directories : string[] = [];
|
||||
|
||||
directories.push('allEvents');
|
||||
directories.push('allPositions)';
|
||||
directories.push('allPositions');
|
||||
directories.push('allPressReleases');
|
||||
directories.push('allTeams');
|
||||
directories.push('allTestimonials');
|
||||
@ -81,7 +81,7 @@ function getListingQueryDirectories() {
|
||||
|
||||
}
|
||||
|
||||
function getListingDirectoryByQueryParent(parent : string) {
|
||||
function getListingDirectoryByQueryParent(parent : string) : string {
|
||||
//-----this acts as a whitelist and a mapping to the folder name...
|
||||
|
||||
let directories : string[] = getListingQueryDirectories() ;
|
||||
@ -95,7 +95,7 @@ function getListingDirectoryByQueryParent(parent : string) {
|
||||
return directory;
|
||||
}
|
||||
|
||||
function pluckFirstParentFromQuery(query : any) {
|
||||
function pluckFirstParentFromQuery(query : any) : string {
|
||||
|
||||
//-----only plucks the FIRST parent, if there are multiple parents in the query they will be ignored.
|
||||
let parent : string = ((query.replace(/[\W_]+/g," ")).trim()).split(" ")[0];
|
||||
@ -103,7 +103,7 @@ function pluckFirstParentFromQuery(query : any) {
|
||||
|
||||
}
|
||||
|
||||
async function datocmsPageQueryIntercept(query : any) {
|
||||
async function datocmsPageQueryIntercept(query : any) : object {
|
||||
|
||||
let parent : string = pluckFirstParentFromQuery(query);
|
||||
let jsonDirectory : string = path.join(process.cwd(), 'json/site_content');
|
||||
@ -128,7 +128,7 @@ async function datocmsPageQueryIntercept(query : any) {
|
||||
|
||||
}
|
||||
|
||||
async function datocmsListingQueryIntercept(query : any) {
|
||||
async function datocmsListingQueryIntercept(query : any) : object {
|
||||
|
||||
let parent : string = pluckFirstParentFromQuery(query);
|
||||
let jsonData : object = {};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user