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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aoss-comm/service-module-common

v0.0.2

Published

AOSS 共享基础类

Readme

Core Modules

This is the foundational library of the entire application support system. It serves as the base common library to avoid version conflicts by including @ticatec/node-common-library via peerDependencies.

Installation

npm i @aoss-comm/service-module-common

Entity Class CommonUser

The CommonUser interface represents a generic user object that includes essential user details such as ID, code, name, department, and tenant.

Property Details

| Property | Type | Description | |--------|--------|----------------------------------------------------------------------------------------------------| | id | string | Unique identifier for the user | | code | string | Code representing the user | | name | string | User’s name | | dept | object | User’s department information: id: string - Department IDname: string- Department name | | tenant | object | User’s tenant information:code:code: string - Tenant codename: string - Tenant name |

Entity Class LoggedUser

The LoggedUser interface extends CommonUser, representing the currently logged-in user. It adds an optional property actAs for scenarios where the user operates as another user.

Property Details

| Property | Type | Description | |----------|------------|------------------| | actAs | CommonUser | (Optional) Represents the user being impersonated |


Controller Abstract Controller Classes

This set of controller classes provides an abstract implementation for service-layer-based controllers, mainly used for managing entities (create, update, delete) and performing queries. The classes have an inheritance hierarchy, and developers can override or extend methods to implement specific business logic.


1. BaseController

Features

BaseController is the base class for all controllers, responsible for initializing the service and logging functionalities.

Properties

| Property | Type | Description | |--------------|------|----------------------------| | service | T | Injected service instance | | logger | any | Logger, based on log4js |

Constructor

| Parameter | Type | Description | |-----------|------|------------------| | service | T | Injected service instance |


2. CommonController

Features

CommonController extends BaseController, adding entity validation and implementing basic CRUD operation interfaces.

New Properties

| Property | Type | Description | |---------|-------------------|------------------| | rules | ValidationRules | Validation rules for entities, optional|

Methods

| Method Name | Return Type | Description | |--------------------------|----------------------|----------------------------------------| | validateEntity(data) | void | Validates entity data against rules | | createNew() | RestfulFunction | Provides an interface for creating entities | | update() | RestfulFunction | Provides an interface for updating entities | | del() | RestfulFunction | Provides an interface for deleting entities | | checkInterface(name) | void | Verifies the existence of a service interface | | invokeServiceInterface(name, args) | Promise | Calls a service interface method | | _createNew(req) | Promise | Implements the logic for creating entities | | _update(req) | Promise | Implements the logic for updating entities | | _del(req) | Promise | Implements the logic for deleting entities (requires subclass implementation) | | getCreateNewArguments(req) | Array<any> | Abstract method, must be implemented by subclass to extract arguments for creation | | getUpdateArguments(req) | Array<any> | Abstract method, must be implemented by subclass to extract arguments for update |


3. AdminBaseController

Features

AdminBaseController is a foundational class for platform management controllers unrelated to tenants. It provides default logic for extracting arguments for creating and updating entities.

Methods

| Method Name | Return Type | Description | |--------------------------|------------------|--------------------------| | getCreateNewArguments(req) | Array<any> | Default implementation extracts creation arguments from the request body | | getUpdateArguments(req) | Array<any> | Default implementation extracts update arguments from the request body |


4. AdminSearchController

Features

AdminSearchController extends AdminBaseController, adding functionality for conditional queries.

Methods

| Method Name | Return Type | Description | |-------------|------------------|------------------------| | search() | (req) => any | Provides an interface for querying entities |


5. TenantBaseController

Features

TenantBaseController is designed for managing tenant-related entities. It provides default logic for extracting arguments for creating and updating entities and supports scenarios where the user operates as another user.

Methods

| Method Name | Return Type | Description | |--------------------------|------------------|--------------------------| | getLoggedUser(req) | CommonUser | Retrieves the current user, including impersonated users | | getCreateNewArguments(req) | Array<any> | Extracts creation arguments, including the logged-in user | | getUpdateArguments(req) | Array<any> | Extracts update arguments, including the logged-in user |


6. TenantSearchController

Features

TenantSearchController extends TenantBaseController, adding functionality for tenant-related conditional queries.

Methods

| Method Name | Return Type | Description | |-------------|------------------|------------------------| | search() | (req) => any | Provides an interface for querying entities |