You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@based/core-client

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@based/core-client

``` import { BasedCoreClient } from '@based/core-client'

1.0.2
latest
npmnpm
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

@based/core

import { BasedCoreClient } from '@based/core-client'

// create client
const coreClient = new BasedCoreClient()

// connect
coreClient.connect({
  env: 'myEnv',
  org: 'myOrg',
  project: 'myProject'
})

coreClient.once('connect', (isConnected) => {
  console.info('connect', isConnected)
})

// authorize
const authState = await coreClient.auth(token)

// update schema
await coreClient.function('based-db-update-schema', {
  languages: ['en'],
  types: {
    thing: {
      prefix: 'th',
      fields: {
        name: { type: 'string' },
      },
    },
  },
})

// observe
coreClient.observe(
   'based-db-observe',
   (d) => {
     console.info('|-->', d)
   },
   { children: { name: true, id: true, $list: true } }
 )

// set (or any function)
const res = await coreClient.function('based-db-set', {
  type: 'thing',
  name: 'BLAAAA',
})

// get from observer
const res = await coreClient.get('based-db-observe')

FAQs

Package last updated on 16 Nov 2022

Did you know?

Socket

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