Skip to content

jsResource failing to take in a TS version of resources file (resources.ts)Β #34

@tballard34

Description

@tballard34

Bug Summary

When I make the jsResource in the config.yaml a TypeScript file, it was failing to load the back-end resources and nothing was rendering on the API schema in the Harper Fabric UI

Reproduction Repository (if applicable)

https://github.com/tballard34/ConvoIQ

Steps to Reproduce

  1. Clone repo
  2. In config.yaml change the
jsResource:
  files: 'operations/backend/resources.js'

to

jsResource:
  files: 'backend/resources.ts'
  1. Run npm run dev
  2. Check Harper Fabric UI API OpenAPI Schema for routes

Here there should be the routes in the resources.ts file, but they should be blank. This is the bug.

Expected Behavior

So I expected Harper to be able to handle my TS file directly, but this was failing and the API endpoints I had in my resource TS file were not showing up in my Harper. For fabric UI on local. This proves that it was not able to read my resources.ts file.

Actual Behavior

Ideally, I would be able to reference the resources.ts file directly without having to make a build step to compile it from ts to js and then referencing the js file in my config.yaml.

Platform

No response

Console Errors

No response

Screenshots or Videos

No response

Additional Context

    "build:backend": "tsc backend/agent-prompts.ts backend/agent-tools.ts backend/title-generators.ts backend/resources.ts backend/routes/spa-fallback.ts --outDir operations --rootDir . --module ESNext --target ES2022 --moduleResolution node --skipLibCheck --allowSyntheticDefaultImports",

To solve this, I had to compile my resources file to .js and reference that instead of the .ts version directly. It's not the end of the world, but it would be nice to avoid this middle compilation step, and just use .ts directly

Doc on this
https://docs.harperdb.io/docs/reference/components/built-in-extensions#jsresource

https://docs.harperdb.io/docs/reference/components/plugins#api

Are you planning to fix this issue?

No, just reporting the issue

First-time contributor support

  • I'm new to contributing and would appreciate guidance on the process
  • I'd like help understanding the project structure
  • I need assistance with setting up the development environment
  • I'm comfortable contributing, but new to this project specifically

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions