Socket
Socket
Sign inDemoInstall

@craftercms/classes

Package Overview
Dependencies
8
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @craftercms/classes

Crafter CMS utility classes for developing sites and applications


Version published
Maintainers
3
Created

Changelog

Source

4.1.0

@craftercms/classes

  • Update search API endpoint from /api/1/site/search/search.json to api/1/site/elasticsearch/search.

@craftercms/content

  • urlTransform, getTree, getItem, getChildren fix config argument to accept partial CrafterConfig
  • Update createQuery usage examples without SearchEngine parameter.

@craftercms/models

  • Update Endpoints interface ELASTICSEARCH property to SEARCH.

@craftercms/search

  • Remove ElasticQuery query implementation for ElasticSearch.
  • Use Query class instead of removed ElasticQuery class in createQuery function.
  • Update createQuery usage examples without SearchEngine parameter.

Readme

Source

npm (scoped)

@craftercms/classes

This package contains useful classes for developing craftercms websites & applications.

Usage

All of Crafter CMS packages can be used either via npm or in plain html/javascript via regular script imports.

  • Install module using yarn or npm
    • yarn add @craftercms/classes or
    • npm install @craftercms/classes
  • Import and use the classes you need

Package Index

The examples below assume usage in the style of using via npm. If you're using the bundles, directly importing as a script in the browser, these functions will be under the global variable named craftercms.classes (i.e. window.craftercms.classes).

crafterConf

Example

The crafterConf is a special class to globally configure CrafterCMS libraries. Most services you can supply these configurations on a call-by-call basis, but you may simplify by configuring all services via crafterConf early-on on your application bootstrap.

import { crafterConf } from '@craftercms/classes';

crafterConf.configure({
  // Set the base url for all service calls (i.e. urls get built `${baseUrl}/some-endpoint.json`)
  baseUrl: process.env.CRAFTER_HOST_NAME,
  // Set the site id of the site to fetch from/against
  site: process.env.CRAFTER_SITE_NAME,
  // Optionally, set cors mode to true/false (default is false)
  cors: true,
  // Optionally, set any headers you want SDK requests to go out with
  headers: {
    SOME_HEADER: 'some-value'
  }
});

SDK Service

SDKService Provides http get and post methods for Crafter services

Examples
  import { httpGet } from '@craftercms/classes';

  const requestURL = "/some-url";

  httpGet(requestURL, { 
    crafterSite: "editorial"
  }).subscribe((response) => {
    console.log(response);
  })

Keywords

FAQs

Last updated on 19 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc