<!--
  This file is automatically generated when building the project. Do not make
  changes to this file. Update the template generator/templates/readme.ts instead.
-->

# JS Jujulib

This project provides a JavaScript API client library for interacting with the Juju
WebSocket API.

- [Getting Started](#getting-started)
- [Client API Reference](#client-api-reference)
- [Examples](#examples)
- [Facade API Reference](#facade-api-reference)
- [Library Maintenance](#library-maintenance)
  - [Updating Library Facades](#updating-library-facades)
  - [Releasing to NPM](#releasing-to-npm)

## Getting Started

To access the Juju API, a connection must be made to either a Juju
controller or a Juju model.

```javascript
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](https://github.com/juju/bakeryjs). See the [various examples](#examples).

## Client API Reference

Visit the [full API documentation](https://juju.github.io/js-libjuju/) for detailed information on the Client API.

## Examples

We have a number of examples showing how to perform a few common tasks. Those can be found in the `examples` folder.

- [add-machine.js](examples/add-machine.js)
- [deploy.js](examples/deploy.js)
- [login-with-bakery.js](examples/login-with-bakery.js)
- [watch-all-models.js](examples/watch-all-models.js)
- [watch.js](examples/watch.js)

## Facade API Reference

Detailed Facade documentation is available as part of the [full API documentation](https://juju.github.io/js-libjuju/) or you can visit the facade source directly using the following links:

| Facade                       | Versions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ActionPruner                 | <ul><li>[ActionPrunerV1.ts](/api/facades/action-pruner/ActionPrunerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Action                       | <ul><li>[ActionV6.ts](/api/facades/action/ActionV6.ts)</li><li>[ActionV7.ts](/api/facades/action/ActionV7.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Admin                        | <ul><li>[AdminV3.ts](/api/facades/admin/AdminV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| AgentLifeFlag                | <ul><li>[AgentLifeFlagV1.ts](/api/facades/agent-life-flag/AgentLifeFlagV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| AgentTools                   | <ul><li>[AgentToolsV1.ts](/api/facades/agent-tools/AgentToolsV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Agent                        | <ul><li>[AgentV2.ts](/api/facades/agent/AgentV2.ts)</li><li>[AgentV3.ts](/api/facades/agent/AgentV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| AllModelWatcher              | <ul><li>[AllModelWatcherV2.ts](/api/facades/all-model-watcher/AllModelWatcherV2.ts)</li><li>[AllModelWatcherV3.ts](/api/facades/all-model-watcher/AllModelWatcherV3.ts)</li><li>[AllModelWatcherV4.ts](/api/facades/all-model-watcher/AllModelWatcherV4.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| AllWatcher                   | <ul><li>[AllWatcherV1.ts](/api/facades/all-watcher/AllWatcherV1.ts)</li><li>[AllWatcherV2.ts](/api/facades/all-watcher/AllWatcherV2.ts)</li><li>[AllWatcherV3.ts](/api/facades/all-watcher/AllWatcherV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Annotations                  | <ul><li>[AnnotationsV2.ts](/api/facades/annotations/AnnotationsV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ApplicationOffers            | <ul><li>[ApplicationOffersV2.ts](/api/facades/application-offers/ApplicationOffersV2.ts)</li><li>[ApplicationOffersV3.ts](/api/facades/application-offers/ApplicationOffersV3.ts)</li><li>[ApplicationOffersV4.ts](/api/facades/application-offers/ApplicationOffersV4.ts)</li><li>[ApplicationOffersV5.ts](/api/facades/application-offers/ApplicationOffersV5.ts)</li><li>[ApplicationOffersV6.ts](/api/facades/application-offers/ApplicationOffersV6.ts)</li></ul>                                                                                                                                                                                                                                        |
| ApplicationScaler            | <ul><li>[ApplicationScalerV1.ts](/api/facades/application-scaler/ApplicationScalerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Application                  | <ul><li>[ApplicationV12.ts](/api/facades/application/ApplicationV12.ts)</li><li>[ApplicationV13.ts](/api/facades/application/ApplicationV13.ts)</li><li>[ApplicationV14.ts](/api/facades/application/ApplicationV14.ts)</li><li>[ApplicationV15.ts](/api/facades/application/ApplicationV15.ts)</li><li>[ApplicationV18.ts](/api/facades/application/ApplicationV18.ts)</li><li>[ApplicationV19.ts](/api/facades/application/ApplicationV19.ts)</li><li>[ApplicationV22.ts](/api/facades/application/ApplicationV22.ts)</li></ul>                                                                                                                                                                             |
| Backups                      | <ul><li>[BackupsV2.ts](/api/facades/backups/BackupsV2.ts)</li><li>[BackupsV3.ts](/api/facades/backups/BackupsV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Block                        | <ul><li>[BlockV2.ts](/api/facades/block/BlockV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Bundle                       | <ul><li>[BundleV1.ts](/api/facades/bundle/BundleV1.ts)</li><li>[BundleV4.ts](/api/facades/bundle/BundleV4.ts)</li><li>[BundleV5.ts](/api/facades/bundle/BundleV5.ts)</li><li>[BundleV6.ts](/api/facades/bundle/BundleV6.ts)</li><li>[BundleV8.ts](/api/facades/bundle/BundleV8.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                  |
| CAASAdmission                | <ul><li>[CAASAdmissionV1.ts](/api/facades/caasadmission/CAASAdmissionV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| CAASAgent                    | <ul><li>[CAASAgentV1.ts](/api/facades/caasagent/CAASAgentV1.ts)</li><li>[CAASAgentV2.ts](/api/facades/caasagent/CAASAgentV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| CAASApplicationProvisioner   | <ul><li>[CAASApplicationProvisionerV1.ts](/api/facades/caasapplication-provisioner/CAASApplicationProvisionerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| CAASApplication              | <ul><li>[CAASApplicationV1.ts](/api/facades/caasapplication/CAASApplicationV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| CAASFirewallerEmbedded       | <ul><li>[CAASFirewallerEmbeddedV1.ts](/api/facades/caasfirewaller-embedded/CAASFirewallerEmbeddedV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| CAASFirewallerSidecar        | <ul><li>[CAASFirewallerSidecarV1.ts](/api/facades/caasfirewaller-sidecar/CAASFirewallerSidecarV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| CAASFirewaller               | <ul><li>[CAASFirewallerV1.ts](/api/facades/caasfirewaller/CAASFirewallerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| CAASModelConfigManager       | <ul><li>[CAASModelConfigManagerV1.ts](/api/facades/caasmodel-config-manager/CAASModelConfigManagerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| CAASModelOperator            | <ul><li>[CAASModelOperatorV1.ts](/api/facades/caasmodel-operator/CAASModelOperatorV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| CAASOperatorProvisioner      | <ul><li>[CAASOperatorProvisionerV1.ts](/api/facades/caasoperator-provisioner/CAASOperatorProvisionerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| CAASOperatorUpgrader         | <ul><li>[CAASOperatorUpgraderV1.ts](/api/facades/caasoperator-upgrader/CAASOperatorUpgraderV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| CAASOperator                 | <ul><li>[CAASOperatorV1.ts](/api/facades/caasoperator/CAASOperatorV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| CAASUnitProvisioner          | <ul><li>[CAASUnitProvisionerV1.ts](/api/facades/caasunit-provisioner/CAASUnitProvisionerV1.ts)</li><li>[CAASUnitProvisionerV2.ts](/api/facades/caasunit-provisioner/CAASUnitProvisionerV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| CharmDownloader              | <ul><li>[CharmDownloaderV1.ts](/api/facades/charm-downloader/CharmDownloaderV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| CharmHub                     | <ul><li>[CharmHubV1.ts](/api/facades/charm-hub/CharmHubV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| CharmRevisionUpdater         | <ul><li>[CharmRevisionUpdaterV2.ts](/api/facades/charm-revision-updater/CharmRevisionUpdaterV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Charms                       | <ul><li>[CharmsV2.ts](/api/facades/charms/CharmsV2.ts)</li><li>[CharmsV4.ts](/api/facades/charms/CharmsV4.ts)</li><li>[CharmsV5.ts](/api/facades/charms/CharmsV5.ts)</li><li>[CharmsV6.ts](/api/facades/charms/CharmsV6.ts)</li><li>[CharmsV7.ts](/api/facades/charms/CharmsV7.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Cleaner                      | <ul><li>[CleanerV2.ts](/api/facades/cleaner/CleanerV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Client                       | <ul><li>[ClientV2.ts](/api/facades/client/ClientV2.ts)</li><li>[ClientV3.ts](/api/facades/client/ClientV3.ts)</li><li>[ClientV5.ts](/api/facades/client/ClientV5.ts)</li><li>[ClientV6.ts](/api/facades/client/ClientV6.ts)</li><li>[ClientV7.ts](/api/facades/client/ClientV7.ts)</li><li>[ClientV8.ts](/api/facades/client/ClientV8.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                           |
| Cloud                        | <ul><li>[CloudV1.ts](/api/facades/cloud/CloudV1.ts)</li><li>[CloudV2.ts](/api/facades/cloud/CloudV2.ts)</li><li>[CloudV3.ts](/api/facades/cloud/CloudV3.ts)</li><li>[CloudV4.ts](/api/facades/cloud/CloudV4.ts)</li><li>[CloudV5.ts](/api/facades/cloud/CloudV5.ts)</li><li>[CloudV7.ts](/api/facades/cloud/CloudV7.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                             |
| Controller                   | <ul><li>[ControllerV11.ts](/api/facades/controller/ControllerV11.ts)</li><li>[ControllerV12.ts](/api/facades/controller/ControllerV12.ts)</li><li>[ControllerV13.ts](/api/facades/controller/ControllerV13.ts)</li><li>[ControllerV3.ts](/api/facades/controller/ControllerV3.ts)</li><li>[ControllerV4.ts](/api/facades/controller/ControllerV4.ts)</li><li>[ControllerV5.ts](/api/facades/controller/ControllerV5.ts)</li><li>[ControllerV6.ts](/api/facades/controller/ControllerV6.ts)</li><li>[ControllerV7.ts](/api/facades/controller/ControllerV7.ts)</li><li>[ControllerV8.ts](/api/facades/controller/ControllerV8.ts)</li><li>[ControllerV9.ts](/api/facades/controller/ControllerV9.ts)</li></ul> |
| CredentialManager            | <ul><li>[CredentialManagerV1.ts](/api/facades/credential-manager/CredentialManagerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| CredentialValidator          | <ul><li>[CredentialValidatorV2.ts](/api/facades/credential-validator/CredentialValidatorV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| CrossController              | <ul><li>[CrossControllerV1.ts](/api/facades/cross-controller/CrossControllerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| CrossModelRelations          | <ul><li>[CrossModelRelationsV2.ts](/api/facades/cross-model-relations/CrossModelRelationsV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| CrossModelSecrets            | <ul><li>[CrossModelSecretsV1.ts](/api/facades/cross-model-secrets/CrossModelSecretsV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Deployer                     | <ul><li>[DeployerV1.ts](/api/facades/deployer/DeployerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| DiskManager                  | <ul><li>[DiskManagerV2.ts](/api/facades/disk-manager/DiskManagerV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| EntityWatcher                | <ul><li>[EntityWatcherV2.ts](/api/facades/entity-watcher/EntityWatcherV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| EnvironUpgrader              | <ul><li>[EnvironUpgraderV1.ts](/api/facades/environ-upgrader/EnvironUpgraderV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ExternalControllerUpdater    | <ul><li>[ExternalControllerUpdaterV1.ts](/api/facades/external-controller-updater/ExternalControllerUpdaterV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| FanConfigurer                | <ul><li>[FanConfigurerV1.ts](/api/facades/fan-configurer/FanConfigurerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| FilesystemAttachmentsWatcher | <ul><li>[FilesystemAttachmentsWatcherV2.ts](/api/facades/filesystem-attachments-watcher/FilesystemAttachmentsWatcherV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| FirewallRules                | <ul><li>[FirewallRulesV1.ts](/api/facades/firewall-rules/FirewallRulesV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Firewaller                   | <ul><li>[FirewallerV5.ts](/api/facades/firewaller/FirewallerV5.ts)</li><li>[FirewallerV7.ts](/api/facades/firewaller/FirewallerV7.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| HighAvailability             | <ul><li>[HighAvailabilityV2.ts](/api/facades/high-availability/HighAvailabilityV2.ts)</li><li>[HighAvailabilityV3.ts](/api/facades/high-availability/HighAvailabilityV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| HostKeyReporter              | <ul><li>[HostKeyReporterV1.ts](/api/facades/host-key-reporter/HostKeyReporterV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ImageManager                 | <ul><li>[ImageManagerV2.ts](/api/facades/image-manager/ImageManagerV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ImageMetadataManager         | <ul><li>[ImageMetadataManagerV1.ts](/api/facades/image-metadata-manager/ImageMetadataManagerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ImageMetadata                | <ul><li>[ImageMetadataV3.ts](/api/facades/image-metadata/ImageMetadataV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| InstanceMutater              | <ul><li>[InstanceMutaterV2.ts](/api/facades/instance-mutater/InstanceMutaterV2.ts)</li><li>[InstanceMutaterV3.ts](/api/facades/instance-mutater/InstanceMutaterV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| InstancePoller               | <ul><li>[InstancePollerV4.ts](/api/facades/instance-poller/InstancePollerV4.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| KeyManager                   | <ul><li>[KeyManagerV1.ts](/api/facades/key-manager/KeyManagerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| KeyUpdater                   | <ul><li>[KeyUpdaterV1.ts](/api/facades/key-updater/KeyUpdaterV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| LeadershipService            | <ul><li>[LeadershipServiceV2.ts](/api/facades/leadership-service/LeadershipServiceV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| LifeFlag                     | <ul><li>[LifeFlagV1.ts](/api/facades/life-flag/LifeFlagV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| LogForwarding                | <ul><li>[LogForwardingV1.ts](/api/facades/log-forwarding/LogForwardingV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Logger                       | <ul><li>[LoggerV1.ts](/api/facades/logger/LoggerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| MachineActions               | <ul><li>[MachineActionsV1.ts](/api/facades/machine-actions/MachineActionsV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| MachineManager               | <ul><li>[MachineManagerV10.ts](/api/facades/machine-manager/MachineManagerV10.ts)</li><li>[MachineManagerV11.ts](/api/facades/machine-manager/MachineManagerV11.ts)</li><li>[MachineManagerV6.ts](/api/facades/machine-manager/MachineManagerV6.ts)</li><li>[MachineManagerV7.ts](/api/facades/machine-manager/MachineManagerV7.ts)</li><li>[MachineManagerV9.ts](/api/facades/machine-manager/MachineManagerV9.ts)</li></ul>                                                                                                                                                                                                                                                                                 |
| MachineUndertaker            | <ul><li>[MachineUndertakerV1.ts](/api/facades/machine-undertaker/MachineUndertakerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Machiner                     | <ul><li>[MachinerV4.ts](/api/facades/machiner/MachinerV4.ts)</li><li>[MachinerV5.ts](/api/facades/machiner/MachinerV5.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| MeterStatus                  | <ul><li>[MeterStatusV2.ts](/api/facades/meter-status/MeterStatusV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| MetricsAdder                 | <ul><li>[MetricsAdderV2.ts](/api/facades/metrics-adder/MetricsAdderV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| MetricsDebug                 | <ul><li>[MetricsDebugV2.ts](/api/facades/metrics-debug/MetricsDebugV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| MetricsManager               | <ul><li>[MetricsManagerV1.ts](/api/facades/metrics-manager/MetricsManagerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| MigrationFlag                | <ul><li>[MigrationFlagV1.ts](/api/facades/migration-flag/MigrationFlagV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| MigrationMaster              | <ul><li>[MigrationMasterV2.ts](/api/facades/migration-master/MigrationMasterV2.ts)</li><li>[MigrationMasterV3.ts](/api/facades/migration-master/MigrationMasterV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| MigrationMinion              | <ul><li>[MigrationMinionV1.ts](/api/facades/migration-minion/MigrationMinionV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| MigrationStatusWatcher       | <ul><li>[MigrationStatusWatcherV1.ts](/api/facades/migration-status-watcher/MigrationStatusWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| MigrationTarget              | <ul><li>[MigrationTargetV1.ts](/api/facades/migration-target/MigrationTargetV1.ts)</li><li>[MigrationTargetV2.ts](/api/facades/migration-target/MigrationTargetV2.ts)</li><li>[MigrationTargetV3.ts](/api/facades/migration-target/MigrationTargetV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ModelConfig                  | <ul><li>[ModelConfigV2.ts](/api/facades/model-config/ModelConfigV2.ts)</li><li>[ModelConfigV3.ts](/api/facades/model-config/ModelConfigV3.ts)</li><li>[ModelConfigV4.ts](/api/facades/model-config/ModelConfigV4.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ModelGeneration              | <ul><li>[ModelGenerationV4.ts](/api/facades/model-generation/ModelGenerationV4.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ModelManager                 | <ul><li>[ModelManagerV10.ts](/api/facades/model-manager/ModelManagerV10.ts)</li><li>[ModelManagerV11.ts](/api/facades/model-manager/ModelManagerV11.ts)</li><li>[ModelManagerV2.ts](/api/facades/model-manager/ModelManagerV2.ts)</li><li>[ModelManagerV3.ts](/api/facades/model-manager/ModelManagerV3.ts)</li><li>[ModelManagerV4.ts](/api/facades/model-manager/ModelManagerV4.ts)</li><li>[ModelManagerV5.ts](/api/facades/model-manager/ModelManagerV5.ts)</li><li>[ModelManagerV8.ts](/api/facades/model-manager/ModelManagerV8.ts)</li><li>[ModelManagerV9.ts](/api/facades/model-manager/ModelManagerV9.ts)</li></ul>                                                                                 |
| ModelSummaryWatcher          | <ul><li>[ModelSummaryWatcherV1.ts](/api/facades/model-summary-watcher/ModelSummaryWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ModelUpgrader                | <ul><li>[ModelUpgraderV1.ts](/api/facades/model-upgrader/ModelUpgraderV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| NotifyWatcher                | <ul><li>[NotifyWatcherV1.ts](/api/facades/notify-watcher/NotifyWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| OfferStatusWatcher           | <ul><li>[OfferStatusWatcherV1.ts](/api/facades/offer-status-watcher/OfferStatusWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| PayloadsHookContext          | <ul><li>[PayloadsHookContextV1.ts](/api/facades/payloads-hook-context/PayloadsHookContextV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Payloads                     | <ul><li>[PayloadsV1.ts](/api/facades/payloads/PayloadsV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Pinger                       | <ul><li>[PingerV1.ts](/api/facades/pinger/PingerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Provisioner                  | <ul><li>[ProvisionerV11.ts](/api/facades/provisioner/ProvisionerV11.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ProxyUpdater                 | <ul><li>[ProxyUpdaterV2.ts](/api/facades/proxy-updater/ProxyUpdaterV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| RaftLease                    | <ul><li>[RaftLeaseV1.ts](/api/facades/raft-lease/RaftLeaseV1.ts)</li><li>[RaftLeaseV2.ts](/api/facades/raft-lease/RaftLeaseV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Reboot                       | <ul><li>[RebootV2.ts](/api/facades/reboot/RebootV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| RelationStatusWatcher        | <ul><li>[RelationStatusWatcherV1.ts](/api/facades/relation-status-watcher/RelationStatusWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| RelationUnitsWatcher         | <ul><li>[RelationUnitsWatcherV1.ts](/api/facades/relation-units-watcher/RelationUnitsWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| RemoteRelationWatcher        | <ul><li>[RemoteRelationWatcherV1.ts](/api/facades/remote-relation-watcher/RemoteRelationWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| RemoteRelations              | <ul><li>[RemoteRelationsV2.ts](/api/facades/remote-relations/RemoteRelationsV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ResourcesHookContext         | <ul><li>[ResourcesHookContextV1.ts](/api/facades/resources-hook-context/ResourcesHookContextV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Resources                    | <ul><li>[ResourcesV1.ts](/api/facades/resources/ResourcesV1.ts)</li><li>[ResourcesV2.ts](/api/facades/resources/ResourcesV2.ts)</li><li>[ResourcesV3.ts](/api/facades/resources/ResourcesV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Resumer                      | <ul><li>[ResumerV2.ts](/api/facades/resumer/ResumerV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| RetryStrategy                | <ul><li>[RetryStrategyV1.ts](/api/facades/retry-strategy/RetryStrategyV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| SecretBackendsManager        | <ul><li>[SecretBackendsManagerV1.ts](/api/facades/secret-backends-manager/SecretBackendsManagerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| SecretBackendsRotateWatcher  | <ul><li>[SecretBackendsRotateWatcherV1.ts](/api/facades/secret-backends-rotate-watcher/SecretBackendsRotateWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| SecretBackends               | <ul><li>[SecretBackendsV1.ts](/api/facades/secret-backends/SecretBackendsV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| SecretsDrain                 | <ul><li>[SecretsDrainV1.ts](/api/facades/secrets-drain/SecretsDrainV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| SecretsManager               | <ul><li>[SecretsManagerV1.ts](/api/facades/secrets-manager/SecretsManagerV1.ts)</li><li>[SecretsManagerV2.ts](/api/facades/secrets-manager/SecretsManagerV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| SecretsRevisionWatcher       | <ul><li>[SecretsRevisionWatcherV1.ts](/api/facades/secrets-revision-watcher/SecretsRevisionWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| SecretsRotationWatcher       | <ul><li>[SecretsRotationWatcherV1.ts](/api/facades/secrets-rotation-watcher/SecretsRotationWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| SecretsTriggerWatcher        | <ul><li>[SecretsTriggerWatcherV1.ts](/api/facades/secrets-trigger-watcher/SecretsTriggerWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| Secrets                      | <ul><li>[SecretsV1.ts](/api/facades/secrets/SecretsV1.ts)</li><li>[SecretsV2.ts](/api/facades/secrets/SecretsV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Singular                     | <ul><li>[SingularV2.ts](/api/facades/singular/SingularV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Spaces                       | <ul><li>[SpacesV6.ts](/api/facades/spaces/SpacesV6.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| SSHClient                    | <ul><li>[SSHClientV2.ts](/api/facades/sshclient/SSHClientV2.ts)</li><li>[SSHClientV3.ts](/api/facades/sshclient/SSHClientV3.ts)</li><li>[SSHClientV4.ts](/api/facades/sshclient/SSHClientV4.ts)</li><li>[SSHClientV5.ts](/api/facades/sshclient/SSHClientV5.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| StatusHistory                | <ul><li>[StatusHistoryV2.ts](/api/facades/status-history/StatusHistoryV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| StorageProvisioner           | <ul><li>[StorageProvisionerV4.ts](/api/facades/storage-provisioner/StorageProvisionerV4.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Storage                      | <ul><li>[StorageV6.ts](/api/facades/storage/StorageV6.ts)</li><li>[StorageV7.ts](/api/facades/storage/StorageV7.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| StringsWatcher               | <ul><li>[StringsWatcherV1.ts](/api/facades/strings-watcher/StringsWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Subnets                      | <ul><li>[SubnetsV4.ts](/api/facades/subnets/SubnetsV4.ts)</li><li>[SubnetsV5.ts](/api/facades/subnets/SubnetsV5.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Undertaker                   | <ul><li>[UndertakerV1.ts](/api/facades/undertaker/UndertakerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| UnitAssigner                 | <ul><li>[UnitAssignerV1.ts](/api/facades/unit-assigner/UnitAssignerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Uniter                       | <ul><li>[UniterV16.ts](/api/facades/uniter/UniterV16.ts)</li><li>[UniterV18.ts](/api/facades/uniter/UniterV18.ts)</li><li>[UniterV19.ts](/api/facades/uniter/UniterV19.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| UpgradeSeries                | <ul><li>[UpgradeSeriesV3.ts](/api/facades/upgrade-series/UpgradeSeriesV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| UpgradeSteps                 | <ul><li>[UpgradeStepsV2.ts](/api/facades/upgrade-steps/UpgradeStepsV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Upgrader                     | <ul><li>[UpgraderV1.ts](/api/facades/upgrader/UpgraderV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| UserManager                  | <ul><li>[UserManagerV1.ts](/api/facades/user-manager/UserManagerV1.ts)</li><li>[UserManagerV2.ts](/api/facades/user-manager/UserManagerV2.ts)</li><li>[UserManagerV3.ts](/api/facades/user-manager/UserManagerV3.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| UserSecretsDrain             | <ul><li>[UserSecretsDrainV1.ts](/api/facades/user-secrets-drain/UserSecretsDrainV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| UserSecretsManager           | <ul><li>[UserSecretsManagerV1.ts](/api/facades/user-secrets-manager/UserSecretsManagerV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| VolumeAttachmentPlansWatcher | <ul><li>[VolumeAttachmentPlansWatcherV1.ts](/api/facades/volume-attachment-plans-watcher/VolumeAttachmentPlansWatcherV1.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| VolumeAttachmentsWatcher     | <ul><li>[VolumeAttachmentsWatcherV2.ts](/api/facades/volume-attachments-watcher/VolumeAttachmentsWatcherV2.ts)</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

## Library Maintenance

### Updating Library Facades

The Juju facade API files are generated from a supplied Juju schema.

First, open the file `generator/schema/schema-history.json` and add a new object with `juju-version` set to the version of Juju you want to support.

Set `schema` to a "raw" path on github for the schema file e.g. `https://raw.githubusercontent.com/juju/juju/refs/tags/v3.6.14/apiserver/facades/schema.json` (substituting the tag with the version number from above).

Set `juju-git-sha` to the sha for the release (go to the release page for the version you want to support e.g. `https://github.com/juju/juju/releases/tag/v3.6.14` and the sha will be listed next to the tag).

To update the facades, run `yarn regenerate-all-facades`. This will generate the facades using the data from the `schema-history.json` file.

Finally, update `CLIENT_VERSION` in `api/client.ts` with the highest version of Juju that is supported by Jujulib.

### Releasing to NPM

- Update the version number in `package.json`, respecting semver, create a PR
  and land it.
- Build package with `yarn run build`.
- Upgrade the [Juju Dashboard](https://github.com/canonical-web-and-design/jaas-dashboard) to this version using `yarn link` and ensure that everything works as expected.
- Create a [new release](https://github.com/juju/js-libjuju/releases/new) on
  GitHub, setting the tag and title to the version number from above and include
  any relevant changes in the release notes (use the 'Generate release notes' to
  show changes since the last release and create a full changelog link, but
  rewrite the changes to help them make sense to consumers of the library).
- Clone a fresh copy of the repository: `git clone git@github.com:juju/js-libjuju.git`.
- Install the dependencies and build the package with `yarn install && yarn run build`.
- Now you can publish to NPM with `yarn publish`.
