Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
@alist/core
Advanced tools
English | 简体中文
The list state core management package does not rely on any third-party UI frameworks. This package will provide the following features:
- Manage Filter status
- Manage Table status
- Manage Pagination status
- Manage List LifeCycle
- Manage dependencies between Filter, Table, Pagination
npm install --save @alist/core
In the middle and back-end field, lists are indispensable scenarios which integrate the search area (form) and data display area (Table or chart). Lists act as background system portals, with the vast majority of pages.
AList is a unified and efficient solution for this scenario.
AList is a framework that integrates mature solutions from all parties. The search area uses UForm, Pagination, and the Table area uses Fusion-Next or Ant-Design or other third-party component libraries.
create a List instance
Signature
createList(options?: IListProps): IList
Usage
import createList from '@alist/core'
const list = createList({
url: '/data.json'
})
Signature
type LifeCycleHandler<T> = (payload: T, context: any) => void
new ListLifeCycle(handler: LifeCycleHandler<Payload>)
new ListLifeCycle(...type: ListLifeCycleTypes, handler: LifeCycleHandler<Payload>...)
new ListLifeCycle(handlerMap: { [key: ListLifeCycleTypes]: LifeCycleHandler<Payload> })
Usage
import { createList, ListLifeCycle, ListLifeCycleTypes } from '@alist/core'
const list = createList({
lifecycles:[
new ListLifeCycle(({ type, payload })=>{
// God mode, full monitoring
}),
new ListLifeCycle(
ListLifeCycleTypes.ON_LIST_INIT,
(payload)=>{
// Accurate monitoring
}),
new ListLifeCycle({
[ListLifeCycleTypes.ON_LIST_INIT]: (payload)=>{
// Object form accurate listener
}
}),
]
})
enum ListLifeCycleTypes {
ON_LIST_ERROR = 'onListError',
ON_LIST_EMPTY = 'onListEmpty',
ON_LIST_WILL_INIT = 'onListWillInit',
ON_LIST_INIT = 'onListInit',
WILL_LIST_UPDATE = 'willListUpdate',
DID_LIST_UPDATE = 'didListUpdate',
}
type IListQueryMethod = 'GET' | 'POST'
interface IListQueryOptions {
url: string,
data: IListQueryData,
method?: IListQueryMethod,
}
type IListQuery = (queryOptions: IListQueryOptions) => Promise<any>
type IListQuerySort = 'desc' | 'asc'
type IListFilterData = IListKVMap<any>
type IListQueryData = {
sort?: IListKVMap<IListQuerySort>,
currentPage: number,
pageSize: number,
filterData?: IListFilterData,
_t: number,
}
interface IListProps {
dataSource?: any,
validateConfig?: IListKVMap<any>,
url?: string,
method?: IListQueryMethod,
params?: any,
paramsFields?: string | string[],
pageSize?: number,
currentPage?: number,
total?: number,
totalPages?: number,
autoLoad?: boolean, // automatically load if there is a url
defaultFilterValues?: any,
multiple?: boolean, // multiple instance of table
filterConfig?: any, // config of search area
query?: IListQuery, // customize query
formatBefore?: (queryData: IListQueryData) => any | void, // format query data before request
formatAfter?: (response: any) => any | void, // format response data after request
formatFilter?: (filterData: IListFilterData) => any | void, // format search area data which will affect query data
lifecycles?: ListLifeCycle, // lifecycles management
}
type IListDataSource = any[]
enum ModeType {
DATASOURCE = 'dataSource',
URL = 'url',
QUERY = 'query',
}
type IListMode = ModeType.DATASOURCE | ModeType.URL | ModeType.QUERY
interface IListPageData {
pageSize: number,
currentPage: number,
total: number,
totalPages: number,
}
interface IListFunctionOptions {
withFetch?: boolean,
withRender?: boolean,
reset?: boolean,
filterData?: IListFilterData,
enableInvalid?: boolean
}
interface IList {
getDataSource: () => IListDataSource,
setDataSource: (data: IListDataSource) => void,
setPaginationDataSource: (data: IListDataSource) => void,
getPaginationDataSource: () => IListDataSource,
getMode: () => IListMode,
getFilterData: () => IListFilterData,
setFilterData: (data: IListFilterData) => void,
getFilterInstance: () => any,
getFilterProps: () => IFilterInitProps,
setFilterInstance: (form?: any) => void,
getPageData: () => IListPageData,
setPageData: (data: IListPageData) => void,
getMultipleData: () => IListMultipleData,
setMultipleData: (data: IListMultipleDataParams) => void,
setMultiplePageSize: (data: IListMultiplePageSize) => void,
getValidateConfig: () => IListKVMap<any>,
setValidateConfig: (validateConfig?: IListKVMap<any>) => void,
clear: () => void,
search: () => void,
reset: () => void,
refresh: () => void,
notify: (type: ListLifeCycleTypes, paylaod?: any) => void
setLoading: (loading: boolean, fnOpts?: IListFunctionOptions) => void,
getLoading: () => boolean,
setUrl: (url: string, fnOpts?: IListFunctionOptions) => void,
setQuery: (query: IListQuery, fnOpts?: IListFunctionOptions) => void,
setParams: (params: IListParams, fnOpts?: IListFunctionOptions) => void,
getParams: () => IListParams,
setCurrentPage: (currentPage: number, fnOpts?: IListFunctionOptions) => void,
setPageSize: (pageSize: number) => void,
on: (key: EventType, cb?: IListEvent) => void
removeListener: (key: EventType, cb?: IListEvent) => void,
}
FAQs
desc
The npm package @alist/core receives a total of 92 weekly downloads. As such, @alist/core popularity was classified as not popular.
We found that @alist/core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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 found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.