@cubicweb/rql-generator
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

@cubicweb/rql-generator

This library exposes a set of helpers to make building RQL transactions simpler.

Installation

@cubicweb/rql-generator is available from NPM:

# With NPM
npm i @cubicweb/rql-generator
# Or with Yarn
yarn add @cubicweb/rql-generator

Usage

This library works on an existing transaction object. This allows you to combine different helpers on the same object to create complex transactions.

Please refer to the documentation of @cubicweb/client on how to create the instanceSchema and client parameters.

import { Transaction } from "@cubicweb/client";
import {instanceSchema, client} from "../data"

const transaction = new Transaction()
const { resolveEntity } = pushEntityFromEid(transaction, instanceSchema, 5, "BlogEntry", [
    "title",
    "content"
]);
const result = await client.executeTransaction(transaction)
const entity = resolveEntity(result)
console.log(entity)
// Will print {title: "entity title", content: "entity content"}

Documentation

You can find the full documentation with examples here.

Contribute

All @cubicweb libraries are in the cubicwebjs monorepo. Please refer to the main README.

Get Help

Contact us on Matrix and check the roadmap on the CubicWeb Repository.

Package Sidebar

Install

npm i @cubicweb/rql-generator

Weekly Downloads

5

Version

0.2.0

License

LGPL-3.0-or-later

Unpacked Size

171 kB

Total Files

72

Last publish

Collaborators

  • fbessou
  • famarger
  • nchauvat