npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@radical-elements/lucentcms-node

v1.2.1

Published

JavaScript client for Lucent CMS

Downloads

47

Readme

lucentcms-node

LucentCMS driver for node js.

Installation

npm i @radical-elements/lucentcms-node

Import

We have two files that can be imported, the first one being the LucentClient and the second one being LucentQueryBuilder.

const { LucentClient , LucentQueryBuilder } = require('@radical-elements/lucentcms-node')

If you are inside an module or using vue js (if you have access to import keyword),

import { LucentClient, LucentQueryBuilder } from '@radical-elements/lucentcms-node'

Configure

For more information regarding the keys, you can visit LucentCMS API documentations.

let config = {
  channel : "channel-id",
  access_key : "access-key",
  secret_key : "secret-key",
  locale : "locale", // optional
}
      
let lucy = new LucentClient(config)

LucentClient methods

As of now, we have the following methods

  • get()
  • post()
  • put()
  • patch()
  • delete()
  • getDocuments()
  • createDocument()
  • upload()

All of these will return a promise that can be used with then, catch and finally.

get()

Method Signature

get(endpoint, params = {}, headers = {})

example


let params = {
    hello: 'world' // must follow a valid schema, available on Lucent API Documentation or use the query builder.
}

let headers = {
    'Custom-Header' : 'Custom-Value'
}

lucy.get('documents', params, headers) // headers and params are optional
  .then( res => {} )
  .catch( err => {})

post()

Method Signature

post(endpoint, data = {}, headers = {})

example

let data = {
    hello: 'world' // must follow a valid schema, available on Lucent API Documentation or use the query builder.
}

let headers = {
  'Custom-Header' : 'Custom-Value'
}

lucy.post('documents',data, headers)
  .then( res => {} )
  .catch( err => {})

put()

Method Signature

put(endpoint, data = {}, headers = {})

example

let data = {
    hello: 'world' // must follow a valid schema, available on Lucent API Documentation or use the query builder.
}


lucy.put('documents',data)
  .then( res => {} )
  .catch( err => {})

patch()

Method Signature

patch(endpoint, data = {}, headers = {})

example

let data = {
    hello: 'world' // must follow a valid schema, available on Lucent API Documentation or use the query builder.
}


lucy.patch('documents',data)
  .then( res => {} )
  .catch( err => {})

delete()

Method Signature

delete(endpoint, data = {}, headers = {})

example

let data = {
    hello: 'world' // must follow a valid schema, available on Lucent API Documentation or use the query builder.
}


lucy.delete('documents',data)
  .then( res => {} )
  .catch( err => {})

getDocuments()

Method Signature

getDocuments(params = {}, headers = {})

Params are same as get() method. You can use LucentQueryBuilder too.

createDocument()

Method Signature

createDocument(schema ,content = {}, headers = {}) 

schema is the schema you've created from the dashboard, or the "content type" you can say. content is the key-value pair where the value
can be string or an object ( if you are using/specifying locale).

When you are specifying locale.

 let content =  {
  "title": {
    "en-US": "An Amazing title",
    "fr-FR": "Un titre incroyable"
  }
}

The following is also valid, when you are not specifying locale,

let content =  {
  "title": "An Amazing title"
}

upload()

Method Signature

upload(formData, headers = {}) 

To upload a single or multiple files, you must create a form data instance and pass it as an argument in the upload method.


let form = new FormData

form.append('files[0]',event.target.files[0])

// or if you have multiple files

listOfFiles.forEach((file,i) => {
  form.append('files[' + i +']',file)
})

lucy.upload(form)
  .then(res => {
    console.log('successfully uploaded! check res.data[]',res)
  })
  .catch(err => {
    console.log('there was an error',err)
  })
  .finally(() => {
    console.log('finally do something!')
  })

LucentQueryBuilder

It is a helping class that will help you build up your query.

let builder = new LucentQueryBuilder()

// if you want to specify the schema ( content type )

let builder = new LucentQueryBuilder('articles')

With the LucentQueryBuilder you can filter and manipulate pagination, meta and includes. Filter options can be found here, the builder implements these options.

Available Methods

where(field, value)

or(field,value)

in(field,value)

regex(field,value)

exists(field,value) 

nexists(field,value) 

eq(field,value) 

ne(field,value) 

in(field,value)

nin(field,value)

lt(field,value) 

lte(field,value) 

gt(field,value) 

gte(field,value) 

false(field)

true(field)

ntrue(field,value) 

nfalse(field,value) 

null(field)
    
empty(field) 

meta(value)
    
limit(value)
    
skip(value)

sort(value)

include(value)

includeAll()

getQueryString() 

getQuery(withSchema = true)

As of this being a builder, every method except getQueryString and getQuery returns an instance of itself. Meaning you can do,


let builder = new LucentQueryBuilder('articles')

builder.where('title', 'hello')
  .or('author_name', 'Aryan Ahmed Anik')
  .in('category_id', '1,2,3')
  .meta('page')
  .sort('title') // or use '-title' for descending
  .include('a_related_schema') // or use .includeAll() to include every related schema
  .skip(10) 


lucy.get('documnets', builder.getQuery() )
  .then(res => {})
  .catch( err => {})

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.