
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
@canonical/jujulib
Advanced tools
This project provides a JavaScript API client library for interacting with the Juju WebSocket API.
To access the Juju API, a connection must be made to either a Juju controller or a Juju model.
import { connect } from "@canonical/jujulib";
import Client from "@canonical/jujulib/dist/api/facades/client";
import ModelManager from "@canonical/jujulib/dist/api/facades/model-manager";
// Nodejs
// import WebSocket from "ws";
const serverURL = "ws://localhost:17070";
const credentials = {
username: "admin",
password: "test",
};
// Connect to the controller
const controller = await connect(`${serverURL}/api`, {
facades: [ModelManager],
wsclass: WebSocket,
});
let conn = await controller.login(credentials);
// Get the list of models
const modelManager = conn.facades.modelManager;
const response = await modelManager.listModels({
tag: conn.info.user.identity,
});
const models = response["user-models"];
console.log("models:", models);
// Close the connection to the controller
conn.transport.close();
// Login to each model
for (const modelDetails of models) {
const model = await connect(
`${serverURL}/model/${modelDetails.model.uuid}/api`,
{
facades: [Client],
wsclass: WebSocket,
}
);
conn = await model.login(credentials);
// Get the details of the model
const client = conn.facades.client;
console.log("model details:", await client.fullStatus());
// Close the connection to the model
conn.transport.close();
}
In the code above, a connection is established to the provided controller API URL where the client declares interest in using the facade ModelManager, and we establish a new connection with each model API to get the full details using the facade Client.
Note: Facades are used to supported different versions of juju, when multiple versions of the same facade are supported by the juju API (like the two client versions in the example), the most recent version supported by the server is made available to the client.
The connect method returns a juju object which is used to log into the controller or model by providing a user/pass credentials or macaroons. See the various examples.
Visit the full API documentation for detailed information on the Client API.
We have a number of examples showing how to perform a few common tasks. Those can be found in the examples folder.
Detailed Facade documentation is available as part of the full API documentation or you can visit the facade source directly using the following links:
| Facade | Versions |
|---|---|
| ActionPruner | |
| Action | |
| Admin | |
| AgentLifeFlag | |
| AgentTools | |
| Agent | |
| AllModelWatcher | |
| AllWatcher | |
| Annotations | |
| ApplicationOffers | |
| ApplicationScaler | |
| Application | |
| Backups | |
| Block | |
| Bundle | |
| CAASAdmission | |
| CAASAgent | |
| CAASApplicationProvisioner | |
| CAASApplication | |
| CAASFirewallerEmbedded | |
| CAASFirewallerSidecar | |
| CAASFirewaller | |
| CAASModelConfigManager | |
| CAASModelOperator | |
| CAASOperatorProvisioner | |
| CAASOperatorUpgrader | |
| CAASOperator | |
| CAASUnitProvisioner | |
| CharmDownloader | |
| CharmHub | |
| CharmRevisionUpdater | |
| Charms | |
| Cleaner | |
| Client | |
| Cloud | |
| Controller | |
| CredentialManager | |
| CredentialValidator | |
| CrossController | |
| CrossModelRelations | |
| CrossModelSecrets | |
| Deployer | |
| DiskManager | |
| EntityWatcher | |
| EnvironUpgrader | |
| ExternalControllerUpdater | |
| FanConfigurer | |
| FilesystemAttachmentsWatcher | |
| FirewallRules | |
| Firewaller | |
| HighAvailability | |
| HostKeyReporter | |
| ImageManager | |
| ImageMetadataManager | |
| ImageMetadata | |
| InstanceMutater | |
| InstancePoller | |
| KeyManager | |
| KeyUpdater | |
| LeadershipService | |
| LifeFlag | |
| LogForwarding | |
| Logger | |
| MachineActions | |
| MachineManager | |
| MachineUndertaker | |
| Machiner | |
| MeterStatus | |
| MetricsAdder | |
| MetricsDebug | |
| MetricsManager | |
| MigrationFlag | |
| MigrationMaster | |
| MigrationMinion | |
| MigrationStatusWatcher | |
| MigrationTarget | |
| ModelConfig | |
| ModelGeneration | |
| ModelManager | |
| ModelSummaryWatcher | |
| ModelUpgrader | |
| NotifyWatcher | |
| OfferStatusWatcher | |
| PayloadsHookContext | |
| Payloads | |
| Pinger | |
| Provisioner | |
| ProxyUpdater | |
| RaftLease | |
| Reboot | |
| RelationStatusWatcher | |
| RelationUnitsWatcher | |
| RemoteRelationWatcher | |
| RemoteRelations | |
| ResourcesHookContext | |
| Resources | |
| Resumer | |
| RetryStrategy | |
| SecretBackendsManager | |
| SecretBackendsRotateWatcher | |
| SecretBackends | |
| SecretsDrain | |
| SecretsManager | |
| SecretsRevisionWatcher | |
| SecretsRotationWatcher | |
| SecretsTriggerWatcher | |
| Secrets | |
| Singular | |
| Spaces | |
| SSHClient | |
| StatusHistory | |
| StorageProvisioner | |
| Storage | |
| StringsWatcher | |
| Subnets | |
| Undertaker | |
| UnitAssigner | |
| Uniter | |
| UpgradeSeries | |
| UpgradeSteps | |
| Upgrader | |
| UserManager | |
| UserSecretsDrain | |
| UserSecretsManager | |
| VolumeAttachmentPlansWatcher | |
| VolumeAttachmentsWatcher |
The Juju facade API files are generated from a supplied Juju schema.
To generate this schema you will need to clone the Juju repository and then run make rebuild-schema or go run github.com/juju/juju/generate/schemagen -admin-facades --facade-group=client,jimm ./apiserver/facades/schema.json to generate a schema file that contains the publicly available facades as well as the set of facades for JAAS. Other --facade-group options are latest and all.
After generating a new schema run yarn store-schema ../path/to/juju which will store the updated schema and necessary meta data in this project.
To update the facades, run yarn generate-facades on this project. This will generate the facades using the locally stored schema, sha, and version the schema was generated from.
Finally, update CLIENT_VERSION in api/client.ts with the highest support version.
package.json, respecting semver, create a PR
and land it.yarn run build.yarn link and ensure that everything works as expected.git clone git@github.com:juju/js-libjuju.git.yarn install && yarn run build.yarn publish.FAQs
Juju API client
We found that @canonical/jujulib demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.