
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@paxada/axios-client-generator
Advanced tools
Create an axios client package from a paxada project.
.doc.ts route file should be up-to-date..route.ts of the project should have a different name, even between different folders..interface.ts files in the routes folder do not use type that just returns void.npm i -D @paxada/axios-client-generator
Add in your package.json, in "scripts" field :
"generate:client": "paxada-axios-client-generate",
"publish:client": "cd {packageName} && npm run package-publish"
.interface.ts file..doc.ts.npm run checkTs.Run npm run generate:client to generate the client.
Add a axiosClient.config.json file at the root project.
{
"folderName": "string",
"packageName": "string",
"extraExports": "[string]",
"excludedRoutes": "[string]",
"includedRoutes": "[string]"
}
All fields are optional.
paxada-axios-client-generator -h
-e, --extra-export <paths...> Add extra export paths
-fn, --folder-name <string> Package alias in package.json name
-ir, --included-route <routes...> Included routes from src/routes
-er, --excluded-routes <routes...> Excluded routes from src/routes
-pn, --package-name <string> Package name
-cf, --config-file <string> Config .json file to generate the route. Default: axiosClient.config.json
Exemple:
paxada-axios-generate -fn bouncer-client -pn @waapi/bouncer-client -e src/clientUtils/index.ts
CLI options will overwrite the axiosClient.config.json data.
npm run publish:client
It will automatically patch the package version.
You should never update the generated client's code but the package version.
It will be overwritten anyway at the next generation.
The client catch the request errors so the methods will never throw. Instead, you should refer to the hasFailed and error fields of the promise response.
Example:
src/loaders/myProjectClient.ts
import { getAxiosClient, AxiosClient } from '@waapi/myProject-client';
import { MY_PROJECT_API_URL } from '@/config';
let myProjectClient: AxiosClient | undefined;
const createMyProjectClient = (url: string) => {
return getAxiosClient({ baseUrl: url, headers: {} });
};
export const getMyProjectClient = (): AxiosClient => {
if (myProjectClient === undefined) {
if (MY_PROJECT_API_URL === undefined) throw new Error('Missing MY_PROJECT_API_URL');
myProjectClient = createMyProjectClient(MY_PROJECT_API_URL);
}
return myProjectClient;
};
type Response<Data> =
| { hasFailed: true; error: { code: string; message: string } }
| { hasFailed: false; data: Data }
src/helpers/mockMyProjectClient
import { mockAxiosClient } from '@waapi/myProject-client';
import * as myProjectClient from '../loaders/myProjectClient';
export const mockMyProjectClient = () => {
const mocked = mockAxiosClient<jest.Mock>(jest.fn);
jest.spyOn(myProjectClient, 'getMyProjectClient').mockReturnValue(mocked);
return mocked;
};
.test.ts file
import { mockMyProjectClient } from '@/helpers/mockMyProjectClient';
import { getMyProjectClient } from '@/loaders/myProjectClient';
const doSomething = async () => {
const myProjectClient = getMyProjectClient()
const response = await myProjectClient.setHeaders({ machin: "chouette" }).private.entity.getMethod();
if (data.hasFailed) return "error";
return response.data;
}
describe(() => {
it ("Should call the mocked method", async () => {
const myProjectClientMock = mockMyProjectClient();
myProjectClientMock.private.entity.getMethod.mockResolvedValue({ hasFailed: false, data: "bidule" });
const result = await doSomething();
expect(myProjectClientMock.private.entity.getMethod).toHaveBeenCalled();
expect(result).toBe("bidule");
})
})
FAQs
Create an axios client package from a paxada project.
We found that @paxada/axios-client-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.