No forest, middleware or routes folders?

Feature(s) impacted

Setup of forest, middleware and routes folders.

Observed behavior

I used the Advanced setup > As a microservice > MongoDB setup flow.
The project is created on my local machine and connects to the web UI. It shows the collections / records.
There isn’t a forest, middleware or routes folder created in my project.
I manually create a forest folder to begin creating a smart action but after creating one it isn’t picked up in the UI.

Expected behavior

The folders are created on setup.

Context

  • Project name: Bypass
  • Team name: IonEV
  • Environment name: Dev
  • Agent (forest package) name & version: forest-cli/3.3.0 darwin-arm64 node-v16.15.1
  • Database type: Mongo

Hello @grantmac and welcome to our community!

I’m sorry to hear that you have troubles creating smart actions.

All new onboarding will generate an agent that changes the way customization are defined. They are to be declared directly on the agent object found in index.js.

createAgent({
  // These process.env variables should be provided in the onboarding
  authSecret: process.env.FOREST_AUTH_SECRET,
  envSecret: process.env.FOREST_ENV_SECRET,
  ...
})
  .addDataSource(createSqlDataSource(process.env.DATABASE_URL))
  .customizeCollection("customer", (customer) =>
    customer
      .addAction("Refund latest article", {
        execute: async (context, resultBuilder) => {
          return resultBuilder.success(
            `Well done ${context.caller.firstName}!`
          );
          // throw new Error();
          // return resultBuilder.error('this is an error');
        },
        scope: "Single",
      })
      .addAction("Smart Action 1", {
     ...

You could as well define everything in a new file and import your configuration if you wish to keep the index.js file short:

  .customizeCollection("customer", customerCustomization)

// in new file customer-customization.ts

export default (collection: Collection) =>
  collection.addAction("Smart Action 1", {
  ...
  })

I hope this helps.

Best regards,

Thanks!

Did I miss this in the docs?

You should be able to find everything you need about agent-nodejs in this documentation.
But we are aware that our documentation portal is confusing and hard to navigate as of now. We have a big overhaul in progress to make it as clear and user friendly as possible.

2 Likes