How to use library that is added in libraries section in settings

How to use library that is added in libraries section in settings

1 Like

@feruz111 Welcome to the community! :wave:

if you've added a library in the libraries section under settings, you can use it directly in your custom components or query scripts.

Steps

  1. Add the Library: Go to Settings > Libraries and add the desired library.
  2. Use the Library: In your custom component or script, simply call the library as you would normally do.

Example

If you've added Lodash as a library:

// In a JavaScript Query or Custom Component
const exampleArray = [1, 2, 3, 4, 5];
const sum = _.sum(exampleArray); // Using Lodash's sum function
return sum;

Make sure to check the documentation of the specific library for correct usage.
Libraries added in the settings should be globally available in all your scripting environments within Retool.

Hope this helps!

1 Like

@Milan_Kalem well that's true but i am trying to use this library and i can't use for some reason, is this package supported by retool @aws-sdk/client-cognito-identity CDN by jsDelivr - A CDN for npm and GitHub

@feruz111 This library's code doesn't seem to work. I would assume that it is not supported.

1 Like

sorry what do you mean by not working it definetly works in my node project

What I meant to say is I cant get it to work in my retool env. I imported the library, but can not use it same as you reported, hence I assume it is not supported by retool

ok got it thanks, then follow up question would be how could i create users in cognito because that library would allow me to do that

you need a umd version of the library. i'm sure someone has bothered to do it. alternatively, you MIGHT be able to use Build your own AWS SDK for JavaScript and upload it to retool storage or something then try embedding it with a script tag using src=retool_file_path. i've never tried this, but i just now stumbled on the builder and wanted to try this myself when i had time

1 Like

hmmmm, I think you could connect a lambda resource and manage a workaround that way? I'm really out of my depth there though

1 Like