Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fauna-labs/fql-utilities

Package Overview
Dependencies
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fauna-labs/fql-utilities - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

.github/workflows/codeql-analysis.yml

4

package.json
{
"name": "@fauna-labs/fql-utilities",
"version": "0.1.0",
"version": "0.1.1",
"description": "A library of FQL utilities for Fauna Schema Migrate, implemented in TypeScript.",

@@ -9,3 +9,3 @@ "main": "dist/index.js",

"build": "tsc",
"prepublish": "tsc",
"prepare": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -12,0 +12,0 @@ },

@@ -1,16 +0,55 @@

# Fauna Labs
This repository contains unofficial patterns, sample code, or tools to help developers build more effectively with [Fauna][fauna]. All [Fauna Labs][fauna-labs] repositories are provided “as-is” and without support. By using this repository or its contents, you agree that this repository may never be officially supported and moved to the [Fauna organization][fauna-organization].
...
---
### Configure the connection for your Region Group
When you created your database, you specified a Region Group. Connections to the database need to be configured with the corresponding Region Group endpoint. If this is a child database, the Region Group will already be set to match the parent database. If your database is in the `Classic` region group, then the default configuration is already set. Otherwise, configure your project for the correct Region Group as follows:
# FQL utilities
- Refer to the [Region Groups](https://docs.fauna.com/fauna/current/api/fql/region_groups#how-to-use-region-groups) documentation to obtain the correct endpoint for your Region Group.
- Reference the [Connections](https://docs.fauna.com/fauna/current/drivers/connections.html) documentation for how to correctly set the endpoint for your specific driver.
This repo contains code for user-defined functions (UDFs) to accomplish common tasks in Fauna. These UDFs are designed to be deployed with [Fauna Schema Migrate][fauna-schema-migrate].
## How to use
* `npm init -y`
* `npm install faunadb`
* `npm install --save-dev @fauna-labs/faunadb-schema-migrate`
* `npm install --save-dev @fauna-labs/fql-utilities`
* `npx fauna-schema-migrate init`
* Create a file named `tail.js` in the `fauna/resources` directory with the following code:
```js
import { Tail } from '@fauna-labs/fql-utilities';
export default Tail();
```
* `npx fauna-schema-migrate generate`
* `npx fauna-schema-migrate apply`
This creates a UDF named `Tail()` in your database. `Tail()` accepts one parameter, an [Array][fql-array], and returns a new array consisting of every element except the first. If the array is empty, `Tail()` returns an empty array.
You can then call the Tail UDF with the following code:
```fql
Let(
{
array: [0, 1, 2],
shortArray: Call("Tail", Var("array"))
},
Equals(Count(Var("shortArray")), 2) // true
)
```
## Included packages
### Collections
* [Tail()](src/collections/tail.ts)
* [Zip()](src/collections/zip.ts)
### Vector math
* [CrossProduct()](src/vector/crossProduct.ts)
* [DotProduct()](src/vector/dotProduct.ts)
[fauna]: https://www.fauna.com/
[fauna-labs]: https://github.com/fauna-labs
[fauna-organization]: https://github.com/fauna
[fauna-schema-migrate]: https://github.com/fauna-labs/fauna-schema-migrate
[fql-array]: https://docs.fauna.com/fauna/current/api/fql/types?lang=shell#array
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc