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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tencent-sdk/cls

v1.0.1

Published

Tencent cloud cls sdk

Downloads

7,638

Readme

Tencent Cloud CLS SDK

This is a SDK tool for Tencent Cloud CLS service.

Usage

Cls is the only class for create a client request instance. You can use it like below:

import { Cls } from '@tencent-sdk/cls';

const client = new Cls({
  region: 'ap-guangzhou',
  secretId: 'Please input your SecretId',
  secretKey: 'Please input your SecretKey',
  token: 'Please input your Token',
  debug: false,
});

Support methods:

getLogsetList

Get logset list:

const res = await client.getLogsetList();

createLogset

Create logset:

const res = await client.createLogset({
  logset_name: 'cls-test',
  period: 7,
});

getLogset

Get logset:

const res = await client.getLogset({
  logset_id: 'xxx-xxx',
});

deleteLogset

Delete logset:

const res = await client.deleteLogset({
  logset_id: 'xxx-xxx',
});

getTopicList

Get topic list:

const res = await client.getTopicList();

createTopic

Create topic:

const res = await client.createTopic({
  logset_id: 'xxx-xxx',
  topic_name: 'cls-test-topic',
});

getTopic

Get topic:

const res = await client.getTopic({
  topic_id: 'xxx-xxx',
});

deleteTopic

Delete topic:

const res = await client.deleteTopic({
  topic_id: 'xxx-xxx',
});

updateIndex

Update topic index:

const res = await client.updateIndex({
  topic_id: 'xxx-xxx',
  effective: true,
  rule: {
    full_text: {
      case_sensitive: true,
      tokenizer: '!@#%^&*()_="\', <>/?|\\;:\n\t\r[]{}',
    },
    key_value: {
      case_sensitive: true,
      keys: ['SCF_RetMsg'],
      types: ['text'],
      tokenizers: [' '],
    },
  },
});

getIndex

Get topic index:

const res = await client.getIndex({
  topic_id: 'xxx-xxx',
});

Custom methods

If you need methods expect above list, you can use client.request() like below:

// create cls shipper
const res = await client.request({
  path: '/shipper',
  method: 'POST',
  data: {
    topic_id: 'xxxx-xx-xx-xx-xxxxxxxx',
    bucket: 'test-1250000001',
    prefix: 'test',
    shipper_name: 'myname',
    interval: 300,
    max_size: 100,
    partition: '%Y%m%d',
    compress: {
      format: 'none',
    },
    content: {
      format: 'csv',
      csv_info: {
        print_key: true,
        keys: ['key1', 'key2'],
        delimiter: '|',
        escape_char: "'",
        non_existing_field: 'null',
      },
    },
  },
});

Options

const client = new Cls(ClsOptions);

ClsOptions for Cls Construct

| Name | Description | Type | Required | Default | | --------- | ------------------------------------ | ------- | -------- | ------------ | | region | request region | string | true | ap-guangzhou | | secretId | tencent account secret id | string | true | '' | | secretKey | tencent account secret key | string | true | '' | | token | tencent account token | string | false | '' | | debug | whether enable log debug info | boolean | false | false | | timeout | request timeout, unit ms | number | false | 5000 | | expire | expire time for signature, unit ms | number | false | 300000 |

License

MIT