Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@qn-pandora/app-sdk
Advanced tools
@qn-pandora/app-sdk
对 Pandora 平台搜索相关 API 进行封装
import { SearchManager } from '@qn-pandora/app-sdk'
const searchCondition = {
queryString: 'repo="testjwzfr"',
time: {
start: 0,
end: 1589770122581
}
}
const option = {
task: {
event: true,
summary: true,
timeline: true,
result: true
}
}
const searchManager = new SearchManager({
searchCondition: searchCondition,
option: option
})
searchManager.on('done', data => {
console.log('data', data)
})
searchManager.search()
import { SearchManager } from '@qn-pandora/app-sdk'
const searchCondition = {
queryString: 'repo="testjwzfr"',
time: {
start: 0,
end: 1589770122581
}
}
const option = {
task: {
event: true,
summary: true,
timeline: true,
result: true
}
}
const searchManager = new SearchManager({
option: option
})
searchManager.on('done', data => {
console.log('data', data)
})
searchManager.search(searchCondition)
import { SearchManager } from '@qn-pandora/app-sdk'
const searchCondition = {
queryString: 'repo="testjwzfr"',
time: {
start: 0,
end: 1589770122581
}
}
const option = {
task: {
event: true,
summary: true,
timeline: true,
result: true
}
}
const searchManager = new SearchManager({
option: option
})
const jobId = await searchManager.search(searchCondition)
searchManager.on('done', data => {
const event = searchMangeer.getEvent(jobId)
console.log('event', event)
})
可通过 on 函数注册监听事件回调函数
对 Pandora 平台登录相关 API 进行封装
import { LoginManager, ELoginType } from '@qn-pandora/app-sdk'
const loginManager = new LoginManager(ELoginType.PANDORA)
loginManager.login({
username: 'admin',
password: 'admin'
})
import { LoginManager, ELoginType } from '@qn-pandora/app-sdk'
const loginManager = new LoginManager(ELoginType.SSO)
loginManager.login({
token:
'MjNGNDEweHdnQ2pOWVpuNFpINkkzUVJQZ0I0MnBab2RNTGt6UGcya0h0aUFpVVNGOjcxNzdmNjRhN2RmZDdjN2UxMGQ1MmRiNmQxYmZkNGU0NjJlNzU3NDdhNjU1NGMyNzJlMzMwODgyNzFiY2IzODMyZGJiZTA1YTM4OWI3NDIyOTgxODkwZGYzYjMxYWI2NTk2OTY0MmI1NDZjMjMxZDRiZjNlZGE3YWMyYjc4MzFj'
})
方法返回都为 Promise
对 Pandora 平台报表管理相关 API 进行封装
import { ReportManager } from '@qn-pandora/app-sdk'
const fetchAll = true // false by default
const pageSize = 20 // 10 by default
const reportManager = new ReportManager(fetchAll, pageSize)
const lists = await reportManager.listReports()
const reportId = '0'
const info = await reportManager.getReport(reportId)
const report = {
name: 'testReport',
time: {
global: false,
preset: 'AllTime'
},
spl: 'repo="tracing" | stats count() by host | where count > 10',
description: 'description'
}
const res = await reportManager.createReport(report)
const report = {
name: 'testReport',
time: {
global: false,
preset: 'AllTime'
},
spl: 'repo="tracing" | stats count() by host | where count > 10',
description: 'updated description'
}
const res = await reportManager.updateReport(report)
const reportId = '0'
const res = await reportManager.deleteReport(reportId)
对 Pandora 平台数据集管理相关 API 进行封装
import { DatasetManager } from '@qn-pandora/app-sdk'
const fetchAll = true // false by default
const pageSize = 20 // 10 by default
const datasetManager = new DatasetManager(fetchAll, pageSize)
const list = await datasetManager.listDatasets()
const datasetId = '0'
const info = await getDataset(datasetId)
const baseDataset = {
name: 'ds1',
description: 'description',
category: 'c1',
transforms: [{ type: 'fields', fields: ['field1'] }],
schemas: [{ name: 'name', type: 'long' }],
dataSource: {
query: 'query_string',
time: {
relative: 'relative',
preset: 'preset',
timeShift: 'timeShift',
global: true
}
}
}
const res = await datasetManager.createDataset(baseDataset)
const baseDataset = {
name: 'ds1',
description: 'description',
category: 'c1',
transforms: [{ type: 'fields', fields: ['field1'] }],
schemas: [{ name: 'name', type: 'long' }],
dataSource: {
query: 'query_string',
time: {
relative: 'relative',
preset: 'preset',
timeShift: 'timeShift',
global: true
}
}
}
const res = await datasetManager.updateDataset(baseDataset)
const datasetId = '0'
const res = await deleteDataset(datasetId)
const categories = ['c1', 'c2']
const res = await datasetManager.setCategories(categories)
const list = await datasetManager.listCategory()
const datasetId = '0'
const datasetSpl = await datasetManager.getDatasetSpl(datasetId)
const transforms = {
type: 'fields',
fields: ['f1', 'f2']
}
const transformSpl = await datasetManager.getTransformSpl(transforms)
baseDataset
对 Pandora 平台仓库管理相关 API 进行封装
import { RepoManager } from '@qn-pandora/app-sdk'
const fetchAll = true // false by default
const pageSize = 20 // 10 by default
const repoManager = new RepoManager(fetchAll, pageSize)
const list = await repoManager.listRepos()
const repoName = 'repo'
const info = await repoManager.getRepo(repoName)
const repo = {
name: 'repo',
description: 'desciption',
retention: -1
}
const res = await repoManager.createRepo(repo)
const repo = {
name: 'repo',
description: 'updated desciption',
retention: -1
}
const res = await reportManager.updateReport(report)
const repoName = 'repo'
const res = await reportManager.deleteRepo(repoName)
对 Pandora 平台来源管理相关 API 进行封装
import { SourceTypeManager } from '@qn-pandora/app-sdk'
const fetchAll = true // false by default
const pageSize = 20 // 10 by default
const sourceTypeManager = new SourceTypeManager(fetchAll, pageSize)
const list = await sourceTypeManager.listSourceType()
const sourceTypeName = 'sourceType'
const info = await sourceTypeManager.getSourceTypeByName(sourceTypeName)
const sourceType = {
name: 'sourceType',
description: 'desciption',
category: 'c1',
line: {
type: 'auto'
},
datetime: {
type: 'now'
}
advance: {
charset: 'utf-8',
fieldDiscovery: false
}
}
const res = await sourceTypeManager.createSourceType(sourceType)
const sourceTypeName = 'sourceType'
const res = await sourceTypeManager.deleteSourceType(sourceTypeName)
对 Pandora 平台应用权限管理相关 API 进行封装
import { PermissionManager } from '@qn-pandora/app-sdk'
const permissionManager = new PermissionManager()
即通过权限(operation)查看当前用户有该权限的功能(function)。
const params = {
operation: 'list'
}
const fucntions = await permissionManager.listFunctions(params)
const params = {
function: 'func1'
}
const operations = await permissionManager.listOperationsByFunction(params)
const params = {
funcName: 'func1',
resourceID: '1',
}
const rolePerms = await permissionManager.listRolePerms(params)
const params = {
funcName: 'func1',
resourceID: '1',
owner: 'o1'
}
const res = await permissionManager.updateOwner(params)
const params = {
funcName: 'func1',
resourceIds: ['0','1']
owner: 'o1'
}
const res = await permissionManager.updateOwners(params)
const params = {
funcName: 'func1',
resourceID: '0',
rolePerms: [
{
role: 'role0',
operation: 'list'
},
{
role: 'role1',
operation: 'edit'
}
]
}
const res = await permissionManager.updateResource(params)
const params = {
funcName: 'func1',
resourceIds: ['0','1'],
rolePerms: [
{
role: 'role0',
operation: 'list'
},
{
role: 'role1',
operation: 'edit'
}
]
}
const res = await permissionManager.updateResources(params)
bind 装饰器用于为装饰的函数绑定 this 指针
在类中装饰类的方法:
import bind from '@qn-pandora/app-sdk'
export class SomeClass extends UpperClass {
@bind
someFunction() {
this.setData(someData)
// setData挂载在UpperClass上,this绑定在当前class上
}
}
bind装饰过的函数在被重载时,不可在重载函数中调用父集的当前函数,会导致父集的当前函数this指针异常。
FAQs
Pandora APP 核心渲染逻辑 SDK
The npm package @qn-pandora/app-sdk receives a total of 24 weekly downloads. As such, @qn-pandora/app-sdk popularity was classified as not popular.
We found that @qn-pandora/app-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.