diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8361223 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +coverage +node_modules +.idea +.git diff --git a/.eslintrc.yaml b/.eslintrc.yaml new file mode 100644 index 0000000..e48c474 --- /dev/null +++ b/.eslintrc.yaml @@ -0,0 +1,19 @@ +env: + es6: true + mocha: true + node: true +extends: 'eslint:recommended' +rules: + indent: + - error + - 2 + - SwitchCase: 1 + linebreak-style: + - error + - unix + quotes: + - error + - single + semi: + - error + - always diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5464d8d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,19 @@ +name: Build and Publish Docker Image + +on: + push: + branches: [main] + pull_request: + branches: [main] + release: + types: [published] + +jobs: + docker-publish: + uses: mekomsolutions/shared-github-workflow/.github/workflows/docker-build-publish.yml@main + with: + download-artifacts: false + image-name: "container-to-consul" + secrets: + DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_REGISTRY_USERNAME }} + DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_REGISTRY_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a592eb3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI +on: + push: + branches: ["*"] + pull_request: + branches: [main] + +jobs: + run-unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + - name: Install dependencies + run: npm install + - name: Run tests + run: npm test + run-e2e-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run e2e tests + uses: hoverkraft-tech/compose-action@v2.0.1 + with: + compose-file: docker-compose-e2e.yaml + up-flags: --build --force-recreate --abort-on-container-exit --exit-code-from playwright + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9cc015f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/.idea +/node_modules +/coverage + diff --git a/.istanbul.yml b/.istanbul.yml new file mode 100644 index 0000000..e44306a --- /dev/null +++ b/.istanbul.yml @@ -0,0 +1,6 @@ +instrumentation: + default-excludes: true + excludes: + - lib/config.js + - lib/index.js + include-all-sources: true diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 0000000..132f284 --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,7 @@ +{ + "require": [ + "sinon-as-promised", + "should", + "should-sinon" + ] +} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..06fa4f6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - '6' + - '5' + - '4.5' +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..118e6a0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:18-alpine + +COPY . /opt/container2sul +WORKDIR /opt/container2sul + +RUN npm install + +CMD ["node", "lib/index.js"] + + diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..2d582c3 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright © 2016 Benoît Vidis + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 6152ee9..c313798 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,162 @@ -# container-to-consul -A tool for automatic discovery and registration of Docker services to Consul using container labels. +# Container-to-Consul + +![Build Status](https://github.com/github/docs/actions/workflows/ci.yml/badge.svg) + +Container-to-Consul automatically registers and deregisters containers as services in Consul. + +This project is largely based on the original work done in [con-tainer2sul](https://github.com/benoitvidis/con-tainer2sul) by [Benoît Vidis](https://github.com/benoitvidis/). While this fork includes significant changes and improvements, we would like to acknowledge the foundation provided by the original project, without which this version would not have been possible. + +Please note that some files, variables, or other elements might still reference the original project name. These remnants will be updated over time as the project evolves, but their presence reflects the project's roots as con-tainer2sul. + + + +- [Container-to-Consul](#container-to-consul) + - [Running Container-to-Consul from source](#running-container-to-consul-from-source) + - [Configuration](#configuration) + - [Consul](#consul) + - [Docker](#docker) + - [Logger](#logger) + - [Container registration](#container-registration) + - [Supported labels](#supported-labels) + - [Registration](#registration) + - [Deregistration](#deregistration) + - [Running E2E tests](#running-e2e-tests) + + + +## Running Container-to-Consul from source + +We provide a Docker Compose setup with [Consul](https://developer.hashicorp.com/consul) included. To run the project, you can use the following command: +``` +docker compose up -d --build --force-recreate +``` + +## Configuration + +Container-to-Consul uses [rc](https://www.npmjs.com/package/rc) to import its configuration. + +The configuration can be overridden using any method supported by rc, for instance using a custom `.c2crc` file or by defining some environmental variables prefixed by `c2c_`. + +#### Consul + +Consul `host` and `port` can be configured: + +_.c2crc_ +```json +{ + "consul": { + "host": "localhost", + "port": 8500 + }, + "[..]": "[..]" +} +``` + +#### Docker + +The `docker` section of the configuration is given to [dockerode](https://github.com/apocas/dockerode) constructor. + +Please refer to [dockerode](https://github.com/apocas/dockerode) documentation for supported options. + +Default configuration listens to Docker daemon on `/var/run/docker.sock` unix socket. + +_.c2crc_ +```json +{ + "[..]": "[..]", + "docker": { + "socketPath": "/var/run/docker.sock" + } +} +``` + +#### Logger + +Container-to-Consul uses [bunyan](https://github.com/trentm/node-bunyan). The `logger` section of the configuraton object is passed to `bunyan.createLogger` method. + +Default configuration outputs logs at `info` level to `stdout`. + +_.c2crc_ +```json +{ + "[..]": "[..]", + "logger": { + "name": "container-to-consul" + } +} +``` + + +## Container registration + +Container-to-Consul relies on [Docker labels](https://docs.docker.com/engine/userguide/labels-custom-metadata/) to define the values sent to Consul. + +Internally, Container-to-Consul calls Consul low-level [catalog/register](https://www.consul.io/docs/agent/http/catalog.html#catalog_register) and [catalog/deregister](https://www.consul.io/docs/agent/http/catalog.html#catalog_deregister) API endpoints. + +Container registration is an opt-in process. By default, Container-to-Consul will not register any container in Consul. To register a container the `consul.register` label must be set to `true`. + +### Supported labels + +| Label | Description | Default | +| --- | --- | --- | +| `consul.register` | Marks a container for discovery | `false` | +| `consul.ip` | The IP that will be registered as part of the service in Consul| first IP found in the `NetworkSettings` group from `docker inspect` result. If the container is running in `host` network mode, the ip address used is the `docker0` one. | +| `consul.port` | The port that the service will be discovered on| `none` | +| `consul.service` | The name of the service in Consul | `container name` | +| `consul.tags` | The tags that will be added to the service in Consul | `[]` | +| `consul.kv.` | Key/Value pairs | `{}` | + +### Registration +Running; + +``` +docker run --name nginx -d \ + -l consul.register=true \ + -l consul.ip=10.0.0.1 \ + -l consul.service=nginx \ + -l consul.tags=www,api \ + -l consul.port=80 \ + -l consul.kv.foo=bar \ + -l consul.kv.bar=baz \ + nginx +``` + +will register a service named `nginx` with +- ip `10.0.0.1` +- tags `www` and `api` +- port `80` +- 2 key/value pairs under the `/services/nginx/` tree. + +You can check for the registered service in [Consul](http://localhost:8500/ui/dc1/services) + +![Nginx Registered](./readme/nginx-registered.png) + +> For a complete usage example please [see](https://github.com/mekomsolutions/container-to-consul/blob/main/e2e/docker/docker-compose.yaml). + +### Deregistration + +To deregister the container, you can simply stop it. + +```bash +docker stop nginx +``` + +After this if you check [Consul](http://localhost:8500/ui/dc1/services) the service will be removed + +![Nginx Deregistered](./readme/nginx-deregistered.png) + +You can then remove the container + +```bash +docker rm nginx +``` + +**Note** : At the moment using force (`-f`) when removing a container will not deregister the service + +## Running E2E tests + +The project contains E2E tests written with [Playwright](https://playwright.dev/) and [Dockerode](https://github.com/apocas/dockerode). Any changes made to the project should be accompanied by E2E tests. To run the tests, you need to have Docker installed and running. Then, you can run the following command: + +``` +docker compose -f docker-compose-e2e.yaml -p container-to-consul-e2e up --build --force-recreate --abort-on-container-exit --exit-code-from playwright +``` diff --git a/coverage/coverage.json b/coverage/coverage.json new file mode 100644 index 0000000..e46ed01 --- /dev/null +++ b/coverage/coverage.json @@ -0,0 +1 @@ +{"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/catalog.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/catalog.js","s":{"1":3,"2":1,"3":1,"4":1},"b":{},"f":{"1":3,"2":1,"3":1},"fnMap":{"1":{"name":"(anonymous_1)","line":4,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":23}}},"2":{"name":"(anonymous_2)","line":8,"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":18}}},"3":{"name":"(anonymous_3)","line":12,"loc":{"start":{"line":12,"column":13},"end":{"line":12,"column":20}}}},"statementMap":{"1":{"start":{"line":5,"column":4},"end":{"line":5,"column":25}},"2":{"start":{"line":9,"column":4},"end":{"line":9,"column":58}},"3":{"start":{"line":13,"column":4},"end":{"line":13,"column":60}},"4":{"start":{"line":17,"column":0},"end":{"line":17,"column":25}}},"branchMap":{}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/kv.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/kv.js","s":{"1":5,"2":1,"3":1,"4":1,"5":1,"6":1,"7":0,"8":1,"9":1},"b":{"1":[0,1]},"f":{"1":5,"2":1,"3":1,"4":1,"5":1},"fnMap":{"1":{"name":"(anonymous_1)","line":4,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":23}}},"2":{"name":"(anonymous_2)","line":8,"loc":{"start":{"line":8,"column":7},"end":{"line":8,"column":16}}},"3":{"name":"(anonymous_3)","line":12,"loc":{"start":{"line":12,"column":6},"end":{"line":12,"column":19}}},"4":{"name":"(anonymous_4)","line":16,"loc":{"start":{"line":16,"column":6},"end":{"line":16,"column":12}}},"5":{"name":"(anonymous_5)","line":20,"loc":{"start":{"line":20,"column":9},"end":{"line":20,"column":24}}}},"statementMap":{"1":{"start":{"line":5,"column":4},"end":{"line":5,"column":25}},"2":{"start":{"line":9,"column":4},"end":{"line":9,"column":53}},"3":{"start":{"line":13,"column":4},"end":{"line":13,"column":52}},"4":{"start":{"line":17,"column":4},"end":{"line":17,"column":49}},"5":{"start":{"line":21,"column":4},"end":{"line":21,"column":30}},"6":{"start":{"line":23,"column":4},"end":{"line":25,"column":5}},"7":{"start":{"line":24,"column":6},"end":{"line":24,"column":24}},"8":{"start":{"line":27,"column":4},"end":{"line":27,"column":36}},"9":{"start":{"line":31,"column":0},"end":{"line":31,"column":20}}},"branchMap":{"1":{"line":23,"type":"if","locations":[{"start":{"line":23,"column":4},"end":{"line":23,"column":4}},{"start":{"line":23,"column":4},"end":{"line":23,"column":4}}]}}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/errors/skipError.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/errors/skipError.js","s":{"1":1,"2":1},"b":{},"f":{"1":1},"fnMap":{"1":{"name":"(anonymous_1)","line":4,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":20}}}},"statementMap":{"1":{"start":{"line":5,"column":4},"end":{"line":5,"column":15}},"2":{"start":{"line":9,"column":0},"end":{"line":9,"column":27}}},"branchMap":{}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/index.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/index.js","s":{"1":1,"2":1,"3":1,"4":6,"5":6,"6":6,"7":6,"8":2,"9":2,"10":2,"11":2,"12":0,"13":2,"14":1,"15":2,"16":1,"17":2,"18":1,"19":2,"20":1,"21":1,"22":1,"23":1},"b":{"1":[6,6],"2":[2,0],"3":[1,1],"4":[1,1],"5":[1,1]},"f":{"1":6,"2":2,"3":0,"4":1,"5":2,"6":1,"7":1,"8":1},"fnMap":{"1":{"name":"(anonymous_1)","line":7,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":22}}},"2":{"name":"(anonymous_2)","line":15,"loc":{"start":{"line":15,"column":7},"end":{"line":15,"column":27}}},"3":{"name":"transformResponse","line":24,"loc":{"start":{"line":24,"column":26},"end":{"line":24,"column":59}}},"4":{"name":"(anonymous_4)","line":35,"loc":{"start":{"line":35,"column":6},"end":{"line":35,"column":12}}},"5":{"name":"(anonymous_5)","line":49,"loc":{"start":{"line":49,"column":6},"end":{"line":49,"column":18}}},"6":{"name":"(anonymous_6)","line":57,"loc":{"start":{"line":57,"column":9},"end":{"line":57,"column":15}}},"7":{"name":"(anonymous_7)","line":61,"loc":{"start":{"line":61,"column":13},"end":{"line":61,"column":16}}},"8":{"name":"(anonymous_8)","line":65,"loc":{"start":{"line":65,"column":8},"end":{"line":65,"column":11}}}},"statementMap":{"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":31}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":37}},"3":{"start":{"line":4,"column":0},"end":{"line":4,"column":27}},"4":{"start":{"line":8,"column":4},"end":{"line":8,"column":28}},"5":{"start":{"line":9,"column":4},"end":{"line":9,"column":28}},"6":{"start":{"line":11,"column":4},"end":{"line":11,"column":26}},"7":{"start":{"line":12,"column":4},"end":{"line":12,"column":33}},"8":{"start":{"line":16,"column":4},"end":{"line":19,"column":5}},"9":{"start":{"line":17,"column":6},"end":{"line":17,"column":47}},"10":{"start":{"line":18,"column":6},"end":{"line":18,"column":33}},"11":{"start":{"line":20,"column":4},"end":{"line":27,"column":6}},"12":{"start":{"line":25,"column":8},"end":{"line":25,"column":32}},"13":{"start":{"line":29,"column":4},"end":{"line":31,"column":5}},"14":{"start":{"line":30,"column":6},"end":{"line":30,"column":26}},"15":{"start":{"line":32,"column":4},"end":{"line":32,"column":26}},"16":{"start":{"line":36,"column":4},"end":{"line":36,"column":34}},"17":{"start":{"line":50,"column":4},"end":{"line":52,"column":5}},"18":{"start":{"line":51,"column":6},"end":{"line":51,"column":32}},"19":{"start":{"line":54,"column":4},"end":{"line":54,"column":40}},"20":{"start":{"line":58,"column":4},"end":{"line":58,"column":37}},"21":{"start":{"line":62,"column":4},"end":{"line":62,"column":29}},"22":{"start":{"line":66,"column":4},"end":{"line":66,"column":24}},"23":{"start":{"line":70,"column":0},"end":{"line":70,"column":24}}},"branchMap":{"1":{"line":12,"type":"binary-expr","locations":[{"start":{"line":12,"column":14},"end":{"line":12,"column":23}},{"start":{"line":12,"column":27},"end":{"line":12,"column":32}}]},"2":{"line":16,"type":"if","locations":[{"start":{"line":16,"column":4},"end":{"line":16,"column":4}},{"start":{"line":16,"column":4},"end":{"line":16,"column":4}}]},"3":{"line":17,"type":"cond-expr","locations":[{"start":{"line":17,"column":37},"end":{"line":17,"column":40}},{"start":{"line":17,"column":43},"end":{"line":17,"column":46}}]},"4":{"line":29,"type":"if","locations":[{"start":{"line":29,"column":4},"end":{"line":29,"column":4}},{"start":{"line":29,"column":4},"end":{"line":29,"column":4}}]},"5":{"line":50,"type":"if","locations":[{"start":{"line":50,"column":4},"end":{"line":50,"column":4}},{"start":{"line":50,"column":4},"end":{"line":50,"column":4}}]}}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/container-to-consul.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/container-to-consul.js","s":{"1":22,"2":22,"3":22,"4":22,"5":22,"6":21,"7":21,"8":21,"9":21,"10":21,"11":25,"12":2,"13":1,"14":1,"15":1,"16":25,"17":2,"18":1,"19":1,"20":1,"21":5,"22":5,"23":2,"24":1,"25":1,"26":4,"27":6,"28":6,"29":1,"30":1,"31":5,"32":4,"33":1,"34":1,"35":3,"36":3,"37":2,"38":2,"39":1,"40":2,"41":4,"42":4,"43":4,"44":2,"45":1,"46":1,"47":1,"48":2,"49":2,"50":2,"51":1,"52":1,"53":1,"54":1,"55":2,"56":2,"57":2,"58":0,"59":0,"60":0,"61":0,"62":0,"63":2,"64":2,"65":1,"66":1,"67":1,"68":1,"69":3,"70":3,"71":3,"72":3,"73":3,"74":3,"75":0,"76":3,"77":3,"78":9,"79":2,"80":2,"81":1,"82":2,"83":2,"84":2,"85":2,"86":1,"87":0,"88":2,"89":1,"90":1,"91":1,"92":2,"93":1,"94":3,"95":3,"96":3,"97":3,"98":1,"99":3,"100":3,"101":1,"102":3,"103":2,"104":3,"105":3,"106":5,"107":5,"108":1,"109":5,"110":22},"b":{"1":[1,1],"2":[2,1],"3":[1,0],"4":[4,1],"5":[5,4],"6":[1,1],"7":[2,0],"8":[0,0],"9":[3,0],"10":[0,3],"11":[3,3,3],"12":[3,0],"13":[2,2,1,1],"14":[1,1],"15":[1,1],"16":[1,2],"17":[3,1],"18":[1,2],"19":[3,2,1],"20":[2,1],"21":[3,2],"22":[1,4],"23":[5,3,1]},"f":{"1":21,"2":25,"3":5,"4":1,"5":4,"6":2,"7":2,"8":3,"9":3,"10":5},"fnMap":{"1":{"name":"(anonymous_1)","line":10,"loc":{"start":{"line":10,"column":13},"end":{"line":10,"column":22}}},"2":{"name":"(anonymous_2)","line":20,"loc":{"start":{"line":20,"column":15},"end":{"line":20,"column":18}}},"3":{"name":"(anonymous_3)","line":41,"loc":{"start":{"line":41,"column":7},"end":{"line":41,"column":10}}},"4":{"name":"(anonymous_4)","line":86,"loc":{"start":{"line":86,"column":20},"end":{"line":86,"column":33}}},"5":{"name":"(anonymous_5)","line":95,"loc":{"start":{"line":95,"column":19},"end":{"line":95,"column":31}}},"6":{"name":"(anonymous_6)","line":128,"loc":{"start":{"line":128,"column":21},"end":{"line":128,"column":33}}},"7":{"name":"(anonymous_7)","line":157,"loc":{"start":{"line":157,"column":19},"end":{"line":157,"column":29}}},"8":{"name":"(anonymous_8)","line":175,"loc":{"start":{"line":175,"column":19},"end":{"line":175,"column":31}}},"9":{"name":"(anonymous_9)","line":241,"loc":{"start":{"line":241,"column":22},"end":{"line":241,"column":34}}},"10":{"name":"(anonymous_10)","line":266,"loc":{"start":{"line":266,"column":18},"end":{"line":266,"column":30}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":33}},"2":{"start":{"line":4,"column":0},"end":{"line":4,"column":35}},"3":{"start":{"line":5,"column":0},"end":{"line":5,"column":35}},"4":{"start":{"line":6,"column":0},"end":{"line":6,"column":36}},"5":{"start":{"line":7,"column":0},"end":{"line":7,"column":48}},"6":{"start":{"line":11,"column":4},"end":{"line":11,"column":25}},"7":{"start":{"line":13,"column":4},"end":{"line":13,"column":44}},"8":{"start":{"line":14,"column":4},"end":{"line":14,"column":35}},"9":{"start":{"line":15,"column":4},"end":{"line":15,"column":50}},"10":{"start":{"line":17,"column":4},"end":{"line":17,"column":25}},"11":{"start":{"line":21,"column":4},"end":{"line":29,"column":7}},"12":{"start":{"line":22,"column":6},"end":{"line":28,"column":11}},"13":{"start":{"line":24,"column":27},"end":{"line":24,"column":60}},"14":{"start":{"line":26,"column":10},"end":{"line":26,"column":32}},"15":{"start":{"line":27,"column":10},"end":{"line":27,"column":22}},"16":{"start":{"line":30,"column":4},"end":{"line":38,"column":7}},"17":{"start":{"line":31,"column":6},"end":{"line":37,"column":11}},"18":{"start":{"line":33,"column":27},"end":{"line":33,"column":87}},"19":{"start":{"line":35,"column":10},"end":{"line":35,"column":32}},"20":{"start":{"line":36,"column":10},"end":{"line":36,"column":22}},"21":{"start":{"line":42,"column":4},"end":{"line":78,"column":9}},"22":{"start":{"line":44,"column":18},"end":{"line":50,"column":10}},"23":{"start":{"line":46,"column":10},"end":{"line":48,"column":11}},"24":{"start":{"line":47,"column":12},"end":{"line":47,"column":22}},"25":{"start":{"line":49,"column":10},"end":{"line":49,"column":22}},"26":{"start":{"line":52,"column":8},"end":{"line":70,"column":12}},"27":{"start":{"line":53,"column":10},"end":{"line":69,"column":15}},"28":{"start":{"line":55,"column":14},"end":{"line":68,"column":19}},"29":{"start":{"line":58,"column":18},"end":{"line":60,"column":19}},"30":{"start":{"line":59,"column":20},"end":{"line":59,"column":55}},"31":{"start":{"line":63,"column":18},"end":{"line":65,"column":19}},"32":{"start":{"line":64,"column":20},"end":{"line":64,"column":55}},"33":{"start":{"line":66,"column":18},"end":{"line":66,"column":40}},"34":{"start":{"line":67,"column":18},"end":{"line":67,"column":30}},"35":{"start":{"line":73,"column":18},"end":{"line":73,"column":42}},"36":{"start":{"line":74,"column":26},"end":{"line":74,"column":61}},"37":{"start":{"line":76,"column":8},"end":{"line":76,"column":30}},"38":{"start":{"line":77,"column":8},"end":{"line":77,"column":20}},"39":{"start":{"line":87,"column":4},"end":{"line":87,"column":87}},"40":{"start":{"line":87,"column":51},"end":{"line":87,"column":84}},"41":{"start":{"line":96,"column":4},"end":{"line":96,"column":16}},"42":{"start":{"line":98,"column":4},"end":{"line":108,"column":5}},"43":{"start":{"line":99,"column":6},"end":{"line":99,"column":50}},"44":{"start":{"line":102,"column":6},"end":{"line":105,"column":7}},"45":{"start":{"line":103,"column":8},"end":{"line":103,"column":33}},"46":{"start":{"line":104,"column":8},"end":{"line":104,"column":33}},"47":{"start":{"line":107,"column":6},"end":{"line":107,"column":31}},"48":{"start":{"line":110,"column":4},"end":{"line":110,"column":52}},"49":{"start":{"line":112,"column":4},"end":{"line":119,"column":9}},"50":{"start":{"line":113,"column":18},"end":{"line":113,"column":55}},"51":{"start":{"line":114,"column":18},"end":{"line":114,"column":112}},"52":{"start":{"line":116,"column":8},"end":{"line":116,"column":88}},"53":{"start":{"line":117,"column":8},"end":{"line":117,"column":30}},"54":{"start":{"line":118,"column":8},"end":{"line":118,"column":20}},"55":{"start":{"line":129,"column":4},"end":{"line":132,"column":57}},"56":{"start":{"line":134,"column":4},"end":{"line":136,"column":5}},"57":{"start":{"line":135,"column":6},"end":{"line":135,"column":31}},"58":{"start":{"line":138,"column":4},"end":{"line":146,"column":7}},"59":{"start":{"line":139,"column":6},"end":{"line":145,"column":7}},"60":{"start":{"line":140,"column":8},"end":{"line":142,"column":28}},"61":{"start":{"line":144,"column":8},"end":{"line":144,"column":81}},"62":{"start":{"line":148,"column":4},"end":{"line":148,"column":33}},"63":{"start":{"line":158,"column":4},"end":{"line":158,"column":54}},"64":{"start":{"line":160,"column":4},"end":{"line":166,"column":9}},"65":{"start":{"line":161,"column":18},"end":{"line":161,"column":72}},"66":{"start":{"line":162,"column":18},"end":{"line":162,"column":68}},"67":{"start":{"line":164,"column":8},"end":{"line":164,"column":30}},"68":{"start":{"line":165,"column":8},"end":{"line":165,"column":20}},"69":{"start":{"line":176,"column":4},"end":{"line":182,"column":6}},"70":{"start":{"line":183,"column":4},"end":{"line":186,"column":17}},"71":{"start":{"line":188,"column":4},"end":{"line":190,"column":5}},"72":{"start":{"line":189,"column":6},"end":{"line":189,"column":43}},"73":{"start":{"line":192,"column":4},"end":{"line":192,"column":50}},"74":{"start":{"line":194,"column":4},"end":{"line":196,"column":5}},"75":{"start":{"line":195,"column":6},"end":{"line":195,"column":87}},"76":{"start":{"line":197,"column":4},"end":{"line":228,"column":5}},"77":{"start":{"line":198,"column":6},"end":{"line":227,"column":9}},"78":{"start":{"line":199,"column":8},"end":{"line":226,"column":9}},"79":{"start":{"line":201,"column":12},"end":{"line":201,"column":42}},"80":{"start":{"line":202,"column":12},"end":{"line":204,"column":13}},"81":{"start":{"line":203,"column":14},"end":{"line":203,"column":52}},"82":{"start":{"line":205,"column":12},"end":{"line":205,"column":18}},"83":{"start":{"line":207,"column":12},"end":{"line":216,"column":13}},"84":{"start":{"line":208,"column":14},"end":{"line":208,"column":59}},"85":{"start":{"line":209,"column":14},"end":{"line":211,"column":15}},"86":{"start":{"line":210,"column":16},"end":{"line":210,"column":44}},"87":{"start":{"line":215,"column":14},"end":{"line":215,"column":32}},"88":{"start":{"line":217,"column":12},"end":{"line":217,"column":18}},"89":{"start":{"line":219,"column":12},"end":{"line":219,"column":50}},"90":{"start":{"line":220,"column":12},"end":{"line":220,"column":18}},"91":{"start":{"line":222,"column":12},"end":{"line":224,"column":38}},"92":{"start":{"line":224,"column":26},"end":{"line":224,"column":36}},"93":{"start":{"line":225,"column":12},"end":{"line":225,"column":18}},"94":{"start":{"line":230,"column":4},"end":{"line":230,"column":39}},"95":{"start":{"line":232,"column":4},"end":{"line":232,"column":19}},"96":{"start":{"line":242,"column":4},"end":{"line":242,"column":30}},"97":{"start":{"line":244,"column":4},"end":{"line":246,"column":5}},"98":{"start":{"line":245,"column":6},"end":{"line":245,"column":32}},"99":{"start":{"line":248,"column":4},"end":{"line":248,"column":32}},"100":{"start":{"line":249,"column":4},"end":{"line":251,"column":5}},"101":{"start":{"line":250,"column":6},"end":{"line":250,"column":37}},"102":{"start":{"line":252,"column":4},"end":{"line":254,"column":5}},"103":{"start":{"line":253,"column":6},"end":{"line":253,"column":33}},"104":{"start":{"line":255,"column":4},"end":{"line":255,"column":35}},"105":{"start":{"line":257,"column":4},"end":{"line":257,"column":16}},"106":{"start":{"line":267,"column":4},"end":{"line":267,"column":32}},"107":{"start":{"line":268,"column":4},"end":{"line":270,"column":5}},"108":{"start":{"line":269,"column":6},"end":{"line":269,"column":37}},"109":{"start":{"line":271,"column":4},"end":{"line":271,"column":16}},"110":{"start":{"line":276,"column":0},"end":{"line":276,"column":35}}},"branchMap":{"1":{"line":46,"type":"if","locations":[{"start":{"line":46,"column":10},"end":{"line":46,"column":10}},{"start":{"line":46,"column":10},"end":{"line":46,"column":10}}]},"2":{"line":46,"type":"binary-expr","locations":[{"start":{"line":46,"column":14},"end":{"line":46,"column":30}},{"start":{"line":46,"column":34},"end":{"line":46,"column":58}}]},"3":{"line":58,"type":"if","locations":[{"start":{"line":58,"column":18},"end":{"line":58,"column":18}},{"start":{"line":58,"column":18},"end":{"line":58,"column":18}}]},"4":{"line":63,"type":"if","locations":[{"start":{"line":63,"column":18},"end":{"line":63,"column":18}},{"start":{"line":63,"column":18},"end":{"line":63,"column":18}}]},"5":{"line":63,"type":"binary-expr","locations":[{"start":{"line":63,"column":22},"end":{"line":63,"column":38}},{"start":{"line":63,"column":42},"end":{"line":63,"column":66}}]},"6":{"line":102,"type":"if","locations":[{"start":{"line":102,"column":6},"end":{"line":102,"column":6}},{"start":{"line":102,"column":6},"end":{"line":102,"column":6}}]},"7":{"line":134,"type":"if","locations":[{"start":{"line":134,"column":4},"end":{"line":134,"column":4}},{"start":{"line":134,"column":4},"end":{"line":134,"column":4}}]},"8":{"line":139,"type":"if","locations":[{"start":{"line":139,"column":6},"end":{"line":139,"column":6}},{"start":{"line":139,"column":6},"end":{"line":139,"column":6}}]},"9":{"line":188,"type":"if","locations":[{"start":{"line":188,"column":4},"end":{"line":188,"column":4}},{"start":{"line":188,"column":4},"end":{"line":188,"column":4}}]},"10":{"line":194,"type":"if","locations":[{"start":{"line":194,"column":4},"end":{"line":194,"column":4}},{"start":{"line":194,"column":4},"end":{"line":194,"column":4}}]},"11":{"line":194,"type":"binary-expr","locations":[{"start":{"line":194,"column":8},"end":{"line":194,"column":38}},{"start":{"line":194,"column":42},"end":{"line":194,"column":77}},{"start":{"line":194,"column":81},"end":{"line":194,"column":105}}]},"12":{"line":197,"type":"if","locations":[{"start":{"line":197,"column":4},"end":{"line":197,"column":4}},{"start":{"line":197,"column":4},"end":{"line":197,"column":4}}]},"13":{"line":199,"type":"switch","locations":[{"start":{"line":200,"column":10},"end":{"line":205,"column":18}},{"start":{"line":206,"column":10},"end":{"line":217,"column":18}},{"start":{"line":218,"column":10},"end":{"line":220,"column":18}},{"start":{"line":221,"column":10},"end":{"line":225,"column":18}}]},"14":{"line":202,"type":"if","locations":[{"start":{"line":202,"column":12},"end":{"line":202,"column":12}},{"start":{"line":202,"column":12},"end":{"line":202,"column":12}}]},"15":{"line":209,"type":"if","locations":[{"start":{"line":209,"column":14},"end":{"line":209,"column":14}},{"start":{"line":209,"column":14},"end":{"line":209,"column":14}}]},"16":{"line":244,"type":"if","locations":[{"start":{"line":244,"column":4},"end":{"line":244,"column":4}},{"start":{"line":244,"column":4},"end":{"line":244,"column":4}}]},"17":{"line":244,"type":"binary-expr","locations":[{"start":{"line":244,"column":8},"end":{"line":244,"column":13}},{"start":{"line":244,"column":17},"end":{"line":244,"column":32}}]},"18":{"line":249,"type":"if","locations":[{"start":{"line":249,"column":4},"end":{"line":249,"column":4}},{"start":{"line":249,"column":4},"end":{"line":249,"column":4}}]},"19":{"line":249,"type":"binary-expr","locations":[{"start":{"line":249,"column":8},"end":{"line":249,"column":13}},{"start":{"line":249,"column":17},"end":{"line":249,"column":33}},{"start":{"line":249,"column":37},"end":{"line":249,"column":60}}]},"20":{"line":252,"type":"if","locations":[{"start":{"line":252,"column":4},"end":{"line":252,"column":4}},{"start":{"line":252,"column":4},"end":{"line":252,"column":4}}]},"21":{"line":252,"type":"binary-expr","locations":[{"start":{"line":252,"column":8},"end":{"line":252,"column":12}},{"start":{"line":252,"column":16},"end":{"line":252,"column":35}}]},"22":{"line":268,"type":"if","locations":[{"start":{"line":268,"column":4},"end":{"line":268,"column":4}},{"start":{"line":268,"column":4},"end":{"line":268,"column":4}}]},"23":{"line":268,"type":"binary-expr","locations":[{"start":{"line":268,"column":8},"end":{"line":268,"column":13}},{"start":{"line":268,"column":17},"end":{"line":268,"column":33}},{"start":{"line":268,"column":37},"end":{"line":268,"column":60}}]}}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/docker.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/docker.js","s":{"1":7,"2":7,"3":7,"4":7,"5":6,"6":6,"7":6,"8":6,"9":6,"10":6,"11":6,"12":5,"13":4,"14":4,"15":4,"16":4,"17":4,"18":5,"19":1,"20":1,"21":2,"22":1,"23":1,"24":1,"25":1,"26":7},"b":{"1":[1,1]},"f":{"1":6,"2":6,"3":1},"fnMap":{"1":{"name":"(anonymous_1)","line":9,"loc":{"start":{"line":9,"column":14},"end":{"line":9,"column":34}}},"2":{"name":"(anonymous_2)","line":20,"loc":{"start":{"line":20,"column":8},"end":{"line":20,"column":11}}},"3":{"name":"(anonymous_3)","line":50,"loc":{"start":{"line":50,"column":13},"end":{"line":50,"column":16}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":39}},"2":{"start":{"line":4,"column":0},"end":{"line":4,"column":54}},"3":{"start":{"line":5,"column":0},"end":{"line":5,"column":46}},"4":{"start":{"line":6,"column":0},"end":{"line":6,"column":36}},"5":{"start":{"line":10,"column":4},"end":{"line":10,"column":47}},"6":{"start":{"line":12,"column":4},"end":{"line":12,"column":50}},"7":{"start":{"line":13,"column":4},"end":{"line":13,"column":52}},"8":{"start":{"line":14,"column":4},"end":{"line":14,"column":32}},"9":{"start":{"line":15,"column":4},"end":{"line":17,"column":7}},"10":{"start":{"line":21,"column":4},"end":{"line":47,"column":9}},"11":{"start":{"line":22,"column":6},"end":{"line":22,"column":26}},"12":{"start":{"line":24,"column":6},"end":{"line":32,"column":9}},"13":{"start":{"line":25,"column":8},"end":{"line":25,"column":63}},"14":{"start":{"line":27,"column":8},"end":{"line":31,"column":13}},"15":{"start":{"line":29,"column":12},"end":{"line":29,"column":99}},"16":{"start":{"line":29,"column":50},"end":{"line":29,"column":71}},"17":{"start":{"line":30,"column":12},"end":{"line":30,"column":22}},"18":{"start":{"line":34,"column":6},"end":{"line":37,"column":9}},"19":{"start":{"line":35,"column":8},"end":{"line":35,"column":82}},"20":{"start":{"line":36,"column":8},"end":{"line":36,"column":28}},"21":{"start":{"line":41,"column":8},"end":{"line":43,"column":9}},"22":{"start":{"line":42,"column":10},"end":{"line":42,"column":30}},"23":{"start":{"line":45,"column":8},"end":{"line":45,"column":48}},"24":{"start":{"line":46,"column":8},"end":{"line":46,"column":37}},"25":{"start":{"line":51,"column":4},"end":{"line":51,"column":40}},"26":{"start":{"line":55,"column":0},"end":{"line":55,"column":24}}},"branchMap":{"1":{"line":41,"type":"if","locations":[{"start":{"line":41,"column":8},"end":{"line":41,"column":8}},{"start":{"line":41,"column":8},"end":{"line":41,"column":8}}]}}},"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/typedefs.js":{"path":"/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/typedefs.js","s":{},"b":{},"f":{},"fnMap":{},"statementMap":{},"branchMap":{}}} \ No newline at end of file diff --git a/coverage/lcov-report/base.css b/coverage/lcov-report/base.css new file mode 100644 index 0000000..29737bc --- /dev/null +++ b/coverage/lcov-report/base.css @@ -0,0 +1,213 @@ +body, html { + margin:0; padding: 0; + height: 100%; +} +body { + font-family: Helvetica Neue, Helvetica, Arial; + font-size: 14px; + color:#333; +} +.small { font-size: 12px; } +*, *:after, *:before { + -webkit-box-sizing:border-box; + -moz-box-sizing:border-box; + box-sizing:border-box; + } +h1 { font-size: 20px; margin: 0;} +h2 { font-size: 14px; } +pre { + font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; + margin: 0; + padding: 0; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; +} +a { color:#0074D9; text-decoration:none; } +a:hover { text-decoration:underline; } +.strong { font-weight: bold; } +.space-top1 { padding: 10px 0 0 0; } +.pad2y { padding: 20px 0; } +.pad1y { padding: 10px 0; } +.pad2x { padding: 0 20px; } +.pad2 { padding: 20px; } +.pad1 { padding: 10px; } +.space-left2 { padding-left:55px; } +.space-right2 { padding-right:20px; } +.center { text-align:center; } +.clearfix { display:block; } +.clearfix:after { + content:''; + display:block; + height:0; + clear:both; + visibility:hidden; + } +.fl { float: left; } +@media only screen and (max-width:640px) { + .col3 { width:100%; max-width:100%; } + .hide-mobile { display:none!important; } +} + +.quiet { + color: #7f7f7f; + color: rgba(0,0,0,0.5); +} +.quiet a { opacity: 0.7; } + +.fraction { + font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; + font-size: 10px; + color: #555; + background: #E8E8E8; + padding: 4px 5px; + border-radius: 3px; + vertical-align: middle; +} + +div.path a:link, div.path a:visited { color: #333; } +table.coverage { + border-collapse: collapse; + margin: 10px 0 0 0; + padding: 0; +} + +table.coverage td { + margin: 0; + padding: 0; + vertical-align: top; +} +table.coverage td.line-count { + text-align: right; + padding: 0 5px 0 20px; +} +table.coverage td.line-coverage { + text-align: right; + padding-right: 10px; + min-width:20px; +} + +table.coverage td span.cline-any { + display: inline-block; + padding: 0 5px; + width: 100%; +} +.missing-if-branch { + display: inline-block; + margin-right: 5px; + border-radius: 3px; + position: relative; + padding: 0 4px; + background: #333; + color: yellow; +} + +.skip-if-branch { + display: none; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: #ccc; + color: white; +} +.missing-if-branch .typ, .skip-if-branch .typ { + color: inherit !important; +} +.coverage-summary { + border-collapse: collapse; + width: 100%; +} +.coverage-summary tr { border-bottom: 1px solid #bbb; } +.keyline-all { border: 1px solid #ddd; } +.coverage-summary td, .coverage-summary th { padding: 10px; } +.coverage-summary tbody { border: 1px solid #bbb; } +.coverage-summary td { border-right: 1px solid #bbb; } +.coverage-summary td:last-child { border-right: none; } +.coverage-summary th { + text-align: left; + font-weight: normal; + white-space: nowrap; +} +.coverage-summary th.file { border-right: none !important; } +.coverage-summary th.pct { } +.coverage-summary th.pic, +.coverage-summary th.abs, +.coverage-summary td.pct, +.coverage-summary td.abs { text-align: right; } +.coverage-summary td.file { white-space: nowrap; } +.coverage-summary td.pic { min-width: 120px !important; } +.coverage-summary tfoot td { } + +.coverage-summary .sorter { + height: 10px; + width: 7px; + display: inline-block; + margin-left: 0.5em; + background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; +} +.coverage-summary .sorted .sorter { + background-position: 0 -20px; +} +.coverage-summary .sorted-desc .sorter { + background-position: 0 -10px; +} +.status-line { height: 10px; } +/* dark red */ +.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } +.low .chart { border:1px solid #C21F39 } +/* medium red */ +.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } +/* light red */ +.low, .cline-no { background:#FCE1E5 } +/* light green */ +.high, .cline-yes { background:rgb(230,245,208) } +/* medium green */ +.cstat-yes { background:rgb(161,215,106) } +/* dark green */ +.status-line.high, .high .cover-fill { background:rgb(77,146,33) } +.high .chart { border:1px solid rgb(77,146,33) } +/* dark yellow (gold) */ +.medium .chart { border:1px solid #f9cd0b; } +.status-line.medium, .medium .cover-fill { background: #f9cd0b; } +/* light yellow */ +.medium { background: #fff4c2; } +/* light gray */ +span.cline-neutral { background: #eaeaea; } + +.cbranch-no { background: yellow !important; color: #111; } + +.cstat-skip { background: #ddd; color: #111; } +.fstat-skip { background: #ddd; color: #111 !important; } +.cbranch-skip { background: #ddd !important; color: #111; } + + +.cover-fill, .cover-empty { + display:inline-block; + height: 12px; +} +.chart { + line-height: 0; +} +.cover-empty { + background: white; +} +.cover-full { + border-right: none !important; +} +pre.prettyprint { + border: none !important; + padding: 0 !important; + margin: 0 !important; +} +.com { color: #999 !important; } +.ignore-none { color: #999; font-weight: normal; } + +.wrapper { + min-height: 100%; + height: auto !important; + height: 100%; + margin: 0 auto -48px; +} +.footer, .push { + height: 48px; +} diff --git a/coverage/lcov-report/index.html b/coverage/lcov-report/index.html new file mode 100644 index 0000000..23f2c2b --- /dev/null +++ b/coverage/lcov-report/index.html @@ -0,0 +1,119 @@ + + + + Code coverage report for All files + + + + + + + +
+
+

+ / +

+
+
+ 94.83% + Statements + 165/174 +
+
+ 86.15% + Branches + 56/65 +
+
+ 96.67% + Functions + 29/30 +
+
+ 94.77% + Lines + 163/172 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
lib/
94.85%129/13686.79%46/53100%13/1394.78%127/134
lib/consul/
94.44%34/3683.33%10/1293.75%15/1694.44%34/36
lib/errors/
100%2/2100%0/0100%1/1100%2/2
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/con-tainer2sul.js.html b/coverage/lcov-report/lib/con-tainer2sul.js.html new file mode 100644 index 0000000..4886df6 --- /dev/null +++ b/coverage/lcov-report/lib/con-tainer2sul.js.html @@ -0,0 +1,896 @@ + + + + Code coverage report for lib/con-tainer2sul.js + + + + + + + +
+
+

+ all files / lib/ con-tainer2sul.js +

+
+
+ 94.5% + Statements + 103/109 +
+
+ 86.27% + Branches + 44/51 +
+
+ 100% + Functions + 10/10 +
+
+ 94.44% + Lines + 102/108 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278  +  +22× +22× +22× +22× +22× +  +  +  +21× +  +21× +21× +21× +  +21× +  +  +  +25× + +  + +  + + +  +  +25× + +  + +  + + +  +  +  +  +  + +  + +  + + +  + +  +  + + +  + +  +  + + +  +  +  + + +  + + +  +  +  +  +  + + +  + + +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  + +  + + +  +  + + + +  +  + +  +  + +  + + + +  + + + +  +  +  +  +  +  +  +  +  +  + +  +  +  +  + + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  + + + +  + + +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  + +  +  +  +  + + +  +  + +  + +  +  + + + +  + + + +  + +  + + + + +  +  +  +  +  + +  + + +  + +  + + +  +  +  +  + +  + +  +  +  +  +  +  +  +  +  + +  + + +  +  + + + +  + + +  + +  + +  +  +  +  +  +  +  +  +  + + + +  + +  +  +  +  +  +  +22× + 
'use strict';
+ 
+const bunyan = require('bunyan');
+const Consul = require('./consul');
+const Docker = require('./docker');
+const Promise = require('bluebird');
+const SkipError = require('./errors/skipError');
+ 
+class ConTainer2Sul {
+  constructor(config) {
+    this.config = config;
+ 
+    this.consul = new Consul(config.consul);
+    this.docker = new Docker(this);
+    this.log = bunyan.createLogger(config.logger);
+ 
+    this._attachEvents();
+  }
+ 
+  _attachEvents() {
+    this.docker.events.on('start', msg => {
+      return this.docker.client.getContainer(msg.id)
+        .inspect()
+        .then(container => this.registerContainer(container))
+        .catch(error => {
+          this.log.error(error);
+          throw error;
+        });
+    });
+    this.docker.events.on('die', msg => {
+      return this.docker.client.getContainer(msg.id)
+        .inspect()
+        .then(container => this.deregisterService(this.containerServiceName(container)))
+        .catch(error => {
+          this.log.error(error);
+          throw error;
+        });
+    });
+  }
+ 
+  start() {
+    return this.docker.start()
+      // deregister containers that do not run
+      .then(() => this.consul.kv.keys('docker/service-ids/')
+        .catch(error => {
+          if (error.statusCode && error.statusCode === 404) {
+            return [];
+          }
+          throw error;
+        }))
+      .then(keys => {
+        return Promise.all(keys.map(key => {
+          return this.consul.kv.get(key)
+            .then(containerId => {
+              return this.docker.client.getContainer(containerId)
+                .inspect()
+                .then(container => {
+                  Eif (container.State.Status !== 'running') {
+                    return this.deregisterService(key);
+                  }
+                })
+                .catch(error => {
+                  if (error.statusCode && error.statusCode === 404) {
+                    return this.deregisterService(key);
+                  }
+                  this.log.error(error);
+                  throw error;
+                });
+            });
+        }));
+      })
+      // register all containers
+      .then(() => this.docker.containers())
+      .then(containers => this.registerContainers(containers))
+      .catch(error => {
+        this.log.error(error);
+        throw error;
+      });
+  }
+ 
+  /**
+   *
+   * @param {Container[]} containers
+   * @returns {Promise.<*>}
+   */
+  registerContainers(containers) {
+    return Promise.all(containers.map(container => this.registerContainer(container)));
+  }
+ 
+  /**
+   *
+   * @param {Container} container
+   * @returns {Promise}
+   */
+  registerContainer(container) {
+    let service;
+ 
+    try {
+      service = this.container2Service(container);
+    }
+    catch (e) {
+      if (e instanceof SkipError) {
+        this.log.info(e.message);
+        return Promise.resolve();
+      }
+ 
+      return Promise.reject(e);
+    }
+ 
+    this.log.info('registering container', service);
+ 
+    return this.registerContainerKv(container)
+      .then(() => this.consul.catalog.register(service))
+      .then(() => this.consul.kv.set(`docker/service-ids/${this.containerServiceName(container)}`, container.Id))
+      .catch(error => {
+        this.consul.kv.delete(`services/${this.containerServiceName(container)}`, true);
+        this.log.error(error);
+        throw error;
+      });
+  }
+ 
+  /**
+   * Registers key/value pairs for the container
+   *
+   * @param {Container} container
+   * @returns {Promise}
+   */
+  registerContainerKv(container) {
+    const
+      lbls = this._containerLabels(container),
+      promises = [],
+      serviceName = this.containerServiceName(container);
+ 
+    Eif (!lbls) {
+      return Promise.resolve();
+    }
+ 
+    Object.keys(lbls).forEach(label => {
+      if (label.startsWith('consul.kv.')) {
+        const
+          key = label.replace(/^consul\.kv\./, ''),
+          val = lbls[label];
+ 
+        promises.push(this.consul.kv.set(`services/${serviceName}/${key}`, val));
+      }
+    });
+ 
+    return Promise.all(promises);
+  }
+ 
+  /**
+   * Un-register a service and related information from Consul
+   *
+   * @param {string} service
+   * @returns {Promise}
+   */
+  deregisterService(service) {
+    this.log.info('deregistering container', service);
+ 
+    return this.consul.catalog.deregister({ Node: service })
+      .then(() => this.consul.kv.delete(`docker/service-ids/${service}`))
+      .then(() => this.consul.kv.delete(`services/${service}`, true))
+      .catch(error => {
+        this.log.error(error);
+        throw error;
+      });
+  }
+ 
+  /**
+   * Given a container, returns a service definition ready to be consumed by Consul catalog/register API endpoint
+   *
+   * @param container
+   * @returns {Object}
+   */
+  container2Service(container) {
+    let service = {
+      Node: this.containerServiceName(container),
+      Address: this.docker.docker0,
+      Service: {
+        Service: this.containerServiceName(container)
+      }
+    };
+    let containerIPAddress = container
+      .NetworkSettings
+      .Networks[Object.keys(container.NetworkSettings.Networks)[0]]
+      .IPAddress;
+ 
+    Eif (containerIPAddress !== '') {
+      service.Address = containerIPAddress;
+    }
+ 
+    const lbls = this._containerLabels(container);
+ 
+    Iif (Object.keys(lbls).length === 0 || lbls['consul.register'] === 'false' || !lbls['consul.register']) {
+      throw new SkipError(`Container ${this.containerServiceName(container)} skipped`);
+    }
+    Eif (lbls) {
+      Object.keys(lbls).forEach(label => {
+        switch (label) {
+          case 'consul.ip':
+            service.Address = lbls[label];
+            if (service.Address === 'host') {
+              service.Address = this.docker.docker0;
+            }
+            break;
+          case 'consul.port':
+            try {
+              service.Service.Port = parseInt(lbls[label]);
+              if (isNaN(service.Service.Port)) {
+                delete service.Service.Port;
+              }
+            }
+            catch (e) {
+              // do nothing
+            }
+            break;
+          case 'consul.service':
+            service.Service.Service = lbls[label];
+            break;
+          case 'consul.tags':
+            service.Service.Tags = lbls[label]
+              .split(',')
+              .map(tag => tag.trim());
+            break;
+        }
+      });
+    }
+ 
+    this.log.debug('service', service);
+ 
+    return service;
+  }
+ 
+  /**
+   * Returns the service name for the container
+   *
+   * @param {Container} container
+   * @returns {string}
+   */
+  containerServiceName(container) {
+    let name = container.Name;
+ 
+    if (!name && container.Names) {
+      name = container.Names[0];
+    }
+ 
+    let lbls = container.Labels;
+    if (!lbls && container.Config && container.Config.Labels) {
+      lbls = container.Config.Labels;
+    }
+    if (lbls && lbls['consul.name']) {
+      name = lbls['consul.name'];
+    }
+    name = name.replace(/^\//, '');
+ 
+    return name;
+  }
+ 
+  /**
+   *
+   * @param container
+   * @returns {Object}
+   * @private
+   */
+  _containerLabels(container) {
+    let lbls = container.Labels;
+    if (!lbls && container.Config && container.Config.Labels) {
+      lbls = container.Config.Labels;
+    }
+    return lbls;
+  }
+ 
+}
+ 
+ 
+ 
+module.exports = ConTainer2Sul;
+ 
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/consul/axios-instance.js.html b/coverage/lcov-report/lib/consul/axios-instance.js.html new file mode 100644 index 0000000..e5a9f0c --- /dev/null +++ b/coverage/lcov-report/lib/consul/axios-instance.js.html @@ -0,0 +1,80 @@ + + + + Code coverage report for lib/consul/axios-instance.js + + + + + + + +
+
+

+ all files / lib/consul/ axios-instance.js +

+
+
+ 0% + Statements + 0/3 +
+
+ 100% + Branches + 0/0 +
+
+ 0% + Functions + 0/1 +
+
+ 0% + Lines + 0/3 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6  +  +  +  +  + 
const axios = require('axios');
+module.exports = axios.create({
+  transformResponse: [function transformResponse(data) {
+    return JSON.parse(data);
+  }]
+}); 
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/consul/catalog.js.html b/coverage/lcov-report/lib/consul/catalog.js.html new file mode 100644 index 0000000..72f9a2b --- /dev/null +++ b/coverage/lcov-report/lib/consul/catalog.js.html @@ -0,0 +1,113 @@ + + + + Code coverage report for lib/consul/catalog.js + + + + + + + +
+
+

+ all files / lib/consul/ catalog.js +

+
+
+ 100% + Statements + 4/4 +
+
+ 100% + Branches + 0/0 +
+
+ 100% + Functions + 3/3 +
+
+ 100% + Lines + 4/4 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17  +  +  +  + +  +  +  + +  +  +  + +  +  +  +
'use strict';
+ 
+class Catalog {
+  constructor (consul) {
+    this.consul = consul;
+  }
+ 
+  register (data) {
+    return this.consul._put('/v1/catalog/register', data);
+  }
+ 
+  deregister (data) {
+    return this.consul._put('/v1/catalog/deregister', data);
+  }
+}
+ 
+module.exports = Catalog;
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/consul/index.html b/coverage/lcov-report/lib/consul/index.html new file mode 100644 index 0000000..374ee10 --- /dev/null +++ b/coverage/lcov-report/lib/consul/index.html @@ -0,0 +1,119 @@ + + + + Code coverage report for lib/consul/ + + + + + + + +
+
+

+ all files lib/consul/ +

+
+
+ 94.44% + Statements + 34/36 +
+
+ 83.33% + Branches + 10/12 +
+
+ 93.75% + Functions + 15/16 +
+
+ 94.44% + Lines + 34/36 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
catalog.js
100%4/4100%0/0100%3/3100%4/4
index.js
95.65%22/2390%9/1087.5%7/895.65%22/23
kv.js
88.89%8/950%1/2100%5/588.89%8/9
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/consul/index.js.html b/coverage/lcov-report/lib/consul/index.js.html new file mode 100644 index 0000000..b9db4ff --- /dev/null +++ b/coverage/lcov-report/lib/consul/index.js.html @@ -0,0 +1,272 @@ + + + + Code coverage report for lib/consul/index.js + + + + + + + +
+
+

+ all files / lib/consul/ index.js +

+
+
+ 95.65% + Statements + 22/23 +
+
+ 90% + Branches + 9/10 +
+
+ 87.5% + Functions + 7/8 +
+
+ 95.65% + Lines + 22/23 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70  + + + +  +  +  + + +  + + +  +  +  + + + +  + +  +  +  +  +  +  +  +  + + +  + +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  + + +  +  + +  +  +  + +  +  +  + +  +  +  + +  +  +  +
'use strict';
+const axios = require('axios');
+const Catalog = require('./catalog');
+const Kv = require('./kv');
+ 
+class Consul {
+  constructor(config) {
+    this.host = config.host;
+    this.port = config.port;
+ 
+    this.acl = config.acl;
+    this.dc = config.dc || false;
+  }
+ 
+  _send(method, uri, body) {
+    Eif (this.acl) {
+      uri += uri.indexOf('?') > -1 ? '&' : '?';
+      uri += `token=${this.acl}`;
+    }
+    let request = {
+      method,
+      baseURL: `http://${this.host}:${this.port}`,
+      url: `${uri}`,
+      transformResponse: [function transformResponse(data) {
+        return JSON.parse(data);
+      }]
+    };
+ 
+    if (body) {
+      request.data = body;
+    }
+    return axios(request);
+  }
+ 
+  _get(uri) {
+    return this._send('GET', uri);
+  }
+ 
+  /*
+  _post (uri, data) {
+    if (this.dc) {
+      data.Datacenter = this.dc;
+    }
+ 
+    return this._send('POST', uri, data);
+  }
+  */
+ 
+  _put(uri, data) {
+    if (this.dc) {
+      data.Datacenter = this.dc;
+    }
+ 
+    return this._send('PUT', uri, data);
+  }
+ 
+  _delete(uri) {
+    return this._send('DELETE', uri);
+  }
+ 
+  get catalog() {
+    return new Catalog(this);
+  }
+ 
+  get kv() {
+    return new Kv(this);
+  }
+}
+ 
+module.exports = Consul;
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/consul/kv.js.html b/coverage/lcov-report/lib/consul/kv.js.html new file mode 100644 index 0000000..0221f41 --- /dev/null +++ b/coverage/lcov-report/lib/consul/kv.js.html @@ -0,0 +1,155 @@ + + + + Code coverage report for lib/consul/kv.js + + + + + + + +
+
+

+ all files / lib/consul/ kv.js +

+
+
+ 88.89% + Statements + 8/9 +
+
+ 50% + Branches + 1/2 +
+
+ 100% + Functions + 5/5 +
+
+ 88.89% + Lines + 8/9 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31  +  +  +  + +  +  +  + +  +  +  + +  +  +  + +  +  +  + +  + +  +  +  + +  +  +  +
'use strict';
+ 
+class Kv {
+  constructor (consul) {
+    this.consul = consul;
+  }
+ 
+  keys (prefix) {
+    return this.consul._get(`/v1/kv/${prefix}?keys`);
+  }
+ 
+  set (key, value) {
+    return this.consul._put(`/v1/kv/${key}`, value);
+  }
+ 
+  get (key) {
+    return this.consul._get(`/v1/kv/${key}?raw`);
+  }
+ 
+  delete (key, recurse) {
+    let url = `/v1/kv/${key}`;
+ 
+    Iif (recurse === true) {
+      url += '?recurse';
+    }
+ 
+    return this.consul._delete(url);
+  }
+}
+ 
+module.exports = Kv;
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/container-to-consul.js.html b/coverage/lcov-report/lib/container-to-consul.js.html new file mode 100644 index 0000000..786adb0 --- /dev/null +++ b/coverage/lcov-report/lib/container-to-consul.js.html @@ -0,0 +1,893 @@ + + + + Code coverage report for lib/container-to-consul.js + + + + + + + +
+
+

+ all files / lib/ container-to-consul.js +

+
+
+ 93.64% + Statements + 103/110 +
+
+ 86.27% + Branches + 44/51 +
+
+ 100% + Functions + 10/10 +
+
+ 93.58% + Lines + 102/109 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277  +  +22× +22× +22× +22× +22× +  +  +  +21× +  +21× +21× +21× +  +21× +  +  +  +25× + +  + +  + + +  +  +25× + +  + +  + + +  +  +  +  +  + +  + +  + + +  + +  +  + + +  + +  +  + + +  +  +  + + +  + + +  +  +  +  +  + + +  + + +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  +  +  + +  + + +  +  + + + +  +  + +  +  + +  + + + +  + + + +  +  +  +  +  +  +  +  +  +  + +  +  +  +  + + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +  + + + +  + + +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  +  + +  +  +  +  + + +  +  + +  + +  +  + + + +  + + + +  + +  + + + + +  +  +  +  +  +  + +  + + +  + +  + + +  +  +  +  + +  + +  +  +  +  +  +  +  +  +  + +  + + +  +  + + + +  + + +  + +  + +  +  +  +  +  +  +  +  +  + + + +  + +  +  +  +  +22× + 
'use strict';
+ 
+const bunyan = require('bunyan');
+const Consul = require('./consul');
+const Docker = require('./docker');
+const Promise = require('bluebird');
+const SkipError = require('./errors/skipError');
+ 
+class ContainertoConsul {
+  constructor(config) {
+    this.config = config;
+ 
+    this.consul = new Consul(config.consul);
+    this.docker = new Docker(this);
+    this.log = bunyan.createLogger(config.logger);
+ 
+    this._attachEvents();
+  }
+ 
+  _attachEvents() {
+    this.docker.events.on('start', msg => {
+      return this.docker.client.getContainer(msg.id)
+        .inspect()
+        .then(container => this.registerContainer(container))
+        .catch(error => {
+          this.log.error(error);
+          throw error;
+        });
+    });
+    this.docker.events.on('die', msg => {
+      return this.docker.client.getContainer(msg.id)
+        .inspect()
+        .then(container => this.deregisterService(this.containerServiceName(container)))
+        .catch(error => {
+          this.log.error(error);
+          throw error;
+        });
+    });
+  }
+ 
+  start() {
+    return this.docker.start()
+      // deregister containers that do not run
+      .then(() => this.consul.kv.keys('docker/service-ids/')
+        .catch(error => {
+          if (error.statusCode && error.statusCode === 404) {
+            return [];
+          }
+          throw error;
+        }))
+      .then(keys => {
+        return Promise.all(keys.map(key => {
+          return this.consul.kv.get(key)
+            .then(containerId => {
+              return this.docker.client.getContainer(containerId)
+                .inspect()
+                .then(container => {
+                  Eif (container.State.Status !== 'running') {
+                    return this.deregisterService(key);
+                  }
+                })
+                .catch(error => {
+                  if (error.statusCode && error.statusCode === 404) {
+                    return this.deregisterService(key);
+                  }
+                  this.log.error(error);
+                  throw error;
+                });
+            });
+        }));
+      })
+      // register all containers
+      .then(() => this.docker.containers())
+      .then(containers => this.registerContainers(containers))
+      .catch(error => {
+        this.log.error(error);
+        throw error;
+      });
+  }
+ 
+  /**
+   *
+   * @param {Container[]} containers
+   * @returns {Promise.<*>}
+   */
+  registerContainers(containers) {
+    return Promise.all(containers.map(container => this.registerContainer(container)));
+  }
+ 
+  /**
+   *
+   * @param {Container} container
+   * @returns {Promise}
+   */
+  registerContainer(container) {
+    let service;
+ 
+    try {
+      service = this.container2Service(container);
+    }
+    catch (e) {
+      if (e instanceof SkipError) {
+        this.log.info(e.message);
+        return Promise.resolve();
+      }
+ 
+      return Promise.reject(e);
+    }
+ 
+    this.log.info('registering container', service);
+ 
+    return this.registerContainerKv(container)
+      .then(() => this.consul.catalog.register(service))
+      .then(() => this.consul.kv.set(`docker/service-ids/${this.containerServiceName(container)}`, container.Id))
+      .catch(error => {
+        this.consul.kv.delete(`services/${this.containerServiceName(container)}`, true);
+        this.log.error(error);
+        throw error;
+      });
+  }
+ 
+  /**
+   * Registers key/value pairs for the container
+   *
+   * @param {Container} container
+   * @returns {Promise}
+   */
+  registerContainerKv(container) {
+    const
+      lbls = this._containerLabels(container),
+      promises = [],
+      serviceName = this.containerServiceName(container);
+ 
+    Eif (!lbls) {
+      return Promise.resolve();
+    }
+ 
+    Object.keys(lbls).forEach(label => {
+      if (label.startsWith('consul.kv.')) {
+        const
+          key = label.replace(/^consul\.kv\./, ''),
+          val = lbls[label];
+ 
+        promises.push(this.consul.kv.set(`services/${serviceName}/${key}`, val));
+      }
+    });
+ 
+    return Promise.all(promises);
+  }
+ 
+  /**
+   * Un-register a service and related information from Consul
+   *
+   * @param {string} service
+   * @returns {Promise}
+   */
+  deregisterService(service) {
+    this.log.info('deregistering container', service);
+ 
+    return this.consul.catalog.deregister({ Node: service })
+      .then(() => this.consul.kv.delete(`docker/service-ids/${service}`))
+      .then(() => this.consul.kv.delete(`services/${service}`, true))
+      .catch(error => {
+        this.log.error(error);
+        throw error;
+      });
+  }
+ 
+  /**
+   * Given a container, returns a service definition ready to be consumed by Consul catalog/register API endpoint
+   *
+   * @param container
+   * @returns {Object}
+   */
+  container2Service(container) {
+    let service = {
+      Node: this.containerServiceName(container),
+      Address: this.docker.docker0,
+      Service: {
+        Service: this.containerServiceName(container)
+      }
+    };
+    let containerIPAddress = container
+      .NetworkSettings
+      .Networks[Object.keys(container.NetworkSettings.Networks)[0]]
+      .IPAddress;
+ 
+    Eif (containerIPAddress !== '') {
+      service.Address = containerIPAddress;
+    }
+ 
+    const lbls = this._containerLabels(container);
+ 
+    Iif (Object.keys(lbls).length === 0 || lbls['consul.register'] === 'false' || !lbls['consul.register']) {
+      throw new SkipError(`Container ${this.containerServiceName(container)} skipped`);
+    }
+    Eif (lbls) {
+      Object.keys(lbls).forEach(label => {
+        switch (label) {
+          case 'consul.ip':
+            service.Address = lbls[label];
+            if (service.Address === 'host') {
+              service.Address = this.docker.docker0;
+            }
+            break;
+          case 'consul.port':
+            try {
+              service.Service.Port = parseInt(lbls[label]);
+              if (isNaN(service.Service.Port)) {
+                delete service.Service.Port;
+              }
+            }
+            catch (e) {
+              // do nothing
+              this.log.error(e);
+            }
+            break;
+          case 'consul.service':
+            service.Service.Service = lbls[label];
+            break;
+          case 'consul.tags':
+            service.Service.Tags = lbls[label]
+              .split(',')
+              .map(tag => tag.trim());
+            break;
+        }
+      });
+    }
+ 
+    this.log.debug('service', service);
+ 
+    return service;
+  }
+ 
+  /**
+   * Returns the service name for the container
+   *
+   * @param {Container} container
+   * @returns {string}
+   */
+  containerServiceName(container) {
+    let name = container.Name;
+ 
+    if (!name && container.Names) {
+      name = container.Names[0];
+    }
+ 
+    let lbls = container.Labels;
+    if (!lbls && container.Config && container.Config.Labels) {
+      lbls = container.Config.Labels;
+    }
+    if (lbls && lbls['consul.name']) {
+      name = lbls['consul.name'];
+    }
+    name = name.replace(/^\//, '');
+ 
+    return name;
+  }
+ 
+  /**
+   *
+   * @param container
+   * @returns {Object}
+   * @private
+   */
+  _containerLabels(container) {
+    let lbls = container.Labels;
+    if (!lbls && container.Config && container.Config.Labels) {
+      lbls = container.Config.Labels;
+    }
+    return lbls;
+  }
+ 
+}
+ 
+module.exports = ContainertoConsul;
+ 
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/docker.js.html b/coverage/lcov-report/lib/docker.js.html new file mode 100644 index 0000000..d188af2 --- /dev/null +++ b/coverage/lcov-report/lib/docker.js.html @@ -0,0 +1,230 @@ + + + + Code coverage report for lib/docker.js + + + + + + + +
+
+

+ all files / lib/ docker.js +

+
+
+ 100% + Statements + 26/26 +
+
+ 100% + Branches + 2/2 +
+
+ 100% + Functions + 3/3 +
+
+ 100% + Lines + 25/25 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56  +  + + + + +  +  +  + +  + + + + +  +  +  +  +  + + +  + + +  + +  + + +  +  +  + + + +  +  +  +  + + +  +  + + +  +  +  +  + +  +  +  + + 
'use strict';
+ 
+const DockerOde = require('dockerode');
+const DockerOdePromise = require('dockerode-promise');
+const DockerEvents = require('docker-events');
+const Promise = require('bluebird');
+ 
+class Docker {
+  constructor (containertoConsul) {
+    this.containertoConsul = containertoConsul;
+ 
+    this.config = containertoConsul.config.docker;
+    this.client = new DockerOdePromise(this.config);
+    this.docker0 = '172.17.0.1';
+    this.events = new DockerEvents({
+      docker: new DockerOde(this.config)
+    });
+  }
+ 
+  start () {
+    return new Promise((resolve) => {
+      this.events.start();
+ 
+      this.events.on('connect', () => {
+        this.containertoConsul.log.info('Connected to docker');
+ 
+        return this.client.listNetworks()
+          .then(networks => {
+            this.docker0 = networks.filter(net => net.Name === 'bridge')[0].IPAM.Config[0].Gateway;
+            resolve();
+          });
+      });
+ 
+      this.events.on('disconnect', () => {
+        this.containertoConsul.log.warn('Disconnected from Docker. Reconnecting');
+        return this.start();
+      });
+    })
+      .timeout(this.config.connectTimeout)
+      .catch(error => {
+        if (error instanceof Promise.TimeoutError) {
+          return this.start();
+        }
+ 
+        this.containertoConsul.log.error(error);
+        return Promise.reject(error);
+      });
+  }
+ 
+  containers () {
+    return this.client.listContainers();
+  }
+}
+ 
+module.exports = Docker;
+ 
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/errors/index.html b/coverage/lcov-report/lib/errors/index.html new file mode 100644 index 0000000..7872921 --- /dev/null +++ b/coverage/lcov-report/lib/errors/index.html @@ -0,0 +1,93 @@ + + + + Code coverage report for lib/errors/ + + + + + + + +
+
+

+ all files lib/errors/ +

+
+
+ 100% + Statements + 2/2 +
+
+ 100% + Branches + 0/0 +
+
+ 100% + Functions + 1/1 +
+
+ 100% + Lines + 2/2 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
skipError.js
100%2/2100%0/0100%1/1100%2/2
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/errors/skipError.js.html b/coverage/lcov-report/lib/errors/skipError.js.html new file mode 100644 index 0000000..82d89b6 --- /dev/null +++ b/coverage/lcov-report/lib/errors/skipError.js.html @@ -0,0 +1,92 @@ + + + + Code coverage report for lib/errors/skipError.js + + + + + + + +
+
+

+ all files / lib/errors/ skipError.js +

+
+
+ 100% + Statements + 2/2 +
+
+ 100% + Branches + 0/0 +
+
+ 100% + Functions + 1/1 +
+
+ 100% + Lines + 2/2 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10  +  +  +  + +  +  +  + + 
'use strict';
+ 
+class SkipError extends Error {
+  constructor (msg) {
+    super(msg);
+  }
+}
+ 
+module.exports = SkipError;
+ 
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/index.html b/coverage/lcov-report/lib/index.html new file mode 100644 index 0000000..0e6ceff --- /dev/null +++ b/coverage/lcov-report/lib/index.html @@ -0,0 +1,119 @@ + + + + Code coverage report for lib/ + + + + + + + +
+
+

+ all files lib/ +

+
+
+ 94.85% + Statements + 129/136 +
+
+ 86.79% + Branches + 46/53 +
+
+ 100% + Functions + 13/13 +
+
+ 94.78% + Lines + 127/134 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
container-to-consul.js
93.64%103/11086.27%44/51100%10/1093.58%102/109
docker.js
100%26/26100%2/2100%3/3100%25/25
typedefs.js
100%0/0100%0/0100%0/0100%0/0
+
+
+ + + + + + + diff --git a/coverage/lcov-report/lib/typedefs.js.html b/coverage/lcov-report/lib/typedefs.js.html new file mode 100644 index 0000000..c31d36e --- /dev/null +++ b/coverage/lcov-report/lib/typedefs.js.html @@ -0,0 +1,92 @@ + + + + Code coverage report for lib/typedefs.js + + + + + + + +
+
+

+ all files / lib/ typedefs.js +

+
+
+ 100% + Statements + 0/0 +
+
+ 100% + Branches + 0/0 +
+
+ 100% + Functions + 0/0 +
+
+ 100% + Lines + 0/0 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10  +  +  +  +  +  +  +  +  + 
/**
+ @typedef
+   {
+    Id: String,
+    Labels: String[]
+ 
+ 
+   } Container
+ 
+ **/
+
+
+ + + + + + + diff --git a/coverage/lcov-report/prettify.css b/coverage/lcov-report/prettify.css new file mode 100644 index 0000000..b317a7c --- /dev/null +++ b/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/coverage/lcov-report/prettify.js b/coverage/lcov-report/prettify.js new file mode 100644 index 0000000..ef51e03 --- /dev/null +++ b/coverage/lcov-report/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/coverage/lcov-report/sort-arrow-sprite.png b/coverage/lcov-report/sort-arrow-sprite.png new file mode 100644 index 0000000..03f704a Binary files /dev/null and b/coverage/lcov-report/sort-arrow-sprite.png differ diff --git a/coverage/lcov-report/sorter.js b/coverage/lcov-report/sorter.js new file mode 100644 index 0000000..6c5034e --- /dev/null +++ b/coverage/lcov-report/sorter.js @@ -0,0 +1,158 @@ +var addSorting = (function () { + "use strict"; + var cols, + currentSort = { + index: 0, + desc: false + }; + + // returns the summary table element + function getTable() { return document.querySelector('.coverage-summary'); } + // returns the thead element of the summary table + function getTableHeader() { return getTable().querySelector('thead tr'); } + // returns the tbody element of the summary table + function getTableBody() { return getTable().querySelector('tbody'); } + // returns the th element for nth column + function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } + + // loads all columns + function loadColumns() { + var colNodes = getTableHeader().querySelectorAll('th'), + colNode, + cols = [], + col, + i; + + for (i = 0; i < colNodes.length; i += 1) { + colNode = colNodes[i]; + col = { + key: colNode.getAttribute('data-col'), + sortable: !colNode.getAttribute('data-nosort'), + type: colNode.getAttribute('data-type') || 'string' + }; + cols.push(col); + if (col.sortable) { + col.defaultDescSort = col.type === 'number'; + colNode.innerHTML = colNode.innerHTML + ''; + } + } + return cols; + } + // attaches a data attribute to every tr element with an object + // of data values keyed by column name + function loadRowData(tableRow) { + var tableCols = tableRow.querySelectorAll('td'), + colNode, + col, + data = {}, + i, + val; + for (i = 0; i < tableCols.length; i += 1) { + colNode = tableCols[i]; + col = cols[i]; + val = colNode.getAttribute('data-value'); + if (col.type === 'number') { + val = Number(val); + } + data[col.key] = val; + } + return data; + } + // loads all row data + function loadData() { + var rows = getTableBody().querySelectorAll('tr'), + i; + + for (i = 0; i < rows.length; i += 1) { + rows[i].data = loadRowData(rows[i]); + } + } + // sorts the table using the data for the ith column + function sortByIndex(index, desc) { + var key = cols[index].key, + sorter = function (a, b) { + a = a.data[key]; + b = b.data[key]; + return a < b ? -1 : a > b ? 1 : 0; + }, + finalSorter = sorter, + tableBody = document.querySelector('.coverage-summary tbody'), + rowNodes = tableBody.querySelectorAll('tr'), + rows = [], + i; + + if (desc) { + finalSorter = function (a, b) { + return -1 * sorter(a, b); + }; + } + + for (i = 0; i < rowNodes.length; i += 1) { + rows.push(rowNodes[i]); + tableBody.removeChild(rowNodes[i]); + } + + rows.sort(finalSorter); + + for (i = 0; i < rows.length; i += 1) { + tableBody.appendChild(rows[i]); + } + } + // removes sort indicators for current column being sorted + function removeSortIndicators() { + var col = getNthColumn(currentSort.index), + cls = col.className; + + cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); + col.className = cls; + } + // adds sort indicators for current column being sorted + function addSortIndicators() { + getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; + } + // adds event listeners for all sorter widgets + function enableUI() { + var i, + el, + ithSorter = function ithSorter(i) { + var col = cols[i]; + + return function () { + var desc = col.defaultDescSort; + + if (currentSort.index === i) { + desc = !currentSort.desc; + } + sortByIndex(i, desc); + removeSortIndicators(); + currentSort.index = i; + currentSort.desc = desc; + addSortIndicators(); + }; + }; + for (i =0 ; i < cols.length; i += 1) { + if (cols[i].sortable) { + // add the click event handler on the th so users + // dont have to click on those tiny arrows + el = getNthColumn(i).querySelector('.sorter').parentElement; + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } + } + } + } + // adds sorting functionality to the UI + return function () { + if (!getTable()) { + return; + } + cols = loadColumns(); + loadData(cols); + addSortIndicators(); + enableUI(); + }; +})(); + +window.addEventListener('load', addSorting); diff --git a/coverage/lcov.info b/coverage/lcov.info new file mode 100644 index 0000000..6501327 --- /dev/null +++ b/coverage/lcov.info @@ -0,0 +1,360 @@ +TN: +SF:/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/catalog.js +FN:4,(anonymous_1) +FN:8,(anonymous_2) +FN:12,(anonymous_3) +FNF:3 +FNH:3 +FNDA:3,(anonymous_1) +FNDA:1,(anonymous_2) +FNDA:1,(anonymous_3) +DA:5,3 +DA:9,1 +DA:13,1 +DA:17,1 +LF:4 +LH:4 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/kv.js +FN:4,(anonymous_1) +FN:8,(anonymous_2) +FN:12,(anonymous_3) +FN:16,(anonymous_4) +FN:20,(anonymous_5) +FNF:5 +FNH:5 +FNDA:5,(anonymous_1) +FNDA:1,(anonymous_2) +FNDA:1,(anonymous_3) +FNDA:1,(anonymous_4) +FNDA:1,(anonymous_5) +DA:5,5 +DA:9,1 +DA:13,1 +DA:17,1 +DA:21,1 +DA:23,1 +DA:24,0 +DA:27,1 +DA:31,1 +LF:9 +LH:8 +BRDA:23,1,0,0 +BRDA:23,1,1,1 +BRF:2 +BRH:1 +end_of_record +TN: +SF:/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/errors/skipError.js +FN:4,(anonymous_1) +FNF:1 +FNH:1 +FNDA:1,(anonymous_1) +DA:5,1 +DA:9,1 +LF:2 +LH:2 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/consul/index.js +FN:7,(anonymous_1) +FN:15,(anonymous_2) +FN:24,transformResponse +FN:35,(anonymous_4) +FN:49,(anonymous_5) +FN:57,(anonymous_6) +FN:61,(anonymous_7) +FN:65,(anonymous_8) +FNF:8 +FNH:7 +FNDA:6,(anonymous_1) +FNDA:2,(anonymous_2) +FNDA:0,transformResponse +FNDA:1,(anonymous_4) +FNDA:2,(anonymous_5) +FNDA:1,(anonymous_6) +FNDA:1,(anonymous_7) +FNDA:1,(anonymous_8) +DA:2,1 +DA:3,1 +DA:4,1 +DA:8,6 +DA:9,6 +DA:11,6 +DA:12,6 +DA:16,2 +DA:17,2 +DA:18,2 +DA:20,2 +DA:25,0 +DA:29,2 +DA:30,1 +DA:32,2 +DA:36,1 +DA:50,2 +DA:51,1 +DA:54,2 +DA:58,1 +DA:62,1 +DA:66,1 +DA:70,1 +LF:23 +LH:22 +BRDA:12,1,0,6 +BRDA:12,1,1,6 +BRDA:16,2,0,2 +BRDA:16,2,1,0 +BRDA:17,3,0,1 +BRDA:17,3,1,1 +BRDA:29,4,0,1 +BRDA:29,4,1,1 +BRDA:50,5,0,1 +BRDA:50,5,1,1 +BRF:10 +BRH:9 +end_of_record +TN: +SF:/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/container-to-consul.js +FN:10,(anonymous_1) +FN:20,(anonymous_2) +FN:41,(anonymous_3) +FN:86,(anonymous_4) +FN:95,(anonymous_5) +FN:128,(anonymous_6) +FN:157,(anonymous_7) +FN:175,(anonymous_8) +FN:241,(anonymous_9) +FN:266,(anonymous_10) +FNF:10 +FNH:10 +FNDA:21,(anonymous_1) +FNDA:25,(anonymous_2) +FNDA:5,(anonymous_3) +FNDA:1,(anonymous_4) +FNDA:4,(anonymous_5) +FNDA:2,(anonymous_6) +FNDA:2,(anonymous_7) +FNDA:3,(anonymous_8) +FNDA:3,(anonymous_9) +FNDA:5,(anonymous_10) +DA:3,22 +DA:4,22 +DA:5,22 +DA:6,22 +DA:7,22 +DA:11,21 +DA:13,21 +DA:14,21 +DA:15,21 +DA:17,21 +DA:21,25 +DA:22,2 +DA:24,1 +DA:26,1 +DA:27,1 +DA:30,25 +DA:31,2 +DA:33,1 +DA:35,1 +DA:36,1 +DA:42,5 +DA:44,5 +DA:46,2 +DA:47,1 +DA:49,1 +DA:52,4 +DA:53,6 +DA:55,6 +DA:58,1 +DA:59,1 +DA:63,5 +DA:64,4 +DA:66,1 +DA:67,1 +DA:73,3 +DA:74,3 +DA:76,2 +DA:77,2 +DA:87,2 +DA:96,4 +DA:98,4 +DA:99,4 +DA:102,2 +DA:103,1 +DA:104,1 +DA:107,1 +DA:110,2 +DA:112,2 +DA:113,2 +DA:114,1 +DA:116,1 +DA:117,1 +DA:118,1 +DA:129,2 +DA:134,2 +DA:135,2 +DA:138,0 +DA:139,0 +DA:140,0 +DA:144,0 +DA:148,0 +DA:158,2 +DA:160,2 +DA:161,1 +DA:162,1 +DA:164,1 +DA:165,1 +DA:176,3 +DA:183,3 +DA:188,3 +DA:189,3 +DA:192,3 +DA:194,3 +DA:195,0 +DA:197,3 +DA:198,3 +DA:199,9 +DA:201,2 +DA:202,2 +DA:203,1 +DA:205,2 +DA:207,2 +DA:208,2 +DA:209,2 +DA:210,1 +DA:215,0 +DA:217,2 +DA:219,1 +DA:220,1 +DA:222,1 +DA:224,2 +DA:225,1 +DA:230,3 +DA:232,3 +DA:242,3 +DA:244,3 +DA:245,1 +DA:248,3 +DA:249,3 +DA:250,1 +DA:252,3 +DA:253,2 +DA:255,3 +DA:257,3 +DA:267,5 +DA:268,5 +DA:269,1 +DA:271,5 +DA:276,22 +LF:109 +LH:102 +BRDA:46,1,0,1 +BRDA:46,1,1,1 +BRDA:46,2,0,2 +BRDA:46,2,1,1 +BRDA:58,3,0,1 +BRDA:58,3,1,0 +BRDA:63,4,0,4 +BRDA:63,4,1,1 +BRDA:63,5,0,5 +BRDA:63,5,1,4 +BRDA:102,6,0,1 +BRDA:102,6,1,1 +BRDA:134,7,0,2 +BRDA:134,7,1,0 +BRDA:139,8,0,0 +BRDA:139,8,1,0 +BRDA:188,9,0,3 +BRDA:188,9,1,0 +BRDA:194,10,0,0 +BRDA:194,10,1,3 +BRDA:194,11,0,3 +BRDA:194,11,1,3 +BRDA:194,11,2,3 +BRDA:197,12,0,3 +BRDA:197,12,1,0 +BRDA:199,13,0,2 +BRDA:199,13,1,2 +BRDA:199,13,2,1 +BRDA:199,13,3,1 +BRDA:202,14,0,1 +BRDA:202,14,1,1 +BRDA:209,15,0,1 +BRDA:209,15,1,1 +BRDA:244,16,0,1 +BRDA:244,16,1,2 +BRDA:244,17,0,3 +BRDA:244,17,1,1 +BRDA:249,18,0,1 +BRDA:249,18,1,2 +BRDA:249,19,0,3 +BRDA:249,19,1,2 +BRDA:249,19,2,1 +BRDA:252,20,0,2 +BRDA:252,20,1,1 +BRDA:252,21,0,3 +BRDA:252,21,1,2 +BRDA:268,22,0,1 +BRDA:268,22,1,4 +BRDA:268,23,0,5 +BRDA:268,23,1,3 +BRDA:268,23,2,1 +BRF:51 +BRH:44 +end_of_record +TN: +SF:/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/docker.js +FN:9,(anonymous_1) +FN:20,(anonymous_2) +FN:50,(anonymous_3) +FNF:3 +FNH:3 +FNDA:6,(anonymous_1) +FNDA:6,(anonymous_2) +FNDA:1,(anonymous_3) +DA:3,7 +DA:4,7 +DA:5,7 +DA:6,7 +DA:10,6 +DA:12,6 +DA:13,6 +DA:14,6 +DA:15,6 +DA:21,6 +DA:22,6 +DA:24,5 +DA:25,4 +DA:27,4 +DA:29,4 +DA:30,4 +DA:34,5 +DA:35,1 +DA:36,1 +DA:41,2 +DA:42,1 +DA:45,1 +DA:46,1 +DA:51,1 +DA:55,7 +LF:25 +LH:25 +BRDA:41,1,0,1 +BRDA:41,1,1,1 +BRF:2 +BRH:2 +end_of_record +TN: +SF:/Users/emmanuelnyachoke/Code/Mekom/con-tainer2sul/lib/typedefs.js +FNF:0 +FNH:0 +LF:0 +LH:0 +BRF:0 +BRH:0 +end_of_record diff --git a/docker-compose-e2e.yaml b/docker-compose-e2e.yaml new file mode 100644 index 0000000..8ad9e6d --- /dev/null +++ b/docker-compose-e2e.yaml @@ -0,0 +1,27 @@ +services: + consul: + image: hashicorp/consul:1.19 + ports: + - "8500:8500" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8500"] + container-to-consul: + build: ./ + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + depends_on: + - consul + environment: + c2c_consul__host: consul + playwright: + build: + dockerfile: ./playwright.Dockerfile + volumes: + - ./playwright.config.ts:/app/playwright.config.ts + - ./e2e:/app/tests + - /var/run/docker.sock:/var/run/docker.sock:ro + depends_on: + - container-to-consul + - consul + command: yarn run playwright test + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..4917b50 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,17 @@ +services: + consul: + image: hashicorp/consul:1.19 + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8500"] + ports: + - "8500:8500" + container-to-consul: + build: ./ + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + depends_on: + consul: + condition: service_healthy + environment: + c2c_consul__host: consul + diff --git a/e2e/container2consul.spec.ts b/e2e/container2consul.spec.ts new file mode 100644 index 0000000..1046091 --- /dev/null +++ b/e2e/container2consul.spec.ts @@ -0,0 +1,55 @@ +import { test, expect } from '@playwright/test'; +import { startDockerCompose, stopDockerCompose } from './util'; + +test.beforeAll(async () => { + await stopDockerCompose(); + await startDockerCompose(); + // Pause for 5 seconds to allow nginx test containers to start + await new Promise(r => setTimeout(r, 5000)); +}); + +test('Should register only services labelled with consul.register=true', async ({request}) => { + const response = await request.get('http://consul:8500/v1/catalog/services', {}); + const json = await response.json() + console.log(JSON.stringify(json, null, 2)); + expect(json).not.toHaveProperty('container2consul_nginx-ignore_1'); + expect(response.ok()).toBeTruthy(); + expect(json).not.toBeNull(); +}) + +test('Should register the service with the name provided by consul.service', async ({request}) => { + const response = await request.get('http://consul:8500/v1/catalog/services', {}); + const json = await response.json() + expect(json).toHaveProperty('nginx-register'); +}) + +test('Should register the service with the container name when consul.service is not provided', async ({request}) => { + const response = await request.get('http://consul:8500/v1/catalog/services', {}); + const json = await response.json() + expect(json).toHaveProperty('container2consul_nginx2_1'); +}) + +test('Should deregister the services when containers are deleted', async ({request}) => { + await stopDockerCompose(); + await new Promise(r => setTimeout(r, 3000)); + const response = await request.get('http://consul:8500/v1/catalog/services', {}); + const json = await response.json() + console.log(JSON.stringify(json, null, 2)); + expect(json).not.toHaveProperty('nginx-register'); + expect(json).not.toHaveProperty('container2consul_nginx2_1'); +}) + +test('Should reregister the services when containers are recreated', async ({request}) => { + await startDockerCompose(); + await new Promise(r => setTimeout(r, 3000)); + const response = await request.get('http://consul:8500/v1/catalog/services', {}); + const json = await response.json() + console.log(JSON.stringify(json, null, 2)); + expect(json).toHaveProperty('nginx-register'); + expect(json).toHaveProperty('container2consul_nginx2_1'); +}) + + +test.afterAll(async () => { + await stopDockerCompose(); +}); \ No newline at end of file diff --git a/e2e/docker/test-compose.yaml b/e2e/docker/test-compose.yaml new file mode 100644 index 0000000..8a47eac --- /dev/null +++ b/e2e/docker/test-compose.yaml @@ -0,0 +1,19 @@ +version: '3.8' +services: + nginx: + image: nginx:1-alpine + labels: + - "consul.port=80" + - "consul.tags=nginx" + - "consul.service=nginx-register" + - "consul.ip=10.0.0.1" + - "consul.register=true" + nginx2: + image: nginx:1-alpine + labels: + - "consul.port=80" + - "consul.tags=nginx" + - "consul.ip=10.0.0.1" + - "consul.register=true" + nginx-ignore: + image: nginx:1-alpine \ No newline at end of file diff --git a/e2e/util.ts b/e2e/util.ts new file mode 100644 index 0000000..ef56020 --- /dev/null +++ b/e2e/util.ts @@ -0,0 +1,15 @@ +const Dockerode = require('dockerode'); +const DockerodeCompose = require('dockerode-compose'); +const fs = require('fs'); +const path = require('path') + +const docker = new Dockerode(); +const compose = new DockerodeCompose(docker, path.resolve(__dirname, './docker/test-compose.yaml'), 'container2consul'); +export async function startDockerCompose() { + await compose.pull(); + await compose.up(); +} + +export async function stopDockerCompose() { + await compose.down(); +} \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..f0fc485 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,32 @@ +import globals from "globals"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [...compat.extends("eslint:recommended"), { + languageOptions: { + globals: { + ...globals.mocha, + ...globals.node, + }, + }, + + rules: { + indent: ["error", 2, { + SwitchCase: 1, + }], + + "linebreak-style": ["error", "unix"], + quotes: ["error", "single"], + semi: ["error", "always"], + }, +}]; \ No newline at end of file diff --git a/lib/config.js b/lib/config.js new file mode 100644 index 0000000..51f6d7f --- /dev/null +++ b/lib/config.js @@ -0,0 +1,17 @@ +'use strict'; + +const rc = require('rc'); + +module.exports = rc('c2c', { + consul: { + host: 'localhost', + port: 8500 + }, + docker: { + connectTimeout: 5000, + socketPath: '/var/run/docker.sock' + }, + logger: { + name: 'container-to-consul' + } +}); \ No newline at end of file diff --git a/lib/consul/catalog.js b/lib/consul/catalog.js new file mode 100644 index 0000000..509fe26 --- /dev/null +++ b/lib/consul/catalog.js @@ -0,0 +1,17 @@ +'use strict'; + +class Catalog { + constructor (consul) { + this.consul = consul; + } + + register (data) { + return this.consul._put('/v1/catalog/register', data); + } + + deregister (data) { + return this.consul._put('/v1/catalog/deregister', data); + } +} + +module.exports = Catalog; \ No newline at end of file diff --git a/lib/consul/index.js b/lib/consul/index.js new file mode 100644 index 0000000..c204cd5 --- /dev/null +++ b/lib/consul/index.js @@ -0,0 +1,80 @@ +'use strict'; +const axios = require('axios'); +const Catalog = require('./catalog'); +const Kv = require('./kv'); + +class Consul { + constructor(config) { + this.host = config.host; + this.port = config.port; + + this.acl = config.acl; + this.dc = config.dc || false; + } + + _send(method, uri, body) { + if (this.acl) { + uri += uri.indexOf('?') > -1 ? '&' : '?'; + uri += `token=${this.acl}`; + } + let request = { + method, + baseURL: `http://${this.host}:${this.port}`, + url: `${uri}`, + transformResponse: [ + (data) => { + let resp; + try { + resp = JSON.parse(data); + } catch (error) { + throw Error( + `[requestClient] Error parsingJSON data $` + ); + } + return resp; + }, + ], + }; + + if (body) { + request.data = body; + } + return axios(request); + } + + _get(uri) { + return this._send('GET', uri); + } + + /* + _post (uri, data) { + if (this.dc) { + data.Datacenter = this.dc; + } + + return this._send('POST', uri, data); + } + */ + + _put(uri, data) { + if (this.dc) { + data.Datacenter = this.dc; + } + + return this._send('PUT', uri, data); + } + + _delete(uri) { + return this._send('DELETE', uri); + } + + get catalog() { + return new Catalog(this); + } + + get kv() { + return new Kv(this); + } +} + +module.exports = Consul; \ No newline at end of file diff --git a/lib/consul/kv.js b/lib/consul/kv.js new file mode 100644 index 0000000..59b3a43 --- /dev/null +++ b/lib/consul/kv.js @@ -0,0 +1,31 @@ +'use strict'; + +class Kv { + constructor (consul) { + this.consul = consul; + } + + keys (prefix) { + return this.consul._get(`/v1/kv/${prefix}?keys`); + } + + set (key, value) { + return this.consul._put(`/v1/kv/${key}`, value); + } + + get (key) { + return this.consul._get(`/v1/kv/${key}?raw`); + } + + delete (key, recurse) { + let url = `/v1/kv/${key}`; + + if (recurse === true) { + url += '?recurse'; + } + + return this.consul._delete(url); + } +} + +module.exports = Kv; \ No newline at end of file diff --git a/lib/container-to-consul.js b/lib/container-to-consul.js new file mode 100644 index 0000000..8a6c8f7 --- /dev/null +++ b/lib/container-to-consul.js @@ -0,0 +1,275 @@ +'use strict'; + +const bunyan = require('bunyan'); +const Consul = require('./consul'); +const Docker = require('./docker'); +const Promise = require('bluebird'); +const SkipError = require('./errors/skipError'); + +class ContainertoConsul { + constructor(config) { + this.config = config; + + this.consul = new Consul(config.consul); + this.docker = new Docker(this); + this.log = bunyan.createLogger(config.logger); + + this._attachEvents(); + } + + _attachEvents() { + this.docker.events.on('start', msg => { + return this.docker.client.getContainer(msg.id) + .inspect() + .then(container => this.registerContainer(container)) + .catch(error => { + this.log.error(error); + throw error; + }); + }); + this.docker.events.on('die', msg => { + return this.docker.client.getContainer(msg.id) + .inspect() + .then(container => this.deregisterService(this.containerServiceName(container))) + .catch(error => { + this.log.error(error); + throw error; + }); + }); + } + + start() { + return this.docker.start() + // deregister containers that do not run + .then(() => this.consul.kv.keys('docker/service-ids/') + .catch(error => { + if (error.statusCode && error.statusCode === 404) { + return []; + } + throw error; + })) + .then(keys => { + return Promise.all(keys.map(key => { + return this.consul.kv.get(key) + .then(containerId => { + return this.docker.client.getContainer(containerId) + .inspect() + .then(container => { + if (container.State.Status !== 'running') { + return this.deregisterService(key); + } + }) + .catch(error => { + if (error.statusCode && error.statusCode === 404) { + return this.deregisterService(key); + } + this.log.error(error); + throw error; + }); + }); + })); + }) + .then(() => this.docker.containers()) + .then(containers => this.registerContainers(containers)) + .catch(error => { + this.log.error(error); + throw error; + }); + } + + /** + * + * @param {Container[]} containers + * @returns {Promise.<*>} + */ + registerContainers(containers) { + return Promise.all(containers.map(container => this.registerContainer(container))); + } + + /** + * + * @param {Container} container + * @returns {Promise} + */ + registerContainer(container) { + let service; + + try { + service = this.container2Service(container); + } + catch (e) { + if (e instanceof SkipError) { + this.log.info(e.message); + return Promise.resolve(); + } + + return Promise.reject(e); + } + + this.log.info('registering container', service); + + return this.registerContainerKv(container) + .then(() => this.consul.catalog.register(service)) + .then(() => this.consul.kv.set(`docker/service-ids/${this.containerServiceName(container)}`, container.Id)) + .catch(error => { + this.consul.kv.delete(`services/${this.containerServiceName(container)}`, true); + this.log.error(error); + throw error; + }); + } + + /** + * Registers key/value pairs for the container + * + * @param {Container} container + * @returns {Promise} + */ + registerContainerKv(container) { + const + lbls = this._containerLabels(container), + promises = [], + serviceName = this.containerServiceName(container); + + if (!lbls) { + return Promise.resolve(); + } + + Object.keys(lbls).forEach(label => { + if (label.startsWith('consul.kv.')) { + const + key = label.replace(/^consul\.kv\./, ''), + val = lbls[label]; + + promises.push(this.consul.kv.set(`services/${serviceName}/${key}`, val)); + } + }); + + return Promise.all(promises); + } + + /** + * Un-register a service and related information from Consul + * + * @param {string} service + * @returns {Promise} + */ + deregisterService(service) { + this.log.info('deregistering container', service); + + return this.consul.catalog.deregister({ Node: service }) + .then(() => this.consul.kv.delete(`docker/service-ids/${service}`)) + .then(() => this.consul.kv.delete(`services/${service}`, true)) + .catch(error => { + this.log.error(error); + throw error; + }); + } + + /** + * Given a container, returns a service definition ready to be consumed by Consul catalog/register API endpoint + * + * @param container + * @returns {Object} + */ + container2Service(container) { + let service = { + Node: this.containerServiceName(container), + Address: this.docker.docker0, + Service: { + Service: this.containerServiceName(container) + } + }; + let containerIPAddress = container + .NetworkSettings + .Networks[Object.keys(container.NetworkSettings.Networks)[0]] + .IPAddress; + + if (containerIPAddress !== '') { + service.Address = containerIPAddress; + } + + const lbls = this._containerLabels(container); + + if (Object.keys(lbls).length === 0 || lbls['consul.register'] === 'false' || !lbls['consul.register']) { + throw new SkipError(`Container ${this.containerServiceName(container)} skipped`); + } + if (lbls) { + Object.keys(lbls).forEach(label => { + switch (label) { + case 'consul.ip': + service.Address = lbls[label]; + if (service.Address === 'host') { + service.Address = this.docker.docker0; + } + break; + case 'consul.port': + try { + service.Service.Port = parseInt(lbls[label]); + if (isNaN(service.Service.Port)) { + delete service.Service.Port; + } + } + catch (e) { + // do nothing + this.log.error(e); + } + break; + case 'consul.service': + service.Service.Service = lbls[label]; + break; + case 'consul.tags': + service.Service.Tags = lbls[label] + .split(',') + .map(tag => tag.trim()); + break; + } + }); + } + + this.log.debug('service', service); + + return service; + } + + /** + * Returns the service name for the container + * + * @param {Container} container + * @returns {string} + */ + containerServiceName(container) { + let name = container.Name; + + if (!name && container.Names) { + name = container.Names[0]; + } + + let lbls = container.Labels; + if (!lbls && container.Config && container.Config.Labels) { + lbls = container.Config.Labels; + } + if (lbls && lbls['consul.name']) { + name = lbls['consul.name']; + } + name = name.replace(/^\//, ''); + + return name; + } + + /** + * + * @param container + * @returns {Object} + * @private + */ + _containerLabels(container) { + let lbls = container.Labels; + if (!lbls && container.Config && container.Config.Labels) { + lbls = container.Config.Labels; + } + return lbls; + } + +} + +module.exports = ContainertoConsul; diff --git a/lib/docker.js b/lib/docker.js new file mode 100644 index 0000000..425cd82 --- /dev/null +++ b/lib/docker.js @@ -0,0 +1,55 @@ +'use strict'; + +const DockerOde = require('dockerode'); +const DockerOdePromise = require('dockerode-promise'); +const DockerEvents = require('docker-events'); +const Promise = require('bluebird'); + +class Docker { + constructor (containertoConsul) { + this.containertoConsul = containertoConsul; + + this.config = containertoConsul.config.docker; + this.client = new DockerOdePromise(this.config); + this.docker0 = '172.17.0.1'; + this.events = new DockerEvents({ + docker: new DockerOde(this.config) + }); + } + + start () { + return new Promise((resolve) => { + this.events.start(); + + this.events.on('connect', () => { + this.containertoConsul.log.info('Connected to docker'); + + return this.client.listNetworks() + .then(networks => { + this.docker0 = networks.filter(net => net.Name === 'bridge')[0].IPAM.Config[0].Gateway; + resolve(); + }); + }); + + this.events.on('disconnect', () => { + this.containertoConsul.log.warn('Disconnected from Docker. Reconnecting'); + return this.start(); + }); + }) + .timeout(this.config.connectTimeout) + .catch(error => { + if (error instanceof Promise.TimeoutError) { + return this.start(); + } + + this.containertoConsul.log.error(error); + return Promise.reject(error); + }); + } + + containers () { + return this.client.listContainers(); + } +} + +module.exports = Docker; diff --git a/lib/errors/skipError.js b/lib/errors/skipError.js new file mode 100644 index 0000000..bb290b8 --- /dev/null +++ b/lib/errors/skipError.js @@ -0,0 +1,9 @@ +'use strict'; + +class SkipError extends Error { + constructor (msg) { + super(msg); + } +} + +module.exports = SkipError; diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 0000000..61a7e2a --- /dev/null +++ b/lib/index.js @@ -0,0 +1,8 @@ +'use strict'; + +const ContainertoConsul = require('./container-to-consul'); +const config = require('./config'); +const conTainer2Sul = new ContainertoConsul(config); + +conTainer2Sul.start(); + diff --git a/lib/typedefs.js b/lib/typedefs.js new file mode 100644 index 0000000..2941f4a --- /dev/null +++ b/lib/typedefs.js @@ -0,0 +1,10 @@ +/** + @typedef + { + Id: String, + Labels: String[] + + + } Container + + **/ \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..929277b --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3335 @@ +{ + "name": "container-to-consul", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "container-to-consul", + "version": "0.1.0", + "license": "Apache-2.0", + "dependencies": { + "axios": "^1.7.2", + "bluebird": "^3.4.6", + "bunyan": "^1.8.1", + "docker-events": "0.0.2", + "dockerode": "^2.3.1", + "dockerode-promise": "^0.1.0", + "rc": "^1.1.6", + "rewire": "^2.5.2" + }, + "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.10.0", + "codecov": "^3.8.3", + "eslint": "^9.10.0", + "globals": "^15.9.0", + "istanbul": "^0.4.5", + "mocha": "^8.0.0", + "mock-require": "^1.3.0", + "should": "^11.1.1", + "should-sinon": "0.0.5", + "sinon": "^1.17.6", + "sinon-as-promised": "^4.0.2" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.11.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.1.tgz", + "integrity": "sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.18.0.tgz", + "integrity": "sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==", + "dev": true, + "dependencies": { + "@eslint/object-schema": "^2.1.4", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-array/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", + "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/@eslint/eslintrc/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.10.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.10.0.tgz", + "integrity": "sha512-fuXtbiP5GWIn8Fz+LWoOMVf/Jxm+aajZYkhi6CuEm4SxymFM+eUWzbO9qXT+L0iCkL5+KGYMCSGxo686H19S1g==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", + "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.1.0.tgz", + "integrity": "sha512-autAXT203ixhqei9xt+qkYOvY8l6LAFIdT2UXc/RPNeUVfqRF1BV94GTJyVPFKT8nFM6MyVJhjLj9E8JWvf5zQ==", + "dev": true, + "dependencies": { + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit/node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/@eslint/plugin-kit/node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/@eslint/plugin-kit/node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.0.tgz", + "integrity": "sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==", + "dev": true, + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@tootallnate/once": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "node_modules/abbrev": { + "version": "1.0.9", + "dev": true, + "license": "ISC" + }, + "node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/agent-base/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/amdefine": { + "version": "1.0.1", + "dev": true, + "license": "BSD-3-Clause OR MIT", + "optional": true, + "engines": { + "node": ">=0.4.2" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/argv": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/argv/-/argv-0.0.2.tgz", + "integrity": "sha512-dEamhpPEwRUBpLNHeuCm/v+g0anFByHahxodVO/BbAarHVBBg2MccCwf9K+o1Pof+2btdnkJelYVUWjW/VrATw==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "dev": true, + "engines": { + "node": ">=0.6.10" + } + }, + "node_modules/asap": { + "version": "2.0.6", + "license": "MIT" + }, + "node_modules/async": { + "version": "1.5.2", + "dev": true, + "license": "MIT" + }, + "node_modules/asynckit": { + "version": "0.4.0", + "license": "MIT" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "dev": true, + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axios": { + "version": "1.7.7", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", + "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/axios/node_modules/form-data": { + "version": "4.0.0", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "devOptional": true, + "license": "MIT" + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bl": { + "version": "1.2.3", + "license": "MIT", + "dependencies": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/bluebird": { + "version": "3.7.2", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "devOptional": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "node_modules/buffer-alloc": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "node_modules/buffer-alloc-unsafe": { + "version": "1.1.0", + "license": "MIT" + }, + "node_modules/buffer-fill": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "license": "MIT" + }, + "node_modules/bunyan": { + "version": "1.8.15", + "engines": [ + "node >=0.10.0" + ], + "license": "MIT", + "bin": { + "bunyan": "bin/bunyan" + }, + "optionalDependencies": { + "dtrace-provider": "~0.8", + "moment": "^2.19.3", + "mv": "~2", + "safe-json-stringify": "~1" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/caller-id": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "stack-trace": "~0.0.7" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chokidar": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.1" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "license": "ISC" + }, + "node_modules/clarinet": { + "version": "0.7.3", + "engines": { + "chrome": ">=16.0.912", + "firefox": ">=0.8.0", + "node": ">=0.3.6" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/codecov": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/codecov/-/codecov-3.8.3.tgz", + "integrity": "sha512-Y8Hw+V3HgR7V71xWH2vQ9lyS358CbGCldWlJFR0JirqoGtOoas3R3/OclRTvgUYFK29mmJICDPauVKmpqbwhOA==", + "deprecated": "https://about.codecov.io/blog/codecov-uploader-deprecation-plan/", + "dev": true, + "dependencies": { + "argv": "0.0.2", + "ignore-walk": "3.0.4", + "js-yaml": "3.14.1", + "teeny-request": "7.1.1", + "urlgrey": "1.0.0" + }, + "bin": { + "codecov": "bin/codecov" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "devOptional": true, + "license": "MIT" + }, + "node_modules/concat-stream": { + "version": "1.6.2", + "engines": [ + "node >= 0.8" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "license": "MIT" + }, + "node_modules/create-thenable": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "object.omit": "~2.0.0", + "unique-concat": "~0.2.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/docker-events": { + "version": "0.0.2", + "license": "BSD", + "dependencies": { + "jsuck": "0.0.4" + }, + "peerDependencies": { + "dockerode": "^2.0.3" + } + }, + "node_modules/docker-modem": { + "version": "1.0.9", + "license": "Apache-2.0", + "dependencies": { + "debug": "^3.2.6", + "JSONStream": "1.3.2", + "readable-stream": "~1.0.26-4", + "split-ca": "^1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/docker-modem/node_modules/isarray": { + "version": "0.0.1", + "license": "MIT" + }, + "node_modules/docker-modem/node_modules/readable-stream": { + "version": "1.0.34", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/docker-modem/node_modules/string_decoder": { + "version": "0.10.31", + "license": "MIT" + }, + "node_modules/dockerode": { + "version": "2.5.8", + "license": "Apache-2.0", + "dependencies": { + "concat-stream": "~1.6.2", + "docker-modem": "^1.0.8", + "tar-fs": "~1.16.3" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dockerode-promise": { + "version": "0.1.0", + "license": "Apache2", + "dependencies": { + "promise": "^7.0.1" + }, + "peerDependencies": { + "dockerode": ">= 2.1.4" + } + }, + "node_modules/dtrace-provider": { + "version": "0.8.8", + "hasInstallScript": true, + "license": "BSD-2-Clause", + "optional": true, + "dependencies": { + "nan": "^2.14.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/escodegen": { + "version": "1.8.1", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^2.7.1", + "estraverse": "^1.9.1", + "esutils": "^2.0.2", + "optionator": "^0.8.1" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=0.12.0" + }, + "optionalDependencies": { + "source-map": "~0.2.0" + } + }, + "node_modules/escodegen/node_modules/estraverse": { + "version": "1.9.3", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint": { + "version": "9.10.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.10.0.tgz", + "integrity": "sha512-Y4D0IgtBZfOcOUAIQTSXBKoNGfY0REGqHJG6+Q81vNippW5YlKjHFj4soMxamKK1NXHUWuBZTLdU3Km+L/pcHw==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.11.0", + "@eslint/config-array": "^0.18.0", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "9.10.0", + "@eslint/plugin-kit": "^0.1.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.3.0", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.0.2", + "eslint-visitor-keys": "^4.0.0", + "espree": "^10.1.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.2.tgz", + "integrity": "sha512-6E4xmrTw5wtxnLA5wYL3WDfhZ/1bUBGOXV0zQvVRDOtrR8D0p6W7fs3JweNYhwRYeGvd/1CKX2se0/2s7Q/nJA==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eslint/node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/eslint/node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/eslint/node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/eslint/node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/espree": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.1.0.tgz", + "integrity": "sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==", + "dev": true, + "dependencies": { + "acorn": "^8.12.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esprima": { + "version": "2.7.3", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-url-parser": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/fast-url-parser/-/fast-url-parser-1.1.3.tgz", + "integrity": "sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==", + "dev": true, + "dependencies": { + "punycode": "^1.3.2" + } + }, + "node_modules/fast-url-parser/node_modules/punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "dev": true + }, + "node_modules/follow-redirects": { + "version": "1.15.6", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/for-in": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/for-own": { + "version": "0.1.5", + "dev": true, + "license": "MIT", + "dependencies": { + "for-in": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/formatio": { + "version": "1.1.1", + "dev": true, + "dependencies": { + "samsam": "~1.1" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "15.9.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.9.0.tgz", + "integrity": "sha512-SmSKyLLKFbSr6rptvP8izbyxJL4ILwqO9Jg23UA0sDlGlu58V59D1//I3vlc0KJphVdUR7vMjHIplYnzBxorQA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true, + "engines": { + "node": ">=4.x" + } + }, + "node_modules/handlebars": { + "version": "4.7.8", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/handlebars/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-flag": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "dev": true, + "dependencies": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-proxy-agent/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/ignore-walk": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.4.tgz", + "integrity": "sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==", + "dev": true, + "dependencies": { + "minimatch": "^3.0.4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "devOptional": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "license": "ISC" + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extendable": { + "version": "0.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "dev": true, + "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.13", + "dev": true, + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/istanbul": { + "version": "0.4.5", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "abbrev": "1.0.x", + "async": "1.x", + "escodegen": "1.8.x", + "esprima": "2.7.x", + "glob": "^5.0.15", + "handlebars": "^4.0.1", + "js-yaml": "3.x", + "mkdirp": "0.5.x", + "nopt": "3.x", + "once": "1.x", + "resolve": "1.1.x", + "supports-color": "^3.1.0", + "which": "^1.1.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "istanbul": "lib/cli.js" + } + }, + "node_modules/istanbul/node_modules/glob": { + "version": "5.0.15", + "dev": true, + "license": "ISC", + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/istanbul/node_modules/supports-color": { + "version": "3.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^1.0.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/js-yaml/node_modules/esprima": { + "version": "4.0.1", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "engines": [ + "node >= 0.2.0" + ], + "license": "MIT" + }, + "node_modules/JSONStream": { + "version": "1.3.2", + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/jsuck": { + "version": "0.0.4", + "license": "BSD", + "dependencies": { + "clarinet": "~0.7.0" + }, + "engines": { + "node": "~0.9.12 || ~0.10.0" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/log-symbols": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/lolex": { + "version": "1.3.2", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/mime-db": { + "version": "1.52.0", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "devOptional": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mocha": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.4.0.tgz", + "integrity": "sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ==", + "dev": true, + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.1", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.6", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.0.0", + "log-symbols": "4.0.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.20", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 10.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "node_modules/mocha/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/mocha/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mocha/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/mocha/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/js-yaml": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/mocha/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/mock-require": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "caller-id": "^0.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/moment": { + "version": "2.30.1", + "license": "MIT", + "optional": true, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "node_modules/mv": { + "version": "2.1.1", + "license": "MIT", + "optional": true, + "dependencies": { + "mkdirp": "~0.5.1", + "ncp": "~2.0.0", + "rimraf": "~2.4.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/mv/node_modules/glob": { + "version": "6.0.4", + "license": "ISC", + "optional": true, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mv/node_modules/rimraf": { + "version": "2.4.5", + "license": "ISC", + "optional": true, + "dependencies": { + "glob": "^6.0.1" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/nan": { + "version": "2.20.0", + "license": "MIT", + "optional": true + }, + "node_modules/nanoid": { + "version": "3.1.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", + "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/native-promise-only": { + "version": "0.8.1", + "dev": true, + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/ncp": { + "version": "2.0.0", + "license": "MIT", + "optional": true, + "bin": { + "ncp": "bin/ncp" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "dev": true, + "license": "MIT" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/nopt": { + "version": "3.0.6", + "dev": true, + "license": "ISC", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object.omit": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/prelude-ls": { + "version": "1.1.2", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "license": "MIT" + }, + "node_modules/promise": { + "version": "7.3.1", + "license": "MIT", + "dependencies": { + "asap": "~2.0.3" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "license": "MIT" + }, + "node_modules/pump": { + "version": "1.0.3", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/isarray": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.1.7", + "dev": true, + "license": "MIT" + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rewire": { + "version": "2.5.2", + "license": "MIT" + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "license": "MIT" + }, + "node_modules/safe-json-stringify": { + "version": "1.2.0", + "license": "MIT", + "optional": true + }, + "node_modules/samsam": { + "version": "1.1.2", + "dev": true + }, + "node_modules/serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/should": { + "version": "11.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "should-equal": "^1.0.0", + "should-format": "^3.0.2", + "should-type": "^1.4.0", + "should-type-adaptors": "^1.0.1", + "should-util": "^1.0.0" + } + }, + "node_modules/should-equal": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "should-type": "^1.0.0" + } + }, + "node_modules/should-format": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "should-type": "^1.3.0", + "should-type-adaptors": "^1.0.1" + } + }, + "node_modules/should-sinon": { + "version": "0.0.5", + "dev": true, + "license": "MIT", + "peerDependencies": { + "should": ">= 8.x" + } + }, + "node_modules/should-type": { + "version": "1.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/should-type-adaptors": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "should-type": "^1.3.0", + "should-util": "^1.0.0" + } + }, + "node_modules/should-util": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/sinon": { + "version": "1.17.7", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "formatio": "1.1.1", + "lolex": "1.3.2", + "samsam": "1.1.2", + "util": ">=0.10.3 <1" + }, + "engines": { + "node": ">=0.1.103" + } + }, + "node_modules/sinon-as-promised": { + "version": "4.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "create-thenable": "~1.0.0", + "native-promise-only": "~0.8.1" + }, + "peerDependencies": { + "sinon": "1" + } + }, + "node_modules/source-map": { + "version": "0.2.0", + "dev": true, + "optional": true, + "dependencies": { + "amdefine": ">=0.0.4" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/split-ca": { + "version": "1.0.1", + "license": "ISC" + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/stack-trace": { + "version": "0.0.10", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/stream-events": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz", + "integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==", + "dev": true, + "dependencies": { + "stubs": "^3.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stubs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", + "integrity": "sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw==", + "dev": true + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/tar-fs": { + "version": "1.16.3", + "license": "MIT", + "dependencies": { + "chownr": "^1.0.1", + "mkdirp": "^0.5.1", + "pump": "^1.0.0", + "tar-stream": "^1.1.2" + } + }, + "node_modules/tar-stream": { + "version": "1.6.2", + "license": "MIT", + "dependencies": { + "bl": "^1.0.0", + "buffer-alloc": "^1.2.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.1", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/teeny-request": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-7.1.1.tgz", + "integrity": "sha512-iwY6rkW5DDGq8hE2YgNQlKbptYpY5Nn2xecjQiNjOXWbKzPGUfmeUBCSQbbr306d7Z7U2N0TPl+/SwYRfua1Dg==", + "dev": true, + "dependencies": { + "http-proxy-agent": "^4.0.0", + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.1", + "stream-events": "^1.0.5", + "uuid": "^8.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/teeny-request/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "dev": true, + "license": "MIT" + }, + "node_modules/through": { + "version": "2.3.8", + "license": "MIT" + }, + "node_modules/to-buffer": { + "version": "1.1.1", + "license": "MIT" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true + }, + "node_modules/type-check": { + "version": "0.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "license": "MIT" + }, + "node_modules/uglify-js": { + "version": "3.19.0", + "dev": true, + "license": "BSD-2-Clause", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/unique-concat": { + "version": "0.2.2", + "dev": true, + "license": "MIT" + }, + "node_modules/uri-js": { + "version": "4.4.1", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/urlgrey": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/urlgrey/-/urlgrey-1.0.0.tgz", + "integrity": "sha512-hJfIzMPJmI9IlLkby8QrsCykQ+SXDeO2W5Q9QTW3QpqZVTx4a/K7p8/5q+/isD8vsbVaFgql/gvAoQCRQ2Cb5w==", + "dev": true, + "dependencies": { + "fast-url-parser": "^1.1.3" + } + }, + "node_modules/util": { + "version": "0.12.5", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "license": "MIT" + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "1.3.1", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.15", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "dependencies": { + "string-width": "^1.0.2 || 2" + } + }, + "node_modules/wide-align/node_modules/ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/wide-align/node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/wide-align/node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "dev": true, + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wordwrap": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/workerpool": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", + "integrity": "sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "license": "ISC" + }, + "node_modules/xtend": { + "version": "4.0.2", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..0b02e80 --- /dev/null +++ b/package.json @@ -0,0 +1,38 @@ +{ + "name": "container-to-consul", + "version": "0.1.0", + "description": "Auto-register Docker containers in Consul", + "main": "lib/index.js", + "scripts": { + "test": "npm run --silent lint && npm run --silent unit-tests", + "lint": "eslint -c eslint.config.mjs lib", + "unit-tests": "istanbul cover _mocha -- --recursive --reporter spec --require should --require should-sinon" + }, + "author": "Benoît Vidis", + "contributors": [ "Mekom Solutions (https://mekomsolutions.com/)" ], + "license": "Apache-2.0", + "dependencies": { + "axios": "^1.7.2", + "bluebird": "^3.4.6", + "bunyan": "^1.8.1", + "docker-events": "0.0.2", + "dockerode": "^2.3.1", + "dockerode-promise": "^0.1.0", + "rc": "^1.1.6", + "rewire": "^2.5.2" + }, + "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.10.0", + "codecov": "^3.8.3", + "eslint": "^9.10.0", + "globals": "^15.9.0", + "istanbul": "^0.4.5", + "mocha": "^8.0.0", + "mock-require": "^1.3.0", + "should": "^11.1.1", + "should-sinon": "0.0.5", + "sinon": "^1.17.6", + "sinon-as-promised": "^4.0.2" + } +} diff --git a/playwright.Dockerfile b/playwright.Dockerfile new file mode 100644 index 0000000..f9a2ca9 --- /dev/null +++ b/playwright.Dockerfile @@ -0,0 +1,3 @@ +FROM mcr.microsoft.com/playwright:v1.47.1-jammy +WORKDIR /app +RUN mkdir -p /app && yarn add @playwright/test dockerode dockerode-compose \ No newline at end of file diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 0000000..8e5f4b3 --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,19 @@ +import { defineConfig, devices } from '@playwright/test'; +export default defineConfig({ + use: { + // All requests we send go to this API endpoint. + baseURL: 'http://localhost:8080', + extraHTTPHeaders: { + 'Accept': 'application/json', + }, + timeout: 120000 + }, + projects: [ + { + name: 'chromium', + use: { + ...devices['Desktop Chrome'], + }, + }, + ] +}); \ No newline at end of file diff --git a/readme/nginx-deregistered.png b/readme/nginx-deregistered.png new file mode 100644 index 0000000..cebf6a8 Binary files /dev/null and b/readme/nginx-deregistered.png differ diff --git a/readme/nginx-registered.png b/readme/nginx-registered.png new file mode 100644 index 0000000..473d1d6 Binary files /dev/null and b/readme/nginx-registered.png differ diff --git a/test/.mocharc.json b/test/.mocharc.json new file mode 100644 index 0000000..132f284 --- /dev/null +++ b/test/.mocharc.json @@ -0,0 +1,7 @@ +{ + "require": [ + "sinon-as-promised", + "should", + "should-sinon" + ] +} \ No newline at end of file diff --git a/test/lib/consul/catalog.test.js b/test/lib/consul/catalog.test.js new file mode 100644 index 0000000..d2061c1 --- /dev/null +++ b/test/lib/consul/catalog.test.js @@ -0,0 +1,35 @@ +'use strict'; + +const should = require('should'); +const sinon = require('sinon'); +const Catalog = require('../../../lib/consul/catalog'); + +describe('consul/catalog', () => { + var catalog; + + beforeEach(() => { + catalog = new Catalog({ + _put: sinon.spy() + }); + }); + + describe('#register', () => { + it('should call _put on proper route', () => { + catalog.register('data'); + + should(catalog.consul._put) + .be.calledOnce() + .be.calledWith('/v1/catalog/register', 'data'); + }); + }); + + describe('#deregisterService', () => { + it('should call _put on proper route', () => { + catalog.deregister('data'); + + should(catalog.consul._put) + .be.calledOnce() + .be.calledWith('/v1/catalog/deregister', 'data'); + }); + }); +}); \ No newline at end of file diff --git a/test/lib/consul/index.test.js b/test/lib/consul/index.test.js new file mode 100644 index 0000000..b98f58e --- /dev/null +++ b/test/lib/consul/index.test.js @@ -0,0 +1,117 @@ +'use strict'; + +const mockRequire = require('mock-require'); +const should = require('should'); +const sinon = require('sinon'); +const sandbox = sinon.sandbox.create(); +const Catalog = require('../../../lib/consul/catalog'); +const Kv = require('../../../lib/consul/kv'); + +describe('consul', () => { + var + Consul, + consul, + stubs = { + axios: sandbox.stub().resolves(true) + }; + + before(() => { + mockRequire('axios', stubs.axios); + Consul = require('../../../lib/consul'); + }); + + beforeEach(() => { + consul = new Consul({ + host: 'host', + port: '80' + }); + }); + + afterEach(() => { + // sandbox.restore does actually not restore stubs + sandbox.fakes.forEach(fake => fake.reset()); + }); + + describe('#_send', () => { + it ('should send what needs to', () => { + consul.acl = 'acl'; + + return consul._send('method', '/uri?foo=bar', 'body') + .then(() => { + should(stubs.axios) + .be.calledOnce() + .be.calledWithMatch({ + baseURL: 'http://host:80', + method: 'method', + url: '/uri?foo=bar&token=acl', + data: 'body' + }); + + }); + }); + }); + + describe('#_get', () => { + it('should call _send with GET', () => { + consul.acl = 'acl'; + + return consul._get('/uri') + .then(() => { + should(stubs.axios) + .be.calledOnce() + .be.calledWithMatch({ + method: 'GET', + url: '/uri?token=acl' + }); + }); + }); + }); + + describe('#_put', () => { + beforeEach(() => { + consul._send = sinon.spy(); + }); + + it('should call _send with PUT', () => { + consul._put('/uri', 'data'); + + should(consul._send) + .be.calledOnce() + .be.calledWith('PUT', '/uri', 'data'); + }); + + it('should set the dc if set globally', () => { + consul.dc = 'dc'; + + consul._put('/uri', {foo: 'bar'}); + + should(consul._send) + .be.calledWithMatch('PUT', '/uri', { + foo: 'bar', + Datacenter: 'dc' + }); + }); + }); + + describe('#_delete', () => { + beforeEach(() => { + consul._send = sinon.spy(); + }); + + it('should call _send with DELETE', () => { + consul._delete('/uri'); + + should(consul._send) + .be.calledOnce() + .be.alwaysCalledWith('DELETE', '/uri'); + }); + }); + + it('These are just for coverage', () => { + should(consul.catalog) + .be.an.instanceOf(Catalog); + should(consul.kv) + .be.an.instanceOf(Kv); + }); + +}); \ No newline at end of file diff --git a/test/lib/consul/kv.test.js b/test/lib/consul/kv.test.js new file mode 100644 index 0000000..6e38e3b --- /dev/null +++ b/test/lib/consul/kv.test.js @@ -0,0 +1,59 @@ +'use strict'; + +const should = require('should'); +const sinon = require('sinon'); +const Kv = require('../../../lib/consul/kv'); + +describe('consul/kv', () => { + var + kv; + + beforeEach(() => { + kv = new Kv({ + _delete: sinon.spy(), + _get: sinon.spy(), + _put: sinon.spy() + }); + }); + + describe('#keys', () => { + it('should call _get on proper route', () => { + kv.keys('prefix'); + + should(kv.consul._get) + .be.calledOnce() + .be.calledWith('/v1/kv/prefix?keys'); + }); + }); + + describe('#set', () => { + it('should call _put on proper route', () => { + kv.set('key', 'val'); + + should(kv.consul._put) + .be.calledOnce() + .be.calledWith('/v1/kv/key', 'val'); + }); + }); + + describe('#get', () => { + it('should call _get on proper route', () => { + kv.get('key'); + + should(kv.consul._get) + .be.calledOnce() + .be.calledWith('/v1/kv/key?raw'); + }); + }); + + describe('#delete', () => { + it('shoudl call _delete on proper route', () => { + kv.delete('key'); + + should(kv.consul._delete) + .be.calledOnce() + .be.calledWith('/v1/kv/key'); + }); + }); + +}); \ No newline at end of file diff --git a/test/lib/container-to-consul.test.js b/test/lib/container-to-consul.test.js new file mode 100644 index 0000000..f72136c --- /dev/null +++ b/test/lib/container-to-consul.test.js @@ -0,0 +1,501 @@ +'use strict'; + +const mockRequire = require('mock-require'); +const should = require('should'); +const sinon = require('sinon'); +const SkipError = require('../../lib/errors/skipError'); + +describe('container-to-consul', () => { + var ContainertoConsul; + var containertoConsul; + var stubs; + + beforeEach(() => { + stubs = { + log: { + debug: sinon.spy(), + info: sinon.spy(), + error: sinon.spy() + }, + consul: { + catalog: { + register: sinon.stub().resolves(), + deregister: sinon.stub().resolves() + }, + kv: { + keys: sinon.stub().resolves(), + get: sinon.stub().resolves(), + set: sinon.stub().resolves(), + delete: sinon.stub().resolves() + } + }, + docker: { + _container: { + inspect: sinon.stub().resolves() + }, + client: {}, + containers: sinon.stub().resolves(), + docker0: 'docker0', + events: { + on: sinon.stub() + }, + start: sinon.stub().resolves() + } + }; + stubs.bunyan = { + createLogger: sinon.stub().returns(stubs.log) + }; + stubs.docker.client.getContainer = sinon.stub().returns(stubs.docker._container); + stubs.Consul = sinon.stub().returns(stubs.consul); + stubs.Docker = sinon.stub().returns(stubs.docker); + + mockRequire('bunyan', stubs.bunyan); + mockRequire('../../lib/consul', stubs.Consul); + mockRequire('../../lib/docker', stubs.Docker); + ContainertoConsul = require('../../lib/container-to-consul'); + mockRequire.reRequire('../../lib/container-to-consul'); + + containertoConsul = new ContainertoConsul({ + consul: { + host: 'consul', + port: 8500 + }, + docker: { + socketPath: '/path' + }, + logger: { + name: 'test' + } + }); + }); + + afterEach(() => { + mockRequire.stopAll(); + }); + + describe('#constructor', () => { + it('should populate the object and attach Docker events', () => { + should(stubs.Consul) + .be.calledOnce() + .be.calledWithMatch({ + host: 'consul', + port: 8500 + }); + + should(stubs.Docker) + .calledOnce() + .be.calledWith(containertoConsul); + + should(stubs.docker.events.on) + .be.calledTwice() + .be.calledWith('start') + .be.calledWith('die'); + }); + + describe('#events', () => { + const container = {foo: 'bar'}; + let + start, + die; + + beforeEach(() => { + containertoConsul.docker._container.inspect.resolves(container); + sinon.stub(ContainertoConsul.prototype, 'registerContainer').resolves(); + sinon.stub(ContainertoConsul.prototype, 'containerServiceName').returns('service'); + sinon.stub(ContainertoConsul.prototype, 'deregisterService').resolves(); + containertoConsul._attachEvents(); + start = containertoConsul.docker.events.on.getCall(2).args[1]; + die = containertoConsul.docker.events.on.getCall(3).args[1]; + }); + + it('#start should register the container', () => { + return start({ + id: 'test' + }) + .then(() => { + should(containertoConsul.docker.client.getContainer) + .be.calledOnce() + .be.calledWith('test'); + + should(containertoConsul.docker._container.inspect) + .be.calledOnce(); + + should(containertoConsul.registerContainer) + .be.calledOnce() + .be.calledWithExactly(container); + + }); + }); + + it('#start should log the error if something goes wrong', () => { + let error = new Error('test'); + + containertoConsul.docker._container.inspect.rejects(error); + + return start({id: 'test'}) + .then(() => { + should(1).be.false(); + }) + .catch(err => { + should(containertoConsul.log.error) + .be.calledOnce() + .be.calledWithExactly(err); + + should(err).be.exactly(error); + }); + }); + + it('#die should deregisterService the container', () => { + return die({id: 'test'}) + .then(() => { + should(containertoConsul.docker.client.getContainer) + .be.calledOnce() + .be.calledWith('test'); + + should(containertoConsul.docker._container.inspect) + .be.calledOnce(); + + should(containertoConsul.containerServiceName) + .be.calledOnce() + .be.calledWithExactly(container); + + should(containertoConsul.deregisterService) + .be.calledOnce() + .be.calledWith('service'); + }); + }); + + it('#die should log the error if something goes wrong', () => { + let error = new Error('test'); + + containertoConsul.docker._container.inspect.rejects(error); + + return die({id: 'test'}) + .then(() => { + should(1).be.false(); + }) + .catch(err => { + should(containertoConsul.log.error) + .be.calledOnce() + .be.calledWithExactly(err); + + should(err).be.exactly(error); + }); + }); + }); + }); + + describe('#start', () => { + var container; + + beforeEach(() => { + let error = new Error('test'); + error.statusCode = 404; + + container = { + inspect: sinon.stub().rejects(error) + }; + + containertoConsul.registerContainers = sinon.stub().resolves(); + containertoConsul.registerContainer = sinon.stub().resolves(); + containertoConsul.deregisterService = sinon.stub().resolves(); + containertoConsul.consul.kv.keys.resolves([ + 'test', + 'foo' + ]); + containertoConsul.docker.client.getContainer.returns(container); + }); + + it('should deregisterService non-running containers and register running ones', () => { + return containertoConsul.start() + .then(() => { + should(containertoConsul.consul.kv.keys) + .be.calledOnce() + .be.calledWith('docker/service-ids/'); + + should(containertoConsul.consul.kv.get) + .be.calledTwice() + .be.calledWith('test') + .be.calledWith('foo'); + + should(containertoConsul.docker.client.getContainer) + .be.calledTwice(); + + should(containertoConsul.deregisterService) + .be.calledTwice() + .be.calledWith('test') + .be.calledWith('foo'); + + should(containertoConsul.docker.containers) + .be.calledOnce(); + + should(containertoConsul.registerContainers) + .be.calledOnce(); + }); + }); + + it('should not fail if no docker/service-ids key is stored in consul', () => { + var error = new Error('test'); + error.statusCode = 404; + + containertoConsul.consul.kv.keys.rejects(error); + + return containertoConsul.start() + .then(() => { + should(containertoConsul.registerContainers) + .be.calledOnce(); + }); + }); + + it('should reject the promise if consul kv throws an unexpected error', () => { + var error = new Error('unexpected'); + containertoConsul.consul.kv.keys.rejects(error); + + return containertoConsul.start() + .then(() => { + throw new Error('this should not happen'); + }) + .catch(e => { + should(e).be.exactly(error); + + should(containertoConsul.log.error) + .be.calledOnce() + .be.calledWith(e); + }); + }); + + it('should deregisterService non-running containers', () => { + container.inspect + .onFirstCall().resolves({ + State: { + Status: 'down' + } + }); + + return containertoConsul.start() + .then(() => { + should(containertoConsul.deregisterService) + .be.calledTwice(); + }); + }); + + it('should reject the promise if we cannot inspect the container', () => { + var error = new Error('test'); + + container.inspect + .onSecondCall().rejects(error); + + return containertoConsul.start() + .then(() => { + throw new Error('this should not happen'); + }) + .catch(e => { + should(containertoConsul.log.error) + .be.calledWith(e); + + should(e).be.exactly(error); + }); + }); + }); + + describe('#registerConstainers', () => { + it('should call registerContainer for all containers', () => { + containertoConsul.registerContainer = sinon.stub().resolves(); + + return containertoConsul.registerContainers([ + 'test', + 'foo' + ]) + .then(() => { + should(containertoConsul.registerContainer) + .be.calledTwice() + .be.calledWith('test') + .be.calledWith('foo'); + }); + }); + }); + + describe('#registerContainer', () => { + beforeEach(() => { + containertoConsul.container2Service = sinon.stub().returns({foo: 'bar'}); + containertoConsul.containerServiceName = sinon.stub().returns('foo'); + }); + + it('should reject if we cannot parse the docker inspect result', () => { + var error = new Error('test'); + + containertoConsul.container2Service.throws(error); + + return should(containertoConsul.registerContainer('test')) + .be.rejectedWith(error); + }); + + it('should resolve and do nothing is the container needs to be skipped', () => { + var error = new SkipError('test'); + + containertoConsul.container2Service.throws(error); + + return containertoConsul.registerContainer('test') + .then(() => { + should(containertoConsul.log.info) + .be.calledOnce() + .be.calledWith('test'); + + should(containertoConsul.consul.catalog.register) + .have.callCount(0); + }); + }); + + it('should register the service in consul', () => { + return containertoConsul.registerContainer({Id: 'test'}) + .then(() => { + should(containertoConsul.log.info) + .be.calledOnce() + .be.calledWith('registering container'); + + should(containertoConsul.consul.catalog.register) + .be.calledOnce() + .be.calledWithMatch({foo: 'bar'}); + + should(containertoConsul.consul.kv.set) + .be.calledOnce() + .be.calledWith('docker/service-ids/foo', 'test'); + }); + }); + + it('should reject the promise if consul fails to register the service', () => { + let error = new Error('test'); + + containertoConsul.consul.catalog.register.rejects(error); + + return should(containertoConsul.registerContainer({})) + .be.rejectedWith(error); + }); + }); + + describe('#deregisterService', () => { + it('should log and reject errors', () => { + let error = new Error('test'); + + containertoConsul.consul.catalog.deregister.rejects(error); + + return containertoConsul.deregisterService() + .then(() => { + throw new Error('this should not happen'); + }) + .catch(e => { + should(e).be.exactly(error); + + should(containertoConsul.log.error) + .be.calledOnce() + .be.calledWith(error); + }); + }); + + it('should deregisterService the node and associated key', () => { + return containertoConsul.deregisterService('test') + .then(() => { + should(containertoConsul.consul.catalog.deregister) + .be.calledOnce() + .be.calledWithMatch({ Node: 'test' }); + + should(containertoConsul.consul.kv.delete) + .be.calledTwice() + .be.calledWith('docker/service-ids/test') + .be.calledWith('services/test'); + }); + }); + }); + + describe('#container2Service', () => { + beforeEach(() => { + containertoConsul.containerServiceName = sinon.stub().returns('foo'); + }); + + it('should parse the inspect result', () => { + let result = containertoConsul.container2Service({ + Config: { + Labels: { + 'consul.ip': 'consul ip', + 'consul.port': '8888 consul port', + 'consul.service': 'consul service', + 'consul.tags': 'consul,tags', + 'consul.register': 'true' + } + }, + NetworkSettings: { + Networks: { + test: { + IPAddress: 'ip' + } + } + } + }); + should(result.Node).be.exactly('foo'); + should(result.Address).be.exactly('consul ip'); + should(result.Service.Service).be.exactly('consul service'); + should(result.Service.Port).be.exactly(8888); + should(result.Service.Tags).match(['consul', 'tags']); + }); + + it('should not set the port if it does not manage to cast it to an int', () => { + let result = containertoConsul.container2Service({ + Labels: { + 'consul.port': 'not a number', + 'consul.register': 'true' + }, + NetworkSettings: { + Networks: { + IPAddress: 'ip' + } + } + }); + + should(result.Service.Port).be.undefined(); + }); + + it('should use docker0 ip address if `host` is specified for ip', () => { + let result = containertoConsul.container2Service({ + Labels: { + 'consul.ip': 'host', + 'consul.register': 'true' + }, + NetworkSettings: { + Networks: { + IPAddress: 'ip' + } + } + }); + + should(result.Address).be.exactly(containertoConsul.docker.docker0); + }); + }); + + describe('#containerServiceName', () => { + it('should get the container name from inecpted result', () => { + should(containertoConsul.containerServiceName({ + Name: 'container', + Labels: { + 'consul.name': 'name', + 'consul.register': 'true' + } + })).be.exactly('name'); + + should(containertoConsul.containerServiceName({ + Names: ['name', 'foo'] + })).be.exactly('name'); + + should(containertoConsul.containerServiceName({ + Name: 'test', + Config: { + Labels: { + 'consul.name': 'foobar', + 'consul.register': 'true' + } + } + })).be.exactly('foobar'); + }); + }); + + +}); \ No newline at end of file diff --git a/test/lib/docker.test.js b/test/lib/docker.test.js new file mode 100644 index 0000000..6039d0f --- /dev/null +++ b/test/lib/docker.test.js @@ -0,0 +1,169 @@ +'use strict'; + +const mockRequire = require('mock-require'); +const should = require('should'); +const sinon = require('sinon'); + +describe('docker', () => { + var + clock, + Docker, + docker, + stubs; + + before(() => { + clock = sinon.useFakeTimers(); + + }); + + after(() => { + clock.restore(); + }); + + beforeEach(() => { + stubs = { + client: { + listContainers: sinon.stub().resolves(), + listNetworks: sinon.stub().resolves([{ + Name: 'bridge', + IPAM: { + Config: [{ + Gateway: 'docker0 from docker' + }] + } + }]) + }, + events: { + on: sinon.stub(), + start: sinon.stub() + }, + containertoConsul: { + config: { + docker: { + connectTimeout: 5000, + foo: 'bar' + } + }, + log: { + error: sinon.spy(), + info: sinon.spy(), + warn: sinon.spy() + } + }, + dockerode: sinon.stub(), + dockerodePromise: sinon.stub(), + dockerEvents: sinon.stub(), + }; + stubs.dockerodePromise = sinon.stub().returns(stubs.client); + stubs.dockerEvents = sinon.stub().returns(stubs.events); + + mockRequire('dockerode', stubs.dockerode); + mockRequire('dockerode-promise', stubs.dockerodePromise); + mockRequire('docker-events', stubs.dockerEvents); + Docker = require('../../lib/docker'); + mockRequire.reRequire('../../lib/docker'); + + docker = new Docker(stubs.containertoConsul); + }); + + describe('#constructor', () => { + it('should construct a proper object', () => { + should(docker.containertoConsul).be.exactly(stubs.containertoConsul); + should(docker.docker0).be.exactly('172.17.0.1'); + }); + }); + + describe('#start', () => { + it('should start events and attach the connect event', () => { + let p = docker.start(); + + let connect = docker.events.on.firstCall.args[1]; + let disconnect = docker.events.on.secondCall.args[1]; + + connect(); + + return p + .then(() => { + should(docker.events.start) + .be.calledOnce(); + + should(docker.events.on) + .be.calledTwice() + .be.calledWith('connect') + .be.calledWith('disconnect'); + + should(docker.docker0).be.exactly('docker0 from docker'); + }); + }); + + it('should call start again on timeout', () => { + sinon.spy(docker, 'start'); + docker.events.on + .withArgs('connect') + .onSecondCall() + .yields(); + + let p = docker.start(); + + should(docker.start) + .be.calledOnce(); + + clock.tick(10000); + + return p + .then(() => { + should(docker.start) + .be.calledTwice(); + }); + }); + + it('should reject the promise if something unexpected occured', () => { + var error = new Error('test'); + + docker.events.start.throws(error); + + return docker.start() + .then(() => { + throw new Error('this should not happen'); + }) + .catch(e => { + should(e).be.exactly(error); + + should(docker.containertoConsul.log.error) + .be.calledOnce() + .be.calledWith(error); + }); + }); + + it('#disconnect event should try to restart', () => { + sinon.spy(docker, 'start'); + docker.events.on + .withArgs('connect') + .yields(); + + docker.start(); + + let disconnect = docker.events.on.secondCall.args[1]; + + disconnect(); + + should(docker.containertoConsul.log.warn) + .be.calledOnce() + .be.calledWith('Disconnected from Docker. Reconnecting'); + + should(docker.start) + .be.calledTwice(); + }); + }); + + describe('#containers', () => { + it('should list containers', () => { + return docker.containers() + .then(() => { + should(docker.client.listContainers) + .be.calledOnce(); + }); + }); + }); + +}); \ No newline at end of file diff --git a/test/mocha.opts b/test/mocha.opts new file mode 100644 index 0000000..775383a --- /dev/null +++ b/test/mocha.opts @@ -0,0 +1,8 @@ +-b +-r sinon-as-promised +-r should-sinon +--reporter spec +--recursive +--slow 2000 +--timeout 10000 +