
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
@cloudbees/codeship-services-js
Advanced tools
Client Library to communicate with different Codeship Services for internal usage
Client Library to communicate with different Codeship Services for internal usage.
jest
yarn coverage
yarn start
getBuildGroupById(buildGroupId)
Returns a build group by a build group id.
getBuildGroupsByProjectIds(projectIds[, params])
Returns a list of build groups given an array of project ids. Optional parameters may be passed in the second argument:
user_id: allows you to filter the build groups by a user idpage_token: the specific page to loadlimit: the number of resultsgetBuildById(projectId, buildId)
Returns a build given a project id and a build id.
import BuildsService from '@cloudbees/codeship-services-js/builds'
const token = 12345
const baseUrl = 'http://example.com'
const buildsService = new BuildsService(token, baseUrl)
const projectIds = [
'0076ff3b-f97d-41d1-9bdf-b810b3135d0d',
'ac1e852c-7ecc-40a7-86ea-374d4801f73e',
'46058f72-0770-406a-80fd-8d0ed27c9de6'
]
const params = {
user_id: 'd5a032cd-f26b-4c96-8831-0e6a26e5fc9d'
}
try {
const { data: buildGroups } = await buildsService.getBuildGroupsByProjectIds(projectIds, params)
console.log(buildGroups)
} catch (error) {
console.error(error)
}
subscribe(buildId, projectId, component[, dataCallback, [ closeCallback]])
Starts a log stream given a build id, project id, and a component. The callback is optional, but it returns two arguments respectively:
error: a server error, if it existsresponse: the server responseAdditionally, the closeCallback is optional, and it provides the close event as it's only argument.
Only one stream may be subscribed to per class. All previous streams will be closed when the subscribe method is called.
import LogService from '@cloudbees/codeship-services-js/logs'
const token = 12345
const baseUrl = 'http://example.com'
const logService = new LogService(token, baseUrl)
const buildId = '56129bd7-3708-45fb-bfcb-422aef2e8bfb'
const projectId = 'a3d49ed2-c8e8-42df-8983-bdf115a4ea97'
logService.subscribe(buildId, projectId, 'default', (error, response) => {
if (!error) {
console.log(response)
}
})
The mocks package exposes mock services and functions that return random sets of mock data.
import { MockBuildService } from '@cloudbees/codeship-services-js/mock'
try {
const mockBuildService = new MockBuildService()
const id = 12345
const { data } = await mockBuildService.getBuildGroupById(id)
const { pagination, build_groups: buildGroups } = data
console.log(pagination, buildGroups)
} catch (error) {
console.error(error)
}
An options object can be passed in as the second parameter in any mock API call.
import { MockBuildService } from '@cloudbees/codeship-services-js/mock'
const mockBuildService = new MockBuildService()
const buildGroupId = 12345
const options = {
buildGroupCount: 5
}
const { data } = await mockBuildService.getBuildsByBuildGroupId(buildGroupId, options)
console.log(data)
Returns a mock object. Each function takes an object as its only parameter, allowing for the overwriting of specified values.
new MockLogService(token, baseUrl)new MockBuildService(token, baseUrl)mockService([params])serviceConclusions[]serviceStatuses[]mockStep([params])mockStepTraits([params])stepStatuses[]serviceGroupTypes[]stepTypes[]stepConclusions[]mockBuildGroup([params])mockCommit([params])repositoryHostTypes[]buildGroupTypes[]mockBuild([params])mockRunningBuild([params])mockStoppedBuild([params])mockApprovableBuild([params])mockBuildEvent([params])mockBuildResponse([params])buildStatuses[]buildConclusions[]mockPagination()mockLogResponse([params])mockLog([params])mockLogContext([params])import { mockBuild } from '@cloudbees/codeship-services-js/mock'
const id = '4bbaf6e7-6729-4168-a5de-0a7ecdd370ae'
const build = mockBuild({ id })
In order to access the provided cli implementation you can use node to access it directly like this:
node bin/local
If you prefer to access the script from anywhere by name
please run the npm link command first. This will create a global reference and make it available under services-js
npm link
services-js
To get a list of commands:
services-js --help
To pass in a token, baseUrl, and a function with arguments:
services-js --token 12345 --baseUrl http://localhost:8080 getBuildGroupById 5
To start a log stream:
services-js -u http://127.0.0.1:8080 -v -t $TOKEN logSubscribe $BUILD_ID $PROJECT_ID service_test
Make sure to pass in the protocol (http/https)!
Question [08/16/2018]: Why was @babel/register used for the local CLI, but a bundle is generated for the global CLI?
Answer: @babel/register has issues applying runtime transformations to global modules because it's technically in a node_modules folder. To get around this, a bundle is generated and the CLI tool is transpiled to es5. On the other hand, the babel runtimes speed up local development.
Question [08/27/2018]: Why aren't type the declarations split into multiple entry points like the various service classes?
Answer: Typescript + Webpack doesn't lend itself well to multiple type outputs, so that's why there's a root delcaration file.
Question [02/04/2019]: Why is the default axios adapter changed in the specs?
Answer: Axios creates a preflight OPTIONS request which causes specs to fail.
FAQs
Client Library to communicate with different Codeship Services for internal usage
We found that @cloudbees/codeship-services-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 16 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.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.