Is it possible to create that script or query always runs before running all query?

There are currently approximately 100 queries and scripts in one app.
Is it possible to create a script or query that runs first before running all query or script? because always need to verify that the token has expired before run query/script.

I'm using a similar approach currently in one of my apps that has ~40 queries. I'm using a main query that acts as a trigger that with some logic executes a set of queries synchronously.

I'm chaining queries like this:

queryA.trigger().then(
  () => queryB.trigger().then(
    () => queryC.trigger().then(...)
  )
)

Thanks for the tip.
But if 20 queries work separately, 20 scripts will have to come out, and a total of 40 queries/scripts will be created and it will be too complicated to manage.

Hi @finn :wave: thanks for reaching out and for the helpful diagrams!

Would you mind providing some additional details regarding your use case? If you're attempting to implement some token authentication logic for REST API queries: would the Custom API authentication feature potentially satisfy your use case?