@appveen/utils

中文文档
6.13.10-2.2发布于 2025/10/14BSD-3-ClauseCommonJS近 30 天下载 5209

appveen utils library

原始使用文档

# utils

This library contains various utility modules to ease development work.

  1. counter: Module to generate unique ID.
    1. transactionIdGenerator: returns a function which can be used in a mongoose schema pre save hook to generate a unique universalTransactionId.
    2. transactionIdGeneratorParallel: returns a function which can be used in a mongoose schema pre save hook to generate a unique universalTransactionId. This function should be used when hook is used in parallel middleware.
    3. getIdGenerator: returns a function which can be used in a mongoose schema pre save hook to generate a unique id for each document in a specific collection. It takes two arguments: 1. prefix 2. collectionName
    4. setDefaults: function to set default startValue of Id generated by getIdGenerator. It takes two arguments: 1. collectionName 2. defaultValue
    5. getCount: increments the count of Id and triggers a callback specified in the argument. It takes three arguments 1. collectionName 2. expiry of Id(can be null) 3. callback function
  2. cache: Helper functions to use Redis as a cache for user sessions
    1. uuid() : Generates a UUID without “-“
    2. addToken(_token, _default, _uuidOfUI, _expiry) : Add a new user token with the UUID for UI session with expiry
    3. addUISessions(_uuidOfUI, _token, _uiHeartbeatTimeOut): Start tracing a UI session
    4. handleHeartBeat(_uuidOfUI, _token, _uiHeartbeatTimeOut): handle heartbeats from UI
    5. showUISessions(_token): Get the list of active UI sessions
    6. isValidToken(_k): Check if the given key _k is a valid token
    7. isBlacklistedToken(_k): Check if the given key _k is a blacklisted token
    8. blacklist(_token, _expiry): Blacklist a token with the given expiry
    9. refreshToken(_tokenOld, _tokenNew, _expiry): Used when a new token is issued.
  3. date: returns a date, months before specified month. Takes one argument: month
  4. IDGenerator:
    1. getUniqueID: generates a uniqueID which can be a candidate _id of a model.
  5. moveToES: move data to elastic search
    1. init: initialize object. Takes four args crud, mastername, logger, fields.
    2. moveToES: move a document to elastic search server. Takes one arg: doc
    3. moveAll: move all deleted document to elastic search. Takes two args: req, res
  6. rand: returns a random integer. Takes one arg: length of integer.
  7. logger: returns a log4j object compatible with aou crud library.

版本与发布记录

@appveen/utils 共发布 46 个版本,首次发布于 2018/11/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
6.13.10-2.2latest2025/10/141.1 年前
6.13.102025/10/101.1 年前
2.2.12023/10/233 年前
2.2.02023/10/173 年前
2.1.132023/01/093 年前
2.1.122022/09/224 年前

关于 @appveen/utils 的常见问题

@appveen/utils 是什么?

appveen utils library

如何安装 @appveen/utils?

在项目目录运行 npm install @appveen/utils,或使用 pnpm add / yarn add / bun add。

@appveen/utils 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/appveen__utils 是否存在。

@appveen/utils 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@appveen/utils 可以商用吗?

@appveen/utils 使用 BSD-3-Clause 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。另外不得用原作者名义为衍生产品背书。以上为概括,不构成法律意见,请以许可原文为准。

@appveen/utils 的下载量有多少?

根据 npm 官方下载统计,@appveen/utils 在 2026/10/07 – 2026/11/05 这 30 天内被下载 5,209 次,日均约 174 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@appveen/utils 还在维护吗?

最新版本 6.13.10-2.2 发布于 2025/10/14(1.1 年前);至今共发布 46 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/11/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。