Creates a new instance of Squid with the given options.
The options for initializing the Squid instance.
Returns the application ID of the current Squid instance.
Returns the observability client for metrics.
Returns the scheduler client for managing scheduled jobs and tasks.
Returns a distributed lock for the given mutex. The lock can be used to synchronize access to a shared resource. The lock will be released when the release method on the returned object is invoked or whenever the connection with the server is lost.
A string that uniquely identifies the lock.
A promise that resolves with the lock object. The promise will reject if failed to acquire the lock.
Returns the AdminClient instance for performing administrative operations.
Returns a set of functionality for interacting with API integrations.
Returns a reference to the collection in the provided integration.
If the integrationId is not provided, the built_in_db
integration id will be used.
For more information on the CollectionReference object, please refer to the documentation.
The type of the documents in the collection.
The name of the collection.
The id of the integration, default to built_in_db
.
A reference to the collection in the provided integration.
Provides information about the connection to the Squid Server.
Destructs the Squid Client. Unsubscribes from all ongoing queries or requests, and clears the local data. After invoking this method, the Squid client will not be usable.
A promise that resolves when the destruct process is complete.
Executes a backend function identified by its name, passing the provided parameters, and returns a promise with the result.
For detailed information on backend functions in Squid, see the documentation.
Files support:
SquidFile
on the backend.The expected type of the result returned by the backend function.
The name of the backend function to execute.
A list of parameters to pass to the backend function.
A promise that resolves to the result of the backend function.
Executes a native Mongo/built-in-db query with the given pipeline and returns a promise with the result. See https://docs.getsquid.ai/docs/client-sdk/database/native-queries#native-mongodb-queries.
The id of the integration that the query is associated with.
The collection to query.
The aggregation pipeline for the query.
A promise that resolves with the result of the query.
Executes a native relational query with the given parameters and returns a promise with the result. See https://docs.getsquid.ai/docs/client-sdk/database/native-queries.
The id of the integration that the query is associated with.
The raw SQL or other database-specific query to execute.
(Optional) The parameters to pass to the query. Defaults to an empty object.
A promise that resolves with the result of the query.
Returns a client for working with structured data extraction tools.
Returns a client for accessing personal (user-specific) file storage.
The storage integration ID to use.
Returns a queue manager for the given topic name and integration id. Using the queue manager you can consume and produce messages
Runs the given callback as an atomic change. All the mutations that are executed using the provided transactionId will be atomic. Note that mutations for different integrations will not be atomic.
For more information about transactions in Squid, please refer to the documentation.
The callback to run as an atomic change. The function receives a transactionId that should be used for all the mutations that should be atomic. The function should return a promise.
A promise that resolves when the transactions are committed on the server.
Sets the authorization access token (OAuth2.0) provider that will be sent to the server and will be used for
providing the auth
object to the security rules.
The OAuth2.0 access token provider invoked for every backend request by Squid. When the provider returns undefined, no authorization information is sent. When a new provider is set, all future Squid backend requests will use the new token provider, and exising in-flight requests won't be affected.
void.
Returns a client for accessing file storage for the current app. Defaults to the built-in storage integration if none is provided.
The storage integration ID (default is 'built_in_storage').
Returns a set of functionality for interacting with the web.
Executes the given callback while holding a lock for the given mutex. The lock will be released when the callback finishes.
A string that uniquely identifies the lock.
The callback to execute while holding the lock.
A promise that resolves with the result of the callback. The promise will reject if failed to acquire the lock.
Static
getReturns the global Squid instance with the given options, creating a new instance if one with the same options does not exist.
The options for initializing the Squid instance.
A global Squid instance with the given options.
Static
get
The main entry point to the Squid Client SDK.
The Squid class provides a comprehensive array of functionality for accessing the different integrations, executing backend functions, managing data, and more. Upon instantiating the Squid class, you will have access to all of these capabilities. All public Squid functions are bound to
this
and can be used with a destructuring patterns, likeconst {setAuthProvider} = useSquid()