presidium 4.9.0 → 4.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/Docker.js +46 -46
  2. package/HTTP.js +4 -0
  3. package/package.json +1 -1
package/Docker.js CHANGED
@@ -49,7 +49,7 @@ const handleDockerHTTPResponse = require('./internal/handleDockerHTTPResponse')
49
49
  * System dependencies:
50
50
  * * `docker`
51
51
  *
52
- * Note: the Presidium Docker client connects to the Docker socket `/var/run/docker.sock`. For security purposes, please avoid exposing any code using the Presidium Docker client to the internet, see [How would an attacker gain access to the host machine from within a Docker container?](https://www.google.com/search?hl=en&q=how+would+an+attacker+gain+access+to+the+host+machine+from+within+a+docker+container&ia=web).
52
+ * Note: the Presidium Docker client connects to the Docker socket at `/var/run/docker.sock`. For security purposes, please avoid exposing code running the Presidium Docker client to the internet.
53
53
  */
54
54
  class Docker {
55
55
  constructor(options = {}) {
@@ -82,7 +82,7 @@ class Docker {
82
82
  * Validates credentials for a Docker container registry. If available, gets an identity token for accessing the registry without password.
83
83
  *
84
84
  * Arguments:
85
- * * `options` - address used for inter-manager communication that is also advertised to other nodes.
85
+ * * `options` - address for inter-manager communication and discovery.
86
86
  * * `username` - authentication credentials.
87
87
  * * `password` - authentication credentials.
88
88
  * * `email` - authentication credentials.
@@ -91,7 +91,7 @@ class Docker {
91
91
  * Return:
92
92
  * * `data`
93
93
  * * `Status` - the status message of the authentication
94
- * * `IdentityToken` - a token used to authenticate the user in place of a username and password.
94
+ * * `IdentityToken` - a token for authenticating users in place of username and password.
95
95
  *
96
96
  * ```javascript
97
97
  * const docker = new Docker()
@@ -155,7 +155,7 @@ class Docker {
155
155
  * * `Created` - the date and time at which the image was created as seconds since EPOCH (January 1, 1970 at midnight UTC/GMT).
156
156
  * * `Size` - the total size in bytes of the image including all layers that the image is composed of.
157
157
  * * `SharedSize` - total size of image layers that are shared between the image and other images. `-1` indicates that this value has not been calculated.
158
- * * `Labels` - object of user-defined key/value metadata.
158
+ * * `Labels` - object of key-value metadata.
159
159
  * * `Containers` - number of containers using this image. Includes both stopped and running containers. `-1` indicates that this value has not been calculated.
160
160
  * * `Manifests` - list of [image manifests](https://docs.docker.com/reference/cli/docker/manifest/) available in the image. Warning: `Manifests` is experimental and may change at any time without any backward compatibility.
161
161
  * * `Descriptor` - an object containing digest, media type, and size for the image, as defined in the [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md).
@@ -217,20 +217,20 @@ class Docker {
217
217
  * * `data`
218
218
  * * `Id` - the Docker container ID
219
219
  * * `Names` - the names associated with the Docker container.
220
- * * `Image` - the name or ID of the image used to create the Docker container.
221
- * * `ImageID` - the ID of the image used to create the Docker container.
222
- * * `ImageManifestDescriptor` - an object containing digest, media type, and size for the image used to create the Docker container, as defined in the [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md).
220
+ * * `Image` - the name or ID of the image of the Docker container.
221
+ * * `ImageID` - the ID of the image of the Docker container.
222
+ * * `ImageManifestDescriptor` - an object containing digest, media type, and size for the image of the Docker container, as defined in the [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md).
223
223
  * * `Command` - the command to run when starting the Docker container.
224
224
  * * `Created` - the date and time at which the image was created as seconds since EPOCH (January 1, 1970 at midnight UTC/GMT).
225
225
  * * `Ports` - port-mappings for the Docker container.
226
226
  * * `SizeRw` - the size of files that have been created or changed by the Docker container.
227
- * * `SizeRootFs` - the total size of all files in the read-only layers of the image that are used by the Docker container.
228
- * * `Labels` - object of user-defined key/value metadata.
227
+ * * `SizeRootFs` - the total size of all files in the read-only layers of the image of the Docker container.
228
+ * * `Labels` - object of key-value metadata.
229
229
  * * `State` - the state of the Docker container.
230
230
  * * `Status` - additional human-readable status of the Docker container, e.g. `'Exit 0'`.
231
231
  * * `HostConfig` - summary of host-specific runtime information of the Docker container.
232
232
  * * `NetworkSettings` - summary of the Docker container's network settings.
233
- * * `Mounts` - list of mounts used by the Docker container.
233
+ * * `Mounts` - list of mounts of the Docker container.
234
234
  * * `Health` - summary of the Docker container's health status.
235
235
  *
236
236
  * ```javascript
@@ -281,7 +281,7 @@ class Docker {
281
281
  * * `password` - authentication credentials.
282
282
  * * `email` - authentication credentials.
283
283
  * * `serveraddress` - domain or IP of the registry server.
284
- * * `identitytoken` - a token used to authenticate the user in place of a username and password.
284
+ * * `IdentityToken` - a token for authenticating users in place of username and password.
285
285
  *
286
286
  * Return:
287
287
  * * `dataStream` - a readable stream of the progress of the Docker `pullImage` operation.
@@ -461,7 +461,7 @@ class Docker {
461
461
  * * `password` - authentication credentials.
462
462
  * * `email` - authentication credentials.
463
463
  * * `serveraddress` - domain or IP of the registry server.
464
- * * `identitytoken` - a token used to authenticate the user in place of a username and password.
464
+ * * `IdentityToken` - a token for authenticating users in place of username and password.
465
465
  *
466
466
  * Return:
467
467
  * * `dataStream` - a readable stream of the progress of the Docker `pushImage` operation.
@@ -562,13 +562,13 @@ class Docker {
562
562
  * * `Comment` - optional message that was set when committing or importing the image.
563
563
  * * `Created` - the date and time at which the image was created as seconds since EPOCH (January 1, 1970 at midnight UTC/GMT).
564
564
  * * `Author` - the name of the author that was specified when committing the image.
565
- * * `Config` - the configuration of the image. `Config` fields are used as defaults when starting a container from an image.
565
+ * * `Config` - the configuration of the image. `Config` fields are the defaults when starting a container from an image.
566
566
  * * `Architecture` - the CPU architecture that the image runs on.
567
567
  * * `Variant` - a CPU architecture variant.
568
568
  * * `Os` - the operating system that the image is built to run on.
569
569
  * * `OsVersion` - the version of the operating system that the image is built to run on.
570
570
  * * `Size` - the total size in bytes of the image including all layers that the image is composed of.
571
- * * `GraphDriver` - information about the storage driver that stores the filesystem used by the Docker container and the image.
571
+ * * `GraphDriver` - information about the storage driver that stores the filesystem of the Docker container and the image.
572
572
  * * `RootFS` - information about the image's RootFS, including the layer IDs.
573
573
  * * `Metadata` - additional metadata of the image in the local cache. This information is not part of the image itself.
574
574
  *
@@ -632,12 +632,12 @@ class Docker {
632
632
  * }) -> data Promise<Array<{ Untagged: string }|{ Deleted: string }>>
633
633
  * ```
634
634
  *
635
- * Removes a Docker image and any untagged parent images that were referenced by the Docker image from the server. Docker images can't be removed if they have descendant images, are being used by a running container, or are being used by a build.
635
+ * Removes a Docker image and any untagged parent images that were referenced by the Docker image from the server. Docker images can't be removed if they have descendant images, have a running container, or are being referenced by a build.
636
636
  *
637
637
  * Arguments:
638
638
  * * `image` - the name or ID of the image to remove.
639
639
  * * `options`
640
- * * `force` - if `true`, removes the image even if it is being used by stopped containers or has other tags. If `false`, the operation will error if the image is being used by stopped containers. Defaults to `false`.
640
+ * * `force` - if `true`, removes the image even if it is referenced by stopped containers or has other tags. If `false`, the operation will error if the image is referenced by stopped containers. Defaults to `false`.
641
641
  * * `noprune` - if `true`, the operation will not delete untagged parent images. If `false`, the operation will delete untagged parent images. Defaults to `false`.
642
642
  *
643
643
  * Return:
@@ -712,7 +712,7 @@ class Docker {
712
712
  * * `image` - the name and tag of the image.
713
713
  * * `rm` - automatically remove the Docker container when it exits.
714
714
  * * `restart` - the restart policy for the Docker container.
715
- * * `logDriver` - the logging driver used for the Docker container.
715
+ * * `logDriver` - the logging driver of the Docker container.
716
716
  * * `logDriverOptions` - driver-specific configuration options for the logging driver.
717
717
  * * `publish` - object of mappings of host ports to container ports with optional protocols.
718
718
  * * `healthCmd` - a command that checks the health of the Docker container. The health check fails if the command errors. The command is run inside the Docker container.
@@ -756,7 +756,7 @@ class Docker {
756
756
  * * `image` - mounts a Docker image.
757
757
  * * `npipe` - mounts a named pipe from the host into the Docker container.
758
758
  * * `tmpfs` - create a tmpfs with the given options. The `source` cannot be specified with mount type `tmpfs`.
759
- * * `volume` - creates a volume with the given name and options or uses a pre-existing volume with the same name and options. The volume persists when the Docker container is removed.
759
+ * * `volume` - creates or references a volume with the given name and options. The volume persists when the Docker container is removed.
760
760
  *
761
761
  * ```javascript
762
762
  * const docker = new Docker()
@@ -991,7 +991,7 @@ class Docker {
991
991
  * * `image` - the name and tag of the image.
992
992
  * * `rm` - automatically remove the Docker container when it exits.
993
993
  * * `restart` - the restart policy for the Docker container.
994
- * * `logDriver` - the logging driver used for the Docker container.
994
+ * * `logDriver` - the logging driver of the Docker container.
995
995
  * * `logDriverOptions` - driver-specific configuration options for the logging driver.
996
996
  * * `publish` - object of mappings of host ports to container ports with optional protocols.
997
997
  * * `healthCmd` - a command that checks the health of the Docker container. The health check fails if the command errors. The command is run inside the Docker container.
@@ -1033,7 +1033,7 @@ class Docker {
1033
1033
  * * `image` - mounts a Docker image.
1034
1034
  * * `npipe` - mounts a named pipe from the host into the Docker container.
1035
1035
  * * `tmpfs` - create a tmpfs with the given options. The `source` cannot be specified with mount type `tmpfs`.
1036
- * * `volume` - creates a volume with the given name and options or uses a pre-existing volume with the same name and options. The volume persists when the Docker container is removed.
1036
+ * * `volume` - creates or references a volume with the given name and options. The volume persists when the Docker container is removed.
1037
1037
  *
1038
1038
  * ```javascript
1039
1039
  * const docker = new Docker()
@@ -1288,16 +1288,16 @@ class Docker {
1288
1288
  * * `Id` - the ID of the Docker container.
1289
1289
  * * `Created` - the date and time at which the Docker container was created as seconds since EPOCH (January 1, 1970 at midnight UTC/GMT).
1290
1290
  * * `Path` - the path to the command run by the Docker container.
1291
- * * `Args` - the arguments to the command being run by the Docker container.
1291
+ * * `Args` - the arguments to the command run by the Docker container.
1292
1292
  * * `State` - `DockerDocs.ContainerState` stores the Docker container's running state.
1293
1293
  * * `Image` - the ID (digest) of the image that the Docker container was created from.
1294
1294
  * * `ResolveConfPath` - the location of `/etc/resolve.conf` generated for the Docker container on the host.
1295
1295
  * * `HostnamePath` - the location of `/etc/hostname` generated for the Docker container on the host.
1296
1296
  * * `HostsPath` - the location of `/etc/hosts` generated for the Docker container on the host.
1297
- * * `LogPath` - the location of the file used to buffer the Docker container's logs.
1297
+ * * `LogPath` - the location of the file that buffers the Docker container's logs.
1298
1298
  * * `Name` - the name associated with the Docker container.
1299
1299
  * * `RestartCount` - the number of times the Docker container was restarted since it was created or since the Docker daemon was started.
1300
- * * `Driver` - the storage-driver used for the Docker container's filesystem.
1300
+ * * `Driver` - the storage-driver of the Docker container's filesystem.
1301
1301
  * * `Platform` - the platform (operating system) for which the Docker container was created.
1302
1302
  * * `ImageManifestDescriptor` - an object containing digest, media type, and size for the image from which the Docker container was created, as defined in the [OCI Content Descriptors Specification](https://github.com/opencontainers/image-spec/blob/v1.0.1/descriptor.md).
1303
1303
  * * `MountLabel` - the SELinux mount label set for the Docker container.
@@ -1305,11 +1305,11 @@ class Docker {
1305
1305
  * * `AppArmorProfile` - the AppArmor profile set for the Docker container.
1306
1306
  * * `ExecIDs` - the IDs of exec instances that are running in the Docker container.
1307
1307
  * * `HostConfig` - host configuration for the Docker container.
1308
- * * `GraphDriver` - information about the storage driver that stores the filesystem used by the Docker container and the image.
1309
- * * `Storage` - information about the storage used by the Docker container.
1308
+ * * `GraphDriver` - information about the storage driver that stores the filesystem of the Docker container and the image.
1309
+ * * `Storage` - information about the storage of the Docker container.
1310
1310
  * * `SizeRw` - the size of files that have been created or changed by the Docker container.
1311
- * * `SizeRootFs` - the total size of all files in the read-only layers of the image that are used by the Docker container.
1312
- * * `Mounts` - list of mounts used by the Docker container.
1311
+ * * `SizeRootFs` - the total size of all files in the read-only layers of the image of the Docker container.
1312
+ * * `Mounts` - list of mounts of the Docker container.
1313
1313
  * * `Config` - the configuration of the Docker container.
1314
1314
  * * `NetworkSettings` - summary of the Docker container's network settings.
1315
1315
  *
@@ -1376,8 +1376,8 @@ class Docker {
1376
1376
  * * `DefaultAddrPool` - the default subnet pools for global scope networks of the Docker swarm.
1377
1377
  * * `SubnetSize` - the subnet size of the networks created from the default address pool.
1378
1378
  * * `JoinTokens` - tokens for worker and manager nodes to join the Docker swarm.
1379
- * * `Worker` - the token that worker nodes can use to join the Docker swarm.
1380
- * * `Manager` - the token that manager nodes can use to join the Docker swarm.
1379
+ * * `Worker` - the token for worker nodes to join the Docker swarm.
1380
+ * * `Manager` - the token for manager nodes to join the Docker swarm.
1381
1381
  *
1382
1382
  * ```javascript
1383
1383
  * const docker = new Docker()
@@ -1404,7 +1404,7 @@ class Docker {
1404
1404
  * Initializes a new Docker swarm.
1405
1405
  *
1406
1406
  * Arguments:
1407
- * * `address` - address used for inter-manager communication that is also advertised to other nodes.
1407
+ * * `address` - address for inter-manager communication and discovery.
1408
1408
  *
1409
1409
  * Return:
1410
1410
  * * `nodeId` - the ID of the current Docker swarm manager node.
@@ -1445,9 +1445,9 @@ class Docker {
1445
1445
  * Joins the current node (server) to a Docker swarm.
1446
1446
  *
1447
1447
  * Arguments:
1448
- * * `address` - address used for inter-manager communication that is also advertised to other nodes.
1448
+ * * `address` - address for inter-manager communication and discovery.
1449
1449
  * * `options`
1450
- * * `RemoteAddrs` - address or interface for data path traffic. Used to separate data traffic from management traffic.
1450
+ * * `RemoteAddrs` - address or interface for data path traffic. Separates data traffic from management traffic.
1451
1451
  * * `JoinToken` - worker or manager token for joining the swarm.
1452
1452
  *
1453
1453
  * Return:
@@ -1577,11 +1577,11 @@ class Docker {
1577
1577
  * Arguments:
1578
1578
  * * `service` - the Docker service name.
1579
1579
  * * `options`
1580
- * * `image` - the Docker image that will be used by the Docker service.
1580
+ * * `image` - the Docker image of the Docker service.
1581
1581
  * * `replicas` - the number of containers that the Docker service will run across all nodes of the Docker swarm. If `replicas` is set to 'global', the Docker service will run containers on each node of the Docker swarm.
1582
1582
  * * `restart` - the restart policy for the Docker service.
1583
1583
  * * `restartDelay` - the delay between restarts for the Docker service.
1584
- * * `logDriver` - the logging driver used for the Docker service.
1584
+ * * `logDriver` - the logging driver of the Docker service.
1585
1585
  * * `logDriverOptions` - driver-specific configuration options for the logging driver.
1586
1586
  * * `publish` - object of mappings of host ports to Docker service ports with optional protocols.
1587
1587
  * * `healthCmd` - a command that checks the health of the Docker service. The health check fails if the command errors. The command is run inside each Docker container of the Docker service.
@@ -1612,7 +1612,7 @@ class Docker {
1612
1612
  * * `password` - authentication credentials.
1613
1613
  * * `email` - authentication credentials.
1614
1614
  * * `serveraddress` - domain or IP of the registry server.
1615
- * * `identitytoken` - a token used to authenticate the user in place of a username and password.
1615
+ * * `IdentityToken` - a token for authenticating users in place of username and password.
1616
1616
  *
1617
1617
  * Return:
1618
1618
  * * `data`
@@ -1859,7 +1859,7 @@ class Docker {
1859
1859
  * * `replicas` - the number of containers that the Docker service will run across all nodes of the Docker swarm. If `replicas` is set to 'global', the Docker service will run containers on each node of the Docker swarm.
1860
1860
  * * `restart` - the restart policy for the Docker service.
1861
1861
  * * `restartDelay` - the delay between restarts for the Docker service.
1862
- * * `logDriver` - the logging driver used for the Docker service.
1862
+ * * `logDriver` - the logging driver of the Docker service.
1863
1863
  * * `logDriverOptions` - driver-specific configuration options for the logging driver.
1864
1864
  * * `publish` - object of mappings of host ports to Docker service ports with optional protocols.
1865
1865
  * * `healthCmd` - a command that checks the health of the Docker service. The health check fails if the command errors. The command is run inside each Docker container of the Docker service.
@@ -2221,12 +2221,12 @@ class Docker {
2221
2221
  * * `CreatedAt` - the date and time at which the task was created as seconds since EPOCH (January 1, 1970 at midnight UTC/GMT).
2222
2222
  * * `UpdatedAt` - the date and time at which the task was updated as seconds since EPOCH (January 1, 1970 at midnight UTC/GMT).
2223
2223
  * * `Name` - the name of the task.
2224
- * * `Labels` - object of user-defined key/value metadata.
2224
+ * * `Labels` - object of key-value metadata.
2225
2225
  * * `Spec` - the task configuration.
2226
2226
  * * `ServiceID` - the ID of the Docker service that the task belongs to.
2227
- * * `Slot` - used by the orchestrator for scheduling purposes.
2227
+ * * `Slot` - for scheduling purposes.
2228
2228
  * * `NodeID` - the ID of the node that the task is on.
2229
- * * `AssignedGenericResources` - user-defined resources.
2229
+ * * `AssignedGenericResources` - resources.
2230
2230
  * * `Status` - the status of the task.
2231
2231
  * * `DesiredState` - the desired status of the task.
2232
2232
  * * `JobIteration` - the version number of the task.
@@ -2386,7 +2386,7 @@ class Docker {
2386
2386
  * }>
2387
2387
  * ```
2388
2388
  *
2389
- * Prunes Docker images. Deletes unused Docker images from the server.
2389
+ * Prunes Docker images. Deletes Docker images without containers from the server.
2390
2390
  *
2391
2391
  * Arguments:
2392
2392
  * * (none)
@@ -2454,7 +2454,7 @@ class Docker {
2454
2454
  * }>
2455
2455
  * ```
2456
2456
  *
2457
- * Prunes Docker volumes. Deletes unused volumes from the server.
2457
+ * Prunes Docker volumes. Deletes volumes without containers from the server.
2458
2458
  *
2459
2459
  * Arguments:
2460
2460
  * * (none)
@@ -2531,7 +2531,7 @@ class Docker {
2531
2531
  * Arguments:
2532
2532
  * * `options`
2533
2533
  * * `name` - the name of the network to create.
2534
- * * `driver` - the name of the network driver plugin to use.
2534
+ * * `driver` - the name of the network driver plugin.
2535
2535
  * * `ingress` - if `true`, creates an ingress network. The ingress network is the network that provides the routing-mesh in swarm mode. If `false`, does not create an ingress network.
2536
2536
  * * `subnet` - the subnet of the network.
2537
2537
  * * `gateway` - the gateway of the network.
@@ -2621,7 +2621,7 @@ class Docker {
2621
2621
  * * `Id` - the network ID.
2622
2622
  * * `Created` - the date and time at which the network was created as seconds since EPOCH (January 1, 1970 at midnight UTC/GMT).
2623
2623
  * * `Scope` - the level at which the network exists.
2624
- * * `Driver` - the name of the driver used to create the network.
2624
+ * * `Driver` - the name of the driver of the network.
2625
2625
  * * `EnableIPv4` - whether the network was created with IPv4 enabled.
2626
2626
  * * `EnableIPv6` - whether the network was created with IPv6 enabled.
2627
2627
  * * `IPAM` - the network's IPAM configuration.
@@ -2629,9 +2629,9 @@ class Docker {
2629
2629
  * * `Attachable` - whether the network is manually attachable by regular containers from worker nodes in a Docker swarm.
2630
2630
  * * `Ingress` - whether the network is providing the routing-mesh for a Docker swarm.
2631
2631
  * * `ConfigFrom` - the config-only network source that provides the configuration for the network.
2632
- * * `ConfigOnly` - whether the network is a config-only network. Config-only networks are placeholder networks for network configurations to be used by other networks. Config-only networks cannot be used directly to run containers or services.
2633
- * * `Options` - network-specific options used when creating the network.
2634
- * * `Labels` - object of user-defined key/value metadata.
2632
+ * * `ConfigOnly` - whether the network is a config-only network. Config-only networks are placeholder networks for network configurations for other networks. Containers and services cannot attach to config-only networks.
2633
+ * * `Options` - network-specific options for creating the network.
2634
+ * * `Labels` - object of key-value metadata.
2635
2635
  * * `Peers` - list of peer nodes for the network. `Peers` is only present if the network is an overlay network.
2636
2636
  *
2637
2637
  * ```javascript
package/HTTP.js CHANGED
@@ -57,6 +57,10 @@ const httpConfigure = require('./internal/httpConfigure')
57
57
  */
58
58
  class HTTP {
59
59
  constructor(baseUrl, requestOptions = {}) {
60
+ if (typeof baseUrl == "string" && !baseUrl.startsWith("http")) {
61
+ baseUrl = `http://${baseUrl}`
62
+ }
63
+
60
64
  if (
61
65
  typeof baseUrl == 'string'
62
66
  || typeof baseUrl?.toString == 'function'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "presidium",
3
- "version": "4.9.0",
3
+ "version": "4.9.1",
4
4
  "description": "The Presidium library.",
5
5
  "author": "Richard Tong",
6
6
  "license": "CFOSS",