
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@gokiteam/dev-tools
Advanced tools
Tools and common codes that we may use in our microservices are provided in this module.
Using npm command:
npm i --save @gokiteam/dev-tools
There's a Container entity that can be configured to create singleton instances of provided helpers. You can declare and instantiate it once and use that instance everywhere in your project. You can also import and instantiate one helper on demand if needed, but it's recommended to use Container entity to have a cleaner implementation and prevent redundant code.
Each config param is optional and can be defined if needed.
const container = new Container ({
logger: WinstonLogger,
config: {
redis: {/* config here */},
rollBar: {/* config here */},
errorLogger: {/* config here */},
lockProvider: {/* config here */},
endpoints: {/* config here */},
healthCheck: {/* config here */},
}
})
This component uses ioredis and creates a simple interface for redis.
Endpoints is a component that represents how other services can communicate with this service. It includes all gRPC and REST APIs and also all messaging consumers.
// batch
container.Endpoints.batchRegister([
{
group: 'group.nestedGroup',
name: 'endpointName',
schema: JoiToSwagger(JoiSchema),
isPublic: true,
responses: []
},
{
group: 'group.nestedGroup',
name: 'endpointName',
schema: JoiToSwagger(JoiSchema),
isPublic: true,
responses: []
}
])
// single
container.Endpoints.register({
group: 'group.nestedGroup',
name: 'endpointName',
schema: JoiToSwagger(JoiSchema),
isPublic: true,
responses: []
})
const endpoints = container.Endpoints.list()
Logs the error appropriately and if RollBar is enabled, forwards the data to it too.
container.ErrorLogger.log(error, 'message', { /* any meta data */ })
This component is responsible for preparing the health status of the service. Don't forget to register new components to the Health Check component to be checked during calls.
container.HealthCheck.register({
group: 'group.nestedGroup',
name: 'TestComponent',
method: async () => {
// async method to prepare the item's health
return {}
}
})
const status = await container.HealthCheck.check()
It creates an interface for locking and unlocking resources with RedLock.
const lock = await container.LockProvider.lock(`resource`)
// operations...
lock.unlock()
There are some utils in this module that can be imported and used.
Converts Joi Schema to swagger object.
const swaggerSchema = Utils.JoiToSwagger(joiSchema)
This component creates a swagger schema from one or several connected models. This component can be used to describe the response of APIs.
const output = new Utils.ObjectDescriber({ schema: User, mask: 'id,firstName,lastName,email'})
.extend({ key: 'ads', objectModel: { schema: Ad, mask: 'id,category' }, array: true })
.extend({ key: 'likes', objectModel: { schema: Like, mask: 'id,link' } })
.join({ key: 'books', objectModel: { schema: Book, mask: 'id,title,author' } })
.format()
The output will be something like this:
{
id: { type: 'string' },
firstName: { type: 'string' },
lastName: { type: 'string' },
email: { type: 'string' },
ads: {
type: 'array',
items: {
id: { type: 'string' },
category: { type: 'string' }
}
},
likes: {
id: { type: 'string' },
link: { type: 'string' }
},
books: {
id: { type: 'string' },
title: { type: 'string' },
author: { type: 'string' }
}
}
If you set the second parameter of the constructor to { array: true }, the output will be in the following format:
{
type: 'array',
items: <ITEMS-SCHEMA>
}
This component receives several async functions and executes all of them and return the response.
const runner = new Utils.PromiseRunner()
runner.add(async () => {
const output1 = await task1()
// ...
})
runner.add(async () => {
const output2 = await task2()
// ...
})
await runner.run()
Link external documents in this section
Please create a task for support.
Please contribute using Git Convention. Create a branch, add commits, and create a merge request.
FAQs
Goki Team Dev Tools
The npm package @gokiteam/dev-tools receives a total of 4 weekly downloads. As such, @gokiteam/dev-tools popularity was classified as not popular.
We found that @gokiteam/dev-tools demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.