Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

refactor: include `ParsedConfig` type

Wesley Matos3e05266fb51f
diff --git a/screenpipe-js/main.ts b/screenpipe-js/main.ts
index 8ca89152d..83ce67488 100644
--- a/screenpipe-js/main.ts
+++ b/screenpipe-js/main.ts
@@ -102,6 +102,17 @@ export interface ScreenpipeResponse {
pagination: PaginationInfo;
}
+/**
+ * Parsed config
+ */
+export interface ParsedConfig<T = unknown> {
+ fields: {
+ name: string;
+ value?: T;
+ default?: T;
+ }[]
+}
+
/**
* Utility function to convert snake_case to camelCase
*/
@@ -156,9 +167,9 @@ export function loadPipeConfig(): PipeConfig {
try {
const configPath = `${process.env.SCREENPIPE_DIR}/pipes/${process.env.PIPE_ID}/pipe.json`;
const configContent = fs.readFileSync(configPath, "utf8");
- const parsedConfig = JSON.parse(configContent);
+ const parsedConfig: ParsedConfig = JSON.parse(configContent);
const config: PipeConfig = {};
- parsedConfig.fields.forEach((field: any) => {
+ parsedConfig.fields.forEach((field) => {
config[field.name] =
field.value !== undefined ? field.value : field.default;
});