Skip to content

v2.32.0

Latest

Choose a tag to compare

@DZakh DZakh released this 04 Nov 14:51
8b85a78

Effect API - Bye-Bye Experimental Prefix 🧪

Effect API, released on May 8, served us well, and we officially removed the experimental_ prefix from createEffect.

This change comes with two new features:

  • The rateLimit option (required) which allows you to set explicitely how freaquently the effect might be called. Use either false to disable, or provide an object with custom calls per duration. Duration might be second, minute or a number in milliseconds.
  • Ability to overwrite cache option for specific call. Set context.cache = false to prevent caching the result which failed.
export const getMetadata = createEffect(
 {
   name: "getMetadata",
   input: S.string,
   output: S.optional(S.schema({
     description: S.string,
     value: S.bigint,
   })),
   // Protect your API from burst Effect calls
   rateLimit: {
     calls: 5,
     per: "second"
   },
   cache: true,
 },
 async ({ input, context }) => {
   try {
     const response = await fetch(`https://api.example.com/metadata/${input}`);
     const data = await response.json();
     return {
       description: data.description,
       value: data.value,
     };
   } catch(_) {
     // Don't cache failed response
     context.cache = false
     return undefined;
   }
 }
);

By @DZakh in #809

Development Console Insights 📺

With this version, the Development Console now provides more performance metrics for Effect API execution, as well as loading entities from your handlers.

See a detailed time overview to identify what's slowing down your processing time. Use Batched metric to find what can be better optimized with Preload Optimization. And get useful insigts about your indexer execution in general. As a nice bonus, the Development Console now works even with TUI disabled.

Tip: Hover over question marks to get better understanding of the data.

image

Access Development Console at envio.dev/console

By @DZakh in #795, #805

New getWhere.lt Query 🔎

Use context.<Entity>.getWhere.<FieldName>.lt to get all entities where the field value is lower than the given value.

By @DZakh in #796

Internal Improvements 🧹

  • Librarify config and stop using global db client by @DZakh in #803
  • Update Cursor rules by @DZakh in #806
  • Librarify InMemoryTable code by @DZakh in #807

Full Changelog: v2.31.1...v2.32.0