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

@rsql/builder

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rsql/builder - npm Package Compare versions

Comparing version 0.0.1-next.1 to 0.0.1-next.2

dist/index.d.ts

29

package.json
{
"name": "@rsql/builder",
"description": "RSQL builder",
"description": "RSQL High level API",
"repository": "https://github.com/piotr-oles/rsql.git",
"license": "MIT",
"author": "Piotr Oleś <piotrek.oles@gmail.com>",
"version": "0.0.1-next.1",
"version": "0.0.1-next.2",
"sideEffects": false,
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"module": "dist/index.esm.js",
"browser": "dist/index.umd.js",
"files": [
"lib"
"dist"
],
"keywords": [
"rsql",
"fiql",
"builder"
],
"scripts": {
"clean": "rm -rf ./lib && rm -f tsconfig.tsbuildinfo",
"compile": "tsc -b tsconfig.json",
"dev": "yarn compile --watch --preserveWatchOutput",
"clean": "rm -rf ./lib && rm -f tsconfig.tsbuildinfo && rm -rf ./dist",
"compile": "tsc -b tsconfig.json && rollup -c && dts-bundle --name \"@rsql/builder\" --main lib/index.d.ts --out ../dist/index.d.ts",
"build": "yarn clean && yarn compile"

@@ -24,6 +30,3 @@ },

"dependencies": {
"@rsql/ast": "0.0.1-next.1",
"@rsql/definitions": "0.0.1-next.1",
"@rsql/emitter": "0.0.1-next.1",
"@rsql/parser": "0.0.1-next.1"
"@rsql/ast": "0.0.1-next.2"
},

@@ -38,3 +41,3 @@ "jest": {

},
"gitHead": "bd96ff0ebd8826bd80799027f6755612a206512b"
"gitHead": "1a690bf021f57c9201d1e02d263f170a419f5c6c"
}

@@ -1,7 +0,7 @@

<div align="center">
# @rsql/builder
<h1>@rsql/builder</h1>
<p>High level API for RSQL for Node.js and Browsers</p>
<p>⚠️ WARNING: This package is still in development - API may break compatibility without upgrading major version! ⚠️</p>
API for building RSQL for Node.js and Browsers
⚠️ WARNING: This package is still in development - API may break compatibility without upgrading major version! ⚠️
[![npm](https://img.shields.io/npm/v/@rsql/builder)](https://www.npmjs.com/package/@rsql/builder)

@@ -14,4 +14,2 @@ [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)

</div>
## Installation

@@ -29,28 +27,34 @@

#### `builder.comparision(selector, operator, value): ComparisionNode`
#### `builder.comparison(selector, operator, value): ComparisonNode`
Creates new `ComparisionNode` - can be used as a base for custom operator factory
Creates new `ComparisonNode` - similar to the `createComparisonNode` from the [`@rsql/ast`](../ast)
but with simpler API (no need to create `SelectorNode` or `ValueNode` and accepts numbers as values)
#### `builder.<operator>(selector, value): ComparisionNode`
#### `builder.<operator>(selector, value): ComparisonNode`
```
builder.eq(selector, value): ComparisionNode
builder.neq(selector, value): ComparisionNode
builder.le(selector, value): ComparisionNode
builder.lt(selector, value): ComparisionNode
builder.ge(selector, value): ComparisionNode
builder.gt(selector, value): ComparisionNode
builder.eq(selector, value): ComparisonNode
builder.neq(selector, value): ComparisonNode
builder.le(selector, value): ComparisonNode
builder.lt(selector, value): ComparisonNode
builder.ge(selector, value): ComparisonNode
builder.gt(selector, value): ComparisonNode
```
Creates new `ComparisionNode` with the predefined operator for single value.
Creates new `ComparisonNode` with the predefined operator for single value.
#### `builder.<operator>(selector, values): ComparisionNode`
#### `builder.<operator>(selector, values): ComparisonNode`
```
builder.in(selector, values): ComparisionNode
builder.out(selector, values): ComparisionNode
builder.in(selector, values): ComparisonNode
builder.out(selector, values): ComparisonNode
```
Creates new `ComparisionNode` with the predefined operator for multiple values.
Creates new `ComparisonNode` with the predefined operator for multiple values.
#### `builder.logic(expressions, operator): LogicNode`
Creates new `LogicNode` - similar to the `createLogicNode` from the [`@rsql/ast`](../ast)
but with simpler API (accepts one or more expressions)
#### `builder.<operator>(...expressions): LogicNode`

@@ -65,25 +69,4 @@

#### `builder.emit(ast): string`
Emits RSQL string from the Abstract Syntax Tree. Same as `emit` function from `@rsql/emitter` package.
#### `builder.parse(rsql): ExpressionNode`
Parses RSQL string and returns Abstract Syntax Tree. Same as `parse` function from `@rsql/parser` package.
## Example
```javascript
import builder from "@rsql/builder";
function createDateRangeQuery(selector, from, to) {
return builder.emit(builder.and(builder.ge(selector, from.toISOString()), builder.le(selector, to.toISOString())));
}
console.log(createDateRangeQuery("createdAt", new Date("2019-07-10"), new Date("2020-04-29")));
// createdAt>=2019-07-10T00:00:00.000Z;createAt<=2020-04-29T00:00:00.000Z
```
## License
MIT
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