Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@master/business
Advanced tools
A business data model for quick verification, access and output of specific data formats.
npm install @master/business
tsconfig.json
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true
}
}
import { Business, BusinessModel, Input, Output } from '@master/business';
@Business()
export class MyBusiness extends BusinessModel {
@Input()
prop1: string;
@Output()
prop2: number;
@Input()
@Output()
prop3: OtherBusinessModel;
...
}
@Input(options?)
Decorate the property that need to be validated
options | type | description |
---|---|---|
disabled | boolean | Used to disable the @Input() decoration behavior of extended objects |
required | boolean | Is the property required |
arrayType | any | Assuming the type is YourType[], the target type must be additionally defined here |
enum | Record<string, any> | Assuming the type is enum, the target type must be additionally defined here |
@Output(options?)
Decorate the property that need to be outputed
options | type | description |
---|---|---|
disabled | boolean | Used to disable the @Input() decoration behavior of extended objects |
The front-end inputs the registration data to the server through the sign-up API, and then outputs the registration result back to the front-end.
├── businesses
│ └── member
│ ├── member.controller.ts
│ ├── member.service.ts
│ ├── member.ts // DAO
│ └── signing-up.ts
// signing-up.ts
import { Business, BusinessModel, Input } from '@master/business';
@Business()
export class SigningUp extends BusinessModel {
@Output()
@Input({ required: true })
name: string;
@Output()
@Input()
address: SigningUpAddress;
@Output()
type = 'general';
// other fields for quick access
a = 1;
b = 2;
c = 3;
d = 4;
}
@Business()
class SigningUpAddress extends BusinessModel {
@Output()
@Input()
city: string;
@Input()
district: string;
@Input()
street: string;
}
// member.controller.ts
import { Business, BusinessModel, Input, validate } from '@master/business';
import { MemberService } from './member.service.ts';
import { SigningUp } from './signing-up.ts';
@Controller('member')
export class MemberController {
constructor(
private memberService: MemberService
) {}
@Post()
async SignUp(
@Body() data: any,
@Res() res: Response
): Promise<void> {
const signingUp = new SigningUp(data);
const errors = signingUp.validate();
// validate
if(errors.length) {
// property error
res.status(400).send(errors);
} else {
// correct
// business logic process here ...
this.memberService.signUp(signingUp);
res.status(200).send(signingUp);
}
}
}
{
name: "joy",
address: {
city: "taipei",
district: "zhongshan",
street: "my home"
}
}
{
name: "joy",
address: {
city: "taipei",
district: "zhongshan",
street: "my home"
},
type: 'general',
a: 1,
b: 2,
c: 3,
d: 4
}
{
name: "joy",
address: {
city: "taipei"
},
type: 'general'
}
@Business()
class MyBusiness extends BusinessModel {
@Input()
str: string;
@Input()
num: number;
@Input({ enum: MyEnum })
enum: MyEnum;
@Input({ arrayType: MyArrayType })
arrayType: MyArrayType[];
}
BenSeage | Aron | Miles | Lola |
creator | designer | maintainer | maintainer |
FAQs
A business data model for quick verification, access and output of specific data formats.
The npm package @master/business receives a total of 0 weekly downloads. As such, @master/business popularity was classified as not popular.
We found that @master/business 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.