@itentialopensource/adapter-utils 4.44.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +3 -0
- package/.eslintrc.js +18 -0
- package/.jshintrc +3 -0
- package/CHANGELOG.md +1398 -0
- package/CODE_OF_CONDUCT.md +48 -0
- package/CONTRIBUTING.md +173 -0
- package/LICENSE +201 -0
- package/README.md +12 -0
- package/actionSchema.json +186 -0
- package/error.json +148 -0
- package/index.js +7 -0
- package/lib/connectorRest.js +4083 -0
- package/lib/dbUtil.js +1300 -0
- package/lib/propertyUtil.js +1012 -0
- package/lib/requestHandler.js +1175 -0
- package/lib/restHandler.js +1309 -0
- package/lib/throttle.js +1289 -0
- package/lib/translatorUtil.js +1137 -0
- package/package.json +61 -0
- package/propertiesSchema.json +840 -0
- package/utils/pre-commit.sh +26 -0
- package/utils/setup.js +32 -0
- package/utils/testRunner.js +259 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
|
10
|
+
|
|
11
|
+
* Using welcoming and inclusive language
|
|
12
|
+
* Being respectful of differing viewpoints and experiences
|
|
13
|
+
* Gracefully accepting constructive criticism
|
|
14
|
+
* Focusing on what is best for the community
|
|
15
|
+
* Showing empathy towards other community members
|
|
16
|
+
|
|
17
|
+
Examples of unacceptable behavior by participants include:
|
|
18
|
+
|
|
19
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
20
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
21
|
+
* Public or private harassment
|
|
22
|
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
|
23
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
24
|
+
|
|
25
|
+
## Our Responsibilities
|
|
26
|
+
|
|
27
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
|
28
|
+
|
|
29
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
## Scope
|
|
32
|
+
|
|
33
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
|
34
|
+
|
|
35
|
+
## Enforcement
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [support@itential.com](mailto:support@itential.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
|
38
|
+
|
|
39
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
|
40
|
+
|
|
41
|
+
## Attribution
|
|
42
|
+
|
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
|
44
|
+
|
|
45
|
+
[homepage]: http://contributor-covenant.org
|
|
46
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
|
47
|
+
|
|
48
|
+
_return to [README](../README.md)_
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
:+1: :tada: First off, thanks for taking the time to contribute! :tada: :+1:
|
|
4
|
+
|
|
5
|
+
The following is a set of guidelines for contributing. [These are mostly guidelines, not rules](https://www.youtube.com/watch?v=jl0hMfqNQ-g). Use your best judgment, and feel free to propose changes to this document in a merge request.
|
|
6
|
+
|
|
7
|
+
#### Table Of Contents
|
|
8
|
+
|
|
9
|
+
[Code of Conduct](#code-of-conduct)
|
|
10
|
+
|
|
11
|
+
[How Can I Contribute?](#how-can-i-contribute)
|
|
12
|
+
* [Reporting Bugs](#reporting-bugs)
|
|
13
|
+
* [Your First Code Contribution](#your-first-code-contribution)
|
|
14
|
+
* [Merge Requests](#merge-requests)
|
|
15
|
+
|
|
16
|
+
[Styleguides](#styleguides)
|
|
17
|
+
* [Git Commit Messages](#git-commit-messages)
|
|
18
|
+
* [JavaScript Styleguide](#javascript-styleguide)
|
|
19
|
+
* [Tests Styleguide](#tests-styleguide)
|
|
20
|
+
* [Documentation Styleguide](#documentation-styleguide)
|
|
21
|
+
|
|
22
|
+
## Code of Conduct
|
|
23
|
+
|
|
24
|
+
This project and everyone participating in it is governed by the [Code of Conduct](./CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [support@itential.com](mailto:support@itential.com).
|
|
25
|
+
|
|
26
|
+
## How Can I Contribute?
|
|
27
|
+
|
|
28
|
+
### Reporting Bugs
|
|
29
|
+
|
|
30
|
+
This section guides you through submitting a bug report. Following these guidelines helps maintainers understand your report :pencil:, reproduce the behavior :computer: :left_right_arrow: :computer:, and find related reports :mag_right:.
|
|
31
|
+
|
|
32
|
+
Before creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out the [gitlab issue template](https://gitlab.com/itentialopensource/argo/issues/new); the information it asks for helps us resolve issues faster.
|
|
33
|
+
|
|
34
|
+
> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.
|
|
35
|
+
|
|
36
|
+
#### Before Submitting A Bug Report
|
|
37
|
+
|
|
38
|
+
* **Check the [User Guide](README.md).** You might be able to find the cause of the problem and fix things yourself. Most importantly, check if you can reproduce the problem __in the latest version__.
|
|
39
|
+
* **Perform a [cursory search](https://gitlab.com/itentialopensource/argo/issues)** to see if the problem has already been reported and is being worked on. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one.
|
|
40
|
+
* **Ask around in chat if you are an Itential employee** to see if others are experiencing the same issue.
|
|
41
|
+
|
|
42
|
+
#### How Do I Submit A (Good) Bug Report?
|
|
43
|
+
|
|
44
|
+
Bugs are tracked as [gitlab issues](https://docs.gitlab.com/ee/user/project/issues/). Create an issue and fill out the [gitlab issue template](https://gitlab.com/itentialopensource/argo/issues/new).
|
|
45
|
+
|
|
46
|
+
Explain the problem and include additional details to help maintainers reproduce the problem:
|
|
47
|
+
|
|
48
|
+
* **Use a clear and descriptive title** for the issue to identify the problem.
|
|
49
|
+
* **Describe the exact steps which reproduce the problem** in as many details as possible. For example, start by explaining how you setup and started the project, e.g. which command exactly you used in the terminal, or how you started the project otherwise.
|
|
50
|
+
* **Provide specific examples to demonstrate the steps**. Include links to files or projects, or copy/paste-able snippets, which you use in those examples.
|
|
51
|
+
* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
|
|
52
|
+
* **Explain which behavior you expected to see instead and why.**
|
|
53
|
+
* **Include screenshots and animated GIFs** which show you following the described steps and clearly demonstrate the problem. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
|
|
54
|
+
* **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below.
|
|
55
|
+
|
|
56
|
+
Provide more context by answering these questions:
|
|
57
|
+
|
|
58
|
+
* **Did the problem start happening recently** (e.g. after updating to a new version/tag) or was this always a problem?
|
|
59
|
+
* If the problem started happening recently, **can you reproduce the problem in an older version/tag?** What's the most recent version in which the problem doesn't happen?
|
|
60
|
+
* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
|
|
61
|
+
|
|
62
|
+
Include details about your configuration and environment:
|
|
63
|
+
|
|
64
|
+
* **Which version of argo are you using?** You can get the exact version by checking the project's version in its VERSION file.
|
|
65
|
+
* **What's the name and version of the OS you're using**?
|
|
66
|
+
* **Are you running or using the project in a virtual machine?** If so, which VM software are you using and which operating systems and versions are used for the host and the guest?
|
|
67
|
+
|
|
68
|
+
### Your First Code Contribution
|
|
69
|
+
|
|
70
|
+
#### Forking this Repository
|
|
71
|
+
|
|
72
|
+
In order for you to have autonomy over your code changes, while still helping us coordinate all merge requests, you will need to fork this repository first.
|
|
73
|
+
|
|
74
|
+
* Click the "fork" button from this project's main page.
|
|
75
|
+
* This will create a brand new git repo which is a copy ("fork") of this original repo.
|
|
76
|
+
* When forking, you can tell gitlab to host it inside your personal gitlab account's project.
|
|
77
|
+
* Clone the newly forked repo.
|
|
78
|
+
* Continue with the next step of [Local Development](#local development).
|
|
79
|
+
|
|
80
|
+
Note: There are sometimes exceptions to this. For example, if you are an Itential employee, you can create a gitlab issue on this project to request developer access to this repo if you do not already have it.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
#### Local Development
|
|
84
|
+
|
|
85
|
+
This project can be developed locally on all operating systems. For instructions on how to do this, follow the steps highlighted in the [User Guide](README.md).
|
|
86
|
+
|
|
87
|
+
For all commits you make, follow the project's [Styleguide](#styleguides).
|
|
88
|
+
|
|
89
|
+
This repo's pipeline is powered by [Argo](https://gitlab.com/itentialopensource/argo). Therefore, you should make sure to name your branches according to these rules: https://gitlab.com/itentialopensource/argo/blob/master/GIT_FLOW.md .
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
#### Merge Requests
|
|
93
|
+
|
|
94
|
+
Merge Requests empower dialog and collaberation. Feel free to make merge requests whenever you want to open discussion about the changes being made -- even if your work is not finished.
|
|
95
|
+
|
|
96
|
+
See https://gitlab.com/itentialopensource/argo/blob/master/GIT_FLOW.md#3-open-a-merge-request-pull-request for more information about Itential's culture around merge requests.
|
|
97
|
+
|
|
98
|
+
If you are working from a forked repo, then you should create the merge request from the forked repo. Gitlab will be smart enough to realize that this repo is a forked copy, and it will automatically assume you are trying to make a merge request to the original source repo.
|
|
99
|
+
|
|
100
|
+
* Fill out the provided merge request template.
|
|
101
|
+
* Reference related issues and merge requests liberally.
|
|
102
|
+
* Include screenshots and animated GIFs in your merge request whenever possible.
|
|
103
|
+
* Follow the project's [Styleguide](#styleguides).
|
|
104
|
+
* End all files with a newline.
|
|
105
|
+
|
|
106
|
+
## Styleguides
|
|
107
|
+
|
|
108
|
+
### Git Commit Messages
|
|
109
|
+
|
|
110
|
+
* Use the present tense ("Add feature" not "Added feature")
|
|
111
|
+
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
|
|
112
|
+
* Consider starting the commit message with an applicable emoji _(not required)_:
|
|
113
|
+
* :art: `:art:` when improving the format/structure of the code
|
|
114
|
+
* :racehorse: `:racehorse:` when improving performance
|
|
115
|
+
* :non-potable_water: `:non-potable_water:` when plugging memory leaks
|
|
116
|
+
* :memo: `:memo:` when writing docs
|
|
117
|
+
* :penguin: `:penguin:` when fixing something on Linux
|
|
118
|
+
* :apple: `:apple:` when fixing something on macOS
|
|
119
|
+
* :checkered_flag: `:checkered_flag:` when fixing something on Windows
|
|
120
|
+
* :bug: `:bug:` when fixing a bug
|
|
121
|
+
* :fire: `:fire:` when removing code or files
|
|
122
|
+
* :green_heart: `:green_heart:` when fixing the CI build
|
|
123
|
+
* :white_check_mark: `:white_check_mark:` when adding tests
|
|
124
|
+
* :lock: `:lock:` when dealing with security
|
|
125
|
+
* :arrow_up: `:arrow_up:` when upgrading dependencies
|
|
126
|
+
* :arrow_down: `:arrow_down:` when downgrading dependencies
|
|
127
|
+
* :shirt: `:shirt:` when removing linter warnings
|
|
128
|
+
|
|
129
|
+
### Docker Styleguide
|
|
130
|
+
|
|
131
|
+
All shell scripts must be POSIX compliant and pass testing via [shellcheck](https://github.com/koalaman/shellcheck).
|
|
132
|
+
|
|
133
|
+
__Order build steps from less-frequently changed to more-frequently changed.__ eg:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
# Rarely changed base package requirements:
|
|
137
|
+
RUN apt-get update -qq && apt-get install -qq make ant netcat gawk
|
|
138
|
+
|
|
139
|
+
# More commonly changed layer (nso isntaller example):
|
|
140
|
+
RUN curl -L -o nso_installer.bin https://address.com/path/to/installer.bin \
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
__Bundle like-steps to keep layer stages compact and specific.__ eg:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
# Bundle all package install steps into one run command:
|
|
147
|
+
RUN apt-get update -qq && apt-get install -qq make ant netcat gawk
|
|
148
|
+
|
|
149
|
+
# Set all environment variables in one layer:
|
|
150
|
+
ENV NCS_LOG_DIR=/var/log/ncs \
|
|
151
|
+
NCS_RUN_DIR=/var/opt/ncs \
|
|
152
|
+
NCS_CONFIG_DIR=/etc/ncs \
|
|
153
|
+
NCS_DIR=/opt/ncs/current
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
__Avoid installing unnecessary packages.__ Don't install packages just because they might be "nice to have". Images are supposed to be minimal, specific, and compact by design.
|
|
157
|
+
|
|
158
|
+
__Each container must have only one purpose/concern.__ For example, if adding an external service, write a separate image for that external service and leverage the separate image's container in conjunction with the official ci images. Do __NOT__ simply add the external service into the argo images.
|
|
159
|
+
|
|
160
|
+
__Use multi-line arguments.__ Instead of creating extremely long command strings, use a space and a backslash (`\`) to span the argument over multiple lines .This makes MRs much easier to read and review. eg:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
# bad
|
|
164
|
+
ENV NCS_LOG_DIR=/var/log/ncs NCS_RUN_DIR=/var/opt/ncs NCS_CONFIG_DIR=/etc/ncs NCS_DIR=/opt/ncs/current
|
|
165
|
+
|
|
166
|
+
# good
|
|
167
|
+
ENV NCS_LOG_DIR=/var/log/ncs \
|
|
168
|
+
NCS_RUN_DIR=/var/opt/ncs \
|
|
169
|
+
NCS_CONFIG_DIR=/etc/ncs \
|
|
170
|
+
NCS_DIR=/opt/ncs/current
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
_return to [README](./README.md)_
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2019 Itential, LLC
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Itential Adapter Utilities
|
|
2
|
+
===
|
|
3
|
+
|
|
4
|
+
Itential Adapter Utilities is a set of Node.js runtime libraries used by Itential Adapters.
|
|
5
|
+
|
|
6
|
+
# Usage
|
|
7
|
+
|
|
8
|
+
Include `@itentialopensource/adapter-utils` as a dependency and require it:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
const { RequestHandler, PropertyUtility } = require('@itentialopensource/adapter-utils');
|
|
12
|
+
```
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "action-schemas",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
+
"properties": {
|
|
6
|
+
"actions": {
|
|
7
|
+
"type": "array",
|
|
8
|
+
"items": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"name": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "the action being performed",
|
|
14
|
+
"examples": [
|
|
15
|
+
"get_config"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"protocol": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "the protocol to use for this action",
|
|
21
|
+
"default": "REST",
|
|
22
|
+
"enum": [
|
|
23
|
+
"REST"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"method": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "the method to use for this action",
|
|
29
|
+
"default": "GET",
|
|
30
|
+
"enum": [
|
|
31
|
+
"GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "TRACE", "CONNECT"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"entitypath": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "the path to use for this action",
|
|
37
|
+
"default": "GET",
|
|
38
|
+
"pattern": "^({base_path}|\\/)[-a-zA-Z0-9!@$:&%_+.,~#\\/*=:]*({version})?([-a-zA-Z0-9!@$:&%_+.,~#\\/*=:]*({pathv[0-9]+})?)*(\\??[-a-zA-Z0-9!@$:&%_+.,\\(\\)~#\\/*=:]*({username})?[-a-zA-Z0-9!@$:&%_+.,\\(\\)~#\/*=:]*({password})?({query})?)?$",
|
|
39
|
+
"examples": [
|
|
40
|
+
"/api/devices{pathv1}{query}", "/api/devices{pathv1}/components{pathv2}{query}",
|
|
41
|
+
"/api/devices", "/api/devices{query}"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"querykey": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "anything that should proceed the query in the entitypath",
|
|
47
|
+
"default": "?",
|
|
48
|
+
"examples": [
|
|
49
|
+
"?query=", "?sysparam_query="
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"timeout": {
|
|
53
|
+
"type": "integer",
|
|
54
|
+
"description": "request timeout for this action"
|
|
55
|
+
},
|
|
56
|
+
"sendEmpty": {
|
|
57
|
+
"type": "boolean",
|
|
58
|
+
"description": "whether to send an empty body"
|
|
59
|
+
},
|
|
60
|
+
"sendGetBody": {
|
|
61
|
+
"type": "boolean",
|
|
62
|
+
"description": "whether to send a body with the get request"
|
|
63
|
+
},
|
|
64
|
+
"schema": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "the name of the schema file for this action",
|
|
67
|
+
"examples": [
|
|
68
|
+
"schema.json"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
"requestSchema": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "the name of the request schema file for this action (will override the schema)",
|
|
74
|
+
"examples": [
|
|
75
|
+
"req_schema.json"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"responseSchema": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"description": "the name of the response schema file for this action (will override the schema)",
|
|
81
|
+
"examples": [
|
|
82
|
+
"resp_schema.json"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"datatype": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"description": "the type of data used in this action, if unsupported type JSON will be used",
|
|
88
|
+
"default": "JSON"
|
|
89
|
+
},
|
|
90
|
+
"requestDatatype": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "the name of the request data type for this action (will override the datatype)",
|
|
93
|
+
"examples": [
|
|
94
|
+
"req_schema.json"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"responseDatatype": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"description": "the name of the response data type for this action (will override the datatype)",
|
|
100
|
+
"examples": [
|
|
101
|
+
"resp_schema.json"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
"sso": {
|
|
105
|
+
"$ref": "#/definitions/sso"
|
|
106
|
+
},
|
|
107
|
+
"headers": {
|
|
108
|
+
"type": "object"
|
|
109
|
+
},
|
|
110
|
+
"responseObjects": {
|
|
111
|
+
"type": "array",
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"properties": {
|
|
115
|
+
"type": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"description": "the response type - based on the entitypath",
|
|
118
|
+
"default": "default",
|
|
119
|
+
"examples": [
|
|
120
|
+
"default", "withpathv1", "withpathv2", "withpathv3", "withquery"
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"key": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"description": "the field in the response where the data we want is",
|
|
126
|
+
"default": "",
|
|
127
|
+
"examples": [
|
|
128
|
+
"result"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"mockFile": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"description": "the relative location of a data file containing a mock response",
|
|
134
|
+
"examples": [
|
|
135
|
+
"mockdatafiles/actionname.json"
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"required": ["type", "key"]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"required": ["name", "protocol", "method", "entitypath"],
|
|
144
|
+
"oneOf": [
|
|
145
|
+
{
|
|
146
|
+
"required": ["schema"]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"required": ["requestSchema","responseSchema"]
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"required": ["actions"],
|
|
156
|
+
"definitions": {
|
|
157
|
+
"sso": {
|
|
158
|
+
"type": "object",
|
|
159
|
+
"properties": {
|
|
160
|
+
"protocol": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"description": "the protocol to request token from system",
|
|
163
|
+
"default": "",
|
|
164
|
+
"enum": [
|
|
165
|
+
"http", "https", ""
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
"host": {
|
|
169
|
+
"type": "string",
|
|
170
|
+
"description": "hostname of the authentication system",
|
|
171
|
+
"default": "",
|
|
172
|
+
"examples": [
|
|
173
|
+
"systemx.customer.com"
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
"port": {
|
|
177
|
+
"type": "integer",
|
|
178
|
+
"description": "port on which to connect to the authentication system",
|
|
179
|
+
"default": 0,
|
|
180
|
+
"minimum": 0,
|
|
181
|
+
"maximum": 65535
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|