agent-claw: automated task changes

This commit is contained in:
daniel
2026-05-06 18:55:16 -05:00
parent 38905bb1e9
commit 732b00fb66
8494 changed files with 2018127 additions and 4 deletions

64
cdk/node_modules/@aws-cdk/asset-awscli-v1/.jsii generated vendored Normal file
View File

@@ -0,0 +1,64 @@
{
"author": {
"email": "aws-cdk-dev@amazon.com",
"name": "Amazon Web Services",
"organization": true,
"roles": [
"author"
]
},
"description": "A library that contains the AWS CLI for use in Lambda Layers",
"docs": {
"stability": "stable"
},
"homepage": "https://github.com/cdklabs/awscdk-asset-awscli#readme",
"jsiiVersion": "5.9.34 (build 8773a22)",
"keywords": [
"cdk"
],
"license": "Apache-2.0",
"metadata": {
"jsii": {
"pacmak": {
"hasDefaultInterfaces": true
}
},
"tscRootDir": "src"
},
"name": "@aws-cdk/asset-awscli-v1",
"readme": {
"markdown": "# Asset with AWS CLI v1\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)\n\n---\n\n<!--END STABILITY BANNER-->\n\nThis module bundles the AWS CLI v1 as a local asset. It exposes\nconstants `ASSET_FILE` and `LAYER_SOURCE_DIR` that can be consumed\nvia the CDK `Asset` construct.\n\nAny Lambda Function that uses uses this asset must use a Python 3.x\nruntime.\n\nUsage:\n\n```ts\n// AwsCliLayer bundles the AWS CLI in a lambda layer\nimport { ASSET_FILE, LAYER_SOURCE_DIR } from '@aws-cdk/asset-awscli-v1';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as s3_assets from 'aws-cdk-lib/aws-s3-assets';\nimport { FileSystem } from 'aws-cdk-lib';\n\ndeclare const fn: lambda.Function;\nconst asset = new s3_assets.Asset(this, 'layer-asset', {\n path: ASSET_FILE,\n assetHash: FileSystem.fingerprint(LAYER_SOURCE_DIR),\n});\nfn.addLayers(new lambda.LayerVersion(this, 'AwsCliLayer', {\n code: lambda.Code.fromBucket(asset.bucket, asset.s3ObjectKey),\n}));\n```\n\nThe CLI will be installed under `/opt/awscli/aws`.\n"
},
"repository": {
"type": "git",
"url": "https://github.com/cdklabs/awscdk-asset-awscli.git"
},
"schema": "jsii/0.10.0",
"targets": {
"dotnet": {
"namespace": "Amazon.CDK.Asset.AwsCliV1",
"packageId": "Amazon.CDK.Asset.AwsCliV1"
},
"go": {
"moduleName": "github.com/cdklabs/awscdk-asset-awscli-go",
"packageName": "awscliv1"
},
"java": {
"maven": {
"artifactId": "cdk-asset-awscli-v1",
"groupId": "software.amazon.awscdk"
},
"package": "software.amazon.awscdk.cdk.asset.awscli.v1"
},
"js": {
"npm": "@aws-cdk/asset-awscli-v1"
},
"python": {
"distName": "aws-cdk.asset-awscli-v1",
"module": "aws_cdk.asset_awscli_v1"
}
},
"types": {},
"version": "2.2.273",
"fingerprint": "T89lS+Ggz0ZESd2hJ5LxStufitlUppIQw11D2xCLWbs="
}

File diff suppressed because one or more lines are too long

6
cdk/node_modules/@aws-cdk/asset-awscli-v1/API.md generated vendored Normal file
View File

@@ -0,0 +1,6 @@
# API Reference <a name="API Reference" id="api-reference"></a>

View File

@@ -0,0 +1,4 @@
## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
opensource-codeofconduct@amazon.com with any additional questions or comments.

View File

@@ -0,0 +1,59 @@
# Contributing Guidelines
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.
## Reporting Bugs/Feature Requests
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
* A reproducible test case or series of steps
* The version of our code being used
* Any modifications you've made relevant to the bug
* Anything unusual about your environment or deployment
## Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
1. You are working against the latest source on the *awscli-v1/main* branch.
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
To send us a pull request, please:
1. Fork the repository.
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
3. Ensure local tests pass.
4. Commit to your fork using clear commit messages.
5. Send us a pull request, answering any default questions in the pull request interface.
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
opensource-codeofconduct@amazon.com with any additional questions or comments.
## Security issue notifications
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
## Licensing
See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.

202
cdk/node_modules/@aws-cdk/asset-awscli-v1/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://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
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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
http://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.

1
cdk/node_modules/@aws-cdk/asset-awscli-v1/NOTICE generated vendored Normal file
View File

@@ -0,0 +1 @@
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

38
cdk/node_modules/@aws-cdk/asset-awscli-v1/README.md generated vendored Normal file
View File

@@ -0,0 +1,38 @@
# Asset with AWS CLI v1
<!--BEGIN STABILITY BANNER-->
---
![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)
---
<!--END STABILITY BANNER-->
This module bundles the AWS CLI v1 as a local asset. It exposes
constants `ASSET_FILE` and `LAYER_SOURCE_DIR` that can be consumed
via the CDK `Asset` construct.
Any Lambda Function that uses uses this asset must use a Python 3.x
runtime.
Usage:
```ts
// AwsCliLayer bundles the AWS CLI in a lambda layer
import { ASSET_FILE, LAYER_SOURCE_DIR } from '@aws-cdk/asset-awscli-v1';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as s3_assets from 'aws-cdk-lib/aws-s3-assets';
import { FileSystem } from 'aws-cdk-lib';
declare const fn: lambda.Function;
const asset = new s3_assets.Asset(this, 'layer-asset', {
path: ASSET_FILE,
assetHash: FileSystem.fingerprint(LAYER_SOURCE_DIR),
});
fn.addLayers(new lambda.LayerVersion(this, 'AwsCliLayer', {
code: lambda.Code.fromBucket(asset.bucket, asset.s3ObjectKey),
}));
```
The CLI will be installed under `/opt/awscli/aws`.

View File

@@ -0,0 +1 @@
build.sh

View File

@@ -0,0 +1,59 @@
FROM public.ecr.aws/sam/build-python3.11
RUN mkdir -p /opt
WORKDIR /tmp
#
# tools
#
RUN yum update -y \
&& yum install -y zip unzip wget tar gzip
#
# aws cli
#
COPY requirements.txt ./
RUN python -m pip install -r requirements.txt -t /opt/awscli
#
# Add the LICENSE file
#
COPY LICENSE /opt/awscli/LICENSE
#
# organize for self-contained usage
#
RUN mv /opt/awscli/bin/aws /opt/awscli
#
# cleanup
#
RUN rm -rf \
/opt/awscli/pip* \
/opt/awscli/setuptools* \
&& cd /opt/awscli/awscli/examples \
&& ls | grep -v "global_options.rst" | xargs rm -rf
#
# Test that the CLI works
#
RUN yum install -y groff
RUN /opt/awscli/aws help
#
# create the bundle
#
RUN cd /opt \
&& zip --symlinks -r ../layer.zip * \
&& echo "/layer.zip is ready" \
&& ls -alh /layer.zip;
WORKDIR /
ENTRYPOINT [ "/bin/bash" ]

View File

@@ -0,0 +1,80 @@
# AWS CLI License Information
## AWS CLI - Apache License 2.0
Copyright 2012-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompanying this file. This file 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.
---
## Third-Party Libraries
The following third-party libraries are included in this distribution and are subject to their respective licenses:
1. **Python Requests** (Apache License 2.0)
- Copyright 2012-2020 Kenneth Reitz
- [Requests GitHub](https://github.com/psf/requests)
2. **botocore** (Apache License 2.0)
- Copyright 2012-2020 Amazon.com, Inc. or its affiliates
- [botocore GitHub](https://github.com/boto/botocore)
3. **s3transfer** (Apache License 2.0)
- Copyright 2012-2020 Amazon.com, Inc. or its affiliates
- [s3transfer GitHub](https://github.com/boto/s3transfer)
4. **colorama** (BSD 3-Clause License)
- Copyright (c) 2010 Jonathan Hartley
- [colorama GitHub](https://github.com/tartley/colorama)
5. **dateutil** (Apache License 2.0 and BSD 3-Clause License)
- Copyright 2003-2011 Gustavo Niemeyer <gustavo@niemeyer.net>
- Copyright 2017- Paul Ganssle <paul@ganssle.io>
- [dateutil GitHub](https://github.com/dateutil/dateutil)
6. **docutils** (Python Software Foundation License)
- Copyright 2001-2020 David Goodger
- [docutils GitHub](https://github.com/docutils/docutils)
7. **jmespath** (MIT License)
- Copyright (c) 2013 Amazon.com, Inc. or its affiliates
- [jmespath GitHub](https://github.com/jmespath/jmespath.py)
8. **pyasn1** (BSD 2-Clause License)
- Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
- [pyasn1 GitHub](https://github.com/etingof/pyasn1)
9. **PyYAML** (MIT License)
- Copyright (c) 2017-2021 Ingy döt Net
- Copyright (c) 2006-2016 Kirill Simonov
- [PyYAML GitHub](https://github.com/yaml/pyyaml)
10. **rsa** (MIT License)
- Copyright (c) 2016 Maxim Biro
- [rsa GitHub](https://github.com/sybrenstuvel/python-rsa)
11. **six** (MIT License)
- Copyright (c) 2010-2024 Benjamin Peterson
- [six GitHub](https://github.com/benjaminp/six)
12. **urllib3** (MIT License)
- Copyright (c) 2008-2020 Andrey Petrov and contributors.
- [urllib3 GitHub](https://github.com/urllib3/urllib3)
13. **YAML Framework** (CC-BY 2.0)
- Copyright: 2005-2013, Dirk Jesse
- [YAML Framework Homepage](https://yaml-framework.github.io)
---
For full details on these libraries and the full license text, please refer to their respective repositories or documentation.

28
cdk/node_modules/@aws-cdk/asset-awscli-v1/layer/build.sh generated vendored Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
set -euo pipefail
cd $(dirname $0)
mkdir -p ../lib
echo ">> Building AWS Lambda layer inside a docker image..."
TAG='aws-lambda-layer'
if command -v docker >/dev/null; then
DOCKER=docker
elif command -v finch >/dev/null; then
DOCKER=finch
else
echo "Neither 'docker' nor 'finch' is available!"
exit 1
fi
${DOCKER} build -t ${TAG} .
echo ">> Extracting layer.zip from the build container..."
CONTAINER=$(${DOCKER} run -d ${TAG} -- -c 'sleep 60')
${DOCKER} cp ${CONTAINER}:/layer.zip ../lib/layer.zip
echo ">> Stopping container..."
${DOCKER} rm -f ${CONTAINER}
echo ">> lib/layer.zip is ready"

View File

@@ -0,0 +1,3 @@
awscli==1.44.68
urllib3>=2.6.3,<3.0.0
pyasn1>=0.6.3

View File

@@ -0,0 +1,2 @@
export declare const ASSET_FILE: string;
export declare const LAYER_SOURCE_DIR: string;

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LAYER_SOURCE_DIR = exports.ASSET_FILE = void 0;
const path = require("path");
exports.ASSET_FILE = path.join(__dirname, 'layer.zip');
exports.LAYER_SOURCE_DIR = path.join(__dirname, '..', 'layer');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXdzY2xpLWFzc2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2F3c2NsaS1hc3NldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2QkFBNkI7QUFFaEIsUUFBQSxVQUFVLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsV0FBVyxDQUFDLENBQUM7QUFDL0MsUUFBQSxnQkFBZ0IsR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxJQUFJLEVBQUUsT0FBTyxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBwYXRoIGZyb20gJ3BhdGgnO1xuXG5leHBvcnQgY29uc3QgQVNTRVRfRklMRSA9IHBhdGguam9pbihfX2Rpcm5hbWUsICdsYXllci56aXAnKTtcbmV4cG9ydCBjb25zdCBMQVlFUl9TT1VSQ0VfRElSID0gcGF0aC5qb2luKF9fZGlybmFtZSwgJy4uJywgJ2xheWVyJyk7XG4iXX0=

View File

@@ -0,0 +1 @@
export * from './awscli-asset';

18
cdk/node_modules/@aws-cdk/asset-awscli-v1/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./awscli-asset"), exports);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLGlEQUErQiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vYXdzY2xpLWFzc2V0JztcbiJdfQ==

BIN
cdk/node_modules/@aws-cdk/asset-awscli-v1/lib/layer.zip generated vendored Normal file

Binary file not shown.

165
cdk/node_modules/@aws-cdk/asset-awscli-v1/package.json generated vendored Normal file
View File

@@ -0,0 +1,165 @@
{
"name": "@aws-cdk/asset-awscli-v1",
"description": "A library that contains the AWS CLI for use in Lambda Layers",
"repository": {
"type": "git",
"url": "https://github.com/cdklabs/awscdk-asset-awscli.git"
},
"scripts": {
"build": "npx projen build",
"bump": "npx projen bump",
"clobber": "npx projen clobber",
"compat": "npx projen compat",
"compile": "npx projen compile",
"default": "npx projen default",
"docgen": "npx projen docgen",
"eject": "npx projen eject",
"eslint": "npx projen eslint",
"integ": "npx projen integ",
"integ:update": "npx projen integ:update",
"package": "npx projen package",
"package-all": "npx projen package-all",
"package:dotnet": "npx projen package:dotnet",
"package:go": "npx projen package:go",
"package:java": "npx projen package:java",
"package:js": "npx projen package:js",
"package:python": "npx projen package:python",
"post-compile": "npx projen post-compile",
"post-upgrade": "npx projen post-upgrade",
"pre-compile": "npx projen pre-compile",
"release:awscli-v1/main": "npx projen release:awscli-v1/main",
"rosetta:extract": "npx projen rosetta:extract",
"test": "npx projen test",
"test:watch": "npx projen test:watch",
"unbump": "npx projen unbump",
"upgrade": "npx projen upgrade",
"upgrade-cdklabs-projen-project-types": "npx projen upgrade-cdklabs-projen-project-types",
"upgrade-dev-deps": "npx projen upgrade-dev-deps",
"watch": "npx projen watch",
"projen": "npx projen"
},
"author": {
"name": "Amazon Web Services",
"email": "aws-cdk-dev@amazon.com",
"organization": true
},
"devDependencies": {
"@aws-cdk/integ-runner": "latest",
"@aws-cdk/integ-tests-alpha": "latest",
"@stylistic/eslint-plugin": "^2",
"@types/jest": "^29",
"@types/node": "^16",
"@typescript-eslint/eslint-plugin": "^8",
"@typescript-eslint/parser": "^8",
"aws-cdk-lib": "^2.0.0",
"cdklabs-projen-project-types": "^0.3.12",
"commit-and-tag-version": "^12",
"constructs": "^10.0.5",
"eslint": "^9",
"eslint-import-resolver-typescript": "^3.10.1",
"eslint-plugin-import": "^2.32.0",
"jest": "^29",
"jest-junit": "^16",
"jsii": "^5",
"jsii-diff": "^1.127.0",
"jsii-docgen": "^10.5.0",
"jsii-pacmak": "^1.127.0",
"jsii-rosetta": "^5",
"projen": "^0.98.31",
"ts-jest": "^29",
"ts-node": "^10.9.2",
"typescript": "^5"
},
"keywords": [
"cdk"
],
"main": "lib/index.js",
"license": "Apache-2.0",
"homepage": "https://github.com/cdklabs/awscdk-asset-awscli#readme",
"publishConfig": {
"access": "public"
},
"version": "2.2.273",
"jest": {
"coverageProvider": "v8",
"testMatch": [
"<rootDir>/@(src|test)/**/*(*.)@(spec|test).ts?(x)",
"<rootDir>/@(src|test)/**/__tests__/**/*.ts?(x)",
"<rootDir>/@(projenrc)/**/*(*.)@(spec|test).ts?(x)",
"<rootDir>/@(projenrc)/**/__tests__/**/*.ts?(x)"
],
"clearMocks": true,
"collectCoverage": true,
"coverageReporters": [
"json",
"lcov",
"clover",
"cobertura",
"text"
],
"coverageDirectory": "coverage",
"coveragePathIgnorePatterns": [
"/node_modules/"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"watchPathIgnorePatterns": [
"/node_modules/"
],
"reporters": [
"default",
[
"jest-junit",
{
"outputDirectory": "test-reports"
}
]
],
"transform": {
"^.+\\.[t]sx?$": [
"ts-jest",
{
"tsconfig": "tsconfig.dev.json"
}
]
}
},
"types": "lib/index.d.ts",
"stability": "stable",
"jsii": {
"outdir": "dist",
"targets": {
"java": {
"package": "software.amazon.awscdk.cdk.asset.awscli.v1",
"maven": {
"groupId": "software.amazon.awscdk",
"artifactId": "cdk-asset-awscli-v1"
}
},
"python": {
"distName": "aws-cdk.asset-awscli-v1",
"module": "aws_cdk.asset_awscli_v1"
},
"dotnet": {
"namespace": "Amazon.CDK.Asset.AwsCliV1",
"packageId": "Amazon.CDK.Asset.AwsCliV1"
},
"go": {
"moduleName": "github.com/cdklabs/awscdk-asset-awscli-go",
"packageName": "awscliv1"
}
},
"tsc": {
"outDir": "lib",
"rootDir": "src"
}
},
"jsiiRosetta": {
"exampleDependencies": {
"aws-cdk-lib": "^2.0.0",
"constructs": "^10.0.5"
}
},
"//": "~~ Generated by projen. To modify, edit .projenrc.ts and run \"npx projen\"."
}

View File

@@ -0,0 +1,13 @@
// Fixture with packages imported, but nothing else
import { Construct } from 'constructs';
import {
Stack,
} from 'aws-cdk-lib';
class Fixture extends Stack {
constructor(scope: Construct, id: string) {
super(scope, id);
/// here
}
}

View File

@@ -0,0 +1,64 @@
{
"author": {
"email": "aws-cdk-dev@amazon.com",
"name": "Amazon Web Services",
"organization": true,
"roles": [
"author"
]
},
"description": "@aws-cdk/asset-node-proxy-agent-v6",
"docs": {
"stability": "stable"
},
"homepage": "https://github.com/cdklabs/awscdk-asset-node-proxy-agent#readme",
"jsiiVersion": "5.7.22 (build 1cfeabd)",
"keywords": [
"cdk"
],
"license": "Apache-2.0",
"metadata": {
"jsii": {
"pacmak": {
"hasDefaultInterfaces": true
}
},
"tscRootDir": "src"
},
"name": "@aws-cdk/asset-node-proxy-agent-v6",
"readme": {
"markdown": "# AWS Lambda Layer with the NPM dependency proxy-agent\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)\n\n---\n\n<!--END STABILITY BANNER-->\n\nThis module bundles the NPM dependency [`proxy-agent`](https://www.npmjs.com/package/proxy-agent)\nas a local asset. It exposes constants `ASSET_FILE` and `LAYER_SOURCE_DIR` that can be consumed\nvia the CDK `Asset` construct.\n\n> - proxy-agent Version: 6.3.0\n\nUsage:\n\n```ts\nimport { ASSET_FILE, LAYER_SOURCE_DIR } from '@aws-cdk/asset-node-proxy-agent-v6';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as s3_assets from 'aws-cdk-lib/aws-s3-assets';\nimport { FileSystem } from 'aws-cdk-lib';\n\ndeclare const fn: lambda.Function;\nconst asset = new s3_assets.Asset(this, 'layer-asset', {\n path: ASSET_FILE,\n assetHash: FileSystem.fingerprint(LAYER_SOURCE_DIR),\n});\n\nfn.addLayers(new lambda.LayerVersion(this, 'ProxyAgentLayer', {\n code: lambda.Code.fromBucket(asset.bucket, asset.s3ObjectKey),\n}));\n```\n\n[`proxy-agent`](https://www.npmjs.com/package/proxy-agent) will be installed under `/nodejs/node_modules`.\n"
},
"repository": {
"type": "git",
"url": "https://github.com/cdklabs/awscdk-asset-node-proxy-agent.git"
},
"schema": "jsii/0.10.0",
"targets": {
"dotnet": {
"namespace": "Amazon.CDK.Asset.NodeProxyAgentV6",
"packageId": "Amazon.CDK.Asset.NodeProxyAgentV6"
},
"go": {
"moduleName": "github.com/cdklabs/awscdk-asset-node-proxy-agent-go",
"packageName": "nodeproxyagentv6"
},
"java": {
"maven": {
"artifactId": "cdk-asset-node-proxy-agent-v6",
"groupId": "software.amazon.awscdk"
},
"package": "software.amazon.awscdk.cdk.asset.node.proxy.agent.v6"
},
"js": {
"npm": "@aws-cdk/asset-node-proxy-agent-v6"
},
"python": {
"distName": "aws-cdk.asset-node-proxy-agent-v6",
"module": "aws_cdk.asset_node_proxy_agent_v6"
}
},
"types": {},
"version": "2.1.1",
"fingerprint": "b8Lt1FQJyMmSrYHTbW2NYQjS2oyPVC6zMf2krLZSUBM="
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
opensource-codeofconduct@amazon.com with any additional questions or comments.

View File

@@ -0,0 +1,59 @@
# Contributing Guidelines
Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.
## Reporting Bugs/Feature Requests
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
* A reproducible test case or series of steps
* The version of our code being used
* Any modifications you've made relevant to the bug
* Anything unusual about your environment or deployment
## Contributing via Pull Requests
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
1. You are working against the latest source on the *main* branch.
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
To send us a pull request, please:
1. Fork the repository.
2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
3. Ensure local tests pass.
4. Commit to your fork using clear commit messages.
5. Send us a pull request, answering any default questions in the pull request interface.
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
## Code of Conduct
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
opensource-codeofconduct@amazon.com with any additional questions or comments.
## Security issue notifications
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
## Licensing
See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.

View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://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
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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
http://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.

View File

@@ -0,0 +1 @@
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

View File

@@ -0,0 +1,37 @@
# AWS Lambda Layer with the NPM dependency proxy-agent
<!--BEGIN STABILITY BANNER-->
---
![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)
---
<!--END STABILITY BANNER-->
This module bundles the NPM dependency [`proxy-agent`](https://www.npmjs.com/package/proxy-agent)
as a local asset. It exposes constants `ASSET_FILE` and `LAYER_SOURCE_DIR` that can be consumed
via the CDK `Asset` construct.
> - proxy-agent Version: 6.3.0
Usage:
```ts
import { ASSET_FILE, LAYER_SOURCE_DIR } from '@aws-cdk/asset-node-proxy-agent-v6';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as s3_assets from 'aws-cdk-lib/aws-s3-assets';
import { FileSystem } from 'aws-cdk-lib';
declare const fn: lambda.Function;
const asset = new s3_assets.Asset(this, 'layer-asset', {
path: ASSET_FILE,
assetHash: FileSystem.fingerprint(LAYER_SOURCE_DIR),
});
fn.addLayers(new lambda.LayerVersion(this, 'ProxyAgentLayer', {
code: lambda.Code.fromBucket(asset.bucket, asset.s3ObjectKey),
}));
```
[`proxy-agent`](https://www.npmjs.com/package/proxy-agent) will be installed under `/nodejs/node_modules`.

View File

@@ -0,0 +1 @@
build.sh

View File

@@ -0,0 +1,33 @@
# base lambda image
FROM public.ecr.aws/lambda/nodejs:latest
USER root
RUN mkdir -p /opt
WORKDIR /tmp
#
# tools
#
RUN dnf update -y \
&& dnf install -y zip
#
# install nodejs dependencies: proxy-agent
#
RUN mkdir -p /opt/nodejs
COPY package*.json /opt/nodejs/
RUN cd /opt/nodejs && npm ci && rm package*.json
#
# create the bundle
#
RUN cd /opt \
&& zip --symlinks -r ../layer.zip * \
&& echo "/layer.zip is ready" \
&& ls -alh /layer.zip;
WORKDIR /
ENTRYPOINT [ "/bin/bash" ]

View File

@@ -0,0 +1,20 @@
#!/bin/bash
set -euo pipefail
cd $(dirname $0)
mkdir -p ../lib
echo ">> Building AWS Lambda layer inside a docker image for Proxy Agent..."
TAG='aws-lambda-node-proxy-agent'
docker build -t ${TAG} .
echo ">> Extrating layer.zip from the build container..."
CONTAINER=$(docker run -d ${TAG} false)
docker cp ${CONTAINER}:/layer.zip ../lib/layer.zip
echo ">> Stopping container..."
docker rm -f ${CONTAINER}
echo ">> lib/layer.zip is ready"

View File

@@ -0,0 +1,700 @@
{
"name": "proxy-agent-layer",
"version": "0.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "proxy-agent-layer",
"version": "0.0.0",
"license": "ISC",
"devDependencies": {
"proxy-agent": "^6.4.0"
}
},
"node_modules/@tootallnate/quickjs-emscripten": {
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz",
"integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==",
"dev": true,
"license": "MIT"
},
"node_modules/agent-base": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz",
"integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==",
"dev": true,
"license": "MIT",
"dependencies": {
"debug": "^4.3.4"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/ast-types": {
"version": "0.13.4",
"resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz",
"integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==",
"dev": true,
"license": "MIT",
"dependencies": {
"tslib": "^2.0.1"
},
"engines": {
"node": ">=4"
}
},
"node_modules/basic-ftp": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.2.0.tgz",
"integrity": "sha512-VoMINM2rqJwJgfdHq6RiUudKt2BV+FY5ZFezP/ypmwayk68+NzzAQy4XXLlqsGD4MCzq3DrmNFD/uUmBJuGoXw==",
"dev": true,
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/data-uri-to-buffer": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz",
"integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 14"
}
},
"node_modules/debug": {
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz",
"integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==",
"dev": true,
"license": "MIT",
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/degenerator": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz",
"integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"ast-types": "^0.13.4",
"escodegen": "^2.1.0",
"esprima": "^4.0.1"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/escodegen": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz",
"integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"esprima": "^4.0.1",
"estraverse": "^5.2.0",
"esutils": "^2.0.2"
},
"bin": {
"escodegen": "bin/escodegen.js",
"esgenerate": "bin/esgenerate.js"
},
"engines": {
"node": ">=6.0"
},
"optionalDependencies": {
"source-map": "~0.6.1"
}
},
"node_modules/esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true,
"license": "BSD-2-Clause",
"bin": {
"esparse": "bin/esparse.js",
"esvalidate": "bin/esvalidate.js"
},
"engines": {
"node": ">=4"
}
},
"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,
"license": "BSD-2-Clause",
"engines": {
"node": ">=4.0"
}
},
"node_modules/esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/fs-extra": {
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
"integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
"dev": true,
"license": "MIT",
"dependencies": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"engines": {
"node": ">=14.14"
}
},
"node_modules/get-uri": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.3.tgz",
"integrity": "sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw==",
"dev": true,
"license": "MIT",
"dependencies": {
"basic-ftp": "^5.0.2",
"data-uri-to-buffer": "^6.0.2",
"debug": "^4.3.4",
"fs-extra": "^11.2.0"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/graceful-fs": {
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"dev": true,
"license": "ISC"
},
"node_modules/http-proxy-agent": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
"integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==",
"dev": true,
"license": "MIT",
"dependencies": {
"agent-base": "^7.1.0",
"debug": "^4.3.4"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/https-proxy-agent": {
"version": "7.0.5",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz",
"integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==",
"dev": true,
"license": "MIT",
"dependencies": {
"agent-base": "^7.0.2",
"debug": "4"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/ip-address": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
"integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==",
"dev": true,
"license": "MIT",
"dependencies": {
"jsbn": "1.1.0",
"sprintf-js": "^1.1.3"
},
"engines": {
"node": ">= 12"
}
},
"node_modules/jsbn": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",
"dev": true,
"license": "MIT"
},
"node_modules/jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"universalify": "^2.0.0"
},
"optionalDependencies": {
"graceful-fs": "^4.1.6"
}
},
"node_modules/lru-cache": {
"version": "7.18.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
"integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"dev": true,
"engines": {
"node": ">=12"
}
},
"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,
"license": "MIT"
},
"node_modules/netmask": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz",
"integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/pac-proxy-agent": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.0.2.tgz",
"integrity": "sha512-BFi3vZnO9X5Qt6NRz7ZOaPja3ic0PhlsmCRYLOpN11+mWBCR6XJDqW5RF3j8jm4WGGQZtBA+bTfxYzeKW73eHg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@tootallnate/quickjs-emscripten": "^0.23.0",
"agent-base": "^7.0.2",
"debug": "^4.3.4",
"get-uri": "^6.0.1",
"http-proxy-agent": "^7.0.0",
"https-proxy-agent": "^7.0.5",
"pac-resolver": "^7.0.1",
"socks-proxy-agent": "^8.0.4"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/pac-resolver": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz",
"integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==",
"dev": true,
"license": "MIT",
"dependencies": {
"degenerator": "^5.0.0",
"netmask": "^2.0.2"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/proxy-agent": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.4.0.tgz",
"integrity": "sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"agent-base": "^7.0.2",
"debug": "^4.3.4",
"http-proxy-agent": "^7.0.1",
"https-proxy-agent": "^7.0.3",
"lru-cache": "^7.14.1",
"pac-proxy-agent": "^7.0.1",
"proxy-from-env": "^1.1.0",
"socks-proxy-agent": "^8.0.2"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"dev": true
},
"node_modules/smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
}
},
"node_modules/socks": {
"version": "2.8.3",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
"integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==",
"dev": true,
"license": "MIT",
"dependencies": {
"ip-address": "^9.0.5",
"smart-buffer": "^4.2.0"
},
"engines": {
"node": ">= 10.0.0",
"npm": ">= 3.0.0"
}
},
"node_modules/socks-proxy-agent": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.4.tgz",
"integrity": "sha512-GNAq/eg8Udq2x0eNiFkr9gRg5bA7PXEWagQdeRX4cPSG+X/8V38v637gim9bjFptMk1QWsCTr0ttrJEiXbNnRw==",
"dev": true,
"license": "MIT",
"dependencies": {
"agent-base": "^7.1.1",
"debug": "^4.3.4",
"socks": "^2.8.3"
},
"engines": {
"node": ">= 14"
}
},
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"license": "BSD-3-Clause",
"optional": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/sprintf-js": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
"dev": true,
"license": "BSD-3-Clause"
},
"node_modules/tslib": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz",
"integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==",
"dev": true,
"license": "0BSD"
},
"node_modules/universalify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
"integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 10.0.0"
}
}
},
"dependencies": {
"@tootallnate/quickjs-emscripten": {
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz",
"integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==",
"dev": true
},
"agent-base": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz",
"integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==",
"dev": true,
"requires": {
"debug": "^4.3.4"
}
},
"ast-types": {
"version": "0.13.4",
"resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz",
"integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==",
"dev": true,
"requires": {
"tslib": "^2.0.1"
}
},
"basic-ftp": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.2.0.tgz",
"integrity": "sha512-VoMINM2rqJwJgfdHq6RiUudKt2BV+FY5ZFezP/ypmwayk68+NzzAQy4XXLlqsGD4MCzq3DrmNFD/uUmBJuGoXw==",
"dev": true
},
"data-uri-to-buffer": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz",
"integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==",
"dev": true
},
"debug": {
"version": "4.3.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz",
"integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==",
"dev": true,
"requires": {
"ms": "2.1.2"
}
},
"degenerator": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz",
"integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==",
"dev": true,
"requires": {
"ast-types": "^0.13.4",
"escodegen": "^2.1.0",
"esprima": "^4.0.1"
}
},
"escodegen": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz",
"integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==",
"dev": true,
"requires": {
"esprima": "^4.0.1",
"estraverse": "^5.2.0",
"esutils": "^2.0.2",
"source-map": "~0.6.1"
}
},
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
"estraverse": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
"dev": true
},
"esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"dev": true
},
"fs-extra": {
"version": "11.2.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
"integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
"dev": true,
"requires": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
}
},
"get-uri": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.3.tgz",
"integrity": "sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw==",
"dev": true,
"requires": {
"basic-ftp": "^5.0.2",
"data-uri-to-buffer": "^6.0.2",
"debug": "^4.3.4",
"fs-extra": "^11.2.0"
}
},
"graceful-fs": {
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"dev": true
},
"http-proxy-agent": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
"integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==",
"dev": true,
"requires": {
"agent-base": "^7.1.0",
"debug": "^4.3.4"
}
},
"https-proxy-agent": {
"version": "7.0.5",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz",
"integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==",
"dev": true,
"requires": {
"agent-base": "^7.0.2",
"debug": "4"
}
},
"ip-address": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
"integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==",
"dev": true,
"requires": {
"jsbn": "1.1.0",
"sprintf-js": "^1.1.3"
}
},
"jsbn": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",
"dev": true
},
"jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
}
},
"lru-cache": {
"version": "7.18.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
"integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"dev": true
},
"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
},
"netmask": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz",
"integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==",
"dev": true
},
"pac-proxy-agent": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.0.2.tgz",
"integrity": "sha512-BFi3vZnO9X5Qt6NRz7ZOaPja3ic0PhlsmCRYLOpN11+mWBCR6XJDqW5RF3j8jm4WGGQZtBA+bTfxYzeKW73eHg==",
"dev": true,
"requires": {
"@tootallnate/quickjs-emscripten": "^0.23.0",
"agent-base": "^7.0.2",
"debug": "^4.3.4",
"get-uri": "^6.0.1",
"http-proxy-agent": "^7.0.0",
"https-proxy-agent": "^7.0.5",
"pac-resolver": "^7.0.1",
"socks-proxy-agent": "^8.0.4"
}
},
"pac-resolver": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz",
"integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==",
"dev": true,
"requires": {
"degenerator": "^5.0.0",
"netmask": "^2.0.2"
}
},
"proxy-agent": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.4.0.tgz",
"integrity": "sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==",
"dev": true,
"requires": {
"agent-base": "^7.0.2",
"debug": "^4.3.4",
"http-proxy-agent": "^7.0.1",
"https-proxy-agent": "^7.0.3",
"lru-cache": "^7.14.1",
"pac-proxy-agent": "^7.0.1",
"proxy-from-env": "^1.1.0",
"socks-proxy-agent": "^8.0.2"
}
},
"proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"dev": true
},
"smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
"dev": true
},
"socks": {
"version": "2.8.3",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
"integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==",
"dev": true,
"requires": {
"ip-address": "^9.0.5",
"smart-buffer": "^4.2.0"
}
},
"socks-proxy-agent": {
"version": "8.0.4",
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.4.tgz",
"integrity": "sha512-GNAq/eg8Udq2x0eNiFkr9gRg5bA7PXEWagQdeRX4cPSG+X/8V38v637gim9bjFptMk1QWsCTr0ttrJEiXbNnRw==",
"dev": true,
"requires": {
"agent-base": "^7.1.1",
"debug": "^4.3.4",
"socks": "^2.8.3"
}
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"optional": true
},
"sprintf-js": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
"dev": true
},
"tslib": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz",
"integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==",
"dev": true
},
"universalify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
"integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
"dev": true
}
}
}

View File

@@ -0,0 +1,12 @@
{
"name": "proxy-agent-layer",
"private": true,
"version": "0.0.0",
"description": "",
"devDependencies": {
"proxy-agent": "^6.4.0"
},
"keywords": [],
"author": "",
"license": "ISC"
}

View File

@@ -0,0 +1 @@
export * from './node-proxy-agent-layer';

View File

@@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./node-proxy-agent-layer"), exports);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLDJEQUF5QyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vbm9kZS1wcm94eS1hZ2VudC1sYXllcic7XG4iXX0=

Binary file not shown.

View File

@@ -0,0 +1,3 @@
export declare const ASSET_FILE: string;
export declare const LAYER_SOURCE_DIR: string;
export declare const LAYER_SOURCE: string;

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LAYER_SOURCE = exports.LAYER_SOURCE_DIR = exports.ASSET_FILE = void 0;
const path = require("path");
exports.ASSET_FILE = path.join(__dirname, 'layer.zip');
exports.LAYER_SOURCE_DIR = path.join(__dirname, '..', 'layer');
exports.LAYER_SOURCE = path.join(__dirname, '..', 'layer', 'Dockerfile');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZS1wcm94eS1hZ2VudC1sYXllci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9ub2RlLXByb3h5LWFnZW50LWxheWVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDZCQUE2QjtBQUVoQixRQUFBLFVBQVUsR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxXQUFXLENBQUMsQ0FBQztBQUMvQyxRQUFBLGdCQUFnQixHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLElBQUksRUFBRSxPQUFPLENBQUMsQ0FBQztBQUN2RCxRQUFBLFlBQVksR0FBRyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxJQUFJLEVBQUUsT0FBTyxFQUFFLFlBQVksQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgcGF0aCBmcm9tICdwYXRoJztcblxuZXhwb3J0IGNvbnN0IEFTU0VUX0ZJTEUgPSBwYXRoLmpvaW4oX19kaXJuYW1lLCAnbGF5ZXIuemlwJyk7XG5leHBvcnQgY29uc3QgTEFZRVJfU09VUkNFX0RJUiA9IHBhdGguam9pbihfX2Rpcm5hbWUsICcuLicsICdsYXllcicpO1xuZXhwb3J0IGNvbnN0IExBWUVSX1NPVVJDRSA9IHBhdGguam9pbihfX2Rpcm5hbWUsICcuLicsICdsYXllcicsICdEb2NrZXJmaWxlJyk7XG4iXX0=

View File

@@ -0,0 +1,160 @@
{
"name": "@aws-cdk/asset-node-proxy-agent-v6",
"repository": {
"type": "git",
"url": "https://github.com/cdklabs/awscdk-asset-node-proxy-agent.git"
},
"scripts": {
"build": "npx projen build",
"bump": "npx projen bump",
"clobber": "npx projen clobber",
"compat": "npx projen compat",
"compile": "npx projen compile",
"default": "npx projen default",
"eject": "npx projen eject",
"eslint": "npx projen eslint",
"integ": "npx projen integ",
"integ:update": "npx projen integ:update",
"package": "npx projen package",
"package-all": "npx projen package-all",
"package:dotnet": "npx projen package:dotnet",
"package:go": "npx projen package:go",
"package:java": "npx projen package:java",
"package:js": "npx projen package:js",
"package:python": "npx projen package:python",
"post-compile": "npx projen post-compile",
"post-upgrade": "npx projen post-upgrade",
"pre-compile": "npx projen pre-compile",
"release": "npx projen release",
"rosetta:extract": "npx projen rosetta:extract",
"test": "npx projen test",
"test:watch": "npx projen test:watch",
"unbump": "npx projen unbump",
"upgrade": "npx projen upgrade",
"upgrade-cdklabs-projen-project-types": "npx projen upgrade-cdklabs-projen-project-types",
"upgrade-dev-deps": "npx projen upgrade-dev-deps",
"watch": "npx projen watch",
"projen": "npx projen"
},
"author": {
"name": "Amazon Web Services",
"email": "aws-cdk-dev@amazon.com",
"organization": true
},
"devDependencies": {
"@aws-cdk/integ-runner": "latest",
"@aws-cdk/integ-tests-alpha": "latest",
"@stylistic/eslint-plugin": "^2",
"@types/jest": "^27",
"@types/node": "^18",
"@typescript-eslint/eslint-plugin": "^8",
"@typescript-eslint/parser": "^8",
"aws-cdk-lib": "^2.0.0",
"cdklabs-projen-project-types": "^0.3.7",
"commit-and-tag-version": "^12",
"constructs": "^10.0.5",
"eslint": "^9",
"eslint-import-resolver-typescript": "^3.10.1",
"eslint-plugin-import": "^2.32.0",
"jest": "^27",
"jest-junit": "^16",
"jsii": "~5.7",
"jsii-diff": "^1.126.0",
"jsii-pacmak": "^1.126.0",
"jsii-rosetta": "^5.9.32",
"projen": "^0.98.4",
"ts-jest": "^27",
"ts-node": "^10.9.2",
"typescript": "^4.9.5"
},
"keywords": [
"cdk"
],
"main": "lib/index.js",
"license": "Apache-2.0",
"homepage": "https://github.com/cdklabs/awscdk-asset-node-proxy-agent#readme",
"publishConfig": {
"access": "public"
},
"version": "2.1.1",
"jest": {
"coverageProvider": "v8",
"testMatch": [
"<rootDir>/@(src|test)/**/*(*.)@(spec|test).ts?(x)",
"<rootDir>/@(src|test)/**/__tests__/**/*.ts?(x)",
"<rootDir>/@(projenrc)/**/*(*.)@(spec|test).ts?(x)",
"<rootDir>/@(projenrc)/**/__tests__/**/*.ts?(x)"
],
"clearMocks": true,
"collectCoverage": true,
"coverageReporters": [
"json",
"lcov",
"clover",
"cobertura",
"text"
],
"coverageDirectory": "coverage",
"coveragePathIgnorePatterns": [
"/node_modules/"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"watchPathIgnorePatterns": [
"/node_modules/"
],
"reporters": [
"default",
[
"jest-junit",
{
"outputDirectory": "test-reports"
}
]
],
"preset": "ts-jest",
"globals": {
"ts-jest": {
"tsconfig": "tsconfig.dev.json"
}
}
},
"types": "lib/index.d.ts",
"stability": "stable",
"jsii": {
"outdir": "dist",
"targets": {
"java": {
"package": "software.amazon.awscdk.cdk.asset.node.proxy.agent.v6",
"maven": {
"groupId": "software.amazon.awscdk",
"artifactId": "cdk-asset-node-proxy-agent-v6"
}
},
"python": {
"distName": "aws-cdk.asset-node-proxy-agent-v6",
"module": "aws_cdk.asset_node_proxy_agent_v6"
},
"dotnet": {
"namespace": "Amazon.CDK.Asset.NodeProxyAgentV6",
"packageId": "Amazon.CDK.Asset.NodeProxyAgentV6"
},
"go": {
"moduleName": "github.com/cdklabs/awscdk-asset-node-proxy-agent-go",
"packageName": "nodeproxyagentv6"
}
},
"tsc": {
"outDir": "lib",
"rootDir": "src"
}
},
"jsiiRosetta": {
"exampleDependencies": {
"aws-cdk-lib": "^2.0.0",
"constructs": "^10.0.5"
}
},
"//": "~~ Generated by projen. To modify, edit .projenrc.ts and run \"npx projen\"."
}

View File

@@ -0,0 +1,13 @@
// Fixture with packages imported, but nothing else
import { Construct } from 'constructs';
import {
Stack,
} from 'aws-cdk-lib';
class Fixture extends Stack {
constructor(scope: Construct, id: string) {
super(scope, id);
/// here
}
}

6203
cdk/node_modules/@aws-cdk/cloud-assembly-schema/.jsii generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
# ~~ Generated by projen. To modify, edit .projenrc.js and run "yarn projen".
{}

View File

@@ -0,0 +1,66 @@
## Cloud Assembly Schema
Making changes to this module should only happen when you introduce new cloud assembly capabilities.
> For example: supporting the `--target` option when building docker containers.
If you decided these changes are necessary, simply go ahead and make the necessary modifications to
the interfaces that describe the schema. Our tests and validation mechanisms will ensure you make those
changes correctly.
### Module Structure
There are two main things to understand about the files in this module:
- [`lib/manifest.ts`](./lib/manifest.ts)
This is the typescript code that defines our schema. It is solely comprised of structs (property only interfaces).
It directly maps to the way we want manifest files to be stored on disk. When you want to make changes to the schema,
this is the file you should be editing.
- [`lib/schema`](./schema/)
This directory contains the generated json [schema](./schema/cloud-assembly.schema.json) from the aforementioned
typescript code. It also contains a [version](./schema/cloud-assembly.version.json) file that holds the current version
of the schema. These files are **not** intended for manual editing. Keep reading to understand how they change and when.
### Schema Generation
The schema can be generated by running `yarn update-schema`. It reads the [`manifest.ts`](./lib/manifest.ts) file and writes
an updated json schema to [`cloud-assembly.schema.json`](./schema/cloud-assembly.schema.json). This command is run as part of
the build but can also be called separately.
If changes to the code are performed, without generating a new schema, the tests will fail:
```console
$ yarn test
FAIL test/schema.test.js (5.902s)
✓ manifest save (7ms)
✕ cloud-assembly.json.schema is correct (5304ms)
✓ manifest load (4ms)
✓ manifest load fails for invalid nested property (5ms)
✓ manifest load fails for invalid artifact type (1ms)
✓ stack-tags are deserialized properly (1ms)
✓ can access random metadata (1ms)
● cloud-assembly.json.schema is correct
Whoops, Looks like the schema has changed. Did you forget to run 'yarn update-schema'?
```
### Schema Validation
Being a **stable** `jsii` module, it undergoes strict API compatibility checks with the help
of [`jsii-diff`](https://github.com/aws/jsii/tree/master/packages/jsii-diff).
This means that breaking changes will be rejected. These include:
- Adding a required property. (same as changing from _optional_ to _required_)
- Changing the type of the property.
In addition, the interfaces defined here are programmatically exposed to users, via the `manifest`
property of the [`CloudAssembly`](../cx-api/lib/cloud-assembly.ts) class. This means that the following are
also considered breaking changes:
- Changing a property from _required_ to _optional_.
- Removing an optional property.
- Removing a required property.

202
cdk/node_modules/@aws-cdk/cloud-assembly-schema/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://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
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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
http://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.

46
cdk/node_modules/@aws-cdk/cloud-assembly-schema/NOTICE generated vendored Normal file
View File

@@ -0,0 +1,46 @@
AWS Cloud Development Kit (AWS CDK)
Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-------------------------------------------------------------------------------
The AWS CDK includes the following third-party software/licensing:
** jsonschema - https://www.npmjs.com/package/jsonschema
Copyright (C) 2012-2015 Tom de Grunt <tom@degrunt.nl>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
----------------
** semver - https://www.npmjs.com/package/semver
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
----------------

View File

@@ -0,0 +1,53 @@
# Cloud Assembly Schema
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.
## Cloud Assembly
The _Cloud Assembly_ is the output of the synthesis operation. It is produced as part of the
[`cdk synth`](https://github.com/aws/aws-cdk-cli/tree/main/packages/aws-cdk#cdk-synthesize)
command, or the [`app.synth()`](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/core/lib/stage.ts#L219) method invocation.
Its essentially a set of files and directories, one of which is the `manifest.json` file. It defines the set of instructions that are
needed in order to deploy the assembly directory.
> For example, when `cdk deploy` is executed, the CLI reads this file and performs its instructions:
>
> - Build container images.
> - Upload assets.
> - Deploy CloudFormation templates.
Therefore, the assembly is how the CDK class library and CDK CLI (or any other consumer) communicate. To ensure compatibility
between the assembly and its consumers, we treat the manifest file as a well defined, versioned schema.
## Schema
This module contains the typescript structs that comprise the `manifest.json` file, as well as the
generated [_json-schema_](./schema/cloud-assembly.schema.json).
## Versioning
The schema version is specified my the major version of the package release. It follows semantic versioning, but with a small twist.
When we add instructions to the assembly, they are reflected in the manifest file and the _json-schema_ accordingly.
Every such instruction, is crucial for ensuring the correct deployment behavior. This means that to properly deploy a cloud assembly,
consumers must be aware of every such instruction modification.
For this reason, every change to the schema, even though it might not strictly break validation of the _json-schema_ format,
is considered `major` version bump. All changes that do not impact the schema are considered a `minor` version bump.
## How to consume
If you'd like to consume the [schema file](./schema/cloud-assembly.schema.json) in order to do validations on `manifest.json` files,
simply download it from this repo and run it against standard _json-schema_ validators, such as [jsonschema](https://www.npmjs.com/package/jsonschema).
Consumers must take into account the `major` version of the schema they are consuming. They should reject cloud assemblies
with a `major` version that is higher than what they expect. While schema validation might pass on such assemblies, the deployment integrity
cannot be guaranteed because some instructions will be ignored.
> For example, if your consumer was built when the schema version was 2.0.0, you should reject deploying cloud assemblies with a
> manifest version of 3.0.0.
## Contributing
See [Contribution Guide](./CONTRIBUTING.md)

View File

@@ -0,0 +1 @@
{"version":"2.1120.0"}

View File

@@ -0,0 +1,35 @@
/**
* Destination for assets that need to be uploaded to AWS
*/
export interface AwsDestination {
/**
* The region where this asset will need to be published
*
* @default - Current region
*/
readonly region?: string;
/**
* The role that needs to be assumed while publishing this asset
*
* @default - No role will be assumed
*/
readonly assumeRoleArn?: string;
/**
* The ExternalId that needs to be supplied while assuming this role
*
* @default - No ExternalId will be supplied
*/
readonly assumeRoleExternalId?: string;
/**
* Additional options to pass to STS when assuming the role.
*
* - `RoleArn` should not be used. Use the dedicated `assumeRoleArn` property instead.
* - `ExternalId` should not be used. Use the dedicated `assumeRoleExternalId` instead.
*
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/STS.html#assumeRole-property
* @default - No additional options.
*/
readonly assumeRoleAdditionalOptions?: {
[key: string]: any;
};
}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXdzLWRlc3RpbmF0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiYXdzLWRlc3RpbmF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIERlc3RpbmF0aW9uIGZvciBhc3NldHMgdGhhdCBuZWVkIHRvIGJlIHVwbG9hZGVkIHRvIEFXU1xuICovXG5leHBvcnQgaW50ZXJmYWNlIEF3c0Rlc3RpbmF0aW9uIHtcbiAgLyoqXG4gICAqIFRoZSByZWdpb24gd2hlcmUgdGhpcyBhc3NldCB3aWxsIG5lZWQgdG8gYmUgcHVibGlzaGVkXG4gICAqXG4gICAqIEBkZWZhdWx0IC0gQ3VycmVudCByZWdpb25cbiAgICovXG4gIHJlYWRvbmx5IHJlZ2lvbj86IHN0cmluZztcblxuICAvKipcbiAgICogVGhlIHJvbGUgdGhhdCBuZWVkcyB0byBiZSBhc3N1bWVkIHdoaWxlIHB1Ymxpc2hpbmcgdGhpcyBhc3NldFxuICAgKlxuICAgKiBAZGVmYXVsdCAtIE5vIHJvbGUgd2lsbCBiZSBhc3N1bWVkXG4gICAqL1xuICByZWFkb25seSBhc3N1bWVSb2xlQXJuPzogc3RyaW5nO1xuXG4gIC8qKlxuICAgKiBUaGUgRXh0ZXJuYWxJZCB0aGF0IG5lZWRzIHRvIGJlIHN1cHBsaWVkIHdoaWxlIGFzc3VtaW5nIHRoaXMgcm9sZVxuICAgKlxuICAgKiBAZGVmYXVsdCAtIE5vIEV4dGVybmFsSWQgd2lsbCBiZSBzdXBwbGllZFxuICAgKi9cbiAgcmVhZG9ubHkgYXNzdW1lUm9sZUV4dGVybmFsSWQ/OiBzdHJpbmc7XG5cbiAgLyoqXG4gICAqIEFkZGl0aW9uYWwgb3B0aW9ucyB0byBwYXNzIHRvIFNUUyB3aGVuIGFzc3VtaW5nIHRoZSByb2xlLlxuICAgKlxuICAgKiAtIGBSb2xlQXJuYCBzaG91bGQgbm90IGJlIHVzZWQuIFVzZSB0aGUgZGVkaWNhdGVkIGBhc3N1bWVSb2xlQXJuYCBwcm9wZXJ0eSBpbnN0ZWFkLlxuICAgKiAtIGBFeHRlcm5hbElkYCBzaG91bGQgbm90IGJlIHVzZWQuIFVzZSB0aGUgZGVkaWNhdGVkIGBhc3N1bWVSb2xlRXh0ZXJuYWxJZGAgaW5zdGVhZC5cbiAgICpcbiAgICogQHNlZSBodHRwczovL2RvY3MuYXdzLmFtYXpvbi5jb20vQVdTSmF2YVNjcmlwdFNESy9sYXRlc3QvQVdTL1NUUy5odG1sI2Fzc3VtZVJvbGUtcHJvcGVydHlcbiAgICogQGRlZmF1bHQgLSBObyBhZGRpdGlvbmFsIG9wdGlvbnMuXG4gICAqL1xuICByZWFkb25seSBhc3N1bWVSb2xlQWRkaXRpb25hbE9wdGlvbnM/OiB7IFtrZXk6IHN0cmluZ106IGFueSB9O1xufVxuIl19

View File

@@ -0,0 +1,181 @@
import type { AwsDestination } from './aws-destination';
/**
* A file asset
*/
export interface DockerImageAsset {
/**
* A display name for this asset
*
* @default - The identifier will be used as the display name
*/
readonly displayName?: string;
/**
* Source description for container assets
*/
readonly source: DockerImageSource;
/**
* Destinations for this container asset
*/
readonly destinations: {
[id: string]: DockerImageDestination;
};
}
/**
* Properties for how to produce a Docker image from a source
*/
export interface DockerImageSource {
/**
* The directory containing the Docker image build instructions.
*
* This path is relative to the asset manifest location.
*
* @default - Exactly one of `directory` and `executable` is required
*/
readonly directory?: string;
/**
* A command-line executable that returns the name of a local
* Docker image on stdout after being run.
*
* @default - Exactly one of `directory` and `executable` is required
*/
readonly executable?: string[];
/**
* The name of the file with build instructions
*
* Only allowed when `directory` is set.
*
* @default "Dockerfile"
*/
readonly dockerFile?: string;
/**
* Target build stage in a Dockerfile with multiple build stages
*
* Only allowed when `directory` is set.
*
* @default - The last stage in the Dockerfile
*/
readonly dockerBuildTarget?: string;
/**
* Additional build arguments
*
* Only allowed when `directory` is set.
*
* @default - No additional build arguments
*/
readonly dockerBuildArgs?: {
[name: string]: string;
};
/**
* Additional build contexts
*
* Only allowed when `directory` is set.
*
* @default - No additional build contexts
*/
readonly dockerBuildContexts?: {
[name: string]: string;
};
/**
* SSH agent socket or keys
*
* Requires building with docker buildkit.
*
* @default - No ssh flag is set
*/
readonly dockerBuildSsh?: string;
/**
* Additional build secrets
*
* Only allowed when `directory` is set.
*
* @default - No additional build secrets
*/
readonly dockerBuildSecrets?: {
[name: string]: string;
};
/**
* Networking mode for the RUN commands during build. _Requires Docker Engine API v1.25+_.
*
* Specify this property to build images on a specific networking mode.
*
* @default - no networking mode specified
*/
readonly networkMode?: string;
/**
* Platform to build for. _Requires Docker Buildx_.
*
* Specify this property to build images on a specific platform/architecture.
*
* @default - current machine platform
*/
readonly platform?: string;
/**
* Outputs
*
* @default - no outputs are passed to the build command (default outputs are used)
* @see https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs
*/
readonly dockerOutputs?: string[];
/**
* Cache from options to pass to the `docker build` command.
*
* @default - no cache from options are passed to the build command
* @see https://docs.docker.com/build/cache/backends/
*/
readonly cacheFrom?: DockerCacheOption[];
/**
* Cache to options to pass to the `docker build` command.
*
* @default - no cache to options are passed to the build command
* @see https://docs.docker.com/build/cache/backends/
*/
readonly cacheTo?: DockerCacheOption;
/**
* Disable the cache and pass `--no-cache` to the `docker build` command.
*
* @default - cache is used
*/
readonly cacheDisabled?: boolean;
}
/**
* Where to publish docker images
*/
export interface DockerImageDestination extends AwsDestination {
/**
* Name of the ECR repository to publish to
*/
readonly repositoryName: string;
/**
* Tag of the image to publish
*/
readonly imageTag: string;
}
/**
* Options for configuring the Docker cache backend
*/
export interface DockerCacheOption {
/**
* The type of cache to use.
* Refer to https://docs.docker.com/build/cache/backends/ for full list of backends.
* @default - unspecified
*
* @example 'registry'
*/
readonly type: string;
/**
* Any parameters to pass into the docker cache backend configuration.
* Refer to https://docs.docker.com/build/cache/backends/ for cache backend configuration.
* @default {} No options provided
*
* @example
* declare const branch: string;
*
* const params = {
* ref: `12345678.dkr.ecr.us-west-2.amazonaws.com/cache:${branch}`,
* mode: "max",
* };
*/
readonly params?: {
[key: string]: string;
};
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,75 @@
import type { AwsDestination } from './aws-destination';
/**
* A file asset
*/
export interface FileAsset {
/**
* A display name for this asset
*
* @default - The identifier will be used as the display name
*/
readonly displayName?: string;
/**
* Source description for file assets
*/
readonly source: FileSource;
/**
* Destinations for this file asset
*/
readonly destinations: {
[id: string]: FileDestination;
};
}
/**
* Packaging strategy for file assets
*/
export declare enum FileAssetPackaging {
/**
* Upload the given path as a file
*/
FILE = "file",
/**
* The given path is a directory, zip it and upload
*/
ZIP_DIRECTORY = "zip"
}
/**
* Describe the source of a file asset
*/
export interface FileSource {
/**
* External command which will produce the file asset to upload.
*
* @default - Exactly one of `executable` and `path` is required.
*/
readonly executable?: string[];
/**
* The filesystem object to upload
*
* This path is relative to the asset manifest location.
*
* @default - Exactly one of `executable` and `path` is required.
*/
readonly path?: string;
/**
* Packaging method
*
* Only allowed when `path` is specified.
*
* @default FILE
*/
readonly packaging?: FileAssetPackaging;
}
/**
* Where in S3 a file asset needs to be published
*/
export interface FileDestination extends AwsDestination {
/**
* The name of the bucket
*/
readonly bucketName: string;
/**
* The destination object key
*/
readonly objectKey: string;
}

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FileAssetPackaging = void 0;
/**
* Packaging strategy for file assets
*/
var FileAssetPackaging;
(function (FileAssetPackaging) {
/**
* Upload the given path as a file
*/
FileAssetPackaging["FILE"] = "file";
/**
* The given path is a directory, zip it and upload
*/
FileAssetPackaging["ZIP_DIRECTORY"] = "zip";
})(FileAssetPackaging || (exports.FileAssetPackaging = FileAssetPackaging = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZS1hc3NldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZpbGUtYXNzZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBd0JBOztHQUVHO0FBQ0gsSUFBWSxrQkFVWDtBQVZELFdBQVksa0JBQWtCO0lBQzVCOztPQUVHO0lBQ0gsbUNBQWEsQ0FBQTtJQUViOztPQUVHO0lBQ0gsMkNBQXFCLENBQUE7QUFDdkIsQ0FBQyxFQVZXLGtCQUFrQixrQ0FBbEIsa0JBQWtCLFFBVTdCIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBBd3NEZXN0aW5hdGlvbiB9IGZyb20gJy4vYXdzLWRlc3RpbmF0aW9uJztcblxuLyoqXG4gKiBBIGZpbGUgYXNzZXRcbiAqL1xuZXhwb3J0IGludGVyZmFjZSBGaWxlQXNzZXQge1xuICAvKipcbiAgICogQSBkaXNwbGF5IG5hbWUgZm9yIHRoaXMgYXNzZXRcbiAgICpcbiAgICogQGRlZmF1bHQgLSBUaGUgaWRlbnRpZmllciB3aWxsIGJlIHVzZWQgYXMgdGhlIGRpc3BsYXkgbmFtZVxuICAgKi9cbiAgcmVhZG9ubHkgZGlzcGxheU5hbWU/OiBzdHJpbmc7XG5cbiAgLyoqXG4gICAqIFNvdXJjZSBkZXNjcmlwdGlvbiBmb3IgZmlsZSBhc3NldHNcbiAgICovXG4gIHJlYWRvbmx5IHNvdXJjZTogRmlsZVNvdXJjZTtcblxuICAvKipcbiAgICogRGVzdGluYXRpb25zIGZvciB0aGlzIGZpbGUgYXNzZXRcbiAgICovXG4gIHJlYWRvbmx5IGRlc3RpbmF0aW9uczogeyBbaWQ6IHN0cmluZ106IEZpbGVEZXN0aW5hdGlvbiB9O1xufVxuXG4vKipcbiAqIFBhY2thZ2luZyBzdHJhdGVneSBmb3IgZmlsZSBhc3NldHNcbiAqL1xuZXhwb3J0IGVudW0gRmlsZUFzc2V0UGFja2FnaW5nIHtcbiAgLyoqXG4gICAqIFVwbG9hZCB0aGUgZ2l2ZW4gcGF0aCBhcyBhIGZpbGVcbiAgICovXG4gIEZJTEUgPSAnZmlsZScsXG5cbiAgLyoqXG4gICAqIFRoZSBnaXZlbiBwYXRoIGlzIGEgZGlyZWN0b3J5LCB6aXAgaXQgYW5kIHVwbG9hZFxuICAgKi9cbiAgWklQX0RJUkVDVE9SWSA9ICd6aXAnLFxufVxuXG4vKipcbiAqIERlc2NyaWJlIHRoZSBzb3VyY2Ugb2YgYSBmaWxlIGFzc2V0XG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgRmlsZVNvdXJjZSB7XG4gIC8qKlxuICAgKiBFeHRlcm5hbCBjb21tYW5kIHdoaWNoIHdpbGwgcHJvZHVjZSB0aGUgZmlsZSBhc3NldCB0byB1cGxvYWQuXG4gICAqXG4gICAqIEBkZWZhdWx0IC0gRXhhY3RseSBvbmUgb2YgYGV4ZWN1dGFibGVgIGFuZCBgcGF0aGAgaXMgcmVxdWlyZWQuXG4gICAqL1xuICByZWFkb25seSBleGVjdXRhYmxlPzogc3RyaW5nW107XG5cbiAgLyoqXG4gICAqIFRoZSBmaWxlc3lzdGVtIG9iamVjdCB0byB1cGxvYWRcbiAgICpcbiAgICogVGhpcyBwYXRoIGlzIHJlbGF0aXZlIHRvIHRoZSBhc3NldCBtYW5pZmVzdCBsb2NhdGlvbi5cbiAgICpcbiAgICogQGRlZmF1bHQgLSBFeGFjdGx5IG9uZSBvZiBgZXhlY3V0YWJsZWAgYW5kIGBwYXRoYCBpcyByZXF1aXJlZC5cbiAgICovXG4gIHJlYWRvbmx5IHBhdGg/OiBzdHJpbmc7XG5cbiAgLyoqXG4gICAqIFBhY2thZ2luZyBtZXRob2RcbiAgICpcbiAgICogT25seSBhbGxvd2VkIHdoZW4gYHBhdGhgIGlzIHNwZWNpZmllZC5cbiAgICpcbiAgICogQGRlZmF1bHQgRklMRVxuICAgKi9cbiAgcmVhZG9ubHkgcGFja2FnaW5nPzogRmlsZUFzc2V0UGFja2FnaW5nO1xufVxuXG4vKipcbiAqIFdoZXJlIGluIFMzIGEgZmlsZSBhc3NldCBuZWVkcyB0byBiZSBwdWJsaXNoZWRcbiAqL1xuZXhwb3J0IGludGVyZmFjZSBGaWxlRGVzdGluYXRpb24gZXh0ZW5kcyBBd3NEZXN0aW5hdGlvbiB7XG4gIC8qKlxuICAgKiBUaGUgbmFtZSBvZiB0aGUgYnVja2V0XG4gICAqL1xuICByZWFkb25seSBidWNrZXROYW1lOiBzdHJpbmc7XG5cbiAgLyoqXG4gICAqIFRoZSBkZXN0aW5hdGlvbiBvYmplY3Qga2V5XG4gICAqL1xuICByZWFkb25seSBvYmplY3RLZXk6IHN0cmluZztcbn1cbiJdfQ==

View File

@@ -0,0 +1,4 @@
export * from './schema';
export * from './docker-image-asset';
export * from './file-asset';
export * from './aws-destination';

View File

@@ -0,0 +1,21 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./schema"), exports);
__exportStar(require("./docker-image-asset"), exports);
__exportStar(require("./file-asset"), exports);
__exportStar(require("./aws-destination"), exports);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkNBQXlCO0FBQ3pCLHVEQUFxQztBQUNyQywrQ0FBNkI7QUFDN0Isb0RBQWtDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9zY2hlbWEnO1xuZXhwb3J0ICogZnJvbSAnLi9kb2NrZXItaW1hZ2UtYXNzZXQnO1xuZXhwb3J0ICogZnJvbSAnLi9maWxlLWFzc2V0JztcbmV4cG9ydCAqIGZyb20gJy4vYXdzLWRlc3RpbmF0aW9uJztcbiJdfQ==

View File

@@ -0,0 +1,27 @@
import type { DockerImageAsset } from './docker-image-asset';
import type { FileAsset } from './file-asset';
/**
* Definitions for the asset manifest
*/
export interface AssetManifest {
/**
* Version of the manifest
*/
readonly version: string;
/**
* The file assets in this manifest
*
* @default - No files
*/
readonly files?: {
[id: string]: FileAsset;
};
/**
* The Docker image assets in this manifest
*
* @default - No Docker images
*/
readonly dockerImages?: {
[id: string]: DockerImageAsset;
};
}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NoZW1hLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsic2NoZW1hLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IERvY2tlckltYWdlQXNzZXQgfSBmcm9tICcuL2RvY2tlci1pbWFnZS1hc3NldCc7XG5pbXBvcnQgdHlwZSB7IEZpbGVBc3NldCB9IGZyb20gJy4vZmlsZS1hc3NldCc7XG5cbi8qKlxuICogRGVmaW5pdGlvbnMgZm9yIHRoZSBhc3NldCBtYW5pZmVzdFxuICovXG5leHBvcnQgaW50ZXJmYWNlIEFzc2V0TWFuaWZlc3Qge1xuICAvKipcbiAgICogVmVyc2lvbiBvZiB0aGUgbWFuaWZlc3RcbiAgICovXG4gIHJlYWRvbmx5IHZlcnNpb246IHN0cmluZztcblxuICAvKipcbiAgICogVGhlIGZpbGUgYXNzZXRzIGluIHRoaXMgbWFuaWZlc3RcbiAgICpcbiAgICogQGRlZmF1bHQgLSBObyBmaWxlc1xuICAgKi9cbiAgcmVhZG9ubHkgZmlsZXM/OiB7IFtpZDogc3RyaW5nXTogRmlsZUFzc2V0IH07XG5cbiAgLyoqXG4gICAqIFRoZSBEb2NrZXIgaW1hZ2UgYXNzZXRzIGluIHRoaXMgbWFuaWZlc3RcbiAgICpcbiAgICogQGRlZmF1bHQgLSBObyBEb2NrZXIgaW1hZ2VzXG4gICAqL1xuICByZWFkb25seSBkb2NrZXJJbWFnZXM/OiB7IFtpZDogc3RyaW5nXTogRG9ja2VySW1hZ2VBc3NldCB9O1xufVxuIl19

View File

@@ -0,0 +1,301 @@
/**
* Information needed to access an IAM role created
* as part of the bootstrap process
*/
export interface BootstrapRole {
/**
* The ARN of the IAM role created as part of bootrapping
* e.g. lookupRoleArn
*/
readonly arn: string;
/**
* External ID to use when assuming the bootstrap role
*
* @default - No external ID
*/
readonly assumeRoleExternalId?: string;
/**
* Additional options to pass to STS when assuming the role.
*
* - `RoleArn` should not be used. Use the dedicated `arn` property instead.
* - `ExternalId` should not be used. Use the dedicated `assumeRoleExternalId` instead.
*
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/STS.html#assumeRole-property
* @default - No additional options.
*/
readonly assumeRoleAdditionalOptions?: {
[key: string]: any;
};
/**
* Version of bootstrap stack required to use this role
*
* @default - No bootstrap stack required
*/
readonly requiresBootstrapStackVersion?: number;
/**
* Name of SSM parameter with bootstrap stack version
*
* @default - Discover SSM parameter by reading stack
*/
readonly bootstrapStackVersionSsmParameter?: string;
}
/**
* Artifact properties for CloudFormation stacks.
*/
export interface AwsCloudFormationStackProperties {
/**
* A file relative to the assembly root which contains the CloudFormation template for this stack.
*/
readonly templateFile: string;
/**
* Values for CloudFormation stack parameters that should be passed when the stack is deployed.
*
* @default - No parameters
*/
readonly parameters?: {
[id: string]: string;
};
/**
* Values for CloudFormation stack tags that should be passed when the stack is deployed.
*
* N.B.: Tags are also written to stack metadata, under the path of the Stack
* construct. Only in CDK CLI v1 are those tags found in metadata used for
* actual deployments; in all stable versions of CDK only the stack tags
* directly found in the `tags` property of `AwsCloudFormationStack` artifact
* (i.e., this property) are used.
*
* @default - No tags
*/
readonly tags?: {
[id: string]: string;
};
/**
* SNS Notification ARNs that should receive CloudFormation Stack Events.
*
* @default - No notification arns
*/
readonly notificationArns?: string[];
/**
* The name to use for the CloudFormation stack.
* @default - name derived from artifact ID
*/
readonly stackName?: string;
/**
* Whether to enable termination protection for this stack.
*
* @default false
*/
readonly terminationProtection?: boolean;
/**
* The role that needs to be assumed to deploy the stack
*
* @default - No role is assumed (current credentials are used)
*/
readonly assumeRoleArn?: string;
/**
* External ID to use when assuming role for cloudformation deployments
*
* @default - No external ID
*/
readonly assumeRoleExternalId?: string;
/**
* Additional options to pass to STS when assuming the role.
*
* - `RoleArn` should not be used. Use the dedicated `assumeRoleArn` property instead.
* - `ExternalId` should not be used. Use the dedicated `assumeRoleExternalId` instead.
*
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/STS.html#assumeRole-property
* @default - No additional options.
*/
readonly assumeRoleAdditionalOptions?: {
[key: string]: any;
};
/**
* The role that is passed to CloudFormation to execute the change set
*
* @default - No role is passed (currently assumed role/credentials are used)
*/
readonly cloudFormationExecutionRoleArn?: string;
/**
* The role to use to look up values from the target AWS account
*
* @default - No role is assumed (current credentials are used)
*/
readonly lookupRole?: BootstrapRole;
/**
* If the stack template has already been included in the asset manifest, its asset URL
*
* @default - Not uploaded yet, upload just before deploying
*/
readonly stackTemplateAssetObjectUrl?: string;
/**
* Version of bootstrap stack required to deploy this stack
*
* @default - No bootstrap stack required
*/
readonly requiresBootstrapStackVersion?: number;
/**
* SSM parameter where the bootstrap stack version number can be found
*
* Only used if `requiresBootstrapStackVersion` is set.
*
* - If this value is not set, the bootstrap stack name must be known at
* deployment time so the stack version can be looked up from the stack
* outputs.
* - If this value is set, the bootstrap stack can have any name because
* we won't need to look it up.
*
* @default - Bootstrap stack version number looked up
*/
readonly bootstrapStackVersionSsmParameter?: string;
/**
* Whether this stack should be validated by the CLI after synthesis
*
* @default - false
*/
readonly validateOnSynth?: boolean;
}
/**
* Configuration options for the Asset Manifest
*/
export interface AssetManifestOptions {
/**
* Version of bootstrap stack required to deploy this stack
*
* @default - Version 1 (basic modern bootstrap stack)
*/
readonly requiresBootstrapStackVersion?: number;
/**
* SSM parameter where the bootstrap stack version number can be found
*
* - If this value is not set, the bootstrap stack name must be known at
* deployment time so the stack version can be looked up from the stack
* outputs.
* - If this value is set, the bootstrap stack can have any name because
* we won't need to look it up.
*
* @default - Bootstrap stack version number looked up
*/
readonly bootstrapStackVersionSsmParameter?: string;
}
/**
* Artifact properties for the Asset Manifest
*/
export interface AssetManifestProperties extends AssetManifestOptions {
/**
* Filename of the asset manifest
*/
readonly file: string;
}
/**
* Artifact properties for the Construct Tree Artifact
*/
export interface TreeArtifactProperties {
/**
* Filename of the tree artifact
*/
readonly file: string;
}
/**
* Artifact properties for nested cloud assemblies
*/
export interface NestedCloudAssemblyProperties {
/**
* Relative path to the nested cloud assembly
*/
readonly directoryName: string;
/**
* Display name for the cloud assembly
*
* @default - The artifact ID
*/
readonly displayName?: string;
}
/**
* Artifact properties for a feature flag report
*
* A feature flag report is small enough that all the properties can be inlined
* here, and doesn't need an additional file.
*/
export interface FeatureFlagReportProperties {
/**
* The library that this feature flag report applies to.
*/
readonly module: string;
/**
* Information about every feature flag supported by this library.
*/
readonly flags: {
[flagName: string]: FeatureFlag;
};
}
/**
* A single feature flag
*/
export interface FeatureFlag {
/**
* The library-recommended value for this flag, if any
*
* It is possible that there is no recommended value.
*
* @default - No recommended value.
*/
readonly recommendedValue?: any;
/**
* The value configured by the user
*
* This is the value configured at the root of the tree. Users may also have
* configured values at specific locations in the tree; we don't report on
* those.
*
* @default - Not configured by the user
*/
readonly userValue?: any;
/**
* Explanation about the purpose of this flag that can be shown to the user.
*
* @default - No description
*/
readonly explanation?: string;
/**
* The value of the flag that produces the same behavior as when the flag is not configured at all
*
*The structure of this field is a historical accident. The type of this field
*should have been boolean, which should have contained the default value for
*the flag appropriate for the *current* version of the CDK library. We are
*not rectifying this accident because doing so
*
* Instead, the canonical way to access this value is by evaluating
* `unconfiguredBehavesLike?.v2 ?? false`.
*
* @default false
*/
readonly unconfiguredBehavesLike?: UnconfiguredBehavesLike;
}
export interface UnconfiguredBehavesLike {
/**
* Historical accident, don't use.
*
* This value may be present, but it should never be used. The actual value is
* in the `v2` field, regardless of the version of the CDK library.
*
* @default - ignore
*/
readonly v1?: any;
/**
* The value of the flag that produces the same behavior as when the flag is not configured at all
*
* Even though it is called 'v2', this is the official name of this field. In
* any future versions of CDK (v3, v4, ...), this field will still be called 'v2'.
*
* The structure of this field is a historical accident. See the comment on
* `unconfiguredBehavesLike` for more information.
*
* @default false
*/
readonly v2?: any;
}
/**
* Properties for manifest artifacts
*/
export type ArtifactProperties = AwsCloudFormationStackProperties | AssetManifestProperties | TreeArtifactProperties | NestedCloudAssemblyProperties | FeatureFlagReportProperties;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,462 @@
import type { Tag } from './metadata-schema';
/**
* Identifier for the context provider
*/
export declare enum ContextProvider {
/**
* AMI provider
*/
AMI_PROVIDER = "ami",
/**
* AZ provider
*/
AVAILABILITY_ZONE_PROVIDER = "availability-zones",
/**
* Route53 Hosted Zone provider
*/
HOSTED_ZONE_PROVIDER = "hosted-zone",
/**
* SSM Parameter Provider
*/
SSM_PARAMETER_PROVIDER = "ssm",
/**
* VPC Provider
*/
VPC_PROVIDER = "vpc-provider",
/**
* VPC Endpoint Service AZ Provider
*/
ENDPOINT_SERVICE_AVAILABILITY_ZONE_PROVIDER = "endpoint-service-availability-zones",
/**
* Load balancer provider
*/
LOAD_BALANCER_PROVIDER = "load-balancer",
/**
* Load balancer listener provider
*/
LOAD_BALANCER_LISTENER_PROVIDER = "load-balancer-listener",
/**
* Security group provider
*/
SECURITY_GROUP_PROVIDER = "security-group",
/**
* KMS Key Provider
*/
KEY_PROVIDER = "key-provider",
/**
* CCAPI Provider
*/
CC_API_PROVIDER = "cc-api-provider",
/**
* A plugin provider (the actual plugin name will be in the properties)
*/
PLUGIN = "plugin"
}
/**
* Options for context lookup roles.
*/
export interface ContextLookupRoleOptions {
/**
* Query account
*/
readonly account: string;
/**
* Query region
*/
readonly region: string;
/**
* The ARN of the role that should be used to look up the missing values
*
* @default - None
*/
readonly lookupRoleArn?: string;
/**
* The ExternalId that needs to be supplied while assuming this role
*
* @default - No ExternalId will be supplied
*/
readonly lookupRoleExternalId?: string;
/**
* Additional options to pass to STS when assuming the lookup role.
*
* - `RoleArn` should not be used. Use the dedicated `lookupRoleArn` property instead.
* - `ExternalId` should not be used. Use the dedicated `lookupRoleExternalId` instead.
*
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/STS.html#assumeRole-property
* @default - No additional options.
*/
readonly assumeRoleAdditionalOptions?: {
[key: string]: any;
};
}
/**
* Query to AMI context provider
*/
export interface AmiContextQuery extends ContextLookupRoleOptions {
/**
* Owners to DescribeImages call
*
* @default - All owners
*/
readonly owners?: string[];
/**
* Filters to DescribeImages call
*/
readonly filters: {
[key: string]: string[];
};
}
/**
* Query to availability zone context provider
*/
export interface AvailabilityZonesContextQuery extends ContextLookupRoleOptions {
}
/**
* Query to hosted zone context provider
*/
export interface HostedZoneContextQuery extends ContextLookupRoleOptions {
/**
* The domain name e.g. example.com to lookup
*/
readonly domainName: string;
/**
* True if the zone you want to find is a private hosted zone
*
* @default false
*/
readonly privateZone?: boolean;
/**
* The VPC ID to that the private zone must be associated with
*
* If you provide VPC ID and privateZone is false, this will return no results
* and raise an error.
*
* @default - Required if privateZone=true
*/
readonly vpcId?: string;
}
/**
* Query to SSM Parameter Context Provider
*/
export interface SSMParameterContextQuery extends ContextLookupRoleOptions {
/**
* Parameter name to query
*/
readonly parameterName: string;
}
/**
* Query input for looking up a VPC
*/
export interface VpcContextQuery extends ContextLookupRoleOptions {
/**
* Filters to apply to the VPC
*
* Filter parameters are the same as passed to DescribeVpcs.
*
* @see https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpcs.html
*/
readonly filter: {
[key: string]: string;
};
/**
* Whether to populate the subnetGroups field of the `VpcContextResponse`,
* which contains potentially asymmetric subnet groups.
*
* @default false
*/
readonly returnAsymmetricSubnets?: boolean;
/**
* Optional tag for subnet group name.
* If not provided, we'll look at the aws-cdk:subnet-name tag.
* If the subnet does not have the specified tag,
* we'll use its type as the name.
*
* @default 'aws-cdk:subnet-name'
*/
readonly subnetGroupNameTag?: string;
/**
* Whether to populate the `vpnGatewayId` field of the `VpcContextResponse`,
* which contains the VPN Gateway ID, if one exists. You can explicitly
* disable this in order to avoid the lookup if you know the VPC does not have
* a VPN Gatway attached.
*
* @default true
*/
readonly returnVpnGateways?: boolean;
}
/**
* Query to endpoint service context provider
*/
export interface EndpointServiceAvailabilityZonesContextQuery extends ContextLookupRoleOptions {
/**
* Query service name
*/
readonly serviceName: string;
}
/**
* Type of load balancer
*/
export declare enum LoadBalancerType {
/**
* Network load balancer
*/
NETWORK = "network",
/**
* Application load balancer
*/
APPLICATION = "application"
}
/**
* Filters for selecting load balancers
*/
export interface LoadBalancerFilter extends ContextLookupRoleOptions {
/**
* Filter load balancers by their type
*/
readonly loadBalancerType: LoadBalancerType;
/**
* Find by load balancer's ARN
* @default - does not search by load balancer arn
*/
readonly loadBalancerArn?: string;
/**
* Match load balancer tags
* @default - does not match load balancers by tags
*/
readonly loadBalancerTags?: Tag[];
}
/**
* Query input for looking up a load balancer
*/
export interface LoadBalancerContextQuery extends LoadBalancerFilter {
}
/**
* The protocol for connections from clients to the load balancer
*/
export declare enum LoadBalancerListenerProtocol {
/**
* HTTP protocol
*/
HTTP = "HTTP",
/**
* HTTPS protocol
*/
HTTPS = "HTTPS",
/**
* TCP protocol
*/
TCP = "TCP",
/**
* TLS protocol
*/
TLS = "TLS",
/**
* UDP protocol
* */
UDP = "UDP",
/**
* TCP and UDP protocol
* */
TCP_UDP = "TCP_UDP"
}
/**
* Query input for looking up a load balancer listener
*/
export interface LoadBalancerListenerContextQuery extends LoadBalancerFilter {
/**
* Find by listener's arn
* @default - does not find by listener arn
*/
readonly listenerArn?: string;
/**
* Filter by listener protocol
* @default - does not filter by listener protocol
*/
readonly listenerProtocol?: LoadBalancerListenerProtocol;
/**
* Filter listeners by listener port
* @default - does not filter by a listener port
*/
readonly listenerPort?: number;
}
/**
* Query input for looking up a security group
*/
export interface SecurityGroupContextQuery extends ContextLookupRoleOptions {
/**
* Security group id
*
* @default - None
*/
readonly securityGroupId?: string;
/**
* Security group name
*
* @default - None
*/
readonly securityGroupName?: string;
/**
* VPC ID
*
* @default - None
*/
readonly vpcId?: string;
}
/**
* Query input for looking up a KMS Key
*/
export interface KeyContextQuery extends ContextLookupRoleOptions {
/**
* Alias name used to search the Key
*/
readonly aliasName: string;
}
/**
* Query input for lookup up CloudFormation resources using CC API
*
* The example below is required to successfully compile CDK (otherwise,
* the CDK build will generate a synthetic example for the below, but it
* doesn't have enough type information about the literal string union
* to generate a validly compiling example).
*
* @example
* import { CcApiContextQuery } from '@aws-cdk/cloud-assembly-schema';
*
* const x: CcApiContextQuery = {
* typeName: 'AWS::Some::Type',
* expectedMatchCount: 'exactly-one',
* resourceModel: {SomeArn: 'arn:aws:....'},
* propertiesToReturn: ['SomeProp'],
* account: '11111111111',
* region: 'us-east-1',
* };
*/
export interface CcApiContextQuery extends ContextLookupRoleOptions {
/**
* The CloudFormation resource type.
* See https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.html
*/
readonly typeName: string;
/**
* Identifier of the resource to look up using `GetResource`.
*
* Specifying exactIdentifier will return exactly one result, or throw an error
* unless `ignoreErrorOnMissingContext` is set.
*
* @default - Either exactIdentifier or propertyMatch should be specified.
*/
readonly exactIdentifier?: string;
/**
* The resource model to use to select the resources, using `ListResources`..
*
* This is needed for sub-resources where the parent Arn is required.
*
* See https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-list.html#resource-operations-list-containers
*
* @default - no resource Model is provided
*/
readonly resourceModel?: Record<string, unknown>;
/**
* Returns any resources matching these properties, using `ListResources`.
*
* By default, specifying propertyMatch will successfully return 0 or more
* results. To throw an error if the number of results is unexpected (and
* prevent the query results from being committed to context), specify
* `expectedMatchCount`.
*
* ## Notes on property completeness
*
* CloudControl API's `ListResources` may return fewer properties than
* `GetResource` would, depending on the resource implementation.
*
* The resources that `propertyMatch` matches against will *only ever* be the
* properties returned by the `ListResources` call.
*
* @default - Either exactIdentifier or propertyMatch should be specified.
*/
readonly propertyMatch?: Record<string, unknown>;
/**
* This is a set of properties returned from CC API that we want to return from ContextQuery.
*
* If any properties listed here are absent from the target resource, an error will be thrown.
*
* The returned object will always include the key `Identifier` with the CC-API returned
* field `Identifier`.
*
* ## Notes on property completeness
*
* CloudControl API's `ListResources` may return fewer properties than
* `GetResource` would, depending on the resource implementation.
*
* The returned properties here are *currently* selected from the response
* object that CloudControl API returns to the CDK CLI.
*
* However, if we find there is need to do so, we may decide to change this
* behavior in the future: we might change it to perform an additional
* `GetResource` call for resources matched by `propertyMatch`.
*/
readonly propertiesToReturn: string[];
/**
* Expected count of results if `propertyMatch` is specified.
*
* If the expected result count does not match the actual count,
* by default an error is produced and the result is not committed to cached
* context, and the user can correct the situation and try again without
* having to manually clear out the context key using `cdk context --remove`
*
* If the value of * `ignoreErrorOnMissingContext` is `true`, the value of
* `expectedMatchCount` is `at-least-one | exactly-one` and the number
* of found resources is 0, `dummyValue` is returned and committed to context
* instead.
*
* @default 'any'
*/
readonly expectedMatchCount?: 'any' | 'at-least-one' | 'at-most-one' | 'exactly-one';
/**
* The value to return if the resource was not found and `ignoreErrorOnMissingContext` is true.
*
* If supplied, `dummyValue` should be an array of objects.
*
* `dummyValue` does not have to have elements, and it may have objects with
* different properties than the properties in `propertiesToReturn`, but it
* will be easiest for downstream code if the `dummyValue` conforms to
* the expected response shape.
*
* @default - No dummy value available
*/
readonly dummyValue?: any;
/**
* Ignore an error and return the `dummyValue` instead if the resource was not found.
*
* - In case of an `exactIdentifier` lookup, return the `dummyValue` if the resource with
* that identifier was not found.
* - In case of a `propertyMatch` lookup, return the `dummyValue` if `expectedMatchCount`
* is `at-least-one | exactly-one` and the number of resources found was 0.
*
* if `ignoreErrorOnMissingContext` is set, `dummyValue` should be set and be an array.
*
* @default false
*/
readonly ignoreErrorOnMissingContext?: boolean;
}
/**
* Query input for plugins
*
* This alternate branch is necessary because it needs to be able to escape all type checking
* we do on on the cloud assembly -- we cannot know the properties that will be used a priori.
*/
export interface PluginContextQuery {
/**
* The name of the plugin
*/
readonly pluginName: string;
/**
* Arbitrary other arguments for the plugin.
*
* This index signature is not usable in non-TypeScript/JavaScript languages.
*
* @jsii ignore
*/
[key: string]: any;
}
export type ContextQueryProperties = AmiContextQuery | AvailabilityZonesContextQuery | HostedZoneContextQuery | SSMParameterContextQuery | VpcContextQuery | EndpointServiceAvailabilityZonesContextQuery | LoadBalancerContextQuery | LoadBalancerListenerContextQuery | SecurityGroupContextQuery | KeyContextQuery | CcApiContextQuery | PluginContextQuery;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
export * from './schema';
export * from './metadata-schema';
export * from './artifact-schema';
export * from './context-queries';
export * from './interfaces';

View File

@@ -0,0 +1,22 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./schema"), exports);
__exportStar(require("./metadata-schema"), exports);
__exportStar(require("./artifact-schema"), exports);
__exportStar(require("./context-queries"), exports);
__exportStar(require("./interfaces"), exports);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkNBQXlCO0FBQ3pCLG9EQUFrQztBQUNsQyxvREFBa0M7QUFDbEMsb0RBQWtDO0FBQ2xDLCtDQUE2QiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vc2NoZW1hJztcbmV4cG9ydCAqIGZyb20gJy4vbWV0YWRhdGEtc2NoZW1hJztcbmV4cG9ydCAqIGZyb20gJy4vYXJ0aWZhY3Qtc2NoZW1hJztcbmV4cG9ydCAqIGZyb20gJy4vY29udGV4dC1xdWVyaWVzJztcbmV4cG9ydCAqIGZyb20gJy4vaW50ZXJmYWNlcyc7XG4iXX0=

View File

@@ -0,0 +1,23 @@
/**
* Interoperable representation of a deployable cloud application.
*
* The external and interoperable contract for a Cloud Assembly is
* a directory containing a valid Cloud Assembly.
*
* Implementations should use the directory to load the Cloud Assembly from disk.
* It is recommended that implementations validate loaded manifest files using
* the provided functionality from this package.
* Within an implementation, it may be prudent to keep (parts of) the Cloud Assembly
* in memory during execution and use an implementation-specific contract.
* However when an implementation is providing an external contract,
* this interface should be used.
*/
export interface ICloudAssembly {
/**
* The directory of the cloud assembly.
*
* This directory will be used to read the Cloud Assembly from.
* Its contents (in particular `manifest.json`) must comply with the schema defined in this package.
*/
readonly directory: string;
}

View File

@@ -0,0 +1,10 @@
"use strict";
// The interfaces in this file, mainly exist __here__ because this is a convenient place to put them.
// The Assembly Schema package is already a jsii package and a dependency of `aws-cdk-lib`.
// It is effectively the only place we can put shared interfaces to be used across the jsii ecosystem.
//
// Putting a shared interface in here should be a huge exception.
// It needs to be justified by great benefits it provides to the ecosystems.
// All interfaces should be as minimal as possible.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVyZmFjZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHFHQUFxRztBQUNyRywyRkFBMkY7QUFDM0Ysc0dBQXNHO0FBQ3RHLEVBQUU7QUFDRixpRUFBaUU7QUFDakUsNEVBQTRFO0FBQzVFLG1EQUFtRCIsInNvdXJjZXNDb250ZW50IjpbIi8vIFRoZSBpbnRlcmZhY2VzIGluIHRoaXMgZmlsZSwgbWFpbmx5IGV4aXN0IF9faGVyZV9fIGJlY2F1c2UgdGhpcyBpcyBhIGNvbnZlbmllbnQgcGxhY2UgdG8gcHV0IHRoZW0uXG4vLyBUaGUgQXNzZW1ibHkgU2NoZW1hIHBhY2thZ2UgaXMgYWxyZWFkeSBhIGpzaWkgcGFja2FnZSBhbmQgYSBkZXBlbmRlbmN5IG9mIGBhd3MtY2RrLWxpYmAuXG4vLyBJdCBpcyBlZmZlY3RpdmVseSB0aGUgb25seSBwbGFjZSB3ZSBjYW4gcHV0IHNoYXJlZCBpbnRlcmZhY2VzIHRvIGJlIHVzZWQgYWNyb3NzIHRoZSBqc2lpIGVjb3N5c3RlbS5cbi8vXG4vLyBQdXR0aW5nIGEgc2hhcmVkIGludGVyZmFjZSBpbiBoZXJlIHNob3VsZCBiZSBhIGh1Z2UgZXhjZXB0aW9uLlxuLy8gSXQgbmVlZHMgdG8gYmUganVzdGlmaWVkIGJ5IGdyZWF0IGJlbmVmaXRzIGl0IHByb3ZpZGVzIHRvIHRoZSBlY29zeXN0ZW1zLlxuLy8gQWxsIGludGVyZmFjZXMgc2hvdWxkIGJlIGFzIG1pbmltYWwgYXMgcG9zc2libGUuXG5cbi8qKlxuICogSW50ZXJvcGVyYWJsZSByZXByZXNlbnRhdGlvbiBvZiBhIGRlcGxveWFibGUgY2xvdWQgYXBwbGljYXRpb24uXG4gKlxuICogVGhlIGV4dGVybmFsIGFuZCBpbnRlcm9wZXJhYmxlIGNvbnRyYWN0IGZvciBhIENsb3VkIEFzc2VtYmx5IGlzXG4gKiBhIGRpcmVjdG9yeSBjb250YWluaW5nIGEgdmFsaWQgQ2xvdWQgQXNzZW1ibHkuXG4gKlxuICogSW1wbGVtZW50YXRpb25zIHNob3VsZCB1c2UgdGhlIGRpcmVjdG9yeSB0byBsb2FkIHRoZSBDbG91ZCBBc3NlbWJseSBmcm9tIGRpc2suXG4gKiBJdCBpcyByZWNvbW1lbmRlZCB0aGF0IGltcGxlbWVudGF0aW9ucyB2YWxpZGF0ZSBsb2FkZWQgbWFuaWZlc3QgZmlsZXMgdXNpbmdcbiAqIHRoZSBwcm92aWRlZCBmdW5jdGlvbmFsaXR5IGZyb20gdGhpcyBwYWNrYWdlLlxuICogV2l0aGluIGFuIGltcGxlbWVudGF0aW9uLCBpdCBtYXkgYmUgcHJ1ZGVudCB0byBrZWVwIChwYXJ0cyBvZikgdGhlIENsb3VkIEFzc2VtYmx5XG4gKiBpbiBtZW1vcnkgZHVyaW5nIGV4ZWN1dGlvbiBhbmQgdXNlIGFuIGltcGxlbWVudGF0aW9uLXNwZWNpZmljIGNvbnRyYWN0LlxuICogSG93ZXZlciB3aGVuIGFuIGltcGxlbWVudGF0aW9uIGlzIHByb3ZpZGluZyBhbiBleHRlcm5hbCBjb250cmFjdCxcbiAqIHRoaXMgaW50ZXJmYWNlIHNob3VsZCBiZSB1c2VkLlxuICovXG5leHBvcnQgaW50ZXJmYWNlIElDbG91ZEFzc2VtYmx5IHtcbiAgLyoqXG4gICAqIFRoZSBkaXJlY3Rvcnkgb2YgdGhlIGNsb3VkIGFzc2VtYmx5LlxuICAgKlxuICAgKiBUaGlzIGRpcmVjdG9yeSB3aWxsIGJlIHVzZWQgdG8gcmVhZCB0aGUgQ2xvdWQgQXNzZW1ibHkgZnJvbS5cbiAgICogSXRzIGNvbnRlbnRzIChpbiBwYXJ0aWN1bGFyIGBtYW5pZmVzdC5qc29uYCkgbXVzdCBjb21wbHkgd2l0aCB0aGUgc2NoZW1hIGRlZmluZWQgaW4gdGhpcyBwYWNrYWdlLlxuICAgKi9cbiAgcmVhZG9ubHkgZGlyZWN0b3J5OiBzdHJpbmc7XG59XG4iXX0=

View File

@@ -0,0 +1,331 @@
/**
* Common properties for asset metadata.
*/
interface BaseAssetMetadataEntry {
/**
* Requested packaging style
*/
readonly packaging: string;
/**
* Logical identifier for the asset
*/
readonly id: string;
/**
* The hash of the asset source.
*/
readonly sourceHash: string;
/**
* Path on disk to the asset
*/
readonly path: string;
}
/**
* Metadata Entry spec for files.
*
* @example
* const entry = {
* packaging: 'file',
* s3BucketParameter: 'bucket-parameter',
* s3KeyParamenter: 'key-parameter',
* artifactHashParameter: 'hash-parameter',
* }
*/
export interface FileAssetMetadataEntry extends BaseAssetMetadataEntry {
/**
* Requested packaging style
*/
readonly packaging: 'zip' | 'file';
/**
* Name of parameter where S3 bucket should be passed in
*/
readonly s3BucketParameter: string;
/**
* Name of parameter where S3 key should be passed in
*/
readonly s3KeyParameter: string;
/**
* The name of the parameter where the hash of the bundled asset should be passed in.
*/
readonly artifactHashParameter: string;
}
/**
* Metadata Entry spec for stack tag.
*/
export interface Tag {
/**
* Tag key.
*
* (In the actual file on disk this will be cased as "Key", and the structure is
* patched to match this structure upon loading:
* https://github.com/aws/aws-cdk/blob/4aadaa779b48f35838cccd4e25107b2338f05547/packages/%40aws-cdk/cloud-assembly-schema/lib/manifest.ts#L137)
*/
readonly key: string;
/**
* Tag value.
*
* (In the actual file on disk this will be cased as "Value", and the structure is
* patched to match this structure upon loading:
* https://github.com/aws/aws-cdk/blob/4aadaa779b48f35838cccd4e25107b2338f05547/packages/%40aws-cdk/cloud-assembly-schema/lib/manifest.ts#L137)
*/
readonly value: string;
}
/**
* Options for configuring the Docker cache backend
*/
export interface ContainerImageAssetCacheOption {
/**
* The type of cache to use.
* Refer to https://docs.docker.com/build/cache/backends/ for full list of backends.
* @default - unspecified
*
* @example 'registry'
*/
readonly type: string;
/**
* Any parameters to pass into the docker cache backend configuration.
* Refer to https://docs.docker.com/build/cache/backends/ for cache backend configuration.
* @default {} No options provided
*
* @example
* declare const branch: string;
*
* const params = {
* ref: `12345678.dkr.ecr.us-west-2.amazonaws.com/cache:${branch}`,
* mode: "max",
* };
*/
readonly params?: {
[key: string]: string;
};
}
/**
* Metadata Entry spec for container images.
*
* @example
* const entry = {
* packaging: 'container-image',
* repositoryName: 'repository-name',
* imageTag: 'tag',
* }
*/
export interface ContainerImageAssetMetadataEntry extends BaseAssetMetadataEntry {
/**
* Type of asset
*/
readonly packaging: 'container-image';
/**
* ECR Repository name and repo digest (separated by "@sha256:") where this
* image is stored.
*
* @default undefined If not specified, `repositoryName` and `imageTag` are
* required because otherwise how will the stack know where to find the asset,
* ha?
* @deprecated specify `repositoryName` and `imageTag` instead, and then you
* know where the image will go.
*/
readonly imageNameParameter?: string;
/**
* ECR repository name, if omitted a default name based on the asset's ID is
* used instead. Specify this property if you need to statically address the
* image, e.g. from a Kubernetes Pod. Note, this is only the repository name,
* without the registry and the tag parts.
*
* @default - this parameter is REQUIRED after 1.21.0
*/
readonly repositoryName?: string;
/**
* The docker image tag to use for tagging pushed images. This field is
* required if `imageParameterName` is ommited (otherwise, the app won't be
* able to find the image).
*
* @default - this parameter is REQUIRED after 1.21.0
*/
readonly imageTag?: string;
/**
* Build args to pass to the `docker build` command
*
* @default no build args are passed
*/
readonly buildArgs?: {
[key: string]: string;
};
/**
* Build contexts to pass to the `docker build` command
*
* @default no build contexts are passed
*/
readonly buildContexts?: {
[key: string]: string;
};
/**
* SSH agent socket or keys to pass to the `docker build` command
*
* @default no ssh arg is passed
*/
readonly buildSsh?: string;
/**
* Build secrets to pass to the `docker build` command
*
* @default no build secrets are passed
*/
readonly buildSecrets?: {
[key: string]: string;
};
/**
* Docker target to build to
*
* @default no build target
*/
readonly target?: string;
/**
* Path to the Dockerfile (relative to the directory).
*
* @default - no file is passed
*/
readonly file?: string;
/**
* Networking mode for the RUN commands during build.
*
* @default - no networking mode specified
*/
readonly networkMode?: string;
/**
* Platform to build for. _Requires Docker Buildx_.
*
* @default - current machine platform
*/
readonly platform?: string;
/**
* Outputs to pass to the `docker build` command.
*
* @default - no outputs are passed to the build command (default outputs are used)
* @see https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs
*/
readonly outputs?: string[];
/**
* Cache from options to pass to the `docker build` command.
*
* @default - no cache from options are passed to the build command
* @see https://docs.docker.com/build/cache/backends/
*/
readonly cacheFrom?: ContainerImageAssetCacheOption[];
/**
* Cache to options to pass to the `docker build` command.
*
* @default - no cache to options are passed to the build command
* @see https://docs.docker.com/build/cache/backends/
*/
readonly cacheTo?: ContainerImageAssetCacheOption;
/**
* Disable the cache and pass `--no-cache` to the `docker build` command.
*
* @default - cache is used
*/
readonly cacheDisabled?: boolean;
}
/**
* @see ArtifactMetadataEntryType.ASSET
*/
export type AssetMetadataEntry = FileAssetMetadataEntry | ContainerImageAssetMetadataEntry;
/**
* @see ArtifactMetadataEntryType.INFO
* @see ArtifactMetadataEntryType.WARN
* @see ArtifactMetadataEntryType.ERROR
*/
export type LogMessageMetadataEntry = string;
/**
* @see ArtifactMetadataEntryType.LOGICAL_ID
*/
export type LogicalIdMetadataEntry = string;
/**
* @see ArtifactMetadataEntryType.STACK_TAGS
*/
export type StackTagsMetadataEntry = Tag[];
/**
* Any other type of metadata entry
*
* This could probably be changed to `any`, but it's safer not
* to do so right now.
* See https://github.com/cdklabs/cloud-assembly-schema/pull/121.
*/
export type PrimitiveType = boolean | number | string;
/**
* Metadata type of a PropertyMutation
*/
export interface PropertyMutationMetadataEntry {
/**
* Name of the property
*/
readonly propertyName: string;
/**
* Stack trace of the mutation
*/
readonly stackTrace: string[];
}
/**
* Union type for all metadata entries that might exist in the manifest.
*/
export type MetadataEntryData = AssetMetadataEntry | LogMessageMetadataEntry | LogicalIdMetadataEntry | PrimitiveType | PropertyMutationMetadataEntry | (Tag | string)[];
/**
* Type of artifact metadata entry.
*/
export declare enum ArtifactMetadataEntryType {
/**
* Asset in metadata.
*/
ASSET = "aws:cdk:asset",
/**
* Metadata key used to print INFO-level messages by the toolkit when an app is syntheized.
*/
INFO = "aws:cdk:info",
/**
* Metadata key used to print WARNING-level messages by the toolkit when an app is syntheized.
*/
WARN = "aws:cdk:warning",
/**
* Metadata key used to print ERROR-level messages by the toolkit when an app is syntheized.
*/
ERROR = "aws:cdk:error",
/**
* Represents the CloudFormation logical ID of a resource at a certain path.
*/
LOGICAL_ID = "aws:cdk:logicalId",
/**
* Represents tags of a stack.
*/
STACK_TAGS = "aws:cdk:stack-tags",
/**
* Whether the resource should be excluded during refactoring.
*/
DO_NOT_REFACTOR = "aws:cdk:do-not-refactor",
/**
* Creation stack of a construct
*/
CREATION_STACK = "aws:cdk:creationStack",
/**
* A property mutation trace
*/
PROPERTY_ASSIGNMENT = "aws:cdk:propertyAssignment"
}
/**
* A metadata entry in a cloud assembly artifact.
*/
export interface MetadataEntry {
/**
* The type of the metadata entry.
*/
readonly type: string;
/**
* The data.
*
* @default - no data.
*/
readonly data?: MetadataEntryData;
/**
* A stack trace for when the entry was created.
*
* @default - no trace.
*/
readonly trace?: string[];
}
export {};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,162 @@
import type { ArtifactProperties } from './artifact-schema';
import type { ContextProvider, ContextQueryProperties } from './context-queries';
import type { MetadataEntry } from './metadata-schema';
/**
* Type of cloud artifact.
*/
export declare enum ArtifactType {
/**
* Stub required because of JSII.
*/
NONE = "none",// required due to a jsii bug
/**
* The artifact is an AWS CloudFormation stack.
*/
AWS_CLOUDFORMATION_STACK = "aws:cloudformation:stack",
/**
* The artifact contains the CDK application's construct tree.
*/
CDK_TREE = "cdk:tree",
/**
* Manifest for all assets in the Cloud Assembly
*/
ASSET_MANIFEST = "cdk:asset-manifest",
/**
* Nested Cloud Assembly
*/
NESTED_CLOUD_ASSEMBLY = "cdk:cloud-assembly",
/**
* Feature flag report
*/
FEATURE_FLAG_REPORT = "cdk:feature-flag-report"
}
/**
* Information about the application's runtime components.
*/
export interface RuntimeInfo {
/**
* The list of libraries loaded in the application, associated with their versions.
*/
readonly libraries: {
[name: string]: string;
};
}
/**
* Represents a missing piece of context.
*/
export interface MissingContext {
/**
* The missing context key.
*/
readonly key: string;
/**
* The provider from which we expect this context key to be obtained.
*/
readonly provider: ContextProvider;
/**
* A set of provider-specific options.
*/
readonly props: ContextQueryProperties;
}
/**
* A manifest for a single artifact within the cloud assembly.
*/
export interface ArtifactManifest {
/**
* The type of artifact.
*/
readonly type: ArtifactType;
/**
* The environment into which this artifact is deployed.
*
* @default - no envrionment.
*/
readonly environment?: string;
/**
* Associated metadata.
*
* Metadata can be stored directly in the assembly manifest, as well as in a
* separate file (see `additionalMetadataFile`). It should prefer to be stored
* in the additional file, as that will reduce the size of the assembly
* manifest in cases of a lot of metdata (which CDK does emit by default).
*
* @default - no metadata.
*/
readonly metadata?: {
[path: string]: MetadataEntry[];
};
/**
* A file with additional metadata entries.
*
* The schema of this file is exactly the same as the type of the `metadata` field.
* In other words, that file contains an object mapping construct paths to arrays
* of metadata entries.
*
* @default - no additional metadata
*/
readonly additionalMetadataFile?: string;
/**
* IDs of artifacts that must be deployed before this artifact.
*
* @default - no dependencies.
*/
readonly dependencies?: string[];
/**
* The set of properties for this artifact (depends on type)
*
* @default - no properties.
*/
readonly properties?: ArtifactProperties;
/**
* A string that can be shown to a user to uniquely identify this artifact inside a cloud assembly tree
*
* Is used by the CLI to present a list of stacks to the user in a way that
* makes sense to them. Even though the property name "display name" doesn't
* imply it, this field is used to select stacks as well, so all stacks should
* have a unique display name.
*
* @default - no display name
*/
readonly displayName?: string;
}
/**
* A manifest which describes the cloud assembly.
*/
export interface AssemblyManifest {
/**
* Protocol version
*/
readonly version: string;
/**
* Required CLI version, if available
*
* If the manifest producer knows, it can put the minimum version of the CLI
* here that supports reading this assembly.
*
* If set, it can be used to show a more informative error message to users.
*
* @default - Minimum CLI version unknown
*/
readonly minimumCliVersion?: string;
/**
* The set of artifacts in this assembly.
*
* @default - no artifacts.
*/
readonly artifacts?: {
[id: string]: ArtifactManifest;
};
/**
* Missing context information. If this field has values, it means that the
* cloud assembly is not complete and should not be deployed.
*
* @default - no missing context.
*/
readonly missing?: MissingContext[];
/**
* Runtime information.
*
* @default - no info.
*/
readonly runtime?: RuntimeInfo;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
export * from './cloud-assembly';
export * from './assets';
export * from './manifest';
export * from './integ-tests';

View File

@@ -0,0 +1,21 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./cloud-assembly"), exports);
__exportStar(require("./assets"), exports);
__exportStar(require("./manifest"), exports);
__exportStar(require("./integ-tests"), exports);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsbURBQWlDO0FBQ2pDLDJDQUF5QjtBQUN6Qiw2Q0FBMkI7QUFDM0IsZ0RBQThCIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9jbG91ZC1hc3NlbWJseSc7XG5leHBvcnQgKiBmcm9tICcuL2Fzc2V0cyc7XG5leHBvcnQgKiBmcm9tICcuL21hbmlmZXN0JztcbmV4cG9ydCAqIGZyb20gJy4vaW50ZWctdGVzdHMnO1xuIl19

View File

@@ -0,0 +1,178 @@
/**
* Specify what changes require manual approval.
*/
export declare enum RequireApproval {
/**
* Approval is not required
*/
NEVER = "never",
/**
* Manual approval required for any change to the stack
*/
ANYCHANGE = "any-change",
/**
* Manual approval required if changes involve a broadening of permissions or security group rules
*/
BROADENING = "broadening"
}
/**
* Default CDK CLI options that apply to all commands
*/
export interface DefaultCdkOptions {
/**
* List of stacks to deploy
*
* Requried if `all` is not set
*
* @default - []
*/
readonly stacks?: string[];
/**
* Deploy all stacks
*
* Requried if `stacks` is not set
*
* @default - false
*/
readonly all?: boolean;
/**
* command-line for executing your app or a cloud assembly directory
* e.g. "node bin/my-app.js"
* or
* "cdk.out"
*
* @default - read from cdk.json
*/
readonly app?: string;
/**
* Role to pass to CloudFormation for deployment
*
* @default - use the bootstrap cfn-exec role
*/
readonly roleArn?: string;
/**
* Additional context
*
* @default - no additional context
*/
readonly context?: {
[name: string]: string;
};
/**
* Print trace for stack warnings
*
* @default false
*/
readonly trace?: boolean;
/**
* Do not construct stacks with warnings
*
* @default false
*/
readonly strict?: boolean;
/**
* Perform context lookups.
*
* Synthesis fails if this is disabled and context lookups need
* to be performed
*
* @default true
*/
readonly lookups?: boolean;
/**
* Ignores synthesis errors, which will likely produce an invalid output
*
* @default false
*/
readonly ignoreErrors?: boolean;
/**
* Use JSON output instead of YAML when templates are printed
* to STDOUT
*
* @default false
*/
readonly json?: boolean;
/**
* show debug logs
*
* @default false
*/
readonly verbose?: boolean;
/**
* enable emission of additional debugging information, such as creation stack
* traces of tokens
*
* @default false
*/
readonly debug?: boolean;
/**
* Use the indicated AWS profile as the default environment
*
* @default - no profile is used
*/
readonly profile?: string;
/**
* Use the indicated proxy. Will read from
* HTTPS_PROXY environment if specified
*
* @default - no proxy
*/
readonly proxy?: string;
/**
* Path to CA certificate to use when validating HTTPS
* requests.
*
* @default - read from AWS_CA_BUNDLE environment variable
*/
readonly caBundlePath?: string;
/**
* Force trying to fetch EC2 instance credentials
*
* @default - guess EC2 instance status
*/
readonly ec2Creds?: boolean;
/**
* Include "AWS::CDK::Metadata" resource in synthesized templates
*
* @default true
*/
readonly versionReporting?: boolean;
/**
* Include "aws:cdk:path" CloudFormation metadata for each resource
*
* @default true
*/
readonly pathMetadata?: boolean;
/**
* Include "aws:asset:*" CloudFormation metadata for resources that use assets
*
* @default true
*/
readonly assetMetadata?: boolean;
/**
* Copy assets to the output directory
*
* Needed for local debugging the source files with SAM CLI
*
* @default false
*/
readonly staging?: boolean;
/**
* Emits the synthesized cloud assembly into a directory
*
* @default cdk.out
*/
readonly output?: string;
/**
* Show relevant notices
*
* @default true
*/
readonly notices?: boolean;
/**
* Show colors and other style from console output
*
* @default true
*/
readonly color?: boolean;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,92 @@
import type { DefaultCdkOptions, RequireApproval } from './common';
/**
* Options to use with cdk deploy
*/
export interface DeployOptions extends DefaultCdkOptions {
/**
* Only perform action on the given stack
*
* @default false
*/
readonly exclusively?: boolean;
/**
* Name of the toolkit stack to use/deploy
*
* @default CDKToolkit
*/
readonly toolkitStackName?: string;
/**
* Reuse the assets with the given asset IDs
*
* @default - do not reuse assets
*/
readonly reuseAssets?: string[];
/**
* Optional name to use for the CloudFormation change set.
* If not provided, a name will be generated automatically.
*
* @default - auto generate a name
*/
readonly changeSetName?: string;
/**
* Always deploy, even if templates are identical.
* @default false
*/
readonly force?: boolean;
/**
* Rollback failed deployments
*
* @default true
*/
readonly rollback?: boolean;
/**
* ARNs of SNS topics that CloudFormation will notify with stack related events
*
* @default - no notifications
*/
readonly notificationArns?: string[];
/**
* What kind of security changes require approval
*
* @default RequireApproval.NEVER
*/
readonly requireApproval?: RequireApproval;
/**
* Whether to execute the ChangeSet
* Not providing `execute` parameter will result in execution of ChangeSet
* @default true
*/
readonly execute?: boolean;
/**
* Additional parameters for CloudFormation at deploy time
* @default {}
*/
readonly parameters?: {
[name: string]: string;
};
/**
* Use previous values for unspecified parameters
*
* If not set, all parameters must be specified for every deployment.
*
* @default true
*/
readonly usePreviousParameters?: boolean;
/**
* Path to file where stack outputs will be written after a successful deploy as JSON
* @default - Outputs are not written to any file
*/
readonly outputsFile?: string;
/**
* Whether we are on a CI system
*
* @default false
*/
readonly ci?: boolean;
/**
* Deploy multiple stacks in parallel
*
* @default 1
*/
readonly concurrency?: number;
}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZGVwbG95LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IERlZmF1bHRDZGtPcHRpb25zLCBSZXF1aXJlQXBwcm92YWwgfSBmcm9tICcuL2NvbW1vbic7XG5cbi8qKlxuICogT3B0aW9ucyB0byB1c2Ugd2l0aCBjZGsgZGVwbG95XG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgRGVwbG95T3B0aW9ucyBleHRlbmRzIERlZmF1bHRDZGtPcHRpb25zIHtcbiAgLyoqXG4gICAqIE9ubHkgcGVyZm9ybSBhY3Rpb24gb24gdGhlIGdpdmVuIHN0YWNrXG4gICAqXG4gICAqIEBkZWZhdWx0IGZhbHNlXG4gICAqL1xuICByZWFkb25seSBleGNsdXNpdmVseT86IGJvb2xlYW47XG5cbiAgLyoqXG4gICAqIE5hbWUgb2YgdGhlIHRvb2xraXQgc3RhY2sgdG8gdXNlL2RlcGxveVxuICAgKlxuICAgKiBAZGVmYXVsdCBDREtUb29sa2l0XG4gICAqL1xuICByZWFkb25seSB0b29sa2l0U3RhY2tOYW1lPzogc3RyaW5nO1xuXG4gIC8qKlxuICAgKiBSZXVzZSB0aGUgYXNzZXRzIHdpdGggdGhlIGdpdmVuIGFzc2V0IElEc1xuICAgKlxuICAgKiBAZGVmYXVsdCAtIGRvIG5vdCByZXVzZSBhc3NldHNcbiAgICovXG4gIHJlYWRvbmx5IHJldXNlQXNzZXRzPzogc3RyaW5nW107XG5cbiAgLyoqXG4gICAqIE9wdGlvbmFsIG5hbWUgdG8gdXNlIGZvciB0aGUgQ2xvdWRGb3JtYXRpb24gY2hhbmdlIHNldC5cbiAgICogSWYgbm90IHByb3ZpZGVkLCBhIG5hbWUgd2lsbCBiZSBnZW5lcmF0ZWQgYXV0b21hdGljYWxseS5cbiAgICpcbiAgICogQGRlZmF1bHQgLSBhdXRvIGdlbmVyYXRlIGEgbmFtZVxuICAgKi9cbiAgcmVhZG9ubHkgY2hhbmdlU2V0TmFtZT86IHN0cmluZztcblxuICAvKipcbiAgICogQWx3YXlzIGRlcGxveSwgZXZlbiBpZiB0ZW1wbGF0ZXMgYXJlIGlkZW50aWNhbC5cbiAgICogQGRlZmF1bHQgZmFsc2VcbiAgICovXG4gIHJlYWRvbmx5IGZvcmNlPzogYm9vbGVhbjtcblxuICAvKipcbiAgICogUm9sbGJhY2sgZmFpbGVkIGRlcGxveW1lbnRzXG4gICAqXG4gICAqIEBkZWZhdWx0IHRydWVcbiAgICovXG4gIHJlYWRvbmx5IHJvbGxiYWNrPzogYm9vbGVhbjtcblxuICAvKipcbiAgICogQVJOcyBvZiBTTlMgdG9waWNzIHRoYXQgQ2xvdWRGb3JtYXRpb24gd2lsbCBub3RpZnkgd2l0aCBzdGFjayByZWxhdGVkIGV2ZW50c1xuICAgKlxuICAgKiBAZGVmYXVsdCAtIG5vIG5vdGlmaWNhdGlvbnNcbiAgICovXG4gIHJlYWRvbmx5IG5vdGlmaWNhdGlvbkFybnM/OiBzdHJpbmdbXTtcblxuICAvKipcbiAgICogV2hhdCBraW5kIG9mIHNlY3VyaXR5IGNoYW5nZXMgcmVxdWlyZSBhcHByb3ZhbFxuICAgKlxuICAgKiBAZGVmYXVsdCBSZXF1aXJlQXBwcm92YWwuTkVWRVJcbiAgICovXG4gIHJlYWRvbmx5IHJlcXVpcmVBcHByb3ZhbD86IFJlcXVpcmVBcHByb3ZhbDtcblxuICAvKipcbiAgICogV2hldGhlciB0byBleGVjdXRlIHRoZSBDaGFuZ2VTZXRcbiAgICogTm90IHByb3ZpZGluZyBgZXhlY3V0ZWAgcGFyYW1ldGVyIHdpbGwgcmVzdWx0IGluIGV4ZWN1dGlvbiBvZiBDaGFuZ2VTZXRcbiAgICogQGRlZmF1bHQgdHJ1ZVxuICAgKi9cbiAgcmVhZG9ubHkgZXhlY3V0ZT86IGJvb2xlYW47XG5cbiAgLyoqXG4gICAqIEFkZGl0aW9uYWwgcGFyYW1ldGVycyBmb3IgQ2xvdWRGb3JtYXRpb24gYXQgZGVwbG95IHRpbWVcbiAgICogQGRlZmF1bHQge31cbiAgICovXG4gIHJlYWRvbmx5IHBhcmFtZXRlcnM/OiB7IFtuYW1lOiBzdHJpbmddOiBzdHJpbmcgfTtcblxuICAvKipcbiAgICogVXNlIHByZXZpb3VzIHZhbHVlcyBmb3IgdW5zcGVjaWZpZWQgcGFyYW1ldGVyc1xuICAgKlxuICAgKiBJZiBub3Qgc2V0LCBhbGwgcGFyYW1ldGVycyBtdXN0IGJlIHNwZWNpZmllZCBmb3IgZXZlcnkgZGVwbG95bWVudC5cbiAgICpcbiAgICogQGRlZmF1bHQgdHJ1ZVxuICAgKi9cbiAgcmVhZG9ubHkgdXNlUHJldmlvdXNQYXJhbWV0ZXJzPzogYm9vbGVhbjtcblxuICAvKipcbiAgICogUGF0aCB0byBmaWxlIHdoZXJlIHN0YWNrIG91dHB1dHMgd2lsbCBiZSB3cml0dGVuIGFmdGVyIGEgc3VjY2Vzc2Z1bCBkZXBsb3kgYXMgSlNPTlxuICAgKiBAZGVmYXVsdCAtIE91dHB1dHMgYXJlIG5vdCB3cml0dGVuIHRvIGFueSBmaWxlXG4gICAqL1xuICByZWFkb25seSBvdXRwdXRzRmlsZT86IHN0cmluZztcblxuICAvKipcbiAgICogV2hldGhlciB3ZSBhcmUgb24gYSBDSSBzeXN0ZW1cbiAgICpcbiAgICogQGRlZmF1bHQgZmFsc2VcbiAgICovXG4gIHJlYWRvbmx5IGNpPzogYm9vbGVhbjtcblxuICAvKipcbiAgICogRGVwbG95IG11bHRpcGxlIHN0YWNrcyBpbiBwYXJhbGxlbFxuICAgKlxuICAgKiBAZGVmYXVsdCAxXG4gICAqL1xuICByZWFkb25seSBjb25jdXJyZW5jeT86IG51bWJlcjtcbn1cbiJdfQ==

View File

@@ -0,0 +1,18 @@
import type { DefaultCdkOptions } from './common';
/**
* Options to use with cdk destroy
*/
export interface DestroyOptions extends DefaultCdkOptions {
/**
* Do not ask for permission before destroying stacks
*
* @default false
*/
readonly force?: boolean;
/**
* Only destroy the given stack
*
* @default false
*/
readonly exclusively?: boolean;
}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVzdHJveS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImRlc3Ryb3kudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHsgRGVmYXVsdENka09wdGlvbnMgfSBmcm9tICcuL2NvbW1vbic7XG5cbi8qKlxuICogT3B0aW9ucyB0byB1c2Ugd2l0aCBjZGsgZGVzdHJveVxuICovXG5leHBvcnQgaW50ZXJmYWNlIERlc3Ryb3lPcHRpb25zIGV4dGVuZHMgRGVmYXVsdENka09wdGlvbnMge1xuICAvKipcbiAgICogRG8gbm90IGFzayBmb3IgcGVybWlzc2lvbiBiZWZvcmUgZGVzdHJveWluZyBzdGFja3NcbiAgICpcbiAgICogQGRlZmF1bHQgZmFsc2VcbiAgICovXG4gIHJlYWRvbmx5IGZvcmNlPzogYm9vbGVhbjtcblxuICAvKipcbiAgICogT25seSBkZXN0cm95IHRoZSBnaXZlbiBzdGFja1xuICAgKlxuICAgKiBAZGVmYXVsdCBmYWxzZVxuICAgKi9cbiAgcmVhZG9ubHkgZXhjbHVzaXZlbHk/OiBib29sZWFuO1xufVxuIl19

View File

@@ -0,0 +1,3 @@
export * from './common';
export * from './deploy';
export * from './destroy';

View File

@@ -0,0 +1,20 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./common"), exports);
__exportStar(require("./deploy"), exports);
__exportStar(require("./destroy"), exports);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkNBQXlCO0FBQ3pCLDJDQUF5QjtBQUN6Qiw0Q0FBMEIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2NvbW1vbic7XG5leHBvcnQgKiBmcm9tICcuL2RlcGxveSc7XG5leHBvcnQgKiBmcm9tICcuL2Rlc3Ryb3knO1xuIl19

View File

@@ -0,0 +1,3 @@
export * from './schema';
export * from './commands';
export * from './test-case';

View File

@@ -0,0 +1,20 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./schema"), exports);
__exportStar(require("./commands"), exports);
__exportStar(require("./test-case"), exports);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkNBQXlCO0FBQ3pCLDZDQUEyQjtBQUMzQiw4Q0FBNEIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3NjaGVtYSc7XG5leHBvcnQgKiBmcm9tICcuL2NvbW1hbmRzJztcbmV4cG9ydCAqIGZyb20gJy4vdGVzdC1jYXNlJztcbiJdfQ==

View File

@@ -0,0 +1,35 @@
import type { TestCase } from './test-case';
/**
* Definitions for the integration testing manifest
*/
export interface IntegManifest {
/**
* Version of the manifest
*/
readonly version: string;
/**
* Enable lookups for this test. If lookups are enabled
* then `stackUpdateWorkflow` must be set to false.
* Lookups should only be enabled when you are explicitly testing
* lookups.
*
* @default false
*/
readonly enableLookups?: boolean;
/**
* Additional context to use when performing
* a synth. Any context provided here will override
* any default context
*
* @default - no additional context
*/
readonly synthContext?: {
[name: string]: string;
};
/**
* test cases
*/
readonly testCases: {
[testName: string]: TestCase;
};
}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NoZW1hLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsic2NoZW1hLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IFRlc3RDYXNlIH0gZnJvbSAnLi90ZXN0LWNhc2UnO1xuLyoqXG4gKiBEZWZpbml0aW9ucyBmb3IgdGhlIGludGVncmF0aW9uIHRlc3RpbmcgbWFuaWZlc3RcbiAqL1xuZXhwb3J0IGludGVyZmFjZSBJbnRlZ01hbmlmZXN0IHtcbiAgLyoqXG4gICAqIFZlcnNpb24gb2YgdGhlIG1hbmlmZXN0XG4gICAqL1xuICByZWFkb25seSB2ZXJzaW9uOiBzdHJpbmc7XG5cbiAgLyoqXG4gICAqIEVuYWJsZSBsb29rdXBzIGZvciB0aGlzIHRlc3QuIElmIGxvb2t1cHMgYXJlIGVuYWJsZWRcbiAgICogdGhlbiBgc3RhY2tVcGRhdGVXb3JrZmxvd2AgbXVzdCBiZSBzZXQgdG8gZmFsc2UuXG4gICAqIExvb2t1cHMgc2hvdWxkIG9ubHkgYmUgZW5hYmxlZCB3aGVuIHlvdSBhcmUgZXhwbGljaXRseSB0ZXN0aW5nXG4gICAqIGxvb2t1cHMuXG4gICAqXG4gICAqIEBkZWZhdWx0IGZhbHNlXG4gICAqL1xuICByZWFkb25seSBlbmFibGVMb29rdXBzPzogYm9vbGVhbjtcblxuICAvKipcbiAgICogQWRkaXRpb25hbCBjb250ZXh0IHRvIHVzZSB3aGVuIHBlcmZvcm1pbmdcbiAgICogYSBzeW50aC4gQW55IGNvbnRleHQgcHJvdmlkZWQgaGVyZSB3aWxsIG92ZXJyaWRlXG4gICAqIGFueSBkZWZhdWx0IGNvbnRleHRcbiAgICpcbiAgICogQGRlZmF1bHQgLSBubyBhZGRpdGlvbmFsIGNvbnRleHRcbiAgICovXG4gIHJlYWRvbmx5IHN5bnRoQ29udGV4dD86IHsgW25hbWU6IHN0cmluZ106IHN0cmluZyB9O1xuXG4gIC8qKlxuICAgKiB0ZXN0IGNhc2VzXG4gICAqL1xuICByZWFkb25seSB0ZXN0Q2FzZXM6IHsgW3Rlc3ROYW1lOiBzdHJpbmddOiBUZXN0Q2FzZSB9O1xufVxuIl19

View File

@@ -0,0 +1,186 @@
import type { DeployOptions, DestroyOptions } from './commands';
/**
* The set of options to control the workflow of the test runner
*/
export interface TestOptions {
/**
* Run update workflow on this test case
* This should only be set to false to test scenarios
* that are not possible to test as part of the update workflow
*
* @default true
*/
readonly stackUpdateWorkflow?: boolean;
/**
* Additional options to use for each CDK command
*
* @default - runner default options
*/
readonly cdkCommandOptions?: CdkCommands;
/**
* Additional commands to run at predefined points in the test workflow
*
* e.g. { postDeploy: ['yarn', 'test'] }
*
* @default - no hooks
*/
readonly hooks?: Hooks;
/**
* Whether or not to include asset hashes in the diff
* Asset hashes can introduces a lot of unneccessary noise into tests,
* but there are some cases where asset hashes _should_ be included. For example
* any tests involving custom resources or bundling
*
* @default false
*/
readonly diffAssets?: boolean;
/**
* List of CloudFormation resource types in this stack that can
* be destroyed as part of an update without failing the test.
*
* This list should only include resources that for this specific
* integration test we are sure will not cause errors or an outage if
* destroyed. For example, maybe we know that a new resource will be created
* first before the old resource is destroyed which prevents any outage.
*
* e.g. ['AWS::IAM::Role']
*
* @default - do not allow destruction of any resources on update
*/
readonly allowDestroy?: string[];
/**
* Limit deployment to these regions
*
* @default - can run in any region
*/
readonly regions?: string[];
}
/**
* Represents an integration test case
*/
export interface TestCase extends TestOptions {
/**
* Stacks that should be tested as part of this test case
* The stackNames will be passed as args to the cdk commands
* so dependent stacks will be automatically deployed unless
* `exclusively` is passed
*/
readonly stacks: string[];
/**
* The node id of the stack that contains assertions.
* This is the value that can be used to deploy the stack with the CDK CLI
*
* @default - no assertion stack
*/
readonly assertionStack?: string;
/**
* The name of the stack that contains assertions
*
* @default - no assertion stack
*/
readonly assertionStackName?: string;
}
/**
* Commands to run at predefined points during the
* integration test workflow
*/
export interface Hooks {
/**
* Commands to run prior to deploying the cdk stacks
* in the integration test
*
* @default - no commands
*/
readonly preDeploy?: string[];
/**
* Commands to run prior after deploying the cdk stacks
* in the integration test
*
* @default - no commands
*/
readonly postDeploy?: string[];
/**
* Commands to run prior to destroying the cdk stacks
* in the integration test
*
* @default - no commands
*/
readonly preDestroy?: string[];
/**
* Commands to run after destroying the cdk stacks
* in the integration test
*
* @default - no commands
*/
readonly postDestroy?: string[];
}
/**
* Represents a cdk command
* i.e. `synth`, `deploy`, & `destroy`
*/
export interface CdkCommand {
/**
* Whether or not to run this command as part of the workflow
* This can be used if you only want to test some of the workflow
* for example enable `synth` and disable `deploy` & `destroy` in order
* to limit the test to synthesis
*
* @default true
*/
readonly enabled?: boolean;
/**
* If the runner should expect this command to fail
*
* @default false
*/
readonly expectError?: boolean;
/**
* This can be used in combination with `expectedError`
* to validate that a specific message is returned.
*
* @default - do not validate message
*/
readonly expectedMessage?: string;
}
/**
* Represents a cdk deploy command
*/
export interface DeployCommand extends CdkCommand {
/**
* Additional arguments to pass to the command
* This can be used to test specific CLI functionality
*
* @default - only default args are used
*/
readonly args?: DeployOptions;
}
/**
* Represents a cdk destroy command
*/
export interface DestroyCommand extends CdkCommand {
/**
* Additional arguments to pass to the command
* This can be used to test specific CLI functionality
*
* @default - only default args are used
*/
readonly args?: DestroyOptions;
}
/**
* Options for specific cdk commands that are run
* as part of the integration test workflow
*/
export interface CdkCommands {
/**
* Options to for the cdk deploy command
*
* @default - default deploy options
*/
readonly deploy?: DeployCommand;
/**
* Options to for the cdk destroy command
*
* @default - default destroy options
*/
readonly destroy?: DestroyCommand;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,142 @@
import type * as assets from './assets';
import * as assembly from './cloud-assembly';
import type * as integ from './integ-tests';
export declare const VERSION_MISMATCH: string;
/**
* Options for the loadManifest operation
*/
export interface LoadManifestOptions {
/**
* Skip the version check
*
* This means you may read a newer cloud assembly than the CX API is designed
* to support, and your application may not be aware of all features that in use
* in the Cloud Assembly.
*
* @default false
*/
readonly skipVersionCheck?: boolean;
/**
* Skip enum checks
*
* This means you may read enum values you don't know about yet. Make sure to always
* check the values of enums you encounter in the manifest.
*
* @default false
*/
readonly skipEnumCheck?: boolean;
/**
* Topologically sort all artifacts
*
* This parameter is only respected by the constructor of `CloudAssembly`. The
* property lives here for backwards compatibility reasons.
*
* @default true
*/
readonly topoSort?: boolean;
/**
* Validate the file according to the declared JSON Schema
*
* Be aware that JSON Schema validation has a significant performance cost
* (about 10x over not validating).
*
* @default false, unless $TESTING_CDK is set to '1'
*/
readonly validateSchema?: boolean;
}
/**
* Protocol utility class.
*/
export declare abstract class Manifest {
/**
* Validates and saves the cloud assembly manifest to file.
*
* @param manifest - manifest.
* @param filePath - output file path.
*/
static saveAssemblyManifest(manifest: assembly.AssemblyManifest, filePath: string): void;
/**
* Load and validates the cloud assembly manifest from file.
*
* @param filePath - path to the manifest file.
*/
static loadAssemblyManifest(filePath: string, options?: LoadManifestOptions): assembly.AssemblyManifest;
/**
* Validates and saves the asset manifest to file.
*
* @param manifest - manifest.
* @param filePath - output file path.
*/
static saveAssetManifest(manifest: assets.AssetManifest, filePath: string): void;
/**
* Load and validates the asset manifest from file.
*
* @param filePath - path to the manifest file.
*/
static loadAssetManifest(filePath: string): assets.AssetManifest;
/**
* Validates and saves the integ manifest to file.
*
* @param manifest - manifest.
* @param filePath - output file path.
*/
static saveIntegManifest(manifest: integ.IntegManifest, filePath: string): void;
/**
* Load and validates the integ manifest from file.
*
* @param filePath - path to the manifest file.
*/
static loadIntegManifest(filePath: string): integ.IntegManifest;
/**
* Fetch the current schema version number.
*/
static version(): string;
/**
* Return the CLI version that supports this Cloud Assembly Schema version
*/
static cliVersion(): string | undefined;
/**
* Deprecated
* @deprecated use `saveAssemblyManifest()`
*/
static save(manifest: assembly.AssemblyManifest, filePath: string): void;
/**
* Deprecated
* @deprecated use `loadAssemblyManifest()`
*/
static load(filePath: string): assembly.AssemblyManifest;
private static validate;
private static saveManifest;
private static loadManifest;
/**
* Fix the casing of stack tags entries
*
* At the very beginning of the CDK we used to emit stack tags as an object with
* `{ Key, Value }` keys; this had the "advantage" that we could stick those
* tags directly into the `CreateChangeSet` call.
*
* Then we later on used jsii on the assembly schema and we were forced to type
* the in-memory objects as `{ key, value }` with lowercase letters. Now the
* objects have a different on-disk and in-memory format, and we need to convert
* between them.
*
* For backwards compatibility reasons, we used to convert lowercase in-memory
* to uppercase on-disk variant until very recently. This is now unnecessary,
* since no officially supported CDK tools read the stack tags from the
* metadata; the CLI and toolkit library read stack tags from the artifact
* properties.
*
* So although we don't emit uppercase stack tag objects anymore, we might still read
* manifests that have them. Because the manifest we read must pass JSON Schema
* validation (which expects lowercase tag objects), we have to fix the casing
* of these objects after reading from disk and before validating.
*
* That's what this function does.
*/
private static patchStackTagsOnRead;
/**
* Validates that `assumeRoleAdditionalOptions` doesn't contain nor `ExternalId` neither `RoleArn`, as they
* should have dedicated properties preceding this (e.g `assumeRoleArn` and `assumeRoleExternalId`).
*/
private static validateAssumeRoleAdditionalOptions;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
../semver/bin/semver.js

View File

@@ -0,0 +1,10 @@
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

View File

@@ -0,0 +1,21 @@
jsonschema is licensed under MIT license.
Copyright (C) 2012-2015 Tom de Grunt <tom@degrunt.nl>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,421 @@
[![Build Status](https://secure.travis-ci.org/tdegrunt/jsonschema.svg)](http://travis-ci.org/tdegrunt/jsonschema)
# jsonschema
[JSON schema](http://json-schema.org/) validator, which is designed to be fast and simple to use. JSON Schema versions through draft-07 are fully supported.
## Contributing & bugs
Please fork the repository, make the changes in your fork and include tests. Once you're done making changes, send in a pull request.
### Bug reports
Please include a test which shows why the code fails.
## Usage
### Simple
Simple object validation using JSON schemas.
```javascript
var Validator = require('jsonschema').Validator;
var v = new Validator();
var instance = 4;
var schema = {"type": "number"};
console.log(v.validate(instance, schema));
```
### Even simpler
```javascript
var validate = require('jsonschema').validate;
console.log(validate(4, {"type": "number"}));
```
### Complex example, with split schemas and references
```javascript
var Validator = require('jsonschema').Validator;
var v = new Validator();
// Address, to be embedded on Person
var addressSchema = {
"id": "/SimpleAddress",
"type": "object",
"properties": {
"lines": {
"type": "array",
"items": {"type": "string"}
},
"zip": {"type": "string"},
"city": {"type": "string"},
"country": {"type": "string"}
},
"required": ["country"]
};
// Person
var schema = {
"id": "/SimplePerson",
"type": "object",
"properties": {
"name": {"type": "string"},
"address": {"$ref": "/SimpleAddress"},
"votes": {"type": "integer", "minimum": 1}
}
};
var p = {
"name": "Barack Obama",
"address": {
"lines": [ "1600 Pennsylvania Avenue Northwest" ],
"zip": "DC 20500",
"city": "Washington",
"country": "USA"
},
"votes": "lots"
};
v.addSchema(addressSchema, '/SimpleAddress');
console.log(v.validate(p, schema));
```
### Example for Array schema
```json
var arraySchema = {
"type": "array",
"items": {
"properties": {
"name": { "type": "string" },
"lastname": { "type": "string" }
},
"required": ["name", "lastname"]
}
}
```
For a comprehensive, annotated example illustrating all possible validation options, see [examples/all.js](./examples/all.js)
## Features
### Definitions
All schema definitions are supported, $schema is ignored.
### Types
All types are supported
### Handling `undefined`
`undefined` is not a value known to JSON, and by default, the validator treats it as if it is not invalid. i.e., it will return valid.
```javascript
var res = validate(undefined, {type: 'string'});
res.valid // true
```
This behavior may be changed with the "required" option:
```javascript
var res = validate(undefined, {type: 'string'}, {required: true});
res.valid // false
```
### Formats
#### Disabling the format keyword.
You may disable format validation by providing `disableFormat: true` to the validator
options.
#### String Formats
All formats are supported, phone numbers are expected to follow the [E.123](http://en.wikipedia.org/wiki/E.123) standard.
#### Custom Formats
You may add your own custom format functions. Format functions accept the input
being validated and return a boolean value. If the returned value is `true`, then
validation succeeds. If the returned value is `false`, then validation fails.
* Formats added to `Validator.prototype.customFormats` do not affect previously instantiated
Validators. This is to prevent validator instances from being altered once created.
It is conceivable that multiple validators may be created to handle multiple schemas
with different formats in a program.
* Formats added to `validator.customFormats` affect only that Validator instance.
Here is an example that uses custom formats:
```javascript
Validator.prototype.customFormats.myFormat = function(input) {
return input === 'myFormat';
};
var validator = new Validator();
validator.validate('myFormat', {type: 'string', format: 'myFormat'}).valid; // true
validator.validate('foo', {type: 'string', format: 'myFormat'}).valid; // false
```
### Results
By default, results will be returned in a `ValidatorResult` object with the following properties:
* `instance`: any.
* `schema`: Schema.
* `errors`: ValidationError[].
* `valid`: boolean.
Each item in `errors` is a `ValidationError` with the following properties:
* path: array. An array of property keys or array offsets, indicating where inside objects or arrays the instance was found.
* property: string. Describes the property path. Starts with `instance`, and is delimited with a dot (`.`).
* message: string. A human-readable message for debugging use. Provided in English and subject to change.
* schema: object. The schema containing the keyword that failed
* instance: any. The instance that failed
* name: string. The keyword within the schema that failed.
* argument: any. Provides information about the keyword that failed.
The validator can be configured to throw in the event of a validation error:
* If the `throwFirst` option is set, the validator will terminate validation at the first encountered error and throw a `ValidatorResultError` object.
* If the `throwAll` option is set, the validator will throw a `ValidatorResultError` object after the entire instance has been validated.
* If the `throwError` option is set, it will throw at the first encountered validation error (like `throwFirst`), but the `ValidationError` object itself will be thrown. Note that, despite the name, this does not inherit from Error like `ValidatorResultError` does.
The `ValidatorResultError` object has the same properties as `ValidatorResult` and additionally inherits from Error.
#### "nestedErrors" option
When `oneOf` or `anyOf` validations fail, errors that caused any of the sub-schemas referenced therein to fail are normally suppressed, because it is not necessary to fix all of them. And in the case of `oneOf`, it would itself be an error to fix all of the listed errors.
This behavior may be configured with `options.nestedErrors`. If truthy, it will emit all the errors from the subschemas. This option may be useful when troubleshooting validation errors in complex schemas:
```javascript
var schema = {
oneOf: [
{ type: 'string', minLength: 32, maxLength: 32 },
{ type: 'string', maxLength: 16 },
{ type: 'number' },
]
};
var validator = new Validator();
var result = validator.validate('This string is 28 chars long', schema, {nestedErrors: true});
// result.toString() reads out:
// 0: instance does not meet minimum length of 32
// 1: instance does not meet maximum length of 16
// 2: instance is not of a type(s) number
// 3: instance is not exactly one from [subschema 0],[subschema 1],[subschema 2]
```
#### Localizing Error Messages
To provide localized, human-readable errors, use the `name` string as a translation key. Feel free to open an issue for support relating to localizing error messages. For example:
```
var localized = result.errors.map(function(err){
return localeService.translate(err.name);
});
```
### Custom keywords
Specify your own JSON Schema keywords with the validator.attributes property:
```javascript
validator.attributes.contains = function validateContains(instance, schema, options, ctx) {
if(typeof instance !== 'string') return;
if(typeof schema.contains !== 'string') throw new jsonschema.SchemaError('"contains" expects a string', schema);
if(instance.indexOf(schema.contains)<0){
return 'does not contain the string ' + JSON.stringify(schema.contains);
}
}
var result = validator.validate("I am an instance", { type:"string", contains: "I am" });
// result.valid === true;
```
The instance passes validation if the function returns nothing. A single validation error is produced
if the function returns a string. Any number of errors (maybe none at all) may be returned by passing a
`ValidatorResult` object, which may be used like so:
```javascript
var result = new ValidatorResult(instance, schema, options, ctx);
while(someErrorCondition()){
result.addError('fails some validation test');
}
return result;
```
### Dereferencing schemas
Sometimes you may want to download schemas from remote sources, like a database, or over HTTP. When importing a schema,
unknown references are inserted into the `validator.unresolvedRefs` Array. Asynchronously shift elements off this array and import
them:
```javascript
var Validator = require('jsonschema').Validator;
var v = new Validator();
v.addSchema(initialSchema);
function importNextSchema(){
var nextSchema = v.unresolvedRefs.shift();
if(!nextSchema){ done(); return; }
databaseGet(nextSchema, function(schema){
v.addSchema(schema);
importNextSchema();
});
}
importNextSchema();
```
### Default base URI
Schemas should typically have an `id` with an absolute, full URI. However if the schema you are using contains only relative URI references, the `base` option will be used to resolve these.
This following example would throw a `SchemaError` if the `base` option were unset:
```javascript
var result = validate(["Name"], {
id: "/schema.json",
type: "array",
items: { $ref: "http://example.com/schema.json#/definitions/item" },
definitions: {
item: { type: "string" },
},
}, { base: 'http://example.com/' });
```
### Rewrite Hook
The `rewrite` option lets you change the value of an instance after it has successfully been validated. This will mutate the `instance` passed to the validate function. This can be useful for unmarshalling data and parsing it into native instances, such as changing a string to a `Date` instance.
The `rewrite` option accepts a function with the following arguments:
* instance: any
* schema: object
* options: object
* ctx: object
* return value: any new value for the instance
The value may be removed by returning `undefined`.
If you don't want to change the value, call `return instance`.
Here is an example that can convert a property expecting a date into a Date instance:
```javascript
const schema = {
properties: {
date: {id: 'http://example.com/date', type: 'string'},
},
};
const value = {
date: '2020-09-30T23:39:27.060Z',
};
function unmarshall(instance, schema){
if(schema.id === 'http://example.com/date'){
return new Date(instance);
}
return instance;
}
const v = new Validator();
const res = v.validate(value, schema, {rewrite: unmarshall});
assert(res.instance.date instanceof Date);
```
### Pre-Property Validation Hook
If some processing of properties is required prior to validation a function may be passed via the options parameter of the validate function. For example, say you needed to perform type coercion for some properties:
```javascript
// See examples/coercion.js
function preValidateProperty(object, key, schema, options, ctx) {
var value = object[key];
if (typeof value === 'undefined') return;
// Test if the schema declares a type, but the type keyword fails validation
if (schema.type && validator.attributes.type.call(validator, value, schema, options, ctx.makeChild(schema, key))) {
// If the type is "number" but the instance is not a number, cast it
if(schema.type==='number' && typeof value!=='number'){
object[key] = parseFloat(value);
return;
}
// If the type is "string" but the instance is not a string, cast it
if(schema.type==='string' && typeof value!=='string'){
object[key] = String(value).toString();
return;
}
}
};
// And now, to actually perform validation with the coercion hook!
v.validate(instance, schema, { preValidateProperty });
```
### Skip validation of certain keywords
Use the "skipAttributes" option to skip validation of certain keywords. Provide an array of keywords to ignore.
For skipping the "format" keyword, see the disableFormat option.
### Fail on unknown keywords
By default, JSON Schema is supposed to ignore unknown schema keywords.
You can change this behavior to require that all keywords used in a schema have a defined behavior, by using setting the "allowUnknownAttributes" option to false.
This example will throw a `SchemaError`:
```javascript
var schema = {
type: "string",
format: "email",
example: "foo",
};
var result = validate("Name", schema, { allowUnknownAttributes: false });
```
## Tests
Uses [JSON Schema Test Suite](https://github.com/json-schema/JSON-Schema-Test-Suite) as well as our own tests.
You'll need to update and init the git submodules:
git submodule update --init
npm test
## Contributions
This library would not be possible without the valuable contributions by:
- Austin Wright
... and many others!
## License
jsonschema is licensed under MIT license.
Copyright (C) 2012-2019 Tom de Grunt <tom@degrunt.nl>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,978 @@
'use strict';
var helpers = require('./helpers');
/** @type ValidatorResult */
var ValidatorResult = helpers.ValidatorResult;
/** @type SchemaError */
var SchemaError = helpers.SchemaError;
var attribute = {};
attribute.ignoreProperties = {
// informative properties
'id': true,
'default': true,
'description': true,
'title': true,
// arguments to other properties
'additionalItems': true,
'then': true,
'else': true,
// special-handled properties
'$schema': true,
'$ref': true,
'extends': true,
};
/**
* @name validators
*/
var validators = attribute.validators = {};
/**
* Validates whether the instance if of a certain type
* @param instance
* @param schema
* @param options
* @param ctx
* @return {ValidatorResult|null}
*/
validators.type = function validateType (instance, schema, options, ctx) {
// Ignore undefined instances
if (instance === undefined) {
return null;
}
var result = new ValidatorResult(instance, schema, options, ctx);
var types = Array.isArray(schema.type) ? schema.type : [schema.type];
if (!types.some(this.testType.bind(this, instance, schema, options, ctx))) {
var list = types.map(function (v) {
if(!v) return;
var id = v.$id || v.id;
return id ? ('<' + id + '>') : (v+'');
});
result.addError({
name: 'type',
argument: list,
message: "is not of a type(s) " + list,
});
}
return result;
};
function testSchemaNoThrow(instance, options, ctx, callback, schema){
var throwError = options.throwError;
var throwAll = options.throwAll;
options.throwError = false;
options.throwAll = false;
var res = this.validateSchema(instance, schema, options, ctx);
options.throwError = throwError;
options.throwAll = throwAll;
if (!res.valid && callback instanceof Function) {
callback(res);
}
return res.valid;
}
/**
* Validates whether the instance matches some of the given schemas
* @param instance
* @param schema
* @param options
* @param ctx
* @return {ValidatorResult|null}
*/
validators.anyOf = function validateAnyOf (instance, schema, options, ctx) {
// Ignore undefined instances
if (instance === undefined) {
return null;
}
var result = new ValidatorResult(instance, schema, options, ctx);
var inner = new ValidatorResult(instance, schema, options, ctx);
if (!Array.isArray(schema.anyOf)){
throw new SchemaError("anyOf must be an array");
}
if (!schema.anyOf.some(
testSchemaNoThrow.bind(
this, instance, options, ctx, function(res){inner.importErrors(res);}
))) {
var list = schema.anyOf.map(function (v, i) {
var id = v.$id || v.id;
if(id) return '<' + id + '>';
return(v.title && JSON.stringify(v.title)) || (v['$ref'] && ('<' + v['$ref'] + '>')) || '[subschema '+i+']';
});
if (options.nestedErrors) {
result.importErrors(inner);
}
result.addError({
name: 'anyOf',
argument: list,
message: "is not any of " + list.join(','),
});
}
return result;
};
/**
* Validates whether the instance matches every given schema
* @param instance
* @param schema
* @param options
* @param ctx
* @return {String|null}
*/
validators.allOf = function validateAllOf (instance, schema, options, ctx) {
// Ignore undefined instances
if (instance === undefined) {
return null;
}
if (!Array.isArray(schema.allOf)){
throw new SchemaError("allOf must be an array");
}
var result = new ValidatorResult(instance, schema, options, ctx);
var self = this;
schema.allOf.forEach(function(v, i){
var valid = self.validateSchema(instance, v, options, ctx);
if(!valid.valid){
var id = v.$id || v.id;
var msg = id || (v.title && JSON.stringify(v.title)) || (v['$ref'] && ('<' + v['$ref'] + '>')) || '[subschema '+i+']';
result.addError({
name: 'allOf',
argument: { id: msg, length: valid.errors.length, valid: valid },
message: 'does not match allOf schema ' + msg + ' with ' + valid.errors.length + ' error[s]:',
});
result.importErrors(valid);
}
});
return result;
};
/**
* Validates whether the instance matches exactly one of the given schemas
* @param instance
* @param schema
* @param options
* @param ctx
* @return {String|null}
*/
validators.oneOf = function validateOneOf (instance, schema, options, ctx) {
// Ignore undefined instances
if (instance === undefined) {
return null;
}
if (!Array.isArray(schema.oneOf)){
throw new SchemaError("oneOf must be an array");
}
var result = new ValidatorResult(instance, schema, options, ctx);
var inner = new ValidatorResult(instance, schema, options, ctx);
var count = schema.oneOf.filter(
testSchemaNoThrow.bind(
this, instance, options, ctx, function(res) {inner.importErrors(res);}
) ).length;
var list = schema.oneOf.map(function (v, i) {
var id = v.$id || v.id;
return id || (v.title && JSON.stringify(v.title)) || (v['$ref'] && ('<' + v['$ref'] + '>')) || '[subschema '+i+']';
});
if (count!==1) {
if (options.nestedErrors) {
result.importErrors(inner);
}
result.addError({
name: 'oneOf',
argument: list,
message: "is not exactly one from " + list.join(','),
});
}
return result;
};
/**
* Validates "then" or "else" depending on the result of validating "if"
* @param instance
* @param schema
* @param options
* @param ctx
* @return {String|null}
*/
validators.if = function validateIf (instance, schema, options, ctx) {
// Ignore undefined instances
if (instance === undefined) return null;
if (!helpers.isSchema(schema.if)) throw new Error('Expected "if" keyword to be a schema');
var ifValid = testSchemaNoThrow.call(this, instance, options, ctx, null, schema.if);
var result = new ValidatorResult(instance, schema, options, ctx);
var res;
if(ifValid){
if (schema.then === undefined) return;
if (!helpers.isSchema(schema.then)) throw new Error('Expected "then" keyword to be a schema');
res = this.validateSchema(instance, schema.then, options, ctx.makeChild(schema.then));
result.importErrors(res);
}else{
if (schema.else === undefined) return;
if (!helpers.isSchema(schema.else)) throw new Error('Expected "else" keyword to be a schema');
res = this.validateSchema(instance, schema.else, options, ctx.makeChild(schema.else));
result.importErrors(res);
}
return result;
};
function getEnumerableProperty(object, key){
// Determine if `key` shows up in `for(var key in object)`
// First test Object.hasOwnProperty.call as an optimization: that guarantees it does
if(Object.hasOwnProperty.call(object, key)) return object[key];
// Test `key in object` as an optimization; false means it won't
if(!(key in object)) return;
while( (object = Object.getPrototypeOf(object)) ){
if(Object.propertyIsEnumerable.call(object, key)) return object[key];
}
}
/**
* Validates propertyNames
* @param instance
* @param schema
* @param options
* @param ctx
* @return {String|null|ValidatorResult}
*/
validators.propertyNames = function validatePropertyNames (instance, schema, options, ctx) {
if(!this.types.object(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
var subschema = schema.propertyNames!==undefined ? schema.propertyNames : {};
if(!helpers.isSchema(subschema)) throw new SchemaError('Expected "propertyNames" to be a schema (object or boolean)');
for (var property in instance) {
if(getEnumerableProperty(instance, property) !== undefined){
var res = this.validateSchema(property, subschema, options, ctx.makeChild(subschema));
result.importErrors(res);
}
}
return result;
};
/**
* Validates properties
* @param instance
* @param schema
* @param options
* @param ctx
* @return {String|null|ValidatorResult}
*/
validators.properties = function validateProperties (instance, schema, options, ctx) {
if(!this.types.object(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
var properties = schema.properties || {};
for (var property in properties) {
var subschema = properties[property];
if(subschema===undefined){
continue;
}else if(subschema===null){
throw new SchemaError('Unexpected null, expected schema in "properties"');
}
if (typeof options.preValidateProperty == 'function') {
options.preValidateProperty(instance, property, subschema, options, ctx);
}
var prop = getEnumerableProperty(instance, property);
var res = this.validateSchema(prop, subschema, options, ctx.makeChild(subschema, property));
if(res.instance !== result.instance[property]) result.instance[property] = res.instance;
result.importErrors(res);
}
return result;
};
/**
* Test a specific property within in instance against the additionalProperties schema attribute
* This ignores properties with definitions in the properties schema attribute, but no other attributes.
* If too many more types of property-existence tests pop up they may need their own class of tests (like `type` has)
* @private
* @return {boolean}
*/
function testAdditionalProperty (instance, schema, options, ctx, property, result) {
if(!this.types.object(instance)) return;
if (schema.properties && schema.properties[property] !== undefined) {
return;
}
if (schema.additionalProperties === false) {
result.addError({
name: 'additionalProperties',
argument: property,
message: "is not allowed to have the additional property " + JSON.stringify(property),
});
} else {
var additionalProperties = schema.additionalProperties || {};
if (typeof options.preValidateProperty == 'function') {
options.preValidateProperty(instance, property, additionalProperties, options, ctx);
}
var res = this.validateSchema(instance[property], additionalProperties, options, ctx.makeChild(additionalProperties, property));
if(res.instance !== result.instance[property]) result.instance[property] = res.instance;
result.importErrors(res);
}
}
/**
* Validates patternProperties
* @param instance
* @param schema
* @param options
* @param ctx
* @return {String|null|ValidatorResult}
*/
validators.patternProperties = function validatePatternProperties (instance, schema, options, ctx) {
if(!this.types.object(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
var patternProperties = schema.patternProperties || {};
for (var property in instance) {
var test = true;
for (var pattern in patternProperties) {
var subschema = patternProperties[pattern];
if(subschema===undefined){
continue;
}else if(subschema===null){
throw new SchemaError('Unexpected null, expected schema in "patternProperties"');
}
try {
var regexp = new RegExp(pattern, 'u');
} catch(_e) {
// In the event the stricter handling causes an error, fall back on the forgiving handling
// DEPRECATED
regexp = new RegExp(pattern);
}
if (!regexp.test(property)) {
continue;
}
test = false;
if (typeof options.preValidateProperty == 'function') {
options.preValidateProperty(instance, property, subschema, options, ctx);
}
var res = this.validateSchema(instance[property], subschema, options, ctx.makeChild(subschema, property));
if(res.instance !== result.instance[property]) result.instance[property] = res.instance;
result.importErrors(res);
}
if (test) {
testAdditionalProperty.call(this, instance, schema, options, ctx, property, result);
}
}
return result;
};
/**
* Validates additionalProperties
* @param instance
* @param schema
* @param options
* @param ctx
* @return {String|null|ValidatorResult}
*/
validators.additionalProperties = function validateAdditionalProperties (instance, schema, options, ctx) {
if(!this.types.object(instance)) return;
// if patternProperties is defined then we'll test when that one is called instead
if (schema.patternProperties) {
return null;
}
var result = new ValidatorResult(instance, schema, options, ctx);
for (var property in instance) {
testAdditionalProperty.call(this, instance, schema, options, ctx, property, result);
}
return result;
};
/**
* Validates whether the instance value is at least of a certain length, when the instance value is a string.
* @param instance
* @param schema
* @return {String|null}
*/
validators.minProperties = function validateMinProperties (instance, schema, options, ctx) {
if (!this.types.object(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
var keys = Object.keys(instance);
if (!(keys.length >= schema.minProperties)) {
result.addError({
name: 'minProperties',
argument: schema.minProperties,
message: "does not meet minimum property length of " + schema.minProperties,
});
}
return result;
};
/**
* Validates whether the instance value is at most of a certain length, when the instance value is a string.
* @param instance
* @param schema
* @return {String|null}
*/
validators.maxProperties = function validateMaxProperties (instance, schema, options, ctx) {
if (!this.types.object(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
var keys = Object.keys(instance);
if (!(keys.length <= schema.maxProperties)) {
result.addError({
name: 'maxProperties',
argument: schema.maxProperties,
message: "does not meet maximum property length of " + schema.maxProperties,
});
}
return result;
};
/**
* Validates items when instance is an array
* @param instance
* @param schema
* @param options
* @param ctx
* @return {String|null|ValidatorResult}
*/
validators.items = function validateItems (instance, schema, options, ctx) {
var self = this;
if (!this.types.array(instance)) return;
if (schema.items===undefined) return;
var result = new ValidatorResult(instance, schema, options, ctx);
instance.every(function (value, i) {
if(Array.isArray(schema.items)){
var items = schema.items[i]===undefined ? schema.additionalItems : schema.items[i];
}else{
var items = schema.items;
}
if (items === undefined) {
return true;
}
if (items === false) {
result.addError({
name: 'items',
message: "additionalItems not permitted",
});
return false;
}
var res = self.validateSchema(value, items, options, ctx.makeChild(items, i));
if(res.instance !== result.instance[i]) result.instance[i] = res.instance;
result.importErrors(res);
return true;
});
return result;
};
/**
* Validates the "contains" keyword
* @param instance
* @param schema
* @param options
* @param ctx
* @return {String|null|ValidatorResult}
*/
validators.contains = function validateContains (instance, schema, options, ctx) {
var self = this;
if (!this.types.array(instance)) return;
if (schema.contains===undefined) return;
if (!helpers.isSchema(schema.contains)) throw new Error('Expected "contains" keyword to be a schema');
var result = new ValidatorResult(instance, schema, options, ctx);
var count = instance.some(function (value, i) {
var res = self.validateSchema(value, schema.contains, options, ctx.makeChild(schema.contains, i));
return res.errors.length===0;
});
if(count===false){
result.addError({
name: 'contains',
argument: schema.contains,
message: "must contain an item matching given schema",
});
}
return result;
};
/**
* Validates minimum and exclusiveMinimum when the type of the instance value is a number.
* @param instance
* @param schema
* @return {String|null}
*/
validators.minimum = function validateMinimum (instance, schema, options, ctx) {
if (!this.types.number(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
if (schema.exclusiveMinimum && schema.exclusiveMinimum === true) {
if(!(instance > schema.minimum)){
result.addError({
name: 'minimum',
argument: schema.minimum,
message: "must be greater than " + schema.minimum,
});
}
} else {
if(!(instance >= schema.minimum)){
result.addError({
name: 'minimum',
argument: schema.minimum,
message: "must be greater than or equal to " + schema.minimum,
});
}
}
return result;
};
/**
* Validates maximum and exclusiveMaximum when the type of the instance value is a number.
* @param instance
* @param schema
* @return {String|null}
*/
validators.maximum = function validateMaximum (instance, schema, options, ctx) {
if (!this.types.number(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
if (schema.exclusiveMaximum && schema.exclusiveMaximum === true) {
if(!(instance < schema.maximum)){
result.addError({
name: 'maximum',
argument: schema.maximum,
message: "must be less than " + schema.maximum,
});
}
} else {
if(!(instance <= schema.maximum)){
result.addError({
name: 'maximum',
argument: schema.maximum,
message: "must be less than or equal to " + schema.maximum,
});
}
}
return result;
};
/**
* Validates the number form of exclusiveMinimum when the type of the instance value is a number.
* @param instance
* @param schema
* @return {String|null}
*/
validators.exclusiveMinimum = function validateExclusiveMinimum (instance, schema, options, ctx) {
// Support the boolean form of exclusiveMinimum, which is handled by the "minimum" keyword.
if(typeof schema.exclusiveMinimum === 'boolean') return;
if (!this.types.number(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
var valid = instance > schema.exclusiveMinimum;
if (!valid) {
result.addError({
name: 'exclusiveMinimum',
argument: schema.exclusiveMinimum,
message: "must be strictly greater than " + schema.exclusiveMinimum,
});
}
return result;
};
/**
* Validates the number form of exclusiveMaximum when the type of the instance value is a number.
* @param instance
* @param schema
* @return {String|null}
*/
validators.exclusiveMaximum = function validateExclusiveMaximum (instance, schema, options, ctx) {
// Support the boolean form of exclusiveMaximum, which is handled by the "maximum" keyword.
if(typeof schema.exclusiveMaximum === 'boolean') return;
if (!this.types.number(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
var valid = instance < schema.exclusiveMaximum;
if (!valid) {
result.addError({
name: 'exclusiveMaximum',
argument: schema.exclusiveMaximum,
message: "must be strictly less than " + schema.exclusiveMaximum,
});
}
return result;
};
/**
* Perform validation for multipleOf and divisibleBy, which are essentially the same.
* @param instance
* @param schema
* @param validationType
* @param errorMessage
* @returns {String|null}
*/
var validateMultipleOfOrDivisbleBy = function validateMultipleOfOrDivisbleBy (instance, schema, options, ctx, validationType, errorMessage) {
if (!this.types.number(instance)) return;
var validationArgument = schema[validationType];
if (validationArgument == 0) {
throw new SchemaError(validationType + " cannot be zero");
}
var result = new ValidatorResult(instance, schema, options, ctx);
var instanceDecimals = helpers.getDecimalPlaces(instance);
var divisorDecimals = helpers.getDecimalPlaces(validationArgument);
var maxDecimals = Math.max(instanceDecimals , divisorDecimals);
var multiplier = Math.pow(10, maxDecimals);
if (Math.round(instance * multiplier) % Math.round(validationArgument * multiplier) !== 0) {
result.addError({
name: validationType,
argument: validationArgument,
message: errorMessage + JSON.stringify(validationArgument),
});
}
return result;
};
/**
* Validates divisibleBy when the type of the instance value is a number.
* @param instance
* @param schema
* @return {String|null}
*/
validators.multipleOf = function validateMultipleOf (instance, schema, options, ctx) {
return validateMultipleOfOrDivisbleBy.call(this, instance, schema, options, ctx, "multipleOf", "is not a multiple of (divisible by) ");
};
/**
* Validates multipleOf when the type of the instance value is a number.
* @param instance
* @param schema
* @return {String|null}
*/
validators.divisibleBy = function validateDivisibleBy (instance, schema, options, ctx) {
return validateMultipleOfOrDivisbleBy.call(this, instance, schema, options, ctx, "divisibleBy", "is not divisible by (multiple of) ");
};
/**
* Validates whether the instance value is present.
* @param instance
* @param schema
* @return {String|null}
*/
validators.required = function validateRequired (instance, schema, options, ctx) {
var result = new ValidatorResult(instance, schema, options, ctx);
if (instance === undefined && schema.required === true) {
// A boolean form is implemented for reverse-compatibility with schemas written against older drafts
result.addError({
name: 'required',
message: "is required",
});
} else if (this.types.object(instance) && Array.isArray(schema.required)) {
schema.required.forEach(function(n){
if(getEnumerableProperty(instance, n)===undefined){
result.addError({
name: 'required',
argument: n,
message: "requires property " + JSON.stringify(n),
});
}
});
}
return result;
};
/**
* Validates whether the instance value matches the regular expression, when the instance value is a string.
* @param instance
* @param schema
* @return {String|null}
*/
validators.pattern = function validatePattern (instance, schema, options, ctx) {
if (!this.types.string(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
var pattern = schema.pattern;
try {
var regexp = new RegExp(pattern, 'u');
} catch(_e) {
// In the event the stricter handling causes an error, fall back on the forgiving handling
// DEPRECATED
regexp = new RegExp(pattern);
}
if (!instance.match(regexp)) {
result.addError({
name: 'pattern',
argument: schema.pattern,
message: "does not match pattern " + JSON.stringify(schema.pattern.toString()),
});
}
return result;
};
/**
* Validates whether the instance value is of a certain defined format or a custom
* format.
* The following formats are supported for string types:
* - date-time
* - date
* - time
* - ip-address
* - ipv6
* - uri
* - color
* - host-name
* - alpha
* - alpha-numeric
* - utc-millisec
* @param instance
* @param schema
* @param [options]
* @param [ctx]
* @return {String|null}
*/
validators.format = function validateFormat (instance, schema, options, ctx) {
if (instance===undefined) return;
var result = new ValidatorResult(instance, schema, options, ctx);
if (!result.disableFormat && !helpers.isFormat(instance, schema.format, this)) {
result.addError({
name: 'format',
argument: schema.format,
message: "does not conform to the " + JSON.stringify(schema.format) + " format",
});
}
return result;
};
/**
* Validates whether the instance value is at least of a certain length, when the instance value is a string.
* @param instance
* @param schema
* @return {String|null}
*/
validators.minLength = function validateMinLength (instance, schema, options, ctx) {
if (!this.types.string(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
var hsp = instance.match(/[\uDC00-\uDFFF]/g);
var length = instance.length - (hsp ? hsp.length : 0);
if (!(length >= schema.minLength)) {
result.addError({
name: 'minLength',
argument: schema.minLength,
message: "does not meet minimum length of " + schema.minLength,
});
}
return result;
};
/**
* Validates whether the instance value is at most of a certain length, when the instance value is a string.
* @param instance
* @param schema
* @return {String|null}
*/
validators.maxLength = function validateMaxLength (instance, schema, options, ctx) {
if (!this.types.string(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
// TODO if this was already computed in "minLength", use that value instead of re-computing
var hsp = instance.match(/[\uDC00-\uDFFF]/g);
var length = instance.length - (hsp ? hsp.length : 0);
if (!(length <= schema.maxLength)) {
result.addError({
name: 'maxLength',
argument: schema.maxLength,
message: "does not meet maximum length of " + schema.maxLength,
});
}
return result;
};
/**
* Validates whether instance contains at least a minimum number of items, when the instance is an Array.
* @param instance
* @param schema
* @return {String|null}
*/
validators.minItems = function validateMinItems (instance, schema, options, ctx) {
if (!this.types.array(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
if (!(instance.length >= schema.minItems)) {
result.addError({
name: 'minItems',
argument: schema.minItems,
message: "does not meet minimum length of " + schema.minItems,
});
}
return result;
};
/**
* Validates whether instance contains no more than a maximum number of items, when the instance is an Array.
* @param instance
* @param schema
* @return {String|null}
*/
validators.maxItems = function validateMaxItems (instance, schema, options, ctx) {
if (!this.types.array(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
if (!(instance.length <= schema.maxItems)) {
result.addError({
name: 'maxItems',
argument: schema.maxItems,
message: "does not meet maximum length of " + schema.maxItems,
});
}
return result;
};
/**
* Deep compares arrays for duplicates
* @param v
* @param i
* @param a
* @private
* @return {boolean}
*/
function testArrays (v, i, a) {
var j, len = a.length;
for (j = i + 1, len; j < len; j++) {
if (helpers.deepCompareStrict(v, a[j])) {
return false;
}
}
return true;
}
/**
* Validates whether there are no duplicates, when the instance is an Array.
* @param instance
* @return {String|null}
*/
validators.uniqueItems = function validateUniqueItems (instance, schema, options, ctx) {
if (schema.uniqueItems!==true) return;
if (!this.types.array(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
if (!instance.every(testArrays)) {
result.addError({
name: 'uniqueItems',
message: "contains duplicate item",
});
}
return result;
};
/**
* Validate for the presence of dependency properties, if the instance is an object.
* @param instance
* @param schema
* @param options
* @param ctx
* @return {null|ValidatorResult}
*/
validators.dependencies = function validateDependencies (instance, schema, options, ctx) {
if (!this.types.object(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
for (var property in schema.dependencies) {
if (instance[property] === undefined) {
continue;
}
var dep = schema.dependencies[property];
var childContext = ctx.makeChild(dep, property);
if (typeof dep == 'string') {
dep = [dep];
}
if (Array.isArray(dep)) {
dep.forEach(function (prop) {
if (instance[prop] === undefined) {
result.addError({
// FIXME there's two different "dependencies" errors here with slightly different outputs
// Can we make these the same? Or should we create different error types?
name: 'dependencies',
argument: childContext.propertyPath,
message: "property " + prop + " not found, required by " + childContext.propertyPath,
});
}
});
} else {
var res = this.validateSchema(instance, dep, options, childContext);
if(result.instance !== res.instance) result.instance = res.instance;
if (res && res.errors.length) {
result.addError({
name: 'dependencies',
argument: childContext.propertyPath,
message: "does not meet dependency required by " + childContext.propertyPath,
});
result.importErrors(res);
}
}
}
return result;
};
/**
* Validates whether the instance value is one of the enumerated values.
*
* @param instance
* @param schema
* @return {ValidatorResult|null}
*/
validators['enum'] = function validateEnum (instance, schema, options, ctx) {
if (instance === undefined) {
return null;
}
if (!Array.isArray(schema['enum'])) {
throw new SchemaError("enum expects an array", schema);
}
var result = new ValidatorResult(instance, schema, options, ctx);
if (!schema['enum'].some(helpers.deepCompareStrict.bind(null, instance))) {
result.addError({
name: 'enum',
argument: schema['enum'],
message: "is not one of enum values: " + schema['enum'].map(String).join(','),
});
}
return result;
};
/**
* Validates whether the instance exactly matches a given value
*
* @param instance
* @param schema
* @return {ValidatorResult|null}
*/
validators['const'] = function validateEnum (instance, schema, options, ctx) {
if (instance === undefined) {
return null;
}
var result = new ValidatorResult(instance, schema, options, ctx);
if (!helpers.deepCompareStrict(schema['const'], instance)) {
result.addError({
name: 'const',
argument: schema['const'],
message: "does not exactly match expected constant: " + schema['const'],
});
}
return result;
};
/**
* Validates whether the instance if of a prohibited type.
* @param instance
* @param schema
* @param options
* @param ctx
* @return {null|ValidatorResult}
*/
validators.not = validators.disallow = function validateNot (instance, schema, options, ctx) {
var self = this;
if(instance===undefined) return null;
var result = new ValidatorResult(instance, schema, options, ctx);
var notTypes = schema.not || schema.disallow;
if(!notTypes) return null;
if(!Array.isArray(notTypes)) notTypes=[notTypes];
notTypes.forEach(function (type) {
if (self.testType(instance, schema, options, ctx, type)) {
var id = type && (type.$id || type.id);
var schemaId = id || type;
result.addError({
name: 'not',
argument: schemaId,
message: "is of prohibited type " + schemaId,
});
}
});
return result;
};
module.exports = attribute;

View File

@@ -0,0 +1,390 @@
'use strict';
var uri = require('url');
var ValidationError = exports.ValidationError = function ValidationError (message, instance, schema, path, name, argument) {
if(Array.isArray(path)){
this.path = path;
this.property = path.reduce(function(sum, item){
return sum + makeSuffix(item);
}, 'instance');
}else if(path !== undefined){
this.property = path;
}
if (message) {
this.message = message;
}
if (schema) {
var id = schema.$id || schema.id;
this.schema = id || schema;
}
if (instance !== undefined) {
this.instance = instance;
}
this.name = name;
this.argument = argument;
this.stack = this.toString();
};
ValidationError.prototype.toString = function toString() {
return this.property + ' ' + this.message;
};
var ValidatorResult = exports.ValidatorResult = function ValidatorResult(instance, schema, options, ctx) {
this.instance = instance;
this.schema = schema;
this.options = options;
this.path = ctx.path;
this.propertyPath = ctx.propertyPath;
this.errors = [];
this.throwError = options && options.throwError;
this.throwFirst = options && options.throwFirst;
this.throwAll = options && options.throwAll;
this.disableFormat = options && options.disableFormat === true;
};
ValidatorResult.prototype.addError = function addError(detail) {
var err;
if (typeof detail == 'string') {
err = new ValidationError(detail, this.instance, this.schema, this.path);
} else {
if (!detail) throw new Error('Missing error detail');
if (!detail.message) throw new Error('Missing error message');
if (!detail.name) throw new Error('Missing validator type');
err = new ValidationError(detail.message, this.instance, this.schema, this.path, detail.name, detail.argument);
}
this.errors.push(err);
if (this.throwFirst) {
throw new ValidatorResultError(this);
}else if(this.throwError){
throw err;
}
return err;
};
ValidatorResult.prototype.importErrors = function importErrors(res) {
if (typeof res == 'string' || (res && res.validatorType)) {
this.addError(res);
} else if (res && res.errors) {
this.errors = this.errors.concat(res.errors);
}
};
function stringizer (v,i){
return i+': '+v.toString()+'\n';
}
ValidatorResult.prototype.toString = function toString(res) {
return this.errors.map(stringizer).join('');
};
Object.defineProperty(ValidatorResult.prototype, "valid", { get: function() {
return !this.errors.length;
} });
module.exports.ValidatorResultError = ValidatorResultError;
function ValidatorResultError(result) {
if(Error.captureStackTrace){
Error.captureStackTrace(this, ValidatorResultError);
}
this.instance = result.instance;
this.schema = result.schema;
this.options = result.options;
this.errors = result.errors;
}
ValidatorResultError.prototype = new Error();
ValidatorResultError.prototype.constructor = ValidatorResultError;
ValidatorResultError.prototype.name = "Validation Error";
/**
* Describes a problem with a Schema which prevents validation of an instance
* @name SchemaError
* @constructor
*/
var SchemaError = exports.SchemaError = function SchemaError (msg, schema) {
this.message = msg;
this.schema = schema;
Error.call(this, msg);
Error.captureStackTrace(this, SchemaError);
};
SchemaError.prototype = Object.create(Error.prototype,
{
constructor: {value: SchemaError, enumerable: false},
name: {value: 'SchemaError', enumerable: false},
});
var SchemaContext = exports.SchemaContext = function SchemaContext (schema, options, path, base, schemas) {
this.schema = schema;
this.options = options;
if(Array.isArray(path)){
this.path = path;
this.propertyPath = path.reduce(function(sum, item){
return sum + makeSuffix(item);
}, 'instance');
}else{
this.propertyPath = path;
}
this.base = base;
this.schemas = schemas;
};
SchemaContext.prototype.resolve = function resolve (target) {
return uri.resolve(this.base, target);
};
SchemaContext.prototype.makeChild = function makeChild(schema, propertyName){
var path = (propertyName===undefined) ? this.path : this.path.concat([propertyName]);
var id = schema.$id || schema.id;
var base = uri.resolve(this.base, id||'');
var ctx = new SchemaContext(schema, this.options, path, base, Object.create(this.schemas));
if(id && !ctx.schemas[base]){
ctx.schemas[base] = schema;
}
return ctx;
};
var FORMAT_REGEXPS = exports.FORMAT_REGEXPS = {
// 7.3.1. Dates, Times, and Duration
'date-time': /^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,
'date': /^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,
'time': /^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,
'duration': /P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,
// 7.3.2. Email Addresses
// TODO: fix the email production
'email': /^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,
'idn-email': /^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,
// 7.3.3. Hostnames
// 7.3.4. IP Addresses
'ip-address': /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,
// FIXME whitespace is invalid
'ipv6': /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,
// 7.3.5. Resource Identifiers
// TODO: A more accurate regular expression for "uri" goes:
// [A-Za-z][+\-.0-9A-Za-z]*:((/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?)?#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])|/?%[0-9A-Fa-f]{2}|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*(#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?)?
'uri': /^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,
'uri-reference': /^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,
'iri': /^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,
'iri-reference': /^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,
'uuid': /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
// 7.3.6. uri-template
'uri-template': /(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,
// 7.3.7. JSON Pointers
'json-pointer': /^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,
'relative-json-pointer': /^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,
// hostname regex from: http://stackoverflow.com/a/1420225/5628
'hostname': /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,
'host-name': /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,
'utc-millisec': function (input) {
return (typeof input === 'string') && parseFloat(input) === parseInt(input, 10) && !isNaN(input);
},
// 7.3.8. regex
'regex': function (input) {
var result = true;
try {
new RegExp(input);
} catch (e) {
result = false;
}
return result;
},
// Other definitions
// "style" was removed from JSON Schema in draft-4 and is deprecated
'style': /[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,
// "color" was removed from JSON Schema in draft-4 and is deprecated
'color': /^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,
'phone': /^\+(?:[0-9] ?){6,14}[0-9]$/,
'alpha': /^[a-zA-Z]+$/,
'alphanumeric': /^[a-zA-Z0-9]+$/,
};
FORMAT_REGEXPS.regexp = FORMAT_REGEXPS.regex;
FORMAT_REGEXPS.pattern = FORMAT_REGEXPS.regex;
FORMAT_REGEXPS.ipv4 = FORMAT_REGEXPS['ip-address'];
exports.isFormat = function isFormat (input, format, validator) {
if (typeof input === 'string' && FORMAT_REGEXPS[format] !== undefined) {
if (FORMAT_REGEXPS[format] instanceof RegExp) {
return FORMAT_REGEXPS[format].test(input);
}
if (typeof FORMAT_REGEXPS[format] === 'function') {
return FORMAT_REGEXPS[format](input);
}
} else if (validator && validator.customFormats &&
typeof validator.customFormats[format] === 'function') {
return validator.customFormats[format](input);
}
return true;
};
var makeSuffix = exports.makeSuffix = function makeSuffix (key) {
key = key.toString();
// This function could be capable of outputting valid a ECMAScript string, but the
// resulting code for testing which form to use would be tens of thousands of characters long
// That means this will use the name form for some illegal forms
if (!key.match(/[.\s\[\]]/) && !key.match(/^[\d]/)) {
return '.' + key;
}
if (key.match(/^\d+$/)) {
return '[' + key + ']';
}
return '[' + JSON.stringify(key) + ']';
};
exports.deepCompareStrict = function deepCompareStrict (a, b) {
if (typeof a !== typeof b) {
return false;
}
if (Array.isArray(a)) {
if (!Array.isArray(b)) {
return false;
}
if (a.length !== b.length) {
return false;
}
return a.every(function (v, i) {
return deepCompareStrict(a[i], b[i]);
});
}
if (typeof a === 'object') {
if (!a || !b) {
return a === b;
}
var aKeys = Object.keys(a);
var bKeys = Object.keys(b);
if (aKeys.length !== bKeys.length) {
return false;
}
return aKeys.every(function (v) {
return deepCompareStrict(a[v], b[v]);
});
}
return a === b;
};
function deepMerger (target, dst, e, i) {
if (typeof e === 'object') {
dst[i] = deepMerge(target[i], e);
} else {
if (target.indexOf(e) === -1) {
dst.push(e);
}
}
}
function copyist (src, dst, key) {
dst[key] = src[key];
}
function copyistWithDeepMerge (target, src, dst, key) {
if (typeof src[key] !== 'object' || !src[key]) {
dst[key] = src[key];
}
else {
if (!target[key]) {
dst[key] = src[key];
} else {
dst[key] = deepMerge(target[key], src[key]);
}
}
}
function deepMerge (target, src) {
var array = Array.isArray(src);
var dst = array && [] || {};
if (array) {
target = target || [];
dst = dst.concat(target);
src.forEach(deepMerger.bind(null, target, dst));
} else {
if (target && typeof target === 'object') {
Object.keys(target).forEach(copyist.bind(null, target, dst));
}
Object.keys(src).forEach(copyistWithDeepMerge.bind(null, target, src, dst));
}
return dst;
}
module.exports.deepMerge = deepMerge;
/**
* Validates instance against the provided schema
* Implements URI+JSON Pointer encoding, e.g. "%7e"="~0"=>"~", "~1"="%2f"=>"/"
* @param o
* @param s The path to walk o along
* @return any
*/
exports.objectGetPath = function objectGetPath(o, s) {
var parts = s.split('/').slice(1);
var k;
while (typeof (k=parts.shift()) == 'string') {
var n = decodeURIComponent(k.replace(/~0/,'~').replace(/~1/g,'/'));
if (!(n in o)) return;
o = o[n];
}
return o;
};
function pathEncoder (v) {
return '/'+encodeURIComponent(v).replace(/~/g,'%7E');
}
/**
* Accept an Array of property names and return a JSON Pointer URI fragment
* @param Array a
* @return {String}
*/
exports.encodePath = function encodePointer(a){
// ~ must be encoded explicitly because hacks
// the slash is encoded by encodeURIComponent
return a.map(pathEncoder).join('');
};
/**
* Calculate the number of decimal places a number uses
* We need this to get correct results out of multipleOf and divisibleBy
* when either figure is has decimal places, due to IEEE-754 float issues.
* @param number
* @returns {number}
*/
exports.getDecimalPlaces = function getDecimalPlaces(number) {
var decimalPlaces = 0;
if (isNaN(number)) return decimalPlaces;
if (typeof number !== 'number') {
number = Number(number);
}
var parts = number.toString().split('e');
if (parts.length === 2) {
if (parts[1][0] !== '-') {
return decimalPlaces;
} else {
decimalPlaces = Number(parts[1].slice(1));
}
}
var decimalParts = parts[0].split('.');
if (decimalParts.length === 2) {
decimalPlaces += decimalParts[1].length;
}
return decimalPlaces;
};
exports.isSchema = function isSchema(val){
return (typeof val === 'object' && val) || (typeof val === 'boolean');
};

View File

@@ -0,0 +1,142 @@
/*
This is type definition for typescript.
This is for library users. Thus, properties and methods for internal use is omitted.
*/
export declare class Validator {
constructor();
customFormats: {[formatName: string]: CustomFormat};
schemas: {[id: string]: Schema};
unresolvedRefs: string[];
attributes: {[property: string]: CustomProperty};
addSchema(schema?: Schema, uri?: string): Schema|void;
validate(instance: any, schema: Schema, options?: Options, ctx?: SchemaContext): ValidatorResult;
}
export declare class ValidatorResult {
constructor(instance: any, schema: Schema, options: Options, ctx: SchemaContext)
instance: any;
schema: Schema;
propertyPath: string;
errors: ValidationError[];
throwError: boolean;
disableFormat: boolean;
valid: boolean;
addError(detail: string|ErrorDetail): ValidationError;
toString(): string;
}
export declare class ValidationError {
constructor(message?: string, instance?: any, schema?: Schema, propertyPath?: any, name?: string, argument?: any);
path: (string|number)[];
property: string;
message: string;
schema: string|Schema;
instance: any;
name: string;
argument: any;
toString(): string;
stack: string;
}
export declare class SchemaError extends Error{
constructor(msg: string, schema: Schema);
schema: Schema;
message: string;
}
export declare function validate(instance: any, schema: any, options?: Options): ValidatorResult
export interface Schema {
$id?: string
id?: string
$schema?: string
$ref?: string
title?: string
description?: string
multipleOf?: number
maximum?: number
exclusiveMaximum?: number | boolean
minimum?: number
exclusiveMinimum?: number | boolean
maxLength?: number
minLength?: number
pattern?: string | RegExp
additionalItems?: boolean | Schema
items?: Schema | Schema[]
maxItems?: number
minItems?: number
uniqueItems?: boolean
maxProperties?: number
minProperties?: number
required?: string[] | boolean
additionalProperties?: boolean | Schema
definitions?: {
[name: string]: Schema
}
properties?: {
[name: string]: Schema
}
patternProperties?: {
[name: string]: Schema
}
dependencies?: {
[name: string]: Schema | string[]
}
const?: any
'enum'?: any[]
type?: string | string[]
format?: string
allOf?: Schema[]
anyOf?: Schema[]
oneOf?: Schema[]
not?: Schema
if?: Schema
then?: Schema
else?: Schema
}
export interface Options {
skipAttributes?: string[];
allowUnknownAttributes?: boolean;
preValidateProperty?: PreValidatePropertyFunction;
rewrite?: RewriteFunction;
base?: string;
throwError?: boolean;
required?: boolean;
throwFirst?: boolean;
throwAll?: boolean;
nestedErrors?: boolean;
}
export interface RewriteFunction {
(instance: any, schema: Schema, options: Options, ctx: SchemaContext): any;
}
export interface PreValidatePropertyFunction {
(instance: any, key: string, schema: Schema, options: Options, ctx: SchemaContext): any;
}
export interface SchemaContext {
schema: Schema;
options: Options;
propertyPath: string;
base: string;
schemas: {[base: string]: Schema};
makeChild: (schema: Schema, key: string) => SchemaContext;
}
export interface CustomFormat {
(input: any): boolean;
}
export interface CustomProperty {
(instance: any, schema: Schema, options: Options, ctx: SchemaContext): string|ValidatorResult;
}
export interface ErrorDetail {
message: string;
name: string;
argument: string;
}

View File

@@ -0,0 +1,15 @@
'use strict';
var Validator = module.exports.Validator = require('./validator');
module.exports.ValidatorResult = require('./helpers').ValidatorResult;
module.exports.ValidatorResultError = require('./helpers').ValidatorResultError;
module.exports.ValidationError = require('./helpers').ValidationError;
module.exports.SchemaError = require('./helpers').SchemaError;
module.exports.SchemaScanResult = require('./scan').SchemaScanResult;
module.exports.scan = require('./scan').scan;
module.exports.validate = function (instance, schema, options) {
var v = new Validator();
return v.validate(instance, schema, options);
};

View File

@@ -0,0 +1,75 @@
"use strict";
var urilib = require('url');
var helpers = require('./helpers');
module.exports.SchemaScanResult = SchemaScanResult;
function SchemaScanResult(found, ref){
this.id = found;
this.ref = ref;
}
/**
* Adds a schema with a certain urn to the Validator instance.
* @param string uri
* @param object schema
* @return {Object}
*/
module.exports.scan = function scan(base, schema){
function scanSchema(baseuri, schema){
if(!schema || typeof schema!='object') return;
// Mark all referenced schemas so we can tell later which schemas are referred to, but never defined
if(schema.$ref){
var resolvedUri = urilib.resolve(baseuri, schema.$ref);
ref[resolvedUri] = ref[resolvedUri] ? ref[resolvedUri]+1 : 0;
return;
}
var id = schema.$id || schema.id;
var ourBase = id ? urilib.resolve(baseuri, id) : baseuri;
if (ourBase) {
// If there's no fragment, append an empty one
if(ourBase.indexOf('#')<0) ourBase += '#';
if(found[ourBase]){
if(!helpers.deepCompareStrict(found[ourBase], schema)){
throw new Error('Schema <'+ourBase+'> already exists with different definition');
}
return found[ourBase];
}
found[ourBase] = schema;
// strip trailing fragment
if(ourBase[ourBase.length-1]=='#'){
found[ourBase.substring(0, ourBase.length-1)] = schema;
}
}
scanArray(ourBase+'/items', (Array.isArray(schema.items)?schema.items:[schema.items]));
scanArray(ourBase+'/extends', (Array.isArray(schema.extends)?schema.extends:[schema.extends]));
scanSchema(ourBase+'/additionalItems', schema.additionalItems);
scanObject(ourBase+'/properties', schema.properties);
scanSchema(ourBase+'/additionalProperties', schema.additionalProperties);
scanObject(ourBase+'/definitions', schema.definitions);
scanObject(ourBase+'/patternProperties', schema.patternProperties);
scanObject(ourBase+'/dependencies', schema.dependencies);
scanArray(ourBase+'/disallow', schema.disallow);
scanArray(ourBase+'/allOf', schema.allOf);
scanArray(ourBase+'/anyOf', schema.anyOf);
scanArray(ourBase+'/oneOf', schema.oneOf);
scanSchema(ourBase+'/not', schema.not);
}
function scanArray(baseuri, schemas){
if(!Array.isArray(schemas)) return;
for(var i=0; i<schemas.length; i++){
scanSchema(baseuri+'/'+i, schemas[i]);
}
}
function scanObject(baseuri, schemas){
if(!schemas || typeof schemas!='object') return;
for(var p in schemas){
scanSchema(baseuri+'/'+p, schemas[p]);
}
}
var found = {};
var ref = {};
scanSchema(base, schema);
return new SchemaScanResult(found, ref);
};

View File

@@ -0,0 +1,336 @@
'use strict';
var urilib = require('url');
var attribute = require('./attribute');
var helpers = require('./helpers');
var scanSchema = require('./scan').scan;
var ValidatorResult = helpers.ValidatorResult;
var ValidatorResultError = helpers.ValidatorResultError;
var SchemaError = helpers.SchemaError;
var SchemaContext = helpers.SchemaContext;
//var anonymousBase = 'vnd.jsonschema:///';
var anonymousBase = '/';
/**
* Creates a new Validator object
* @name Validator
* @constructor
*/
var Validator = function Validator () {
// Allow a validator instance to override global custom formats or to have their
// own custom formats.
this.customFormats = Object.create(Validator.prototype.customFormats);
this.schemas = {};
this.unresolvedRefs = [];
// Use Object.create to make this extensible without Validator instances stepping on each other's toes.
this.types = Object.create(types);
this.attributes = Object.create(attribute.validators);
};
// Allow formats to be registered globally.
Validator.prototype.customFormats = {};
// Hint at the presence of a property
Validator.prototype.schemas = null;
Validator.prototype.types = null;
Validator.prototype.attributes = null;
Validator.prototype.unresolvedRefs = null;
/**
* Adds a schema with a certain urn to the Validator instance.
* @param schema
* @param urn
* @return {Object}
*/
Validator.prototype.addSchema = function addSchema (schema, base) {
var self = this;
if (!schema) {
return null;
}
var scan = scanSchema(base||anonymousBase, schema);
var ourUri = base || schema.$id || schema.id;
for(var uri in scan.id){
this.schemas[uri] = scan.id[uri];
}
for(var uri in scan.ref){
// If this schema is already defined, it will be filtered out by the next step
this.unresolvedRefs.push(uri);
}
// Remove newly defined schemas from unresolvedRefs
this.unresolvedRefs = this.unresolvedRefs.filter(function(uri){
return typeof self.schemas[uri]==='undefined';
});
return this.schemas[ourUri];
};
Validator.prototype.addSubSchemaArray = function addSubSchemaArray(baseuri, schemas) {
if(!Array.isArray(schemas)) return;
for(var i=0; i<schemas.length; i++){
this.addSubSchema(baseuri, schemas[i]);
}
};
Validator.prototype.addSubSchemaObject = function addSubSchemaArray(baseuri, schemas) {
if(!schemas || typeof schemas!='object') return;
for(var p in schemas){
this.addSubSchema(baseuri, schemas[p]);
}
};
/**
* Sets all the schemas of the Validator instance.
* @param schemas
*/
Validator.prototype.setSchemas = function setSchemas (schemas) {
this.schemas = schemas;
};
/**
* Returns the schema of a certain urn
* @param urn
*/
Validator.prototype.getSchema = function getSchema (urn) {
return this.schemas[urn];
};
/**
* Validates instance against the provided schema
* @param instance
* @param schema
* @param [options]
* @param [ctx]
* @return {Array}
*/
Validator.prototype.validate = function validate (instance, schema, options, ctx) {
if((typeof schema !== 'boolean' && typeof schema !== 'object') || schema === null){
throw new SchemaError('Expected `schema` to be an object or boolean');
}
if (!options) {
options = {};
}
// This section indexes subschemas in the provided schema, so they don't need to be added with Validator#addSchema
// This will work so long as the function at uri.resolve() will resolve a relative URI to a relative URI
var id = schema.$id || schema.id;
var base = urilib.resolve(options.base||anonymousBase, id||'');
if(!ctx){
ctx = new SchemaContext(schema, options, [], base, Object.create(this.schemas));
if (!ctx.schemas[base]) {
ctx.schemas[base] = schema;
}
var found = scanSchema(base, schema);
for(var n in found.id){
var sch = found.id[n];
ctx.schemas[n] = sch;
}
}
if(options.required && instance===undefined){
var result = new ValidatorResult(instance, schema, options, ctx);
result.addError('is required, but is undefined');
return result;
}
var result = this.validateSchema(instance, schema, options, ctx);
if (!result) {
throw new Error('Result undefined');
}else if(options.throwAll && result.errors.length){
throw new ValidatorResultError(result);
}
return result;
};
/**
* @param Object schema
* @return mixed schema uri or false
*/
function shouldResolve(schema) {
var ref = (typeof schema === 'string') ? schema : schema.$ref;
if (typeof ref=='string') return ref;
return false;
}
/**
* Validates an instance against the schema (the actual work horse)
* @param instance
* @param schema
* @param options
* @param ctx
* @private
* @return {ValidatorResult}
*/
Validator.prototype.validateSchema = function validateSchema (instance, schema, options, ctx) {
var result = new ValidatorResult(instance, schema, options, ctx);
// Support for the true/false schemas
if(typeof schema==='boolean') {
if(schema===true){
// `true` is always valid
schema = {};
}else if(schema===false){
// `false` is always invalid
schema = {type: []};
}
}else if(!schema){
// This might be a string
throw new Error("schema is undefined");
}
if (schema['extends']) {
if (Array.isArray(schema['extends'])) {
var schemaobj = {schema: schema, ctx: ctx};
schema['extends'].forEach(this.schemaTraverser.bind(this, schemaobj));
schema = schemaobj.schema;
schemaobj.schema = null;
schemaobj.ctx = null;
schemaobj = null;
} else {
schema = helpers.deepMerge(schema, this.superResolve(schema['extends'], ctx));
}
}
// If passed a string argument, load that schema URI
var switchSchema = shouldResolve(schema);
if (switchSchema) {
var resolved = this.resolve(schema, switchSchema, ctx);
var subctx = new SchemaContext(resolved.subschema, options, ctx.path, resolved.switchSchema, ctx.schemas);
return this.validateSchema(instance, resolved.subschema, options, subctx);
}
var skipAttributes = options && options.skipAttributes || [];
// Validate each schema attribute against the instance
for (var key in schema) {
if (!attribute.ignoreProperties[key] && skipAttributes.indexOf(key) < 0) {
var validatorErr = null;
var validator = this.attributes[key];
if (validator) {
validatorErr = validator.call(this, instance, schema, options, ctx);
} else if (options.allowUnknownAttributes === false) {
// This represents an error with the schema itself, not an invalid instance
throw new SchemaError("Unsupported attribute: " + key, schema);
}
if (validatorErr) {
result.importErrors(validatorErr);
}
}
}
if (typeof options.rewrite == 'function') {
var value = options.rewrite.call(this, instance, schema, options, ctx);
result.instance = value;
}
return result;
};
/**
* @private
* @param Object schema
* @param SchemaContext ctx
* @returns Object schema or resolved schema
*/
Validator.prototype.schemaTraverser = function schemaTraverser (schemaobj, s) {
schemaobj.schema = helpers.deepMerge(schemaobj.schema, this.superResolve(s, schemaobj.ctx));
};
/**
* @private
* @param Object schema
* @param SchemaContext ctx
* @returns Object schema or resolved schema
*/
Validator.prototype.superResolve = function superResolve (schema, ctx) {
var ref = shouldResolve(schema);
if(ref) {
return this.resolve(schema, ref, ctx).subschema;
}
return schema;
};
/**
* @private
* @param Object schema
* @param Object switchSchema
* @param SchemaContext ctx
* @return Object resolved schemas {subschema:String, switchSchema: String}
* @throws SchemaError
*/
Validator.prototype.resolve = function resolve (schema, switchSchema, ctx) {
switchSchema = ctx.resolve(switchSchema);
// First see if the schema exists under the provided URI
if (ctx.schemas[switchSchema]) {
return {subschema: ctx.schemas[switchSchema], switchSchema: switchSchema};
}
// Else try walking the property pointer
var parsed = urilib.parse(switchSchema);
var fragment = parsed && parsed.hash;
var document = fragment && fragment.length && switchSchema.substr(0, switchSchema.length - fragment.length);
if (!document || !ctx.schemas[document]) {
throw new SchemaError("no such schema <" + switchSchema + ">", schema);
}
var subschema = helpers.objectGetPath(ctx.schemas[document], fragment.substr(1));
if(subschema===undefined){
throw new SchemaError("no such schema " + fragment + " located in <" + document + ">", schema);
}
return {subschema: subschema, switchSchema: switchSchema};
};
/**
* Tests whether the instance if of a certain type.
* @private
* @param instance
* @param schema
* @param options
* @param ctx
* @param type
* @return {boolean}
*/
Validator.prototype.testType = function validateType (instance, schema, options, ctx, type) {
if(type===undefined){
return;
}else if(type===null){
throw new SchemaError('Unexpected null in "type" keyword');
}
if (typeof this.types[type] == 'function') {
return this.types[type].call(this, instance);
}
if (type && typeof type == 'object') {
var res = this.validateSchema(instance, type, options, ctx);
return res === undefined || !(res && res.errors.length);
}
// Undefined or properties not on the list are acceptable, same as not being defined
return true;
};
var types = Validator.prototype.types = {};
types.string = function testString (instance) {
return typeof instance == 'string';
};
types.number = function testNumber (instance) {
// isFinite returns false for NaN, Infinity, and -Infinity
return typeof instance == 'number' && isFinite(instance);
};
types.integer = function testInteger (instance) {
return (typeof instance == 'number') && instance % 1 === 0;
};
types.boolean = function testBoolean (instance) {
return typeof instance == 'boolean';
};
types.array = function testArray (instance) {
return Array.isArray(instance);
};
types['null'] = function testNull (instance) {
return instance === null;
};
types.date = function testDate (instance) {
return instance instanceof Date;
};
types.any = function testAny (instance) {
return true;
};
types.object = function testObject (instance) {
// TODO: fix this - see #15
return instance && (typeof instance === 'object') && !(Array.isArray(instance)) && !(instance instanceof Date);
};
module.exports = Validator;

View File

@@ -0,0 +1,42 @@
{
"author": "Tom de Grunt <tom@degrunt.nl>",
"name": "jsonschema",
"version": "1.4.1",
"license": "MIT",
"dependencies": {},
"contributors": [
{
"name": "Austin Wright"
}
],
"main": "./lib/index.js",
"typings": "./lib/index.d.ts",
"devDependencies": {
"@stryker-mutator/core": "^4.0.0",
"@stryker-mutator/mocha-runner": "^4.0.0",
"chai": "~4.2.0",
"eslint": "^7.7.0",
"json-metaschema": "^1.2.0",
"mocha": "~8.1.1"
},
"optionalDependencies": {},
"engines": {
"node": "*"
},
"keywords": [
"json",
"schema",
"jsonschema",
"validator",
"validation"
],
"repository": {
"type": "git",
"url": "git://github.com/tdegrunt/jsonschema.git"
},
"description": "A fast and easy to use JSON Schema validator",
"scripts": {
"stryker": "stryker run",
"test": "./node_modules/.bin/mocha -R spec"
}
}

View File

@@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,665 @@
semver(1) -- The semantic versioner for npm
===========================================
## Install
```bash
npm install semver
````
## Usage
As a node module:
```js
const semver = require('semver')
semver.valid('1.2.3') // '1.2.3'
semver.valid('a.b.c') // null
semver.clean(' =v1.2.3 ') // '1.2.3'
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
semver.gt('1.2.3', '9.8.7') // false
semver.lt('1.2.3', '9.8.7') // true
semver.minVersion('>=1.0.0') // '1.0.0'
semver.valid(semver.coerce('v2')) // '2.0.0'
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
```
You can also just load the module for the function that you care about if
you'd like to minimize your footprint.
```js
// load the whole API at once in a single object
const semver = require('semver')
// or just load the bits you need
// all of them listed here, just pick and choose what you want
// classes
const SemVer = require('semver/classes/semver')
const Comparator = require('semver/classes/comparator')
const Range = require('semver/classes/range')
// functions for working with versions
const semverParse = require('semver/functions/parse')
const semverValid = require('semver/functions/valid')
const semverClean = require('semver/functions/clean')
const semverInc = require('semver/functions/inc')
const semverDiff = require('semver/functions/diff')
const semverMajor = require('semver/functions/major')
const semverMinor = require('semver/functions/minor')
const semverPatch = require('semver/functions/patch')
const semverPrerelease = require('semver/functions/prerelease')
const semverCompare = require('semver/functions/compare')
const semverRcompare = require('semver/functions/rcompare')
const semverCompareLoose = require('semver/functions/compare-loose')
const semverCompareBuild = require('semver/functions/compare-build')
const semverSort = require('semver/functions/sort')
const semverRsort = require('semver/functions/rsort')
// low-level comparators between versions
const semverGt = require('semver/functions/gt')
const semverLt = require('semver/functions/lt')
const semverEq = require('semver/functions/eq')
const semverNeq = require('semver/functions/neq')
const semverGte = require('semver/functions/gte')
const semverLte = require('semver/functions/lte')
const semverCmp = require('semver/functions/cmp')
const semverCoerce = require('semver/functions/coerce')
// working with ranges
const semverSatisfies = require('semver/functions/satisfies')
const semverMaxSatisfying = require('semver/ranges/max-satisfying')
const semverMinSatisfying = require('semver/ranges/min-satisfying')
const semverToComparators = require('semver/ranges/to-comparators')
const semverMinVersion = require('semver/ranges/min-version')
const semverValidRange = require('semver/ranges/valid')
const semverOutside = require('semver/ranges/outside')
const semverGtr = require('semver/ranges/gtr')
const semverLtr = require('semver/ranges/ltr')
const semverIntersects = require('semver/ranges/intersects')
const semverSimplifyRange = require('semver/ranges/simplify')
const semverRangeSubset = require('semver/ranges/subset')
```
As a command-line utility:
```
$ semver -h
A JavaScript implementation of the https://semver.org/ specification
Copyright Isaac Z. Schlueter
Usage: semver [options] <version> [<version> [...]]
Prints valid versions sorted by SemVer precedence
Options:
-r --range <range>
Print versions that match the specified range.
-i --increment [<level>]
Increment a version by the specified level. Level can
be one of: major, minor, patch, premajor, preminor,
prepatch, prerelease, or release. Default level is 'patch'.
Only one version may be specified.
--preid <identifier>
Identifier to be used to prefix premajor, preminor,
prepatch or prerelease version increments.
-l --loose
Interpret versions and ranges loosely
-n <0|1|false>
Base number for prerelease identifier (default: 0).
Use false to omit the number altogether.
-p --include-prerelease
Always include prerelease versions in range matching
-c --coerce
Coerce a string into SemVer if possible
(does not imply --loose)
--rtl
Coerce version strings right to left
--ltr
Coerce version strings left to right (default)
Program exits successfully if any valid version satisfies
all supplied ranges, and prints all satisfying versions.
If no satisfying versions are found, then exits failure.
Versions are printed in ascending order, so supplying
multiple versions to the utility will just sort them.
```
## Versions
A "version" is described by the `v2.0.0` specification found at
<https://semver.org/>.
A leading `"="` or `"v"` character is stripped off and ignored.
Support for stripping a leading "v" is kept for compatibility with `v1.0.0` of the SemVer
specification but should not be used anymore.
## Ranges
A `version range` is a set of `comparators` that specify versions
that satisfy the range.
A `comparator` is composed of an `operator` and a `version`. The set
of primitive `operators` is:
* `<` Less than
* `<=` Less than or equal to
* `>` Greater than
* `>=` Greater than or equal to
* `=` Equal. If no operator is specified, then equality is assumed,
so this operator is optional but MAY be included.
For example, the comparator `>=1.2.7` would match the versions
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
or `1.1.0`. The comparator `>1` is equivalent to `>=2.0.0` and
would match the versions `2.0.0` and `3.1.0`, but not the versions
`1.0.1` or `1.1.0`.
Comparators can be joined by whitespace to form a `comparator set`,
which is satisfied by the **intersection** of all of the comparators
it includes.
A range is composed of one or more comparator sets, joined by `||`. A
version matches a range if and only if every comparator in at least
one of the `||`-separated comparator sets is satisfied by the version.
For example, the range `>=1.2.7 <1.3.0` would match the versions
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
or `1.1.0`.
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
### Prerelease Tags
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
it will only be allowed to satisfy comparator sets if at least one
comparator with the same `[major, minor, patch]` tuple also has a
prerelease tag.
For example, the range `>1.2.3-alpha.3` would be allowed to match the
version `1.2.3-alpha.7`, but it would *not* be satisfied by
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
range only accepts prerelease tags on the `1.2.3` version.
Version `3.4.5` *would* satisfy the range because it does not have a
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
The purpose of this behavior is twofold. First, prerelease versions
frequently are updated very quickly, and contain many breaking changes
that are (by the author's design) not yet fit for public consumption.
Therefore, by default, they are excluded from range-matching
semantics.
Second, a user who has opted into using a prerelease version has
indicated the intent to use *that specific* set of
alpha/beta/rc versions. By including a prerelease tag in the range,
the user is indicating that they are aware of the risk. However, it
is still not appropriate to assume that they have opted into taking a
similar risk on the *next* set of prerelease versions.
Note that this behavior can be suppressed (treating all prerelease
versions as if they were normal versions, for range-matching)
by setting the `includePrerelease` flag on the options
object to any
[functions](https://github.com/npm/node-semver#functions) that do
range matching.
#### Prerelease Identifiers
The method `.inc` takes an additional `identifier` string argument that
will append the value of the string as a prerelease identifier:
```javascript
semver.inc('1.2.3', 'prerelease', 'beta')
// '1.2.4-beta.0'
```
command-line example:
```bash
$ semver 1.2.3 -i prerelease --preid beta
1.2.4-beta.0
```
Which then can be used to increment further:
```bash
$ semver 1.2.4-beta.0 -i prerelease
1.2.4-beta.1
```
To get out of the prerelease phase, use the `release` option:
```bash
$ semver 1.2.4-beta.1 -i release
1.2.4
```
#### Prerelease Identifier Base
The method `.inc` takes an optional parameter 'identifierBase' string
that will let you let your prerelease number as zero-based or one-based.
Set to `false` to omit the prerelease number altogether.
If you do not specify this parameter, it will default to zero-based.
```javascript
semver.inc('1.2.3', 'prerelease', 'beta', '1')
// '1.2.4-beta.1'
```
```javascript
semver.inc('1.2.3', 'prerelease', 'beta', false)
// '1.2.4-beta'
```
command-line example:
```bash
$ semver 1.2.3 -i prerelease --preid beta -n 1
1.2.4-beta.1
```
```bash
$ semver 1.2.3 -i prerelease --preid beta -n false
1.2.4-beta
```
### Advanced Range Syntax
Advanced range syntax desugars to primitive comparators in
deterministic ways.
Advanced ranges may be combined in the same way as primitive
comparators using white space or `||`.
#### Hyphen Ranges `X.Y.Z - A.B.C`
Specifies an inclusive set.
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
If a partial version is provided as the first version in the inclusive
range, then the missing pieces are replaced with zeroes.
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
If a partial version is provided as the second version in the
inclusive range, then all versions that start with the supplied parts
of the tuple are accepted, but nothing that would be greater than the
provided tuple parts.
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0-0`
* `1.2.3 - 2` := `>=1.2.3 <3.0.0-0`
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
numeric values in the `[major, minor, patch]` tuple.
* `*` := `>=0.0.0` (Any non-prerelease version satisfies, unless
`includePrerelease` is specified, in which case any version at all
satisfies)
* `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version)
* `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions)
A partial version range is treated as an X-Range, so the special
character is in fact optional.
* `""` (empty string) := `*` := `>=0.0.0`
* `1` := `1.x.x` := `>=1.0.0 <2.0.0-0`
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0-0`
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
Allows patch-level changes if a minor version is specified on the
comparator. Allows minor-level changes if not.
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0-0`
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0-0` (Same as `1.2.x`)
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0-0` (Same as `1.x`)
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0-0`
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0-0` (Same as `0.2.x`)
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0-0` (Same as `0.x`)
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0-0` Note that prereleases in
the `1.2.3` version will be allowed, if they are greater than or
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
`1.2.4-beta.2` would not, because it is a prerelease of a
different `[major, minor, patch]` tuple.
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
Allows changes that do not modify the left-most non-zero element in the
`[major, minor, patch]` tuple. In other words, this allows patch and
minor updates for versions `1.0.0` and above, patch updates for
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
Many authors treat a `0.x` version as if the `x` were the major
"breaking-change" indicator.
Caret ranges are ideal when an author may make breaking changes
between `0.2.4` and `0.3.0` releases, which is a common practice.
However, it presumes that there will *not* be breaking changes between
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
additive (but non-breaking), according to commonly observed practices.
* `^1.2.3` := `>=1.2.3 <2.0.0-0`
* `^0.2.3` := `>=0.2.3 <0.3.0-0`
* `^0.0.3` := `>=0.0.3 <0.0.4-0`
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0-0` Note that prereleases in
the `1.2.3` version will be allowed, if they are greater than or
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
`1.2.4-beta.2` would not, because it is a prerelease of a
different `[major, minor, patch]` tuple.
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4-0` Note that prereleases in the
`0.0.3` version *only* will be allowed, if they are greater than or
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
When parsing caret ranges, a missing `patch` value desugars to the
number `0`, but will allow flexibility within that value, even if the
major and minor versions are both `0`.
* `^1.2.x` := `>=1.2.0 <2.0.0-0`
* `^0.0.x` := `>=0.0.0 <0.1.0-0`
* `^0.0` := `>=0.0.0 <0.1.0-0`
A missing `minor` and `patch` values will desugar to zero, but also
allow flexibility within those values, even if the major version is
zero.
* `^1.x` := `>=1.0.0 <2.0.0-0`
* `^0.x` := `>=0.0.0 <1.0.0-0`
### Range Grammar
Putting all this together, here is a Backus-Naur grammar for ranges,
for the benefit of parser authors:
```bnf
range-set ::= range ( logical-or range ) *
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
range ::= hyphen | simple ( ' ' simple ) * | ''
hyphen ::= partial ' - ' partial
simple ::= primitive | partial | tilde | caret
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
xr ::= 'x' | 'X' | '*' | nr
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
tilde ::= '~' partial
caret ::= '^' partial
qualifier ::= ( '-' pre )? ( '+' build )?
pre ::= parts
build ::= parts
parts ::= part ( '.' part ) *
part ::= nr | [-0-9A-Za-z]+
```
## Functions
All methods and classes take a final `options` object argument. All
options in this object are `false` by default. The options supported
are:
- `loose`: Be more forgiving about not-quite-valid semver strings.
(Any resulting output will always be 100% strict compliant, of
course.) For backwards compatibility reasons, if the `options`
argument is a boolean value instead of an object, it is interpreted
to be the `loose` param.
- `includePrerelease`: Set to suppress the [default
behavior](https://github.com/npm/node-semver#prerelease-tags) of
excluding prerelease tagged versions from ranges unless they are
explicitly opted into.
Strict-mode Comparators and Ranges will be strict about the SemVer
strings that they parse.
* `valid(v)`: Return the parsed version, or null if it's not valid.
* `inc(v, releaseType, options, identifier, identifierBase)`:
Return the version incremented by the release
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
`prepatch`, `prerelease`, or `release`), or null if it's not valid
* `premajor` in one call will bump the version up to the next major
version and down to a prerelease of that major version.
`preminor`, and `prepatch` work the same way.
* If called from a non-prerelease version, `prerelease` will work the
same as `prepatch`. It increments the patch version and then makes a
prerelease. If the input version is already a prerelease it simply
increments it.
* `release` will remove any prerelease part of the version.
* `identifier` can be used to prefix `premajor`, `preminor`,
`prepatch`, or `prerelease` version increments. `identifierBase`
is the base to be used for the `prerelease` identifier.
* `prerelease(v)`: Returns an array of prerelease components, or null
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
* `major(v)`: Return the major version number.
* `minor(v)`: Return the minor version number.
* `patch(v)`: Return the patch version number.
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
or comparators intersect.
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
a `SemVer` object or `null`.
### Comparison
* `gt(v1, v2)`: `v1 > v2`
* `gte(v1, v2)`: `v1 >= v2`
* `lt(v1, v2)`: `v1 < v2`
* `lte(v1, v2)`: `v1 <= v2`
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
even if they're not the same string. You already know how to
compare strings.
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
the corresponding function above. `"==="` and `"!=="` do simple
string comparison, but are included for completeness. Throws if an
invalid comparison string is provided.
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
* `rcompare(v1, v2)`: The reverse of `compare`. Sorts an array of versions
in descending order when passed to `Array.sort()`.
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
are equal. Sorts in ascending order if passed to `Array.sort()`.
* `compareLoose(v1, v2)`: Short for `compare(v1, v2, { loose: true })`.
* `diff(v1, v2)`: Returns the difference between two versions by the release type
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
or null if the versions are the same.
### Sorting
* `sort(versions)`: Returns a sorted array of versions based on the `compareBuild`
function.
* `rsort(versions)`: The reverse of `sort`. Returns an array of versions based on
the `compareBuild` function in descending order.
### Comparators
* `intersects(comparator)`: Return true if the comparators intersect
### Ranges
* `validRange(range)`: Return the valid range or null if it's not valid.
* `satisfies(version, range)`: Return true if the version satisfies the
range.
* `maxSatisfying(versions, range)`: Return the highest version in the list
that satisfies the range, or `null` if none of them do.
* `minSatisfying(versions, range)`: Return the lowest version in the list
that satisfies the range, or `null` if none of them do.
* `minVersion(range)`: Return the lowest version that can match
the given range.
* `gtr(version, range)`: Return `true` if the version is greater than all the
versions possible in the range.
* `ltr(version, range)`: Return `true` if the version is less than all the
versions possible in the range.
* `outside(version, range, hilo)`: Return true if the version is outside
the bounds of the range in either the high or low direction. The
`hilo` argument must be either the string `'>'` or `'<'`. (This is
the function called by `gtr` and `ltr`.)
* `intersects(range)`: Return true if any of the range comparators intersect.
* `simplifyRange(versions, range)`: Return a "simplified" range that
matches the same items in the `versions` list as the range specified. Note
that it does *not* guarantee that it would match the same versions in all
cases, only for the set of versions provided. This is useful when
generating ranges by joining together multiple versions with `||`
programmatically, to provide the user with something a bit more
ergonomic. If the provided range is shorter in string-length than the
generated range, then that is returned.
* `subset(subRange, superRange)`: Return `true` if the `subRange` range is
entirely contained by the `superRange` range.
Note that, since ranges may be non-contiguous, a version might not be
greater than a range, less than a range, *or* satisfy a range! For
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
until `2.0.0`, so version `1.2.10` would not be greater than the
range (because `2.0.1` satisfies, which is higher), nor less than the
range (since `1.2.8` satisfies, which is lower), and it also does not
satisfy the range.
If you want to know if a version satisfies or does not satisfy a
range, use the `satisfies(version, range)` function.
### Coercion
* `coerce(version, options)`: Coerces a string to semver if possible
This aims to provide a very forgiving translation of a non-semver string to
semver. It looks for the first digit in a string and consumes all
remaining characters which satisfy at least a partial semver (e.g., `1`,
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
is not valid). The maximum length for any semver component considered for
coercion is 16 characters; longer components will be ignored
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
components are invalid (`9999999999999999.4.7.4` is likely invalid).
If the `options.rtl` flag is set, then `coerce` will return the right-most
coercible tuple that does not share an ending index with a longer coercible
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
any other overlapping SemVer tuple.
If the `options.includePrerelease` flag is set, then the `coerce` result will contain
prerelease and build parts of a version. For example, `1.2.3.4-rc.1+rev.2`
will preserve prerelease `rc.1` and build `rev.2` in the result.
### Clean
* `clean(version)`: Clean a string to be a valid semver if possible
This will return a cleaned and trimmed semver version. If the provided
version is not valid a null will be returned. This does not work for
ranges.
ex.
* `s.clean(' = v 2.1.5foo')`: `null`
* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
* `s.clean(' = v 2.1.5-foo')`: `null`
* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
* `s.clean('=v2.1.5')`: `'2.1.5'`
* `s.clean(' =v2.1.5')`: `'2.1.5'`
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
* `s.clean('~1.0.0')`: `null`
## Constants
As a convenience, helper constants are exported to provide information about what `node-semver` supports:
### `RELEASE_TYPES`
- major
- premajor
- minor
- preminor
- patch
- prepatch
- prerelease
```
const semver = require('semver');
if (semver.RELEASE_TYPES.includes(arbitraryUserInput)) {
console.log('This is a valid release type!');
} else {
console.warn('This is NOT a valid release type!');
}
```
### `SEMVER_SPEC_VERSION`
2.0.0
```
const semver = require('semver');
console.log('We are currently using the semver specification version:', semver.SEMVER_SPEC_VERSION);
```
## Exported Modules
<!--
TODO: Make sure that all of these items are documented (classes aren't,
eg), and then pull the module name into the documentation for that specific
thing.
-->
You may pull in just the part of this semver utility that you need if you
are sensitive to packing and tree-shaking concerns. The main
`require('semver')` export uses getter functions to lazily load the parts
of the API that are used.
The following modules are available:
* `require('semver')`
* `require('semver/classes')`
* `require('semver/classes/comparator')`
* `require('semver/classes/range')`
* `require('semver/classes/semver')`
* `require('semver/functions/clean')`
* `require('semver/functions/cmp')`
* `require('semver/functions/coerce')`
* `require('semver/functions/compare')`
* `require('semver/functions/compare-build')`
* `require('semver/functions/compare-loose')`
* `require('semver/functions/diff')`
* `require('semver/functions/eq')`
* `require('semver/functions/gt')`
* `require('semver/functions/gte')`
* `require('semver/functions/inc')`
* `require('semver/functions/lt')`
* `require('semver/functions/lte')`
* `require('semver/functions/major')`
* `require('semver/functions/minor')`
* `require('semver/functions/neq')`
* `require('semver/functions/parse')`
* `require('semver/functions/patch')`
* `require('semver/functions/prerelease')`
* `require('semver/functions/rcompare')`
* `require('semver/functions/rsort')`
* `require('semver/functions/satisfies')`
* `require('semver/functions/sort')`
* `require('semver/functions/valid')`
* `require('semver/ranges/gtr')`
* `require('semver/ranges/intersects')`
* `require('semver/ranges/ltr')`
* `require('semver/ranges/max-satisfying')`
* `require('semver/ranges/min-satisfying')`
* `require('semver/ranges/min-version')`
* `require('semver/ranges/outside')`
* `require('semver/ranges/simplify')`
* `require('semver/ranges/subset')`
* `require('semver/ranges/to-comparators')`
* `require('semver/ranges/valid')`

Some files were not shown because too many files have changed in this diff Show More