feat: initial prototype
Node.js CI / Lint and Test (push) Failing after 1m0s

This commit is contained in:
2025-09-22 16:45:38 -07:00
parent b5c1ec7fa0
commit 03c559b6cf
23 changed files with 8445 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import fastify from "fastify";
import { buildRoutes } from "./modules/buildRoutes.js";
import { logger } from "./utils/logger.js";
const server = fastify({
logger: false,
});
await buildRoutes(server);
server.listen({ port: 9999 }, () => {
void logger.log("info", "Server started on port 9999");
});
+14
View File
@@ -0,0 +1,14 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
export type Donate = Array<{
icon: string;
name: string;
description: string;
url: string;
foreground: string;
background: string;
}>;
+62
View File
@@ -0,0 +1,62 @@
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
export interface Funding {
version: string;
entity: {
type: string;
role: string;
name: string;
email: string;
phone: string;
description: string;
webpageUrl: {
url: string;
wellKnown: string;
};
};
projects: Array<{
guid: string;
name: string;
description: string;
webpageUrl: {
url: string;
wellKnown?: string;
};
repositoryUrl: {
url: string;
wellKnown: string;
};
licenses: Array<string>;
tags: Array<string>;
}>;
funding: {
channels: Array<{
guid: string;
type: string;
address: string;
description: string;
}>;
plans: Array<{
guid: string;
status: string;
name: string;
description: string;
amount: number;
currency: string;
frequency: string;
channels: Array<string>;
}>;
history: Array<{
year: number;
income: number;
expenses: number;
taxes: number;
currency: string;
description: string;
}>;
};
}
+15
View File
@@ -0,0 +1,15 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
export type Projects = Array<{
avatar?: string;
category: string;
description: string;
name: string;
premium: boolean;
url?: string;
wip: boolean;
}>;
+69
View File
@@ -0,0 +1,69 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
/* eslint-disable @typescript-eslint/naming-convention -- snake_case matches the YAML standard, I believe?*/
interface Employment {
title: string;
company: string;
type: string;
start_date: string;
end_date: string;
description: string;
prior_positions?: Array<{
title: string;
start_date: string;
end_date: string;
}>;
}
interface Volunteer {
title: string;
company: string;
start_date: string;
end_date: string;
description: string;
}
interface Education {
title: string;
institution: string;
type: string;
start_date: string;
end_date: string;
description: string;
}
interface Certification {
title: string;
issuer: string;
date: string;
}
interface Project {
title: string;
company: string;
description: string;
date: string;
}
interface Publication {
title: string;
company: string;
description: string;
date: string;
}
export interface Resume {
name: string;
contact: string;
summary: string;
employment: Array<Employment>;
volunteer: Array<Volunteer>;
education: Array<Education>;
certifications: Array<Certification>;
projects: Array<Project>;
publications: Array<Publication>;
}
+40
View File
@@ -0,0 +1,40 @@
/**
* @copyright NHCarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { readdir, readFile } from "node:fs/promises";
import { join } from "node:path";
import { logger } from "../utils/logger.js";
import type { FastifyInstance } from "fastify";
/**
* Builds the routes for the Fastify instance based on the files in the data directory.
* @param fastify - The Fastify instance to build routes for.
*/
export const buildRoutes = async(fastify: FastifyInstance): Promise<void> => {
const data = await readdir(join(import.meta.dirname, "..", "..", "data"));
await Promise.all(
data.map(async(file) => {
const route = `/${file}`;
const contents = await readFile(
join(import.meta.dirname, "..", "..", "data", file),
"utf-8",
);
if (file.endsWith(".yml")) {
fastify.get(route, async(_request, response) => {
response.type("application/yaml").send(contents);
});
}
if (file.endsWith(".json")) {
fastify.get(route, async(_request, response) => {
response.type("application/json").send(contents);
});
}
await logger.log("debug", `Loaded route ${route}`);
}),
);
};
+12
View File
@@ -0,0 +1,12 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { Logger } from "@nhcarrigan/logger";
export const logger = new Logger(
"Data API",
process.env.LOG_TOKEN ?? "",
);