mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-06-30 11:58:54 +00:00
Compare commits
23 Commits
v4.1
...
macos-pyth
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a26ee8850 | ||
|
|
03fe035094 | ||
|
|
887a942a15 | ||
|
|
d174a24c07 | ||
|
|
12c852e6ba | ||
|
|
180f8b4439 | ||
|
|
e3fb95a689 | ||
|
|
2af22b5b2d | ||
|
|
dd578776bb | ||
|
|
85aa0bf0c1 | ||
|
|
1f2cbfa7bb | ||
|
|
25b3ce6330 | ||
|
|
856099c958 | ||
|
|
e3017a763c | ||
|
|
3460fe1a9a | ||
|
|
884a30e33c | ||
|
|
f064c84ddb | ||
|
|
be4207d29e | ||
|
|
bdcda7e77f | ||
|
|
1e4d4ea9ff | ||
|
|
f0b64e0d53 | ||
|
|
38f3f10444 | ||
|
|
8bdd012be5 |
79
.github/workflows/test-cache.yml
vendored
79
.github/workflows/test-cache.yml
vendored
@@ -11,6 +11,54 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-setup-cache:
|
test-setup-cache:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
enable-cache: [ "true", "false", "auto" ]
|
||||||
|
os: ["ubuntu-latest", "selfhosted-ubuntu-arm64"]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup with cache
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
enable-cache: ${{ matrix.enable-cache }}
|
||||||
|
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-${{ matrix.os }}-${{ matrix.enable-cache }}
|
||||||
|
- run: uv sync
|
||||||
|
working-directory: __tests__/fixtures/uv-project
|
||||||
|
test-restore-cache:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
enable-cache: [ "true", "false", "auto" ]
|
||||||
|
os: [ "ubuntu-latest", "selfhosted-ubuntu-arm64" ]
|
||||||
|
needs: test-setup-cache
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Restore with cache
|
||||||
|
id: restore
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
enable-cache: ${{ matrix.enable-cache }}
|
||||||
|
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-${{ matrix.os }}-${{ matrix.enable-cache }}
|
||||||
|
- name: Cache was hit
|
||||||
|
if: ${{ matrix.enable-cache == 'true' || (matrix.enable-cache == 'auto' && matrix.os == 'ubuntu-latest') }}
|
||||||
|
run: |
|
||||||
|
if [ "$CACHE_HIT" != "true" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
CACHE_HIT: ${{ steps.restore.outputs.cache-hit }}
|
||||||
|
- name: Cache was not hit
|
||||||
|
if: ${{ matrix.enable-cache == 'false' || (matrix.enable-cache == 'auto' && matrix.os == 'selfhosted-ubuntu-arm64') }}
|
||||||
|
run: |
|
||||||
|
if [ "$CACHE_HIT" == "true" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
CACHE_HIT: ${{ steps.restore.outputs.cache-hit }}
|
||||||
|
- run: uv sync
|
||||||
|
working-directory: __tests__/fixtures/uv-project
|
||||||
|
test-setup-cache-requirements-txt:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -18,10 +66,12 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache
|
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-requirements-txt
|
||||||
- run: uv sync
|
- run: |
|
||||||
working-directory: __tests__/fixtures/uv-project
|
uv venv
|
||||||
test-restore-cache:
|
uv pip install -r requirements.txt
|
||||||
|
working-directory: __tests__/fixtures/requirements-txt-project
|
||||||
|
test-restore-cache-requirements-txt:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: test-setup-cache
|
needs: test-setup-cache
|
||||||
steps:
|
steps:
|
||||||
@@ -31,7 +81,7 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache
|
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-requirements-txt
|
||||||
- name: Cache was hit
|
- name: Cache was hit
|
||||||
run: |
|
run: |
|
||||||
if [ "$CACHE_HIT" != "true" ]; then
|
if [ "$CACHE_HIT" != "true" ]; then
|
||||||
@@ -39,8 +89,10 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
CACHE_HIT: ${{ steps.restore.outputs.cache-hit }}
|
CACHE_HIT: ${{ steps.restore.outputs.cache-hit }}
|
||||||
- run: uv sync
|
- run: |
|
||||||
working-directory: __tests__/fixtures/uv-project
|
uv venv
|
||||||
|
uv pip install -r requirements.txt
|
||||||
|
working-directory: __tests__/fixtures/requirements-txt-project
|
||||||
|
|
||||||
test-setup-cache-dependency-glob:
|
test-setup-cache-dependency-glob:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -162,3 +214,16 @@ jobs:
|
|||||||
- name: Remove cache dependency glob file
|
- name: Remove cache dependency glob file
|
||||||
run: rm -f ~/uv-cache.glob
|
run: rm -f ~/uv-cache.glob
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
test-no-python-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Fake pyproject.toml at root
|
||||||
|
run: cp __tests__/fixtures/old-python-constraint-project/pyproject.toml pyproject.toml
|
||||||
|
- name: Setup with cache
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
enable-cache: true
|
||||||
|
- run: uv sync
|
||||||
|
working-directory: __tests__/fixtures/old-python-constraint-project
|
||||||
|
|||||||
46
.github/workflows/test.yml
vendored
46
.github/workflows/test.yml
vendored
@@ -84,6 +84,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: "0.3.2"
|
version: "0.3.2"
|
||||||
checksum: ${{ matrix.checksum }}
|
checksum: ${{ matrix.checksum }}
|
||||||
|
- run: uv sync
|
||||||
|
working-directory: __tests__/fixtures/uv-project
|
||||||
test-with-explicit-token:
|
test-with-explicit-token:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -118,7 +120,6 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
- run: uv tool install ruff
|
- run: uv tool install ruff
|
||||||
- run: ruff --version
|
- run: ruff --version
|
||||||
|
|
||||||
test-tilde-expansion-tool-dirs:
|
test-tilde-expansion-tool-dirs:
|
||||||
runs-on: selfhosted-ubuntu-arm64
|
runs-on: selfhosted-ubuntu-arm64
|
||||||
steps:
|
steps:
|
||||||
@@ -138,4 +139,45 @@ jobs:
|
|||||||
echo "UV_TOOL_DIR does not contain /home/ubuntu/tool-dir: $UV_TOOL_DIR"
|
echo "UV_TOOL_DIR does not contain /home/ubuntu/tool-dir: $UV_TOOL_DIR"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
test-python-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install latest version
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version: 3.13.1t
|
||||||
|
- name: Verify UV_PYTHON is set to correct version
|
||||||
|
run: |
|
||||||
|
echo "$UV_PYTHON"
|
||||||
|
if [ "$UV_PYTHON" != "3.13.1t" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
shell: bash
|
||||||
|
- name: Verify packages can be installed
|
||||||
|
run: uv pip install --python=3.13.1t pip
|
||||||
|
shell: bash
|
||||||
|
- name: Verify python version is correct
|
||||||
|
run: |
|
||||||
|
python --version
|
||||||
|
if [ "$(python --version)" != "Python 3.13.1" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
shell: bash
|
||||||
|
test-macos-python-version:
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
/Applications/Xcode_15.4.app/Contents/Developer/usr/bin/python3 --version
|
||||||
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.9
|
||||||
|
- run: |
|
||||||
|
echo "$UV_PYTHON"
|
||||||
|
python --version
|
||||||
|
uv python list
|
||||||
|
shell: bash
|
||||||
|
|||||||
79
README.md
79
README.md
@@ -34,7 +34,7 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv
|
- name: Install the latest version of uv
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
version: "latest"
|
version: "latest"
|
||||||
```
|
```
|
||||||
@@ -42,17 +42,11 @@ Set up your GitHub Actions workflow with a specific version of [uv](https://docs
|
|||||||
For an example workflow, see
|
For an example workflow, see
|
||||||
[here](https://github.com/charliermarsh/autobot/blob/e42c66659bf97b90ca9ff305a19cc99952d0d43f/.github/workflows/ci.yaml).
|
[here](https://github.com/charliermarsh/autobot/blob/e42c66659bf97b90ca9ff305a19cc99952d0d43f/.github/workflows/ci.yaml).
|
||||||
|
|
||||||
> [!TIP]
|
|
||||||
>
|
|
||||||
> Using `latest` requires to download the uv executable on every run, which incurs a cost
|
|
||||||
> (especially on self-hosted runners). As a best practice, consider pinning the version to a
|
|
||||||
> specific release.
|
|
||||||
|
|
||||||
### Install a specific version
|
### Install a specific version
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install a specific version of uv
|
- name: Install a specific version of uv
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
version: "0.4.4"
|
version: "0.4.4"
|
||||||
```
|
```
|
||||||
@@ -64,29 +58,34 @@ to install the latest version that satisfies the range.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install a semver range of uv
|
- name: Install a semver range of uv
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
version: ">=0.4.0"
|
version: ">=0.4.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Pinning a minor version of uv
|
- name: Pinning a minor version of uv
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
version: "0.4.x"
|
version: "0.4.x"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Python version
|
### Python version
|
||||||
|
|
||||||
You can use the input `python-version` to set the environment variable `UV_PYTHON` for the rest
|
You can use the input `python-version` to
|
||||||
of your workflow.
|
|
||||||
|
- set the environment variable `UV_PYTHON` for the rest of your workflow
|
||||||
|
- create a new virtual environment with the specified python version
|
||||||
|
- activate the virtual environment for the rest of your workflow
|
||||||
|
|
||||||
This will override any python version specifications in `pyproject.toml` and `.python-version`
|
This will override any python version specifications in `pyproject.toml` and `.python-version`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv and set the python version to 3.12
|
- name: Install the latest version of uv and set the python version to 3.13t
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: 3.13t
|
||||||
|
- run: uv pip install --python=3.13t pip
|
||||||
```
|
```
|
||||||
|
|
||||||
You can combine this with a matrix to test multiple python versions:
|
You can combine this with a matrix to test multiple python versions:
|
||||||
@@ -101,7 +100,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install the latest version of uv and set the python version
|
- name: Install the latest version of uv and set the python version
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Test with python ${{ matrix.python-version }}
|
- name: Test with python ${{ matrix.python-version }}
|
||||||
@@ -116,7 +115,7 @@ are automatically verified by this action. The sha256 hashes can be found on the
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install a specific version and validate the checksum
|
- name: Install a specific version and validate the checksum
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
version: "0.3.1"
|
version: "0.3.1"
|
||||||
checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"
|
checksum: "e11b01402ab645392c7ad6044db63d37e4fd1e745e015306993b07695ea5f9f8"
|
||||||
@@ -137,7 +136,7 @@ You can optionally define a custom cache key suffix.
|
|||||||
```yaml
|
```yaml
|
||||||
- name: Enable caching and define a custom cache key suffix
|
- name: Enable caching and define a custom cache key suffix
|
||||||
id: setup-uv
|
id: setup-uv
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-suffix: "optional-suffix"
|
cache-suffix: "optional-suffix"
|
||||||
@@ -160,19 +159,24 @@ changes. If you use relative paths, they are relative to the repository root.
|
|||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
>
|
>
|
||||||
> The default is `**/uv.lock`.
|
> The default is
|
||||||
|
> ```yaml
|
||||||
|
> cache-dependency-glob: |
|
||||||
|
> **/requirements*.txt
|
||||||
|
> **/uv.lock
|
||||||
|
> ```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Define a cache dependency glob
|
- name: Define a cache dependency glob
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-dependency-glob: "**/requirements*.txt"
|
cache-dependency-glob: "**/pyproject.toml"
|
||||||
```
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Define a list of cache dependency globs
|
- name: Define a list of cache dependency globs
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-dependency-glob: |
|
cache-dependency-glob: |
|
||||||
@@ -182,7 +186,7 @@ changes. If you use relative paths, they are relative to the repository root.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Define an absolute cache dependency glob
|
- name: Define an absolute cache dependency glob
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-dependency-glob: "/tmp/my-folder/requirements*.txt"
|
cache-dependency-glob: "/tmp/my-folder/requirements*.txt"
|
||||||
@@ -190,7 +194,7 @@ changes. If you use relative paths, they are relative to the repository root.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Never invalidate the cache
|
- name: Never invalidate the cache
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
cache-dependency-glob: ""
|
cache-dependency-glob: ""
|
||||||
@@ -205,7 +209,7 @@ It defaults to `setup-uv-cache` in the `TMP` dir, `D:\a\_temp\uv-tool-dir` on Wi
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Define a custom uv cache path
|
- name: Define a custom uv cache path
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
cache-local-path: "/path/to/cache"
|
cache-local-path: "/path/to/cache"
|
||||||
```
|
```
|
||||||
@@ -224,7 +228,7 @@ input.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Don't prune the cache before saving it
|
- name: Don't prune the cache before saving it
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
prune-cache: false
|
prune-cache: false
|
||||||
@@ -237,7 +241,7 @@ If you want to ignore this, set the `ignore-nothing-to-cache` input to `true`.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Ignore nothing to cache
|
- name: Ignore nothing to cache
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
ignore-nothing-to-cache: true
|
ignore-nothing-to-cache: true
|
||||||
@@ -255,7 +259,7 @@ are not sufficient, you can provide a custom GitHub token with the necessary per
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv with a custom GitHub token
|
- name: Install the latest version of uv with a custom GitHub token
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
github-token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
@@ -273,7 +277,7 @@ input:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv with a custom tool dir
|
- name: Install the latest version of uv with a custom tool dir
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
tool-dir: "/path/to/tool/dir"
|
tool-dir: "/path/to/tool/dir"
|
||||||
```
|
```
|
||||||
@@ -292,7 +296,7 @@ If you want to change this behaviour (especially on self-hosted runners) you can
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv with a custom tool bin dir
|
- name: Install the latest version of uv with a custom tool bin dir
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
tool-bin-dir: "/path/to/tool-bin/dir"
|
tool-bin-dir: "/path/to/tool-bin/dir"
|
||||||
```
|
```
|
||||||
@@ -308,7 +312,7 @@ This action supports expanding the `~` character to the user's home directory fo
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Expand the tilde character
|
- name: Expand the tilde character
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
cache-local-path: "~/path/to/cache"
|
cache-local-path: "~/path/to/cache"
|
||||||
tool-dir: "~/path/to/tool/dir"
|
tool-dir: "~/path/to/tool/dir"
|
||||||
@@ -330,21 +334,22 @@ by name (`uv`).
|
|||||||
|
|
||||||
### Do I still need `actions/setup-python` alongside `setup-uv`?
|
### Do I still need `actions/setup-python` alongside `setup-uv`?
|
||||||
|
|
||||||
No. This action is modelled as a drop-in replacement for `actions/setup-python` when using uv. With
|
With `setup-uv`, you can install a specific version of Python using `uv python install` rather than
|
||||||
`setup-uv`, you can install a specific version of Python using `uv python install` rather than
|
|
||||||
relying on `actions/setup-python`.
|
relying on `actions/setup-python`.
|
||||||
|
|
||||||
|
Using `actions/setup-python` can be faster, because GitHub caches the Python versions alongside the runner.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
- name: Install the latest version of uv
|
- name: Install the latest version of uv
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
- name: Test
|
- name: Test
|
||||||
run: uv run --frozen pytest
|
run: uv run --frozen pytest # Uses the Python version automatically installed by uv
|
||||||
```
|
```
|
||||||
|
|
||||||
To install a specific version of Python, use
|
To install a specific version of Python, use
|
||||||
@@ -352,7 +357,7 @@ To install a specific version of Python, use
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Install the latest version of uv
|
- name: Install the latest version of uv
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
- name: Install Python 3.12
|
- name: Install Python 3.12
|
||||||
@@ -371,7 +376,7 @@ output:
|
|||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
- name: Install the default version of uv
|
- name: Install the default version of uv
|
||||||
id: setup-uv
|
id: setup-uv
|
||||||
uses: astral-sh/setup-uv@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
- name: Print the installed version
|
- name: Print the installed version
|
||||||
run: echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"
|
run: echo "Installed uv version is ${{ steps.setup-uv.outputs.uv-version }}"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
[project]
|
||||||
|
name = "old-python-constraint-project"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Add your description here"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.8,<=3.9"
|
||||||
|
dependencies = [
|
||||||
|
"ruff>=0.6.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
def hello() -> str:
|
||||||
|
return "Hello from uv-project!"
|
||||||
38
__tests__/fixtures/old-python-constraint-project/uv.lock
generated
Normal file
38
__tests__/fixtures/old-python-constraint-project/uv.lock
generated
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
version = 1
|
||||||
|
requires-python = ">=3.12"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ruff"
|
||||||
|
version = "0.6.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/23/f4/279d044f66b79261fd37df76bf72b64471afab5d3b7906a01499c4451910/ruff-0.6.2.tar.gz", hash = "sha256:239ee6beb9e91feb8e0ec384204a763f36cb53fb895a1a364618c6abb076b3be", size = 2460281 }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/72/4b/47dd7a69287afb4069fa42c198e899463605460a58120196711bfcf0446b/ruff-0.6.2-py3-none-linux_armv6l.whl", hash = "sha256:5c8cbc6252deb3ea840ad6a20b0f8583caab0c5ef4f9cca21adc5a92b8f79f3c", size = 9695871 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ae/c3/8aac62ac4638c14a740ee76a755a925f2d0d04580ab790a9887accb729f6/ruff-0.6.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:17002fe241e76544448a8e1e6118abecbe8cd10cf68fde635dad480dba594570", size = 9459354 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/2f/cf/77fbd8d4617b9b9c503f9bffb8552c4e3ea1a58dc36975e7a9104ffb0f85/ruff-0.6.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:3dbeac76ed13456f8158b8f4fe087bf87882e645c8e8b606dd17b0b66c2c1158", size = 9163871 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/05/1c/765192bab32b79efbb498b06f0b9dcb3629112b53b8777ae1d19b8209e09/ruff-0.6.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:094600ee88cda325988d3f54e3588c46de5c18dae09d683ace278b11f9d4d534", size = 10096250 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/08/d0/86f3cb0f6934c99f759c232984a5204d67a26745cad2d9edff6248adf7d2/ruff-0.6.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:316d418fe258c036ba05fbf7dfc1f7d3d4096db63431546163b472285668132b", size = 9475376 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/cd/cc/4c8d0e225b559a3fae6092ec310d7150d3b02b4669e9223f783ef64d82c0/ruff-0.6.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d72b8b3abf8a2d51b7b9944a41307d2f442558ccb3859bbd87e6ae9be1694a5d", size = 10295634 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/db/96/d2699cfb1bb5a01c68122af43454c76c31331e1c8a9bd97d653d7c82524b/ruff-0.6.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:2aed7e243be68487aa8982e91c6e260982d00da3f38955873aecd5a9204b1d66", size = 11024941 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8b/a9/6ecd66af8929e0f2a1ed308a4137f3521789f28f0eb97d32c2ca3aa7000c/ruff-0.6.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d371f7fc9cec83497fe7cf5eaf5b76e22a8efce463de5f775a1826197feb9df8", size = 10606894 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e4/73/2ee4cd19f44992fedac1cc6db9e3d825966072f6dcbd4032f21cbd063170/ruff-0.6.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a8f310d63af08f583363dfb844ba8f9417b558199c58a5999215082036d795a1", size = 11552886 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/60/4c/c0f1cd35ce4a93c54a6bb1ee6934a3a205fa02198dd076678193853ceea1/ruff-0.6.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7db6880c53c56addb8638fe444818183385ec85eeada1d48fc5abe045301b2f1", size = 10264945 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c4/89/e45c9359b9cdd4245512ea2b9f2bb128a997feaa5f726fc9e8c7a66afadf/ruff-0.6.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:1175d39faadd9a50718f478d23bfc1d4da5743f1ab56af81a2b6caf0a2394f23", size = 10100007 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/06/74/0bd4e0a7ed5f6908df87892f9bf60a2356c0fd74102d8097298bd9b4f346/ruff-0.6.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:5b939f9c86d51635fe486585389f54582f0d65b8238e08c327c1534844b3bb9a", size = 9559267 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/54/03/3dc6dc9419f276f05805bf888c279e3e0b631284abd548d9e87cebb93aec/ruff-0.6.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d0d62ca91219f906caf9b187dea50d17353f15ec9bb15aae4a606cd697b49b4c", size = 9905304 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5c/5b/d6a72a6a6bbf097c09de468326ef5fa1c9e7aa5e6e45979bc0d984b0dbe7/ruff-0.6.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:7438a7288f9d67ed3c8ce4d059e67f7ed65e9fe3aa2ab6f5b4b3610e57e3cb56", size = 10341480 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/79/a9/0f2f21fe15ba537c46598f96aa9ae4a3d4b9ec64926664617ca6a8c772f4/ruff-0.6.2-py3-none-win32.whl", hash = "sha256:279d5f7d86696df5f9549b56b9b6a7f6c72961b619022b5b7999b15db392a4da", size = 7961901 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b0/80/fff12ffe11853d9f4ea3e5221e6dd2e93640a161c05c9579833e09ad40a7/ruff-0.6.2-py3-none-win_amd64.whl", hash = "sha256:d9f3469c7dd43cd22eb1c3fc16926fb8258d50cb1b216658a07be95dd117b0f2", size = 8783320 },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/56/91/577cdd64cce5e74d3f8b5ecb93f29566def569c741eb008aed4f331ef821/ruff-0.6.2-py3-none-win_arm64.whl", hash = "sha256:f28fcd2cd0e02bdf739297516d5643a945cc7caf09bd9bcb4d932540a5ea4fa9", size = 8225886 },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "uv-project"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = { editable = "." }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "ruff" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.metadata]
|
||||||
|
requires-dist = [{ name = "ruff" }]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
print("Hello world")
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ruff>=0.6.2
|
||||||
@@ -14,18 +14,19 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
github-token:
|
github-token:
|
||||||
description:
|
description:
|
||||||
"Used to increase the rate limit when retrieving versions and downloading
|
"Used to increase the rate limit when retrieving versions and downloading uv."
|
||||||
uv."
|
|
||||||
required: false
|
required: false
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
enable-cache:
|
enable-cache:
|
||||||
description: "Enable caching of the uv cache"
|
description: "Enable caching of the uv cache"
|
||||||
default: "false"
|
default: "auto"
|
||||||
cache-dependency-glob:
|
cache-dependency-glob:
|
||||||
description:
|
description:
|
||||||
"Glob pattern to match files relative to the repository root to control
|
"Glob pattern to match files relative to the repository root to control
|
||||||
the cache."
|
the cache."
|
||||||
default: "**/uv.lock"
|
default: |
|
||||||
|
**/uv.lock
|
||||||
|
**/requirements*.txt
|
||||||
cache-suffix:
|
cache-suffix:
|
||||||
description: "Suffix for the cache key"
|
description: "Suffix for the cache key"
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
9344
dist/save-cache/index.js
generated
vendored
9344
dist/save-cache/index.js
generated
vendored
@@ -44,7 +44,10 @@ const core = __importStar(__nccwpck_require__(7484));
|
|||||||
const path = __importStar(__nccwpck_require__(6928));
|
const path = __importStar(__nccwpck_require__(6928));
|
||||||
const utils = __importStar(__nccwpck_require__(680));
|
const utils = __importStar(__nccwpck_require__(680));
|
||||||
const cacheHttpClient = __importStar(__nccwpck_require__(5552));
|
const cacheHttpClient = __importStar(__nccwpck_require__(5552));
|
||||||
|
const cacheTwirpClient = __importStar(__nccwpck_require__(6819));
|
||||||
|
const config_1 = __nccwpck_require__(7606);
|
||||||
const tar_1 = __nccwpck_require__(5321);
|
const tar_1 = __nccwpck_require__(5321);
|
||||||
|
const constants_1 = __nccwpck_require__(8287);
|
||||||
class ValidationError extends Error {
|
class ValidationError extends Error {
|
||||||
constructor(message) {
|
constructor(message) {
|
||||||
super(message);
|
super(message);
|
||||||
@@ -88,15 +91,39 @@ exports.isFeatureAvailable = isFeatureAvailable;
|
|||||||
* Restores cache from keys
|
* Restores cache from keys
|
||||||
*
|
*
|
||||||
* @param paths a list of file paths to restore from the cache
|
* @param paths a list of file paths to restore from the cache
|
||||||
* @param primaryKey an explicit key for restoring the cache
|
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
|
||||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||||
* @param downloadOptions cache download options
|
* @param downloadOptions cache download options
|
||||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||||
*/
|
*/
|
||||||
function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
|
function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
|
||||||
|
core.debug(`Cache service version: ${cacheServiceVersion}`);
|
||||||
checkPaths(paths);
|
checkPaths(paths);
|
||||||
|
switch (cacheServiceVersion) {
|
||||||
|
case 'v2':
|
||||||
|
return yield restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
|
||||||
|
case 'v1':
|
||||||
|
default:
|
||||||
|
return yield restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.restoreCache = restoreCache;
|
||||||
|
/**
|
||||||
|
* Restores cache using the legacy Cache Service
|
||||||
|
*
|
||||||
|
* @param paths a list of file paths to restore from the cache
|
||||||
|
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
|
||||||
|
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||||
|
* @param options cache download options
|
||||||
|
* @param enableCrossOsArchive an optional boolean enabled to restore on Windows any cache created on any platform
|
||||||
|
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||||
|
*/
|
||||||
|
function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
restoreKeys = restoreKeys || [];
|
restoreKeys = restoreKeys || [];
|
||||||
const keys = [primaryKey, ...restoreKeys];
|
const keys = [primaryKey, ...restoreKeys];
|
||||||
core.debug('Resolved Keys:');
|
core.debug('Resolved Keys:');
|
||||||
@@ -158,7 +185,85 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
|
|||||||
return undefined;
|
return undefined;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.restoreCache = restoreCache;
|
/**
|
||||||
|
* Restores cache using Cache Service v2
|
||||||
|
*
|
||||||
|
* @param paths a list of file paths to restore from the cache
|
||||||
|
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching
|
||||||
|
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||||
|
* @param downloadOptions cache download options
|
||||||
|
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||||
|
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||||
|
*/
|
||||||
|
function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// Override UploadOptions to force the use of Azure
|
||||||
|
options = Object.assign(Object.assign({}, options), { useAzureSdk: true });
|
||||||
|
restoreKeys = restoreKeys || [];
|
||||||
|
const keys = [primaryKey, ...restoreKeys];
|
||||||
|
core.debug('Resolved Keys:');
|
||||||
|
core.debug(JSON.stringify(keys));
|
||||||
|
if (keys.length > 10) {
|
||||||
|
throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`);
|
||||||
|
}
|
||||||
|
for (const key of keys) {
|
||||||
|
checkKey(key);
|
||||||
|
}
|
||||||
|
let archivePath = '';
|
||||||
|
try {
|
||||||
|
const twirpClient = cacheTwirpClient.internalCacheTwirpClient();
|
||||||
|
const compressionMethod = yield utils.getCompressionMethod();
|
||||||
|
const request = {
|
||||||
|
key: primaryKey,
|
||||||
|
restoreKeys,
|
||||||
|
version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive)
|
||||||
|
};
|
||||||
|
const response = yield twirpClient.GetCacheEntryDownloadURL(request);
|
||||||
|
if (!response.ok) {
|
||||||
|
core.warning(`Cache not found for keys: ${keys.join(', ')}`);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
core.info(`Cache hit for: ${request.key}`);
|
||||||
|
if (options === null || options === void 0 ? void 0 : options.lookupOnly) {
|
||||||
|
core.info('Lookup only - skipping download');
|
||||||
|
return response.matchedKey;
|
||||||
|
}
|
||||||
|
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
|
||||||
|
core.debug(`Archive path: ${archivePath}`);
|
||||||
|
core.debug(`Starting download of archive to: ${archivePath}`);
|
||||||
|
yield cacheHttpClient.downloadCache(response.signedDownloadUrl, archivePath, options);
|
||||||
|
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
||||||
|
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
|
||||||
|
if (core.isDebug()) {
|
||||||
|
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
||||||
|
}
|
||||||
|
yield (0, tar_1.extractTar)(archivePath, compressionMethod);
|
||||||
|
core.info('Cache restored successfully');
|
||||||
|
return response.matchedKey;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const typedError = error;
|
||||||
|
if (typedError.name === ValidationError.name) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Supress all non-validation cache related errors because caching should be optional
|
||||||
|
core.warning(`Failed to restore: ${error.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (archivePath) {
|
||||||
|
yield utils.unlinkFile(archivePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.debug(`Failed to delete archive: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Saves a list of files with the specified key
|
* Saves a list of files with the specified key
|
||||||
*
|
*
|
||||||
@@ -169,10 +274,33 @@ exports.restoreCache = restoreCache;
|
|||||||
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
|
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
|
||||||
*/
|
*/
|
||||||
function saveCache(paths, key, options, enableCrossOsArchive = false) {
|
function saveCache(paths, key, options, enableCrossOsArchive = false) {
|
||||||
var _a, _b, _c, _d, _e;
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
|
||||||
|
core.debug(`Cache service version: ${cacheServiceVersion}`);
|
||||||
checkPaths(paths);
|
checkPaths(paths);
|
||||||
checkKey(key);
|
checkKey(key);
|
||||||
|
switch (cacheServiceVersion) {
|
||||||
|
case 'v2':
|
||||||
|
return yield saveCacheV2(paths, key, options, enableCrossOsArchive);
|
||||||
|
case 'v1':
|
||||||
|
default:
|
||||||
|
return yield saveCacheV1(paths, key, options, enableCrossOsArchive);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.saveCache = saveCache;
|
||||||
|
/**
|
||||||
|
* Save cache using the legacy Cache Service
|
||||||
|
*
|
||||||
|
* @param paths
|
||||||
|
* @param key
|
||||||
|
* @param options
|
||||||
|
* @param enableCrossOsArchive
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function saveCacheV1(paths, key, options, enableCrossOsArchive = false) {
|
||||||
|
var _a, _b, _c, _d, _e;
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const compressionMethod = yield utils.getCompressionMethod();
|
const compressionMethod = yield utils.getCompressionMethod();
|
||||||
let cacheId = -1;
|
let cacheId = -1;
|
||||||
const cachePaths = yield utils.resolvePaths(paths);
|
const cachePaths = yield utils.resolvePaths(paths);
|
||||||
@@ -193,7 +321,7 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
|
|||||||
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
||||||
core.debug(`File Size: ${archiveFileSize}`);
|
core.debug(`File Size: ${archiveFileSize}`);
|
||||||
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
||||||
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
|
if (archiveFileSize > fileSizeLimit && !(0, config_1.isGhes)()) {
|
||||||
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
|
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
|
||||||
}
|
}
|
||||||
core.debug('Reserving Cache');
|
core.debug('Reserving Cache');
|
||||||
@@ -212,7 +340,95 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
|
|||||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
|
||||||
}
|
}
|
||||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||||
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
|
yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const typedError = error;
|
||||||
|
if (typedError.name === ValidationError.name) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
else if (typedError.name === ReserveCacheError.name) {
|
||||||
|
core.info(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
// Try to delete the archive to save space
|
||||||
|
try {
|
||||||
|
yield utils.unlinkFile(archivePath);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.debug(`Failed to delete archive: ${error}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cacheId;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Save cache using Cache Service v2
|
||||||
|
*
|
||||||
|
* @param paths a list of file paths to restore from the cache
|
||||||
|
* @param key an explicit key for restoring the cache
|
||||||
|
* @param options cache upload options
|
||||||
|
* @param enableCrossOsArchive an optional boolean enabled to save cache on windows which could be restored on any platform
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// Override UploadOptions to force the use of Azure
|
||||||
|
// ...options goes first because we want to override the default values
|
||||||
|
// set in UploadOptions with these specific figures
|
||||||
|
options = Object.assign(Object.assign({}, options), { uploadChunkSize: 64 * 1024 * 1024, uploadConcurrency: 8, useAzureSdk: true });
|
||||||
|
const compressionMethod = yield utils.getCompressionMethod();
|
||||||
|
const twirpClient = cacheTwirpClient.internalCacheTwirpClient();
|
||||||
|
let cacheId = -1;
|
||||||
|
const cachePaths = yield utils.resolvePaths(paths);
|
||||||
|
core.debug('Cache Paths:');
|
||||||
|
core.debug(`${JSON.stringify(cachePaths)}`);
|
||||||
|
if (cachePaths.length === 0) {
|
||||||
|
throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);
|
||||||
|
}
|
||||||
|
const archiveFolder = yield utils.createTempDirectory();
|
||||||
|
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
|
||||||
|
core.debug(`Archive Path: ${archivePath}`);
|
||||||
|
try {
|
||||||
|
yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod);
|
||||||
|
if (core.isDebug()) {
|
||||||
|
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
||||||
|
}
|
||||||
|
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
|
||||||
|
core.debug(`File Size: ${archiveFileSize}`);
|
||||||
|
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
|
||||||
|
if (archiveFileSize > constants_1.CacheFileSizeLimit && !(0, config_1.isGhes)()) {
|
||||||
|
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
|
||||||
|
}
|
||||||
|
// Set the archive size in the options, will be used to display the upload progress
|
||||||
|
options.archiveSizeBytes = archiveFileSize;
|
||||||
|
core.debug('Reserving Cache');
|
||||||
|
const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive);
|
||||||
|
const request = {
|
||||||
|
key,
|
||||||
|
version
|
||||||
|
};
|
||||||
|
const response = yield twirpClient.CreateCacheEntry(request);
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||||
|
}
|
||||||
|
core.debug(`Attempting to upload cache located at: ${archivePath}`);
|
||||||
|
yield cacheHttpClient.saveCache(cacheId, archivePath, response.signedUploadUrl, options);
|
||||||
|
const finalizeRequest = {
|
||||||
|
key,
|
||||||
|
version,
|
||||||
|
sizeBytes: `${archiveFileSize}`
|
||||||
|
};
|
||||||
|
const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest);
|
||||||
|
core.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`);
|
||||||
|
if (!finalizeResponse.ok) {
|
||||||
|
throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`);
|
||||||
|
}
|
||||||
|
cacheId = parseInt(finalizeResponse.entryId);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
const typedError = error;
|
const typedError = error;
|
||||||
@@ -238,11 +454,1753 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
|
|||||||
return cacheId;
|
return cacheId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.saveCache = saveCache;
|
|
||||||
//# sourceMappingURL=cache.js.map
|
//# sourceMappingURL=cache.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 8200:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.Timestamp = void 0;
|
||||||
|
const runtime_1 = __nccwpck_require__(8886);
|
||||||
|
const runtime_2 = __nccwpck_require__(8886);
|
||||||
|
const runtime_3 = __nccwpck_require__(8886);
|
||||||
|
const runtime_4 = __nccwpck_require__(8886);
|
||||||
|
const runtime_5 = __nccwpck_require__(8886);
|
||||||
|
const runtime_6 = __nccwpck_require__(8886);
|
||||||
|
const runtime_7 = __nccwpck_require__(8886);
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class Timestamp$Type extends runtime_7.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("google.protobuf.Timestamp", [
|
||||||
|
{ no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
|
||||||
|
{ no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Creates a new `Timestamp` for the current time.
|
||||||
|
*/
|
||||||
|
now() {
|
||||||
|
const msg = this.create();
|
||||||
|
const ms = Date.now();
|
||||||
|
msg.seconds = runtime_6.PbLong.from(Math.floor(ms / 1000)).toString();
|
||||||
|
msg.nanos = (ms % 1000) * 1000000;
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Converts a `Timestamp` to a JavaScript Date.
|
||||||
|
*/
|
||||||
|
toDate(message) {
|
||||||
|
return new Date(runtime_6.PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Converts a JavaScript Date to a `Timestamp`.
|
||||||
|
*/
|
||||||
|
fromDate(date) {
|
||||||
|
const msg = this.create();
|
||||||
|
const ms = date.getTime();
|
||||||
|
msg.seconds = runtime_6.PbLong.from(Math.floor(ms / 1000)).toString();
|
||||||
|
msg.nanos = (ms % 1000) * 1000000;
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* In JSON format, the `Timestamp` type is encoded as a string
|
||||||
|
* in the RFC 3339 format.
|
||||||
|
*/
|
||||||
|
internalJsonWrite(message, options) {
|
||||||
|
let ms = runtime_6.PbLong.from(message.seconds).toNumber() * 1000;
|
||||||
|
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
|
||||||
|
throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
|
||||||
|
if (message.nanos < 0)
|
||||||
|
throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");
|
||||||
|
let z = "Z";
|
||||||
|
if (message.nanos > 0) {
|
||||||
|
let nanosStr = (message.nanos + 1000000000).toString().substring(1);
|
||||||
|
if (nanosStr.substring(3) === "000000")
|
||||||
|
z = "." + nanosStr.substring(0, 3) + "Z";
|
||||||
|
else if (nanosStr.substring(6) === "000")
|
||||||
|
z = "." + nanosStr.substring(0, 6) + "Z";
|
||||||
|
else
|
||||||
|
z = "." + nanosStr + "Z";
|
||||||
|
}
|
||||||
|
return new Date(ms).toISOString().replace(".000Z", z);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* In JSON format, the `Timestamp` type is encoded as a string
|
||||||
|
* in the RFC 3339 format.
|
||||||
|
*/
|
||||||
|
internalJsonRead(json, options, target) {
|
||||||
|
if (typeof json !== "string")
|
||||||
|
throw new Error("Unable to parse Timestamp from JSON " + (0, runtime_5.typeofJsonValue)(json) + ".");
|
||||||
|
let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
|
||||||
|
if (!matches)
|
||||||
|
throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
|
||||||
|
let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
|
||||||
|
if (Number.isNaN(ms))
|
||||||
|
throw new Error("Unable to parse Timestamp from JSON. Invalid value.");
|
||||||
|
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
|
||||||
|
throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
|
||||||
|
if (!target)
|
||||||
|
target = this.create();
|
||||||
|
target.seconds = runtime_6.PbLong.from(ms / 1000).toString();
|
||||||
|
target.nanos = 0;
|
||||||
|
if (matches[7])
|
||||||
|
target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { seconds: "0", nanos: 0 };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* int64 seconds */ 1:
|
||||||
|
message.seconds = reader.int64().toString();
|
||||||
|
break;
|
||||||
|
case /* int32 nanos */ 2:
|
||||||
|
message.nanos = reader.int32();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* int64 seconds = 1; */
|
||||||
|
if (message.seconds !== "0")
|
||||||
|
writer.tag(1, runtime_1.WireType.Varint).int64(message.seconds);
|
||||||
|
/* int32 nanos = 2; */
|
||||||
|
if (message.nanos !== 0)
|
||||||
|
writer.tag(2, runtime_1.WireType.Varint).int32(message.nanos);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message google.protobuf.Timestamp
|
||||||
|
*/
|
||||||
|
exports.Timestamp = new Timestamp$Type();
|
||||||
|
//# sourceMappingURL=timestamp.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 3156:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.CacheService = exports.LookupCacheEntryResponse = exports.LookupCacheEntryRequest = exports.ListCacheEntriesResponse = exports.ListCacheEntriesRequest = exports.DeleteCacheEntryResponse = exports.DeleteCacheEntryRequest = exports.GetCacheEntryDownloadURLResponse = exports.GetCacheEntryDownloadURLRequest = exports.FinalizeCacheEntryUploadResponse = exports.FinalizeCacheEntryUploadRequest = exports.CreateCacheEntryResponse = exports.CreateCacheEntryRequest = void 0;
|
||||||
|
// @generated by protobuf-ts 2.9.1 with parameter long_type_string,client_none,generate_dependencies
|
||||||
|
// @generated from protobuf file "results/api/v1/cache.proto" (package "github.actions.results.api.v1", syntax proto3)
|
||||||
|
// tslint:disable
|
||||||
|
const runtime_rpc_1 = __nccwpck_require__(4420);
|
||||||
|
const runtime_1 = __nccwpck_require__(8886);
|
||||||
|
const runtime_2 = __nccwpck_require__(8886);
|
||||||
|
const runtime_3 = __nccwpck_require__(8886);
|
||||||
|
const runtime_4 = __nccwpck_require__(8886);
|
||||||
|
const runtime_5 = __nccwpck_require__(8886);
|
||||||
|
const cacheentry_1 = __nccwpck_require__(5893);
|
||||||
|
const cachemetadata_1 = __nccwpck_require__(9444);
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class CreateCacheEntryRequest$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.CreateCacheEntryRequest", [
|
||||||
|
{ no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
|
||||||
|
{ no: 2, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 3, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { key: "", version: "" };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* github.actions.results.entities.v1.CacheMetadata metadata */ 1:
|
||||||
|
message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
|
||||||
|
break;
|
||||||
|
case /* string key */ 2:
|
||||||
|
message.key = reader.string();
|
||||||
|
break;
|
||||||
|
case /* string version */ 3:
|
||||||
|
message.version = reader.string();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* github.actions.results.entities.v1.CacheMetadata metadata = 1; */
|
||||||
|
if (message.metadata)
|
||||||
|
cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
/* string key = 2; */
|
||||||
|
if (message.key !== "")
|
||||||
|
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
|
||||||
|
/* string version = 3; */
|
||||||
|
if (message.version !== "")
|
||||||
|
writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.version);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.CreateCacheEntryRequest
|
||||||
|
*/
|
||||||
|
exports.CreateCacheEntryRequest = new CreateCacheEntryRequest$Type();
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class CreateCacheEntryResponse$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.CreateCacheEntryResponse", [
|
||||||
|
{ no: 1, name: "ok", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
|
||||||
|
{ no: 2, name: "signed_upload_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { ok: false, signedUploadUrl: "" };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* bool ok */ 1:
|
||||||
|
message.ok = reader.bool();
|
||||||
|
break;
|
||||||
|
case /* string signed_upload_url */ 2:
|
||||||
|
message.signedUploadUrl = reader.string();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* bool ok = 1; */
|
||||||
|
if (message.ok !== false)
|
||||||
|
writer.tag(1, runtime_1.WireType.Varint).bool(message.ok);
|
||||||
|
/* string signed_upload_url = 2; */
|
||||||
|
if (message.signedUploadUrl !== "")
|
||||||
|
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.CreateCacheEntryResponse
|
||||||
|
*/
|
||||||
|
exports.CreateCacheEntryResponse = new CreateCacheEntryResponse$Type();
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class FinalizeCacheEntryUploadRequest$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.FinalizeCacheEntryUploadRequest", [
|
||||||
|
{ no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
|
||||||
|
{ no: 2, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 3, name: "size_bytes", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
|
||||||
|
{ no: 4, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { key: "", sizeBytes: "0", version: "" };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* github.actions.results.entities.v1.CacheMetadata metadata */ 1:
|
||||||
|
message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
|
||||||
|
break;
|
||||||
|
case /* string key */ 2:
|
||||||
|
message.key = reader.string();
|
||||||
|
break;
|
||||||
|
case /* int64 size_bytes */ 3:
|
||||||
|
message.sizeBytes = reader.int64().toString();
|
||||||
|
break;
|
||||||
|
case /* string version */ 4:
|
||||||
|
message.version = reader.string();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* github.actions.results.entities.v1.CacheMetadata metadata = 1; */
|
||||||
|
if (message.metadata)
|
||||||
|
cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
/* string key = 2; */
|
||||||
|
if (message.key !== "")
|
||||||
|
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
|
||||||
|
/* int64 size_bytes = 3; */
|
||||||
|
if (message.sizeBytes !== "0")
|
||||||
|
writer.tag(3, runtime_1.WireType.Varint).int64(message.sizeBytes);
|
||||||
|
/* string version = 4; */
|
||||||
|
if (message.version !== "")
|
||||||
|
writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.version);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.FinalizeCacheEntryUploadRequest
|
||||||
|
*/
|
||||||
|
exports.FinalizeCacheEntryUploadRequest = new FinalizeCacheEntryUploadRequest$Type();
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class FinalizeCacheEntryUploadResponse$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.FinalizeCacheEntryUploadResponse", [
|
||||||
|
{ no: 1, name: "ok", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
|
||||||
|
{ no: 2, name: "entry_id", kind: "scalar", T: 3 /*ScalarType.INT64*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { ok: false, entryId: "0" };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* bool ok */ 1:
|
||||||
|
message.ok = reader.bool();
|
||||||
|
break;
|
||||||
|
case /* int64 entry_id */ 2:
|
||||||
|
message.entryId = reader.int64().toString();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* bool ok = 1; */
|
||||||
|
if (message.ok !== false)
|
||||||
|
writer.tag(1, runtime_1.WireType.Varint).bool(message.ok);
|
||||||
|
/* int64 entry_id = 2; */
|
||||||
|
if (message.entryId !== "0")
|
||||||
|
writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.FinalizeCacheEntryUploadResponse
|
||||||
|
*/
|
||||||
|
exports.FinalizeCacheEntryUploadResponse = new FinalizeCacheEntryUploadResponse$Type();
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class GetCacheEntryDownloadURLRequest$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.GetCacheEntryDownloadURLRequest", [
|
||||||
|
{ no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
|
||||||
|
{ no: 2, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 3, name: "restore_keys", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 4, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { key: "", restoreKeys: [], version: "" };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* github.actions.results.entities.v1.CacheMetadata metadata */ 1:
|
||||||
|
message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
|
||||||
|
break;
|
||||||
|
case /* string key */ 2:
|
||||||
|
message.key = reader.string();
|
||||||
|
break;
|
||||||
|
case /* repeated string restore_keys */ 3:
|
||||||
|
message.restoreKeys.push(reader.string());
|
||||||
|
break;
|
||||||
|
case /* string version */ 4:
|
||||||
|
message.version = reader.string();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* github.actions.results.entities.v1.CacheMetadata metadata = 1; */
|
||||||
|
if (message.metadata)
|
||||||
|
cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
/* string key = 2; */
|
||||||
|
if (message.key !== "")
|
||||||
|
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
|
||||||
|
/* repeated string restore_keys = 3; */
|
||||||
|
for (let i = 0; i < message.restoreKeys.length; i++)
|
||||||
|
writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.restoreKeys[i]);
|
||||||
|
/* string version = 4; */
|
||||||
|
if (message.version !== "")
|
||||||
|
writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.version);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.GetCacheEntryDownloadURLRequest
|
||||||
|
*/
|
||||||
|
exports.GetCacheEntryDownloadURLRequest = new GetCacheEntryDownloadURLRequest$Type();
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class GetCacheEntryDownloadURLResponse$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.GetCacheEntryDownloadURLResponse", [
|
||||||
|
{ no: 1, name: "ok", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
|
||||||
|
{ no: 2, name: "signed_download_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 3, name: "matched_key", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { ok: false, signedDownloadUrl: "", matchedKey: "" };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* bool ok */ 1:
|
||||||
|
message.ok = reader.bool();
|
||||||
|
break;
|
||||||
|
case /* string signed_download_url */ 2:
|
||||||
|
message.signedDownloadUrl = reader.string();
|
||||||
|
break;
|
||||||
|
case /* string matched_key */ 3:
|
||||||
|
message.matchedKey = reader.string();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* bool ok = 1; */
|
||||||
|
if (message.ok !== false)
|
||||||
|
writer.tag(1, runtime_1.WireType.Varint).bool(message.ok);
|
||||||
|
/* string signed_download_url = 2; */
|
||||||
|
if (message.signedDownloadUrl !== "")
|
||||||
|
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedDownloadUrl);
|
||||||
|
/* string matched_key = 3; */
|
||||||
|
if (message.matchedKey !== "")
|
||||||
|
writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.matchedKey);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.GetCacheEntryDownloadURLResponse
|
||||||
|
*/
|
||||||
|
exports.GetCacheEntryDownloadURLResponse = new GetCacheEntryDownloadURLResponse$Type();
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class DeleteCacheEntryRequest$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.DeleteCacheEntryRequest", [
|
||||||
|
{ no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
|
||||||
|
{ no: 2, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { key: "" };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* github.actions.results.entities.v1.CacheMetadata metadata */ 1:
|
||||||
|
message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
|
||||||
|
break;
|
||||||
|
case /* string key */ 2:
|
||||||
|
message.key = reader.string();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* github.actions.results.entities.v1.CacheMetadata metadata = 1; */
|
||||||
|
if (message.metadata)
|
||||||
|
cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
/* string key = 2; */
|
||||||
|
if (message.key !== "")
|
||||||
|
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.DeleteCacheEntryRequest
|
||||||
|
*/
|
||||||
|
exports.DeleteCacheEntryRequest = new DeleteCacheEntryRequest$Type();
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class DeleteCacheEntryResponse$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.DeleteCacheEntryResponse", [
|
||||||
|
{ no: 1, name: "ok", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
|
||||||
|
{ no: 2, name: "entry_id", kind: "scalar", T: 3 /*ScalarType.INT64*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { ok: false, entryId: "0" };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* bool ok */ 1:
|
||||||
|
message.ok = reader.bool();
|
||||||
|
break;
|
||||||
|
case /* int64 entry_id */ 2:
|
||||||
|
message.entryId = reader.int64().toString();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* bool ok = 1; */
|
||||||
|
if (message.ok !== false)
|
||||||
|
writer.tag(1, runtime_1.WireType.Varint).bool(message.ok);
|
||||||
|
/* int64 entry_id = 2; */
|
||||||
|
if (message.entryId !== "0")
|
||||||
|
writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.DeleteCacheEntryResponse
|
||||||
|
*/
|
||||||
|
exports.DeleteCacheEntryResponse = new DeleteCacheEntryResponse$Type();
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class ListCacheEntriesRequest$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.ListCacheEntriesRequest", [
|
||||||
|
{ no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
|
||||||
|
{ no: 2, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 3, name: "restore_keys", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { key: "", restoreKeys: [] };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* github.actions.results.entities.v1.CacheMetadata metadata */ 1:
|
||||||
|
message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
|
||||||
|
break;
|
||||||
|
case /* string key */ 2:
|
||||||
|
message.key = reader.string();
|
||||||
|
break;
|
||||||
|
case /* repeated string restore_keys */ 3:
|
||||||
|
message.restoreKeys.push(reader.string());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* github.actions.results.entities.v1.CacheMetadata metadata = 1; */
|
||||||
|
if (message.metadata)
|
||||||
|
cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
/* string key = 2; */
|
||||||
|
if (message.key !== "")
|
||||||
|
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
|
||||||
|
/* repeated string restore_keys = 3; */
|
||||||
|
for (let i = 0; i < message.restoreKeys.length; i++)
|
||||||
|
writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.restoreKeys[i]);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.ListCacheEntriesRequest
|
||||||
|
*/
|
||||||
|
exports.ListCacheEntriesRequest = new ListCacheEntriesRequest$Type();
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class ListCacheEntriesResponse$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.ListCacheEntriesResponse", [
|
||||||
|
{ no: 1, name: "entries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => cacheentry_1.CacheEntry }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { entries: [] };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* repeated github.actions.results.entities.v1.CacheEntry entries */ 1:
|
||||||
|
message.entries.push(cacheentry_1.CacheEntry.internalBinaryRead(reader, reader.uint32(), options));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* repeated github.actions.results.entities.v1.CacheEntry entries = 1; */
|
||||||
|
for (let i = 0; i < message.entries.length; i++)
|
||||||
|
cacheentry_1.CacheEntry.internalBinaryWrite(message.entries[i], writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.ListCacheEntriesResponse
|
||||||
|
*/
|
||||||
|
exports.ListCacheEntriesResponse = new ListCacheEntriesResponse$Type();
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class LookupCacheEntryRequest$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.LookupCacheEntryRequest", [
|
||||||
|
{ no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
|
||||||
|
{ no: 2, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 3, name: "restore_keys", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 4, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { key: "", restoreKeys: [], version: "" };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* github.actions.results.entities.v1.CacheMetadata metadata */ 1:
|
||||||
|
message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
|
||||||
|
break;
|
||||||
|
case /* string key */ 2:
|
||||||
|
message.key = reader.string();
|
||||||
|
break;
|
||||||
|
case /* repeated string restore_keys */ 3:
|
||||||
|
message.restoreKeys.push(reader.string());
|
||||||
|
break;
|
||||||
|
case /* string version */ 4:
|
||||||
|
message.version = reader.string();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* github.actions.results.entities.v1.CacheMetadata metadata = 1; */
|
||||||
|
if (message.metadata)
|
||||||
|
cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
/* string key = 2; */
|
||||||
|
if (message.key !== "")
|
||||||
|
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
|
||||||
|
/* repeated string restore_keys = 3; */
|
||||||
|
for (let i = 0; i < message.restoreKeys.length; i++)
|
||||||
|
writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.restoreKeys[i]);
|
||||||
|
/* string version = 4; */
|
||||||
|
if (message.version !== "")
|
||||||
|
writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.version);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.LookupCacheEntryRequest
|
||||||
|
*/
|
||||||
|
exports.LookupCacheEntryRequest = new LookupCacheEntryRequest$Type();
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class LookupCacheEntryResponse$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.api.v1.LookupCacheEntryResponse", [
|
||||||
|
{ no: 1, name: "exists", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
|
||||||
|
{ no: 2, name: "entry", kind: "message", T: () => cacheentry_1.CacheEntry }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { exists: false };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* bool exists */ 1:
|
||||||
|
message.exists = reader.bool();
|
||||||
|
break;
|
||||||
|
case /* github.actions.results.entities.v1.CacheEntry entry */ 2:
|
||||||
|
message.entry = cacheentry_1.CacheEntry.internalBinaryRead(reader, reader.uint32(), options, message.entry);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* bool exists = 1; */
|
||||||
|
if (message.exists !== false)
|
||||||
|
writer.tag(1, runtime_1.WireType.Varint).bool(message.exists);
|
||||||
|
/* github.actions.results.entities.v1.CacheEntry entry = 2; */
|
||||||
|
if (message.entry)
|
||||||
|
cacheentry_1.CacheEntry.internalBinaryWrite(message.entry, writer.tag(2, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.api.v1.LookupCacheEntryResponse
|
||||||
|
*/
|
||||||
|
exports.LookupCacheEntryResponse = new LookupCacheEntryResponse$Type();
|
||||||
|
/**
|
||||||
|
* @generated ServiceType for protobuf service github.actions.results.api.v1.CacheService
|
||||||
|
*/
|
||||||
|
exports.CacheService = new runtime_rpc_1.ServiceType("github.actions.results.api.v1.CacheService", [
|
||||||
|
{ name: "CreateCacheEntry", options: {}, I: exports.CreateCacheEntryRequest, O: exports.CreateCacheEntryResponse },
|
||||||
|
{ name: "FinalizeCacheEntryUpload", options: {}, I: exports.FinalizeCacheEntryUploadRequest, O: exports.FinalizeCacheEntryUploadResponse },
|
||||||
|
{ name: "GetCacheEntryDownloadURL", options: {}, I: exports.GetCacheEntryDownloadURLRequest, O: exports.GetCacheEntryDownloadURLResponse },
|
||||||
|
{ name: "DeleteCacheEntry", options: {}, I: exports.DeleteCacheEntryRequest, O: exports.DeleteCacheEntryResponse },
|
||||||
|
{ name: "ListCacheEntries", options: {}, I: exports.ListCacheEntriesRequest, O: exports.ListCacheEntriesResponse },
|
||||||
|
{ name: "LookupCacheEntry", options: {}, I: exports.LookupCacheEntryRequest, O: exports.LookupCacheEntryResponse }
|
||||||
|
]);
|
||||||
|
//# sourceMappingURL=cache.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 564:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.createCacheServiceServer = exports.CacheServiceMethodList = exports.CacheServiceMethod = exports.CacheServiceClientProtobuf = exports.CacheServiceClientJSON = void 0;
|
||||||
|
const twirp_ts_1 = __nccwpck_require__(430);
|
||||||
|
const cache_1 = __nccwpck_require__(3156);
|
||||||
|
class CacheServiceClientJSON {
|
||||||
|
constructor(rpc) {
|
||||||
|
this.rpc = rpc;
|
||||||
|
this.CreateCacheEntry.bind(this);
|
||||||
|
this.FinalizeCacheEntryUpload.bind(this);
|
||||||
|
this.GetCacheEntryDownloadURL.bind(this);
|
||||||
|
this.DeleteCacheEntry.bind(this);
|
||||||
|
this.ListCacheEntries.bind(this);
|
||||||
|
this.LookupCacheEntry.bind(this);
|
||||||
|
}
|
||||||
|
CreateCacheEntry(request) {
|
||||||
|
const data = cache_1.CreateCacheEntryRequest.toJson(request, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
});
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "CreateCacheEntry", "application/json", data);
|
||||||
|
return promise.then((data) => cache_1.CreateCacheEntryResponse.fromJson(data, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
FinalizeCacheEntryUpload(request) {
|
||||||
|
const data = cache_1.FinalizeCacheEntryUploadRequest.toJson(request, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
});
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "FinalizeCacheEntryUpload", "application/json", data);
|
||||||
|
return promise.then((data) => cache_1.FinalizeCacheEntryUploadResponse.fromJson(data, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
GetCacheEntryDownloadURL(request) {
|
||||||
|
const data = cache_1.GetCacheEntryDownloadURLRequest.toJson(request, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
});
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "GetCacheEntryDownloadURL", "application/json", data);
|
||||||
|
return promise.then((data) => cache_1.GetCacheEntryDownloadURLResponse.fromJson(data, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
DeleteCacheEntry(request) {
|
||||||
|
const data = cache_1.DeleteCacheEntryRequest.toJson(request, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
});
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "DeleteCacheEntry", "application/json", data);
|
||||||
|
return promise.then((data) => cache_1.DeleteCacheEntryResponse.fromJson(data, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
ListCacheEntries(request) {
|
||||||
|
const data = cache_1.ListCacheEntriesRequest.toJson(request, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
});
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "ListCacheEntries", "application/json", data);
|
||||||
|
return promise.then((data) => cache_1.ListCacheEntriesResponse.fromJson(data, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
LookupCacheEntry(request) {
|
||||||
|
const data = cache_1.LookupCacheEntryRequest.toJson(request, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
});
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "LookupCacheEntry", "application/json", data);
|
||||||
|
return promise.then((data) => cache_1.LookupCacheEntryResponse.fromJson(data, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CacheServiceClientJSON = CacheServiceClientJSON;
|
||||||
|
class CacheServiceClientProtobuf {
|
||||||
|
constructor(rpc) {
|
||||||
|
this.rpc = rpc;
|
||||||
|
this.CreateCacheEntry.bind(this);
|
||||||
|
this.FinalizeCacheEntryUpload.bind(this);
|
||||||
|
this.GetCacheEntryDownloadURL.bind(this);
|
||||||
|
this.DeleteCacheEntry.bind(this);
|
||||||
|
this.ListCacheEntries.bind(this);
|
||||||
|
this.LookupCacheEntry.bind(this);
|
||||||
|
}
|
||||||
|
CreateCacheEntry(request) {
|
||||||
|
const data = cache_1.CreateCacheEntryRequest.toBinary(request);
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "CreateCacheEntry", "application/protobuf", data);
|
||||||
|
return promise.then((data) => cache_1.CreateCacheEntryResponse.fromBinary(data));
|
||||||
|
}
|
||||||
|
FinalizeCacheEntryUpload(request) {
|
||||||
|
const data = cache_1.FinalizeCacheEntryUploadRequest.toBinary(request);
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "FinalizeCacheEntryUpload", "application/protobuf", data);
|
||||||
|
return promise.then((data) => cache_1.FinalizeCacheEntryUploadResponse.fromBinary(data));
|
||||||
|
}
|
||||||
|
GetCacheEntryDownloadURL(request) {
|
||||||
|
const data = cache_1.GetCacheEntryDownloadURLRequest.toBinary(request);
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "GetCacheEntryDownloadURL", "application/protobuf", data);
|
||||||
|
return promise.then((data) => cache_1.GetCacheEntryDownloadURLResponse.fromBinary(data));
|
||||||
|
}
|
||||||
|
DeleteCacheEntry(request) {
|
||||||
|
const data = cache_1.DeleteCacheEntryRequest.toBinary(request);
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "DeleteCacheEntry", "application/protobuf", data);
|
||||||
|
return promise.then((data) => cache_1.DeleteCacheEntryResponse.fromBinary(data));
|
||||||
|
}
|
||||||
|
ListCacheEntries(request) {
|
||||||
|
const data = cache_1.ListCacheEntriesRequest.toBinary(request);
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "ListCacheEntries", "application/protobuf", data);
|
||||||
|
return promise.then((data) => cache_1.ListCacheEntriesResponse.fromBinary(data));
|
||||||
|
}
|
||||||
|
LookupCacheEntry(request) {
|
||||||
|
const data = cache_1.LookupCacheEntryRequest.toBinary(request);
|
||||||
|
const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "LookupCacheEntry", "application/protobuf", data);
|
||||||
|
return promise.then((data) => cache_1.LookupCacheEntryResponse.fromBinary(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CacheServiceClientProtobuf = CacheServiceClientProtobuf;
|
||||||
|
var CacheServiceMethod;
|
||||||
|
(function (CacheServiceMethod) {
|
||||||
|
CacheServiceMethod["CreateCacheEntry"] = "CreateCacheEntry";
|
||||||
|
CacheServiceMethod["FinalizeCacheEntryUpload"] = "FinalizeCacheEntryUpload";
|
||||||
|
CacheServiceMethod["GetCacheEntryDownloadURL"] = "GetCacheEntryDownloadURL";
|
||||||
|
CacheServiceMethod["DeleteCacheEntry"] = "DeleteCacheEntry";
|
||||||
|
CacheServiceMethod["ListCacheEntries"] = "ListCacheEntries";
|
||||||
|
CacheServiceMethod["LookupCacheEntry"] = "LookupCacheEntry";
|
||||||
|
})(CacheServiceMethod || (exports.CacheServiceMethod = CacheServiceMethod = {}));
|
||||||
|
exports.CacheServiceMethodList = [
|
||||||
|
CacheServiceMethod.CreateCacheEntry,
|
||||||
|
CacheServiceMethod.FinalizeCacheEntryUpload,
|
||||||
|
CacheServiceMethod.GetCacheEntryDownloadURL,
|
||||||
|
CacheServiceMethod.DeleteCacheEntry,
|
||||||
|
CacheServiceMethod.ListCacheEntries,
|
||||||
|
CacheServiceMethod.LookupCacheEntry,
|
||||||
|
];
|
||||||
|
function createCacheServiceServer(service) {
|
||||||
|
return new twirp_ts_1.TwirpServer({
|
||||||
|
service,
|
||||||
|
packageName: "github.actions.results.api.v1",
|
||||||
|
serviceName: "CacheService",
|
||||||
|
methodList: exports.CacheServiceMethodList,
|
||||||
|
matchRoute: matchCacheServiceRoute,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.createCacheServiceServer = createCacheServiceServer;
|
||||||
|
function matchCacheServiceRoute(method, events) {
|
||||||
|
switch (method) {
|
||||||
|
case "CreateCacheEntry":
|
||||||
|
return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
ctx = Object.assign(Object.assign({}, ctx), { methodName: "CreateCacheEntry" });
|
||||||
|
yield events.onMatch(ctx);
|
||||||
|
return handleCacheServiceCreateCacheEntryRequest(ctx, service, data, interceptors);
|
||||||
|
});
|
||||||
|
case "FinalizeCacheEntryUpload":
|
||||||
|
return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
ctx = Object.assign(Object.assign({}, ctx), { methodName: "FinalizeCacheEntryUpload" });
|
||||||
|
yield events.onMatch(ctx);
|
||||||
|
return handleCacheServiceFinalizeCacheEntryUploadRequest(ctx, service, data, interceptors);
|
||||||
|
});
|
||||||
|
case "GetCacheEntryDownloadURL":
|
||||||
|
return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
ctx = Object.assign(Object.assign({}, ctx), { methodName: "GetCacheEntryDownloadURL" });
|
||||||
|
yield events.onMatch(ctx);
|
||||||
|
return handleCacheServiceGetCacheEntryDownloadURLRequest(ctx, service, data, interceptors);
|
||||||
|
});
|
||||||
|
case "DeleteCacheEntry":
|
||||||
|
return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
ctx = Object.assign(Object.assign({}, ctx), { methodName: "DeleteCacheEntry" });
|
||||||
|
yield events.onMatch(ctx);
|
||||||
|
return handleCacheServiceDeleteCacheEntryRequest(ctx, service, data, interceptors);
|
||||||
|
});
|
||||||
|
case "ListCacheEntries":
|
||||||
|
return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
ctx = Object.assign(Object.assign({}, ctx), { methodName: "ListCacheEntries" });
|
||||||
|
yield events.onMatch(ctx);
|
||||||
|
return handleCacheServiceListCacheEntriesRequest(ctx, service, data, interceptors);
|
||||||
|
});
|
||||||
|
case "LookupCacheEntry":
|
||||||
|
return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
ctx = Object.assign(Object.assign({}, ctx), { methodName: "LookupCacheEntry" });
|
||||||
|
yield events.onMatch(ctx);
|
||||||
|
return handleCacheServiceLookupCacheEntryRequest(ctx, service, data, interceptors);
|
||||||
|
});
|
||||||
|
default:
|
||||||
|
events.onNotFound();
|
||||||
|
const msg = `no handler found`;
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function handleCacheServiceCreateCacheEntryRequest(ctx, service, data, interceptors) {
|
||||||
|
switch (ctx.contentType) {
|
||||||
|
case twirp_ts_1.TwirpContentType.JSON:
|
||||||
|
return handleCacheServiceCreateCacheEntryJSON(ctx, service, data, interceptors);
|
||||||
|
case twirp_ts_1.TwirpContentType.Protobuf:
|
||||||
|
return handleCacheServiceCreateCacheEntryProtobuf(ctx, service, data, interceptors);
|
||||||
|
default:
|
||||||
|
const msg = "unexpected Content-Type";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function handleCacheServiceFinalizeCacheEntryUploadRequest(ctx, service, data, interceptors) {
|
||||||
|
switch (ctx.contentType) {
|
||||||
|
case twirp_ts_1.TwirpContentType.JSON:
|
||||||
|
return handleCacheServiceFinalizeCacheEntryUploadJSON(ctx, service, data, interceptors);
|
||||||
|
case twirp_ts_1.TwirpContentType.Protobuf:
|
||||||
|
return handleCacheServiceFinalizeCacheEntryUploadProtobuf(ctx, service, data, interceptors);
|
||||||
|
default:
|
||||||
|
const msg = "unexpected Content-Type";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function handleCacheServiceGetCacheEntryDownloadURLRequest(ctx, service, data, interceptors) {
|
||||||
|
switch (ctx.contentType) {
|
||||||
|
case twirp_ts_1.TwirpContentType.JSON:
|
||||||
|
return handleCacheServiceGetCacheEntryDownloadURLJSON(ctx, service, data, interceptors);
|
||||||
|
case twirp_ts_1.TwirpContentType.Protobuf:
|
||||||
|
return handleCacheServiceGetCacheEntryDownloadURLProtobuf(ctx, service, data, interceptors);
|
||||||
|
default:
|
||||||
|
const msg = "unexpected Content-Type";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function handleCacheServiceDeleteCacheEntryRequest(ctx, service, data, interceptors) {
|
||||||
|
switch (ctx.contentType) {
|
||||||
|
case twirp_ts_1.TwirpContentType.JSON:
|
||||||
|
return handleCacheServiceDeleteCacheEntryJSON(ctx, service, data, interceptors);
|
||||||
|
case twirp_ts_1.TwirpContentType.Protobuf:
|
||||||
|
return handleCacheServiceDeleteCacheEntryProtobuf(ctx, service, data, interceptors);
|
||||||
|
default:
|
||||||
|
const msg = "unexpected Content-Type";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function handleCacheServiceListCacheEntriesRequest(ctx, service, data, interceptors) {
|
||||||
|
switch (ctx.contentType) {
|
||||||
|
case twirp_ts_1.TwirpContentType.JSON:
|
||||||
|
return handleCacheServiceListCacheEntriesJSON(ctx, service, data, interceptors);
|
||||||
|
case twirp_ts_1.TwirpContentType.Protobuf:
|
||||||
|
return handleCacheServiceListCacheEntriesProtobuf(ctx, service, data, interceptors);
|
||||||
|
default:
|
||||||
|
const msg = "unexpected Content-Type";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function handleCacheServiceLookupCacheEntryRequest(ctx, service, data, interceptors) {
|
||||||
|
switch (ctx.contentType) {
|
||||||
|
case twirp_ts_1.TwirpContentType.JSON:
|
||||||
|
return handleCacheServiceLookupCacheEntryJSON(ctx, service, data, interceptors);
|
||||||
|
case twirp_ts_1.TwirpContentType.Protobuf:
|
||||||
|
return handleCacheServiceLookupCacheEntryProtobuf(ctx, service, data, interceptors);
|
||||||
|
default:
|
||||||
|
const msg = "unexpected Content-Type";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function handleCacheServiceCreateCacheEntryJSON(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
const body = JSON.parse(data.toString() || "{}");
|
||||||
|
request = cache_1.CreateCacheEntryRequest.fromJson(body, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the json request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.CreateCacheEntry(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.CreateCacheEntry(ctx, request);
|
||||||
|
}
|
||||||
|
return JSON.stringify(cache_1.CreateCacheEntryResponse.toJson(response, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCacheServiceFinalizeCacheEntryUploadJSON(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
const body = JSON.parse(data.toString() || "{}");
|
||||||
|
request = cache_1.FinalizeCacheEntryUploadRequest.fromJson(body, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the json request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.FinalizeCacheEntryUpload(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.FinalizeCacheEntryUpload(ctx, request);
|
||||||
|
}
|
||||||
|
return JSON.stringify(cache_1.FinalizeCacheEntryUploadResponse.toJson(response, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCacheServiceGetCacheEntryDownloadURLJSON(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
const body = JSON.parse(data.toString() || "{}");
|
||||||
|
request = cache_1.GetCacheEntryDownloadURLRequest.fromJson(body, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the json request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.GetCacheEntryDownloadURL(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.GetCacheEntryDownloadURL(ctx, request);
|
||||||
|
}
|
||||||
|
return JSON.stringify(cache_1.GetCacheEntryDownloadURLResponse.toJson(response, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCacheServiceDeleteCacheEntryJSON(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
const body = JSON.parse(data.toString() || "{}");
|
||||||
|
request = cache_1.DeleteCacheEntryRequest.fromJson(body, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the json request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.DeleteCacheEntry(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.DeleteCacheEntry(ctx, request);
|
||||||
|
}
|
||||||
|
return JSON.stringify(cache_1.DeleteCacheEntryResponse.toJson(response, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCacheServiceListCacheEntriesJSON(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
const body = JSON.parse(data.toString() || "{}");
|
||||||
|
request = cache_1.ListCacheEntriesRequest.fromJson(body, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the json request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.ListCacheEntries(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.ListCacheEntries(ctx, request);
|
||||||
|
}
|
||||||
|
return JSON.stringify(cache_1.ListCacheEntriesResponse.toJson(response, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCacheServiceLookupCacheEntryJSON(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
const body = JSON.parse(data.toString() || "{}");
|
||||||
|
request = cache_1.LookupCacheEntryRequest.fromJson(body, {
|
||||||
|
ignoreUnknownFields: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the json request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.LookupCacheEntry(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.LookupCacheEntry(ctx, request);
|
||||||
|
}
|
||||||
|
return JSON.stringify(cache_1.LookupCacheEntryResponse.toJson(response, {
|
||||||
|
useProtoFieldName: true,
|
||||||
|
emitDefaultValues: false,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCacheServiceCreateCacheEntryProtobuf(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
request = cache_1.CreateCacheEntryRequest.fromBinary(data);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the protobuf request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.CreateCacheEntry(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.CreateCacheEntry(ctx, request);
|
||||||
|
}
|
||||||
|
return Buffer.from(cache_1.CreateCacheEntryResponse.toBinary(response));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCacheServiceFinalizeCacheEntryUploadProtobuf(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
request = cache_1.FinalizeCacheEntryUploadRequest.fromBinary(data);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the protobuf request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.FinalizeCacheEntryUpload(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.FinalizeCacheEntryUpload(ctx, request);
|
||||||
|
}
|
||||||
|
return Buffer.from(cache_1.FinalizeCacheEntryUploadResponse.toBinary(response));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCacheServiceGetCacheEntryDownloadURLProtobuf(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
request = cache_1.GetCacheEntryDownloadURLRequest.fromBinary(data);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the protobuf request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.GetCacheEntryDownloadURL(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.GetCacheEntryDownloadURL(ctx, request);
|
||||||
|
}
|
||||||
|
return Buffer.from(cache_1.GetCacheEntryDownloadURLResponse.toBinary(response));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCacheServiceDeleteCacheEntryProtobuf(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
request = cache_1.DeleteCacheEntryRequest.fromBinary(data);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the protobuf request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.DeleteCacheEntry(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.DeleteCacheEntry(ctx, request);
|
||||||
|
}
|
||||||
|
return Buffer.from(cache_1.DeleteCacheEntryResponse.toBinary(response));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCacheServiceListCacheEntriesProtobuf(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
request = cache_1.ListCacheEntriesRequest.fromBinary(data);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the protobuf request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.ListCacheEntries(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.ListCacheEntries(ctx, request);
|
||||||
|
}
|
||||||
|
return Buffer.from(cache_1.ListCacheEntriesResponse.toBinary(response));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleCacheServiceLookupCacheEntryProtobuf(ctx, service, data, interceptors) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let request;
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
request = cache_1.LookupCacheEntryRequest.fromBinary(data);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
if (e instanceof Error) {
|
||||||
|
const msg = "the protobuf request could not be decoded";
|
||||||
|
throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (interceptors && interceptors.length > 0) {
|
||||||
|
const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
|
||||||
|
response = yield interceptor(ctx, request, (ctx, inputReq) => {
|
||||||
|
return service.LookupCacheEntry(ctx, inputReq);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = yield service.LookupCacheEntry(ctx, request);
|
||||||
|
}
|
||||||
|
return Buffer.from(cache_1.LookupCacheEntryResponse.toBinary(response));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=cache.twirp.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 5893:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.CacheEntry = void 0;
|
||||||
|
const runtime_1 = __nccwpck_require__(8886);
|
||||||
|
const runtime_2 = __nccwpck_require__(8886);
|
||||||
|
const runtime_3 = __nccwpck_require__(8886);
|
||||||
|
const runtime_4 = __nccwpck_require__(8886);
|
||||||
|
const runtime_5 = __nccwpck_require__(8886);
|
||||||
|
const timestamp_1 = __nccwpck_require__(8200);
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class CacheEntry$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.entities.v1.CacheEntry", [
|
||||||
|
{ no: 1, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 2, name: "hash", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 3, name: "size_bytes", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
|
||||||
|
{ no: 4, name: "scope", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 5, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 6, name: "created_at", kind: "message", T: () => timestamp_1.Timestamp },
|
||||||
|
{ no: 7, name: "last_accessed_at", kind: "message", T: () => timestamp_1.Timestamp },
|
||||||
|
{ no: 8, name: "expires_at", kind: "message", T: () => timestamp_1.Timestamp }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { key: "", hash: "", sizeBytes: "0", scope: "", version: "" };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* string key */ 1:
|
||||||
|
message.key = reader.string();
|
||||||
|
break;
|
||||||
|
case /* string hash */ 2:
|
||||||
|
message.hash = reader.string();
|
||||||
|
break;
|
||||||
|
case /* int64 size_bytes */ 3:
|
||||||
|
message.sizeBytes = reader.int64().toString();
|
||||||
|
break;
|
||||||
|
case /* string scope */ 4:
|
||||||
|
message.scope = reader.string();
|
||||||
|
break;
|
||||||
|
case /* string version */ 5:
|
||||||
|
message.version = reader.string();
|
||||||
|
break;
|
||||||
|
case /* google.protobuf.Timestamp created_at */ 6:
|
||||||
|
message.createdAt = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.createdAt);
|
||||||
|
break;
|
||||||
|
case /* google.protobuf.Timestamp last_accessed_at */ 7:
|
||||||
|
message.lastAccessedAt = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.lastAccessedAt);
|
||||||
|
break;
|
||||||
|
case /* google.protobuf.Timestamp expires_at */ 8:
|
||||||
|
message.expiresAt = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.expiresAt);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* string key = 1; */
|
||||||
|
if (message.key !== "")
|
||||||
|
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.key);
|
||||||
|
/* string hash = 2; */
|
||||||
|
if (message.hash !== "")
|
||||||
|
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.hash);
|
||||||
|
/* int64 size_bytes = 3; */
|
||||||
|
if (message.sizeBytes !== "0")
|
||||||
|
writer.tag(3, runtime_1.WireType.Varint).int64(message.sizeBytes);
|
||||||
|
/* string scope = 4; */
|
||||||
|
if (message.scope !== "")
|
||||||
|
writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.scope);
|
||||||
|
/* string version = 5; */
|
||||||
|
if (message.version !== "")
|
||||||
|
writer.tag(5, runtime_1.WireType.LengthDelimited).string(message.version);
|
||||||
|
/* google.protobuf.Timestamp created_at = 6; */
|
||||||
|
if (message.createdAt)
|
||||||
|
timestamp_1.Timestamp.internalBinaryWrite(message.createdAt, writer.tag(6, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
/* google.protobuf.Timestamp last_accessed_at = 7; */
|
||||||
|
if (message.lastAccessedAt)
|
||||||
|
timestamp_1.Timestamp.internalBinaryWrite(message.lastAccessedAt, writer.tag(7, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
/* google.protobuf.Timestamp expires_at = 8; */
|
||||||
|
if (message.expiresAt)
|
||||||
|
timestamp_1.Timestamp.internalBinaryWrite(message.expiresAt, writer.tag(8, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.entities.v1.CacheEntry
|
||||||
|
*/
|
||||||
|
exports.CacheEntry = new CacheEntry$Type();
|
||||||
|
//# sourceMappingURL=cacheentry.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 9444:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.CacheMetadata = void 0;
|
||||||
|
const runtime_1 = __nccwpck_require__(8886);
|
||||||
|
const runtime_2 = __nccwpck_require__(8886);
|
||||||
|
const runtime_3 = __nccwpck_require__(8886);
|
||||||
|
const runtime_4 = __nccwpck_require__(8886);
|
||||||
|
const runtime_5 = __nccwpck_require__(8886);
|
||||||
|
const cachescope_1 = __nccwpck_require__(9425);
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class CacheMetadata$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.entities.v1.CacheMetadata", [
|
||||||
|
{ no: 1, name: "repository_id", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
|
||||||
|
{ no: 2, name: "scope", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => cachescope_1.CacheScope }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { repositoryId: "0", scope: [] };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* int64 repository_id */ 1:
|
||||||
|
message.repositoryId = reader.int64().toString();
|
||||||
|
break;
|
||||||
|
case /* repeated github.actions.results.entities.v1.CacheScope scope */ 2:
|
||||||
|
message.scope.push(cachescope_1.CacheScope.internalBinaryRead(reader, reader.uint32(), options));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* int64 repository_id = 1; */
|
||||||
|
if (message.repositoryId !== "0")
|
||||||
|
writer.tag(1, runtime_1.WireType.Varint).int64(message.repositoryId);
|
||||||
|
/* repeated github.actions.results.entities.v1.CacheScope scope = 2; */
|
||||||
|
for (let i = 0; i < message.scope.length; i++)
|
||||||
|
cachescope_1.CacheScope.internalBinaryWrite(message.scope[i], writer.tag(2, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.entities.v1.CacheMetadata
|
||||||
|
*/
|
||||||
|
exports.CacheMetadata = new CacheMetadata$Type();
|
||||||
|
//# sourceMappingURL=cachemetadata.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 9425:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.CacheScope = void 0;
|
||||||
|
const runtime_1 = __nccwpck_require__(8886);
|
||||||
|
const runtime_2 = __nccwpck_require__(8886);
|
||||||
|
const runtime_3 = __nccwpck_require__(8886);
|
||||||
|
const runtime_4 = __nccwpck_require__(8886);
|
||||||
|
const runtime_5 = __nccwpck_require__(8886);
|
||||||
|
// @generated message type with reflection information, may provide speed optimized methods
|
||||||
|
class CacheScope$Type extends runtime_5.MessageType {
|
||||||
|
constructor() {
|
||||||
|
super("github.actions.results.entities.v1.CacheScope", [
|
||||||
|
{ no: 1, name: "scope", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||||
|
{ no: 2, name: "permission", kind: "scalar", T: 3 /*ScalarType.INT64*/ }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
const message = { scope: "", permission: "0" };
|
||||||
|
globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
|
||||||
|
if (value !== undefined)
|
||||||
|
(0, runtime_3.reflectionMergePartial)(this, message, value);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case /* string scope */ 1:
|
||||||
|
message.scope = reader.string();
|
||||||
|
break;
|
||||||
|
case /* int64 permission */ 2:
|
||||||
|
message.permission = reader.int64().toString();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u === "throw")
|
||||||
|
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
/* string scope = 1; */
|
||||||
|
if (message.scope !== "")
|
||||||
|
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.scope);
|
||||||
|
/* int64 permission = 2; */
|
||||||
|
if (message.permission !== "0")
|
||||||
|
writer.tag(2, runtime_1.WireType.Varint).int64(message.permission);
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @generated MessageType for protobuf message github.actions.results.entities.v1.CacheScope
|
||||||
|
*/
|
||||||
|
exports.CacheScope = new CacheScope$Type();
|
||||||
|
//# sourceMappingURL=cachescope.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 5552:
|
/***/ 5552:
|
||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
@@ -281,20 +2239,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.saveCache = exports.reserveCache = exports.downloadCache = exports.getCacheEntry = exports.getCacheVersion = void 0;
|
exports.saveCache = exports.reserveCache = exports.downloadCache = exports.getCacheEntry = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(7484));
|
const core = __importStar(__nccwpck_require__(7484));
|
||||||
const http_client_1 = __nccwpck_require__(4844);
|
const http_client_1 = __nccwpck_require__(4844);
|
||||||
const auth_1 = __nccwpck_require__(4552);
|
const auth_1 = __nccwpck_require__(4552);
|
||||||
const crypto = __importStar(__nccwpck_require__(6982));
|
|
||||||
const fs = __importStar(__nccwpck_require__(9896));
|
const fs = __importStar(__nccwpck_require__(9896));
|
||||||
const url_1 = __nccwpck_require__(7016);
|
const url_1 = __nccwpck_require__(7016);
|
||||||
const utils = __importStar(__nccwpck_require__(680));
|
const utils = __importStar(__nccwpck_require__(680));
|
||||||
|
const uploadUtils_1 = __nccwpck_require__(5268);
|
||||||
const downloadUtils_1 = __nccwpck_require__(5067);
|
const downloadUtils_1 = __nccwpck_require__(5067);
|
||||||
const options_1 = __nccwpck_require__(8356);
|
const options_1 = __nccwpck_require__(8356);
|
||||||
const requestUtils_1 = __nccwpck_require__(2846);
|
const requestUtils_1 = __nccwpck_require__(2846);
|
||||||
const versionSalt = '1.0';
|
const config_1 = __nccwpck_require__(7606);
|
||||||
|
const user_agent_1 = __nccwpck_require__(1899);
|
||||||
function getCacheApiUrl(resource) {
|
function getCacheApiUrl(resource) {
|
||||||
const baseUrl = process.env['ACTIONS_CACHE_URL'] || '';
|
const baseUrl = (0, config_1.getCacheServiceURL)();
|
||||||
if (!baseUrl) {
|
if (!baseUrl) {
|
||||||
throw new Error('Cache Service Url not found, unable to restore cache.');
|
throw new Error('Cache Service Url not found, unable to restore cache.');
|
||||||
}
|
}
|
||||||
@@ -316,29 +2275,12 @@ function getRequestOptions() {
|
|||||||
function createHttpClient() {
|
function createHttpClient() {
|
||||||
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
|
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
|
||||||
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
|
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
|
||||||
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
|
return new http_client_1.HttpClient((0, user_agent_1.getUserAgentString)(), [bearerCredentialHandler], getRequestOptions());
|
||||||
}
|
}
|
||||||
function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) {
|
|
||||||
// don't pass changes upstream
|
|
||||||
const components = paths.slice();
|
|
||||||
// Add compression method to cache version to restore
|
|
||||||
// compressed cache as per compression method
|
|
||||||
if (compressionMethod) {
|
|
||||||
components.push(compressionMethod);
|
|
||||||
}
|
|
||||||
// Only check for windows platforms if enableCrossOsArchive is false
|
|
||||||
if (process.platform === 'win32' && !enableCrossOsArchive) {
|
|
||||||
components.push('windows-only');
|
|
||||||
}
|
|
||||||
// Add salt to cache version to support breaking changes in cache entry
|
|
||||||
components.push(versionSalt);
|
|
||||||
return crypto.createHash('sha256').update(components.join('|')).digest('hex');
|
|
||||||
}
|
|
||||||
exports.getCacheVersion = getCacheVersion;
|
|
||||||
function getCacheEntry(keys, paths, options) {
|
function getCacheEntry(keys, paths, options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const httpClient = createHttpClient();
|
const httpClient = createHttpClient();
|
||||||
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive);
|
const version = utils.getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive);
|
||||||
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
|
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
|
||||||
const response = yield (0, requestUtils_1.retryTypedResponse)('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
|
const response = yield (0, requestUtils_1.retryTypedResponse)('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
|
||||||
// Cache not found
|
// Cache not found
|
||||||
@@ -409,7 +2351,7 @@ exports.downloadCache = downloadCache;
|
|||||||
function reserveCache(key, paths, options) {
|
function reserveCache(key, paths, options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const httpClient = createHttpClient();
|
const httpClient = createHttpClient();
|
||||||
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive);
|
const version = utils.getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive);
|
||||||
const reserveCacheRequest = {
|
const reserveCacheRequest = {
|
||||||
key,
|
key,
|
||||||
version,
|
version,
|
||||||
@@ -491,8 +2433,17 @@ function commitCache(httpClient, cacheId, filesize) {
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function saveCache(cacheId, archivePath, options) {
|
function saveCache(cacheId, archivePath, signedUploadURL, options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const uploadOptions = (0, options_1.getUploadOptions)(options);
|
||||||
|
if (uploadOptions.useAzureSdk) {
|
||||||
|
// Use Azure storage SDK to upload caches directly to Azure
|
||||||
|
if (!signedUploadURL) {
|
||||||
|
throw new Error('Azure Storage SDK can only be used when a signed URL is provided.');
|
||||||
|
}
|
||||||
|
yield (0, uploadUtils_1.uploadCacheArchiveSDK)(signedUploadURL, archivePath, options);
|
||||||
|
}
|
||||||
|
else {
|
||||||
const httpClient = createHttpClient();
|
const httpClient = createHttpClient();
|
||||||
core.debug('Upload cache');
|
core.debug('Upload cache');
|
||||||
yield uploadFile(httpClient, cacheId, archivePath, options);
|
yield uploadFile(httpClient, cacheId, archivePath, options);
|
||||||
@@ -505,6 +2456,7 @@ function saveCache(cacheId, archivePath, options) {
|
|||||||
throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
|
throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
|
||||||
}
|
}
|
||||||
core.info('Cache saved successfully');
|
core.info('Cache saved successfully');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.saveCache = saveCache;
|
exports.saveCache = saveCache;
|
||||||
@@ -557,7 +2509,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|||||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.isGhes = exports.assertDefined = exports.getGnuTarPathOnWindows = exports.getCacheFileName = exports.getCompressionMethod = exports.unlinkFile = exports.resolvePaths = exports.getArchiveFileSizeInBytes = exports.createTempDirectory = void 0;
|
exports.getRuntimeToken = exports.getCacheVersion = exports.assertDefined = exports.getGnuTarPathOnWindows = exports.getCacheFileName = exports.getCompressionMethod = exports.unlinkFile = exports.resolvePaths = exports.getArchiveFileSizeInBytes = exports.createTempDirectory = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(7484));
|
const core = __importStar(__nccwpck_require__(7484));
|
||||||
const exec = __importStar(__nccwpck_require__(5236));
|
const exec = __importStar(__nccwpck_require__(5236));
|
||||||
const glob = __importStar(__nccwpck_require__(9688));
|
const glob = __importStar(__nccwpck_require__(9688));
|
||||||
@@ -568,6 +2520,7 @@ const path = __importStar(__nccwpck_require__(6928));
|
|||||||
const semver = __importStar(__nccwpck_require__(9318));
|
const semver = __importStar(__nccwpck_require__(9318));
|
||||||
const util = __importStar(__nccwpck_require__(9023));
|
const util = __importStar(__nccwpck_require__(9023));
|
||||||
const constants_1 = __nccwpck_require__(8287);
|
const constants_1 = __nccwpck_require__(8287);
|
||||||
|
const versionSalt = '1.0';
|
||||||
// From https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L23
|
// From https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L23
|
||||||
function createTempDirectory() {
|
function createTempDirectory() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
@@ -705,15 +2658,76 @@ function assertDefined(name, value) {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
exports.assertDefined = assertDefined;
|
exports.assertDefined = assertDefined;
|
||||||
|
function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) {
|
||||||
|
// don't pass changes upstream
|
||||||
|
const components = paths.slice();
|
||||||
|
// Add compression method to cache version to restore
|
||||||
|
// compressed cache as per compression method
|
||||||
|
if (compressionMethod) {
|
||||||
|
components.push(compressionMethod);
|
||||||
|
}
|
||||||
|
// Only check for windows platforms if enableCrossOsArchive is false
|
||||||
|
if (process.platform === 'win32' && !enableCrossOsArchive) {
|
||||||
|
components.push('windows-only');
|
||||||
|
}
|
||||||
|
// Add salt to cache version to support breaking changes in cache entry
|
||||||
|
components.push(versionSalt);
|
||||||
|
return crypto.createHash('sha256').update(components.join('|')).digest('hex');
|
||||||
|
}
|
||||||
|
exports.getCacheVersion = getCacheVersion;
|
||||||
|
function getRuntimeToken() {
|
||||||
|
const token = process.env['ACTIONS_RUNTIME_TOKEN'];
|
||||||
|
if (!token) {
|
||||||
|
throw new Error('Unable to get the ACTIONS_RUNTIME_TOKEN env variable');
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
exports.getRuntimeToken = getRuntimeToken;
|
||||||
|
//# sourceMappingURL=cacheUtils.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 7606:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.getCacheServiceURL = exports.getCacheServiceVersion = exports.isGhes = void 0;
|
||||||
function isGhes() {
|
function isGhes() {
|
||||||
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
||||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||||
const isGitHubHost = hostname === 'GITHUB.COM';
|
const isGitHubHost = hostname === 'GITHUB.COM';
|
||||||
const isGheHost = hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST');
|
const isGheHost = hostname.endsWith('.GHE.COM');
|
||||||
return !isGitHubHost && !isGheHost;
|
const isLocalHost = hostname.endsWith('.LOCALHOST');
|
||||||
|
return !isGitHubHost && !isGheHost && !isLocalHost;
|
||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
//# sourceMappingURL=cacheUtils.js.map
|
function getCacheServiceVersion() {
|
||||||
|
// Cache service v2 is not supported on GHES. We will default to
|
||||||
|
// cache service v1 even if the feature flag was enabled by user.
|
||||||
|
if (isGhes())
|
||||||
|
return 'v1';
|
||||||
|
return process.env['ACTIONS_CACHE_SERVICE_V2'] ? 'v2' : 'v1';
|
||||||
|
}
|
||||||
|
exports.getCacheServiceVersion = getCacheServiceVersion;
|
||||||
|
function getCacheServiceURL() {
|
||||||
|
const version = getCacheServiceVersion();
|
||||||
|
// Based on the version of the cache service, we will determine which
|
||||||
|
// URL to use.
|
||||||
|
switch (version) {
|
||||||
|
case 'v1':
|
||||||
|
return (process.env['ACTIONS_CACHE_URL'] ||
|
||||||
|
process.env['ACTIONS_RESULTS_URL'] ||
|
||||||
|
'');
|
||||||
|
case 'v2':
|
||||||
|
return process.env['ACTIONS_RESULTS_URL'] || '';
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported cache service version: ${version}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.getCacheServiceURL = getCacheServiceURL;
|
||||||
|
//# sourceMappingURL=config.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
@@ -723,7 +2737,7 @@ exports.isGhes = isGhes;
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.ManifestFilename = exports.TarFilename = exports.SystemTarPathOnWindows = exports.GnuTarPathOnWindows = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.ArchiveToolType = exports.CompressionMethod = exports.CacheFilename = void 0;
|
exports.CacheFileSizeLimit = exports.ManifestFilename = exports.TarFilename = exports.SystemTarPathOnWindows = exports.GnuTarPathOnWindows = exports.SocketTimeout = exports.DefaultRetryDelay = exports.DefaultRetryAttempts = exports.ArchiveToolType = exports.CompressionMethod = exports.CacheFilename = void 0;
|
||||||
var CacheFilename;
|
var CacheFilename;
|
||||||
(function (CacheFilename) {
|
(function (CacheFilename) {
|
||||||
CacheFilename["Gzip"] = "cache.tgz";
|
CacheFilename["Gzip"] = "cache.tgz";
|
||||||
@@ -756,6 +2770,7 @@ exports.GnuTarPathOnWindows = `${process.env['PROGRAMFILES']}\\Git\\usr\\bin\\ta
|
|||||||
exports.SystemTarPathOnWindows = `${process.env['SYSTEMDRIVE']}\\Windows\\System32\\tar.exe`;
|
exports.SystemTarPathOnWindows = `${process.env['SYSTEMDRIVE']}\\Windows\\System32\\tar.exe`;
|
||||||
exports.TarFilename = 'cache.tar';
|
exports.TarFilename = 'cache.tar';
|
||||||
exports.ManifestFilename = 'manifest.txt';
|
exports.ManifestFilename = 'manifest.txt';
|
||||||
|
exports.CacheFileSizeLimit = 10 * Math.pow(1024, 3); // 10GiB per repository
|
||||||
//# sourceMappingURL=constants.js.map
|
//# sourceMappingURL=constants.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@@ -1289,6 +3304,270 @@ exports.retryHttpClientResponse = retryHttpClientResponse;
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 6819:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.internalCacheTwirpClient = void 0;
|
||||||
|
const core_1 = __nccwpck_require__(7484);
|
||||||
|
const user_agent_1 = __nccwpck_require__(1899);
|
||||||
|
const errors_1 = __nccwpck_require__(263);
|
||||||
|
const config_1 = __nccwpck_require__(7606);
|
||||||
|
const cacheUtils_1 = __nccwpck_require__(680);
|
||||||
|
const auth_1 = __nccwpck_require__(4552);
|
||||||
|
const http_client_1 = __nccwpck_require__(4844);
|
||||||
|
const cache_twirp_1 = __nccwpck_require__(564);
|
||||||
|
/**
|
||||||
|
* This class is a wrapper around the CacheServiceClientJSON class generated by Twirp.
|
||||||
|
*
|
||||||
|
* It adds retry logic to the request method, which is not present in the generated client.
|
||||||
|
*
|
||||||
|
* This class is used to interact with cache service v2.
|
||||||
|
*/
|
||||||
|
class CacheServiceClient {
|
||||||
|
constructor(userAgent, maxAttempts, baseRetryIntervalMilliseconds, retryMultiplier) {
|
||||||
|
this.maxAttempts = 5;
|
||||||
|
this.baseRetryIntervalMilliseconds = 3000;
|
||||||
|
this.retryMultiplier = 1.5;
|
||||||
|
const token = (0, cacheUtils_1.getRuntimeToken)();
|
||||||
|
this.baseUrl = (0, config_1.getCacheServiceURL)();
|
||||||
|
if (maxAttempts) {
|
||||||
|
this.maxAttempts = maxAttempts;
|
||||||
|
}
|
||||||
|
if (baseRetryIntervalMilliseconds) {
|
||||||
|
this.baseRetryIntervalMilliseconds = baseRetryIntervalMilliseconds;
|
||||||
|
}
|
||||||
|
if (retryMultiplier) {
|
||||||
|
this.retryMultiplier = retryMultiplier;
|
||||||
|
}
|
||||||
|
this.httpClient = new http_client_1.HttpClient(userAgent, [
|
||||||
|
new auth_1.BearerCredentialHandler(token)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
// This function satisfies the Rpc interface. It is compatible with the JSON
|
||||||
|
// JSON generated client.
|
||||||
|
request(service, method, contentType, data) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const url = new URL(`/twirp/${service}/${method}`, this.baseUrl).href;
|
||||||
|
(0, core_1.debug)(`[Request] ${method} ${url}`);
|
||||||
|
const headers = {
|
||||||
|
'Content-Type': contentType
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const { body } = yield this.retryableRequest(() => __awaiter(this, void 0, void 0, function* () { return this.httpClient.post(url, JSON.stringify(data), headers); }));
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
throw new Error(`Failed to ${method}: ${error.message}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
retryableRequest(operation) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let attempt = 0;
|
||||||
|
let errorMessage = '';
|
||||||
|
let rawBody = '';
|
||||||
|
while (attempt < this.maxAttempts) {
|
||||||
|
let isRetryable = false;
|
||||||
|
try {
|
||||||
|
const response = yield operation();
|
||||||
|
const statusCode = response.message.statusCode;
|
||||||
|
rawBody = yield response.readBody();
|
||||||
|
(0, core_1.debug)(`[Response] - ${response.message.statusCode}`);
|
||||||
|
(0, core_1.debug)(`Headers: ${JSON.stringify(response.message.headers, null, 2)}`);
|
||||||
|
const body = JSON.parse(rawBody);
|
||||||
|
(0, core_1.debug)(`Body: ${JSON.stringify(body, null, 2)}`);
|
||||||
|
if (this.isSuccessStatusCode(statusCode)) {
|
||||||
|
return { response, body };
|
||||||
|
}
|
||||||
|
isRetryable = this.isRetryableHttpStatusCode(statusCode);
|
||||||
|
errorMessage = `Failed request: (${statusCode}) ${response.message.statusMessage}`;
|
||||||
|
if (body.msg) {
|
||||||
|
if (errors_1.UsageError.isUsageErrorMessage(body.msg)) {
|
||||||
|
throw new errors_1.UsageError();
|
||||||
|
}
|
||||||
|
errorMessage = `${errorMessage}: ${body.msg}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
if (error instanceof SyntaxError) {
|
||||||
|
(0, core_1.debug)(`Raw Body: ${rawBody}`);
|
||||||
|
}
|
||||||
|
if (error instanceof errors_1.UsageError) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
if (errors_1.NetworkError.isNetworkErrorCode(error === null || error === void 0 ? void 0 : error.code)) {
|
||||||
|
throw new errors_1.NetworkError(error === null || error === void 0 ? void 0 : error.code);
|
||||||
|
}
|
||||||
|
isRetryable = true;
|
||||||
|
errorMessage = error.message;
|
||||||
|
}
|
||||||
|
if (!isRetryable) {
|
||||||
|
throw new Error(`Received non-retryable error: ${errorMessage}`);
|
||||||
|
}
|
||||||
|
if (attempt + 1 === this.maxAttempts) {
|
||||||
|
throw new Error(`Failed to make request after ${this.maxAttempts} attempts: ${errorMessage}`);
|
||||||
|
}
|
||||||
|
const retryTimeMilliseconds = this.getExponentialRetryTimeMilliseconds(attempt);
|
||||||
|
(0, core_1.info)(`Attempt ${attempt + 1} of ${this.maxAttempts} failed with error: ${errorMessage}. Retrying request in ${retryTimeMilliseconds} ms...`);
|
||||||
|
yield this.sleep(retryTimeMilliseconds);
|
||||||
|
attempt++;
|
||||||
|
}
|
||||||
|
throw new Error(`Request failed`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
isSuccessStatusCode(statusCode) {
|
||||||
|
if (!statusCode)
|
||||||
|
return false;
|
||||||
|
return statusCode >= 200 && statusCode < 300;
|
||||||
|
}
|
||||||
|
isRetryableHttpStatusCode(statusCode) {
|
||||||
|
if (!statusCode)
|
||||||
|
return false;
|
||||||
|
const retryableStatusCodes = [
|
||||||
|
http_client_1.HttpCodes.BadGateway,
|
||||||
|
http_client_1.HttpCodes.GatewayTimeout,
|
||||||
|
http_client_1.HttpCodes.InternalServerError,
|
||||||
|
http_client_1.HttpCodes.ServiceUnavailable,
|
||||||
|
http_client_1.HttpCodes.TooManyRequests
|
||||||
|
];
|
||||||
|
return retryableStatusCodes.includes(statusCode);
|
||||||
|
}
|
||||||
|
sleep(milliseconds) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, milliseconds));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getExponentialRetryTimeMilliseconds(attempt) {
|
||||||
|
if (attempt < 0) {
|
||||||
|
throw new Error('attempt should be a positive integer');
|
||||||
|
}
|
||||||
|
if (attempt === 0) {
|
||||||
|
return this.baseRetryIntervalMilliseconds;
|
||||||
|
}
|
||||||
|
const minTime = this.baseRetryIntervalMilliseconds * Math.pow(this.retryMultiplier, attempt);
|
||||||
|
const maxTime = minTime * this.retryMultiplier;
|
||||||
|
// returns a random number between minTime and maxTime (exclusive)
|
||||||
|
return Math.trunc(Math.random() * (maxTime - minTime) + minTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function internalCacheTwirpClient(options) {
|
||||||
|
const client = new CacheServiceClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier);
|
||||||
|
return new cache_twirp_1.CacheServiceClientJSON(client);
|
||||||
|
}
|
||||||
|
exports.internalCacheTwirpClient = internalCacheTwirpClient;
|
||||||
|
//# sourceMappingURL=cacheTwirpClient.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 263:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.UsageError = exports.NetworkError = exports.GHESNotSupportedError = exports.CacheNotFoundError = exports.InvalidResponseError = exports.FilesNotFoundError = void 0;
|
||||||
|
class FilesNotFoundError extends Error {
|
||||||
|
constructor(files = []) {
|
||||||
|
let message = 'No files were found to upload';
|
||||||
|
if (files.length > 0) {
|
||||||
|
message += `: ${files.join(', ')}`;
|
||||||
|
}
|
||||||
|
super(message);
|
||||||
|
this.files = files;
|
||||||
|
this.name = 'FilesNotFoundError';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.FilesNotFoundError = FilesNotFoundError;
|
||||||
|
class InvalidResponseError extends Error {
|
||||||
|
constructor(message) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'InvalidResponseError';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.InvalidResponseError = InvalidResponseError;
|
||||||
|
class CacheNotFoundError extends Error {
|
||||||
|
constructor(message = 'Cache not found') {
|
||||||
|
super(message);
|
||||||
|
this.name = 'CacheNotFoundError';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CacheNotFoundError = CacheNotFoundError;
|
||||||
|
class GHESNotSupportedError extends Error {
|
||||||
|
constructor(message = '@actions/cache v4.1.4+, actions/cache/save@v4+ and actions/cache/restore@v4+ are not currently supported on GHES.') {
|
||||||
|
super(message);
|
||||||
|
this.name = 'GHESNotSupportedError';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.GHESNotSupportedError = GHESNotSupportedError;
|
||||||
|
class NetworkError extends Error {
|
||||||
|
constructor(code) {
|
||||||
|
const message = `Unable to make request: ${code}\nIf you are using self-hosted runners, please make sure your runner has access to all GitHub endpoints: https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#communication-between-self-hosted-runners-and-github`;
|
||||||
|
super(message);
|
||||||
|
this.code = code;
|
||||||
|
this.name = 'NetworkError';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.NetworkError = NetworkError;
|
||||||
|
NetworkError.isNetworkErrorCode = (code) => {
|
||||||
|
if (!code)
|
||||||
|
return false;
|
||||||
|
return [
|
||||||
|
'ECONNRESET',
|
||||||
|
'ENOTFOUND',
|
||||||
|
'ETIMEDOUT',
|
||||||
|
'ECONNREFUSED',
|
||||||
|
'EHOSTUNREACH'
|
||||||
|
].includes(code);
|
||||||
|
};
|
||||||
|
class UsageError extends Error {
|
||||||
|
constructor() {
|
||||||
|
const message = `Cache storage quota has been hit. Unable to upload any new cache entries. Usage is recalculated every 6-12 hours.\nMore info on storage limits: https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#calculating-minute-and-storage-spending`;
|
||||||
|
super(message);
|
||||||
|
this.name = 'UsageError';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.UsageError = UsageError;
|
||||||
|
UsageError.isUsageErrorMessage = (msg) => {
|
||||||
|
if (!msg)
|
||||||
|
return false;
|
||||||
|
return msg.includes('insufficient usage');
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=errors.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 1899:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.getUserAgentString = void 0;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
|
||||||
|
const packageJson = __nccwpck_require__(4012);
|
||||||
|
/**
|
||||||
|
* Ensure that this User Agent String is used in all HTTP calls so that we can monitor telemetry between different versions of this package
|
||||||
|
*/
|
||||||
|
function getUserAgentString() {
|
||||||
|
return `@actions/cache-${packageJson.version}`;
|
||||||
|
}
|
||||||
|
exports.getUserAgentString = getUserAgentString;
|
||||||
|
//# sourceMappingURL=user-agent.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 5321:
|
/***/ 5321:
|
||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
@@ -1568,6 +3847,180 @@ exports.createTar = createTar;
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 5268:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.uploadCacheArchiveSDK = exports.UploadProgress = void 0;
|
||||||
|
const core = __importStar(__nccwpck_require__(7484));
|
||||||
|
const storage_blob_1 = __nccwpck_require__(1012);
|
||||||
|
const errors_1 = __nccwpck_require__(263);
|
||||||
|
/**
|
||||||
|
* Class for tracking the upload state and displaying stats.
|
||||||
|
*/
|
||||||
|
class UploadProgress {
|
||||||
|
constructor(contentLength) {
|
||||||
|
this.contentLength = contentLength;
|
||||||
|
this.sentBytes = 0;
|
||||||
|
this.displayedComplete = false;
|
||||||
|
this.startTime = Date.now();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Sets the number of bytes sent
|
||||||
|
*
|
||||||
|
* @param sentBytes the number of bytes sent
|
||||||
|
*/
|
||||||
|
setSentBytes(sentBytes) {
|
||||||
|
this.sentBytes = sentBytes;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the total number of bytes transferred.
|
||||||
|
*/
|
||||||
|
getTransferredBytes() {
|
||||||
|
return this.sentBytes;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns true if the upload is complete.
|
||||||
|
*/
|
||||||
|
isDone() {
|
||||||
|
return this.getTransferredBytes() === this.contentLength;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Prints the current upload stats. Once the upload completes, this will print one
|
||||||
|
* last line and then stop.
|
||||||
|
*/
|
||||||
|
display() {
|
||||||
|
if (this.displayedComplete) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const transferredBytes = this.sentBytes;
|
||||||
|
const percentage = (100 * (transferredBytes / this.contentLength)).toFixed(1);
|
||||||
|
const elapsedTime = Date.now() - this.startTime;
|
||||||
|
const uploadSpeed = (transferredBytes /
|
||||||
|
(1024 * 1024) /
|
||||||
|
(elapsedTime / 1000)).toFixed(1);
|
||||||
|
core.info(`Sent ${transferredBytes} of ${this.contentLength} (${percentage}%), ${uploadSpeed} MBs/sec`);
|
||||||
|
if (this.isDone()) {
|
||||||
|
this.displayedComplete = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns a function used to handle TransferProgressEvents.
|
||||||
|
*/
|
||||||
|
onProgress() {
|
||||||
|
return (progress) => {
|
||||||
|
this.setSentBytes(progress.loadedBytes);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Starts the timer that displays the stats.
|
||||||
|
*
|
||||||
|
* @param delayInMs the delay between each write
|
||||||
|
*/
|
||||||
|
startDisplayTimer(delayInMs = 1000) {
|
||||||
|
const displayCallback = () => {
|
||||||
|
this.display();
|
||||||
|
if (!this.isDone()) {
|
||||||
|
this.timeoutHandle = setTimeout(displayCallback, delayInMs);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.timeoutHandle = setTimeout(displayCallback, delayInMs);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Stops the timer that displays the stats. As this typically indicates the upload
|
||||||
|
* is complete, this will display one last line, unless the last line has already
|
||||||
|
* been written.
|
||||||
|
*/
|
||||||
|
stopDisplayTimer() {
|
||||||
|
if (this.timeoutHandle) {
|
||||||
|
clearTimeout(this.timeoutHandle);
|
||||||
|
this.timeoutHandle = undefined;
|
||||||
|
}
|
||||||
|
this.display();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.UploadProgress = UploadProgress;
|
||||||
|
/**
|
||||||
|
* Uploads a cache archive directly to Azure Blob Storage using the Azure SDK.
|
||||||
|
* This function will display progress information to the console. Concurrency of the
|
||||||
|
* upload is determined by the calling functions.
|
||||||
|
*
|
||||||
|
* @param signedUploadURL
|
||||||
|
* @param archivePath
|
||||||
|
* @param options
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function uploadCacheArchiveSDK(signedUploadURL, archivePath, options) {
|
||||||
|
var _a;
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
|
||||||
|
const blockBlobClient = blobClient.getBlockBlobClient();
|
||||||
|
const uploadProgress = new UploadProgress((_a = options === null || options === void 0 ? void 0 : options.archiveSizeBytes) !== null && _a !== void 0 ? _a : 0);
|
||||||
|
// Specify data transfer options
|
||||||
|
const uploadOptions = {
|
||||||
|
blockSize: options === null || options === void 0 ? void 0 : options.uploadChunkSize,
|
||||||
|
concurrency: options === null || options === void 0 ? void 0 : options.uploadConcurrency,
|
||||||
|
maxSingleShotSize: 128 * 1024 * 1024,
|
||||||
|
onProgress: uploadProgress.onProgress()
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
uploadProgress.startDisplayTimer();
|
||||||
|
core.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
|
||||||
|
const response = yield blockBlobClient.uploadFile(archivePath, uploadOptions);
|
||||||
|
// TODO: better management of non-retryable errors
|
||||||
|
if (response._response.status >= 400) {
|
||||||
|
throw new errors_1.InvalidResponseError(`uploadCacheArchiveSDK: upload failed with status code ${response._response.status}`);
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.warning(`uploadCacheArchiveSDK: internal error uploading cache archive: ${error.message}`);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
uploadProgress.stopDisplayTimer();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.uploadCacheArchiveSDK = uploadCacheArchiveSDK;
|
||||||
|
//# sourceMappingURL=uploadUtils.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 8356:
|
/***/ 8356:
|
||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
@@ -1605,11 +4058,16 @@ const core = __importStar(__nccwpck_require__(7484));
|
|||||||
* @param copy the original upload options
|
* @param copy the original upload options
|
||||||
*/
|
*/
|
||||||
function getUploadOptions(copy) {
|
function getUploadOptions(copy) {
|
||||||
|
// Defaults if not overriden
|
||||||
const result = {
|
const result = {
|
||||||
|
useAzureSdk: false,
|
||||||
uploadConcurrency: 4,
|
uploadConcurrency: 4,
|
||||||
uploadChunkSize: 32 * 1024 * 1024
|
uploadChunkSize: 32 * 1024 * 1024
|
||||||
};
|
};
|
||||||
if (copy) {
|
if (copy) {
|
||||||
|
if (typeof copy.useAzureSdk === 'boolean') {
|
||||||
|
result.useAzureSdk = copy.useAzureSdk;
|
||||||
|
}
|
||||||
if (typeof copy.uploadConcurrency === 'number') {
|
if (typeof copy.uploadConcurrency === 'number') {
|
||||||
result.uploadConcurrency = copy.uploadConcurrency;
|
result.uploadConcurrency = copy.uploadConcurrency;
|
||||||
}
|
}
|
||||||
@@ -1617,6 +4075,18 @@ function getUploadOptions(copy) {
|
|||||||
result.uploadChunkSize = copy.uploadChunkSize;
|
result.uploadChunkSize = copy.uploadChunkSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Add env var overrides
|
||||||
|
*/
|
||||||
|
// Cap the uploadConcurrency at 32
|
||||||
|
result.uploadConcurrency = !isNaN(Number(process.env['CACHE_UPLOAD_CONCURRENCY']))
|
||||||
|
? Math.min(32, Number(process.env['CACHE_UPLOAD_CONCURRENCY']))
|
||||||
|
: result.uploadConcurrency;
|
||||||
|
// Cap the uploadChunkSize at 128MiB
|
||||||
|
result.uploadChunkSize = !isNaN(Number(process.env['CACHE_UPLOAD_CHUNK_SIZE']))
|
||||||
|
? Math.min(128 * 1024 * 1024, Number(process.env['CACHE_UPLOAD_CHUNK_SIZE']) * 1024 * 1024)
|
||||||
|
: result.uploadChunkSize;
|
||||||
|
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
|
||||||
core.debug(`Upload concurrency: ${result.uploadConcurrency}`);
|
core.debug(`Upload concurrency: ${result.uploadConcurrency}`);
|
||||||
core.debug(`Upload chunk size: ${result.uploadChunkSize}`);
|
core.debug(`Upload chunk size: ${result.uploadChunkSize}`);
|
||||||
return result;
|
return result;
|
||||||
@@ -47196,6 +49666,4940 @@ exports.VERSION = void 0;
|
|||||||
exports.VERSION = '1.4.1';
|
exports.VERSION = '1.4.1';
|
||||||
//# sourceMappingURL=version.js.map
|
//# sourceMappingURL=version.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 7889:
|
||||||
|
/***/ (function(__unused_webpack_module, exports) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.ClientStreamingCall = void 0;
|
||||||
|
/**
|
||||||
|
* A client streaming RPC call. This means that the clients sends 0, 1, or
|
||||||
|
* more messages to the server, and the server replies with exactly one
|
||||||
|
* message.
|
||||||
|
*/
|
||||||
|
class ClientStreamingCall {
|
||||||
|
constructor(method, requestHeaders, request, headers, response, status, trailers) {
|
||||||
|
this.method = method;
|
||||||
|
this.requestHeaders = requestHeaders;
|
||||||
|
this.requests = request;
|
||||||
|
this.headers = headers;
|
||||||
|
this.response = response;
|
||||||
|
this.status = status;
|
||||||
|
this.trailers = trailers;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Instead of awaiting the response status and trailers, you can
|
||||||
|
* just as well await this call itself to receive the server outcome.
|
||||||
|
* Note that it may still be valid to send more request messages.
|
||||||
|
*/
|
||||||
|
then(onfulfilled, onrejected) {
|
||||||
|
return this.promiseFinished().then(value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value, reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
|
||||||
|
}
|
||||||
|
promiseFinished() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let [headers, response, status, trailers] = yield Promise.all([this.headers, this.response, this.status, this.trailers]);
|
||||||
|
return {
|
||||||
|
method: this.method,
|
||||||
|
requestHeaders: this.requestHeaders,
|
||||||
|
headers,
|
||||||
|
response,
|
||||||
|
status,
|
||||||
|
trailers
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ClientStreamingCall = ClientStreamingCall;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 1409:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.Deferred = exports.DeferredState = void 0;
|
||||||
|
var DeferredState;
|
||||||
|
(function (DeferredState) {
|
||||||
|
DeferredState[DeferredState["PENDING"] = 0] = "PENDING";
|
||||||
|
DeferredState[DeferredState["REJECTED"] = 1] = "REJECTED";
|
||||||
|
DeferredState[DeferredState["RESOLVED"] = 2] = "RESOLVED";
|
||||||
|
})(DeferredState = exports.DeferredState || (exports.DeferredState = {}));
|
||||||
|
/**
|
||||||
|
* A deferred promise. This is a "controller" for a promise, which lets you
|
||||||
|
* pass a promise around and reject or resolve it from the outside.
|
||||||
|
*
|
||||||
|
* Warning: This class is to be used with care. Using it can make code very
|
||||||
|
* difficult to read. It is intended for use in library code that exposes
|
||||||
|
* promises, not for regular business logic.
|
||||||
|
*/
|
||||||
|
class Deferred {
|
||||||
|
/**
|
||||||
|
* @param preventUnhandledRejectionWarning - prevents the warning
|
||||||
|
* "Unhandled Promise rejection" by adding a noop rejection handler.
|
||||||
|
* Working with calls returned from the runtime-rpc package in an
|
||||||
|
* async function usually means awaiting one call property after
|
||||||
|
* the other. This means that the "status" is not being awaited when
|
||||||
|
* an earlier await for the "headers" is rejected. This causes the
|
||||||
|
* "unhandled promise reject" warning. A more correct behaviour for
|
||||||
|
* calls might be to become aware whether at least one of the
|
||||||
|
* promises is handled and swallow the rejection warning for the
|
||||||
|
* others.
|
||||||
|
*/
|
||||||
|
constructor(preventUnhandledRejectionWarning = true) {
|
||||||
|
this._state = DeferredState.PENDING;
|
||||||
|
this._promise = new Promise((resolve, reject) => {
|
||||||
|
this._resolve = resolve;
|
||||||
|
this._reject = reject;
|
||||||
|
});
|
||||||
|
if (preventUnhandledRejectionWarning) {
|
||||||
|
this._promise.catch(_ => { });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get the current state of the promise.
|
||||||
|
*/
|
||||||
|
get state() {
|
||||||
|
return this._state;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get the deferred promise.
|
||||||
|
*/
|
||||||
|
get promise() {
|
||||||
|
return this._promise;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resolve the promise. Throws if the promise is already resolved or rejected.
|
||||||
|
*/
|
||||||
|
resolve(value) {
|
||||||
|
if (this.state !== DeferredState.PENDING)
|
||||||
|
throw new Error(`cannot resolve ${DeferredState[this.state].toLowerCase()}`);
|
||||||
|
this._resolve(value);
|
||||||
|
this._state = DeferredState.RESOLVED;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Reject the promise. Throws if the promise is already resolved or rejected.
|
||||||
|
*/
|
||||||
|
reject(reason) {
|
||||||
|
if (this.state !== DeferredState.PENDING)
|
||||||
|
throw new Error(`cannot reject ${DeferredState[this.state].toLowerCase()}`);
|
||||||
|
this._reject(reason);
|
||||||
|
this._state = DeferredState.REJECTED;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resolve the promise. Ignore if not pending.
|
||||||
|
*/
|
||||||
|
resolvePending(val) {
|
||||||
|
if (this._state === DeferredState.PENDING)
|
||||||
|
this.resolve(val);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Reject the promise. Ignore if not pending.
|
||||||
|
*/
|
||||||
|
rejectPending(reason) {
|
||||||
|
if (this._state === DeferredState.PENDING)
|
||||||
|
this.reject(reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Deferred = Deferred;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 6826:
|
||||||
|
/***/ (function(__unused_webpack_module, exports) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.DuplexStreamingCall = void 0;
|
||||||
|
/**
|
||||||
|
* A duplex streaming RPC call. This means that the clients sends an
|
||||||
|
* arbitrary amount of messages to the server, while at the same time,
|
||||||
|
* the server sends an arbitrary amount of messages to the client.
|
||||||
|
*/
|
||||||
|
class DuplexStreamingCall {
|
||||||
|
constructor(method, requestHeaders, request, headers, response, status, trailers) {
|
||||||
|
this.method = method;
|
||||||
|
this.requestHeaders = requestHeaders;
|
||||||
|
this.requests = request;
|
||||||
|
this.headers = headers;
|
||||||
|
this.responses = response;
|
||||||
|
this.status = status;
|
||||||
|
this.trailers = trailers;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Instead of awaiting the response status and trailers, you can
|
||||||
|
* just as well await this call itself to receive the server outcome.
|
||||||
|
* Note that it may still be valid to send more request messages.
|
||||||
|
*/
|
||||||
|
then(onfulfilled, onrejected) {
|
||||||
|
return this.promiseFinished().then(value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value, reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
|
||||||
|
}
|
||||||
|
promiseFinished() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let [headers, status, trailers] = yield Promise.all([this.headers, this.status, this.trailers]);
|
||||||
|
return {
|
||||||
|
method: this.method,
|
||||||
|
requestHeaders: this.requestHeaders,
|
||||||
|
headers,
|
||||||
|
status,
|
||||||
|
trailers,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.DuplexStreamingCall = DuplexStreamingCall;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 4420:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Public API of the rpc runtime.
|
||||||
|
// Note: we do not use `export * from ...` to help tree shakers,
|
||||||
|
// webpack verbose output hints that this should be useful
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
var service_type_1 = __nccwpck_require__(6892);
|
||||||
|
Object.defineProperty(exports, "ServiceType", ({ enumerable: true, get: function () { return service_type_1.ServiceType; } }));
|
||||||
|
var reflection_info_1 = __nccwpck_require__(2496);
|
||||||
|
Object.defineProperty(exports, "readMethodOptions", ({ enumerable: true, get: function () { return reflection_info_1.readMethodOptions; } }));
|
||||||
|
Object.defineProperty(exports, "readMethodOption", ({ enumerable: true, get: function () { return reflection_info_1.readMethodOption; } }));
|
||||||
|
Object.defineProperty(exports, "readServiceOption", ({ enumerable: true, get: function () { return reflection_info_1.readServiceOption; } }));
|
||||||
|
var rpc_error_1 = __nccwpck_require__(8636);
|
||||||
|
Object.defineProperty(exports, "RpcError", ({ enumerable: true, get: function () { return rpc_error_1.RpcError; } }));
|
||||||
|
var rpc_options_1 = __nccwpck_require__(8576);
|
||||||
|
Object.defineProperty(exports, "mergeRpcOptions", ({ enumerable: true, get: function () { return rpc_options_1.mergeRpcOptions; } }));
|
||||||
|
var rpc_output_stream_1 = __nccwpck_require__(2726);
|
||||||
|
Object.defineProperty(exports, "RpcOutputStreamController", ({ enumerable: true, get: function () { return rpc_output_stream_1.RpcOutputStreamController; } }));
|
||||||
|
var test_transport_1 = __nccwpck_require__(9122);
|
||||||
|
Object.defineProperty(exports, "TestTransport", ({ enumerable: true, get: function () { return test_transport_1.TestTransport; } }));
|
||||||
|
var deferred_1 = __nccwpck_require__(1409);
|
||||||
|
Object.defineProperty(exports, "Deferred", ({ enumerable: true, get: function () { return deferred_1.Deferred; } }));
|
||||||
|
Object.defineProperty(exports, "DeferredState", ({ enumerable: true, get: function () { return deferred_1.DeferredState; } }));
|
||||||
|
var duplex_streaming_call_1 = __nccwpck_require__(6826);
|
||||||
|
Object.defineProperty(exports, "DuplexStreamingCall", ({ enumerable: true, get: function () { return duplex_streaming_call_1.DuplexStreamingCall; } }));
|
||||||
|
var client_streaming_call_1 = __nccwpck_require__(7889);
|
||||||
|
Object.defineProperty(exports, "ClientStreamingCall", ({ enumerable: true, get: function () { return client_streaming_call_1.ClientStreamingCall; } }));
|
||||||
|
var server_streaming_call_1 = __nccwpck_require__(6173);
|
||||||
|
Object.defineProperty(exports, "ServerStreamingCall", ({ enumerable: true, get: function () { return server_streaming_call_1.ServerStreamingCall; } }));
|
||||||
|
var unary_call_1 = __nccwpck_require__(9288);
|
||||||
|
Object.defineProperty(exports, "UnaryCall", ({ enumerable: true, get: function () { return unary_call_1.UnaryCall; } }));
|
||||||
|
var rpc_interceptor_1 = __nccwpck_require__(2849);
|
||||||
|
Object.defineProperty(exports, "stackIntercept", ({ enumerable: true, get: function () { return rpc_interceptor_1.stackIntercept; } }));
|
||||||
|
Object.defineProperty(exports, "stackDuplexStreamingInterceptors", ({ enumerable: true, get: function () { return rpc_interceptor_1.stackDuplexStreamingInterceptors; } }));
|
||||||
|
Object.defineProperty(exports, "stackClientStreamingInterceptors", ({ enumerable: true, get: function () { return rpc_interceptor_1.stackClientStreamingInterceptors; } }));
|
||||||
|
Object.defineProperty(exports, "stackServerStreamingInterceptors", ({ enumerable: true, get: function () { return rpc_interceptor_1.stackServerStreamingInterceptors; } }));
|
||||||
|
Object.defineProperty(exports, "stackUnaryInterceptors", ({ enumerable: true, get: function () { return rpc_interceptor_1.stackUnaryInterceptors; } }));
|
||||||
|
var server_call_context_1 = __nccwpck_require__(3352);
|
||||||
|
Object.defineProperty(exports, "ServerCallContextController", ({ enumerable: true, get: function () { return server_call_context_1.ServerCallContextController; } }));
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 2496:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.readServiceOption = exports.readMethodOption = exports.readMethodOptions = exports.normalizeMethodInfo = void 0;
|
||||||
|
const runtime_1 = __nccwpck_require__(8886);
|
||||||
|
/**
|
||||||
|
* Turns PartialMethodInfo into MethodInfo.
|
||||||
|
*/
|
||||||
|
function normalizeMethodInfo(method, service) {
|
||||||
|
var _a, _b, _c;
|
||||||
|
let m = method;
|
||||||
|
m.service = service;
|
||||||
|
m.localName = (_a = m.localName) !== null && _a !== void 0 ? _a : runtime_1.lowerCamelCase(m.name);
|
||||||
|
// noinspection PointlessBooleanExpressionJS
|
||||||
|
m.serverStreaming = !!m.serverStreaming;
|
||||||
|
// noinspection PointlessBooleanExpressionJS
|
||||||
|
m.clientStreaming = !!m.clientStreaming;
|
||||||
|
m.options = (_b = m.options) !== null && _b !== void 0 ? _b : {};
|
||||||
|
m.idempotency = (_c = m.idempotency) !== null && _c !== void 0 ? _c : undefined;
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
exports.normalizeMethodInfo = normalizeMethodInfo;
|
||||||
|
/**
|
||||||
|
* Read custom method options from a generated service client.
|
||||||
|
*
|
||||||
|
* @deprecated use readMethodOption()
|
||||||
|
*/
|
||||||
|
function readMethodOptions(service, methodName, extensionName, extensionType) {
|
||||||
|
var _a;
|
||||||
|
const options = (_a = service.methods.find((m, i) => m.localName === methodName || i === methodName)) === null || _a === void 0 ? void 0 : _a.options;
|
||||||
|
return options && options[extensionName] ? extensionType.fromJson(options[extensionName]) : undefined;
|
||||||
|
}
|
||||||
|
exports.readMethodOptions = readMethodOptions;
|
||||||
|
function readMethodOption(service, methodName, extensionName, extensionType) {
|
||||||
|
var _a;
|
||||||
|
const options = (_a = service.methods.find((m, i) => m.localName === methodName || i === methodName)) === null || _a === void 0 ? void 0 : _a.options;
|
||||||
|
if (!options) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const optionVal = options[extensionName];
|
||||||
|
if (optionVal === undefined) {
|
||||||
|
return optionVal;
|
||||||
|
}
|
||||||
|
return extensionType ? extensionType.fromJson(optionVal) : optionVal;
|
||||||
|
}
|
||||||
|
exports.readMethodOption = readMethodOption;
|
||||||
|
function readServiceOption(service, extensionName, extensionType) {
|
||||||
|
const options = service.options;
|
||||||
|
if (!options) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const optionVal = options[extensionName];
|
||||||
|
if (optionVal === undefined) {
|
||||||
|
return optionVal;
|
||||||
|
}
|
||||||
|
return extensionType ? extensionType.fromJson(optionVal) : optionVal;
|
||||||
|
}
|
||||||
|
exports.readServiceOption = readServiceOption;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 8636:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.RpcError = void 0;
|
||||||
|
/**
|
||||||
|
* An error that occurred while calling a RPC method.
|
||||||
|
*/
|
||||||
|
class RpcError extends Error {
|
||||||
|
constructor(message, code = 'UNKNOWN', meta) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'RpcError';
|
||||||
|
// see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#example
|
||||||
|
Object.setPrototypeOf(this, new.target.prototype);
|
||||||
|
this.code = code;
|
||||||
|
this.meta = meta !== null && meta !== void 0 ? meta : {};
|
||||||
|
}
|
||||||
|
toString() {
|
||||||
|
const l = [this.name + ': ' + this.message];
|
||||||
|
if (this.code) {
|
||||||
|
l.push('');
|
||||||
|
l.push('Code: ' + this.code);
|
||||||
|
}
|
||||||
|
if (this.serviceName && this.methodName) {
|
||||||
|
l.push('Method: ' + this.serviceName + '/' + this.methodName);
|
||||||
|
}
|
||||||
|
let m = Object.entries(this.meta);
|
||||||
|
if (m.length) {
|
||||||
|
l.push('');
|
||||||
|
l.push('Meta:');
|
||||||
|
for (let [k, v] of m) {
|
||||||
|
l.push(` ${k}: ${v}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return l.join('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.RpcError = RpcError;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 2849:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.stackDuplexStreamingInterceptors = exports.stackClientStreamingInterceptors = exports.stackServerStreamingInterceptors = exports.stackUnaryInterceptors = exports.stackIntercept = void 0;
|
||||||
|
const runtime_1 = __nccwpck_require__(8886);
|
||||||
|
/**
|
||||||
|
* Creates a "stack" of of all interceptors specified in the given `RpcOptions`.
|
||||||
|
* Used by generated client implementations.
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
function stackIntercept(kind, transport, method, options, input) {
|
||||||
|
var _a, _b, _c, _d;
|
||||||
|
if (kind == "unary") {
|
||||||
|
let tail = (mtd, inp, opt) => transport.unary(mtd, inp, opt);
|
||||||
|
for (const curr of ((_a = options.interceptors) !== null && _a !== void 0 ? _a : []).filter(i => i.interceptUnary).reverse()) {
|
||||||
|
const next = tail;
|
||||||
|
tail = (mtd, inp, opt) => curr.interceptUnary(next, mtd, inp, opt);
|
||||||
|
}
|
||||||
|
return tail(method, input, options);
|
||||||
|
}
|
||||||
|
if (kind == "serverStreaming") {
|
||||||
|
let tail = (mtd, inp, opt) => transport.serverStreaming(mtd, inp, opt);
|
||||||
|
for (const curr of ((_b = options.interceptors) !== null && _b !== void 0 ? _b : []).filter(i => i.interceptServerStreaming).reverse()) {
|
||||||
|
const next = tail;
|
||||||
|
tail = (mtd, inp, opt) => curr.interceptServerStreaming(next, mtd, inp, opt);
|
||||||
|
}
|
||||||
|
return tail(method, input, options);
|
||||||
|
}
|
||||||
|
if (kind == "clientStreaming") {
|
||||||
|
let tail = (mtd, opt) => transport.clientStreaming(mtd, opt);
|
||||||
|
for (const curr of ((_c = options.interceptors) !== null && _c !== void 0 ? _c : []).filter(i => i.interceptClientStreaming).reverse()) {
|
||||||
|
const next = tail;
|
||||||
|
tail = (mtd, opt) => curr.interceptClientStreaming(next, mtd, opt);
|
||||||
|
}
|
||||||
|
return tail(method, options);
|
||||||
|
}
|
||||||
|
if (kind == "duplex") {
|
||||||
|
let tail = (mtd, opt) => transport.duplex(mtd, opt);
|
||||||
|
for (const curr of ((_d = options.interceptors) !== null && _d !== void 0 ? _d : []).filter(i => i.interceptDuplex).reverse()) {
|
||||||
|
const next = tail;
|
||||||
|
tail = (mtd, opt) => curr.interceptDuplex(next, mtd, opt);
|
||||||
|
}
|
||||||
|
return tail(method, options);
|
||||||
|
}
|
||||||
|
runtime_1.assertNever(kind);
|
||||||
|
}
|
||||||
|
exports.stackIntercept = stackIntercept;
|
||||||
|
/**
|
||||||
|
* @deprecated replaced by `stackIntercept()`, still here to support older generated code
|
||||||
|
*/
|
||||||
|
function stackUnaryInterceptors(transport, method, input, options) {
|
||||||
|
return stackIntercept("unary", transport, method, options, input);
|
||||||
|
}
|
||||||
|
exports.stackUnaryInterceptors = stackUnaryInterceptors;
|
||||||
|
/**
|
||||||
|
* @deprecated replaced by `stackIntercept()`, still here to support older generated code
|
||||||
|
*/
|
||||||
|
function stackServerStreamingInterceptors(transport, method, input, options) {
|
||||||
|
return stackIntercept("serverStreaming", transport, method, options, input);
|
||||||
|
}
|
||||||
|
exports.stackServerStreamingInterceptors = stackServerStreamingInterceptors;
|
||||||
|
/**
|
||||||
|
* @deprecated replaced by `stackIntercept()`, still here to support older generated code
|
||||||
|
*/
|
||||||
|
function stackClientStreamingInterceptors(transport, method, options) {
|
||||||
|
return stackIntercept("clientStreaming", transport, method, options);
|
||||||
|
}
|
||||||
|
exports.stackClientStreamingInterceptors = stackClientStreamingInterceptors;
|
||||||
|
/**
|
||||||
|
* @deprecated replaced by `stackIntercept()`, still here to support older generated code
|
||||||
|
*/
|
||||||
|
function stackDuplexStreamingInterceptors(transport, method, options) {
|
||||||
|
return stackIntercept("duplex", transport, method, options);
|
||||||
|
}
|
||||||
|
exports.stackDuplexStreamingInterceptors = stackDuplexStreamingInterceptors;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 8576:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.mergeRpcOptions = void 0;
|
||||||
|
const runtime_1 = __nccwpck_require__(8886);
|
||||||
|
/**
|
||||||
|
* Merges custom RPC options with defaults. Returns a new instance and keeps
|
||||||
|
* the "defaults" and the "options" unmodified.
|
||||||
|
*
|
||||||
|
* Merges `RpcMetadata` "meta", overwriting values from "defaults" with
|
||||||
|
* values from "options". Does not append values to existing entries.
|
||||||
|
*
|
||||||
|
* Merges "jsonOptions", including "jsonOptions.typeRegistry", by creating
|
||||||
|
* a new array that contains types from "options.jsonOptions.typeRegistry"
|
||||||
|
* first, then types from "defaults.jsonOptions.typeRegistry".
|
||||||
|
*
|
||||||
|
* Merges "binaryOptions".
|
||||||
|
*
|
||||||
|
* Merges "interceptors" by creating a new array that contains interceptors
|
||||||
|
* from "defaults" first, then interceptors from "options".
|
||||||
|
*
|
||||||
|
* Works with objects that extend `RpcOptions`, but only if the added
|
||||||
|
* properties are of type Date, primitive like string, boolean, or Array
|
||||||
|
* of primitives. If you have other property types, you have to merge them
|
||||||
|
* yourself.
|
||||||
|
*/
|
||||||
|
function mergeRpcOptions(defaults, options) {
|
||||||
|
if (!options)
|
||||||
|
return defaults;
|
||||||
|
let o = {};
|
||||||
|
copy(defaults, o);
|
||||||
|
copy(options, o);
|
||||||
|
for (let key of Object.keys(options)) {
|
||||||
|
let val = options[key];
|
||||||
|
switch (key) {
|
||||||
|
case "jsonOptions":
|
||||||
|
o.jsonOptions = runtime_1.mergeJsonOptions(defaults.jsonOptions, o.jsonOptions);
|
||||||
|
break;
|
||||||
|
case "binaryOptions":
|
||||||
|
o.binaryOptions = runtime_1.mergeBinaryOptions(defaults.binaryOptions, o.binaryOptions);
|
||||||
|
break;
|
||||||
|
case "meta":
|
||||||
|
o.meta = {};
|
||||||
|
copy(defaults.meta, o.meta);
|
||||||
|
copy(options.meta, o.meta);
|
||||||
|
break;
|
||||||
|
case "interceptors":
|
||||||
|
o.interceptors = defaults.interceptors ? defaults.interceptors.concat(val) : val.concat();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
exports.mergeRpcOptions = mergeRpcOptions;
|
||||||
|
function copy(a, into) {
|
||||||
|
if (!a)
|
||||||
|
return;
|
||||||
|
let c = into;
|
||||||
|
for (let [k, v] of Object.entries(a)) {
|
||||||
|
if (v instanceof Date)
|
||||||
|
c[k] = new Date(v.getTime());
|
||||||
|
else if (Array.isArray(v))
|
||||||
|
c[k] = v.concat();
|
||||||
|
else
|
||||||
|
c[k] = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 2726:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.RpcOutputStreamController = void 0;
|
||||||
|
const deferred_1 = __nccwpck_require__(1409);
|
||||||
|
const runtime_1 = __nccwpck_require__(8886);
|
||||||
|
/**
|
||||||
|
* A `RpcOutputStream` that you control.
|
||||||
|
*/
|
||||||
|
class RpcOutputStreamController {
|
||||||
|
constructor() {
|
||||||
|
this._lis = {
|
||||||
|
nxt: [],
|
||||||
|
msg: [],
|
||||||
|
err: [],
|
||||||
|
cmp: [],
|
||||||
|
};
|
||||||
|
this._closed = false;
|
||||||
|
}
|
||||||
|
// --- RpcOutputStream callback API
|
||||||
|
onNext(callback) {
|
||||||
|
return this.addLis(callback, this._lis.nxt);
|
||||||
|
}
|
||||||
|
onMessage(callback) {
|
||||||
|
return this.addLis(callback, this._lis.msg);
|
||||||
|
}
|
||||||
|
onError(callback) {
|
||||||
|
return this.addLis(callback, this._lis.err);
|
||||||
|
}
|
||||||
|
onComplete(callback) {
|
||||||
|
return this.addLis(callback, this._lis.cmp);
|
||||||
|
}
|
||||||
|
addLis(callback, list) {
|
||||||
|
list.push(callback);
|
||||||
|
return () => {
|
||||||
|
let i = list.indexOf(callback);
|
||||||
|
if (i >= 0)
|
||||||
|
list.splice(i, 1);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// remove all listeners
|
||||||
|
clearLis() {
|
||||||
|
for (let l of Object.values(this._lis))
|
||||||
|
l.splice(0, l.length);
|
||||||
|
}
|
||||||
|
// --- Controller API
|
||||||
|
/**
|
||||||
|
* Is this stream already closed by a completion or error?
|
||||||
|
*/
|
||||||
|
get closed() {
|
||||||
|
return this._closed !== false;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Emit message, close with error, or close successfully, but only one
|
||||||
|
* at a time.
|
||||||
|
* Can be used to wrap a stream by using the other stream's `onNext`.
|
||||||
|
*/
|
||||||
|
notifyNext(message, error, complete) {
|
||||||
|
runtime_1.assert((message ? 1 : 0) + (error ? 1 : 0) + (complete ? 1 : 0) <= 1, 'only one emission at a time');
|
||||||
|
if (message)
|
||||||
|
this.notifyMessage(message);
|
||||||
|
if (error)
|
||||||
|
this.notifyError(error);
|
||||||
|
if (complete)
|
||||||
|
this.notifyComplete();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Emits a new message. Throws if stream is closed.
|
||||||
|
*
|
||||||
|
* Triggers onNext and onMessage callbacks.
|
||||||
|
*/
|
||||||
|
notifyMessage(message) {
|
||||||
|
runtime_1.assert(!this.closed, 'stream is closed');
|
||||||
|
this.pushIt({ value: message, done: false });
|
||||||
|
this._lis.msg.forEach(l => l(message));
|
||||||
|
this._lis.nxt.forEach(l => l(message, undefined, false));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Closes the stream with an error. Throws if stream is closed.
|
||||||
|
*
|
||||||
|
* Triggers onNext and onError callbacks.
|
||||||
|
*/
|
||||||
|
notifyError(error) {
|
||||||
|
runtime_1.assert(!this.closed, 'stream is closed');
|
||||||
|
this._closed = error;
|
||||||
|
this.pushIt(error);
|
||||||
|
this._lis.err.forEach(l => l(error));
|
||||||
|
this._lis.nxt.forEach(l => l(undefined, error, false));
|
||||||
|
this.clearLis();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Closes the stream successfully. Throws if stream is closed.
|
||||||
|
*
|
||||||
|
* Triggers onNext and onComplete callbacks.
|
||||||
|
*/
|
||||||
|
notifyComplete() {
|
||||||
|
runtime_1.assert(!this.closed, 'stream is closed');
|
||||||
|
this._closed = true;
|
||||||
|
this.pushIt({ value: null, done: true });
|
||||||
|
this._lis.cmp.forEach(l => l());
|
||||||
|
this._lis.nxt.forEach(l => l(undefined, undefined, true));
|
||||||
|
this.clearLis();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Creates an async iterator (that can be used with `for await {...}`)
|
||||||
|
* to consume the stream.
|
||||||
|
*
|
||||||
|
* Some things to note:
|
||||||
|
* - If an error occurs, the `for await` will throw it.
|
||||||
|
* - If an error occurred before the `for await` was started, `for await`
|
||||||
|
* will re-throw it.
|
||||||
|
* - If the stream is already complete, the `for await` will be empty.
|
||||||
|
* - If your `for await` consumes slower than the stream produces,
|
||||||
|
* for example because you are relaying messages in a slow operation,
|
||||||
|
* messages are queued.
|
||||||
|
*/
|
||||||
|
[Symbol.asyncIterator]() {
|
||||||
|
// init the iterator state, enabling pushIt()
|
||||||
|
if (!this._itState) {
|
||||||
|
this._itState = { q: [] };
|
||||||
|
}
|
||||||
|
// if we are closed, we are definitely not receiving any more messages.
|
||||||
|
// but we can't let the iterator get stuck. we want to either:
|
||||||
|
// a) finish the new iterator immediately, because we are completed
|
||||||
|
// b) reject the new iterator, because we errored
|
||||||
|
if (this._closed === true)
|
||||||
|
this.pushIt({ value: null, done: true });
|
||||||
|
else if (this._closed !== false)
|
||||||
|
this.pushIt(this._closed);
|
||||||
|
// the async iterator
|
||||||
|
return {
|
||||||
|
next: () => {
|
||||||
|
let state = this._itState;
|
||||||
|
runtime_1.assert(state, "bad state"); // if we don't have a state here, code is broken
|
||||||
|
// there should be no pending result.
|
||||||
|
// did the consumer call next() before we resolved our previous result promise?
|
||||||
|
runtime_1.assert(!state.p, "iterator contract broken");
|
||||||
|
// did we produce faster than the iterator consumed?
|
||||||
|
// return the oldest result from the queue.
|
||||||
|
let first = state.q.shift();
|
||||||
|
if (first)
|
||||||
|
return ("value" in first) ? Promise.resolve(first) : Promise.reject(first);
|
||||||
|
// we have no result ATM, but we promise one.
|
||||||
|
// as soon as we have a result, we must resolve promise.
|
||||||
|
state.p = new deferred_1.Deferred();
|
||||||
|
return state.p.promise;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// "push" a new iterator result.
|
||||||
|
// this either resolves a pending promise, or enqueues the result.
|
||||||
|
pushIt(result) {
|
||||||
|
let state = this._itState;
|
||||||
|
if (!state)
|
||||||
|
return;
|
||||||
|
// is the consumer waiting for us?
|
||||||
|
if (state.p) {
|
||||||
|
// yes, consumer is waiting for this promise.
|
||||||
|
const p = state.p;
|
||||||
|
runtime_1.assert(p.state == deferred_1.DeferredState.PENDING, "iterator contract broken");
|
||||||
|
// resolve the promise
|
||||||
|
("value" in result) ? p.resolve(result) : p.reject(result);
|
||||||
|
// must cleanup, otherwise iterator.next() would pick it up again.
|
||||||
|
delete state.p;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// we are producing faster than the iterator consumes.
|
||||||
|
// push result onto queue.
|
||||||
|
state.q.push(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.RpcOutputStreamController = RpcOutputStreamController;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 3352:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.ServerCallContextController = void 0;
|
||||||
|
class ServerCallContextController {
|
||||||
|
constructor(method, headers, deadline, sendResponseHeadersFn, defaultStatus = { code: 'OK', detail: '' }) {
|
||||||
|
this._cancelled = false;
|
||||||
|
this._listeners = [];
|
||||||
|
this.method = method;
|
||||||
|
this.headers = headers;
|
||||||
|
this.deadline = deadline;
|
||||||
|
this.trailers = {};
|
||||||
|
this._sendRH = sendResponseHeadersFn;
|
||||||
|
this.status = defaultStatus;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Set the call cancelled.
|
||||||
|
*
|
||||||
|
* Invokes all callbacks registered with onCancel() and
|
||||||
|
* sets `cancelled = true`.
|
||||||
|
*/
|
||||||
|
notifyCancelled() {
|
||||||
|
if (!this._cancelled) {
|
||||||
|
this._cancelled = true;
|
||||||
|
for (let l of this._listeners) {
|
||||||
|
l();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Send response headers.
|
||||||
|
*/
|
||||||
|
sendResponseHeaders(data) {
|
||||||
|
this._sendRH(data);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Is the call cancelled?
|
||||||
|
*
|
||||||
|
* When the client closes the connection before the server
|
||||||
|
* is done, the call is cancelled.
|
||||||
|
*
|
||||||
|
* If you want to cancel a request on the server, throw a
|
||||||
|
* RpcError with the CANCELLED status code.
|
||||||
|
*/
|
||||||
|
get cancelled() {
|
||||||
|
return this._cancelled;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Add a callback for cancellation.
|
||||||
|
*/
|
||||||
|
onCancel(callback) {
|
||||||
|
const l = this._listeners;
|
||||||
|
l.push(callback);
|
||||||
|
return () => {
|
||||||
|
let i = l.indexOf(callback);
|
||||||
|
if (i >= 0)
|
||||||
|
l.splice(i, 1);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ServerCallContextController = ServerCallContextController;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 6173:
|
||||||
|
/***/ (function(__unused_webpack_module, exports) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.ServerStreamingCall = void 0;
|
||||||
|
/**
|
||||||
|
* A server streaming RPC call. The client provides exactly one input message
|
||||||
|
* but the server may respond with 0, 1, or more messages.
|
||||||
|
*/
|
||||||
|
class ServerStreamingCall {
|
||||||
|
constructor(method, requestHeaders, request, headers, response, status, trailers) {
|
||||||
|
this.method = method;
|
||||||
|
this.requestHeaders = requestHeaders;
|
||||||
|
this.request = request;
|
||||||
|
this.headers = headers;
|
||||||
|
this.responses = response;
|
||||||
|
this.status = status;
|
||||||
|
this.trailers = trailers;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Instead of awaiting the response status and trailers, you can
|
||||||
|
* just as well await this call itself to receive the server outcome.
|
||||||
|
* You should first setup some listeners to the `request` to
|
||||||
|
* see the actual messages the server replied with.
|
||||||
|
*/
|
||||||
|
then(onfulfilled, onrejected) {
|
||||||
|
return this.promiseFinished().then(value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value, reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
|
||||||
|
}
|
||||||
|
promiseFinished() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let [headers, status, trailers] = yield Promise.all([this.headers, this.status, this.trailers]);
|
||||||
|
return {
|
||||||
|
method: this.method,
|
||||||
|
requestHeaders: this.requestHeaders,
|
||||||
|
request: this.request,
|
||||||
|
headers,
|
||||||
|
status,
|
||||||
|
trailers,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ServerStreamingCall = ServerStreamingCall;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 6892:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.ServiceType = void 0;
|
||||||
|
const reflection_info_1 = __nccwpck_require__(2496);
|
||||||
|
class ServiceType {
|
||||||
|
constructor(typeName, methods, options) {
|
||||||
|
this.typeName = typeName;
|
||||||
|
this.methods = methods.map(i => reflection_info_1.normalizeMethodInfo(i, this));
|
||||||
|
this.options = options !== null && options !== void 0 ? options : {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ServiceType = ServiceType;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 9122:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.TestTransport = void 0;
|
||||||
|
const rpc_error_1 = __nccwpck_require__(8636);
|
||||||
|
const runtime_1 = __nccwpck_require__(8886);
|
||||||
|
const rpc_output_stream_1 = __nccwpck_require__(2726);
|
||||||
|
const rpc_options_1 = __nccwpck_require__(8576);
|
||||||
|
const unary_call_1 = __nccwpck_require__(9288);
|
||||||
|
const server_streaming_call_1 = __nccwpck_require__(6173);
|
||||||
|
const client_streaming_call_1 = __nccwpck_require__(7889);
|
||||||
|
const duplex_streaming_call_1 = __nccwpck_require__(6826);
|
||||||
|
/**
|
||||||
|
* Transport for testing.
|
||||||
|
*/
|
||||||
|
class TestTransport {
|
||||||
|
/**
|
||||||
|
* Initialize with mock data. Omitted fields have default value.
|
||||||
|
*/
|
||||||
|
constructor(data) {
|
||||||
|
/**
|
||||||
|
* Suppress warning / error about uncaught rejections of
|
||||||
|
* "status" and "trailers".
|
||||||
|
*/
|
||||||
|
this.suppressUncaughtRejections = true;
|
||||||
|
this.headerDelay = 10;
|
||||||
|
this.responseDelay = 50;
|
||||||
|
this.betweenResponseDelay = 10;
|
||||||
|
this.afterResponseDelay = 10;
|
||||||
|
this.data = data !== null && data !== void 0 ? data : {};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Sent message(s) during the last operation.
|
||||||
|
*/
|
||||||
|
get sentMessages() {
|
||||||
|
if (this.lastInput instanceof TestInputStream) {
|
||||||
|
return this.lastInput.sent;
|
||||||
|
}
|
||||||
|
else if (typeof this.lastInput == "object") {
|
||||||
|
return [this.lastInput.single];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Sending message(s) completed?
|
||||||
|
*/
|
||||||
|
get sendComplete() {
|
||||||
|
if (this.lastInput instanceof TestInputStream) {
|
||||||
|
return this.lastInput.completed;
|
||||||
|
}
|
||||||
|
else if (typeof this.lastInput == "object") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Creates a promise for response headers from the mock data.
|
||||||
|
promiseHeaders() {
|
||||||
|
var _a;
|
||||||
|
const headers = (_a = this.data.headers) !== null && _a !== void 0 ? _a : TestTransport.defaultHeaders;
|
||||||
|
return headers instanceof rpc_error_1.RpcError
|
||||||
|
? Promise.reject(headers)
|
||||||
|
: Promise.resolve(headers);
|
||||||
|
}
|
||||||
|
// Creates a promise for a single, valid, message from the mock data.
|
||||||
|
promiseSingleResponse(method) {
|
||||||
|
if (this.data.response instanceof rpc_error_1.RpcError) {
|
||||||
|
return Promise.reject(this.data.response);
|
||||||
|
}
|
||||||
|
let r;
|
||||||
|
if (Array.isArray(this.data.response)) {
|
||||||
|
runtime_1.assert(this.data.response.length > 0);
|
||||||
|
r = this.data.response[0];
|
||||||
|
}
|
||||||
|
else if (this.data.response !== undefined) {
|
||||||
|
r = this.data.response;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
r = method.O.create();
|
||||||
|
}
|
||||||
|
runtime_1.assert(method.O.is(r));
|
||||||
|
return Promise.resolve(r);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Pushes response messages from the mock data to the output stream.
|
||||||
|
* If an error response, status or trailers are mocked, the stream is
|
||||||
|
* closed with the respective error.
|
||||||
|
* Otherwise, stream is completed successfully.
|
||||||
|
*
|
||||||
|
* The returned promise resolves when the stream is closed. It should
|
||||||
|
* not reject. If it does, code is broken.
|
||||||
|
*/
|
||||||
|
streamResponses(method, stream, abort) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// normalize "data.response" into an array of valid output messages
|
||||||
|
const messages = [];
|
||||||
|
if (this.data.response === undefined) {
|
||||||
|
messages.push(method.O.create());
|
||||||
|
}
|
||||||
|
else if (Array.isArray(this.data.response)) {
|
||||||
|
for (let msg of this.data.response) {
|
||||||
|
runtime_1.assert(method.O.is(msg));
|
||||||
|
messages.push(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!(this.data.response instanceof rpc_error_1.RpcError)) {
|
||||||
|
runtime_1.assert(method.O.is(this.data.response));
|
||||||
|
messages.push(this.data.response);
|
||||||
|
}
|
||||||
|
// start the stream with an initial delay.
|
||||||
|
// if the request is cancelled, notify() error and exit.
|
||||||
|
try {
|
||||||
|
yield delay(this.responseDelay, abort)(undefined);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
stream.notifyError(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// if error response was mocked, notify() error (stream is now closed with error) and exit.
|
||||||
|
if (this.data.response instanceof rpc_error_1.RpcError) {
|
||||||
|
stream.notifyError(this.data.response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// regular response messages were mocked. notify() them.
|
||||||
|
for (let msg of messages) {
|
||||||
|
stream.notifyMessage(msg);
|
||||||
|
// add a short delay between responses
|
||||||
|
// if the request is cancelled, notify() error and exit.
|
||||||
|
try {
|
||||||
|
yield delay(this.betweenResponseDelay, abort)(undefined);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
stream.notifyError(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// error status was mocked, notify() error (stream is now closed with error) and exit.
|
||||||
|
if (this.data.status instanceof rpc_error_1.RpcError) {
|
||||||
|
stream.notifyError(this.data.status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// error trailers were mocked, notify() error (stream is now closed with error) and exit.
|
||||||
|
if (this.data.trailers instanceof rpc_error_1.RpcError) {
|
||||||
|
stream.notifyError(this.data.trailers);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// stream completed successfully
|
||||||
|
stream.notifyComplete();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Creates a promise for response status from the mock data.
|
||||||
|
promiseStatus() {
|
||||||
|
var _a;
|
||||||
|
const status = (_a = this.data.status) !== null && _a !== void 0 ? _a : TestTransport.defaultStatus;
|
||||||
|
return status instanceof rpc_error_1.RpcError
|
||||||
|
? Promise.reject(status)
|
||||||
|
: Promise.resolve(status);
|
||||||
|
}
|
||||||
|
// Creates a promise for response trailers from the mock data.
|
||||||
|
promiseTrailers() {
|
||||||
|
var _a;
|
||||||
|
const trailers = (_a = this.data.trailers) !== null && _a !== void 0 ? _a : TestTransport.defaultTrailers;
|
||||||
|
return trailers instanceof rpc_error_1.RpcError
|
||||||
|
? Promise.reject(trailers)
|
||||||
|
: Promise.resolve(trailers);
|
||||||
|
}
|
||||||
|
maybeSuppressUncaught(...promise) {
|
||||||
|
if (this.suppressUncaughtRejections) {
|
||||||
|
for (let p of promise) {
|
||||||
|
p.catch(() => {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mergeOptions(options) {
|
||||||
|
return rpc_options_1.mergeRpcOptions({}, options);
|
||||||
|
}
|
||||||
|
unary(method, input, options) {
|
||||||
|
var _a;
|
||||||
|
const requestHeaders = (_a = options.meta) !== null && _a !== void 0 ? _a : {}, headersPromise = this.promiseHeaders()
|
||||||
|
.then(delay(this.headerDelay, options.abort)), responsePromise = headersPromise
|
||||||
|
.catch(_ => {
|
||||||
|
})
|
||||||
|
.then(delay(this.responseDelay, options.abort))
|
||||||
|
.then(_ => this.promiseSingleResponse(method)), statusPromise = responsePromise
|
||||||
|
.catch(_ => {
|
||||||
|
})
|
||||||
|
.then(delay(this.afterResponseDelay, options.abort))
|
||||||
|
.then(_ => this.promiseStatus()), trailersPromise = responsePromise
|
||||||
|
.catch(_ => {
|
||||||
|
})
|
||||||
|
.then(delay(this.afterResponseDelay, options.abort))
|
||||||
|
.then(_ => this.promiseTrailers());
|
||||||
|
this.maybeSuppressUncaught(statusPromise, trailersPromise);
|
||||||
|
this.lastInput = { single: input };
|
||||||
|
return new unary_call_1.UnaryCall(method, requestHeaders, input, headersPromise, responsePromise, statusPromise, trailersPromise);
|
||||||
|
}
|
||||||
|
serverStreaming(method, input, options) {
|
||||||
|
var _a;
|
||||||
|
const requestHeaders = (_a = options.meta) !== null && _a !== void 0 ? _a : {}, headersPromise = this.promiseHeaders()
|
||||||
|
.then(delay(this.headerDelay, options.abort)), outputStream = new rpc_output_stream_1.RpcOutputStreamController(), responseStreamClosedPromise = headersPromise
|
||||||
|
.then(delay(this.responseDelay, options.abort))
|
||||||
|
.catch(() => {
|
||||||
|
})
|
||||||
|
.then(() => this.streamResponses(method, outputStream, options.abort))
|
||||||
|
.then(delay(this.afterResponseDelay, options.abort)), statusPromise = responseStreamClosedPromise
|
||||||
|
.then(() => this.promiseStatus()), trailersPromise = responseStreamClosedPromise
|
||||||
|
.then(() => this.promiseTrailers());
|
||||||
|
this.maybeSuppressUncaught(statusPromise, trailersPromise);
|
||||||
|
this.lastInput = { single: input };
|
||||||
|
return new server_streaming_call_1.ServerStreamingCall(method, requestHeaders, input, headersPromise, outputStream, statusPromise, trailersPromise);
|
||||||
|
}
|
||||||
|
clientStreaming(method, options) {
|
||||||
|
var _a;
|
||||||
|
const requestHeaders = (_a = options.meta) !== null && _a !== void 0 ? _a : {}, headersPromise = this.promiseHeaders()
|
||||||
|
.then(delay(this.headerDelay, options.abort)), responsePromise = headersPromise
|
||||||
|
.catch(_ => {
|
||||||
|
})
|
||||||
|
.then(delay(this.responseDelay, options.abort))
|
||||||
|
.then(_ => this.promiseSingleResponse(method)), statusPromise = responsePromise
|
||||||
|
.catch(_ => {
|
||||||
|
})
|
||||||
|
.then(delay(this.afterResponseDelay, options.abort))
|
||||||
|
.then(_ => this.promiseStatus()), trailersPromise = responsePromise
|
||||||
|
.catch(_ => {
|
||||||
|
})
|
||||||
|
.then(delay(this.afterResponseDelay, options.abort))
|
||||||
|
.then(_ => this.promiseTrailers());
|
||||||
|
this.maybeSuppressUncaught(statusPromise, trailersPromise);
|
||||||
|
this.lastInput = new TestInputStream(this.data, options.abort);
|
||||||
|
return new client_streaming_call_1.ClientStreamingCall(method, requestHeaders, this.lastInput, headersPromise, responsePromise, statusPromise, trailersPromise);
|
||||||
|
}
|
||||||
|
duplex(method, options) {
|
||||||
|
var _a;
|
||||||
|
const requestHeaders = (_a = options.meta) !== null && _a !== void 0 ? _a : {}, headersPromise = this.promiseHeaders()
|
||||||
|
.then(delay(this.headerDelay, options.abort)), outputStream = new rpc_output_stream_1.RpcOutputStreamController(), responseStreamClosedPromise = headersPromise
|
||||||
|
.then(delay(this.responseDelay, options.abort))
|
||||||
|
.catch(() => {
|
||||||
|
})
|
||||||
|
.then(() => this.streamResponses(method, outputStream, options.abort))
|
||||||
|
.then(delay(this.afterResponseDelay, options.abort)), statusPromise = responseStreamClosedPromise
|
||||||
|
.then(() => this.promiseStatus()), trailersPromise = responseStreamClosedPromise
|
||||||
|
.then(() => this.promiseTrailers());
|
||||||
|
this.maybeSuppressUncaught(statusPromise, trailersPromise);
|
||||||
|
this.lastInput = new TestInputStream(this.data, options.abort);
|
||||||
|
return new duplex_streaming_call_1.DuplexStreamingCall(method, requestHeaders, this.lastInput, headersPromise, outputStream, statusPromise, trailersPromise);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.TestTransport = TestTransport;
|
||||||
|
TestTransport.defaultHeaders = {
|
||||||
|
responseHeader: "test"
|
||||||
|
};
|
||||||
|
TestTransport.defaultStatus = {
|
||||||
|
code: "OK", detail: "all good"
|
||||||
|
};
|
||||||
|
TestTransport.defaultTrailers = {
|
||||||
|
responseTrailer: "test"
|
||||||
|
};
|
||||||
|
function delay(ms, abort) {
|
||||||
|
return (v) => new Promise((resolve, reject) => {
|
||||||
|
if (abort === null || abort === void 0 ? void 0 : abort.aborted) {
|
||||||
|
reject(new rpc_error_1.RpcError("user cancel", "CANCELLED"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const id = setTimeout(() => resolve(v), ms);
|
||||||
|
if (abort) {
|
||||||
|
abort.addEventListener("abort", ev => {
|
||||||
|
clearTimeout(id);
|
||||||
|
reject(new rpc_error_1.RpcError("user cancel", "CANCELLED"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
class TestInputStream {
|
||||||
|
constructor(data, abort) {
|
||||||
|
this._completed = false;
|
||||||
|
this._sent = [];
|
||||||
|
this.data = data;
|
||||||
|
this.abort = abort;
|
||||||
|
}
|
||||||
|
get sent() {
|
||||||
|
return this._sent;
|
||||||
|
}
|
||||||
|
get completed() {
|
||||||
|
return this._completed;
|
||||||
|
}
|
||||||
|
send(message) {
|
||||||
|
if (this.data.inputMessage instanceof rpc_error_1.RpcError) {
|
||||||
|
return Promise.reject(this.data.inputMessage);
|
||||||
|
}
|
||||||
|
const delayMs = this.data.inputMessage === undefined
|
||||||
|
? 10
|
||||||
|
: this.data.inputMessage;
|
||||||
|
return Promise.resolve(undefined)
|
||||||
|
.then(() => {
|
||||||
|
this._sent.push(message);
|
||||||
|
})
|
||||||
|
.then(delay(delayMs, this.abort));
|
||||||
|
}
|
||||||
|
complete() {
|
||||||
|
if (this.data.inputComplete instanceof rpc_error_1.RpcError) {
|
||||||
|
return Promise.reject(this.data.inputComplete);
|
||||||
|
}
|
||||||
|
const delayMs = this.data.inputComplete === undefined
|
||||||
|
? 10
|
||||||
|
: this.data.inputComplete;
|
||||||
|
return Promise.resolve(undefined)
|
||||||
|
.then(() => {
|
||||||
|
this._completed = true;
|
||||||
|
})
|
||||||
|
.then(delay(delayMs, this.abort));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 9288:
|
||||||
|
/***/ (function(__unused_webpack_module, exports) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.UnaryCall = void 0;
|
||||||
|
/**
|
||||||
|
* A unary RPC call. Unary means there is exactly one input message and
|
||||||
|
* exactly one output message unless an error occurred.
|
||||||
|
*/
|
||||||
|
class UnaryCall {
|
||||||
|
constructor(method, requestHeaders, request, headers, response, status, trailers) {
|
||||||
|
this.method = method;
|
||||||
|
this.requestHeaders = requestHeaders;
|
||||||
|
this.request = request;
|
||||||
|
this.headers = headers;
|
||||||
|
this.response = response;
|
||||||
|
this.status = status;
|
||||||
|
this.trailers = trailers;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* If you are only interested in the final outcome of this call,
|
||||||
|
* you can await it to receive a `FinishedUnaryCall`.
|
||||||
|
*/
|
||||||
|
then(onfulfilled, onrejected) {
|
||||||
|
return this.promiseFinished().then(value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value, reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
|
||||||
|
}
|
||||||
|
promiseFinished() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let [headers, response, status, trailers] = yield Promise.all([this.headers, this.response, this.status, this.trailers]);
|
||||||
|
return {
|
||||||
|
method: this.method,
|
||||||
|
requestHeaders: this.requestHeaders,
|
||||||
|
request: this.request,
|
||||||
|
headers,
|
||||||
|
response,
|
||||||
|
status,
|
||||||
|
trailers
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.UnaryCall = UnaryCall;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 8602:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.assertFloat32 = exports.assertUInt32 = exports.assertInt32 = exports.assertNever = exports.assert = void 0;
|
||||||
|
/**
|
||||||
|
* assert that condition is true or throw error (with message)
|
||||||
|
*/
|
||||||
|
function assert(condition, msg) {
|
||||||
|
if (!condition) {
|
||||||
|
throw new Error(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.assert = assert;
|
||||||
|
/**
|
||||||
|
* assert that value cannot exist = type `never`. throw runtime error if it does.
|
||||||
|
*/
|
||||||
|
function assertNever(value, msg) {
|
||||||
|
throw new Error(msg !== null && msg !== void 0 ? msg : 'Unexpected object: ' + value);
|
||||||
|
}
|
||||||
|
exports.assertNever = assertNever;
|
||||||
|
const FLOAT32_MAX = 3.4028234663852886e+38, FLOAT32_MIN = -3.4028234663852886e+38, UINT32_MAX = 0xFFFFFFFF, INT32_MAX = 0X7FFFFFFF, INT32_MIN = -0X80000000;
|
||||||
|
function assertInt32(arg) {
|
||||||
|
if (typeof arg !== "number")
|
||||||
|
throw new Error('invalid int 32: ' + typeof arg);
|
||||||
|
if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN)
|
||||||
|
throw new Error('invalid int 32: ' + arg);
|
||||||
|
}
|
||||||
|
exports.assertInt32 = assertInt32;
|
||||||
|
function assertUInt32(arg) {
|
||||||
|
if (typeof arg !== "number")
|
||||||
|
throw new Error('invalid uint 32: ' + typeof arg);
|
||||||
|
if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0)
|
||||||
|
throw new Error('invalid uint 32: ' + arg);
|
||||||
|
}
|
||||||
|
exports.assertUInt32 = assertUInt32;
|
||||||
|
function assertFloat32(arg) {
|
||||||
|
if (typeof arg !== "number")
|
||||||
|
throw new Error('invalid float 32: ' + typeof arg);
|
||||||
|
if (!Number.isFinite(arg))
|
||||||
|
return;
|
||||||
|
if (arg > FLOAT32_MAX || arg < FLOAT32_MIN)
|
||||||
|
throw new Error('invalid float 32: ' + arg);
|
||||||
|
}
|
||||||
|
exports.assertFloat32 = assertFloat32;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 6335:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.base64encode = exports.base64decode = void 0;
|
||||||
|
// lookup table from base64 character to byte
|
||||||
|
let encTable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
||||||
|
// lookup table from base64 character *code* to byte because lookup by number is fast
|
||||||
|
let decTable = [];
|
||||||
|
for (let i = 0; i < encTable.length; i++)
|
||||||
|
decTable[encTable[i].charCodeAt(0)] = i;
|
||||||
|
// support base64url variants
|
||||||
|
decTable["-".charCodeAt(0)] = encTable.indexOf("+");
|
||||||
|
decTable["_".charCodeAt(0)] = encTable.indexOf("/");
|
||||||
|
/**
|
||||||
|
* Decodes a base64 string to a byte array.
|
||||||
|
*
|
||||||
|
* - ignores white-space, including line breaks and tabs
|
||||||
|
* - allows inner padding (can decode concatenated base64 strings)
|
||||||
|
* - does not require padding
|
||||||
|
* - understands base64url encoding:
|
||||||
|
* "-" instead of "+",
|
||||||
|
* "_" instead of "/",
|
||||||
|
* no padding
|
||||||
|
*/
|
||||||
|
function base64decode(base64Str) {
|
||||||
|
// estimate byte size, not accounting for inner padding and whitespace
|
||||||
|
let es = base64Str.length * 3 / 4;
|
||||||
|
// if (es % 3 !== 0)
|
||||||
|
// throw new Error('invalid base64 string');
|
||||||
|
if (base64Str[base64Str.length - 2] == '=')
|
||||||
|
es -= 2;
|
||||||
|
else if (base64Str[base64Str.length - 1] == '=')
|
||||||
|
es -= 1;
|
||||||
|
let bytes = new Uint8Array(es), bytePos = 0, // position in byte array
|
||||||
|
groupPos = 0, // position in base64 group
|
||||||
|
b, // current byte
|
||||||
|
p = 0 // previous byte
|
||||||
|
;
|
||||||
|
for (let i = 0; i < base64Str.length; i++) {
|
||||||
|
b = decTable[base64Str.charCodeAt(i)];
|
||||||
|
if (b === undefined) {
|
||||||
|
// noinspection FallThroughInSwitchStatementJS
|
||||||
|
switch (base64Str[i]) {
|
||||||
|
case '=':
|
||||||
|
groupPos = 0; // reset state when padding found
|
||||||
|
case '\n':
|
||||||
|
case '\r':
|
||||||
|
case '\t':
|
||||||
|
case ' ':
|
||||||
|
continue; // skip white-space, and padding
|
||||||
|
default:
|
||||||
|
throw Error(`invalid base64 string.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (groupPos) {
|
||||||
|
case 0:
|
||||||
|
p = b;
|
||||||
|
groupPos = 1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
bytes[bytePos++] = p << 2 | (b & 48) >> 4;
|
||||||
|
p = b;
|
||||||
|
groupPos = 2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
bytes[bytePos++] = (p & 15) << 4 | (b & 60) >> 2;
|
||||||
|
p = b;
|
||||||
|
groupPos = 3;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
bytes[bytePos++] = (p & 3) << 6 | b;
|
||||||
|
groupPos = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (groupPos == 1)
|
||||||
|
throw Error(`invalid base64 string.`);
|
||||||
|
return bytes.subarray(0, bytePos);
|
||||||
|
}
|
||||||
|
exports.base64decode = base64decode;
|
||||||
|
/**
|
||||||
|
* Encodes a byte array to a base64 string.
|
||||||
|
* Adds padding at the end.
|
||||||
|
* Does not insert newlines.
|
||||||
|
*/
|
||||||
|
function base64encode(bytes) {
|
||||||
|
let base64 = '', groupPos = 0, // position in base64 group
|
||||||
|
b, // current byte
|
||||||
|
p = 0; // carry over from previous byte
|
||||||
|
for (let i = 0; i < bytes.length; i++) {
|
||||||
|
b = bytes[i];
|
||||||
|
switch (groupPos) {
|
||||||
|
case 0:
|
||||||
|
base64 += encTable[b >> 2];
|
||||||
|
p = (b & 3) << 4;
|
||||||
|
groupPos = 1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
base64 += encTable[p | b >> 4];
|
||||||
|
p = (b & 15) << 2;
|
||||||
|
groupPos = 2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
base64 += encTable[p | b >> 6];
|
||||||
|
base64 += encTable[b & 63];
|
||||||
|
groupPos = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// padding required?
|
||||||
|
if (groupPos) {
|
||||||
|
base64 += encTable[p];
|
||||||
|
base64 += '=';
|
||||||
|
if (groupPos == 1)
|
||||||
|
base64 += '=';
|
||||||
|
}
|
||||||
|
return base64;
|
||||||
|
}
|
||||||
|
exports.base64encode = base64encode;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 4816:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.WireType = exports.mergeBinaryOptions = exports.UnknownFieldHandler = void 0;
|
||||||
|
/**
|
||||||
|
* This handler implements the default behaviour for unknown fields.
|
||||||
|
* When reading data, unknown fields are stored on the message, in a
|
||||||
|
* symbol property.
|
||||||
|
* When writing data, the symbol property is queried and unknown fields
|
||||||
|
* are serialized into the output again.
|
||||||
|
*/
|
||||||
|
var UnknownFieldHandler;
|
||||||
|
(function (UnknownFieldHandler) {
|
||||||
|
/**
|
||||||
|
* The symbol used to store unknown fields for a message.
|
||||||
|
* The property must conform to `UnknownFieldContainer`.
|
||||||
|
*/
|
||||||
|
UnknownFieldHandler.symbol = Symbol.for("protobuf-ts/unknown");
|
||||||
|
/**
|
||||||
|
* Store an unknown field during binary read directly on the message.
|
||||||
|
* This method is compatible with `BinaryReadOptions.readUnknownField`.
|
||||||
|
*/
|
||||||
|
UnknownFieldHandler.onRead = (typeName, message, fieldNo, wireType, data) => {
|
||||||
|
let container = is(message) ? message[UnknownFieldHandler.symbol] : message[UnknownFieldHandler.symbol] = [];
|
||||||
|
container.push({ no: fieldNo, wireType, data });
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Write unknown fields stored for the message to the writer.
|
||||||
|
* This method is compatible with `BinaryWriteOptions.writeUnknownFields`.
|
||||||
|
*/
|
||||||
|
UnknownFieldHandler.onWrite = (typeName, message, writer) => {
|
||||||
|
for (let { no, wireType, data } of UnknownFieldHandler.list(message))
|
||||||
|
writer.tag(no, wireType).raw(data);
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* List unknown fields stored for the message.
|
||||||
|
* Note that there may be multiples fields with the same number.
|
||||||
|
*/
|
||||||
|
UnknownFieldHandler.list = (message, fieldNo) => {
|
||||||
|
if (is(message)) {
|
||||||
|
let all = message[UnknownFieldHandler.symbol];
|
||||||
|
return fieldNo ? all.filter(uf => uf.no == fieldNo) : all;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Returns the last unknown field by field number.
|
||||||
|
*/
|
||||||
|
UnknownFieldHandler.last = (message, fieldNo) => UnknownFieldHandler.list(message, fieldNo).slice(-1)[0];
|
||||||
|
const is = (message) => message && Array.isArray(message[UnknownFieldHandler.symbol]);
|
||||||
|
})(UnknownFieldHandler = exports.UnknownFieldHandler || (exports.UnknownFieldHandler = {}));
|
||||||
|
/**
|
||||||
|
* Merges binary write or read options. Later values override earlier values.
|
||||||
|
*/
|
||||||
|
function mergeBinaryOptions(a, b) {
|
||||||
|
return Object.assign(Object.assign({}, a), b);
|
||||||
|
}
|
||||||
|
exports.mergeBinaryOptions = mergeBinaryOptions;
|
||||||
|
/**
|
||||||
|
* Protobuf binary format wire types.
|
||||||
|
*
|
||||||
|
* A wire type provides just enough information to find the length of the
|
||||||
|
* following value.
|
||||||
|
*
|
||||||
|
* See https://developers.google.com/protocol-buffers/docs/encoding#structure
|
||||||
|
*/
|
||||||
|
var WireType;
|
||||||
|
(function (WireType) {
|
||||||
|
/**
|
||||||
|
* Used for int32, int64, uint32, uint64, sint32, sint64, bool, enum
|
||||||
|
*/
|
||||||
|
WireType[WireType["Varint"] = 0] = "Varint";
|
||||||
|
/**
|
||||||
|
* Used for fixed64, sfixed64, double.
|
||||||
|
* Always 8 bytes with little-endian byte order.
|
||||||
|
*/
|
||||||
|
WireType[WireType["Bit64"] = 1] = "Bit64";
|
||||||
|
/**
|
||||||
|
* Used for string, bytes, embedded messages, packed repeated fields
|
||||||
|
*
|
||||||
|
* Only repeated numeric types (types which use the varint, 32-bit,
|
||||||
|
* or 64-bit wire types) can be packed. In proto3, such fields are
|
||||||
|
* packed by default.
|
||||||
|
*/
|
||||||
|
WireType[WireType["LengthDelimited"] = 2] = "LengthDelimited";
|
||||||
|
/**
|
||||||
|
* Used for groups
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
WireType[WireType["StartGroup"] = 3] = "StartGroup";
|
||||||
|
/**
|
||||||
|
* Used for groups
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
WireType[WireType["EndGroup"] = 4] = "EndGroup";
|
||||||
|
/**
|
||||||
|
* Used for fixed32, sfixed32, float.
|
||||||
|
* Always 4 bytes with little-endian byte order.
|
||||||
|
*/
|
||||||
|
WireType[WireType["Bit32"] = 5] = "Bit32";
|
||||||
|
})(WireType = exports.WireType || (exports.WireType = {}));
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 2889:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.BinaryReader = exports.binaryReadOptions = void 0;
|
||||||
|
const binary_format_contract_1 = __nccwpck_require__(4816);
|
||||||
|
const pb_long_1 = __nccwpck_require__(1753);
|
||||||
|
const goog_varint_1 = __nccwpck_require__(3223);
|
||||||
|
const defaultsRead = {
|
||||||
|
readUnknownField: true,
|
||||||
|
readerFactory: bytes => new BinaryReader(bytes),
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Make options for reading binary data form partial options.
|
||||||
|
*/
|
||||||
|
function binaryReadOptions(options) {
|
||||||
|
return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;
|
||||||
|
}
|
||||||
|
exports.binaryReadOptions = binaryReadOptions;
|
||||||
|
class BinaryReader {
|
||||||
|
constructor(buf, textDecoder) {
|
||||||
|
this.varint64 = goog_varint_1.varint64read; // dirty cast for `this`
|
||||||
|
/**
|
||||||
|
* Read a `uint32` field, an unsigned 32 bit varint.
|
||||||
|
*/
|
||||||
|
this.uint32 = goog_varint_1.varint32read; // dirty cast for `this` and access to protected `buf`
|
||||||
|
this.buf = buf;
|
||||||
|
this.len = buf.length;
|
||||||
|
this.pos = 0;
|
||||||
|
this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||||
|
this.textDecoder = textDecoder !== null && textDecoder !== void 0 ? textDecoder : new TextDecoder("utf-8", {
|
||||||
|
fatal: true,
|
||||||
|
ignoreBOM: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Reads a tag - field number and wire type.
|
||||||
|
*/
|
||||||
|
tag() {
|
||||||
|
let tag = this.uint32(), fieldNo = tag >>> 3, wireType = tag & 7;
|
||||||
|
if (fieldNo <= 0 || wireType < 0 || wireType > 5)
|
||||||
|
throw new Error("illegal tag: field no " + fieldNo + " wire type " + wireType);
|
||||||
|
return [fieldNo, wireType];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Skip one element on the wire and return the skipped data.
|
||||||
|
* Supports WireType.StartGroup since v2.0.0-alpha.23.
|
||||||
|
*/
|
||||||
|
skip(wireType) {
|
||||||
|
let start = this.pos;
|
||||||
|
// noinspection FallThroughInSwitchStatementJS
|
||||||
|
switch (wireType) {
|
||||||
|
case binary_format_contract_1.WireType.Varint:
|
||||||
|
while (this.buf[this.pos++] & 0x80) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case binary_format_contract_1.WireType.Bit64:
|
||||||
|
this.pos += 4;
|
||||||
|
case binary_format_contract_1.WireType.Bit32:
|
||||||
|
this.pos += 4;
|
||||||
|
break;
|
||||||
|
case binary_format_contract_1.WireType.LengthDelimited:
|
||||||
|
let len = this.uint32();
|
||||||
|
this.pos += len;
|
||||||
|
break;
|
||||||
|
case binary_format_contract_1.WireType.StartGroup:
|
||||||
|
// From descriptor.proto: Group type is deprecated, not supported in proto3.
|
||||||
|
// But we must still be able to parse and treat as unknown.
|
||||||
|
let t;
|
||||||
|
while ((t = this.tag()[1]) !== binary_format_contract_1.WireType.EndGroup) {
|
||||||
|
this.skip(t);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error("cant skip wire type " + wireType);
|
||||||
|
}
|
||||||
|
this.assertBounds();
|
||||||
|
return this.buf.subarray(start, this.pos);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Throws error if position in byte array is out of range.
|
||||||
|
*/
|
||||||
|
assertBounds() {
|
||||||
|
if (this.pos > this.len)
|
||||||
|
throw new RangeError("premature EOF");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `int32` field, a signed 32 bit varint.
|
||||||
|
*/
|
||||||
|
int32() {
|
||||||
|
return this.uint32() | 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
|
||||||
|
*/
|
||||||
|
sint32() {
|
||||||
|
let zze = this.uint32();
|
||||||
|
// decode zigzag
|
||||||
|
return (zze >>> 1) ^ -(zze & 1);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `int64` field, a signed 64-bit varint.
|
||||||
|
*/
|
||||||
|
int64() {
|
||||||
|
return new pb_long_1.PbLong(...this.varint64());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `uint64` field, an unsigned 64-bit varint.
|
||||||
|
*/
|
||||||
|
uint64() {
|
||||||
|
return new pb_long_1.PbULong(...this.varint64());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
|
||||||
|
*/
|
||||||
|
sint64() {
|
||||||
|
let [lo, hi] = this.varint64();
|
||||||
|
// decode zig zag
|
||||||
|
let s = -(lo & 1);
|
||||||
|
lo = ((lo >>> 1 | (hi & 1) << 31) ^ s);
|
||||||
|
hi = (hi >>> 1 ^ s);
|
||||||
|
return new pb_long_1.PbLong(lo, hi);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `bool` field, a variant.
|
||||||
|
*/
|
||||||
|
bool() {
|
||||||
|
let [lo, hi] = this.varint64();
|
||||||
|
return lo !== 0 || hi !== 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.
|
||||||
|
*/
|
||||||
|
fixed32() {
|
||||||
|
return this.view.getUint32((this.pos += 4) - 4, true);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `sfixed32` field, a signed, fixed-length 32-bit integer.
|
||||||
|
*/
|
||||||
|
sfixed32() {
|
||||||
|
return this.view.getInt32((this.pos += 4) - 4, true);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
|
||||||
|
*/
|
||||||
|
fixed64() {
|
||||||
|
return new pb_long_1.PbULong(this.sfixed32(), this.sfixed32());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `fixed64` field, a signed, fixed-length 64-bit integer.
|
||||||
|
*/
|
||||||
|
sfixed64() {
|
||||||
|
return new pb_long_1.PbLong(this.sfixed32(), this.sfixed32());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `float` field, 32-bit floating point number.
|
||||||
|
*/
|
||||||
|
float() {
|
||||||
|
return this.view.getFloat32((this.pos += 4) - 4, true);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `double` field, a 64-bit floating point number.
|
||||||
|
*/
|
||||||
|
double() {
|
||||||
|
return this.view.getFloat64((this.pos += 8) - 8, true);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `bytes` field, length-delimited arbitrary data.
|
||||||
|
*/
|
||||||
|
bytes() {
|
||||||
|
let len = this.uint32();
|
||||||
|
let start = this.pos;
|
||||||
|
this.pos += len;
|
||||||
|
this.assertBounds();
|
||||||
|
return this.buf.subarray(start, start + len);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a `string` field, length-delimited data converted to UTF-8 text.
|
||||||
|
*/
|
||||||
|
string() {
|
||||||
|
return this.textDecoder.decode(this.bytes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.BinaryReader = BinaryReader;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 3957:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.BinaryWriter = exports.binaryWriteOptions = void 0;
|
||||||
|
const pb_long_1 = __nccwpck_require__(1753);
|
||||||
|
const goog_varint_1 = __nccwpck_require__(3223);
|
||||||
|
const assert_1 = __nccwpck_require__(8602);
|
||||||
|
const defaultsWrite = {
|
||||||
|
writeUnknownFields: true,
|
||||||
|
writerFactory: () => new BinaryWriter(),
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Make options for writing binary data form partial options.
|
||||||
|
*/
|
||||||
|
function binaryWriteOptions(options) {
|
||||||
|
return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;
|
||||||
|
}
|
||||||
|
exports.binaryWriteOptions = binaryWriteOptions;
|
||||||
|
class BinaryWriter {
|
||||||
|
constructor(textEncoder) {
|
||||||
|
/**
|
||||||
|
* Previous fork states.
|
||||||
|
*/
|
||||||
|
this.stack = [];
|
||||||
|
this.textEncoder = textEncoder !== null && textEncoder !== void 0 ? textEncoder : new TextEncoder();
|
||||||
|
this.chunks = [];
|
||||||
|
this.buf = [];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return all bytes written and reset this writer.
|
||||||
|
*/
|
||||||
|
finish() {
|
||||||
|
this.chunks.push(new Uint8Array(this.buf)); // flush the buffer
|
||||||
|
let len = 0;
|
||||||
|
for (let i = 0; i < this.chunks.length; i++)
|
||||||
|
len += this.chunks[i].length;
|
||||||
|
let bytes = new Uint8Array(len);
|
||||||
|
let offset = 0;
|
||||||
|
for (let i = 0; i < this.chunks.length; i++) {
|
||||||
|
bytes.set(this.chunks[i], offset);
|
||||||
|
offset += this.chunks[i].length;
|
||||||
|
}
|
||||||
|
this.chunks = [];
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Start a new fork for length-delimited data like a message
|
||||||
|
* or a packed repeated field.
|
||||||
|
*
|
||||||
|
* Must be joined later with `join()`.
|
||||||
|
*/
|
||||||
|
fork() {
|
||||||
|
this.stack.push({ chunks: this.chunks, buf: this.buf });
|
||||||
|
this.chunks = [];
|
||||||
|
this.buf = [];
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Join the last fork. Write its length and bytes, then
|
||||||
|
* return to the previous state.
|
||||||
|
*/
|
||||||
|
join() {
|
||||||
|
// get chunk of fork
|
||||||
|
let chunk = this.finish();
|
||||||
|
// restore previous state
|
||||||
|
let prev = this.stack.pop();
|
||||||
|
if (!prev)
|
||||||
|
throw new Error('invalid state, fork stack empty');
|
||||||
|
this.chunks = prev.chunks;
|
||||||
|
this.buf = prev.buf;
|
||||||
|
// write length of chunk as varint
|
||||||
|
this.uint32(chunk.byteLength);
|
||||||
|
return this.raw(chunk);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Writes a tag (field number and wire type).
|
||||||
|
*
|
||||||
|
* Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`.
|
||||||
|
*
|
||||||
|
* Generated code should compute the tag ahead of time and call `uint32()`.
|
||||||
|
*/
|
||||||
|
tag(fieldNo, type) {
|
||||||
|
return this.uint32((fieldNo << 3 | type) >>> 0);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a chunk of raw bytes.
|
||||||
|
*/
|
||||||
|
raw(chunk) {
|
||||||
|
if (this.buf.length) {
|
||||||
|
this.chunks.push(new Uint8Array(this.buf));
|
||||||
|
this.buf = [];
|
||||||
|
}
|
||||||
|
this.chunks.push(chunk);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `uint32` value, an unsigned 32 bit varint.
|
||||||
|
*/
|
||||||
|
uint32(value) {
|
||||||
|
assert_1.assertUInt32(value);
|
||||||
|
// write value as varint 32, inlined for speed
|
||||||
|
while (value > 0x7f) {
|
||||||
|
this.buf.push((value & 0x7f) | 0x80);
|
||||||
|
value = value >>> 7;
|
||||||
|
}
|
||||||
|
this.buf.push(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `int32` value, a signed 32 bit varint.
|
||||||
|
*/
|
||||||
|
int32(value) {
|
||||||
|
assert_1.assertInt32(value);
|
||||||
|
goog_varint_1.varint32write(value, this.buf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `bool` value, a variant.
|
||||||
|
*/
|
||||||
|
bool(value) {
|
||||||
|
this.buf.push(value ? 1 : 0);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `bytes` value, length-delimited arbitrary data.
|
||||||
|
*/
|
||||||
|
bytes(value) {
|
||||||
|
this.uint32(value.byteLength); // write length of chunk as varint
|
||||||
|
return this.raw(value);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `string` value, length-delimited data converted to UTF-8 text.
|
||||||
|
*/
|
||||||
|
string(value) {
|
||||||
|
let chunk = this.textEncoder.encode(value);
|
||||||
|
this.uint32(chunk.byteLength); // write length of chunk as varint
|
||||||
|
return this.raw(chunk);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `float` value, 32-bit floating point number.
|
||||||
|
*/
|
||||||
|
float(value) {
|
||||||
|
assert_1.assertFloat32(value);
|
||||||
|
let chunk = new Uint8Array(4);
|
||||||
|
new DataView(chunk.buffer).setFloat32(0, value, true);
|
||||||
|
return this.raw(chunk);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `double` value, a 64-bit floating point number.
|
||||||
|
*/
|
||||||
|
double(value) {
|
||||||
|
let chunk = new Uint8Array(8);
|
||||||
|
new DataView(chunk.buffer).setFloat64(0, value, true);
|
||||||
|
return this.raw(chunk);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
|
||||||
|
*/
|
||||||
|
fixed32(value) {
|
||||||
|
assert_1.assertUInt32(value);
|
||||||
|
let chunk = new Uint8Array(4);
|
||||||
|
new DataView(chunk.buffer).setUint32(0, value, true);
|
||||||
|
return this.raw(chunk);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
|
||||||
|
*/
|
||||||
|
sfixed32(value) {
|
||||||
|
assert_1.assertInt32(value);
|
||||||
|
let chunk = new Uint8Array(4);
|
||||||
|
new DataView(chunk.buffer).setInt32(0, value, true);
|
||||||
|
return this.raw(chunk);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
|
||||||
|
*/
|
||||||
|
sint32(value) {
|
||||||
|
assert_1.assertInt32(value);
|
||||||
|
// zigzag encode
|
||||||
|
value = ((value << 1) ^ (value >> 31)) >>> 0;
|
||||||
|
goog_varint_1.varint32write(value, this.buf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `fixed64` value, a signed, fixed-length 64-bit integer.
|
||||||
|
*/
|
||||||
|
sfixed64(value) {
|
||||||
|
let chunk = new Uint8Array(8);
|
||||||
|
let view = new DataView(chunk.buffer);
|
||||||
|
let long = pb_long_1.PbLong.from(value);
|
||||||
|
view.setInt32(0, long.lo, true);
|
||||||
|
view.setInt32(4, long.hi, true);
|
||||||
|
return this.raw(chunk);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
|
||||||
|
*/
|
||||||
|
fixed64(value) {
|
||||||
|
let chunk = new Uint8Array(8);
|
||||||
|
let view = new DataView(chunk.buffer);
|
||||||
|
let long = pb_long_1.PbULong.from(value);
|
||||||
|
view.setInt32(0, long.lo, true);
|
||||||
|
view.setInt32(4, long.hi, true);
|
||||||
|
return this.raw(chunk);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `int64` value, a signed 64-bit varint.
|
||||||
|
*/
|
||||||
|
int64(value) {
|
||||||
|
let long = pb_long_1.PbLong.from(value);
|
||||||
|
goog_varint_1.varint64write(long.lo, long.hi, this.buf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
|
||||||
|
*/
|
||||||
|
sint64(value) {
|
||||||
|
let long = pb_long_1.PbLong.from(value),
|
||||||
|
// zigzag encode
|
||||||
|
sign = long.hi >> 31, lo = (long.lo << 1) ^ sign, hi = ((long.hi << 1) | (long.lo >>> 31)) ^ sign;
|
||||||
|
goog_varint_1.varint64write(lo, hi, this.buf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a `uint64` value, an unsigned 64-bit varint.
|
||||||
|
*/
|
||||||
|
uint64(value) {
|
||||||
|
let long = pb_long_1.PbULong.from(value);
|
||||||
|
goog_varint_1.varint64write(long.lo, long.hi, this.buf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.BinaryWriter = BinaryWriter;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 257:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.listEnumNumbers = exports.listEnumNames = exports.listEnumValues = exports.isEnumObject = void 0;
|
||||||
|
/**
|
||||||
|
* Is this a lookup object generated by Typescript, for a Typescript enum
|
||||||
|
* generated by protobuf-ts?
|
||||||
|
*
|
||||||
|
* - No `const enum` (enum must not be inlined, we need reverse mapping).
|
||||||
|
* - No string enum (we need int32 for protobuf).
|
||||||
|
* - Must have a value for 0 (otherwise, we would need to support custom default values).
|
||||||
|
*/
|
||||||
|
function isEnumObject(arg) {
|
||||||
|
if (typeof arg != 'object' || arg === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!arg.hasOwnProperty(0)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (let k of Object.keys(arg)) {
|
||||||
|
let num = parseInt(k);
|
||||||
|
if (!Number.isNaN(num)) {
|
||||||
|
// is there a name for the number?
|
||||||
|
let nam = arg[num];
|
||||||
|
if (nam === undefined)
|
||||||
|
return false;
|
||||||
|
// does the name resolve back to the number?
|
||||||
|
if (arg[nam] !== num)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// is there a number for the name?
|
||||||
|
let num = arg[k];
|
||||||
|
if (num === undefined)
|
||||||
|
return false;
|
||||||
|
// is it a string enum?
|
||||||
|
if (typeof num !== 'number')
|
||||||
|
return false;
|
||||||
|
// do we know the number?
|
||||||
|
if (arg[num] === undefined)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
exports.isEnumObject = isEnumObject;
|
||||||
|
/**
|
||||||
|
* Lists all values of a Typescript enum, as an array of objects with a "name"
|
||||||
|
* property and a "number" property.
|
||||||
|
*
|
||||||
|
* Note that it is possible that a number appears more than once, because it is
|
||||||
|
* possible to have aliases in an enum.
|
||||||
|
*
|
||||||
|
* Throws if the enum does not adhere to the rules of enums generated by
|
||||||
|
* protobuf-ts. See `isEnumObject()`.
|
||||||
|
*/
|
||||||
|
function listEnumValues(enumObject) {
|
||||||
|
if (!isEnumObject(enumObject))
|
||||||
|
throw new Error("not a typescript enum object");
|
||||||
|
let values = [];
|
||||||
|
for (let [name, number] of Object.entries(enumObject))
|
||||||
|
if (typeof number == "number")
|
||||||
|
values.push({ name, number });
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
exports.listEnumValues = listEnumValues;
|
||||||
|
/**
|
||||||
|
* Lists the names of a Typescript enum.
|
||||||
|
*
|
||||||
|
* Throws if the enum does not adhere to the rules of enums generated by
|
||||||
|
* protobuf-ts. See `isEnumObject()`.
|
||||||
|
*/
|
||||||
|
function listEnumNames(enumObject) {
|
||||||
|
return listEnumValues(enumObject).map(val => val.name);
|
||||||
|
}
|
||||||
|
exports.listEnumNames = listEnumNames;
|
||||||
|
/**
|
||||||
|
* Lists the numbers of a Typescript enum.
|
||||||
|
*
|
||||||
|
* Throws if the enum does not adhere to the rules of enums generated by
|
||||||
|
* protobuf-ts. See `isEnumObject()`.
|
||||||
|
*/
|
||||||
|
function listEnumNumbers(enumObject) {
|
||||||
|
return listEnumValues(enumObject)
|
||||||
|
.map(val => val.number)
|
||||||
|
.filter((num, index, arr) => arr.indexOf(num) == index);
|
||||||
|
}
|
||||||
|
exports.listEnumNumbers = listEnumNumbers;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 3223:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// Code generated by the Protocol Buffer compiler is owned by the owner
|
||||||
|
// of the input file used when generating it. This code is not
|
||||||
|
// standalone and requires a support library to be linked with it. This
|
||||||
|
// support library is itself covered by the above license.
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.varint32read = exports.varint32write = exports.int64toString = exports.int64fromString = exports.varint64write = exports.varint64read = void 0;
|
||||||
|
/**
|
||||||
|
* Read a 64 bit varint as two JS numbers.
|
||||||
|
*
|
||||||
|
* Returns tuple:
|
||||||
|
* [0]: low bits
|
||||||
|
* [0]: high bits
|
||||||
|
*
|
||||||
|
* Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175
|
||||||
|
*/
|
||||||
|
function varint64read() {
|
||||||
|
let lowBits = 0;
|
||||||
|
let highBits = 0;
|
||||||
|
for (let shift = 0; shift < 28; shift += 7) {
|
||||||
|
let b = this.buf[this.pos++];
|
||||||
|
lowBits |= (b & 0x7F) << shift;
|
||||||
|
if ((b & 0x80) == 0) {
|
||||||
|
this.assertBounds();
|
||||||
|
return [lowBits, highBits];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let middleByte = this.buf[this.pos++];
|
||||||
|
// last four bits of the first 32 bit number
|
||||||
|
lowBits |= (middleByte & 0x0F) << 28;
|
||||||
|
// 3 upper bits are part of the next 32 bit number
|
||||||
|
highBits = (middleByte & 0x70) >> 4;
|
||||||
|
if ((middleByte & 0x80) == 0) {
|
||||||
|
this.assertBounds();
|
||||||
|
return [lowBits, highBits];
|
||||||
|
}
|
||||||
|
for (let shift = 3; shift <= 31; shift += 7) {
|
||||||
|
let b = this.buf[this.pos++];
|
||||||
|
highBits |= (b & 0x7F) << shift;
|
||||||
|
if ((b & 0x80) == 0) {
|
||||||
|
this.assertBounds();
|
||||||
|
return [lowBits, highBits];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error('invalid varint');
|
||||||
|
}
|
||||||
|
exports.varint64read = varint64read;
|
||||||
|
/**
|
||||||
|
* Write a 64 bit varint, given as two JS numbers, to the given bytes array.
|
||||||
|
*
|
||||||
|
* Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344
|
||||||
|
*/
|
||||||
|
function varint64write(lo, hi, bytes) {
|
||||||
|
for (let i = 0; i < 28; i = i + 7) {
|
||||||
|
const shift = lo >>> i;
|
||||||
|
const hasNext = !((shift >>> 7) == 0 && hi == 0);
|
||||||
|
const byte = (hasNext ? shift | 0x80 : shift) & 0xFF;
|
||||||
|
bytes.push(byte);
|
||||||
|
if (!hasNext) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const splitBits = ((lo >>> 28) & 0x0F) | ((hi & 0x07) << 4);
|
||||||
|
const hasMoreBits = !((hi >> 3) == 0);
|
||||||
|
bytes.push((hasMoreBits ? splitBits | 0x80 : splitBits) & 0xFF);
|
||||||
|
if (!hasMoreBits) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (let i = 3; i < 31; i = i + 7) {
|
||||||
|
const shift = hi >>> i;
|
||||||
|
const hasNext = !((shift >>> 7) == 0);
|
||||||
|
const byte = (hasNext ? shift | 0x80 : shift) & 0xFF;
|
||||||
|
bytes.push(byte);
|
||||||
|
if (!hasNext) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bytes.push((hi >>> 31) & 0x01);
|
||||||
|
}
|
||||||
|
exports.varint64write = varint64write;
|
||||||
|
// constants for binary math
|
||||||
|
const TWO_PWR_32_DBL = (1 << 16) * (1 << 16);
|
||||||
|
/**
|
||||||
|
* Parse decimal string of 64 bit integer value as two JS numbers.
|
||||||
|
*
|
||||||
|
* Returns tuple:
|
||||||
|
* [0]: minus sign?
|
||||||
|
* [1]: low bits
|
||||||
|
* [2]: high bits
|
||||||
|
*
|
||||||
|
* Copyright 2008 Google Inc.
|
||||||
|
*/
|
||||||
|
function int64fromString(dec) {
|
||||||
|
// Check for minus sign.
|
||||||
|
let minus = dec[0] == '-';
|
||||||
|
if (minus)
|
||||||
|
dec = dec.slice(1);
|
||||||
|
// Work 6 decimal digits at a time, acting like we're converting base 1e6
|
||||||
|
// digits to binary. This is safe to do with floating point math because
|
||||||
|
// Number.isSafeInteger(ALL_32_BITS * 1e6) == true.
|
||||||
|
const base = 1e6;
|
||||||
|
let lowBits = 0;
|
||||||
|
let highBits = 0;
|
||||||
|
function add1e6digit(begin, end) {
|
||||||
|
// Note: Number('') is 0.
|
||||||
|
const digit1e6 = Number(dec.slice(begin, end));
|
||||||
|
highBits *= base;
|
||||||
|
lowBits = lowBits * base + digit1e6;
|
||||||
|
// Carry bits from lowBits to highBits
|
||||||
|
if (lowBits >= TWO_PWR_32_DBL) {
|
||||||
|
highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0);
|
||||||
|
lowBits = lowBits % TWO_PWR_32_DBL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add1e6digit(-24, -18);
|
||||||
|
add1e6digit(-18, -12);
|
||||||
|
add1e6digit(-12, -6);
|
||||||
|
add1e6digit(-6);
|
||||||
|
return [minus, lowBits, highBits];
|
||||||
|
}
|
||||||
|
exports.int64fromString = int64fromString;
|
||||||
|
/**
|
||||||
|
* Format 64 bit integer value (as two JS numbers) to decimal string.
|
||||||
|
*
|
||||||
|
* Copyright 2008 Google Inc.
|
||||||
|
*/
|
||||||
|
function int64toString(bitsLow, bitsHigh) {
|
||||||
|
// Skip the expensive conversion if the number is small enough to use the
|
||||||
|
// built-in conversions.
|
||||||
|
if ((bitsHigh >>> 0) <= 0x1FFFFF) {
|
||||||
|
return '' + (TWO_PWR_32_DBL * bitsHigh + (bitsLow >>> 0));
|
||||||
|
}
|
||||||
|
// What this code is doing is essentially converting the input number from
|
||||||
|
// base-2 to base-1e7, which allows us to represent the 64-bit range with
|
||||||
|
// only 3 (very large) digits. Those digits are then trivial to convert to
|
||||||
|
// a base-10 string.
|
||||||
|
// The magic numbers used here are -
|
||||||
|
// 2^24 = 16777216 = (1,6777216) in base-1e7.
|
||||||
|
// 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7.
|
||||||
|
// Split 32:32 representation into 16:24:24 representation so our
|
||||||
|
// intermediate digits don't overflow.
|
||||||
|
let low = bitsLow & 0xFFFFFF;
|
||||||
|
let mid = (((bitsLow >>> 24) | (bitsHigh << 8)) >>> 0) & 0xFFFFFF;
|
||||||
|
let high = (bitsHigh >> 16) & 0xFFFF;
|
||||||
|
// Assemble our three base-1e7 digits, ignoring carries. The maximum
|
||||||
|
// value in a digit at this step is representable as a 48-bit integer, which
|
||||||
|
// can be stored in a 64-bit floating point number.
|
||||||
|
let digitA = low + (mid * 6777216) + (high * 6710656);
|
||||||
|
let digitB = mid + (high * 8147497);
|
||||||
|
let digitC = (high * 2);
|
||||||
|
// Apply carries from A to B and from B to C.
|
||||||
|
let base = 10000000;
|
||||||
|
if (digitA >= base) {
|
||||||
|
digitB += Math.floor(digitA / base);
|
||||||
|
digitA %= base;
|
||||||
|
}
|
||||||
|
if (digitB >= base) {
|
||||||
|
digitC += Math.floor(digitB / base);
|
||||||
|
digitB %= base;
|
||||||
|
}
|
||||||
|
// Convert base-1e7 digits to base-10, with optional leading zeroes.
|
||||||
|
function decimalFrom1e7(digit1e7, needLeadingZeros) {
|
||||||
|
let partial = digit1e7 ? String(digit1e7) : '';
|
||||||
|
if (needLeadingZeros) {
|
||||||
|
return '0000000'.slice(partial.length) + partial;
|
||||||
|
}
|
||||||
|
return partial;
|
||||||
|
}
|
||||||
|
return decimalFrom1e7(digitC, /*needLeadingZeros=*/ 0) +
|
||||||
|
decimalFrom1e7(digitB, /*needLeadingZeros=*/ digitC) +
|
||||||
|
// If the final 1e7 digit didn't need leading zeros, we would have
|
||||||
|
// returned via the trivial code path at the top.
|
||||||
|
decimalFrom1e7(digitA, /*needLeadingZeros=*/ 1);
|
||||||
|
}
|
||||||
|
exports.int64toString = int64toString;
|
||||||
|
/**
|
||||||
|
* Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`
|
||||||
|
*
|
||||||
|
* Copyright 2008 Google Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144
|
||||||
|
*/
|
||||||
|
function varint32write(value, bytes) {
|
||||||
|
if (value >= 0) {
|
||||||
|
// write value as varint 32
|
||||||
|
while (value > 0x7f) {
|
||||||
|
bytes.push((value & 0x7f) | 0x80);
|
||||||
|
value = value >>> 7;
|
||||||
|
}
|
||||||
|
bytes.push(value);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (let i = 0; i < 9; i++) {
|
||||||
|
bytes.push(value & 127 | 128);
|
||||||
|
value = value >> 7;
|
||||||
|
}
|
||||||
|
bytes.push(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.varint32write = varint32write;
|
||||||
|
/**
|
||||||
|
* Read an unsigned 32 bit varint.
|
||||||
|
*
|
||||||
|
* See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220
|
||||||
|
*/
|
||||||
|
function varint32read() {
|
||||||
|
let b = this.buf[this.pos++];
|
||||||
|
let result = b & 0x7F;
|
||||||
|
if ((b & 0x80) == 0) {
|
||||||
|
this.assertBounds();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
b = this.buf[this.pos++];
|
||||||
|
result |= (b & 0x7F) << 7;
|
||||||
|
if ((b & 0x80) == 0) {
|
||||||
|
this.assertBounds();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
b = this.buf[this.pos++];
|
||||||
|
result |= (b & 0x7F) << 14;
|
||||||
|
if ((b & 0x80) == 0) {
|
||||||
|
this.assertBounds();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
b = this.buf[this.pos++];
|
||||||
|
result |= (b & 0x7F) << 21;
|
||||||
|
if ((b & 0x80) == 0) {
|
||||||
|
this.assertBounds();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// Extract only last 4 bits
|
||||||
|
b = this.buf[this.pos++];
|
||||||
|
result |= (b & 0x0F) << 28;
|
||||||
|
for (let readBytes = 5; ((b & 0x80) !== 0) && readBytes < 10; readBytes++)
|
||||||
|
b = this.buf[this.pos++];
|
||||||
|
if ((b & 0x80) != 0)
|
||||||
|
throw new Error('invalid varint');
|
||||||
|
this.assertBounds();
|
||||||
|
// Result can have 32 bits, convert it to unsigned
|
||||||
|
return result >>> 0;
|
||||||
|
}
|
||||||
|
exports.varint32read = varint32read;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 8886:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Public API of the protobuf-ts runtime.
|
||||||
|
// Note: we do not use `export * from ...` to help tree shakers,
|
||||||
|
// webpack verbose output hints that this should be useful
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
// Convenience JSON typings and corresponding type guards
|
||||||
|
var json_typings_1 = __nccwpck_require__(9999);
|
||||||
|
Object.defineProperty(exports, "typeofJsonValue", ({ enumerable: true, get: function () { return json_typings_1.typeofJsonValue; } }));
|
||||||
|
Object.defineProperty(exports, "isJsonObject", ({ enumerable: true, get: function () { return json_typings_1.isJsonObject; } }));
|
||||||
|
// Base 64 encoding
|
||||||
|
var base64_1 = __nccwpck_require__(6335);
|
||||||
|
Object.defineProperty(exports, "base64decode", ({ enumerable: true, get: function () { return base64_1.base64decode; } }));
|
||||||
|
Object.defineProperty(exports, "base64encode", ({ enumerable: true, get: function () { return base64_1.base64encode; } }));
|
||||||
|
// UTF8 encoding
|
||||||
|
var protobufjs_utf8_1 = __nccwpck_require__(8950);
|
||||||
|
Object.defineProperty(exports, "utf8read", ({ enumerable: true, get: function () { return protobufjs_utf8_1.utf8read; } }));
|
||||||
|
// Binary format contracts, options for reading and writing, for example
|
||||||
|
var binary_format_contract_1 = __nccwpck_require__(4816);
|
||||||
|
Object.defineProperty(exports, "WireType", ({ enumerable: true, get: function () { return binary_format_contract_1.WireType; } }));
|
||||||
|
Object.defineProperty(exports, "mergeBinaryOptions", ({ enumerable: true, get: function () { return binary_format_contract_1.mergeBinaryOptions; } }));
|
||||||
|
Object.defineProperty(exports, "UnknownFieldHandler", ({ enumerable: true, get: function () { return binary_format_contract_1.UnknownFieldHandler; } }));
|
||||||
|
// Standard IBinaryReader implementation
|
||||||
|
var binary_reader_1 = __nccwpck_require__(2889);
|
||||||
|
Object.defineProperty(exports, "BinaryReader", ({ enumerable: true, get: function () { return binary_reader_1.BinaryReader; } }));
|
||||||
|
Object.defineProperty(exports, "binaryReadOptions", ({ enumerable: true, get: function () { return binary_reader_1.binaryReadOptions; } }));
|
||||||
|
// Standard IBinaryWriter implementation
|
||||||
|
var binary_writer_1 = __nccwpck_require__(3957);
|
||||||
|
Object.defineProperty(exports, "BinaryWriter", ({ enumerable: true, get: function () { return binary_writer_1.BinaryWriter; } }));
|
||||||
|
Object.defineProperty(exports, "binaryWriteOptions", ({ enumerable: true, get: function () { return binary_writer_1.binaryWriteOptions; } }));
|
||||||
|
// Int64 and UInt64 implementations required for the binary format
|
||||||
|
var pb_long_1 = __nccwpck_require__(1753);
|
||||||
|
Object.defineProperty(exports, "PbLong", ({ enumerable: true, get: function () { return pb_long_1.PbLong; } }));
|
||||||
|
Object.defineProperty(exports, "PbULong", ({ enumerable: true, get: function () { return pb_long_1.PbULong; } }));
|
||||||
|
// JSON format contracts, options for reading and writing, for example
|
||||||
|
var json_format_contract_1 = __nccwpck_require__(9367);
|
||||||
|
Object.defineProperty(exports, "jsonReadOptions", ({ enumerable: true, get: function () { return json_format_contract_1.jsonReadOptions; } }));
|
||||||
|
Object.defineProperty(exports, "jsonWriteOptions", ({ enumerable: true, get: function () { return json_format_contract_1.jsonWriteOptions; } }));
|
||||||
|
Object.defineProperty(exports, "mergeJsonOptions", ({ enumerable: true, get: function () { return json_format_contract_1.mergeJsonOptions; } }));
|
||||||
|
// Message type contract
|
||||||
|
var message_type_contract_1 = __nccwpck_require__(3785);
|
||||||
|
Object.defineProperty(exports, "MESSAGE_TYPE", ({ enumerable: true, get: function () { return message_type_contract_1.MESSAGE_TYPE; } }));
|
||||||
|
// Message type implementation via reflection
|
||||||
|
var message_type_1 = __nccwpck_require__(5106);
|
||||||
|
Object.defineProperty(exports, "MessageType", ({ enumerable: true, get: function () { return message_type_1.MessageType; } }));
|
||||||
|
// Reflection info, generated by the plugin, exposed to the user, used by reflection ops
|
||||||
|
var reflection_info_1 = __nccwpck_require__(7910);
|
||||||
|
Object.defineProperty(exports, "ScalarType", ({ enumerable: true, get: function () { return reflection_info_1.ScalarType; } }));
|
||||||
|
Object.defineProperty(exports, "LongType", ({ enumerable: true, get: function () { return reflection_info_1.LongType; } }));
|
||||||
|
Object.defineProperty(exports, "RepeatType", ({ enumerable: true, get: function () { return reflection_info_1.RepeatType; } }));
|
||||||
|
Object.defineProperty(exports, "normalizeFieldInfo", ({ enumerable: true, get: function () { return reflection_info_1.normalizeFieldInfo; } }));
|
||||||
|
Object.defineProperty(exports, "readFieldOptions", ({ enumerable: true, get: function () { return reflection_info_1.readFieldOptions; } }));
|
||||||
|
Object.defineProperty(exports, "readFieldOption", ({ enumerable: true, get: function () { return reflection_info_1.readFieldOption; } }));
|
||||||
|
Object.defineProperty(exports, "readMessageOption", ({ enumerable: true, get: function () { return reflection_info_1.readMessageOption; } }));
|
||||||
|
// Message operations via reflection
|
||||||
|
var reflection_type_check_1 = __nccwpck_require__(5167);
|
||||||
|
Object.defineProperty(exports, "ReflectionTypeCheck", ({ enumerable: true, get: function () { return reflection_type_check_1.ReflectionTypeCheck; } }));
|
||||||
|
var reflection_create_1 = __nccwpck_require__(5726);
|
||||||
|
Object.defineProperty(exports, "reflectionCreate", ({ enumerable: true, get: function () { return reflection_create_1.reflectionCreate; } }));
|
||||||
|
var reflection_scalar_default_1 = __nccwpck_require__(9526);
|
||||||
|
Object.defineProperty(exports, "reflectionScalarDefault", ({ enumerable: true, get: function () { return reflection_scalar_default_1.reflectionScalarDefault; } }));
|
||||||
|
var reflection_merge_partial_1 = __nccwpck_require__(8044);
|
||||||
|
Object.defineProperty(exports, "reflectionMergePartial", ({ enumerable: true, get: function () { return reflection_merge_partial_1.reflectionMergePartial; } }));
|
||||||
|
var reflection_equals_1 = __nccwpck_require__(4827);
|
||||||
|
Object.defineProperty(exports, "reflectionEquals", ({ enumerable: true, get: function () { return reflection_equals_1.reflectionEquals; } }));
|
||||||
|
var reflection_binary_reader_1 = __nccwpck_require__(9611);
|
||||||
|
Object.defineProperty(exports, "ReflectionBinaryReader", ({ enumerable: true, get: function () { return reflection_binary_reader_1.ReflectionBinaryReader; } }));
|
||||||
|
var reflection_binary_writer_1 = __nccwpck_require__(6907);
|
||||||
|
Object.defineProperty(exports, "ReflectionBinaryWriter", ({ enumerable: true, get: function () { return reflection_binary_writer_1.ReflectionBinaryWriter; } }));
|
||||||
|
var reflection_json_reader_1 = __nccwpck_require__(6790);
|
||||||
|
Object.defineProperty(exports, "ReflectionJsonReader", ({ enumerable: true, get: function () { return reflection_json_reader_1.ReflectionJsonReader; } }));
|
||||||
|
var reflection_json_writer_1 = __nccwpck_require__(1094);
|
||||||
|
Object.defineProperty(exports, "ReflectionJsonWriter", ({ enumerable: true, get: function () { return reflection_json_writer_1.ReflectionJsonWriter; } }));
|
||||||
|
var reflection_contains_message_type_1 = __nccwpck_require__(7565);
|
||||||
|
Object.defineProperty(exports, "containsMessageType", ({ enumerable: true, get: function () { return reflection_contains_message_type_1.containsMessageType; } }));
|
||||||
|
// Oneof helpers
|
||||||
|
var oneof_1 = __nccwpck_require__(8063);
|
||||||
|
Object.defineProperty(exports, "isOneofGroup", ({ enumerable: true, get: function () { return oneof_1.isOneofGroup; } }));
|
||||||
|
Object.defineProperty(exports, "setOneofValue", ({ enumerable: true, get: function () { return oneof_1.setOneofValue; } }));
|
||||||
|
Object.defineProperty(exports, "getOneofValue", ({ enumerable: true, get: function () { return oneof_1.getOneofValue; } }));
|
||||||
|
Object.defineProperty(exports, "clearOneofValue", ({ enumerable: true, get: function () { return oneof_1.clearOneofValue; } }));
|
||||||
|
Object.defineProperty(exports, "getSelectedOneofValue", ({ enumerable: true, get: function () { return oneof_1.getSelectedOneofValue; } }));
|
||||||
|
// Enum object type guard and reflection util, may be interesting to the user.
|
||||||
|
var enum_object_1 = __nccwpck_require__(257);
|
||||||
|
Object.defineProperty(exports, "listEnumValues", ({ enumerable: true, get: function () { return enum_object_1.listEnumValues; } }));
|
||||||
|
Object.defineProperty(exports, "listEnumNames", ({ enumerable: true, get: function () { return enum_object_1.listEnumNames; } }));
|
||||||
|
Object.defineProperty(exports, "listEnumNumbers", ({ enumerable: true, get: function () { return enum_object_1.listEnumNumbers; } }));
|
||||||
|
Object.defineProperty(exports, "isEnumObject", ({ enumerable: true, get: function () { return enum_object_1.isEnumObject; } }));
|
||||||
|
// lowerCamelCase() is exported for plugin, rpc-runtime and other rpc packages
|
||||||
|
var lower_camel_case_1 = __nccwpck_require__(4073);
|
||||||
|
Object.defineProperty(exports, "lowerCamelCase", ({ enumerable: true, get: function () { return lower_camel_case_1.lowerCamelCase; } }));
|
||||||
|
// assertion functions are exported for plugin, may also be useful to user
|
||||||
|
var assert_1 = __nccwpck_require__(8602);
|
||||||
|
Object.defineProperty(exports, "assert", ({ enumerable: true, get: function () { return assert_1.assert; } }));
|
||||||
|
Object.defineProperty(exports, "assertNever", ({ enumerable: true, get: function () { return assert_1.assertNever; } }));
|
||||||
|
Object.defineProperty(exports, "assertInt32", ({ enumerable: true, get: function () { return assert_1.assertInt32; } }));
|
||||||
|
Object.defineProperty(exports, "assertUInt32", ({ enumerable: true, get: function () { return assert_1.assertUInt32; } }));
|
||||||
|
Object.defineProperty(exports, "assertFloat32", ({ enumerable: true, get: function () { return assert_1.assertFloat32; } }));
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 9367:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.mergeJsonOptions = exports.jsonWriteOptions = exports.jsonReadOptions = void 0;
|
||||||
|
const defaultsWrite = {
|
||||||
|
emitDefaultValues: false,
|
||||||
|
enumAsInteger: false,
|
||||||
|
useProtoFieldName: false,
|
||||||
|
prettySpaces: 0,
|
||||||
|
}, defaultsRead = {
|
||||||
|
ignoreUnknownFields: false,
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Make options for reading JSON data from partial options.
|
||||||
|
*/
|
||||||
|
function jsonReadOptions(options) {
|
||||||
|
return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;
|
||||||
|
}
|
||||||
|
exports.jsonReadOptions = jsonReadOptions;
|
||||||
|
/**
|
||||||
|
* Make options for writing JSON data from partial options.
|
||||||
|
*/
|
||||||
|
function jsonWriteOptions(options) {
|
||||||
|
return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;
|
||||||
|
}
|
||||||
|
exports.jsonWriteOptions = jsonWriteOptions;
|
||||||
|
/**
|
||||||
|
* Merges JSON write or read options. Later values override earlier values. Type registries are merged.
|
||||||
|
*/
|
||||||
|
function mergeJsonOptions(a, b) {
|
||||||
|
var _a, _b;
|
||||||
|
let c = Object.assign(Object.assign({}, a), b);
|
||||||
|
c.typeRegistry = [...((_a = a === null || a === void 0 ? void 0 : a.typeRegistry) !== null && _a !== void 0 ? _a : []), ...((_b = b === null || b === void 0 ? void 0 : b.typeRegistry) !== null && _b !== void 0 ? _b : [])];
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
exports.mergeJsonOptions = mergeJsonOptions;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 9999:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.isJsonObject = exports.typeofJsonValue = void 0;
|
||||||
|
/**
|
||||||
|
* Get the type of a JSON value.
|
||||||
|
* Distinguishes between array, null and object.
|
||||||
|
*/
|
||||||
|
function typeofJsonValue(value) {
|
||||||
|
let t = typeof value;
|
||||||
|
if (t == "object") {
|
||||||
|
if (Array.isArray(value))
|
||||||
|
return "array";
|
||||||
|
if (value === null)
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
exports.typeofJsonValue = typeofJsonValue;
|
||||||
|
/**
|
||||||
|
* Is this a JSON object (instead of an array or null)?
|
||||||
|
*/
|
||||||
|
function isJsonObject(value) {
|
||||||
|
return value !== null && typeof value == "object" && !Array.isArray(value);
|
||||||
|
}
|
||||||
|
exports.isJsonObject = isJsonObject;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 4073:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.lowerCamelCase = void 0;
|
||||||
|
/**
|
||||||
|
* Converts snake_case to lowerCamelCase.
|
||||||
|
*
|
||||||
|
* Should behave like protoc:
|
||||||
|
* https://github.com/protocolbuffers/protobuf/blob/e8ae137c96444ea313485ed1118c5e43b2099cf1/src/google/protobuf/compiler/java/java_helpers.cc#L118
|
||||||
|
*/
|
||||||
|
function lowerCamelCase(snakeCase) {
|
||||||
|
let capNext = false;
|
||||||
|
const sb = [];
|
||||||
|
for (let i = 0; i < snakeCase.length; i++) {
|
||||||
|
let next = snakeCase.charAt(i);
|
||||||
|
if (next == '_') {
|
||||||
|
capNext = true;
|
||||||
|
}
|
||||||
|
else if (/\d/.test(next)) {
|
||||||
|
sb.push(next);
|
||||||
|
capNext = true;
|
||||||
|
}
|
||||||
|
else if (capNext) {
|
||||||
|
sb.push(next.toUpperCase());
|
||||||
|
capNext = false;
|
||||||
|
}
|
||||||
|
else if (i == 0) {
|
||||||
|
sb.push(next.toLowerCase());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sb.push(next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.join('');
|
||||||
|
}
|
||||||
|
exports.lowerCamelCase = lowerCamelCase;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 3785:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.MESSAGE_TYPE = void 0;
|
||||||
|
/**
|
||||||
|
* The symbol used as a key on message objects to store the message type.
|
||||||
|
*
|
||||||
|
* Note that this is an experimental feature - it is here to stay, but
|
||||||
|
* implementation details may change without notice.
|
||||||
|
*/
|
||||||
|
exports.MESSAGE_TYPE = Symbol.for("protobuf-ts/message-type");
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 5106:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.MessageType = void 0;
|
||||||
|
const message_type_contract_1 = __nccwpck_require__(3785);
|
||||||
|
const reflection_info_1 = __nccwpck_require__(7910);
|
||||||
|
const reflection_type_check_1 = __nccwpck_require__(5167);
|
||||||
|
const reflection_json_reader_1 = __nccwpck_require__(6790);
|
||||||
|
const reflection_json_writer_1 = __nccwpck_require__(1094);
|
||||||
|
const reflection_binary_reader_1 = __nccwpck_require__(9611);
|
||||||
|
const reflection_binary_writer_1 = __nccwpck_require__(6907);
|
||||||
|
const reflection_create_1 = __nccwpck_require__(5726);
|
||||||
|
const reflection_merge_partial_1 = __nccwpck_require__(8044);
|
||||||
|
const json_typings_1 = __nccwpck_require__(9999);
|
||||||
|
const json_format_contract_1 = __nccwpck_require__(9367);
|
||||||
|
const reflection_equals_1 = __nccwpck_require__(4827);
|
||||||
|
const binary_writer_1 = __nccwpck_require__(3957);
|
||||||
|
const binary_reader_1 = __nccwpck_require__(2889);
|
||||||
|
const baseDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));
|
||||||
|
/**
|
||||||
|
* This standard message type provides reflection-based
|
||||||
|
* operations to work with a message.
|
||||||
|
*/
|
||||||
|
class MessageType {
|
||||||
|
constructor(name, fields, options) {
|
||||||
|
this.defaultCheckDepth = 16;
|
||||||
|
this.typeName = name;
|
||||||
|
this.fields = fields.map(reflection_info_1.normalizeFieldInfo);
|
||||||
|
this.options = options !== null && options !== void 0 ? options : {};
|
||||||
|
this.messagePrototype = Object.create(null, Object.assign(Object.assign({}, baseDescriptors), { [message_type_contract_1.MESSAGE_TYPE]: { value: this } }));
|
||||||
|
this.refTypeCheck = new reflection_type_check_1.ReflectionTypeCheck(this);
|
||||||
|
this.refJsonReader = new reflection_json_reader_1.ReflectionJsonReader(this);
|
||||||
|
this.refJsonWriter = new reflection_json_writer_1.ReflectionJsonWriter(this);
|
||||||
|
this.refBinReader = new reflection_binary_reader_1.ReflectionBinaryReader(this);
|
||||||
|
this.refBinWriter = new reflection_binary_writer_1.ReflectionBinaryWriter(this);
|
||||||
|
}
|
||||||
|
create(value) {
|
||||||
|
let message = reflection_create_1.reflectionCreate(this);
|
||||||
|
if (value !== undefined) {
|
||||||
|
reflection_merge_partial_1.reflectionMergePartial(this, message, value);
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Clone the message.
|
||||||
|
*
|
||||||
|
* Unknown fields are discarded.
|
||||||
|
*/
|
||||||
|
clone(message) {
|
||||||
|
let copy = this.create();
|
||||||
|
reflection_merge_partial_1.reflectionMergePartial(this, copy, message);
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Determines whether two message of the same type have the same field values.
|
||||||
|
* Checks for deep equality, traversing repeated fields, oneof groups, maps
|
||||||
|
* and messages recursively.
|
||||||
|
* Will also return true if both messages are `undefined`.
|
||||||
|
*/
|
||||||
|
equals(a, b) {
|
||||||
|
return reflection_equals_1.reflectionEquals(this, a, b);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Is the given value assignable to our message type
|
||||||
|
* and contains no [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?
|
||||||
|
*/
|
||||||
|
is(arg, depth = this.defaultCheckDepth) {
|
||||||
|
return this.refTypeCheck.is(arg, depth, false);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Is the given value assignable to our message type,
|
||||||
|
* regardless of [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?
|
||||||
|
*/
|
||||||
|
isAssignable(arg, depth = this.defaultCheckDepth) {
|
||||||
|
return this.refTypeCheck.is(arg, depth, true);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Copy partial data into the target message.
|
||||||
|
*/
|
||||||
|
mergePartial(target, source) {
|
||||||
|
reflection_merge_partial_1.reflectionMergePartial(this, target, source);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Create a new message from binary format.
|
||||||
|
*/
|
||||||
|
fromBinary(data, options) {
|
||||||
|
let opt = binary_reader_1.binaryReadOptions(options);
|
||||||
|
return this.internalBinaryRead(opt.readerFactory(data), data.byteLength, opt);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a new message from a JSON value.
|
||||||
|
*/
|
||||||
|
fromJson(json, options) {
|
||||||
|
return this.internalJsonRead(json, json_format_contract_1.jsonReadOptions(options));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a new message from a JSON string.
|
||||||
|
* This is equivalent to `T.fromJson(JSON.parse(json))`.
|
||||||
|
*/
|
||||||
|
fromJsonString(json, options) {
|
||||||
|
let value = JSON.parse(json);
|
||||||
|
return this.fromJson(value, options);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write the message to canonical JSON value.
|
||||||
|
*/
|
||||||
|
toJson(message, options) {
|
||||||
|
return this.internalJsonWrite(message, json_format_contract_1.jsonWriteOptions(options));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Convert the message to canonical JSON string.
|
||||||
|
* This is equivalent to `JSON.stringify(T.toJson(t))`
|
||||||
|
*/
|
||||||
|
toJsonString(message, options) {
|
||||||
|
var _a;
|
||||||
|
let value = this.toJson(message, options);
|
||||||
|
return JSON.stringify(value, null, (_a = options === null || options === void 0 ? void 0 : options.prettySpaces) !== null && _a !== void 0 ? _a : 0);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write the message to binary format.
|
||||||
|
*/
|
||||||
|
toBinary(message, options) {
|
||||||
|
let opt = binary_writer_1.binaryWriteOptions(options);
|
||||||
|
return this.internalBinaryWrite(message, opt.writerFactory(), opt).finish();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is an internal method. If you just want to read a message from
|
||||||
|
* JSON, use `fromJson()` or `fromJsonString()`.
|
||||||
|
*
|
||||||
|
* Reads JSON value and merges the fields into the target
|
||||||
|
* according to protobuf rules. If the target is omitted,
|
||||||
|
* a new instance is created first.
|
||||||
|
*/
|
||||||
|
internalJsonRead(json, options, target) {
|
||||||
|
if (json !== null && typeof json == "object" && !Array.isArray(json)) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create();
|
||||||
|
this.refJsonReader.read(json, message, options);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
throw new Error(`Unable to parse message ${this.typeName} from JSON ${json_typings_1.typeofJsonValue(json)}.`);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is an internal method. If you just want to write a message
|
||||||
|
* to JSON, use `toJson()` or `toJsonString().
|
||||||
|
*
|
||||||
|
* Writes JSON value and returns it.
|
||||||
|
*/
|
||||||
|
internalJsonWrite(message, options) {
|
||||||
|
return this.refJsonWriter.write(message, options);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is an internal method. If you just want to write a message
|
||||||
|
* in binary format, use `toBinary()`.
|
||||||
|
*
|
||||||
|
* Serializes the message in binary format and appends it to the given
|
||||||
|
* writer. Returns passed writer.
|
||||||
|
*/
|
||||||
|
internalBinaryWrite(message, writer, options) {
|
||||||
|
this.refBinWriter.write(message, writer, options);
|
||||||
|
return writer;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is an internal method. If you just want to read a message from
|
||||||
|
* binary data, use `fromBinary()`.
|
||||||
|
*
|
||||||
|
* Reads data from binary format and merges the fields into
|
||||||
|
* the target according to protobuf rules. If the target is
|
||||||
|
* omitted, a new instance is created first.
|
||||||
|
*/
|
||||||
|
internalBinaryRead(reader, length, options, target) {
|
||||||
|
let message = target !== null && target !== void 0 ? target : this.create();
|
||||||
|
this.refBinReader.read(reader, message, options, length);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.MessageType = MessageType;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 8063:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.getSelectedOneofValue = exports.clearOneofValue = exports.setUnknownOneofValue = exports.setOneofValue = exports.getOneofValue = exports.isOneofGroup = void 0;
|
||||||
|
/**
|
||||||
|
* Is the given value a valid oneof group?
|
||||||
|
*
|
||||||
|
* We represent protobuf `oneof` as algebraic data types (ADT) in generated
|
||||||
|
* code. But when working with messages of unknown type, the ADT does not
|
||||||
|
* help us.
|
||||||
|
*
|
||||||
|
* This type guard checks if the given object adheres to the ADT rules, which
|
||||||
|
* are as follows:
|
||||||
|
*
|
||||||
|
* 1) Must be an object.
|
||||||
|
*
|
||||||
|
* 2) Must have a "oneofKind" discriminator property.
|
||||||
|
*
|
||||||
|
* 3) If "oneofKind" is `undefined`, no member field is selected. The object
|
||||||
|
* must not have any other properties.
|
||||||
|
*
|
||||||
|
* 4) If "oneofKind" is a `string`, the member field with this name is
|
||||||
|
* selected.
|
||||||
|
*
|
||||||
|
* 5) If a member field is selected, the object must have a second property
|
||||||
|
* with this name. The property must not be `undefined`.
|
||||||
|
*
|
||||||
|
* 6) No extra properties are allowed. The object has either one property
|
||||||
|
* (no selection) or two properties (selection).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function isOneofGroup(any) {
|
||||||
|
if (typeof any != 'object' || any === null || !any.hasOwnProperty('oneofKind')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch (typeof any.oneofKind) {
|
||||||
|
case "string":
|
||||||
|
if (any[any.oneofKind] === undefined)
|
||||||
|
return false;
|
||||||
|
return Object.keys(any).length == 2;
|
||||||
|
case "undefined":
|
||||||
|
return Object.keys(any).length == 1;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.isOneofGroup = isOneofGroup;
|
||||||
|
/**
|
||||||
|
* Returns the value of the given field in a oneof group.
|
||||||
|
*/
|
||||||
|
function getOneofValue(oneof, kind) {
|
||||||
|
return oneof[kind];
|
||||||
|
}
|
||||||
|
exports.getOneofValue = getOneofValue;
|
||||||
|
function setOneofValue(oneof, kind, value) {
|
||||||
|
if (oneof.oneofKind !== undefined) {
|
||||||
|
delete oneof[oneof.oneofKind];
|
||||||
|
}
|
||||||
|
oneof.oneofKind = kind;
|
||||||
|
if (value !== undefined) {
|
||||||
|
oneof[kind] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.setOneofValue = setOneofValue;
|
||||||
|
function setUnknownOneofValue(oneof, kind, value) {
|
||||||
|
if (oneof.oneofKind !== undefined) {
|
||||||
|
delete oneof[oneof.oneofKind];
|
||||||
|
}
|
||||||
|
oneof.oneofKind = kind;
|
||||||
|
if (value !== undefined && kind !== undefined) {
|
||||||
|
oneof[kind] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.setUnknownOneofValue = setUnknownOneofValue;
|
||||||
|
/**
|
||||||
|
* Removes the selected field in a oneof group.
|
||||||
|
*
|
||||||
|
* Note that the recommended way to modify a oneof group is to set
|
||||||
|
* a new object:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* message.result = { oneofKind: undefined };
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
function clearOneofValue(oneof) {
|
||||||
|
if (oneof.oneofKind !== undefined) {
|
||||||
|
delete oneof[oneof.oneofKind];
|
||||||
|
}
|
||||||
|
oneof.oneofKind = undefined;
|
||||||
|
}
|
||||||
|
exports.clearOneofValue = clearOneofValue;
|
||||||
|
/**
|
||||||
|
* Returns the selected value of the given oneof group.
|
||||||
|
*
|
||||||
|
* Not that the recommended way to access a oneof group is to check
|
||||||
|
* the "oneofKind" property and let TypeScript narrow down the union
|
||||||
|
* type for you:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* if (message.result.oneofKind === "error") {
|
||||||
|
* message.result.error; // string
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* In the rare case you just need the value, and do not care about
|
||||||
|
* which protobuf field is selected, you can use this function
|
||||||
|
* for convenience.
|
||||||
|
*/
|
||||||
|
function getSelectedOneofValue(oneof) {
|
||||||
|
if (oneof.oneofKind === undefined) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return oneof[oneof.oneofKind];
|
||||||
|
}
|
||||||
|
exports.getSelectedOneofValue = getSelectedOneofValue;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 1753:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.PbLong = exports.PbULong = exports.detectBi = void 0;
|
||||||
|
const goog_varint_1 = __nccwpck_require__(3223);
|
||||||
|
let BI;
|
||||||
|
function detectBi() {
|
||||||
|
const dv = new DataView(new ArrayBuffer(8));
|
||||||
|
const ok = globalThis.BigInt !== undefined
|
||||||
|
&& typeof dv.getBigInt64 === "function"
|
||||||
|
&& typeof dv.getBigUint64 === "function"
|
||||||
|
&& typeof dv.setBigInt64 === "function"
|
||||||
|
&& typeof dv.setBigUint64 === "function";
|
||||||
|
BI = ok ? {
|
||||||
|
MIN: BigInt("-9223372036854775808"),
|
||||||
|
MAX: BigInt("9223372036854775807"),
|
||||||
|
UMIN: BigInt("0"),
|
||||||
|
UMAX: BigInt("18446744073709551615"),
|
||||||
|
C: BigInt,
|
||||||
|
V: dv,
|
||||||
|
} : undefined;
|
||||||
|
}
|
||||||
|
exports.detectBi = detectBi;
|
||||||
|
detectBi();
|
||||||
|
function assertBi(bi) {
|
||||||
|
if (!bi)
|
||||||
|
throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support");
|
||||||
|
}
|
||||||
|
// used to validate from(string) input (when bigint is unavailable)
|
||||||
|
const RE_DECIMAL_STR = /^-?[0-9]+$/;
|
||||||
|
// constants for binary math
|
||||||
|
const TWO_PWR_32_DBL = 0x100000000;
|
||||||
|
const HALF_2_PWR_32 = 0x080000000;
|
||||||
|
// base class for PbLong and PbULong provides shared code
|
||||||
|
class SharedPbLong {
|
||||||
|
/**
|
||||||
|
* Create a new instance with the given bits.
|
||||||
|
*/
|
||||||
|
constructor(lo, hi) {
|
||||||
|
this.lo = lo | 0;
|
||||||
|
this.hi = hi | 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Is this instance equal to 0?
|
||||||
|
*/
|
||||||
|
isZero() {
|
||||||
|
return this.lo == 0 && this.hi == 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Convert to a native number.
|
||||||
|
*/
|
||||||
|
toNumber() {
|
||||||
|
let result = this.hi * TWO_PWR_32_DBL + (this.lo >>> 0);
|
||||||
|
if (!Number.isSafeInteger(result))
|
||||||
|
throw new Error("cannot convert to safe number");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 64-bit unsigned integer as two 32-bit values.
|
||||||
|
* Converts between `string`, `number` and `bigint` representations.
|
||||||
|
*/
|
||||||
|
class PbULong extends SharedPbLong {
|
||||||
|
/**
|
||||||
|
* Create instance from a `string`, `number` or `bigint`.
|
||||||
|
*/
|
||||||
|
static from(value) {
|
||||||
|
if (BI)
|
||||||
|
// noinspection FallThroughInSwitchStatementJS
|
||||||
|
switch (typeof value) {
|
||||||
|
case "string":
|
||||||
|
if (value == "0")
|
||||||
|
return this.ZERO;
|
||||||
|
if (value == "")
|
||||||
|
throw new Error('string is no integer');
|
||||||
|
value = BI.C(value);
|
||||||
|
case "number":
|
||||||
|
if (value === 0)
|
||||||
|
return this.ZERO;
|
||||||
|
value = BI.C(value);
|
||||||
|
case "bigint":
|
||||||
|
if (!value)
|
||||||
|
return this.ZERO;
|
||||||
|
if (value < BI.UMIN)
|
||||||
|
throw new Error('signed value for ulong');
|
||||||
|
if (value > BI.UMAX)
|
||||||
|
throw new Error('ulong too large');
|
||||||
|
BI.V.setBigUint64(0, value, true);
|
||||||
|
return new PbULong(BI.V.getInt32(0, true), BI.V.getInt32(4, true));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
switch (typeof value) {
|
||||||
|
case "string":
|
||||||
|
if (value == "0")
|
||||||
|
return this.ZERO;
|
||||||
|
value = value.trim();
|
||||||
|
if (!RE_DECIMAL_STR.test(value))
|
||||||
|
throw new Error('string is no integer');
|
||||||
|
let [minus, lo, hi] = goog_varint_1.int64fromString(value);
|
||||||
|
if (minus)
|
||||||
|
throw new Error('signed value for ulong');
|
||||||
|
return new PbULong(lo, hi);
|
||||||
|
case "number":
|
||||||
|
if (value == 0)
|
||||||
|
return this.ZERO;
|
||||||
|
if (!Number.isSafeInteger(value))
|
||||||
|
throw new Error('number is no integer');
|
||||||
|
if (value < 0)
|
||||||
|
throw new Error('signed value for ulong');
|
||||||
|
return new PbULong(value, value / TWO_PWR_32_DBL);
|
||||||
|
}
|
||||||
|
throw new Error('unknown value ' + typeof value);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Convert to decimal string.
|
||||||
|
*/
|
||||||
|
toString() {
|
||||||
|
return BI ? this.toBigInt().toString() : goog_varint_1.int64toString(this.lo, this.hi);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Convert to native bigint.
|
||||||
|
*/
|
||||||
|
toBigInt() {
|
||||||
|
assertBi(BI);
|
||||||
|
BI.V.setInt32(0, this.lo, true);
|
||||||
|
BI.V.setInt32(4, this.hi, true);
|
||||||
|
return BI.V.getBigUint64(0, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.PbULong = PbULong;
|
||||||
|
/**
|
||||||
|
* ulong 0 singleton.
|
||||||
|
*/
|
||||||
|
PbULong.ZERO = new PbULong(0, 0);
|
||||||
|
/**
|
||||||
|
* 64-bit signed integer as two 32-bit values.
|
||||||
|
* Converts between `string`, `number` and `bigint` representations.
|
||||||
|
*/
|
||||||
|
class PbLong extends SharedPbLong {
|
||||||
|
/**
|
||||||
|
* Create instance from a `string`, `number` or `bigint`.
|
||||||
|
*/
|
||||||
|
static from(value) {
|
||||||
|
if (BI)
|
||||||
|
// noinspection FallThroughInSwitchStatementJS
|
||||||
|
switch (typeof value) {
|
||||||
|
case "string":
|
||||||
|
if (value == "0")
|
||||||
|
return this.ZERO;
|
||||||
|
if (value == "")
|
||||||
|
throw new Error('string is no integer');
|
||||||
|
value = BI.C(value);
|
||||||
|
case "number":
|
||||||
|
if (value === 0)
|
||||||
|
return this.ZERO;
|
||||||
|
value = BI.C(value);
|
||||||
|
case "bigint":
|
||||||
|
if (!value)
|
||||||
|
return this.ZERO;
|
||||||
|
if (value < BI.MIN)
|
||||||
|
throw new Error('signed long too small');
|
||||||
|
if (value > BI.MAX)
|
||||||
|
throw new Error('signed long too large');
|
||||||
|
BI.V.setBigInt64(0, value, true);
|
||||||
|
return new PbLong(BI.V.getInt32(0, true), BI.V.getInt32(4, true));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
switch (typeof value) {
|
||||||
|
case "string":
|
||||||
|
if (value == "0")
|
||||||
|
return this.ZERO;
|
||||||
|
value = value.trim();
|
||||||
|
if (!RE_DECIMAL_STR.test(value))
|
||||||
|
throw new Error('string is no integer');
|
||||||
|
let [minus, lo, hi] = goog_varint_1.int64fromString(value);
|
||||||
|
if (minus) {
|
||||||
|
if (hi > HALF_2_PWR_32 || (hi == HALF_2_PWR_32 && lo != 0))
|
||||||
|
throw new Error('signed long too small');
|
||||||
|
}
|
||||||
|
else if (hi >= HALF_2_PWR_32)
|
||||||
|
throw new Error('signed long too large');
|
||||||
|
let pbl = new PbLong(lo, hi);
|
||||||
|
return minus ? pbl.negate() : pbl;
|
||||||
|
case "number":
|
||||||
|
if (value == 0)
|
||||||
|
return this.ZERO;
|
||||||
|
if (!Number.isSafeInteger(value))
|
||||||
|
throw new Error('number is no integer');
|
||||||
|
return value > 0
|
||||||
|
? new PbLong(value, value / TWO_PWR_32_DBL)
|
||||||
|
: new PbLong(-value, -value / TWO_PWR_32_DBL).negate();
|
||||||
|
}
|
||||||
|
throw new Error('unknown value ' + typeof value);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Do we have a minus sign?
|
||||||
|
*/
|
||||||
|
isNegative() {
|
||||||
|
return (this.hi & HALF_2_PWR_32) !== 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Negate two's complement.
|
||||||
|
* Invert all the bits and add one to the result.
|
||||||
|
*/
|
||||||
|
negate() {
|
||||||
|
let hi = ~this.hi, lo = this.lo;
|
||||||
|
if (lo)
|
||||||
|
lo = ~lo + 1;
|
||||||
|
else
|
||||||
|
hi += 1;
|
||||||
|
return new PbLong(lo, hi);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Convert to decimal string.
|
||||||
|
*/
|
||||||
|
toString() {
|
||||||
|
if (BI)
|
||||||
|
return this.toBigInt().toString();
|
||||||
|
if (this.isNegative()) {
|
||||||
|
let n = this.negate();
|
||||||
|
return '-' + goog_varint_1.int64toString(n.lo, n.hi);
|
||||||
|
}
|
||||||
|
return goog_varint_1.int64toString(this.lo, this.hi);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Convert to native bigint.
|
||||||
|
*/
|
||||||
|
toBigInt() {
|
||||||
|
assertBi(BI);
|
||||||
|
BI.V.setInt32(0, this.lo, true);
|
||||||
|
BI.V.setInt32(4, this.hi, true);
|
||||||
|
return BI.V.getBigInt64(0, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.PbLong = PbLong;
|
||||||
|
/**
|
||||||
|
* long 0 singleton.
|
||||||
|
*/
|
||||||
|
PbLong.ZERO = new PbLong(0, 0);
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 8950:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Copyright (c) 2016, Daniel Wirtz All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the distribution.
|
||||||
|
// * Neither the name of its author, nor the names of its contributors
|
||||||
|
// may be used to endorse or promote products derived from this software
|
||||||
|
// without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.utf8read = void 0;
|
||||||
|
const fromCharCodes = (chunk) => String.fromCharCode.apply(String, chunk);
|
||||||
|
/**
|
||||||
|
* @deprecated This function will no longer be exported with the next major
|
||||||
|
* release, since protobuf-ts has switch to TextDecoder API. If you need this
|
||||||
|
* function, please migrate to @protobufjs/utf8. For context, see
|
||||||
|
* https://github.com/timostamm/protobuf-ts/issues/184
|
||||||
|
*
|
||||||
|
* Reads UTF8 bytes as a string.
|
||||||
|
*
|
||||||
|
* See [protobufjs / utf8](https://github.com/protobufjs/protobuf.js/blob/9893e35b854621cce64af4bf6be2cff4fb892796/lib/utf8/index.js#L40)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016, Daniel Wirtz
|
||||||
|
*/
|
||||||
|
function utf8read(bytes) {
|
||||||
|
if (bytes.length < 1)
|
||||||
|
return "";
|
||||||
|
let pos = 0, // position in bytes
|
||||||
|
parts = [], chunk = [], i = 0, // char offset
|
||||||
|
t; // temporary
|
||||||
|
let len = bytes.length;
|
||||||
|
while (pos < len) {
|
||||||
|
t = bytes[pos++];
|
||||||
|
if (t < 128)
|
||||||
|
chunk[i++] = t;
|
||||||
|
else if (t > 191 && t < 224)
|
||||||
|
chunk[i++] = (t & 31) << 6 | bytes[pos++] & 63;
|
||||||
|
else if (t > 239 && t < 365) {
|
||||||
|
t = ((t & 7) << 18 | (bytes[pos++] & 63) << 12 | (bytes[pos++] & 63) << 6 | bytes[pos++] & 63) - 0x10000;
|
||||||
|
chunk[i++] = 0xD800 + (t >> 10);
|
||||||
|
chunk[i++] = 0xDC00 + (t & 1023);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
chunk[i++] = (t & 15) << 12 | (bytes[pos++] & 63) << 6 | bytes[pos++] & 63;
|
||||||
|
if (i > 8191) {
|
||||||
|
parts.push(fromCharCodes(chunk));
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (parts.length) {
|
||||||
|
if (i)
|
||||||
|
parts.push(fromCharCodes(chunk.slice(0, i)));
|
||||||
|
return parts.join("");
|
||||||
|
}
|
||||||
|
return fromCharCodes(chunk.slice(0, i));
|
||||||
|
}
|
||||||
|
exports.utf8read = utf8read;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 9611:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.ReflectionBinaryReader = void 0;
|
||||||
|
const binary_format_contract_1 = __nccwpck_require__(4816);
|
||||||
|
const reflection_info_1 = __nccwpck_require__(7910);
|
||||||
|
const reflection_long_convert_1 = __nccwpck_require__(3402);
|
||||||
|
const reflection_scalar_default_1 = __nccwpck_require__(9526);
|
||||||
|
/**
|
||||||
|
* Reads proto3 messages in binary format using reflection information.
|
||||||
|
*
|
||||||
|
* https://developers.google.com/protocol-buffers/docs/encoding
|
||||||
|
*/
|
||||||
|
class ReflectionBinaryReader {
|
||||||
|
constructor(info) {
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
prepare() {
|
||||||
|
var _a;
|
||||||
|
if (!this.fieldNoToField) {
|
||||||
|
const fieldsInput = (_a = this.info.fields) !== null && _a !== void 0 ? _a : [];
|
||||||
|
this.fieldNoToField = new Map(fieldsInput.map(field => [field.no, field]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Reads a message from binary format into the target message.
|
||||||
|
*
|
||||||
|
* Repeated fields are appended. Map entries are added, overwriting
|
||||||
|
* existing keys.
|
||||||
|
*
|
||||||
|
* If a message field is already present, it will be merged with the
|
||||||
|
* new data.
|
||||||
|
*/
|
||||||
|
read(reader, message, options, length) {
|
||||||
|
this.prepare();
|
||||||
|
const end = length === undefined ? reader.len : reader.pos + length;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
// read the tag and find the field
|
||||||
|
const [fieldNo, wireType] = reader.tag(), field = this.fieldNoToField.get(fieldNo);
|
||||||
|
if (!field) {
|
||||||
|
let u = options.readUnknownField;
|
||||||
|
if (u == "throw")
|
||||||
|
throw new Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.info.typeName}`);
|
||||||
|
let d = reader.skip(wireType);
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? binary_format_contract_1.UnknownFieldHandler.onRead : u)(this.info.typeName, message, fieldNo, wireType, d);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// target object for the field we are reading
|
||||||
|
let target = message, repeated = field.repeat, localName = field.localName;
|
||||||
|
// if field is member of oneof ADT, use ADT as target
|
||||||
|
if (field.oneof) {
|
||||||
|
target = target[field.oneof];
|
||||||
|
// if other oneof member selected, set new ADT
|
||||||
|
if (target.oneofKind !== localName)
|
||||||
|
target = message[field.oneof] = {
|
||||||
|
oneofKind: localName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// we have handled oneof above, we just have read the value into `target[localName]`
|
||||||
|
switch (field.kind) {
|
||||||
|
case "scalar":
|
||||||
|
case "enum":
|
||||||
|
let T = field.kind == "enum" ? reflection_info_1.ScalarType.INT32 : field.T;
|
||||||
|
let L = field.kind == "scalar" ? field.L : undefined;
|
||||||
|
if (repeated) {
|
||||||
|
let arr = target[localName]; // safe to assume presence of array, oneof cannot contain repeated values
|
||||||
|
if (wireType == binary_format_contract_1.WireType.LengthDelimited && T != reflection_info_1.ScalarType.STRING && T != reflection_info_1.ScalarType.BYTES) {
|
||||||
|
let e = reader.uint32() + reader.pos;
|
||||||
|
while (reader.pos < e)
|
||||||
|
arr.push(this.scalar(reader, T, L));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
arr.push(this.scalar(reader, T, L));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
target[localName] = this.scalar(reader, T, L);
|
||||||
|
break;
|
||||||
|
case "message":
|
||||||
|
if (repeated) {
|
||||||
|
let arr = target[localName]; // safe to assume presence of array, oneof cannot contain repeated values
|
||||||
|
let msg = field.T().internalBinaryRead(reader, reader.uint32(), options);
|
||||||
|
arr.push(msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
target[localName] = field.T().internalBinaryRead(reader, reader.uint32(), options, target[localName]);
|
||||||
|
break;
|
||||||
|
case "map":
|
||||||
|
let [mapKey, mapVal] = this.mapEntry(field, reader, options);
|
||||||
|
// safe to assume presence of map object, oneof cannot contain repeated values
|
||||||
|
target[localName][mapKey] = mapVal;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Read a map field, expecting key field = 1, value field = 2
|
||||||
|
*/
|
||||||
|
mapEntry(field, reader, options) {
|
||||||
|
let length = reader.uint32();
|
||||||
|
let end = reader.pos + length;
|
||||||
|
let key = undefined; // javascript only allows number or string for object properties
|
||||||
|
let val = undefined;
|
||||||
|
while (reader.pos < end) {
|
||||||
|
let [fieldNo, wireType] = reader.tag();
|
||||||
|
switch (fieldNo) {
|
||||||
|
case 1:
|
||||||
|
if (field.K == reflection_info_1.ScalarType.BOOL)
|
||||||
|
key = reader.bool().toString();
|
||||||
|
else
|
||||||
|
// long types are read as string, number types are okay as number
|
||||||
|
key = this.scalar(reader, field.K, reflection_info_1.LongType.STRING);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
switch (field.V.kind) {
|
||||||
|
case "scalar":
|
||||||
|
val = this.scalar(reader, field.V.T, field.V.L);
|
||||||
|
break;
|
||||||
|
case "enum":
|
||||||
|
val = reader.int32();
|
||||||
|
break;
|
||||||
|
case "message":
|
||||||
|
val = field.V.T().internalBinaryRead(reader, reader.uint32(), options);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error(`Unknown field ${fieldNo} (wire type ${wireType}) in map entry for ${this.info.typeName}#${field.name}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (key === undefined) {
|
||||||
|
let keyRaw = reflection_scalar_default_1.reflectionScalarDefault(field.K);
|
||||||
|
key = field.K == reflection_info_1.ScalarType.BOOL ? keyRaw.toString() : keyRaw;
|
||||||
|
}
|
||||||
|
if (val === undefined)
|
||||||
|
switch (field.V.kind) {
|
||||||
|
case "scalar":
|
||||||
|
val = reflection_scalar_default_1.reflectionScalarDefault(field.V.T, field.V.L);
|
||||||
|
break;
|
||||||
|
case "enum":
|
||||||
|
val = 0;
|
||||||
|
break;
|
||||||
|
case "message":
|
||||||
|
val = field.V.T().create();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return [key, val];
|
||||||
|
}
|
||||||
|
scalar(reader, type, longType) {
|
||||||
|
switch (type) {
|
||||||
|
case reflection_info_1.ScalarType.INT32:
|
||||||
|
return reader.int32();
|
||||||
|
case reflection_info_1.ScalarType.STRING:
|
||||||
|
return reader.string();
|
||||||
|
case reflection_info_1.ScalarType.BOOL:
|
||||||
|
return reader.bool();
|
||||||
|
case reflection_info_1.ScalarType.DOUBLE:
|
||||||
|
return reader.double();
|
||||||
|
case reflection_info_1.ScalarType.FLOAT:
|
||||||
|
return reader.float();
|
||||||
|
case reflection_info_1.ScalarType.INT64:
|
||||||
|
return reflection_long_convert_1.reflectionLongConvert(reader.int64(), longType);
|
||||||
|
case reflection_info_1.ScalarType.UINT64:
|
||||||
|
return reflection_long_convert_1.reflectionLongConvert(reader.uint64(), longType);
|
||||||
|
case reflection_info_1.ScalarType.FIXED64:
|
||||||
|
return reflection_long_convert_1.reflectionLongConvert(reader.fixed64(), longType);
|
||||||
|
case reflection_info_1.ScalarType.FIXED32:
|
||||||
|
return reader.fixed32();
|
||||||
|
case reflection_info_1.ScalarType.BYTES:
|
||||||
|
return reader.bytes();
|
||||||
|
case reflection_info_1.ScalarType.UINT32:
|
||||||
|
return reader.uint32();
|
||||||
|
case reflection_info_1.ScalarType.SFIXED32:
|
||||||
|
return reader.sfixed32();
|
||||||
|
case reflection_info_1.ScalarType.SFIXED64:
|
||||||
|
return reflection_long_convert_1.reflectionLongConvert(reader.sfixed64(), longType);
|
||||||
|
case reflection_info_1.ScalarType.SINT32:
|
||||||
|
return reader.sint32();
|
||||||
|
case reflection_info_1.ScalarType.SINT64:
|
||||||
|
return reflection_long_convert_1.reflectionLongConvert(reader.sint64(), longType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ReflectionBinaryReader = ReflectionBinaryReader;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 6907:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.ReflectionBinaryWriter = void 0;
|
||||||
|
const binary_format_contract_1 = __nccwpck_require__(4816);
|
||||||
|
const reflection_info_1 = __nccwpck_require__(7910);
|
||||||
|
const assert_1 = __nccwpck_require__(8602);
|
||||||
|
const pb_long_1 = __nccwpck_require__(1753);
|
||||||
|
/**
|
||||||
|
* Writes proto3 messages in binary format using reflection information.
|
||||||
|
*
|
||||||
|
* https://developers.google.com/protocol-buffers/docs/encoding
|
||||||
|
*/
|
||||||
|
class ReflectionBinaryWriter {
|
||||||
|
constructor(info) {
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
prepare() {
|
||||||
|
if (!this.fields) {
|
||||||
|
const fieldsInput = this.info.fields ? this.info.fields.concat() : [];
|
||||||
|
this.fields = fieldsInput.sort((a, b) => a.no - b.no);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Writes the message to binary format.
|
||||||
|
*/
|
||||||
|
write(message, writer, options) {
|
||||||
|
this.prepare();
|
||||||
|
for (const field of this.fields) {
|
||||||
|
let value, // this will be our field value, whether it is member of a oneof or not
|
||||||
|
emitDefault, // whether we emit the default value (only true for oneof members)
|
||||||
|
repeated = field.repeat, localName = field.localName;
|
||||||
|
// handle oneof ADT
|
||||||
|
if (field.oneof) {
|
||||||
|
const group = message[field.oneof];
|
||||||
|
if (group.oneofKind !== localName)
|
||||||
|
continue; // if field is not selected, skip
|
||||||
|
value = group[localName];
|
||||||
|
emitDefault = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
value = message[localName];
|
||||||
|
emitDefault = false;
|
||||||
|
}
|
||||||
|
// we have handled oneof above. we just have to honor `emitDefault`.
|
||||||
|
switch (field.kind) {
|
||||||
|
case "scalar":
|
||||||
|
case "enum":
|
||||||
|
let T = field.kind == "enum" ? reflection_info_1.ScalarType.INT32 : field.T;
|
||||||
|
if (repeated) {
|
||||||
|
assert_1.assert(Array.isArray(value));
|
||||||
|
if (repeated == reflection_info_1.RepeatType.PACKED)
|
||||||
|
this.packed(writer, T, field.no, value);
|
||||||
|
else
|
||||||
|
for (const item of value)
|
||||||
|
this.scalar(writer, T, field.no, item, true);
|
||||||
|
}
|
||||||
|
else if (value === undefined)
|
||||||
|
assert_1.assert(field.opt);
|
||||||
|
else
|
||||||
|
this.scalar(writer, T, field.no, value, emitDefault || field.opt);
|
||||||
|
break;
|
||||||
|
case "message":
|
||||||
|
if (repeated) {
|
||||||
|
assert_1.assert(Array.isArray(value));
|
||||||
|
for (const item of value)
|
||||||
|
this.message(writer, options, field.T(), field.no, item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.message(writer, options, field.T(), field.no, value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "map":
|
||||||
|
assert_1.assert(typeof value == 'object' && value !== null);
|
||||||
|
for (const [key, val] of Object.entries(value))
|
||||||
|
this.mapEntry(writer, options, field, key, val);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let u = options.writeUnknownFields;
|
||||||
|
if (u !== false)
|
||||||
|
(u === true ? binary_format_contract_1.UnknownFieldHandler.onWrite : u)(this.info.typeName, message, writer);
|
||||||
|
}
|
||||||
|
mapEntry(writer, options, field, key, value) {
|
||||||
|
writer.tag(field.no, binary_format_contract_1.WireType.LengthDelimited);
|
||||||
|
writer.fork();
|
||||||
|
// javascript only allows number or string for object properties
|
||||||
|
// we convert from our representation to the protobuf type
|
||||||
|
let keyValue = key;
|
||||||
|
switch (field.K) {
|
||||||
|
case reflection_info_1.ScalarType.INT32:
|
||||||
|
case reflection_info_1.ScalarType.FIXED32:
|
||||||
|
case reflection_info_1.ScalarType.UINT32:
|
||||||
|
case reflection_info_1.ScalarType.SFIXED32:
|
||||||
|
case reflection_info_1.ScalarType.SINT32:
|
||||||
|
keyValue = Number.parseInt(key);
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.BOOL:
|
||||||
|
assert_1.assert(key == 'true' || key == 'false');
|
||||||
|
keyValue = key == 'true';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// write key, expecting key field number = 1
|
||||||
|
this.scalar(writer, field.K, 1, keyValue, true);
|
||||||
|
// write value, expecting value field number = 2
|
||||||
|
switch (field.V.kind) {
|
||||||
|
case 'scalar':
|
||||||
|
this.scalar(writer, field.V.T, 2, value, true);
|
||||||
|
break;
|
||||||
|
case 'enum':
|
||||||
|
this.scalar(writer, reflection_info_1.ScalarType.INT32, 2, value, true);
|
||||||
|
break;
|
||||||
|
case 'message':
|
||||||
|
this.message(writer, options, field.V.T(), 2, value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
writer.join();
|
||||||
|
}
|
||||||
|
message(writer, options, handler, fieldNo, value) {
|
||||||
|
if (value === undefined)
|
||||||
|
return;
|
||||||
|
handler.internalBinaryWrite(value, writer.tag(fieldNo, binary_format_contract_1.WireType.LengthDelimited).fork(), options);
|
||||||
|
writer.join();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write a single scalar value.
|
||||||
|
*/
|
||||||
|
scalar(writer, type, fieldNo, value, emitDefault) {
|
||||||
|
let [wireType, method, isDefault] = this.scalarInfo(type, value);
|
||||||
|
if (!isDefault || emitDefault) {
|
||||||
|
writer.tag(fieldNo, wireType);
|
||||||
|
writer[method](value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Write an array of scalar values in packed format.
|
||||||
|
*/
|
||||||
|
packed(writer, type, fieldNo, value) {
|
||||||
|
if (!value.length)
|
||||||
|
return;
|
||||||
|
assert_1.assert(type !== reflection_info_1.ScalarType.BYTES && type !== reflection_info_1.ScalarType.STRING);
|
||||||
|
// write tag
|
||||||
|
writer.tag(fieldNo, binary_format_contract_1.WireType.LengthDelimited);
|
||||||
|
// begin length-delimited
|
||||||
|
writer.fork();
|
||||||
|
// write values without tags
|
||||||
|
let [, method,] = this.scalarInfo(type);
|
||||||
|
for (let i = 0; i < value.length; i++)
|
||||||
|
writer[method](value[i]);
|
||||||
|
// end length delimited
|
||||||
|
writer.join();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get information for writing a scalar value.
|
||||||
|
*
|
||||||
|
* Returns tuple:
|
||||||
|
* [0]: appropriate WireType
|
||||||
|
* [1]: name of the appropriate method of IBinaryWriter
|
||||||
|
* [2]: whether the given value is a default value
|
||||||
|
*
|
||||||
|
* If argument `value` is omitted, [2] is always false.
|
||||||
|
*/
|
||||||
|
scalarInfo(type, value) {
|
||||||
|
let t = binary_format_contract_1.WireType.Varint;
|
||||||
|
let m;
|
||||||
|
let i = value === undefined;
|
||||||
|
let d = value === 0;
|
||||||
|
switch (type) {
|
||||||
|
case reflection_info_1.ScalarType.INT32:
|
||||||
|
m = "int32";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.STRING:
|
||||||
|
d = i || !value.length;
|
||||||
|
t = binary_format_contract_1.WireType.LengthDelimited;
|
||||||
|
m = "string";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.BOOL:
|
||||||
|
d = value === false;
|
||||||
|
m = "bool";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.UINT32:
|
||||||
|
m = "uint32";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.DOUBLE:
|
||||||
|
t = binary_format_contract_1.WireType.Bit64;
|
||||||
|
m = "double";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.FLOAT:
|
||||||
|
t = binary_format_contract_1.WireType.Bit32;
|
||||||
|
m = "float";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.INT64:
|
||||||
|
d = i || pb_long_1.PbLong.from(value).isZero();
|
||||||
|
m = "int64";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.UINT64:
|
||||||
|
d = i || pb_long_1.PbULong.from(value).isZero();
|
||||||
|
m = "uint64";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.FIXED64:
|
||||||
|
d = i || pb_long_1.PbULong.from(value).isZero();
|
||||||
|
t = binary_format_contract_1.WireType.Bit64;
|
||||||
|
m = "fixed64";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.BYTES:
|
||||||
|
d = i || !value.byteLength;
|
||||||
|
t = binary_format_contract_1.WireType.LengthDelimited;
|
||||||
|
m = "bytes";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.FIXED32:
|
||||||
|
t = binary_format_contract_1.WireType.Bit32;
|
||||||
|
m = "fixed32";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.SFIXED32:
|
||||||
|
t = binary_format_contract_1.WireType.Bit32;
|
||||||
|
m = "sfixed32";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.SFIXED64:
|
||||||
|
d = i || pb_long_1.PbLong.from(value).isZero();
|
||||||
|
t = binary_format_contract_1.WireType.Bit64;
|
||||||
|
m = "sfixed64";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.SINT32:
|
||||||
|
m = "sint32";
|
||||||
|
break;
|
||||||
|
case reflection_info_1.ScalarType.SINT64:
|
||||||
|
d = i || pb_long_1.PbLong.from(value).isZero();
|
||||||
|
m = "sint64";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return [t, m, i || d];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ReflectionBinaryWriter = ReflectionBinaryWriter;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 7565:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.containsMessageType = void 0;
|
||||||
|
const message_type_contract_1 = __nccwpck_require__(3785);
|
||||||
|
/**
|
||||||
|
* Check if the provided object is a proto message.
|
||||||
|
*
|
||||||
|
* Note that this is an experimental feature - it is here to stay, but
|
||||||
|
* implementation details may change without notice.
|
||||||
|
*/
|
||||||
|
function containsMessageType(msg) {
|
||||||
|
return msg[message_type_contract_1.MESSAGE_TYPE] != null;
|
||||||
|
}
|
||||||
|
exports.containsMessageType = containsMessageType;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 5726:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.reflectionCreate = void 0;
|
||||||
|
const reflection_scalar_default_1 = __nccwpck_require__(9526);
|
||||||
|
const message_type_contract_1 = __nccwpck_require__(3785);
|
||||||
|
/**
|
||||||
|
* Creates an instance of the generic message, using the field
|
||||||
|
* information.
|
||||||
|
*/
|
||||||
|
function reflectionCreate(type) {
|
||||||
|
/**
|
||||||
|
* This ternary can be removed in the next major version.
|
||||||
|
* The `Object.create()` code path utilizes a new `messagePrototype`
|
||||||
|
* property on the `IMessageType` which has this same `MESSAGE_TYPE`
|
||||||
|
* non-enumerable property on it. Doing it this way means that we only
|
||||||
|
* pay the cost of `Object.defineProperty()` once per `IMessageType`
|
||||||
|
* class of once per "instance". The falsy code path is only provided
|
||||||
|
* for backwards compatibility in cases where the runtime library is
|
||||||
|
* updated without also updating the generated code.
|
||||||
|
*/
|
||||||
|
const msg = type.messagePrototype
|
||||||
|
? Object.create(type.messagePrototype)
|
||||||
|
: Object.defineProperty({}, message_type_contract_1.MESSAGE_TYPE, { value: type });
|
||||||
|
for (let field of type.fields) {
|
||||||
|
let name = field.localName;
|
||||||
|
if (field.opt)
|
||||||
|
continue;
|
||||||
|
if (field.oneof)
|
||||||
|
msg[field.oneof] = { oneofKind: undefined };
|
||||||
|
else if (field.repeat)
|
||||||
|
msg[name] = [];
|
||||||
|
else
|
||||||
|
switch (field.kind) {
|
||||||
|
case "scalar":
|
||||||
|
msg[name] = reflection_scalar_default_1.reflectionScalarDefault(field.T, field.L);
|
||||||
|
break;
|
||||||
|
case "enum":
|
||||||
|
// we require 0 to be default value for all enums
|
||||||
|
msg[name] = 0;
|
||||||
|
break;
|
||||||
|
case "map":
|
||||||
|
msg[name] = {};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
exports.reflectionCreate = reflectionCreate;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 4827:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.reflectionEquals = void 0;
|
||||||
|
const reflection_info_1 = __nccwpck_require__(7910);
|
||||||
|
/**
|
||||||
|
* Determines whether two message of the same type have the same field values.
|
||||||
|
* Checks for deep equality, traversing repeated fields, oneof groups, maps
|
||||||
|
* and messages recursively.
|
||||||
|
* Will also return true if both messages are `undefined`.
|
||||||
|
*/
|
||||||
|
function reflectionEquals(info, a, b) {
|
||||||
|
if (a === b)
|
||||||
|
return true;
|
||||||
|
if (!a || !b)
|
||||||
|
return false;
|
||||||
|
for (let field of info.fields) {
|
||||||
|
let localName = field.localName;
|
||||||
|
let val_a = field.oneof ? a[field.oneof][localName] : a[localName];
|
||||||
|
let val_b = field.oneof ? b[field.oneof][localName] : b[localName];
|
||||||
|
switch (field.kind) {
|
||||||
|
case "enum":
|
||||||
|
case "scalar":
|
||||||
|
let t = field.kind == "enum" ? reflection_info_1.ScalarType.INT32 : field.T;
|
||||||
|
if (!(field.repeat
|
||||||
|
? repeatedPrimitiveEq(t, val_a, val_b)
|
||||||
|
: primitiveEq(t, val_a, val_b)))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case "map":
|
||||||
|
if (!(field.V.kind == "message"
|
||||||
|
? repeatedMsgEq(field.V.T(), objectValues(val_a), objectValues(val_b))
|
||||||
|
: repeatedPrimitiveEq(field.V.kind == "enum" ? reflection_info_1.ScalarType.INT32 : field.V.T, objectValues(val_a), objectValues(val_b))))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case "message":
|
||||||
|
let T = field.T();
|
||||||
|
if (!(field.repeat
|
||||||
|
? repeatedMsgEq(T, val_a, val_b)
|
||||||
|
: T.equals(val_a, val_b)))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
exports.reflectionEquals = reflectionEquals;
|
||||||
|
const objectValues = Object.values;
|
||||||
|
function primitiveEq(type, a, b) {
|
||||||
|
if (a === b)
|
||||||
|
return true;
|
||||||
|
if (type !== reflection_info_1.ScalarType.BYTES)
|
||||||
|
return false;
|
||||||
|
let ba = a;
|
||||||
|
let bb = b;
|
||||||
|
if (ba.length !== bb.length)
|
||||||
|
return false;
|
||||||
|
for (let i = 0; i < ba.length; i++)
|
||||||
|
if (ba[i] != bb[i])
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function repeatedPrimitiveEq(type, a, b) {
|
||||||
|
if (a.length !== b.length)
|
||||||
|
return false;
|
||||||
|
for (let i = 0; i < a.length; i++)
|
||||||
|
if (!primitiveEq(type, a[i], b[i]))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function repeatedMsgEq(type, a, b) {
|
||||||
|
if (a.length !== b.length)
|
||||||
|
return false;
|
||||||
|
for (let i = 0; i < a.length; i++)
|
||||||
|
if (!type.equals(a[i], b[i]))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 7910:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.readMessageOption = exports.readFieldOption = exports.readFieldOptions = exports.normalizeFieldInfo = exports.RepeatType = exports.LongType = exports.ScalarType = void 0;
|
||||||
|
const lower_camel_case_1 = __nccwpck_require__(4073);
|
||||||
|
/**
|
||||||
|
* Scalar value types. This is a subset of field types declared by protobuf
|
||||||
|
* enum google.protobuf.FieldDescriptorProto.Type The types GROUP and MESSAGE
|
||||||
|
* are omitted, but the numerical values are identical.
|
||||||
|
*/
|
||||||
|
var ScalarType;
|
||||||
|
(function (ScalarType) {
|
||||||
|
// 0 is reserved for errors.
|
||||||
|
// Order is weird for historical reasons.
|
||||||
|
ScalarType[ScalarType["DOUBLE"] = 1] = "DOUBLE";
|
||||||
|
ScalarType[ScalarType["FLOAT"] = 2] = "FLOAT";
|
||||||
|
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
|
||||||
|
// negative values are likely.
|
||||||
|
ScalarType[ScalarType["INT64"] = 3] = "INT64";
|
||||||
|
ScalarType[ScalarType["UINT64"] = 4] = "UINT64";
|
||||||
|
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
|
||||||
|
// negative values are likely.
|
||||||
|
ScalarType[ScalarType["INT32"] = 5] = "INT32";
|
||||||
|
ScalarType[ScalarType["FIXED64"] = 6] = "FIXED64";
|
||||||
|
ScalarType[ScalarType["FIXED32"] = 7] = "FIXED32";
|
||||||
|
ScalarType[ScalarType["BOOL"] = 8] = "BOOL";
|
||||||
|
ScalarType[ScalarType["STRING"] = 9] = "STRING";
|
||||||
|
// Tag-delimited aggregate.
|
||||||
|
// Group type is deprecated and not supported in proto3. However, Proto3
|
||||||
|
// implementations should still be able to parse the group wire format and
|
||||||
|
// treat group fields as unknown fields.
|
||||||
|
// TYPE_GROUP = 10,
|
||||||
|
// TYPE_MESSAGE = 11, // Length-delimited aggregate.
|
||||||
|
// New in version 2.
|
||||||
|
ScalarType[ScalarType["BYTES"] = 12] = "BYTES";
|
||||||
|
ScalarType[ScalarType["UINT32"] = 13] = "UINT32";
|
||||||
|
// TYPE_ENUM = 14,
|
||||||
|
ScalarType[ScalarType["SFIXED32"] = 15] = "SFIXED32";
|
||||||
|
ScalarType[ScalarType["SFIXED64"] = 16] = "SFIXED64";
|
||||||
|
ScalarType[ScalarType["SINT32"] = 17] = "SINT32";
|
||||||
|
ScalarType[ScalarType["SINT64"] = 18] = "SINT64";
|
||||||
|
})(ScalarType = exports.ScalarType || (exports.ScalarType = {}));
|
||||||
|
/**
|
||||||
|
* JavaScript representation of 64 bit integral types. Equivalent to the
|
||||||
|
* field option "jstype".
|
||||||
|
*
|
||||||
|
* By default, protobuf-ts represents 64 bit types as `bigint`.
|
||||||
|
*
|
||||||
|
* You can change the default behaviour by enabling the plugin parameter
|
||||||
|
* `long_type_string`, which will represent 64 bit types as `string`.
|
||||||
|
*
|
||||||
|
* Alternatively, you can change the behaviour for individual fields
|
||||||
|
* with the field option "jstype":
|
||||||
|
*
|
||||||
|
* ```protobuf
|
||||||
|
* uint64 my_field = 1 [jstype = JS_STRING];
|
||||||
|
* uint64 other_field = 2 [jstype = JS_NUMBER];
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
var LongType;
|
||||||
|
(function (LongType) {
|
||||||
|
/**
|
||||||
|
* Use JavaScript `bigint`.
|
||||||
|
*
|
||||||
|
* Field option `[jstype = JS_NORMAL]`.
|
||||||
|
*/
|
||||||
|
LongType[LongType["BIGINT"] = 0] = "BIGINT";
|
||||||
|
/**
|
||||||
|
* Use JavaScript `string`.
|
||||||
|
*
|
||||||
|
* Field option `[jstype = JS_STRING]`.
|
||||||
|
*/
|
||||||
|
LongType[LongType["STRING"] = 1] = "STRING";
|
||||||
|
/**
|
||||||
|
* Use JavaScript `number`.
|
||||||
|
*
|
||||||
|
* Large values will loose precision.
|
||||||
|
*
|
||||||
|
* Field option `[jstype = JS_NUMBER]`.
|
||||||
|
*/
|
||||||
|
LongType[LongType["NUMBER"] = 2] = "NUMBER";
|
||||||
|
})(LongType = exports.LongType || (exports.LongType = {}));
|
||||||
|
/**
|
||||||
|
* Protobuf 2.1.0 introduced packed repeated fields.
|
||||||
|
* Setting the field option `[packed = true]` enables packing.
|
||||||
|
*
|
||||||
|
* In proto3, all repeated fields are packed by default.
|
||||||
|
* Setting the field option `[packed = false]` disables packing.
|
||||||
|
*
|
||||||
|
* Packed repeated fields are encoded with a single tag,
|
||||||
|
* then a length-delimiter, then the element values.
|
||||||
|
*
|
||||||
|
* Unpacked repeated fields are encoded with a tag and
|
||||||
|
* value for each element.
|
||||||
|
*
|
||||||
|
* `bytes` and `string` cannot be packed.
|
||||||
|
*/
|
||||||
|
var RepeatType;
|
||||||
|
(function (RepeatType) {
|
||||||
|
/**
|
||||||
|
* The field is not repeated.
|
||||||
|
*/
|
||||||
|
RepeatType[RepeatType["NO"] = 0] = "NO";
|
||||||
|
/**
|
||||||
|
* The field is repeated and should be packed.
|
||||||
|
* Invalid for `bytes` and `string`, they cannot be packed.
|
||||||
|
*/
|
||||||
|
RepeatType[RepeatType["PACKED"] = 1] = "PACKED";
|
||||||
|
/**
|
||||||
|
* The field is repeated but should not be packed.
|
||||||
|
* The only valid repeat type for repeated `bytes` and `string`.
|
||||||
|
*/
|
||||||
|
RepeatType[RepeatType["UNPACKED"] = 2] = "UNPACKED";
|
||||||
|
})(RepeatType = exports.RepeatType || (exports.RepeatType = {}));
|
||||||
|
/**
|
||||||
|
* Turns PartialFieldInfo into FieldInfo.
|
||||||
|
*/
|
||||||
|
function normalizeFieldInfo(field) {
|
||||||
|
var _a, _b, _c, _d;
|
||||||
|
field.localName = (_a = field.localName) !== null && _a !== void 0 ? _a : lower_camel_case_1.lowerCamelCase(field.name);
|
||||||
|
field.jsonName = (_b = field.jsonName) !== null && _b !== void 0 ? _b : lower_camel_case_1.lowerCamelCase(field.name);
|
||||||
|
field.repeat = (_c = field.repeat) !== null && _c !== void 0 ? _c : RepeatType.NO;
|
||||||
|
field.opt = (_d = field.opt) !== null && _d !== void 0 ? _d : (field.repeat ? false : field.oneof ? false : field.kind == "message");
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
exports.normalizeFieldInfo = normalizeFieldInfo;
|
||||||
|
/**
|
||||||
|
* Read custom field options from a generated message type.
|
||||||
|
*
|
||||||
|
* @deprecated use readFieldOption()
|
||||||
|
*/
|
||||||
|
function readFieldOptions(messageType, fieldName, extensionName, extensionType) {
|
||||||
|
var _a;
|
||||||
|
const options = (_a = messageType.fields.find((m, i) => m.localName == fieldName || i == fieldName)) === null || _a === void 0 ? void 0 : _a.options;
|
||||||
|
return options && options[extensionName] ? extensionType.fromJson(options[extensionName]) : undefined;
|
||||||
|
}
|
||||||
|
exports.readFieldOptions = readFieldOptions;
|
||||||
|
function readFieldOption(messageType, fieldName, extensionName, extensionType) {
|
||||||
|
var _a;
|
||||||
|
const options = (_a = messageType.fields.find((m, i) => m.localName == fieldName || i == fieldName)) === null || _a === void 0 ? void 0 : _a.options;
|
||||||
|
if (!options) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const optionVal = options[extensionName];
|
||||||
|
if (optionVal === undefined) {
|
||||||
|
return optionVal;
|
||||||
|
}
|
||||||
|
return extensionType ? extensionType.fromJson(optionVal) : optionVal;
|
||||||
|
}
|
||||||
|
exports.readFieldOption = readFieldOption;
|
||||||
|
function readMessageOption(messageType, extensionName, extensionType) {
|
||||||
|
const options = messageType.options;
|
||||||
|
const optionVal = options[extensionName];
|
||||||
|
if (optionVal === undefined) {
|
||||||
|
return optionVal;
|
||||||
|
}
|
||||||
|
return extensionType ? extensionType.fromJson(optionVal) : optionVal;
|
||||||
|
}
|
||||||
|
exports.readMessageOption = readMessageOption;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 6790:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.ReflectionJsonReader = void 0;
|
||||||
|
const json_typings_1 = __nccwpck_require__(9999);
|
||||||
|
const base64_1 = __nccwpck_require__(6335);
|
||||||
|
const reflection_info_1 = __nccwpck_require__(7910);
|
||||||
|
const pb_long_1 = __nccwpck_require__(1753);
|
||||||
|
const assert_1 = __nccwpck_require__(8602);
|
||||||
|
const reflection_long_convert_1 = __nccwpck_require__(3402);
|
||||||
|
/**
|
||||||
|
* Reads proto3 messages in canonical JSON format using reflection information.
|
||||||
|
*
|
||||||
|
* https://developers.google.com/protocol-buffers/docs/proto3#json
|
||||||
|
*/
|
||||||
|
class ReflectionJsonReader {
|
||||||
|
constructor(info) {
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
prepare() {
|
||||||
|
var _a;
|
||||||
|
if (this.fMap === undefined) {
|
||||||
|
this.fMap = {};
|
||||||
|
const fieldsInput = (_a = this.info.fields) !== null && _a !== void 0 ? _a : [];
|
||||||
|
for (const field of fieldsInput) {
|
||||||
|
this.fMap[field.name] = field;
|
||||||
|
this.fMap[field.jsonName] = field;
|
||||||
|
this.fMap[field.localName] = field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Cannot parse JSON <type of jsonValue> for <type name>#<fieldName>.
|
||||||
|
assert(condition, fieldName, jsonValue) {
|
||||||
|
if (!condition) {
|
||||||
|
let what = json_typings_1.typeofJsonValue(jsonValue);
|
||||||
|
if (what == "number" || what == "boolean")
|
||||||
|
what = jsonValue.toString();
|
||||||
|
throw new Error(`Cannot parse JSON ${what} for ${this.info.typeName}#${fieldName}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Reads a message from canonical JSON format into the target message.
|
||||||
|
*
|
||||||
|
* Repeated fields are appended. Map entries are added, overwriting
|
||||||
|
* existing keys.
|
||||||
|
*
|
||||||
|
* If a message field is already present, it will be merged with the
|
||||||
|
* new data.
|
||||||
|
*/
|
||||||
|
read(input, message, options) {
|
||||||
|
this.prepare();
|
||||||
|
const oneofsHandled = [];
|
||||||
|
for (const [jsonKey, jsonValue] of Object.entries(input)) {
|
||||||
|
const field = this.fMap[jsonKey];
|
||||||
|
if (!field) {
|
||||||
|
if (!options.ignoreUnknownFields)
|
||||||
|
throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${jsonKey}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const localName = field.localName;
|
||||||
|
// handle oneof ADT
|
||||||
|
let target; // this will be the target for the field value, whether it is member of a oneof or not
|
||||||
|
if (field.oneof) {
|
||||||
|
if (jsonValue === null && (field.kind !== 'enum' || field.T()[0] !== 'google.protobuf.NullValue')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// since json objects are unordered by specification, it is not possible to take the last of multiple oneofs
|
||||||
|
if (oneofsHandled.includes(field.oneof))
|
||||||
|
throw new Error(`Multiple members of the oneof group "${field.oneof}" of ${this.info.typeName} are present in JSON.`);
|
||||||
|
oneofsHandled.push(field.oneof);
|
||||||
|
target = message[field.oneof] = {
|
||||||
|
oneofKind: localName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
target = message;
|
||||||
|
}
|
||||||
|
// we have handled oneof above. we just have read the value into `target`.
|
||||||
|
if (field.kind == 'map') {
|
||||||
|
if (jsonValue === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// check input
|
||||||
|
this.assert(json_typings_1.isJsonObject(jsonValue), field.name, jsonValue);
|
||||||
|
// our target to put map entries into
|
||||||
|
const fieldObj = target[localName];
|
||||||
|
// read entries
|
||||||
|
for (const [jsonObjKey, jsonObjValue] of Object.entries(jsonValue)) {
|
||||||
|
this.assert(jsonObjValue !== null, field.name + " map value", null);
|
||||||
|
// read value
|
||||||
|
let val;
|
||||||
|
switch (field.V.kind) {
|
||||||
|
case "message":
|
||||||
|
val = field.V.T().internalJsonRead(jsonObjValue, options);
|
||||||
|
break;
|
||||||
|
case "enum":
|
||||||
|
val = this.enum(field.V.T(), jsonObjValue, field.name, options.ignoreUnknownFields);
|
||||||
|
if (val === false)
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
case "scalar":
|
||||||
|
val = this.scalar(jsonObjValue, field.V.T, field.V.L, field.name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.assert(val !== undefined, field.name + " map value", jsonObjValue);
|
||||||
|
// read key
|
||||||
|
let key = jsonObjKey;
|
||||||
|
if (field.K == reflection_info_1.ScalarType.BOOL)
|
||||||
|
key = key == "true" ? true : key == "false" ? false : key;
|
||||||
|
key = this.scalar(key, field.K, reflection_info_1.LongType.STRING, field.name).toString();
|
||||||
|
fieldObj[key] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (field.repeat) {
|
||||||
|
if (jsonValue === null)
|
||||||
|
continue;
|
||||||
|
// check input
|
||||||
|
this.assert(Array.isArray(jsonValue), field.name, jsonValue);
|
||||||
|
// our target to put array entries into
|
||||||
|
const fieldArr = target[localName];
|
||||||
|
// read array entries
|
||||||
|
for (const jsonItem of jsonValue) {
|
||||||
|
this.assert(jsonItem !== null, field.name, null);
|
||||||
|
let val;
|
||||||
|
switch (field.kind) {
|
||||||
|
case "message":
|
||||||
|
val = field.T().internalJsonRead(jsonItem, options);
|
||||||
|
break;
|
||||||
|
case "enum":
|
||||||
|
val = this.enum(field.T(), jsonItem, field.name, options.ignoreUnknownFields);
|
||||||
|
if (val === false)
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
case "scalar":
|
||||||
|
val = this.scalar(jsonItem, field.T, field.L, field.name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.assert(val !== undefined, field.name, jsonValue);
|
||||||
|
fieldArr.push(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (field.kind) {
|
||||||
|
case "message":
|
||||||
|
if (jsonValue === null && field.T().typeName != 'google.protobuf.Value') {
|
||||||
|
this.assert(field.oneof === undefined, field.name + " (oneof member)", null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
target[localName] = field.T().internalJsonRead(jsonValue, options, target[localName]);
|
||||||
|
break;
|
||||||
|
case "enum":
|
||||||
|
let val = this.enum(field.T(), jsonValue, field.name, options.ignoreUnknownFields);
|
||||||
|
if (val === false)
|
||||||
|
continue;
|
||||||
|
target[localName] = val;
|
||||||
|
break;
|
||||||
|
case "scalar":
|
||||||
|
target[localName] = this.scalar(jsonValue, field.T, field.L, field.name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns `false` for unrecognized string representations.
|
||||||
|
*
|
||||||
|
* google.protobuf.NullValue accepts only JSON `null` (or the old `"NULL_VALUE"`).
|
||||||
|
*/
|
||||||
|
enum(type, json, fieldName, ignoreUnknownFields) {
|
||||||
|
if (type[0] == 'google.protobuf.NullValue')
|
||||||
|
assert_1.assert(json === null || json === "NULL_VALUE", `Unable to parse field ${this.info.typeName}#${fieldName}, enum ${type[0]} only accepts null.`);
|
||||||
|
if (json === null)
|
||||||
|
// we require 0 to be default value for all enums
|
||||||
|
return 0;
|
||||||
|
switch (typeof json) {
|
||||||
|
case "number":
|
||||||
|
assert_1.assert(Number.isInteger(json), `Unable to parse field ${this.info.typeName}#${fieldName}, enum can only be integral number, got ${json}.`);
|
||||||
|
return json;
|
||||||
|
case "string":
|
||||||
|
let localEnumName = json;
|
||||||
|
if (type[2] && json.substring(0, type[2].length) === type[2])
|
||||||
|
// lookup without the shared prefix
|
||||||
|
localEnumName = json.substring(type[2].length);
|
||||||
|
let enumNumber = type[1][localEnumName];
|
||||||
|
if (typeof enumNumber === 'undefined' && ignoreUnknownFields) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
assert_1.assert(typeof enumNumber == "number", `Unable to parse field ${this.info.typeName}#${fieldName}, enum ${type[0]} has no value for "${json}".`);
|
||||||
|
return enumNumber;
|
||||||
|
}
|
||||||
|
assert_1.assert(false, `Unable to parse field ${this.info.typeName}#${fieldName}, cannot parse enum value from ${typeof json}".`);
|
||||||
|
}
|
||||||
|
scalar(json, type, longType, fieldName) {
|
||||||
|
let e;
|
||||||
|
try {
|
||||||
|
switch (type) {
|
||||||
|
// float, double: JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity".
|
||||||
|
// Either numbers or strings are accepted. Exponent notation is also accepted.
|
||||||
|
case reflection_info_1.ScalarType.DOUBLE:
|
||||||
|
case reflection_info_1.ScalarType.FLOAT:
|
||||||
|
if (json === null)
|
||||||
|
return .0;
|
||||||
|
if (json === "NaN")
|
||||||
|
return Number.NaN;
|
||||||
|
if (json === "Infinity")
|
||||||
|
return Number.POSITIVE_INFINITY;
|
||||||
|
if (json === "-Infinity")
|
||||||
|
return Number.NEGATIVE_INFINITY;
|
||||||
|
if (json === "") {
|
||||||
|
e = "empty string";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (typeof json == "string" && json.trim().length !== json.length) {
|
||||||
|
e = "extra whitespace";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (typeof json != "string" && typeof json != "number") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
let float = Number(json);
|
||||||
|
if (Number.isNaN(float)) {
|
||||||
|
e = "not a number";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!Number.isFinite(float)) {
|
||||||
|
// infinity and -infinity are handled by string representation above, so this is an error
|
||||||
|
e = "too large or small";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (type == reflection_info_1.ScalarType.FLOAT)
|
||||||
|
assert_1.assertFloat32(float);
|
||||||
|
return float;
|
||||||
|
// int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.
|
||||||
|
case reflection_info_1.ScalarType.INT32:
|
||||||
|
case reflection_info_1.ScalarType.FIXED32:
|
||||||
|
case reflection_info_1.ScalarType.SFIXED32:
|
||||||
|
case reflection_info_1.ScalarType.SINT32:
|
||||||
|
case reflection_info_1.ScalarType.UINT32:
|
||||||
|
if (json === null)
|
||||||
|
return 0;
|
||||||
|
let int32;
|
||||||
|
if (typeof json == "number")
|
||||||
|
int32 = json;
|
||||||
|
else if (json === "")
|
||||||
|
e = "empty string";
|
||||||
|
else if (typeof json == "string") {
|
||||||
|
if (json.trim().length !== json.length)
|
||||||
|
e = "extra whitespace";
|
||||||
|
else
|
||||||
|
int32 = Number(json);
|
||||||
|
}
|
||||||
|
if (int32 === undefined)
|
||||||
|
break;
|
||||||
|
if (type == reflection_info_1.ScalarType.UINT32)
|
||||||
|
assert_1.assertUInt32(int32);
|
||||||
|
else
|
||||||
|
assert_1.assertInt32(int32);
|
||||||
|
return int32;
|
||||||
|
// int64, fixed64, uint64: JSON value will be a decimal string. Either numbers or strings are accepted.
|
||||||
|
case reflection_info_1.ScalarType.INT64:
|
||||||
|
case reflection_info_1.ScalarType.SFIXED64:
|
||||||
|
case reflection_info_1.ScalarType.SINT64:
|
||||||
|
if (json === null)
|
||||||
|
return reflection_long_convert_1.reflectionLongConvert(pb_long_1.PbLong.ZERO, longType);
|
||||||
|
if (typeof json != "number" && typeof json != "string")
|
||||||
|
break;
|
||||||
|
return reflection_long_convert_1.reflectionLongConvert(pb_long_1.PbLong.from(json), longType);
|
||||||
|
case reflection_info_1.ScalarType.FIXED64:
|
||||||
|
case reflection_info_1.ScalarType.UINT64:
|
||||||
|
if (json === null)
|
||||||
|
return reflection_long_convert_1.reflectionLongConvert(pb_long_1.PbULong.ZERO, longType);
|
||||||
|
if (typeof json != "number" && typeof json != "string")
|
||||||
|
break;
|
||||||
|
return reflection_long_convert_1.reflectionLongConvert(pb_long_1.PbULong.from(json), longType);
|
||||||
|
// bool:
|
||||||
|
case reflection_info_1.ScalarType.BOOL:
|
||||||
|
if (json === null)
|
||||||
|
return false;
|
||||||
|
if (typeof json !== "boolean")
|
||||||
|
break;
|
||||||
|
return json;
|
||||||
|
// string:
|
||||||
|
case reflection_info_1.ScalarType.STRING:
|
||||||
|
if (json === null)
|
||||||
|
return "";
|
||||||
|
if (typeof json !== "string") {
|
||||||
|
e = "extra whitespace";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
encodeURIComponent(json);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
e = "invalid UTF8";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return json;
|
||||||
|
// bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.
|
||||||
|
// Either standard or URL-safe base64 encoding with/without paddings are accepted.
|
||||||
|
case reflection_info_1.ScalarType.BYTES:
|
||||||
|
if (json === null || json === "")
|
||||||
|
return new Uint8Array(0);
|
||||||
|
if (typeof json !== 'string')
|
||||||
|
break;
|
||||||
|
return base64_1.base64decode(json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
e = error.message;
|
||||||
|
}
|
||||||
|
this.assert(false, fieldName + (e ? " - " + e : ""), json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ReflectionJsonReader = ReflectionJsonReader;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 1094:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.ReflectionJsonWriter = void 0;
|
||||||
|
const base64_1 = __nccwpck_require__(6335);
|
||||||
|
const pb_long_1 = __nccwpck_require__(1753);
|
||||||
|
const reflection_info_1 = __nccwpck_require__(7910);
|
||||||
|
const assert_1 = __nccwpck_require__(8602);
|
||||||
|
/**
|
||||||
|
* Writes proto3 messages in canonical JSON format using reflection
|
||||||
|
* information.
|
||||||
|
*
|
||||||
|
* https://developers.google.com/protocol-buffers/docs/proto3#json
|
||||||
|
*/
|
||||||
|
class ReflectionJsonWriter {
|
||||||
|
constructor(info) {
|
||||||
|
var _a;
|
||||||
|
this.fields = (_a = info.fields) !== null && _a !== void 0 ? _a : [];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Converts the message to a JSON object, based on the field descriptors.
|
||||||
|
*/
|
||||||
|
write(message, options) {
|
||||||
|
const json = {}, source = message;
|
||||||
|
for (const field of this.fields) {
|
||||||
|
// field is not part of a oneof, simply write as is
|
||||||
|
if (!field.oneof) {
|
||||||
|
let jsonValue = this.field(field, source[field.localName], options);
|
||||||
|
if (jsonValue !== undefined)
|
||||||
|
json[options.useProtoFieldName ? field.name : field.jsonName] = jsonValue;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// field is part of a oneof
|
||||||
|
const group = source[field.oneof];
|
||||||
|
if (group.oneofKind !== field.localName)
|
||||||
|
continue; // not selected, skip
|
||||||
|
const opt = field.kind == 'scalar' || field.kind == 'enum'
|
||||||
|
? Object.assign(Object.assign({}, options), { emitDefaultValues: true }) : options;
|
||||||
|
let jsonValue = this.field(field, group[field.localName], opt);
|
||||||
|
assert_1.assert(jsonValue !== undefined);
|
||||||
|
json[options.useProtoFieldName ? field.name : field.jsonName] = jsonValue;
|
||||||
|
}
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
field(field, value, options) {
|
||||||
|
let jsonValue = undefined;
|
||||||
|
if (field.kind == 'map') {
|
||||||
|
assert_1.assert(typeof value == "object" && value !== null);
|
||||||
|
const jsonObj = {};
|
||||||
|
switch (field.V.kind) {
|
||||||
|
case "scalar":
|
||||||
|
for (const [entryKey, entryValue] of Object.entries(value)) {
|
||||||
|
const val = this.scalar(field.V.T, entryValue, field.name, false, true);
|
||||||
|
assert_1.assert(val !== undefined);
|
||||||
|
jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "message":
|
||||||
|
const messageType = field.V.T();
|
||||||
|
for (const [entryKey, entryValue] of Object.entries(value)) {
|
||||||
|
const val = this.message(messageType, entryValue, field.name, options);
|
||||||
|
assert_1.assert(val !== undefined);
|
||||||
|
jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "enum":
|
||||||
|
const enumInfo = field.V.T();
|
||||||
|
for (const [entryKey, entryValue] of Object.entries(value)) {
|
||||||
|
assert_1.assert(entryValue === undefined || typeof entryValue == 'number');
|
||||||
|
const val = this.enum(enumInfo, entryValue, field.name, false, true, options.enumAsInteger);
|
||||||
|
assert_1.assert(val !== undefined);
|
||||||
|
jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (options.emitDefaultValues || Object.keys(jsonObj).length > 0)
|
||||||
|
jsonValue = jsonObj;
|
||||||
|
}
|
||||||
|
else if (field.repeat) {
|
||||||
|
assert_1.assert(Array.isArray(value));
|
||||||
|
const jsonArr = [];
|
||||||
|
switch (field.kind) {
|
||||||
|
case "scalar":
|
||||||
|
for (let i = 0; i < value.length; i++) {
|
||||||
|
const val = this.scalar(field.T, value[i], field.name, field.opt, true);
|
||||||
|
assert_1.assert(val !== undefined);
|
||||||
|
jsonArr.push(val);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "enum":
|
||||||
|
const enumInfo = field.T();
|
||||||
|
for (let i = 0; i < value.length; i++) {
|
||||||
|
assert_1.assert(value[i] === undefined || typeof value[i] == 'number');
|
||||||
|
const val = this.enum(enumInfo, value[i], field.name, field.opt, true, options.enumAsInteger);
|
||||||
|
assert_1.assert(val !== undefined);
|
||||||
|
jsonArr.push(val);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "message":
|
||||||
|
const messageType = field.T();
|
||||||
|
for (let i = 0; i < value.length; i++) {
|
||||||
|
const val = this.message(messageType, value[i], field.name, options);
|
||||||
|
assert_1.assert(val !== undefined);
|
||||||
|
jsonArr.push(val);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// add converted array to json output
|
||||||
|
if (options.emitDefaultValues || jsonArr.length > 0 || options.emitDefaultValues)
|
||||||
|
jsonValue = jsonArr;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (field.kind) {
|
||||||
|
case "scalar":
|
||||||
|
jsonValue = this.scalar(field.T, value, field.name, field.opt, options.emitDefaultValues);
|
||||||
|
break;
|
||||||
|
case "enum":
|
||||||
|
jsonValue = this.enum(field.T(), value, field.name, field.opt, options.emitDefaultValues, options.enumAsInteger);
|
||||||
|
break;
|
||||||
|
case "message":
|
||||||
|
jsonValue = this.message(field.T(), value, field.name, options);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return jsonValue;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns `null` as the default for google.protobuf.NullValue.
|
||||||
|
*/
|
||||||
|
enum(type, value, fieldName, optional, emitDefaultValues, enumAsInteger) {
|
||||||
|
if (type[0] == 'google.protobuf.NullValue')
|
||||||
|
return !emitDefaultValues && !optional ? undefined : null;
|
||||||
|
if (value === undefined) {
|
||||||
|
assert_1.assert(optional);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
if (value === 0 && !emitDefaultValues && !optional)
|
||||||
|
// we require 0 to be default value for all enums
|
||||||
|
return undefined;
|
||||||
|
assert_1.assert(typeof value == 'number');
|
||||||
|
assert_1.assert(Number.isInteger(value));
|
||||||
|
if (enumAsInteger || !type[1].hasOwnProperty(value))
|
||||||
|
// if we don't now the enum value, just return the number
|
||||||
|
return value;
|
||||||
|
if (type[2])
|
||||||
|
// restore the dropped prefix
|
||||||
|
return type[2] + type[1][value];
|
||||||
|
return type[1][value];
|
||||||
|
}
|
||||||
|
message(type, value, fieldName, options) {
|
||||||
|
if (value === undefined)
|
||||||
|
return options.emitDefaultValues ? null : undefined;
|
||||||
|
return type.internalJsonWrite(value, options);
|
||||||
|
}
|
||||||
|
scalar(type, value, fieldName, optional, emitDefaultValues) {
|
||||||
|
if (value === undefined) {
|
||||||
|
assert_1.assert(optional);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const ed = emitDefaultValues || optional;
|
||||||
|
// noinspection FallThroughInSwitchStatementJS
|
||||||
|
switch (type) {
|
||||||
|
// int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.
|
||||||
|
case reflection_info_1.ScalarType.INT32:
|
||||||
|
case reflection_info_1.ScalarType.SFIXED32:
|
||||||
|
case reflection_info_1.ScalarType.SINT32:
|
||||||
|
if (value === 0)
|
||||||
|
return ed ? 0 : undefined;
|
||||||
|
assert_1.assertInt32(value);
|
||||||
|
return value;
|
||||||
|
case reflection_info_1.ScalarType.FIXED32:
|
||||||
|
case reflection_info_1.ScalarType.UINT32:
|
||||||
|
if (value === 0)
|
||||||
|
return ed ? 0 : undefined;
|
||||||
|
assert_1.assertUInt32(value);
|
||||||
|
return value;
|
||||||
|
// float, double: JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity".
|
||||||
|
// Either numbers or strings are accepted. Exponent notation is also accepted.
|
||||||
|
case reflection_info_1.ScalarType.FLOAT:
|
||||||
|
assert_1.assertFloat32(value);
|
||||||
|
case reflection_info_1.ScalarType.DOUBLE:
|
||||||
|
if (value === 0)
|
||||||
|
return ed ? 0 : undefined;
|
||||||
|
assert_1.assert(typeof value == 'number');
|
||||||
|
if (Number.isNaN(value))
|
||||||
|
return 'NaN';
|
||||||
|
if (value === Number.POSITIVE_INFINITY)
|
||||||
|
return 'Infinity';
|
||||||
|
if (value === Number.NEGATIVE_INFINITY)
|
||||||
|
return '-Infinity';
|
||||||
|
return value;
|
||||||
|
// string:
|
||||||
|
case reflection_info_1.ScalarType.STRING:
|
||||||
|
if (value === "")
|
||||||
|
return ed ? '' : undefined;
|
||||||
|
assert_1.assert(typeof value == 'string');
|
||||||
|
return value;
|
||||||
|
// bool:
|
||||||
|
case reflection_info_1.ScalarType.BOOL:
|
||||||
|
if (value === false)
|
||||||
|
return ed ? false : undefined;
|
||||||
|
assert_1.assert(typeof value == 'boolean');
|
||||||
|
return value;
|
||||||
|
// JSON value will be a decimal string. Either numbers or strings are accepted.
|
||||||
|
case reflection_info_1.ScalarType.UINT64:
|
||||||
|
case reflection_info_1.ScalarType.FIXED64:
|
||||||
|
assert_1.assert(typeof value == 'number' || typeof value == 'string' || typeof value == 'bigint');
|
||||||
|
let ulong = pb_long_1.PbULong.from(value);
|
||||||
|
if (ulong.isZero() && !ed)
|
||||||
|
return undefined;
|
||||||
|
return ulong.toString();
|
||||||
|
// JSON value will be a decimal string. Either numbers or strings are accepted.
|
||||||
|
case reflection_info_1.ScalarType.INT64:
|
||||||
|
case reflection_info_1.ScalarType.SFIXED64:
|
||||||
|
case reflection_info_1.ScalarType.SINT64:
|
||||||
|
assert_1.assert(typeof value == 'number' || typeof value == 'string' || typeof value == 'bigint');
|
||||||
|
let long = pb_long_1.PbLong.from(value);
|
||||||
|
if (long.isZero() && !ed)
|
||||||
|
return undefined;
|
||||||
|
return long.toString();
|
||||||
|
// bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.
|
||||||
|
// Either standard or URL-safe base64 encoding with/without paddings are accepted.
|
||||||
|
case reflection_info_1.ScalarType.BYTES:
|
||||||
|
assert_1.assert(value instanceof Uint8Array);
|
||||||
|
if (!value.byteLength)
|
||||||
|
return ed ? "" : undefined;
|
||||||
|
return base64_1.base64encode(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ReflectionJsonWriter = ReflectionJsonWriter;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 3402:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.reflectionLongConvert = void 0;
|
||||||
|
const reflection_info_1 = __nccwpck_require__(7910);
|
||||||
|
/**
|
||||||
|
* Utility method to convert a PbLong or PbUlong to a JavaScript
|
||||||
|
* representation during runtime.
|
||||||
|
*
|
||||||
|
* Works with generated field information, `undefined` is equivalent
|
||||||
|
* to `STRING`.
|
||||||
|
*/
|
||||||
|
function reflectionLongConvert(long, type) {
|
||||||
|
switch (type) {
|
||||||
|
case reflection_info_1.LongType.BIGINT:
|
||||||
|
return long.toBigInt();
|
||||||
|
case reflection_info_1.LongType.NUMBER:
|
||||||
|
return long.toNumber();
|
||||||
|
default:
|
||||||
|
// case undefined:
|
||||||
|
// case LongType.STRING:
|
||||||
|
return long.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.reflectionLongConvert = reflectionLongConvert;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 8044:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.reflectionMergePartial = void 0;
|
||||||
|
/**
|
||||||
|
* Copy partial data into the target message.
|
||||||
|
*
|
||||||
|
* If a singular scalar or enum field is present in the source, it
|
||||||
|
* replaces the field in the target.
|
||||||
|
*
|
||||||
|
* If a singular message field is present in the source, it is merged
|
||||||
|
* with the target field by calling mergePartial() of the responsible
|
||||||
|
* message type.
|
||||||
|
*
|
||||||
|
* If a repeated field is present in the source, its values replace
|
||||||
|
* all values in the target array, removing extraneous values.
|
||||||
|
* Repeated message fields are copied, not merged.
|
||||||
|
*
|
||||||
|
* If a map field is present in the source, entries are added to the
|
||||||
|
* target map, replacing entries with the same key. Entries that only
|
||||||
|
* exist in the target remain. Entries with message values are copied,
|
||||||
|
* not merged.
|
||||||
|
*
|
||||||
|
* Note that this function differs from protobuf merge semantics,
|
||||||
|
* which appends repeated fields.
|
||||||
|
*/
|
||||||
|
function reflectionMergePartial(info, target, source) {
|
||||||
|
let fieldValue, // the field value we are working with
|
||||||
|
input = source, output; // where we want our field value to go
|
||||||
|
for (let field of info.fields) {
|
||||||
|
let name = field.localName;
|
||||||
|
if (field.oneof) {
|
||||||
|
const group = input[field.oneof]; // this is the oneof`s group in the source
|
||||||
|
if ((group === null || group === void 0 ? void 0 : group.oneofKind) == undefined) { // the user is free to omit
|
||||||
|
continue; // we skip this field, and all other members too
|
||||||
|
}
|
||||||
|
fieldValue = group[name]; // our value comes from the the oneof group of the source
|
||||||
|
output = target[field.oneof]; // and our output is the oneof group of the target
|
||||||
|
output.oneofKind = group.oneofKind; // always update discriminator
|
||||||
|
if (fieldValue == undefined) {
|
||||||
|
delete output[name]; // remove any existing value
|
||||||
|
continue; // skip further work on field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fieldValue = input[name]; // we are using the source directly
|
||||||
|
output = target; // we want our field value to go directly into the target
|
||||||
|
if (fieldValue == undefined) {
|
||||||
|
continue; // skip further work on field, existing value is used as is
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (field.repeat)
|
||||||
|
output[name].length = fieldValue.length; // resize target array to match source array
|
||||||
|
// now we just work with `fieldValue` and `output` to merge the value
|
||||||
|
switch (field.kind) {
|
||||||
|
case "scalar":
|
||||||
|
case "enum":
|
||||||
|
if (field.repeat)
|
||||||
|
for (let i = 0; i < fieldValue.length; i++)
|
||||||
|
output[name][i] = fieldValue[i]; // not a reference type
|
||||||
|
else
|
||||||
|
output[name] = fieldValue; // not a reference type
|
||||||
|
break;
|
||||||
|
case "message":
|
||||||
|
let T = field.T();
|
||||||
|
if (field.repeat)
|
||||||
|
for (let i = 0; i < fieldValue.length; i++)
|
||||||
|
output[name][i] = T.create(fieldValue[i]);
|
||||||
|
else if (output[name] === undefined)
|
||||||
|
output[name] = T.create(fieldValue); // nothing to merge with
|
||||||
|
else
|
||||||
|
T.mergePartial(output[name], fieldValue);
|
||||||
|
break;
|
||||||
|
case "map":
|
||||||
|
// Map and repeated fields are simply overwritten, not appended or merged
|
||||||
|
switch (field.V.kind) {
|
||||||
|
case "scalar":
|
||||||
|
case "enum":
|
||||||
|
Object.assign(output[name], fieldValue); // elements are not reference types
|
||||||
|
break;
|
||||||
|
case "message":
|
||||||
|
let T = field.V.T();
|
||||||
|
for (let k of Object.keys(fieldValue))
|
||||||
|
output[name][k] = T.create(fieldValue[k]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.reflectionMergePartial = reflectionMergePartial;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 9526:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.reflectionScalarDefault = void 0;
|
||||||
|
const reflection_info_1 = __nccwpck_require__(7910);
|
||||||
|
const reflection_long_convert_1 = __nccwpck_require__(3402);
|
||||||
|
const pb_long_1 = __nccwpck_require__(1753);
|
||||||
|
/**
|
||||||
|
* Creates the default value for a scalar type.
|
||||||
|
*/
|
||||||
|
function reflectionScalarDefault(type, longType = reflection_info_1.LongType.STRING) {
|
||||||
|
switch (type) {
|
||||||
|
case reflection_info_1.ScalarType.BOOL:
|
||||||
|
return false;
|
||||||
|
case reflection_info_1.ScalarType.UINT64:
|
||||||
|
case reflection_info_1.ScalarType.FIXED64:
|
||||||
|
return reflection_long_convert_1.reflectionLongConvert(pb_long_1.PbULong.ZERO, longType);
|
||||||
|
case reflection_info_1.ScalarType.INT64:
|
||||||
|
case reflection_info_1.ScalarType.SFIXED64:
|
||||||
|
case reflection_info_1.ScalarType.SINT64:
|
||||||
|
return reflection_long_convert_1.reflectionLongConvert(pb_long_1.PbLong.ZERO, longType);
|
||||||
|
case reflection_info_1.ScalarType.DOUBLE:
|
||||||
|
case reflection_info_1.ScalarType.FLOAT:
|
||||||
|
return 0.0;
|
||||||
|
case reflection_info_1.ScalarType.BYTES:
|
||||||
|
return new Uint8Array(0);
|
||||||
|
case reflection_info_1.ScalarType.STRING:
|
||||||
|
return "";
|
||||||
|
default:
|
||||||
|
// case ScalarType.INT32:
|
||||||
|
// case ScalarType.UINT32:
|
||||||
|
// case ScalarType.SINT32:
|
||||||
|
// case ScalarType.FIXED32:
|
||||||
|
// case ScalarType.SFIXED32:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.reflectionScalarDefault = reflectionScalarDefault;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 5167:
|
||||||
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.ReflectionTypeCheck = void 0;
|
||||||
|
const reflection_info_1 = __nccwpck_require__(7910);
|
||||||
|
const oneof_1 = __nccwpck_require__(8063);
|
||||||
|
// noinspection JSMethodCanBeStatic
|
||||||
|
class ReflectionTypeCheck {
|
||||||
|
constructor(info) {
|
||||||
|
var _a;
|
||||||
|
this.fields = (_a = info.fields) !== null && _a !== void 0 ? _a : [];
|
||||||
|
}
|
||||||
|
prepare() {
|
||||||
|
if (this.data)
|
||||||
|
return;
|
||||||
|
const req = [], known = [], oneofs = [];
|
||||||
|
for (let field of this.fields) {
|
||||||
|
if (field.oneof) {
|
||||||
|
if (!oneofs.includes(field.oneof)) {
|
||||||
|
oneofs.push(field.oneof);
|
||||||
|
req.push(field.oneof);
|
||||||
|
known.push(field.oneof);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
known.push(field.localName);
|
||||||
|
switch (field.kind) {
|
||||||
|
case "scalar":
|
||||||
|
case "enum":
|
||||||
|
if (!field.opt || field.repeat)
|
||||||
|
req.push(field.localName);
|
||||||
|
break;
|
||||||
|
case "message":
|
||||||
|
if (field.repeat)
|
||||||
|
req.push(field.localName);
|
||||||
|
break;
|
||||||
|
case "map":
|
||||||
|
req.push(field.localName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.data = { req, known, oneofs: Object.values(oneofs) };
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Is the argument a valid message as specified by the
|
||||||
|
* reflection information?
|
||||||
|
*
|
||||||
|
* Checks all field types recursively. The `depth`
|
||||||
|
* specifies how deep into the structure the check will be.
|
||||||
|
*
|
||||||
|
* With a depth of 0, only the presence of fields
|
||||||
|
* is checked.
|
||||||
|
*
|
||||||
|
* With a depth of 1 or more, the field types are checked.
|
||||||
|
*
|
||||||
|
* With a depth of 2 or more, the members of map, repeated
|
||||||
|
* and message fields are checked.
|
||||||
|
*
|
||||||
|
* Message fields will be checked recursively with depth - 1.
|
||||||
|
*
|
||||||
|
* The number of map entries / repeated values being checked
|
||||||
|
* is < depth.
|
||||||
|
*/
|
||||||
|
is(message, depth, allowExcessProperties = false) {
|
||||||
|
if (depth < 0)
|
||||||
|
return true;
|
||||||
|
if (message === null || message === undefined || typeof message != 'object')
|
||||||
|
return false;
|
||||||
|
this.prepare();
|
||||||
|
let keys = Object.keys(message), data = this.data;
|
||||||
|
// if a required field is missing in arg, this cannot be a T
|
||||||
|
if (keys.length < data.req.length || data.req.some(n => !keys.includes(n)))
|
||||||
|
return false;
|
||||||
|
if (!allowExcessProperties) {
|
||||||
|
// if the arg contains a key we dont know, this is not a literal T
|
||||||
|
if (keys.some(k => !data.known.includes(k)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// "With a depth of 0, only the presence and absence of fields is checked."
|
||||||
|
// "With a depth of 1 or more, the field types are checked."
|
||||||
|
if (depth < 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// check oneof group
|
||||||
|
for (const name of data.oneofs) {
|
||||||
|
const group = message[name];
|
||||||
|
if (!oneof_1.isOneofGroup(group))
|
||||||
|
return false;
|
||||||
|
if (group.oneofKind === undefined)
|
||||||
|
continue;
|
||||||
|
const field = this.fields.find(f => f.localName === group.oneofKind);
|
||||||
|
if (!field)
|
||||||
|
return false; // we found no field, but have a kind, something is wrong
|
||||||
|
if (!this.field(group[group.oneofKind], field, allowExcessProperties, depth))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// check types
|
||||||
|
for (const field of this.fields) {
|
||||||
|
if (field.oneof !== undefined)
|
||||||
|
continue;
|
||||||
|
if (!this.field(message[field.localName], field, allowExcessProperties, depth))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
field(arg, field, allowExcessProperties, depth) {
|
||||||
|
let repeated = field.repeat;
|
||||||
|
switch (field.kind) {
|
||||||
|
case "scalar":
|
||||||
|
if (arg === undefined)
|
||||||
|
return field.opt;
|
||||||
|
if (repeated)
|
||||||
|
return this.scalars(arg, field.T, depth, field.L);
|
||||||
|
return this.scalar(arg, field.T, field.L);
|
||||||
|
case "enum":
|
||||||
|
if (arg === undefined)
|
||||||
|
return field.opt;
|
||||||
|
if (repeated)
|
||||||
|
return this.scalars(arg, reflection_info_1.ScalarType.INT32, depth);
|
||||||
|
return this.scalar(arg, reflection_info_1.ScalarType.INT32);
|
||||||
|
case "message":
|
||||||
|
if (arg === undefined)
|
||||||
|
return true;
|
||||||
|
if (repeated)
|
||||||
|
return this.messages(arg, field.T(), allowExcessProperties, depth);
|
||||||
|
return this.message(arg, field.T(), allowExcessProperties, depth);
|
||||||
|
case "map":
|
||||||
|
if (typeof arg != 'object' || arg === null)
|
||||||
|
return false;
|
||||||
|
if (depth < 2)
|
||||||
|
return true;
|
||||||
|
if (!this.mapKeys(arg, field.K, depth))
|
||||||
|
return false;
|
||||||
|
switch (field.V.kind) {
|
||||||
|
case "scalar":
|
||||||
|
return this.scalars(Object.values(arg), field.V.T, depth, field.V.L);
|
||||||
|
case "enum":
|
||||||
|
return this.scalars(Object.values(arg), reflection_info_1.ScalarType.INT32, depth);
|
||||||
|
case "message":
|
||||||
|
return this.messages(Object.values(arg), field.V.T(), allowExcessProperties, depth);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
message(arg, type, allowExcessProperties, depth) {
|
||||||
|
if (allowExcessProperties) {
|
||||||
|
return type.isAssignable(arg, depth);
|
||||||
|
}
|
||||||
|
return type.is(arg, depth);
|
||||||
|
}
|
||||||
|
messages(arg, type, allowExcessProperties, depth) {
|
||||||
|
if (!Array.isArray(arg))
|
||||||
|
return false;
|
||||||
|
if (depth < 2)
|
||||||
|
return true;
|
||||||
|
if (allowExcessProperties) {
|
||||||
|
for (let i = 0; i < arg.length && i < depth; i++)
|
||||||
|
if (!type.isAssignable(arg[i], depth - 1))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (let i = 0; i < arg.length && i < depth; i++)
|
||||||
|
if (!type.is(arg[i], depth - 1))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
scalar(arg, type, longType) {
|
||||||
|
let argType = typeof arg;
|
||||||
|
switch (type) {
|
||||||
|
case reflection_info_1.ScalarType.UINT64:
|
||||||
|
case reflection_info_1.ScalarType.FIXED64:
|
||||||
|
case reflection_info_1.ScalarType.INT64:
|
||||||
|
case reflection_info_1.ScalarType.SFIXED64:
|
||||||
|
case reflection_info_1.ScalarType.SINT64:
|
||||||
|
switch (longType) {
|
||||||
|
case reflection_info_1.LongType.BIGINT:
|
||||||
|
return argType == "bigint";
|
||||||
|
case reflection_info_1.LongType.NUMBER:
|
||||||
|
return argType == "number" && !isNaN(arg);
|
||||||
|
default:
|
||||||
|
return argType == "string";
|
||||||
|
}
|
||||||
|
case reflection_info_1.ScalarType.BOOL:
|
||||||
|
return argType == 'boolean';
|
||||||
|
case reflection_info_1.ScalarType.STRING:
|
||||||
|
return argType == 'string';
|
||||||
|
case reflection_info_1.ScalarType.BYTES:
|
||||||
|
return arg instanceof Uint8Array;
|
||||||
|
case reflection_info_1.ScalarType.DOUBLE:
|
||||||
|
case reflection_info_1.ScalarType.FLOAT:
|
||||||
|
return argType == 'number' && !isNaN(arg);
|
||||||
|
default:
|
||||||
|
// case ScalarType.UINT32:
|
||||||
|
// case ScalarType.FIXED32:
|
||||||
|
// case ScalarType.INT32:
|
||||||
|
// case ScalarType.SINT32:
|
||||||
|
// case ScalarType.SFIXED32:
|
||||||
|
return argType == 'number' && Number.isInteger(arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scalars(arg, type, depth, longType) {
|
||||||
|
if (!Array.isArray(arg))
|
||||||
|
return false;
|
||||||
|
if (depth < 2)
|
||||||
|
return true;
|
||||||
|
if (Array.isArray(arg))
|
||||||
|
for (let i = 0; i < arg.length && i < depth; i++)
|
||||||
|
if (!this.scalar(arg[i], type, longType))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
mapKeys(map, type, depth) {
|
||||||
|
let keys = Object.keys(map);
|
||||||
|
switch (type) {
|
||||||
|
case reflection_info_1.ScalarType.INT32:
|
||||||
|
case reflection_info_1.ScalarType.FIXED32:
|
||||||
|
case reflection_info_1.ScalarType.SFIXED32:
|
||||||
|
case reflection_info_1.ScalarType.SINT32:
|
||||||
|
case reflection_info_1.ScalarType.UINT32:
|
||||||
|
return this.scalars(keys.slice(0, depth).map(k => parseInt(k)), type, depth);
|
||||||
|
case reflection_info_1.ScalarType.BOOL:
|
||||||
|
return this.scalars(keys.slice(0, depth).map(k => k == 'true' ? true : k == 'false' ? false : k), type, depth);
|
||||||
|
default:
|
||||||
|
return this.scalars(keys, type, depth, reflection_info_1.LongType.STRING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ReflectionTypeCheck = ReflectionTypeCheck;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 1324:
|
/***/ 1324:
|
||||||
@@ -48261,6 +55665,599 @@ DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 5129:
|
||||||
|
/***/ ((module) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
|
||||||
|
function _process (v, mod) {
|
||||||
|
var i
|
||||||
|
var r
|
||||||
|
|
||||||
|
if (typeof mod === 'function') {
|
||||||
|
r = mod(v)
|
||||||
|
if (r !== undefined) {
|
||||||
|
v = r
|
||||||
|
}
|
||||||
|
} else if (Array.isArray(mod)) {
|
||||||
|
for (i = 0; i < mod.length; i++) {
|
||||||
|
r = mod[i](v)
|
||||||
|
if (r !== undefined) {
|
||||||
|
v = r
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseKey (key, val) {
|
||||||
|
// detect negative index notation
|
||||||
|
if (key[0] === '-' && Array.isArray(val) && /^-\d+$/.test(key)) {
|
||||||
|
return val.length + parseInt(key, 10)
|
||||||
|
}
|
||||||
|
return key
|
||||||
|
}
|
||||||
|
|
||||||
|
function isIndex (k) {
|
||||||
|
return /^\d+$/.test(k)
|
||||||
|
}
|
||||||
|
|
||||||
|
function isObject (val) {
|
||||||
|
return Object.prototype.toString.call(val) === '[object Object]'
|
||||||
|
}
|
||||||
|
|
||||||
|
function isArrayOrObject (val) {
|
||||||
|
return Object(val) === val
|
||||||
|
}
|
||||||
|
|
||||||
|
function isEmptyObject (val) {
|
||||||
|
return Object.keys(val).length === 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var blacklist = ['__proto__', 'prototype', 'constructor']
|
||||||
|
var blacklistFilter = function (part) { return blacklist.indexOf(part) === -1 }
|
||||||
|
|
||||||
|
function parsePath (path, sep) {
|
||||||
|
if (path.indexOf('[') >= 0) {
|
||||||
|
path = path.replace(/\[/g, sep).replace(/]/g, '')
|
||||||
|
}
|
||||||
|
|
||||||
|
var parts = path.split(sep)
|
||||||
|
|
||||||
|
var check = parts.filter(blacklistFilter)
|
||||||
|
|
||||||
|
if (check.length !== parts.length) {
|
||||||
|
throw Error('Refusing to update blacklisted property ' + path)
|
||||||
|
}
|
||||||
|
|
||||||
|
return parts
|
||||||
|
}
|
||||||
|
|
||||||
|
var hasOwnProperty = Object.prototype.hasOwnProperty
|
||||||
|
|
||||||
|
function DotObject (separator, override, useArray, useBrackets) {
|
||||||
|
if (!(this instanceof DotObject)) {
|
||||||
|
return new DotObject(separator, override, useArray, useBrackets)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof override === 'undefined') override = false
|
||||||
|
if (typeof useArray === 'undefined') useArray = true
|
||||||
|
if (typeof useBrackets === 'undefined') useBrackets = true
|
||||||
|
this.separator = separator || '.'
|
||||||
|
this.override = override
|
||||||
|
this.useArray = useArray
|
||||||
|
this.useBrackets = useBrackets
|
||||||
|
this.keepArray = false
|
||||||
|
|
||||||
|
// contains touched arrays
|
||||||
|
this.cleanup = []
|
||||||
|
}
|
||||||
|
|
||||||
|
var dotDefault = new DotObject('.', false, true, true)
|
||||||
|
function wrap (method) {
|
||||||
|
return function () {
|
||||||
|
return dotDefault[method].apply(dotDefault, arguments)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DotObject.prototype._fill = function (a, obj, v, mod) {
|
||||||
|
var k = a.shift()
|
||||||
|
|
||||||
|
if (a.length > 0) {
|
||||||
|
obj[k] = obj[k] || (this.useArray && isIndex(a[0]) ? [] : {})
|
||||||
|
|
||||||
|
if (!isArrayOrObject(obj[k])) {
|
||||||
|
if (this.override) {
|
||||||
|
obj[k] = {}
|
||||||
|
} else {
|
||||||
|
if (!(isArrayOrObject(v) && isEmptyObject(v))) {
|
||||||
|
throw new Error(
|
||||||
|
'Trying to redefine `' + k + '` which is a ' + typeof obj[k]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this._fill(a, obj[k], v, mod)
|
||||||
|
} else {
|
||||||
|
if (!this.override && isArrayOrObject(obj[k]) && !isEmptyObject(obj[k])) {
|
||||||
|
if (!(isArrayOrObject(v) && isEmptyObject(v))) {
|
||||||
|
throw new Error("Trying to redefine non-empty obj['" + k + "']")
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
obj[k] = _process(v, mod)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Converts an object with dotted-key/value pairs to it's expanded version
|
||||||
|
*
|
||||||
|
* Optionally transformed by a set of modifiers.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* var row = {
|
||||||
|
* 'nr': 200,
|
||||||
|
* 'doc.name': ' My Document '
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* var mods = {
|
||||||
|
* 'doc.name': [_s.trim, _s.underscored]
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* dot.object(row, mods)
|
||||||
|
*
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {Object} mods
|
||||||
|
*/
|
||||||
|
DotObject.prototype.object = function (obj, mods) {
|
||||||
|
var self = this
|
||||||
|
|
||||||
|
Object.keys(obj).forEach(function (k) {
|
||||||
|
var mod = mods === undefined ? null : mods[k]
|
||||||
|
// normalize array notation.
|
||||||
|
var ok = parsePath(k, self.separator).join(self.separator)
|
||||||
|
|
||||||
|
if (ok.indexOf(self.separator) !== -1) {
|
||||||
|
self._fill(ok.split(self.separator), obj, obj[k], mod)
|
||||||
|
delete obj[k]
|
||||||
|
} else {
|
||||||
|
obj[k] = _process(obj[k], mod)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {String} path dotted path
|
||||||
|
* @param {String} v value to be set
|
||||||
|
* @param {Object} obj object to be modified
|
||||||
|
* @param {Function|Array} mod optional modifier
|
||||||
|
*/
|
||||||
|
DotObject.prototype.str = function (path, v, obj, mod) {
|
||||||
|
var ok = parsePath(path, this.separator).join(this.separator)
|
||||||
|
|
||||||
|
if (path.indexOf(this.separator) !== -1) {
|
||||||
|
this._fill(ok.split(this.separator), obj, v, mod)
|
||||||
|
} else {
|
||||||
|
obj[path] = _process(v, mod)
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Pick a value from an object using dot notation.
|
||||||
|
*
|
||||||
|
* Optionally remove the value
|
||||||
|
*
|
||||||
|
* @param {String} path
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {Boolean} remove
|
||||||
|
*/
|
||||||
|
DotObject.prototype.pick = function (path, obj, remove, reindexArray) {
|
||||||
|
var i
|
||||||
|
var keys
|
||||||
|
var val
|
||||||
|
var key
|
||||||
|
var cp
|
||||||
|
|
||||||
|
keys = parsePath(path, this.separator)
|
||||||
|
for (i = 0; i < keys.length; i++) {
|
||||||
|
key = parseKey(keys[i], obj)
|
||||||
|
if (obj && typeof obj === 'object' && key in obj) {
|
||||||
|
if (i === keys.length - 1) {
|
||||||
|
if (remove) {
|
||||||
|
val = obj[key]
|
||||||
|
if (reindexArray && Array.isArray(obj)) {
|
||||||
|
obj.splice(key, 1)
|
||||||
|
} else {
|
||||||
|
delete obj[key]
|
||||||
|
}
|
||||||
|
if (Array.isArray(obj)) {
|
||||||
|
cp = keys.slice(0, -1).join('.')
|
||||||
|
if (this.cleanup.indexOf(cp) === -1) {
|
||||||
|
this.cleanup.push(cp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return val
|
||||||
|
} else {
|
||||||
|
return obj[key]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
obj = obj[key]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (remove && Array.isArray(obj)) {
|
||||||
|
obj = obj.filter(function (n) {
|
||||||
|
return n !== undefined
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Delete value from an object using dot notation.
|
||||||
|
*
|
||||||
|
* @param {String} path
|
||||||
|
* @param {Object} obj
|
||||||
|
* @return {any} The removed value
|
||||||
|
*/
|
||||||
|
DotObject.prototype.delete = function (path, obj) {
|
||||||
|
return this.remove(path, obj, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Remove value from an object using dot notation.
|
||||||
|
*
|
||||||
|
* Will remove multiple items if path is an array.
|
||||||
|
* In this case array indexes will be retained until all
|
||||||
|
* removals have been processed.
|
||||||
|
*
|
||||||
|
* Use dot.delete() to automatically re-index arrays.
|
||||||
|
*
|
||||||
|
* @param {String|Array<String>} path
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {Boolean} reindexArray
|
||||||
|
* @return {any} The removed value
|
||||||
|
*/
|
||||||
|
DotObject.prototype.remove = function (path, obj, reindexArray) {
|
||||||
|
var i
|
||||||
|
|
||||||
|
this.cleanup = []
|
||||||
|
if (Array.isArray(path)) {
|
||||||
|
for (i = 0; i < path.length; i++) {
|
||||||
|
this.pick(path[i], obj, true, reindexArray)
|
||||||
|
}
|
||||||
|
if (!reindexArray) {
|
||||||
|
this._cleanup(obj)
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
} else {
|
||||||
|
return this.pick(path, obj, true, reindexArray)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DotObject.prototype._cleanup = function (obj) {
|
||||||
|
var ret
|
||||||
|
var i
|
||||||
|
var keys
|
||||||
|
var root
|
||||||
|
if (this.cleanup.length) {
|
||||||
|
for (i = 0; i < this.cleanup.length; i++) {
|
||||||
|
keys = this.cleanup[i].split('.')
|
||||||
|
root = keys.splice(0, -1).join('.')
|
||||||
|
ret = root ? this.pick(root, obj) : obj
|
||||||
|
ret = ret[keys[0]].filter(function (v) {
|
||||||
|
return v !== undefined
|
||||||
|
})
|
||||||
|
this.set(this.cleanup[i], ret, obj)
|
||||||
|
}
|
||||||
|
this.cleanup = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alias method for `dot.remove`
|
||||||
|
*
|
||||||
|
* Note: this is not an alias for dot.delete()
|
||||||
|
*
|
||||||
|
* @param {String|Array<String>} path
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {Boolean} reindexArray
|
||||||
|
* @return {any} The removed value
|
||||||
|
*/
|
||||||
|
DotObject.prototype.del = DotObject.prototype.remove
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Move a property from one place to the other.
|
||||||
|
*
|
||||||
|
* If the source path does not exist (undefined)
|
||||||
|
* the target property will not be set.
|
||||||
|
*
|
||||||
|
* @param {String} source
|
||||||
|
* @param {String} target
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {Function|Array} mods
|
||||||
|
* @param {Boolean} merge
|
||||||
|
*/
|
||||||
|
DotObject.prototype.move = function (source, target, obj, mods, merge) {
|
||||||
|
if (typeof mods === 'function' || Array.isArray(mods)) {
|
||||||
|
this.set(target, _process(this.pick(source, obj, true), mods), obj, merge)
|
||||||
|
} else {
|
||||||
|
merge = mods
|
||||||
|
this.set(target, this.pick(source, obj, true), obj, merge)
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Transfer a property from one object to another object.
|
||||||
|
*
|
||||||
|
* If the source path does not exist (undefined)
|
||||||
|
* the property on the other object will not be set.
|
||||||
|
*
|
||||||
|
* @param {String} source
|
||||||
|
* @param {String} target
|
||||||
|
* @param {Object} obj1
|
||||||
|
* @param {Object} obj2
|
||||||
|
* @param {Function|Array} mods
|
||||||
|
* @param {Boolean} merge
|
||||||
|
*/
|
||||||
|
DotObject.prototype.transfer = function (
|
||||||
|
source,
|
||||||
|
target,
|
||||||
|
obj1,
|
||||||
|
obj2,
|
||||||
|
mods,
|
||||||
|
merge
|
||||||
|
) {
|
||||||
|
if (typeof mods === 'function' || Array.isArray(mods)) {
|
||||||
|
this.set(
|
||||||
|
target,
|
||||||
|
_process(this.pick(source, obj1, true), mods),
|
||||||
|
obj2,
|
||||||
|
merge
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
merge = mods
|
||||||
|
this.set(target, this.pick(source, obj1, true), obj2, merge)
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj2
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copy a property from one object to another object.
|
||||||
|
*
|
||||||
|
* If the source path does not exist (undefined)
|
||||||
|
* the property on the other object will not be set.
|
||||||
|
*
|
||||||
|
* @param {String} source
|
||||||
|
* @param {String} target
|
||||||
|
* @param {Object} obj1
|
||||||
|
* @param {Object} obj2
|
||||||
|
* @param {Function|Array} mods
|
||||||
|
* @param {Boolean} merge
|
||||||
|
*/
|
||||||
|
DotObject.prototype.copy = function (source, target, obj1, obj2, mods, merge) {
|
||||||
|
if (typeof mods === 'function' || Array.isArray(mods)) {
|
||||||
|
this.set(
|
||||||
|
target,
|
||||||
|
_process(
|
||||||
|
// clone what is picked
|
||||||
|
JSON.parse(JSON.stringify(this.pick(source, obj1, false))),
|
||||||
|
mods
|
||||||
|
),
|
||||||
|
obj2,
|
||||||
|
merge
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
merge = mods
|
||||||
|
this.set(target, this.pick(source, obj1, false), obj2, merge)
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj2
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Set a property on an object using dot notation.
|
||||||
|
*
|
||||||
|
* @param {String} path
|
||||||
|
* @param {any} val
|
||||||
|
* @param {Object} obj
|
||||||
|
* @param {Boolean} merge
|
||||||
|
*/
|
||||||
|
DotObject.prototype.set = function (path, val, obj, merge) {
|
||||||
|
var i
|
||||||
|
var k
|
||||||
|
var keys
|
||||||
|
var key
|
||||||
|
|
||||||
|
// Do not operate if the value is undefined.
|
||||||
|
if (typeof val === 'undefined') {
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
keys = parsePath(path, this.separator)
|
||||||
|
|
||||||
|
for (i = 0; i < keys.length; i++) {
|
||||||
|
key = keys[i]
|
||||||
|
if (i === keys.length - 1) {
|
||||||
|
if (merge && isObject(val) && isObject(obj[key])) {
|
||||||
|
for (k in val) {
|
||||||
|
if (hasOwnProperty.call(val, k)) {
|
||||||
|
obj[key][k] = val[k]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (merge && Array.isArray(obj[key]) && Array.isArray(val)) {
|
||||||
|
for (var j = 0; j < val.length; j++) {
|
||||||
|
obj[keys[i]].push(val[j])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
obj[key] = val
|
||||||
|
}
|
||||||
|
} else if (
|
||||||
|
// force the value to be an object
|
||||||
|
!hasOwnProperty.call(obj, key) ||
|
||||||
|
(!isObject(obj[key]) && !Array.isArray(obj[key]))
|
||||||
|
) {
|
||||||
|
// initialize as array if next key is numeric
|
||||||
|
if (/^\d+$/.test(keys[i + 1])) {
|
||||||
|
obj[key] = []
|
||||||
|
} else {
|
||||||
|
obj[key] = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj = obj[key]
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Transform an object
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* var obj = {
|
||||||
|
* "id": 1,
|
||||||
|
* "some": {
|
||||||
|
* "thing": "else"
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* var transform = {
|
||||||
|
* "id": "nr",
|
||||||
|
* "some.thing": "name"
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* var tgt = dot.transform(transform, obj)
|
||||||
|
*
|
||||||
|
* @param {Object} recipe Transform recipe
|
||||||
|
* @param {Object} obj Object to be transformed
|
||||||
|
* @param {Array} mods modifiers for the target
|
||||||
|
*/
|
||||||
|
DotObject.prototype.transform = function (recipe, obj, tgt) {
|
||||||
|
obj = obj || {}
|
||||||
|
tgt = tgt || {}
|
||||||
|
Object.keys(recipe).forEach(
|
||||||
|
function (key) {
|
||||||
|
this.set(recipe[key], this.pick(key, obj), tgt)
|
||||||
|
}.bind(this)
|
||||||
|
)
|
||||||
|
return tgt
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Convert object to dotted-key/value pair
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* var tgt = dot.dot(obj)
|
||||||
|
*
|
||||||
|
* or
|
||||||
|
*
|
||||||
|
* var tgt = {}
|
||||||
|
* dot.dot(obj, tgt)
|
||||||
|
*
|
||||||
|
* @param {Object} obj source object
|
||||||
|
* @param {Object} tgt target object
|
||||||
|
* @param {Array} path path array (internal)
|
||||||
|
*/
|
||||||
|
DotObject.prototype.dot = function (obj, tgt, path) {
|
||||||
|
tgt = tgt || {}
|
||||||
|
path = path || []
|
||||||
|
var isArray = Array.isArray(obj)
|
||||||
|
|
||||||
|
Object.keys(obj).forEach(
|
||||||
|
function (key) {
|
||||||
|
var index = isArray && this.useBrackets ? '[' + key + ']' : key
|
||||||
|
if (
|
||||||
|
isArrayOrObject(obj[key]) &&
|
||||||
|
((isObject(obj[key]) && !isEmptyObject(obj[key])) ||
|
||||||
|
(Array.isArray(obj[key]) && !this.keepArray && obj[key].length !== 0))
|
||||||
|
) {
|
||||||
|
if (isArray && this.useBrackets) {
|
||||||
|
var previousKey = path[path.length - 1] || ''
|
||||||
|
return this.dot(
|
||||||
|
obj[key],
|
||||||
|
tgt,
|
||||||
|
path.slice(0, -1).concat(previousKey + index)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return this.dot(obj[key], tgt, path.concat(index))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isArray && this.useBrackets) {
|
||||||
|
tgt[path.join(this.separator).concat('[' + key + ']')] = obj[key]
|
||||||
|
} else {
|
||||||
|
tgt[path.concat(index).join(this.separator)] = obj[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.bind(this)
|
||||||
|
)
|
||||||
|
return tgt
|
||||||
|
}
|
||||||
|
|
||||||
|
DotObject.pick = wrap('pick')
|
||||||
|
DotObject.move = wrap('move')
|
||||||
|
DotObject.transfer = wrap('transfer')
|
||||||
|
DotObject.transform = wrap('transform')
|
||||||
|
DotObject.copy = wrap('copy')
|
||||||
|
DotObject.object = wrap('object')
|
||||||
|
DotObject.str = wrap('str')
|
||||||
|
DotObject.set = wrap('set')
|
||||||
|
DotObject.delete = wrap('delete')
|
||||||
|
DotObject.del = DotObject.remove = wrap('remove')
|
||||||
|
DotObject.dot = wrap('dot');
|
||||||
|
['override', 'overwrite'].forEach(function (prop) {
|
||||||
|
Object.defineProperty(DotObject, prop, {
|
||||||
|
get: function () {
|
||||||
|
return dotDefault.override
|
||||||
|
},
|
||||||
|
set: function (val) {
|
||||||
|
dotDefault.override = !!val
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
['useArray', 'keepArray', 'useBrackets'].forEach(function (prop) {
|
||||||
|
Object.defineProperty(DotObject, prop, {
|
||||||
|
get: function () {
|
||||||
|
return dotDefault[prop]
|
||||||
|
},
|
||||||
|
set: function (val) {
|
||||||
|
dotDefault[prop] = val
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
DotObject._process = _process
|
||||||
|
|
||||||
|
module.exports = DotObject
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 9829:
|
/***/ 9829:
|
||||||
@@ -53133,6 +61130,1152 @@ if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
|||||||
exports.debug = debug; // for test
|
exports.debug = debug; // for test
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 5497:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 3315:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.isValidErrorCode = exports.httpStatusFromErrorCode = exports.TwirpErrorCode = exports.BadRouteError = exports.InternalServerErrorWith = exports.InternalServerError = exports.RequiredArgumentError = exports.InvalidArgumentError = exports.NotFoundError = exports.TwirpError = void 0;
|
||||||
|
/**
|
||||||
|
* Represents a twirp error
|
||||||
|
*/
|
||||||
|
class TwirpError extends Error {
|
||||||
|
constructor(code, msg) {
|
||||||
|
super(msg);
|
||||||
|
this.code = TwirpErrorCode.Internal;
|
||||||
|
this.meta = {};
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
Object.setPrototypeOf(this, TwirpError.prototype);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds a metadata kv to the error
|
||||||
|
* @param key
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
withMeta(key, value) {
|
||||||
|
this.meta[key] = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns a single metadata value
|
||||||
|
* return "" if not found
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
getMeta(key) {
|
||||||
|
return this.meta[key] || "";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Add the original error cause
|
||||||
|
* @param err
|
||||||
|
* @param addMeta
|
||||||
|
*/
|
||||||
|
withCause(err, addMeta = false) {
|
||||||
|
this._originalCause = err;
|
||||||
|
if (addMeta) {
|
||||||
|
this.withMeta("cause", err.message);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
cause() {
|
||||||
|
return this._originalCause;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the error representation to JSON
|
||||||
|
*/
|
||||||
|
toJSON() {
|
||||||
|
try {
|
||||||
|
return JSON.stringify({
|
||||||
|
code: this.code,
|
||||||
|
msg: this.msg,
|
||||||
|
meta: this.meta,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
return `{"code": "internal", "msg": "There was an error but it could not be serialized into JSON"}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Create a twirp error from an object
|
||||||
|
* @param obj
|
||||||
|
*/
|
||||||
|
static fromObject(obj) {
|
||||||
|
const code = obj["code"] || TwirpErrorCode.Unknown;
|
||||||
|
const msg = obj["msg"] || "unknown";
|
||||||
|
const error = new TwirpError(code, msg);
|
||||||
|
if (obj["meta"]) {
|
||||||
|
Object.keys(obj["meta"]).forEach((key) => {
|
||||||
|
error.withMeta(key, obj["meta"][key]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.TwirpError = TwirpError;
|
||||||
|
/**
|
||||||
|
* NotFoundError constructor for the common NotFound error.
|
||||||
|
*/
|
||||||
|
class NotFoundError extends TwirpError {
|
||||||
|
constructor(msg) {
|
||||||
|
super(TwirpErrorCode.NotFound, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.NotFoundError = NotFoundError;
|
||||||
|
/**
|
||||||
|
* InvalidArgumentError constructor for the common InvalidArgument error. Can be
|
||||||
|
* used when an argument has invalid format, is a number out of range, is a bad
|
||||||
|
* option, etc).
|
||||||
|
*/
|
||||||
|
class InvalidArgumentError extends TwirpError {
|
||||||
|
constructor(argument, validationMsg) {
|
||||||
|
super(TwirpErrorCode.InvalidArgument, argument + " " + validationMsg);
|
||||||
|
this.withMeta("argument", argument);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.InvalidArgumentError = InvalidArgumentError;
|
||||||
|
/**
|
||||||
|
* RequiredArgumentError is a more specific constructor for InvalidArgument
|
||||||
|
* error. Should be used when the argument is required (expected to have a
|
||||||
|
* non-zero value).
|
||||||
|
*/
|
||||||
|
class RequiredArgumentError extends InvalidArgumentError {
|
||||||
|
constructor(argument) {
|
||||||
|
super(argument, "is required");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.RequiredArgumentError = RequiredArgumentError;
|
||||||
|
/**
|
||||||
|
* InternalError constructor for the common Internal error. Should be used to
|
||||||
|
* specify that something bad or unexpected happened.
|
||||||
|
*/
|
||||||
|
class InternalServerError extends TwirpError {
|
||||||
|
constructor(msg) {
|
||||||
|
super(TwirpErrorCode.Internal, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.InternalServerError = InternalServerError;
|
||||||
|
/**
|
||||||
|
* InternalErrorWith makes an internal error, wrapping the original error and using it
|
||||||
|
* for the error message, and with metadata "cause" with the original error type.
|
||||||
|
* This function is used by Twirp services to wrap non-Twirp errors as internal errors.
|
||||||
|
* The wrapped error can be extracted later with err.cause()
|
||||||
|
*/
|
||||||
|
class InternalServerErrorWith extends InternalServerError {
|
||||||
|
constructor(err) {
|
||||||
|
super(err.message);
|
||||||
|
this.withMeta("cause", err.name);
|
||||||
|
this.withCause(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.InternalServerErrorWith = InternalServerErrorWith;
|
||||||
|
/**
|
||||||
|
* A standard BadRoute Error
|
||||||
|
*/
|
||||||
|
class BadRouteError extends TwirpError {
|
||||||
|
constructor(msg, method, url) {
|
||||||
|
super(TwirpErrorCode.BadRoute, msg);
|
||||||
|
this.withMeta("twirp_invalid_route", method + " " + url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.BadRouteError = BadRouteError;
|
||||||
|
var TwirpErrorCode;
|
||||||
|
(function (TwirpErrorCode) {
|
||||||
|
// Canceled indicates the operation was cancelled (typically by the caller).
|
||||||
|
TwirpErrorCode["Canceled"] = "canceled";
|
||||||
|
// Unknown error. For example when handling errors raised by APIs that do not
|
||||||
|
// return enough error information.
|
||||||
|
TwirpErrorCode["Unknown"] = "unknown";
|
||||||
|
// InvalidArgument indicates client specified an invalid argument. It
|
||||||
|
// indicates arguments that are problematic regardless of the state of the
|
||||||
|
// system (i.e. a malformed file name, required argument, number out of range,
|
||||||
|
// etc.).
|
||||||
|
TwirpErrorCode["InvalidArgument"] = "invalid_argument";
|
||||||
|
// Malformed indicates an error occurred while decoding the client's request.
|
||||||
|
// This may mean that the message was encoded improperly, or that there is a
|
||||||
|
// disagreement in message format between the client and server.
|
||||||
|
TwirpErrorCode["Malformed"] = "malformed";
|
||||||
|
// DeadlineExceeded means operation expired before completion. For operations
|
||||||
|
// that change the state of the system, this error may be returned even if the
|
||||||
|
// operation has completed successfully (timeout).
|
||||||
|
TwirpErrorCode["DeadlineExceeded"] = "deadline_exceeded";
|
||||||
|
// NotFound means some requested entity was not found.
|
||||||
|
TwirpErrorCode["NotFound"] = "not_found";
|
||||||
|
// BadRoute means that the requested URL path wasn't routable to a Twirp
|
||||||
|
// service and method. This is returned by the generated server, and usually
|
||||||
|
// shouldn't be returned by applications. Instead, applications should use
|
||||||
|
// NotFound or Unimplemented.
|
||||||
|
TwirpErrorCode["BadRoute"] = "bad_route";
|
||||||
|
// AlreadyExists means an attempt to create an entity failed because one
|
||||||
|
// already exists.
|
||||||
|
TwirpErrorCode["AlreadyExists"] = "already_exists";
|
||||||
|
// PermissionDenied indicates the caller does not have permission to execute
|
||||||
|
// the specified operation. It must not be used if the caller cannot be
|
||||||
|
// identified (Unauthenticated).
|
||||||
|
TwirpErrorCode["PermissionDenied"] = "permission_denied";
|
||||||
|
// Unauthenticated indicates the request does not have valid authentication
|
||||||
|
// credentials for the operation.
|
||||||
|
TwirpErrorCode["Unauthenticated"] = "unauthenticated";
|
||||||
|
// ResourceExhausted indicates some resource has been exhausted, perhaps a
|
||||||
|
// per-user quota, or perhaps the entire file system is out of space.
|
||||||
|
TwirpErrorCode["ResourceExhausted"] = "resource_exhausted";
|
||||||
|
// FailedPrecondition indicates operation was rejected because the system is
|
||||||
|
// not in a state required for the operation's execution. For example, doing
|
||||||
|
// an rmdir operation on a directory that is non-empty, or on a non-directory
|
||||||
|
// object, or when having conflicting read-modify-write on the same resource.
|
||||||
|
TwirpErrorCode["FailedPrecondition"] = "failed_precondition";
|
||||||
|
// Aborted indicates the operation was aborted, typically due to a concurrency
|
||||||
|
// issue like sequencer check failures, transaction aborts, etc.
|
||||||
|
TwirpErrorCode["Aborted"] = "aborted";
|
||||||
|
// OutOfRange means operation was attempted past the valid range. For example,
|
||||||
|
// seeking or reading past end of a paginated collection.
|
||||||
|
//
|
||||||
|
// Unlike InvalidArgument, this error indicates a problem that may be fixed if
|
||||||
|
// the system state changes (i.e. adding more items to the collection).
|
||||||
|
//
|
||||||
|
// There is a fair bit of overlap between FailedPrecondition and OutOfRange.
|
||||||
|
// We recommend using OutOfRange (the more specific error) when it applies so
|
||||||
|
// that callers who are iterating through a space can easily look for an
|
||||||
|
// OutOfRange error to detect when they are done.
|
||||||
|
TwirpErrorCode["OutOfRange"] = "out_of_range";
|
||||||
|
// Unimplemented indicates operation is not implemented or not
|
||||||
|
// supported/enabled in this service.
|
||||||
|
TwirpErrorCode["Unimplemented"] = "unimplemented";
|
||||||
|
// Internal errors. When some invariants expected by the underlying system
|
||||||
|
// have been broken. In other words, something bad happened in the library or
|
||||||
|
// backend service. Do not confuse with HTTP Internal Server Error; an
|
||||||
|
// Internal error could also happen on the client code, i.e. when parsing a
|
||||||
|
// server response.
|
||||||
|
TwirpErrorCode["Internal"] = "internal";
|
||||||
|
// Unavailable indicates the service is currently unavailable. This is a most
|
||||||
|
// likely a transient condition and may be corrected by retrying with a
|
||||||
|
// backoff.
|
||||||
|
TwirpErrorCode["Unavailable"] = "unavailable";
|
||||||
|
// DataLoss indicates unrecoverable data loss or corruption.
|
||||||
|
TwirpErrorCode["DataLoss"] = "data_loss";
|
||||||
|
})(TwirpErrorCode = exports.TwirpErrorCode || (exports.TwirpErrorCode = {}));
|
||||||
|
// ServerHTTPStatusFromErrorCode maps a Twirp error type into a similar HTTP
|
||||||
|
// response status. It is used by the Twirp server handler to set the HTTP
|
||||||
|
// response status code. Returns 0 if the ErrorCode is invalid.
|
||||||
|
function httpStatusFromErrorCode(code) {
|
||||||
|
switch (code) {
|
||||||
|
case TwirpErrorCode.Canceled:
|
||||||
|
return 408; // RequestTimeout
|
||||||
|
case TwirpErrorCode.Unknown:
|
||||||
|
return 500; // Internal Server Error
|
||||||
|
case TwirpErrorCode.InvalidArgument:
|
||||||
|
return 400; // BadRequest
|
||||||
|
case TwirpErrorCode.Malformed:
|
||||||
|
return 400; // BadRequest
|
||||||
|
case TwirpErrorCode.DeadlineExceeded:
|
||||||
|
return 408; // RequestTimeout
|
||||||
|
case TwirpErrorCode.NotFound:
|
||||||
|
return 404; // Not Found
|
||||||
|
case TwirpErrorCode.BadRoute:
|
||||||
|
return 404; // Not Found
|
||||||
|
case TwirpErrorCode.AlreadyExists:
|
||||||
|
return 409; // Conflict
|
||||||
|
case TwirpErrorCode.PermissionDenied:
|
||||||
|
return 403; // Forbidden
|
||||||
|
case TwirpErrorCode.Unauthenticated:
|
||||||
|
return 401; // Unauthorized
|
||||||
|
case TwirpErrorCode.ResourceExhausted:
|
||||||
|
return 429; // Too Many Requests
|
||||||
|
case TwirpErrorCode.FailedPrecondition:
|
||||||
|
return 412; // Precondition Failed
|
||||||
|
case TwirpErrorCode.Aborted:
|
||||||
|
return 409; // Conflict
|
||||||
|
case TwirpErrorCode.OutOfRange:
|
||||||
|
return 400; // Bad Request
|
||||||
|
case TwirpErrorCode.Unimplemented:
|
||||||
|
return 501; // Not Implemented
|
||||||
|
case TwirpErrorCode.Internal:
|
||||||
|
return 500; // Internal Server Error
|
||||||
|
case TwirpErrorCode.Unavailable:
|
||||||
|
return 503; // Service Unavailable
|
||||||
|
case TwirpErrorCode.DataLoss:
|
||||||
|
return 500; // Internal Server Error
|
||||||
|
default:
|
||||||
|
return 0; // Invalid!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.httpStatusFromErrorCode = httpStatusFromErrorCode;
|
||||||
|
// IsValidErrorCode returns true if is one of the valid predefined constants.
|
||||||
|
function isValidErrorCode(code) {
|
||||||
|
return httpStatusFromErrorCode(code) != 0;
|
||||||
|
}
|
||||||
|
exports.isValidErrorCode = isValidErrorCode;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 9636:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __rest = (this && this.__rest) || function (s, e) {
|
||||||
|
var t = {};
|
||||||
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||||
|
t[p] = s[p];
|
||||||
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||||
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||||
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||||
|
t[p[i]] = s[p[i]];
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.Gateway = exports.Pattern = void 0;
|
||||||
|
const querystring_1 = __nccwpck_require__(3480);
|
||||||
|
const dotObject = __importStar(__nccwpck_require__(5129));
|
||||||
|
const request_1 = __nccwpck_require__(9647);
|
||||||
|
const errors_1 = __nccwpck_require__(3315);
|
||||||
|
const http_client_1 = __nccwpck_require__(5683);
|
||||||
|
const server_1 = __nccwpck_require__(1035);
|
||||||
|
var Pattern;
|
||||||
|
(function (Pattern) {
|
||||||
|
Pattern["POST"] = "post";
|
||||||
|
Pattern["GET"] = "get";
|
||||||
|
Pattern["PATCH"] = "patch";
|
||||||
|
Pattern["PUT"] = "put";
|
||||||
|
Pattern["DELETE"] = "delete";
|
||||||
|
})(Pattern = exports.Pattern || (exports.Pattern = {}));
|
||||||
|
/**
|
||||||
|
* The Gateway proxies http requests to Twirp Compliant
|
||||||
|
* handlers
|
||||||
|
*/
|
||||||
|
class Gateway {
|
||||||
|
constructor(routes) {
|
||||||
|
this.routes = routes;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Middleware that rewrite the current request
|
||||||
|
* to a Twirp compliant request
|
||||||
|
*/
|
||||||
|
twirpRewrite(prefix = "/twirp") {
|
||||||
|
return (req, resp, next) => {
|
||||||
|
this.rewrite(req, resp, prefix)
|
||||||
|
.then(() => next())
|
||||||
|
.catch((e) => {
|
||||||
|
if (e instanceof errors_1.TwirpError) {
|
||||||
|
if (e.code !== errors_1.TwirpErrorCode.NotFound) {
|
||||||
|
server_1.writeError(resp, e);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Rewrite an incoming request to a Twirp compliant request
|
||||||
|
* @param req
|
||||||
|
* @param resp
|
||||||
|
* @param prefix
|
||||||
|
*/
|
||||||
|
rewrite(req, resp, prefix = "/twirp") {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const [match, route] = this.matchRoute(req);
|
||||||
|
const body = yield this.prepareTwirpBody(req, match, route);
|
||||||
|
const twirpUrl = `${prefix}/${route.packageName}.${route.serviceName}/${route.methodName}`;
|
||||||
|
req.url = twirpUrl;
|
||||||
|
req.originalUrl = twirpUrl;
|
||||||
|
req.method = "POST";
|
||||||
|
req.headers["content-type"] = "application/json";
|
||||||
|
req.rawBody = Buffer.from(JSON.stringify(body));
|
||||||
|
if (route.responseBodyKey) {
|
||||||
|
const endFn = resp.end.bind(resp);
|
||||||
|
resp.end = function (chunk) {
|
||||||
|
if (resp.statusCode === 200) {
|
||||||
|
endFn(`{ "${route.responseBodyKey}": ${chunk} }`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
endFn(chunk);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Create a reverse proxy handler to
|
||||||
|
* proxy http requests to Twirp Compliant handlers
|
||||||
|
* @param httpClientOption
|
||||||
|
*/
|
||||||
|
reverseProxy(httpClientOption) {
|
||||||
|
const client = http_client_1.NodeHttpRPC(httpClientOption);
|
||||||
|
return (req, res) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
try {
|
||||||
|
const [match, route] = this.matchRoute(req);
|
||||||
|
const body = yield this.prepareTwirpBody(req, match, route);
|
||||||
|
const response = yield client.request(`${route.packageName}.${route.serviceName}`, route.methodName, "application/json", body);
|
||||||
|
res.statusCode = 200;
|
||||||
|
res.setHeader("content-type", "application/json");
|
||||||
|
let jsonResponse;
|
||||||
|
if (route.responseBodyKey) {
|
||||||
|
jsonResponse = JSON.stringify({ [route.responseBodyKey]: response });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
jsonResponse = JSON.stringify(response);
|
||||||
|
}
|
||||||
|
res.end(jsonResponse);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
server_1.writeError(res, e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Prepares twirp body requests using http.google.annotions
|
||||||
|
* compliant spec
|
||||||
|
*
|
||||||
|
* @param req
|
||||||
|
* @param match
|
||||||
|
* @param route
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
prepareTwirpBody(req, match, route) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const _a = match.params, { query_string } = _a, params = __rest(_a, ["query_string"]);
|
||||||
|
let requestBody = Object.assign({}, params);
|
||||||
|
if (query_string && route.bodyKey !== "*") {
|
||||||
|
const queryParams = this.parseQueryString(query_string);
|
||||||
|
requestBody = Object.assign(Object.assign({}, queryParams), requestBody);
|
||||||
|
}
|
||||||
|
let body = {};
|
||||||
|
if (route.bodyKey) {
|
||||||
|
const data = yield request_1.getRequestData(req);
|
||||||
|
try {
|
||||||
|
const jsonBody = JSON.parse(data.toString() || "{}");
|
||||||
|
if (route.bodyKey === "*") {
|
||||||
|
body = jsonBody;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
body[route.bodyKey] = jsonBody;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
const msg = "the json request could not be decoded";
|
||||||
|
throw new errors_1.TwirpError(errors_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Object.assign(Object.assign({}, body), requestBody);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Matches a route
|
||||||
|
* @param req
|
||||||
|
*/
|
||||||
|
matchRoute(req) {
|
||||||
|
var _a;
|
||||||
|
const httpMethod = (_a = req.method) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
||||||
|
if (!httpMethod) {
|
||||||
|
throw new errors_1.BadRouteError(`method not allowed`, req.method || "", req.url || "");
|
||||||
|
}
|
||||||
|
const routes = this.routes[httpMethod];
|
||||||
|
for (const route of routes) {
|
||||||
|
const match = route.matcher(req.url || "/");
|
||||||
|
if (match) {
|
||||||
|
return [match, route];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new errors_1.NotFoundError(`url ${req.url} not found`);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Parse query string
|
||||||
|
* @param queryString
|
||||||
|
*/
|
||||||
|
parseQueryString(queryString) {
|
||||||
|
const queryParams = querystring_1.parse(queryString.replace("?", ""));
|
||||||
|
return dotObject.object(queryParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Gateway = Gateway;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 3898:
|
||||||
|
/***/ (function(__unused_webpack_module, exports) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.isHook = exports.chainHooks = void 0;
|
||||||
|
// ChainHooks creates a new ServerHook which chains the callbacks in
|
||||||
|
// each of the constituent hooks passed in. Each hook function will be
|
||||||
|
// called in the order of the ServerHooks values passed in.
|
||||||
|
//
|
||||||
|
// For the erroring hooks, RequestReceived and RequestRouted, any returned
|
||||||
|
// errors prevent processing by later hooks.
|
||||||
|
function chainHooks(...hooks) {
|
||||||
|
if (hooks.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (hooks.length === 1) {
|
||||||
|
return hooks[0];
|
||||||
|
}
|
||||||
|
const serverHook = {
|
||||||
|
requestReceived(ctx) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
for (const hook of hooks) {
|
||||||
|
if (!hook.requestReceived) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
yield hook.requestReceived(ctx);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
requestPrepared(ctx) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
for (const hook of hooks) {
|
||||||
|
if (!hook.requestPrepared) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
console.warn("hook requestPrepared is deprecated and will be removed in the next release. " +
|
||||||
|
"Please use responsePrepared instead.");
|
||||||
|
yield hook.requestPrepared(ctx);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
responsePrepared(ctx) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
for (const hook of hooks) {
|
||||||
|
if (!hook.responsePrepared) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
yield hook.responsePrepared(ctx);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
requestSent(ctx) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
for (const hook of hooks) {
|
||||||
|
if (!hook.requestSent) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
console.warn("hook requestSent is deprecated and will be removed in the next release. " +
|
||||||
|
"Please use responseSent instead.");
|
||||||
|
yield hook.requestSent(ctx);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
responseSent(ctx) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
for (const hook of hooks) {
|
||||||
|
if (!hook.responseSent) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
yield hook.responseSent(ctx);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
requestRouted(ctx) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
for (const hook of hooks) {
|
||||||
|
if (!hook.requestRouted) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
yield hook.requestRouted(ctx);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error(ctx, err) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
for (const hook of hooks) {
|
||||||
|
if (!hook.error) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
yield hook.error(ctx, err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return serverHook;
|
||||||
|
}
|
||||||
|
exports.chainHooks = chainHooks;
|
||||||
|
function isHook(object) {
|
||||||
|
return ("requestReceived" in object ||
|
||||||
|
"requestPrepared" in object ||
|
||||||
|
"requestSent" in object ||
|
||||||
|
"requestRouted" in object ||
|
||||||
|
"responsePrepared" in object ||
|
||||||
|
"responseSent" in object ||
|
||||||
|
"error" in object);
|
||||||
|
}
|
||||||
|
exports.isHook = isHook;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 5683:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.FetchRPC = exports.wrapErrorResponseToTwirpError = exports.NodeHttpRPC = void 0;
|
||||||
|
const http = __importStar(__nccwpck_require__(8611));
|
||||||
|
const https = __importStar(__nccwpck_require__(5692));
|
||||||
|
const url_1 = __nccwpck_require__(7016);
|
||||||
|
const errors_1 = __nccwpck_require__(3315);
|
||||||
|
/**
|
||||||
|
* a node HTTP RPC implementation
|
||||||
|
* @param options
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
const NodeHttpRPC = (options) => ({
|
||||||
|
request(service, method, contentType, data) {
|
||||||
|
let client;
|
||||||
|
return new Promise((resolve, rejected) => {
|
||||||
|
const responseChunks = [];
|
||||||
|
const requestData = contentType === "application/protobuf"
|
||||||
|
? Buffer.from(data)
|
||||||
|
: JSON.stringify(data);
|
||||||
|
const url = new url_1.URL(options.baseUrl);
|
||||||
|
const isHttps = url.protocol === "https:";
|
||||||
|
if (isHttps) {
|
||||||
|
client = https;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
client = http;
|
||||||
|
}
|
||||||
|
const prefix = url.pathname !== "/" ? url.pathname : "";
|
||||||
|
const req = client
|
||||||
|
.request(Object.assign(Object.assign({}, (options ? options : {})), { method: "POST", protocol: url.protocol, host: url.hostname, port: url.port ? url.port : isHttps ? 443 : 80, path: `${prefix}/${service}/${method}`, headers: Object.assign(Object.assign({}, (options.headers ? options.headers : {})), { "Content-Type": contentType, "Content-Length": contentType === "application/protobuf"
|
||||||
|
? Buffer.byteLength(requestData)
|
||||||
|
: Buffer.from(requestData).byteLength }) }), (res) => {
|
||||||
|
res.on("data", (chunk) => responseChunks.push(chunk));
|
||||||
|
res.on("end", () => {
|
||||||
|
const data = Buffer.concat(responseChunks);
|
||||||
|
if (res.statusCode != 200) {
|
||||||
|
rejected(wrapErrorResponseToTwirpError(data.toString()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (contentType === "application/json") {
|
||||||
|
resolve(JSON.parse(data.toString()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
res.on("error", (err) => {
|
||||||
|
rejected(err);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.on("error", (err) => {
|
||||||
|
rejected(err);
|
||||||
|
});
|
||||||
|
req.end(requestData);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
exports.NodeHttpRPC = NodeHttpRPC;
|
||||||
|
function wrapErrorResponseToTwirpError(errorResponse) {
|
||||||
|
return errors_1.TwirpError.fromObject(JSON.parse(errorResponse));
|
||||||
|
}
|
||||||
|
exports.wrapErrorResponseToTwirpError = wrapErrorResponseToTwirpError;
|
||||||
|
/**
|
||||||
|
* a browser fetch RPC implementation
|
||||||
|
*/
|
||||||
|
const FetchRPC = (options) => ({
|
||||||
|
request(service, method, contentType, data) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const headers = new Headers(options.headers);
|
||||||
|
headers.set("content-type", contentType);
|
||||||
|
const response = yield fetch(`${options.baseUrl}/${service}/${method}`, Object.assign(Object.assign({}, options), { method: "POST", headers, body: data instanceof Uint8Array ? data : JSON.stringify(data) }));
|
||||||
|
if (response.status === 200) {
|
||||||
|
if (contentType === "application/json") {
|
||||||
|
return yield response.json();
|
||||||
|
}
|
||||||
|
return new Uint8Array(yield response.arrayBuffer());
|
||||||
|
}
|
||||||
|
throw errors_1.TwirpError.fromObject(yield response.json());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
exports.FetchRPC = FetchRPC;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 430:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (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 }));
|
||||||
|
exports.TwirpContentType = void 0;
|
||||||
|
__exportStar(__nccwpck_require__(5497), exports);
|
||||||
|
__exportStar(__nccwpck_require__(1035), exports);
|
||||||
|
__exportStar(__nccwpck_require__(4036), exports);
|
||||||
|
__exportStar(__nccwpck_require__(3898), exports);
|
||||||
|
__exportStar(__nccwpck_require__(3315), exports);
|
||||||
|
__exportStar(__nccwpck_require__(9636), exports);
|
||||||
|
__exportStar(__nccwpck_require__(5683), exports);
|
||||||
|
var request_1 = __nccwpck_require__(9647);
|
||||||
|
Object.defineProperty(exports, "TwirpContentType", ({ enumerable: true, get: function () { return request_1.TwirpContentType; } }));
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 4036:
|
||||||
|
/***/ (function(__unused_webpack_module, exports) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.chainInterceptors = void 0;
|
||||||
|
// chains multiple Interceptors into a single Interceptor.
|
||||||
|
// The first interceptor wraps the second one, and so on.
|
||||||
|
// Returns null if interceptors is empty.
|
||||||
|
function chainInterceptors(...interceptors) {
|
||||||
|
if (interceptors.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (interceptors.length === 1) {
|
||||||
|
return interceptors[0];
|
||||||
|
}
|
||||||
|
const first = interceptors[0];
|
||||||
|
return (ctx, request, handler) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let next = handler;
|
||||||
|
for (let i = interceptors.length - 1; i > 0; i--) {
|
||||||
|
next = ((next) => (ctx, typedRequest) => {
|
||||||
|
return interceptors[i](ctx, typedRequest, next);
|
||||||
|
})(next);
|
||||||
|
}
|
||||||
|
return first(ctx, request, next);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.chainInterceptors = chainInterceptors;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 9647:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.parseTwirpPath = exports.getRequestData = exports.validateRequest = exports.getContentType = exports.TwirpContentType = void 0;
|
||||||
|
const errors_1 = __nccwpck_require__(3315);
|
||||||
|
/**
|
||||||
|
* Supported Twirp Content-Type
|
||||||
|
*/
|
||||||
|
var TwirpContentType;
|
||||||
|
(function (TwirpContentType) {
|
||||||
|
TwirpContentType[TwirpContentType["Protobuf"] = 0] = "Protobuf";
|
||||||
|
TwirpContentType[TwirpContentType["JSON"] = 1] = "JSON";
|
||||||
|
TwirpContentType[TwirpContentType["Unknown"] = 2] = "Unknown";
|
||||||
|
})(TwirpContentType = exports.TwirpContentType || (exports.TwirpContentType = {}));
|
||||||
|
/**
|
||||||
|
* Get supported content-type
|
||||||
|
* @param mimeType
|
||||||
|
*/
|
||||||
|
function getContentType(mimeType) {
|
||||||
|
switch (mimeType) {
|
||||||
|
case "application/protobuf":
|
||||||
|
return TwirpContentType.Protobuf;
|
||||||
|
case "application/json":
|
||||||
|
return TwirpContentType.JSON;
|
||||||
|
default:
|
||||||
|
return TwirpContentType.Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.getContentType = getContentType;
|
||||||
|
/**
|
||||||
|
* Validate a twirp request
|
||||||
|
* @param ctx
|
||||||
|
* @param request
|
||||||
|
* @param pathPrefix
|
||||||
|
*/
|
||||||
|
function validateRequest(ctx, request, pathPrefix) {
|
||||||
|
if (request.method !== "POST") {
|
||||||
|
const msg = `unsupported method ${request.method} (only POST is allowed)`;
|
||||||
|
throw new errors_1.BadRouteError(msg, request.method || "", request.url || "");
|
||||||
|
}
|
||||||
|
const path = parseTwirpPath(request.url || "");
|
||||||
|
if (path.pkgService !==
|
||||||
|
(ctx.packageName ? ctx.packageName + "." : "") + ctx.serviceName) {
|
||||||
|
const msg = `no handler for path ${request.url}`;
|
||||||
|
throw new errors_1.BadRouteError(msg, request.method || "", request.url || "");
|
||||||
|
}
|
||||||
|
if (path.prefix !== pathPrefix) {
|
||||||
|
const msg = `invalid path prefix ${path.prefix}, expected ${pathPrefix}, on path ${request.url}`;
|
||||||
|
throw new errors_1.BadRouteError(msg, request.method || "", request.url || "");
|
||||||
|
}
|
||||||
|
const mimeContentType = request.headers["content-type"] || "";
|
||||||
|
if (ctx.contentType === TwirpContentType.Unknown) {
|
||||||
|
const msg = `unexpected Content-Type: ${request.headers["content-type"]}`;
|
||||||
|
throw new errors_1.BadRouteError(msg, request.method || "", request.url || "");
|
||||||
|
}
|
||||||
|
return Object.assign(Object.assign({}, path), { mimeContentType, contentType: ctx.contentType });
|
||||||
|
}
|
||||||
|
exports.validateRequest = validateRequest;
|
||||||
|
/**
|
||||||
|
* Get request data from the body
|
||||||
|
* @param req
|
||||||
|
*/
|
||||||
|
function getRequestData(req) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const reqWithRawBody = req;
|
||||||
|
if (reqWithRawBody.rawBody instanceof Buffer) {
|
||||||
|
resolve(reqWithRawBody.rawBody);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const chunks = [];
|
||||||
|
req.on("data", (chunk) => chunks.push(chunk));
|
||||||
|
req.on("end", () => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const data = Buffer.concat(chunks);
|
||||||
|
resolve(data);
|
||||||
|
}));
|
||||||
|
req.on("error", (err) => {
|
||||||
|
if (req.aborted) {
|
||||||
|
reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.DeadlineExceeded, "failed to read request: deadline exceeded"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.Malformed, err.message).withCause(err));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
req.on("close", () => {
|
||||||
|
reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.Canceled, "failed to read request: context canceled"));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.getRequestData = getRequestData;
|
||||||
|
/**
|
||||||
|
* Parses twirp url path
|
||||||
|
* @param path
|
||||||
|
*/
|
||||||
|
function parseTwirpPath(path) {
|
||||||
|
const parts = path.split("/");
|
||||||
|
if (parts.length < 2) {
|
||||||
|
return {
|
||||||
|
pkgService: "",
|
||||||
|
method: "",
|
||||||
|
prefix: "",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
method: parts[parts.length - 1],
|
||||||
|
pkgService: parts[parts.length - 2],
|
||||||
|
prefix: parts.slice(0, parts.length - 2).join("/"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
exports.parseTwirpPath = parseTwirpPath;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 1035:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.writeError = exports.TwirpServer = void 0;
|
||||||
|
const hooks_1 = __nccwpck_require__(3898);
|
||||||
|
const request_1 = __nccwpck_require__(9647);
|
||||||
|
const errors_1 = __nccwpck_require__(3315);
|
||||||
|
/**
|
||||||
|
* Runtime server implementation of a TwirpServer
|
||||||
|
*/
|
||||||
|
class TwirpServer {
|
||||||
|
constructor(options) {
|
||||||
|
this.pathPrefix = "/twirp";
|
||||||
|
this.hooks = [];
|
||||||
|
this.interceptors = [];
|
||||||
|
this.packageName = options.packageName;
|
||||||
|
this.serviceName = options.serviceName;
|
||||||
|
this.methodList = options.methodList;
|
||||||
|
this.matchRoute = options.matchRoute;
|
||||||
|
this.service = options.service;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the prefix for this server
|
||||||
|
*/
|
||||||
|
get prefix() {
|
||||||
|
return this.pathPrefix;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The http handler for twirp complaint endpoints
|
||||||
|
* @param options
|
||||||
|
*/
|
||||||
|
httpHandler(options) {
|
||||||
|
return (req, resp) => {
|
||||||
|
// setup prefix
|
||||||
|
if ((options === null || options === void 0 ? void 0 : options.prefix) !== undefined) {
|
||||||
|
this.withPrefix(options.prefix);
|
||||||
|
}
|
||||||
|
return this._httpHandler(req, resp);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds interceptors or hooks to the request stack
|
||||||
|
* @param middlewares
|
||||||
|
*/
|
||||||
|
use(...middlewares) {
|
||||||
|
middlewares.forEach((middleware) => {
|
||||||
|
if (hooks_1.isHook(middleware)) {
|
||||||
|
this.hooks.push(middleware);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
this.interceptors.push(middleware);
|
||||||
|
});
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds a prefix to the service url path
|
||||||
|
* @param prefix
|
||||||
|
*/
|
||||||
|
withPrefix(prefix) {
|
||||||
|
if (prefix === false) {
|
||||||
|
this.pathPrefix = "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.pathPrefix = prefix;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the regex matching path for this twirp server
|
||||||
|
*/
|
||||||
|
matchingPath() {
|
||||||
|
const baseRegex = this.baseURI().replace(/\./g, "\\.");
|
||||||
|
return new RegExp(`${baseRegex}\/(${this.methodList.join("|")})`);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the base URI for this twirp server
|
||||||
|
*/
|
||||||
|
baseURI() {
|
||||||
|
return `${this.pathPrefix}/${this.packageName ? this.packageName + "." : ""}${this.serviceName}`;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Create a twirp context
|
||||||
|
* @param req
|
||||||
|
* @param res
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
createContext(req, res) {
|
||||||
|
return {
|
||||||
|
packageName: this.packageName,
|
||||||
|
serviceName: this.serviceName,
|
||||||
|
methodName: "",
|
||||||
|
contentType: request_1.getContentType(req.headers["content-type"]),
|
||||||
|
req: req,
|
||||||
|
res: res,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Twrip server http handler implementation
|
||||||
|
* @param req
|
||||||
|
* @param resp
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_httpHandler(req, resp) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const ctx = this.createContext(req, resp);
|
||||||
|
try {
|
||||||
|
yield this.invokeHook("requestReceived", ctx);
|
||||||
|
const { method, mimeContentType } = request_1.validateRequest(ctx, req, this.pathPrefix || "");
|
||||||
|
const handler = this.matchRoute(method, {
|
||||||
|
onMatch: (ctx) => {
|
||||||
|
return this.invokeHook("requestRouted", ctx);
|
||||||
|
},
|
||||||
|
onNotFound: () => {
|
||||||
|
const msg = `no handler for path ${req.url}`;
|
||||||
|
throw new errors_1.BadRouteError(msg, req.method || "", req.url || "");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const body = yield request_1.getRequestData(req);
|
||||||
|
const response = yield handler(ctx, this.service, body, this.interceptors);
|
||||||
|
yield Promise.all([
|
||||||
|
this.invokeHook("responsePrepared", ctx),
|
||||||
|
// keep backwards compatibility till next release
|
||||||
|
this.invokeHook("requestPrepared", ctx),
|
||||||
|
]);
|
||||||
|
resp.statusCode = 200;
|
||||||
|
resp.setHeader("Content-Type", mimeContentType);
|
||||||
|
resp.end(response);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
yield this.invokeHook("error", ctx, mustBeTwirpError(e));
|
||||||
|
if (!resp.headersSent) {
|
||||||
|
writeError(resp, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
yield Promise.all([
|
||||||
|
this.invokeHook("responseSent", ctx),
|
||||||
|
// keep backwards compatibility till next release
|
||||||
|
this.invokeHook("requestSent", ctx),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Invoke a hook
|
||||||
|
* @param hookName
|
||||||
|
* @param ctx
|
||||||
|
* @param err
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
invokeHook(hookName, ctx, err) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (this.hooks.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const chainedHooks = hooks_1.chainHooks(...this.hooks);
|
||||||
|
const hook = chainedHooks === null || chainedHooks === void 0 ? void 0 : chainedHooks[hookName];
|
||||||
|
if (hook) {
|
||||||
|
yield hook(ctx, err || new errors_1.InternalServerError("internal server error"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.TwirpServer = TwirpServer;
|
||||||
|
/**
|
||||||
|
* Write http error response
|
||||||
|
* @param res
|
||||||
|
* @param error
|
||||||
|
*/
|
||||||
|
function writeError(res, error) {
|
||||||
|
const twirpError = mustBeTwirpError(error);
|
||||||
|
res.setHeader("Content-Type", "application/json");
|
||||||
|
res.statusCode = errors_1.httpStatusFromErrorCode(twirpError.code);
|
||||||
|
res.end(twirpError.toJSON());
|
||||||
|
}
|
||||||
|
exports.writeError = writeError;
|
||||||
|
/**
|
||||||
|
* Make sure that the error passed is a TwirpError
|
||||||
|
* otherwise it will wrap it into an InternalError
|
||||||
|
* @param err
|
||||||
|
*/
|
||||||
|
function mustBeTwirpError(err) {
|
||||||
|
if (err instanceof errors_1.TwirpError) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
return new errors_1.InternalServerErrorWith(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 6752:
|
/***/ 6752:
|
||||||
@@ -82284,13 +91427,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
}) : function(o, v) {
|
}) : function(o, v) {
|
||||||
o["default"] = v;
|
o["default"] = v;
|
||||||
});
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || (function () {
|
||||||
|
var ownKeys = function(o) {
|
||||||
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||||
|
var ar = [];
|
||||||
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||||
|
return ar;
|
||||||
|
};
|
||||||
|
return ownKeys(o);
|
||||||
|
};
|
||||||
|
return function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
})();
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -82308,12 +91461,13 @@ const core = __importStar(__nccwpck_require__(7484));
|
|||||||
const inputs_1 = __nccwpck_require__(9612);
|
const inputs_1 = __nccwpck_require__(9612);
|
||||||
const platforms_1 = __nccwpck_require__(8361);
|
const platforms_1 = __nccwpck_require__(8361);
|
||||||
const hash_files_1 = __nccwpck_require__(9660);
|
const hash_files_1 = __nccwpck_require__(9660);
|
||||||
|
const exec = __importStar(__nccwpck_require__(5236));
|
||||||
exports.STATE_CACHE_KEY = "cache-key";
|
exports.STATE_CACHE_KEY = "cache-key";
|
||||||
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
exports.STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||||
const CACHE_VERSION = "1";
|
const CACHE_VERSION = "1";
|
||||||
function restoreCache(version) {
|
function restoreCache() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const cacheKey = yield computeKeys(version);
|
const cacheKey = yield computeKeys();
|
||||||
let matchedKey;
|
let matchedKey;
|
||||||
core.info(`Trying to restore uv cache from GitHub Actions cache with key: ${cacheKey}`);
|
core.info(`Trying to restore uv cache from GitHub Actions cache with key: ${cacheKey}`);
|
||||||
try {
|
try {
|
||||||
@@ -82329,21 +91483,52 @@ function restoreCache(version) {
|
|||||||
handleMatchResult(matchedKey, cacheKey);
|
handleMatchResult(matchedKey, cacheKey);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function computeKeys(version) {
|
function computeKeys() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let cacheDependencyPathHash = "-";
|
let cacheDependencyPathHash = "-";
|
||||||
if (inputs_1.cacheDependencyGlob !== "") {
|
if (inputs_1.cacheDependencyGlob !== "") {
|
||||||
core.info(`Searching files using cache dependency glob: ${inputs_1.cacheDependencyGlob.split("\n").join(",")}`);
|
core.info(`Searching files using cache dependency glob: ${inputs_1.cacheDependencyGlob.split("\n").join(",")}`);
|
||||||
cacheDependencyPathHash += yield (0, hash_files_1.hashFiles)(inputs_1.cacheDependencyGlob, true);
|
cacheDependencyPathHash += yield (0, hash_files_1.hashFiles)(inputs_1.cacheDependencyGlob, true);
|
||||||
if (cacheDependencyPathHash === "-") {
|
if (cacheDependencyPathHash === "-") {
|
||||||
throw new Error(`No file matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository`);
|
core.warning(`No file matched to [${inputs_1.cacheDependencyGlob.split("\n").join(",")}]. The cache will never get invalidated. Make sure you have checked out the target repository and configured the cache-dependency-glob input correctly.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
if (cacheDependencyPathHash === "-") {
|
||||||
cacheDependencyPathHash += "no-dependency-glob";
|
cacheDependencyPathHash = "-no-dependency-glob";
|
||||||
}
|
}
|
||||||
const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : "";
|
const suffix = inputs_1.cacheSuffix ? `-${inputs_1.cacheSuffix}` : "";
|
||||||
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${(0, platforms_1.getPlatform)()}-${version}${cacheDependencyPathHash}${suffix}`;
|
const pythonVersion = yield getPythonVersion();
|
||||||
|
return `setup-uv-${CACHE_VERSION}-${(0, platforms_1.getArch)()}-${(0, platforms_1.getPlatform)()}-${pythonVersion}${cacheDependencyPathHash}${suffix}`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function getPythonVersion() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (inputs_1.pythonVersion !== "") {
|
||||||
|
return inputs_1.pythonVersion;
|
||||||
|
}
|
||||||
|
let output = "";
|
||||||
|
const options = {
|
||||||
|
silent: !core.isDebug(),
|
||||||
|
listeners: {
|
||||||
|
stdout: (data) => {
|
||||||
|
output += data.toString();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const execArgs = ["python", "find"];
|
||||||
|
yield exec.exec("uv", execArgs, options);
|
||||||
|
const pythonPath = output.trim();
|
||||||
|
output = "";
|
||||||
|
yield exec.exec(pythonPath, ["--version"], options);
|
||||||
|
// output is like "Python 3.8.10"
|
||||||
|
return output.split(" ")[1].trim();
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
const err = error;
|
||||||
|
core.debug(`Failed to get python version from uv. Error: ${err.message}`);
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function handleMatchResult(matchedKey, primaryKey) {
|
function handleMatchResult(matchedKey, primaryKey) {
|
||||||
@@ -82381,13 +91566,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
}) : function(o, v) {
|
}) : function(o, v) {
|
||||||
o["default"] = v;
|
o["default"] = v;
|
||||||
});
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || (function () {
|
||||||
|
var ownKeys = function(o) {
|
||||||
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||||
|
var ar = [];
|
||||||
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||||
|
return ar;
|
||||||
|
};
|
||||||
|
return ownKeys(o);
|
||||||
|
};
|
||||||
|
return function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
})();
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -82489,13 +91684,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
}) : function(o, v) {
|
}) : function(o, v) {
|
||||||
o["default"] = v;
|
o["default"] = v;
|
||||||
});
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || (function () {
|
||||||
|
var ownKeys = function(o) {
|
||||||
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||||
|
var ar = [];
|
||||||
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||||
|
return ar;
|
||||||
|
};
|
||||||
|
return ownKeys(o);
|
||||||
|
};
|
||||||
|
return function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
})();
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -82603,13 +91808,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
}) : function(o, v) {
|
}) : function(o, v) {
|
||||||
o["default"] = v;
|
o["default"] = v;
|
||||||
});
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || (function () {
|
||||||
|
var ownKeys = function(o) {
|
||||||
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||||
|
var ar = [];
|
||||||
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||||
|
return ar;
|
||||||
|
};
|
||||||
|
return ownKeys(o);
|
||||||
|
};
|
||||||
|
return function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
})();
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
@@ -82620,7 +91835,7 @@ const node_path_1 = __importDefault(__nccwpck_require__(6760));
|
|||||||
exports.version = core.getInput("version");
|
exports.version = core.getInput("version");
|
||||||
exports.pythonVersion = core.getInput("python-version");
|
exports.pythonVersion = core.getInput("python-version");
|
||||||
exports.checkSum = core.getInput("checksum");
|
exports.checkSum = core.getInput("checksum");
|
||||||
exports.enableCache = core.getInput("enable-cache") === "true";
|
exports.enableCache = getEnableCache();
|
||||||
exports.cacheSuffix = core.getInput("cache-suffix") || "";
|
exports.cacheSuffix = core.getInput("cache-suffix") || "";
|
||||||
exports.cacheLocalPath = getCacheLocalPath();
|
exports.cacheLocalPath = getCacheLocalPath();
|
||||||
exports.cacheDependencyGlob = core.getInput("cache-dependency-glob");
|
exports.cacheDependencyGlob = core.getInput("cache-dependency-glob");
|
||||||
@@ -82629,6 +91844,13 @@ exports.ignoreNothingToCache = core.getInput("ignore-nothing-to-cache") === "tru
|
|||||||
exports.toolBinDir = getToolBinDir();
|
exports.toolBinDir = getToolBinDir();
|
||||||
exports.toolDir = getToolDir();
|
exports.toolDir = getToolDir();
|
||||||
exports.githubToken = core.getInput("github-token");
|
exports.githubToken = core.getInput("github-token");
|
||||||
|
function getEnableCache() {
|
||||||
|
const enableCacheInput = core.getInput("enable-cache");
|
||||||
|
if (enableCacheInput === "auto") {
|
||||||
|
return process.env.RUNNER_ENVIRONMENT === "github-hosted";
|
||||||
|
}
|
||||||
|
return enableCacheInput === "true";
|
||||||
|
}
|
||||||
function getToolBinDir() {
|
function getToolBinDir() {
|
||||||
const toolBinDirInput = core.getInput("tool-bin-dir");
|
const toolBinDirInput = core.getInput("tool-bin-dir");
|
||||||
if (toolBinDirInput !== "") {
|
if (toolBinDirInput !== "") {
|
||||||
@@ -84606,6 +93828,14 @@ function parseParams (str) {
|
|||||||
module.exports = parseParams
|
module.exports = parseParams
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 4012:
|
||||||
|
/***/ ((module) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.0.0","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1","twirp-ts":"^2.5.0"},"devDependencies":{"@types/semver":"^6.0.0","typescript":"^5.2.2"}}');
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 1813:
|
/***/ 1813:
|
||||||
|
|||||||
9651
dist/setup/index.js
generated
vendored
9651
dist/setup/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
135
dist/update-known-checksums/index.js
generated
vendored
135
dist/update-known-checksums/index.js
generated
vendored
@@ -32368,6 +32368,104 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
exports.KNOWN_CHECKSUMS = void 0;
|
exports.KNOWN_CHECKSUMS = void 0;
|
||||||
// AUTOGENERATED_DO_NOT_EDIT
|
// AUTOGENERATED_DO_NOT_EDIT
|
||||||
exports.KNOWN_CHECKSUMS = {
|
exports.KNOWN_CHECKSUMS = {
|
||||||
|
"aarch64-apple-darwin-0.5.11": "695f3640d5b1a4e28de7e36e3a2e14072852dcc6c70bf9e4deec6ada00d516b4",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.11": "055c329c38a93c01d378349d51cb4d521d1998c8a79355ddc00f863ce451942f",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.11": "d0bb82d8bceb561dc785f3811f5f5a427f1be47b654f0cc5d6c36d779e03a3ff",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.11": "a889ef4a6bbb7d2c2e460544e8c949ca9d01e18c56af23b6bfb4d8b952319dc7",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.11": "e9f4ff168ecaf87fee4ba129c0de59f6bab96a249fa21ecafdd853d61f2ff929",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.11": "202b6437480af1e46a9722d20e179983951edee1d92c307ea457acfafbd378bf",
|
||||||
|
"i686-pc-windows-msvc-0.5.11": "955dfba777851761b246bfa701a05fa809676493fa83ec29837f5315ada38b3f",
|
||||||
|
"i686-unknown-linux-gnu-0.5.11": "916df079c0125c2a5d48e1f012064f24dc7ef2ab8c94bccc192cf9d96094db5a",
|
||||||
|
"i686-unknown-linux-musl-0.5.11": "a06d22d1f9d0233941817fc263dd928913f20aaac940c336f995e3ad3592736d",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.11": "dc2e4ce36bf01c1fb1f1ff8506cc11f4fe607f077ab235ea660417fd4e1964df",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.11": "ca60d5f715f068647e487c003f1e55eea303abcec2ef8cb04c3d87c83bc580f7",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.11": "8b1b9d9c1dc2f195e4f490c1ea7c848e0eec025510dd576036df44dc78c27c28",
|
||||||
|
"x86_64-apple-darwin-0.5.11": "7e23d1d892c23f9e74245c4fd3d3e246438ce9b34460f85eee61f784de137b0b",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.11": "3e8203e6434b45427f20824419f8d8d53f970a76d94ccdcad07f8498fa01a9d0",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.11": "14411de26cdea5f5139fafaf2b675b1c633e744dd49c6d6a9fc8817ec065158b",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.11": "5b77978bc8ded7e1b6ddb6d6a3e52f684bcc07c6d9be11d7b4fc3c1c23f4458f",
|
||||||
|
"aarch64-apple-darwin-0.5.10": "dd3fa053379017923a4692cabdebb96844f83c7a516d9e6cb30502574cbd322d",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.10": "f4316a657c964994d7eb736ba875f3f685c4b61e961f514e98fb50ed181da72a",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.10": "82e0472b5b0e6c738db3abe454e39e4b25b3d02f84b34b41dc7abca01ade09b7",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.10": "269001ff4b3cda3af685d78803ae25d96fe78282040c416875784cda37fa6c73",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.10": "e6c0d421a2c66e3938cc2d78138239a782561da3c595c2e37d4bde36883ede95",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.10": "ab50758c7e1f56e6ec1e8a66a9b727ad7f3db1a872dd56b2c2e7f9d71a06b39a",
|
||||||
|
"i686-pc-windows-msvc-0.5.10": "676336743ca7f152a5f5186c49e8a171a9d49ad735c08e1bb5d85f6ed280d57b",
|
||||||
|
"i686-unknown-linux-gnu-0.5.10": "1d8c84de2e995ee26dfc9cd0bfee6bf546b06995dcd13e255b005d5a59a8c349",
|
||||||
|
"i686-unknown-linux-musl-0.5.10": "1867b910f331a56891bc0f287ae5fbf05cb09ded229d1d95a25a1e76e7b0a010",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.10": "b617172c145df05dcf28666570cb3a798d393cb7f48292686490cf7b0b8fb508",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.10": "95a0234191ba11109163cba2bf4c757d92bc98be0aa1349d7f32b5d85c8935b5",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.10": "a6943d479fca4fccab7af39bd47f097d67e64382665768600ab268cf167f1cee",
|
||||||
|
"x86_64-apple-darwin-0.5.10": "f82ed219d9e4cc22ac24168450567351881930774197bf9ad4bb5fc50e1eaf0d",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.10": "d97566f535f07a9bbcaed90900a4a9e1b800076daa3193f23d17910879e7fbc5",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.10": "13452b7a99d953e970ec52861de03f6f2e00bfee2c4357bc63c292a70472b386",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.10": "e94e9060ce51fabad2b62846df3963f908101ffebc02fec5e8c1baa373bd6edb",
|
||||||
|
"aarch64-apple-darwin-0.5.9": "66d352728d0efe9ecc65f7e9ee419fce139e3ab99addc08527e8cebbb405d382",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.9": "376d5d52a4b3a9875d66898261e2ce2d31d36c095a1d81cb88d953f5bf7273eb",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.9": "ec5598ae9daba48f7a12b2f12533c6aa683049e6a822835794cea136f63abd31",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.9": "4ca86619f26c0879f81e26760b529a548ba96b33141d24075b71137cf9dfa639",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.9": "412d249f2c9a3dd7c070a219fc658fe9a36c6e9c50bef53b536efd54446eeae9",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.9": "4097f1b45627212aa8936c973d9c7dcfaf1512ed08cfe958cf9dc68d0cc5d02f",
|
||||||
|
"i686-pc-windows-msvc-0.5.9": "73ac9d7aab6bafe1d8da36b7d4cb2bd969ca1d9c675b7a021afec3c913fe223f",
|
||||||
|
"i686-unknown-linux-gnu-0.5.9": "7236440874031e47a2ff3b4df93c7c2833c0bbe428716e491b8e87c8539a6651",
|
||||||
|
"i686-unknown-linux-musl-0.5.9": "64e588a32f12dac948733eb8ad57f7344bffd30023150a4b9b2b9b2a47ba2c9b",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.9": "56d62d87a42f05f49f29fda674ec2576b811838029c048ed776cdbbaa690da57",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.9": "15a6f24ad5b30b2ce71a9fcc31ecd88d658c8534fac58d2a9af33a3e7c48a99b",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.9": "e5a3ebc23c9acba4f8ae2a9f0a4344297e5a604cb24f63751193494f64e42822",
|
||||||
|
"x86_64-apple-darwin-0.5.9": "f4b4311cd2c2928aadee6b4e85aec2c6db7d779d4f9009eb4733bc8b2f20dbb5",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.9": "8cb608cdf23b79f4f598969b72890db657c5addab312890c37ab20b9b57c501f",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.9": "e9cca3fb618dbc056f770d3ac4d52af491b532e60c8b19b97b9ba24f42db2bc1",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.9": "f97ffe29c03f01bb19a948eb8eb1e27cefbbf83b8dd54057da0247a664a303ac",
|
||||||
|
"aarch64-apple-darwin-0.5.8": "745b3b8c0c2ea5b3ae253bc4c01fa5026ef399f4836749bef468d44747f291b0",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.8": "2eecc3b90d2316a85c9245107ddc6a5eecb9f481d97f4da94845972db0e93457",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.8": "f30278b8a479e5d5e55f69432e4fcfc2b7ef20fa6e7aebfe92c30fb6bcef93c7",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.8": "59c1e1a3c2aa50ad06495655d3ae1f0a58d9ec3c6179aecd6f3a6b5a01a30fde",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.8": "a697d9cee4e1698a4e9634caa57fc3f0afca370014bb37cc8d13a339374bf1da",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.8": "596a103852edd5e09c8acd12206b123a1c1808c9161271c2819572477d4694f5",
|
||||||
|
"i686-pc-windows-msvc-0.5.8": "2e1dc6042c1d419c296d4fa424218b24fb87a2fc6c8b61280f9d7df26a90e3f7",
|
||||||
|
"i686-unknown-linux-gnu-0.5.8": "e4edad6a7a772ccf7695ece61698fa289cb9ef113fb3e3b5ce8739cfee7ab8d6",
|
||||||
|
"i686-unknown-linux-musl-0.5.8": "878cd30bfbfbe53b721970d72961f1a1694afba3de6df96aa15d0f3782fa249b",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.8": "36735c72bb137cdd44f7d534da570d99354f08b1bf2e704616a946cf58f37c71",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.8": "a00e19ebf37b384abdb19968e65d38503880d5dc093f9795bc3d5d45ca9db6b3",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.8": "b8feaf065cad523651936acd62d90d4d37d4cb5b52703cf753f6cd1eb97cb6ea",
|
||||||
|
"x86_64-apple-darwin-0.5.8": "c3da7bebc434c59264737ff2430d942cb1d8605f20a7f4093232b1715eaafdca",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.8": "9335f35ebfb29ad2cc8b65862f43d5f72ee50038a22b216e999342efb402e319",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.8": "dd73615862bb9cfb1f31a491b486123eb7730f99a815ec38baf297a37c749a14",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.8": "b503c9e5a9aacba7f9283a1595931656cbac652c7fda1c486935af7d6e82b0c2",
|
||||||
|
"aarch64-apple-darwin-0.5.7": "b8cab25ab2ec0714dbb34179f948c27aa4ab307be54e0628e9e1eef1d2264f9f",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.7": "d4dd7a72689888c92b5191902fd4ec9d25b7eeba07be41ba4a8f89acbb403e2d",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.7": "2c0fdf774ebfabecadf403c2fb966cc1a023b3db3907041fae34c77464a38a2b",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.7": "7d375c18cb8819f712072fa64cbfeede37bc246513d2bcdabb06e08999ac3908",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.7": "2495d0c98b18b0fb1e258bcefd05d9771720e769f642046e6943aa9c8dc3a006",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.7": "070f3c59782832f1befd054053ba9def92e94e265aea2c06078c127525d2b086",
|
||||||
|
"i686-pc-windows-msvc-0.5.7": "d207a2791a513e3d645779e5d86cc88f7040426ec5e4a5521498b87558f93db6",
|
||||||
|
"i686-unknown-linux-gnu-0.5.7": "01d7c0444812563712038f472fcac77981a5dac9c44d507ccbccd49ec1828a12",
|
||||||
|
"i686-unknown-linux-musl-0.5.7": "ad934cb434d896637a4a9bf9defd309ebd71b46294aa6d878cf23d8377d3b2e1",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.7": "ff17ee98044a38d65f177d4534c10d7e971f7df13ee4b50710f7929cc6cb1342",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.7": "080de54bc6b2a2c56c3d39d3ae857bac322702fd5a53b7732260a04ea6f25f67",
|
||||||
|
"powerpc64le-unknown-linux-musl-0.5.7": "326c1da6f0bbd16350a45243a4ebe4deab838c2af5662c20514ae878986689c2",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.7": "ad94c056abf9a5caf652136de3569b999a5e0cba0456e41459e5ee34215465b0",
|
||||||
|
"x86_64-apple-darwin-0.5.7": "b0ff9937005e9dbc68798f587e72cedfe488f0866bb47532a8c3273e7222090a",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.7": "cb2aea0d8f85ffe1c4e2a431cbbd6e5c8faeb732e7cf8e4bee1c10b7779e7352",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.7": "8a0a3e823684dec6e49ae17f31bf6483c778fd579671992d9156875210e5161e",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.7": "4433fddf179fb49c962d6b4f824602b81cc20228406382b6fd21da33f816f8db",
|
||||||
|
"aarch64-apple-darwin-0.5.6": "dc122e0c41f7a3fbc8004802062785e6b5c8171bc2a2ca0adc5485165c92452d",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.6": "e90777ae28652cc7c40084ca2156bd344b5f95ee2ea9792b6e0c3a15f527c778",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.6": "b7e346728daac9c0d0d2e5df333f19275c232373a9ad29255b7aab2d8972f7fe",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.6": "89ab758f876a6724ad1667f9e267369892dc7c570c136e40651ecbfd3a78e0e5",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.6": "6e17c62e361400498f95d39c0565e1e71fd252c732485ff0bea7af68ea24739c",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.6": "c1806fb75ebc416e50e796ad3a61b82d096172d46fd4701c431cb54df4faf85a",
|
||||||
|
"i686-pc-windows-msvc-0.5.6": "4e387415a2238a7e827cf653448c032aa7085ccb4e14c5376f022aa52a3b145d",
|
||||||
|
"i686-unknown-linux-gnu-0.5.6": "d61e0b1aa8fa302f39604ba8080972fccd9e2b76b653c0ae4d9fffc0b91e193d",
|
||||||
|
"i686-unknown-linux-musl-0.5.6": "3ca5626e6325a116aad2f44ba30bccc31a15b35ac2e67349982b9c717900004f",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.6": "112fd134f44c35800c1321bdd5ffc081d1d0bcd439e43fc3043829ed718fb7d5",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.6": "56fcf8a19260d25ebda937422382c701446ff7849d86fc0aba37d9b60e8dcca9",
|
||||||
|
"powerpc64le-unknown-linux-musl-0.5.6": "86f0347ff9cdfa214192d0143e673c61aca0981ab330f9ecf967acce2002f0df",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.6": "170beaaa681acf3c7535dbca04808f1ad51689c86a3439f93eb6e0a4567ea24d",
|
||||||
|
"x86_64-apple-darwin-0.5.6": "9c45d209e5abdcfa42aa44cf456df6c0952b9d719b01d9c9e787886b17a5080e",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.6": "46c21ac0449ae967d65518d8025f6ae4006387802373bce0e72ebd133d77e94f",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.6": "83521a07922e4ddff61b9204890a974e56ad9333f295690d3ddae931243ec3db",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.6": "0578a350834a79f39dc2301b613e094597fc6b7937e5249519a7e1fd17f6184f",
|
||||||
"aarch64-apple-darwin-0.5.5": "9368ad5eb6dfb414e88b1ab70ef03a15963569a2bba5b2ad79f8cd0cdde01646",
|
"aarch64-apple-darwin-0.5.5": "9368ad5eb6dfb414e88b1ab70ef03a15963569a2bba5b2ad79f8cd0cdde01646",
|
||||||
"aarch64-unknown-linux-gnu-0.5.5": "aa3e8c6e095798c92e0b1bc7599af6313c10c0f35cd301221d230abb083cf6b0",
|
"aarch64-unknown-linux-gnu-0.5.5": "aa3e8c6e095798c92e0b1bc7599af6313c10c0f35cd301221d230abb083cf6b0",
|
||||||
"aarch64-unknown-linux-musl-0.5.5": "fb09752aa9459cefd98f3c390ba4a937c32c0079588cf79586069883df204423",
|
"aarch64-unknown-linux-musl-0.5.5": "fb09752aa9459cefd98f3c390ba4a937c32c0079588cf79586069883df204423",
|
||||||
@@ -34492,13 +34590,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
}) : function(o, v) {
|
}) : function(o, v) {
|
||||||
o["default"] = v;
|
o["default"] = v;
|
||||||
});
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || (function () {
|
||||||
|
var ownKeys = function(o) {
|
||||||
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||||
|
var ar = [];
|
||||||
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||||
|
return ar;
|
||||||
|
};
|
||||||
|
return ownKeys(o);
|
||||||
|
};
|
||||||
|
return function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
})();
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -34589,13 +34697,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|||||||
}) : function(o, v) {
|
}) : function(o, v) {
|
||||||
o["default"] = v;
|
o["default"] = v;
|
||||||
});
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || (function () {
|
||||||
|
var ownKeys = function(o) {
|
||||||
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||||
|
var ar = [];
|
||||||
|
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||||
|
return ar;
|
||||||
|
};
|
||||||
|
return ownKeys(o);
|
||||||
|
};
|
||||||
|
return function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
})();
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -34615,7 +34733,7 @@ function run() {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const checksumFilePath = process.argv.slice(2)[0];
|
const checksumFilePath = process.argv.slice(2)[0];
|
||||||
const github_token = process.argv.slice(2)[1];
|
const github_token = process.argv.slice(2)[1];
|
||||||
const octokit = github.getOctokit(github_token);
|
const octokit = github.getOctokit(github_token, { baseUrl: constants_1.GITHUB_COM_API });
|
||||||
const response = yield octokit.paginate(octokit.rest.repos.listReleases, {
|
const response = yield octokit.paginate(octokit.rest.repos.listReleases, {
|
||||||
owner: constants_1.OWNER,
|
owner: constants_1.OWNER,
|
||||||
repo: constants_1.REPO,
|
repo: constants_1.REPO,
|
||||||
@@ -34641,10 +34759,11 @@ run();
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
|
exports.GITHUB_COM_API = exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
|
||||||
exports.REPO = "uv";
|
exports.REPO = "uv";
|
||||||
exports.OWNER = "astral-sh";
|
exports.OWNER = "astral-sh";
|
||||||
exports.TOOL_CACHE_NAME = "uv";
|
exports.TOOL_CACHE_NAME = "uv";
|
||||||
|
exports.GITHUB_COM_API = "https://api.github.com";
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|||||||
484
package-lock.json
generated
484
package-lock.json
generated
@@ -9,7 +9,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.3.0",
|
"@actions/cache": "^4.0.0",
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/github": "^6.0.0",
|
"@actions/github": "^6.0.0",
|
||||||
@@ -20,19 +20,19 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.9.4",
|
"@biomejs/biome": "1.9.4",
|
||||||
"@types/node": "^22.9.1",
|
"@types/node": "^22.10.2",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"ts-jest": "^29.2.5",
|
"ts-jest": "^29.2.5",
|
||||||
"typescript": "^5.6.3"
|
"typescript": "^5.7.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache": {
|
"node_modules/@actions/cache": {
|
||||||
"version": "3.3.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-4.0.0.tgz",
|
||||||
"integrity": "sha512-+eCsMTIZUEm+QA9GqjollOhCdvRrZ1JV8d9Rp34zVNizBkYITO8dhKczP5Xps1dFzc5n59p7vYVtZrGt18bb5Q==",
|
"integrity": "sha512-WIuxjnZ44lNYtIS4fqSaYvF00hORdy3cSin+jx8xNgBVGWnNIAiCBHjlwusVQlcgExoQC9pHXGrDsZyZr7rCDQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
@@ -42,7 +42,9 @@
|
|||||||
"@azure/abort-controller": "^1.1.0",
|
"@azure/abort-controller": "^1.1.0",
|
||||||
"@azure/ms-rest-js": "^2.6.0",
|
"@azure/ms-rest-js": "^2.6.0",
|
||||||
"@azure/storage-blob": "^12.13.0",
|
"@azure/storage-blob": "^12.13.0",
|
||||||
"semver": "^6.3.1"
|
"@protobuf-ts/plugin": "^2.9.4",
|
||||||
|
"semver": "^6.3.1",
|
||||||
|
"twirp-ts": "^2.5.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache/node_modules/@actions/glob": {
|
"node_modules/@actions/cache/node_modules/@actions/glob": {
|
||||||
@@ -1926,6 +1928,76 @@
|
|||||||
"node": ">=8.0.0"
|
"node": ">=8.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@protobuf-ts/plugin": {
|
||||||
|
"version": "2.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/plugin/-/plugin-2.9.4.tgz",
|
||||||
|
"integrity": "sha512-Db5Laq5T3mc6ERZvhIhkj1rn57/p8gbWiCKxQWbZBBl20wMuqKoHbRw4tuD7FyXi+IkwTToaNVXymv5CY3E8Rw==",
|
||||||
|
"dependencies": {
|
||||||
|
"@protobuf-ts/plugin-framework": "^2.9.4",
|
||||||
|
"@protobuf-ts/protoc": "^2.9.4",
|
||||||
|
"@protobuf-ts/runtime": "^2.9.4",
|
||||||
|
"@protobuf-ts/runtime-rpc": "^2.9.4",
|
||||||
|
"typescript": "^3.9"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"protoc-gen-dump": "bin/protoc-gen-dump",
|
||||||
|
"protoc-gen-ts": "bin/protoc-gen-ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/plugin-framework": {
|
||||||
|
"version": "2.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/plugin-framework/-/plugin-framework-2.9.4.tgz",
|
||||||
|
"integrity": "sha512-9nuX1kjdMliv+Pes8dQCKyVhjKgNNfwxVHg+tx3fLXSfZZRcUHMc1PMwB9/vTvc6gBKt9QGz5ERqSqZc0++E9A==",
|
||||||
|
"dependencies": {
|
||||||
|
"@protobuf-ts/runtime": "^2.9.4",
|
||||||
|
"typescript": "^3.9"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/plugin-framework/node_modules/typescript": {
|
||||||
|
"version": "3.9.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||||
|
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/plugin/node_modules/typescript": {
|
||||||
|
"version": "3.9.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||||
|
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/protoc": {
|
||||||
|
"version": "2.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.9.4.tgz",
|
||||||
|
"integrity": "sha512-hQX+nOhFtrA+YdAXsXEDrLoGJqXHpgv4+BueYF0S9hy/Jq0VRTVlJS1Etmf4qlMt/WdigEes5LOd/LDzui4GIQ==",
|
||||||
|
"bin": {
|
||||||
|
"protoc": "protoc.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/runtime": {
|
||||||
|
"version": "2.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.4.tgz",
|
||||||
|
"integrity": "sha512-vHRFWtJJB/SiogWDF0ypoKfRIZ41Kq+G9cEFj6Qm1eQaAhJ1LDFvgZ7Ja4tb3iLOQhz0PaoPnnOijF1qmEqTxg=="
|
||||||
|
},
|
||||||
|
"node_modules/@protobuf-ts/runtime-rpc": {
|
||||||
|
"version": "2.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.4.tgz",
|
||||||
|
"integrity": "sha512-y9L9JgnZxXFqH5vD4d7j9duWvIJ7AShyBRoNKJGhu9Q27qIbchfzli66H9RvrQNIFk5ER7z1Twe059WZGqERcA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@protobuf-ts/runtime": "^2.9.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@sinclair/typebox": {
|
"node_modules/@sinclair/typebox": {
|
||||||
"version": "0.27.8",
|
"version": "0.27.8",
|
||||||
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
|
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
|
||||||
@@ -2025,11 +2097,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "22.9.1",
|
"version": "22.10.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz",
|
||||||
"integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==",
|
"integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~6.19.8"
|
"undici-types": "~6.20.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node-fetch": {
|
"node_modules/@types/node-fetch": {
|
||||||
@@ -2376,6 +2448,20 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/camel-case": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz",
|
||||||
|
"integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==",
|
||||||
|
"dependencies": {
|
||||||
|
"pascal-case": "^3.1.2",
|
||||||
|
"tslib": "^2.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/camel-case/node_modules/tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
|
||||||
|
},
|
||||||
"node_modules/camelcase": {
|
"node_modules/camelcase": {
|
||||||
"version": "5.3.1",
|
"version": "5.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||||
@@ -2510,6 +2596,14 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/commander": {
|
||||||
|
"version": "6.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
|
||||||
|
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/concat-map": {
|
"node_modules/concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
@@ -2543,9 +2637,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cross-spawn": {
|
"node_modules/cross-spawn": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"path-key": "^3.1.0",
|
"path-key": "^3.1.0",
|
||||||
@@ -2627,6 +2721,18 @@
|
|||||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/dot-object": {
|
||||||
|
"version": "2.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/dot-object/-/dot-object-2.1.5.tgz",
|
||||||
|
"integrity": "sha512-xHF8EP4XH/Ba9fvAF2LDd5O3IITVolerVV6xvkxoM8zlGEiCUrggpAnHyOoKJKCrhvPcGATFAUwIujj7bRG5UA==",
|
||||||
|
"dependencies": {
|
||||||
|
"commander": "^6.1.0",
|
||||||
|
"glob": "^7.1.6"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"dot-object": "bin/dot-object"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ejs": {
|
"node_modules/ejs": {
|
||||||
"version": "3.1.10",
|
"version": "3.1.10",
|
||||||
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz",
|
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz",
|
||||||
@@ -2843,8 +2949,7 @@
|
|||||||
"node_modules/fs.realpath": {
|
"node_modules/fs.realpath": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"node_modules/fsevents": {
|
"node_modules/fsevents": {
|
||||||
"version": "2.3.3",
|
"version": "2.3.3",
|
||||||
@@ -2912,7 +3017,6 @@
|
|||||||
"version": "7.1.6",
|
"version": "7.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||||
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fs.realpath": "^1.0.0",
|
"fs.realpath": "^1.0.0",
|
||||||
"inflight": "^1.0.4",
|
"inflight": "^1.0.4",
|
||||||
@@ -3093,7 +3197,6 @@
|
|||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"once": "^1.3.0",
|
"once": "^1.3.0",
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
@@ -3102,8 +3205,7 @@
|
|||||||
"node_modules/inherits": {
|
"node_modules/inherits": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"node_modules/is-arrayish": {
|
"node_modules/is-arrayish": {
|
||||||
"version": "0.2.1",
|
"version": "0.2.1",
|
||||||
@@ -3951,12 +4053,30 @@
|
|||||||
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
|
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/lodash": {
|
||||||
|
"version": "4.17.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||||
|
},
|
||||||
"node_modules/lodash.memoize": {
|
"node_modules/lodash.memoize": {
|
||||||
"version": "4.1.2",
|
"version": "4.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
|
||||||
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
|
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/lower-case": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lower-case/node_modules/tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
|
||||||
|
},
|
||||||
"node_modules/lru-cache": {
|
"node_modules/lru-cache": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||||
@@ -4084,6 +4204,20 @@
|
|||||||
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
|
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/no-case": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz",
|
||||||
|
"integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==",
|
||||||
|
"dependencies": {
|
||||||
|
"lower-case": "^2.0.2",
|
||||||
|
"tslib": "^2.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/no-case/node_modules/tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
|
||||||
|
},
|
||||||
"node_modules/node-int64": {
|
"node_modules/node-int64": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
|
||||||
@@ -4158,11 +4292,24 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pascal-case": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==",
|
||||||
|
"dependencies": {
|
||||||
|
"no-case": "^3.0.4",
|
||||||
|
"tslib": "^2.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pascal-case/node_modules/tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
|
||||||
|
},
|
||||||
"node_modules/path-is-absolute": {
|
"node_modules/path-is-absolute": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@@ -4182,6 +4329,11 @@
|
|||||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/path-to-regexp": {
|
||||||
|
"version": "6.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz",
|
||||||
|
"integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ=="
|
||||||
|
},
|
||||||
"node_modules/picocolors": {
|
"node_modules/picocolors": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||||
@@ -4209,6 +4361,20 @@
|
|||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/prettier": {
|
||||||
|
"version": "2.8.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
|
||||||
|
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
|
||||||
|
"bin": {
|
||||||
|
"prettier": "bin-prettier.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.13.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/pretty-format": {
|
"node_modules/pretty-format": {
|
||||||
"version": "29.7.0",
|
"version": "29.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
|
||||||
@@ -4625,6 +4791,15 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ts-poet": {
|
||||||
|
"version": "4.15.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-4.15.0.tgz",
|
||||||
|
"integrity": "sha512-sLLR8yQBvHzi9d4R1F4pd+AzQxBfzOSSjfxiJxQhkUoH5bL7RsAC6wgvtVUQdGqiCsyS9rT6/8X2FI7ipdir5g==",
|
||||||
|
"dependencies": {
|
||||||
|
"lodash": "^4.17.15",
|
||||||
|
"prettier": "^2.5.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tslib": {
|
"node_modules/tslib": {
|
||||||
"version": "1.10.0",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
|
||||||
@@ -4638,6 +4813,34 @@
|
|||||||
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/twirp-ts": {
|
||||||
|
"version": "2.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/twirp-ts/-/twirp-ts-2.5.0.tgz",
|
||||||
|
"integrity": "sha512-JTKIK5Pf/+3qCrmYDFlqcPPUx+ohEWKBaZy8GL8TmvV2VvC0SXVyNYILO39+GCRbqnuP6hBIF+BVr8ZxRz+6fw==",
|
||||||
|
"dependencies": {
|
||||||
|
"@protobuf-ts/plugin-framework": "^2.0.7",
|
||||||
|
"camel-case": "^4.1.2",
|
||||||
|
"dot-object": "^2.1.4",
|
||||||
|
"path-to-regexp": "^6.2.0",
|
||||||
|
"ts-poet": "^4.5.0",
|
||||||
|
"yaml": "^1.10.2"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"protoc-gen-twirp_ts": "protoc-gen-twirp_ts"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@protobuf-ts/plugin": "^2.5.0",
|
||||||
|
"ts-proto": "^1.81.3"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@protobuf-ts/plugin": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"ts-proto": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/type-detect": {
|
"node_modules/type-detect": {
|
||||||
"version": "4.0.8",
|
"version": "4.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
|
||||||
@@ -4648,9 +4851,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.6.3",
|
"version": "5.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz",
|
||||||
"integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
|
"integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
@@ -4672,9 +4875,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici-types": {
|
"node_modules/undici-types": {
|
||||||
"version": "6.19.8",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
|
||||||
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="
|
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="
|
||||||
},
|
},
|
||||||
"node_modules/universal-user-agent": {
|
"node_modules/universal-user-agent": {
|
||||||
"version": "6.0.1",
|
"version": "6.0.1",
|
||||||
@@ -4844,6 +5047,14 @@
|
|||||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/yaml": {
|
||||||
|
"version": "1.10.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
|
||||||
|
"integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/yargs": {
|
"node_modules/yargs": {
|
||||||
"version": "17.7.2",
|
"version": "17.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
|
||||||
@@ -4886,9 +5097,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": {
|
"@actions/cache": {
|
||||||
"version": "3.3.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-4.0.0.tgz",
|
||||||
"integrity": "sha512-+eCsMTIZUEm+QA9GqjollOhCdvRrZ1JV8d9Rp34zVNizBkYITO8dhKczP5Xps1dFzc5n59p7vYVtZrGt18bb5Q==",
|
"integrity": "sha512-WIuxjnZ44lNYtIS4fqSaYvF00hORdy3cSin+jx8xNgBVGWnNIAiCBHjlwusVQlcgExoQC9pHXGrDsZyZr7rCDQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
@@ -4898,7 +5109,9 @@
|
|||||||
"@azure/abort-controller": "^1.1.0",
|
"@azure/abort-controller": "^1.1.0",
|
||||||
"@azure/ms-rest-js": "^2.6.0",
|
"@azure/ms-rest-js": "^2.6.0",
|
||||||
"@azure/storage-blob": "^12.13.0",
|
"@azure/storage-blob": "^12.13.0",
|
||||||
"semver": "^6.3.1"
|
"@protobuf-ts/plugin": "^2.9.4",
|
||||||
|
"semver": "^6.3.1",
|
||||||
|
"twirp-ts": "^2.5.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/glob": {
|
"@actions/glob": {
|
||||||
@@ -6365,6 +6578,59 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.4.1.tgz",
|
||||||
"integrity": "sha512-O2yRJce1GOc6PAy3QxFM4NzFiWzvScDC1/5ihYBL6BUEVdq0XMWN01sppE+H6bBXbaFYipjwFLEWLg5PaSOThA=="
|
"integrity": "sha512-O2yRJce1GOc6PAy3QxFM4NzFiWzvScDC1/5ihYBL6BUEVdq0XMWN01sppE+H6bBXbaFYipjwFLEWLg5PaSOThA=="
|
||||||
},
|
},
|
||||||
|
"@protobuf-ts/plugin": {
|
||||||
|
"version": "2.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/plugin/-/plugin-2.9.4.tgz",
|
||||||
|
"integrity": "sha512-Db5Laq5T3mc6ERZvhIhkj1rn57/p8gbWiCKxQWbZBBl20wMuqKoHbRw4tuD7FyXi+IkwTToaNVXymv5CY3E8Rw==",
|
||||||
|
"requires": {
|
||||||
|
"@protobuf-ts/plugin-framework": "^2.9.4",
|
||||||
|
"@protobuf-ts/protoc": "^2.9.4",
|
||||||
|
"@protobuf-ts/runtime": "^2.9.4",
|
||||||
|
"@protobuf-ts/runtime-rpc": "^2.9.4",
|
||||||
|
"typescript": "^3.9"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"typescript": {
|
||||||
|
"version": "3.9.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||||
|
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@protobuf-ts/plugin-framework": {
|
||||||
|
"version": "2.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/plugin-framework/-/plugin-framework-2.9.4.tgz",
|
||||||
|
"integrity": "sha512-9nuX1kjdMliv+Pes8dQCKyVhjKgNNfwxVHg+tx3fLXSfZZRcUHMc1PMwB9/vTvc6gBKt9QGz5ERqSqZc0++E9A==",
|
||||||
|
"requires": {
|
||||||
|
"@protobuf-ts/runtime": "^2.9.4",
|
||||||
|
"typescript": "^3.9"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"typescript": {
|
||||||
|
"version": "3.9.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||||
|
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@protobuf-ts/protoc": {
|
||||||
|
"version": "2.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.9.4.tgz",
|
||||||
|
"integrity": "sha512-hQX+nOhFtrA+YdAXsXEDrLoGJqXHpgv4+BueYF0S9hy/Jq0VRTVlJS1Etmf4qlMt/WdigEes5LOd/LDzui4GIQ=="
|
||||||
|
},
|
||||||
|
"@protobuf-ts/runtime": {
|
||||||
|
"version": "2.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.4.tgz",
|
||||||
|
"integrity": "sha512-vHRFWtJJB/SiogWDF0ypoKfRIZ41Kq+G9cEFj6Qm1eQaAhJ1LDFvgZ7Ja4tb3iLOQhz0PaoPnnOijF1qmEqTxg=="
|
||||||
|
},
|
||||||
|
"@protobuf-ts/runtime-rpc": {
|
||||||
|
"version": "2.9.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.4.tgz",
|
||||||
|
"integrity": "sha512-y9L9JgnZxXFqH5vD4d7j9duWvIJ7AShyBRoNKJGhu9Q27qIbchfzli66H9RvrQNIFk5ER7z1Twe059WZGqERcA==",
|
||||||
|
"requires": {
|
||||||
|
"@protobuf-ts/runtime": "^2.9.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@sinclair/typebox": {
|
"@sinclair/typebox": {
|
||||||
"version": "0.27.8",
|
"version": "0.27.8",
|
||||||
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
|
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
|
||||||
@@ -6464,11 +6730,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "22.9.1",
|
"version": "22.10.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz",
|
||||||
"integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==",
|
"integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"undici-types": "~6.19.8"
|
"undici-types": "~6.20.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/node-fetch": {
|
"@types/node-fetch": {
|
||||||
@@ -6740,6 +7006,22 @@
|
|||||||
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
|
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"camel-case": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz",
|
||||||
|
"integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==",
|
||||||
|
"requires": {
|
||||||
|
"pascal-case": "^3.1.2",
|
||||||
|
"tslib": "^2.0.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"camelcase": {
|
"camelcase": {
|
||||||
"version": "5.3.1",
|
"version": "5.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||||
@@ -6826,6 +7108,11 @@
|
|||||||
"delayed-stream": "~1.0.0"
|
"delayed-stream": "~1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"commander": {
|
||||||
|
"version": "6.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
|
||||||
|
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA=="
|
||||||
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
@@ -6853,9 +7140,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cross-spawn": {
|
"cross-spawn": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"path-key": "^3.1.0",
|
"path-key": "^3.1.0",
|
||||||
@@ -6907,6 +7194,15 @@
|
|||||||
"integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==",
|
"integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"dot-object": {
|
||||||
|
"version": "2.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/dot-object/-/dot-object-2.1.5.tgz",
|
||||||
|
"integrity": "sha512-xHF8EP4XH/Ba9fvAF2LDd5O3IITVolerVV6xvkxoM8zlGEiCUrggpAnHyOoKJKCrhvPcGATFAUwIujj7bRG5UA==",
|
||||||
|
"requires": {
|
||||||
|
"commander": "^6.1.0",
|
||||||
|
"glob": "^7.1.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"ejs": {
|
"ejs": {
|
||||||
"version": "3.1.10",
|
"version": "3.1.10",
|
||||||
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz",
|
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz",
|
||||||
@@ -7073,8 +7369,7 @@
|
|||||||
"fs.realpath": {
|
"fs.realpath": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"fsevents": {
|
"fsevents": {
|
||||||
"version": "2.3.3",
|
"version": "2.3.3",
|
||||||
@@ -7117,7 +7412,6 @@
|
|||||||
"version": "7.1.6",
|
"version": "7.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||||
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"fs.realpath": "^1.0.0",
|
"fs.realpath": "^1.0.0",
|
||||||
"inflight": "^1.0.4",
|
"inflight": "^1.0.4",
|
||||||
@@ -7246,7 +7540,6 @@
|
|||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"once": "^1.3.0",
|
"once": "^1.3.0",
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
@@ -7255,8 +7548,7 @@
|
|||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"is-arrayish": {
|
"is-arrayish": {
|
||||||
"version": "0.2.1",
|
"version": "0.2.1",
|
||||||
@@ -7895,12 +8187,32 @@
|
|||||||
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
|
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"lodash": {
|
||||||
|
"version": "4.17.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||||
|
},
|
||||||
"lodash.memoize": {
|
"lodash.memoize": {
|
||||||
"version": "4.1.2",
|
"version": "4.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
|
||||||
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
|
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"lower-case": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==",
|
||||||
|
"requires": {
|
||||||
|
"tslib": "^2.0.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"lru-cache": {
|
"lru-cache": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||||
@@ -8000,6 +8312,22 @@
|
|||||||
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
|
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"no-case": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz",
|
||||||
|
"integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==",
|
||||||
|
"requires": {
|
||||||
|
"lower-case": "^2.0.2",
|
||||||
|
"tslib": "^2.0.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node-int64": {
|
"node-int64": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
|
||||||
@@ -8056,11 +8384,26 @@
|
|||||||
"lines-and-columns": "^1.1.6"
|
"lines-and-columns": "^1.1.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"pascal-case": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==",
|
||||||
|
"requires": {
|
||||||
|
"no-case": "^3.0.4",
|
||||||
|
"tslib": "^2.0.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"path-is-absolute": {
|
"path-is-absolute": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"path-key": {
|
"path-key": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
@@ -8074,6 +8417,11 @@
|
|||||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"path-to-regexp": {
|
||||||
|
"version": "6.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz",
|
||||||
|
"integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ=="
|
||||||
|
},
|
||||||
"picocolors": {
|
"picocolors": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||||
@@ -8092,6 +8440,11 @@
|
|||||||
"integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==",
|
"integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"prettier": {
|
||||||
|
"version": "2.8.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
|
||||||
|
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q=="
|
||||||
|
},
|
||||||
"pretty-format": {
|
"pretty-format": {
|
||||||
"version": "29.7.0",
|
"version": "29.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
|
||||||
@@ -8379,6 +8732,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ts-poet": {
|
||||||
|
"version": "4.15.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-4.15.0.tgz",
|
||||||
|
"integrity": "sha512-sLLR8yQBvHzi9d4R1F4pd+AzQxBfzOSSjfxiJxQhkUoH5bL7RsAC6wgvtVUQdGqiCsyS9rT6/8X2FI7ipdir5g==",
|
||||||
|
"requires": {
|
||||||
|
"lodash": "^4.17.15",
|
||||||
|
"prettier": "^2.5.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"tslib": {
|
"tslib": {
|
||||||
"version": "1.10.0",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
|
||||||
@@ -8389,6 +8751,19 @@
|
|||||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||||
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
|
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
|
||||||
},
|
},
|
||||||
|
"twirp-ts": {
|
||||||
|
"version": "2.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/twirp-ts/-/twirp-ts-2.5.0.tgz",
|
||||||
|
"integrity": "sha512-JTKIK5Pf/+3qCrmYDFlqcPPUx+ohEWKBaZy8GL8TmvV2VvC0SXVyNYILO39+GCRbqnuP6hBIF+BVr8ZxRz+6fw==",
|
||||||
|
"requires": {
|
||||||
|
"@protobuf-ts/plugin-framework": "^2.0.7",
|
||||||
|
"camel-case": "^4.1.2",
|
||||||
|
"dot-object": "^2.1.4",
|
||||||
|
"path-to-regexp": "^6.2.0",
|
||||||
|
"ts-poet": "^4.5.0",
|
||||||
|
"yaml": "^1.10.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"type-detect": {
|
"type-detect": {
|
||||||
"version": "4.0.8",
|
"version": "4.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
|
||||||
@@ -8396,9 +8771,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "5.6.3",
|
"version": "5.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz",
|
||||||
"integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
|
"integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"undici": {
|
"undici": {
|
||||||
@@ -8410,9 +8785,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"undici-types": {
|
"undici-types": {
|
||||||
"version": "6.19.8",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
|
||||||
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="
|
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="
|
||||||
},
|
},
|
||||||
"universal-user-agent": {
|
"universal-user-agent": {
|
||||||
"version": "6.0.1",
|
"version": "6.0.1",
|
||||||
@@ -8537,6 +8912,11 @@
|
|||||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"yaml": {
|
||||||
|
"version": "1.10.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
|
||||||
|
"integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg=="
|
||||||
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "17.7.2",
|
"version": "17.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"author": "@eifinger",
|
"author": "@eifinger",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.3.0",
|
"@actions/cache": "^4.0.0",
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/github": "^6.0.0",
|
"@actions/github": "^6.0.0",
|
||||||
@@ -34,12 +34,12 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.9.4",
|
"@biomejs/biome": "1.9.4",
|
||||||
"@types/node": "^22.9.1",
|
"@types/node": "^22.10.2",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"ts-jest": "^29.2.5",
|
"ts-jest": "^29.2.5",
|
||||||
"typescript": "^5.6.3"
|
"typescript": "^5.7.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
51
src/cache/restore-cache.ts
vendored
51
src/cache/restore-cache.ts
vendored
@@ -4,16 +4,18 @@ import {
|
|||||||
cacheDependencyGlob,
|
cacheDependencyGlob,
|
||||||
cacheLocalPath,
|
cacheLocalPath,
|
||||||
cacheSuffix,
|
cacheSuffix,
|
||||||
|
pythonVersion as pythonVersionInput,
|
||||||
} from "../utils/inputs";
|
} from "../utils/inputs";
|
||||||
import { getArch, getPlatform } from "../utils/platforms";
|
import { getArch, getPlatform } from "../utils/platforms";
|
||||||
import { hashFiles } from "../hash/hash-files";
|
import { hashFiles } from "../hash/hash-files";
|
||||||
|
import * as exec from "@actions/exec";
|
||||||
|
|
||||||
export const STATE_CACHE_KEY = "cache-key";
|
export const STATE_CACHE_KEY = "cache-key";
|
||||||
export const STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
export const STATE_CACHE_MATCHED_KEY = "cache-matched-key";
|
||||||
const CACHE_VERSION = "1";
|
const CACHE_VERSION = "1";
|
||||||
|
|
||||||
export async function restoreCache(version: string): Promise<void> {
|
export async function restoreCache(): Promise<void> {
|
||||||
const cacheKey = await computeKeys(version);
|
const cacheKey = await computeKeys();
|
||||||
|
|
||||||
let matchedKey: string | undefined;
|
let matchedKey: string | undefined;
|
||||||
core.info(
|
core.info(
|
||||||
@@ -33,7 +35,7 @@ export async function restoreCache(version: string): Promise<void> {
|
|||||||
handleMatchResult(matchedKey, cacheKey);
|
handleMatchResult(matchedKey, cacheKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function computeKeys(version: string): Promise<string> {
|
async function computeKeys(): Promise<string> {
|
||||||
let cacheDependencyPathHash = "-";
|
let cacheDependencyPathHash = "-";
|
||||||
if (cacheDependencyGlob !== "") {
|
if (cacheDependencyGlob !== "") {
|
||||||
core.info(
|
core.info(
|
||||||
@@ -41,15 +43,48 @@ async function computeKeys(version: string): Promise<string> {
|
|||||||
);
|
);
|
||||||
cacheDependencyPathHash += await hashFiles(cacheDependencyGlob, true);
|
cacheDependencyPathHash += await hashFiles(cacheDependencyGlob, true);
|
||||||
if (cacheDependencyPathHash === "-") {
|
if (cacheDependencyPathHash === "-") {
|
||||||
throw new Error(
|
core.warning(
|
||||||
`No file matched to [${cacheDependencyGlob.split("\n").join(",")}], make sure you have checked out the target repository`,
|
`No file matched to [${cacheDependencyGlob.split("\n").join(",")}]. The cache will never get invalidated. Make sure you have checked out the target repository and configured the cache-dependency-glob input correctly.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
cacheDependencyPathHash += "no-dependency-glob";
|
if (cacheDependencyPathHash === "-") {
|
||||||
|
cacheDependencyPathHash = "-no-dependency-glob";
|
||||||
}
|
}
|
||||||
const suffix = cacheSuffix ? `-${cacheSuffix}` : "";
|
const suffix = cacheSuffix ? `-${cacheSuffix}` : "";
|
||||||
return `setup-uv-${CACHE_VERSION}-${getArch()}-${getPlatform()}-${version}${cacheDependencyPathHash}${suffix}`;
|
const pythonVersion = await getPythonVersion();
|
||||||
|
return `setup-uv-${CACHE_VERSION}-${getArch()}-${getPlatform()}-${pythonVersion}${cacheDependencyPathHash}${suffix}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPythonVersion(): Promise<string> {
|
||||||
|
if (pythonVersionInput !== "") {
|
||||||
|
return pythonVersionInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
let output = "";
|
||||||
|
const options: exec.ExecOptions = {
|
||||||
|
silent: !core.isDebug(),
|
||||||
|
listeners: {
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
output += data.toString();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const execArgs = ["python", "find"];
|
||||||
|
await exec.exec("uv", execArgs, options);
|
||||||
|
const pythonPath = output.trim();
|
||||||
|
|
||||||
|
output = "";
|
||||||
|
await exec.exec(pythonPath, ["--version"], options);
|
||||||
|
// output is like "Python 3.8.10"
|
||||||
|
return output.split(" ")[1].trim();
|
||||||
|
} catch (error) {
|
||||||
|
const err = error as Error;
|
||||||
|
core.debug(`Failed to get python version from uv. Error: ${err.message}`);
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMatchResult(
|
function handleMatchResult(
|
||||||
|
|||||||
@@ -1,5 +1,201 @@
|
|||||||
// AUTOGENERATED_DO_NOT_EDIT
|
// AUTOGENERATED_DO_NOT_EDIT
|
||||||
export const KNOWN_CHECKSUMS: { [key: string]: string } = {
|
export const KNOWN_CHECKSUMS: { [key: string]: string } = {
|
||||||
|
"aarch64-apple-darwin-0.5.11":
|
||||||
|
"695f3640d5b1a4e28de7e36e3a2e14072852dcc6c70bf9e4deec6ada00d516b4",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.11":
|
||||||
|
"055c329c38a93c01d378349d51cb4d521d1998c8a79355ddc00f863ce451942f",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.11":
|
||||||
|
"d0bb82d8bceb561dc785f3811f5f5a427f1be47b654f0cc5d6c36d779e03a3ff",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.11":
|
||||||
|
"a889ef4a6bbb7d2c2e460544e8c949ca9d01e18c56af23b6bfb4d8b952319dc7",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.11":
|
||||||
|
"e9f4ff168ecaf87fee4ba129c0de59f6bab96a249fa21ecafdd853d61f2ff929",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.11":
|
||||||
|
"202b6437480af1e46a9722d20e179983951edee1d92c307ea457acfafbd378bf",
|
||||||
|
"i686-pc-windows-msvc-0.5.11":
|
||||||
|
"955dfba777851761b246bfa701a05fa809676493fa83ec29837f5315ada38b3f",
|
||||||
|
"i686-unknown-linux-gnu-0.5.11":
|
||||||
|
"916df079c0125c2a5d48e1f012064f24dc7ef2ab8c94bccc192cf9d96094db5a",
|
||||||
|
"i686-unknown-linux-musl-0.5.11":
|
||||||
|
"a06d22d1f9d0233941817fc263dd928913f20aaac940c336f995e3ad3592736d",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.11":
|
||||||
|
"dc2e4ce36bf01c1fb1f1ff8506cc11f4fe607f077ab235ea660417fd4e1964df",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.11":
|
||||||
|
"ca60d5f715f068647e487c003f1e55eea303abcec2ef8cb04c3d87c83bc580f7",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.11":
|
||||||
|
"8b1b9d9c1dc2f195e4f490c1ea7c848e0eec025510dd576036df44dc78c27c28",
|
||||||
|
"x86_64-apple-darwin-0.5.11":
|
||||||
|
"7e23d1d892c23f9e74245c4fd3d3e246438ce9b34460f85eee61f784de137b0b",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.11":
|
||||||
|
"3e8203e6434b45427f20824419f8d8d53f970a76d94ccdcad07f8498fa01a9d0",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.11":
|
||||||
|
"14411de26cdea5f5139fafaf2b675b1c633e744dd49c6d6a9fc8817ec065158b",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.11":
|
||||||
|
"5b77978bc8ded7e1b6ddb6d6a3e52f684bcc07c6d9be11d7b4fc3c1c23f4458f",
|
||||||
|
"aarch64-apple-darwin-0.5.10":
|
||||||
|
"dd3fa053379017923a4692cabdebb96844f83c7a516d9e6cb30502574cbd322d",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.10":
|
||||||
|
"f4316a657c964994d7eb736ba875f3f685c4b61e961f514e98fb50ed181da72a",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.10":
|
||||||
|
"82e0472b5b0e6c738db3abe454e39e4b25b3d02f84b34b41dc7abca01ade09b7",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.10":
|
||||||
|
"269001ff4b3cda3af685d78803ae25d96fe78282040c416875784cda37fa6c73",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.10":
|
||||||
|
"e6c0d421a2c66e3938cc2d78138239a782561da3c595c2e37d4bde36883ede95",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.10":
|
||||||
|
"ab50758c7e1f56e6ec1e8a66a9b727ad7f3db1a872dd56b2c2e7f9d71a06b39a",
|
||||||
|
"i686-pc-windows-msvc-0.5.10":
|
||||||
|
"676336743ca7f152a5f5186c49e8a171a9d49ad735c08e1bb5d85f6ed280d57b",
|
||||||
|
"i686-unknown-linux-gnu-0.5.10":
|
||||||
|
"1d8c84de2e995ee26dfc9cd0bfee6bf546b06995dcd13e255b005d5a59a8c349",
|
||||||
|
"i686-unknown-linux-musl-0.5.10":
|
||||||
|
"1867b910f331a56891bc0f287ae5fbf05cb09ded229d1d95a25a1e76e7b0a010",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.10":
|
||||||
|
"b617172c145df05dcf28666570cb3a798d393cb7f48292686490cf7b0b8fb508",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.10":
|
||||||
|
"95a0234191ba11109163cba2bf4c757d92bc98be0aa1349d7f32b5d85c8935b5",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.10":
|
||||||
|
"a6943d479fca4fccab7af39bd47f097d67e64382665768600ab268cf167f1cee",
|
||||||
|
"x86_64-apple-darwin-0.5.10":
|
||||||
|
"f82ed219d9e4cc22ac24168450567351881930774197bf9ad4bb5fc50e1eaf0d",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.10":
|
||||||
|
"d97566f535f07a9bbcaed90900a4a9e1b800076daa3193f23d17910879e7fbc5",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.10":
|
||||||
|
"13452b7a99d953e970ec52861de03f6f2e00bfee2c4357bc63c292a70472b386",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.10":
|
||||||
|
"e94e9060ce51fabad2b62846df3963f908101ffebc02fec5e8c1baa373bd6edb",
|
||||||
|
"aarch64-apple-darwin-0.5.9":
|
||||||
|
"66d352728d0efe9ecc65f7e9ee419fce139e3ab99addc08527e8cebbb405d382",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.9":
|
||||||
|
"376d5d52a4b3a9875d66898261e2ce2d31d36c095a1d81cb88d953f5bf7273eb",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.9":
|
||||||
|
"ec5598ae9daba48f7a12b2f12533c6aa683049e6a822835794cea136f63abd31",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.9":
|
||||||
|
"4ca86619f26c0879f81e26760b529a548ba96b33141d24075b71137cf9dfa639",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.9":
|
||||||
|
"412d249f2c9a3dd7c070a219fc658fe9a36c6e9c50bef53b536efd54446eeae9",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.9":
|
||||||
|
"4097f1b45627212aa8936c973d9c7dcfaf1512ed08cfe958cf9dc68d0cc5d02f",
|
||||||
|
"i686-pc-windows-msvc-0.5.9":
|
||||||
|
"73ac9d7aab6bafe1d8da36b7d4cb2bd969ca1d9c675b7a021afec3c913fe223f",
|
||||||
|
"i686-unknown-linux-gnu-0.5.9":
|
||||||
|
"7236440874031e47a2ff3b4df93c7c2833c0bbe428716e491b8e87c8539a6651",
|
||||||
|
"i686-unknown-linux-musl-0.5.9":
|
||||||
|
"64e588a32f12dac948733eb8ad57f7344bffd30023150a4b9b2b9b2a47ba2c9b",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.9":
|
||||||
|
"56d62d87a42f05f49f29fda674ec2576b811838029c048ed776cdbbaa690da57",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.9":
|
||||||
|
"15a6f24ad5b30b2ce71a9fcc31ecd88d658c8534fac58d2a9af33a3e7c48a99b",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.9":
|
||||||
|
"e5a3ebc23c9acba4f8ae2a9f0a4344297e5a604cb24f63751193494f64e42822",
|
||||||
|
"x86_64-apple-darwin-0.5.9":
|
||||||
|
"f4b4311cd2c2928aadee6b4e85aec2c6db7d779d4f9009eb4733bc8b2f20dbb5",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.9":
|
||||||
|
"8cb608cdf23b79f4f598969b72890db657c5addab312890c37ab20b9b57c501f",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.9":
|
||||||
|
"e9cca3fb618dbc056f770d3ac4d52af491b532e60c8b19b97b9ba24f42db2bc1",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.9":
|
||||||
|
"f97ffe29c03f01bb19a948eb8eb1e27cefbbf83b8dd54057da0247a664a303ac",
|
||||||
|
"aarch64-apple-darwin-0.5.8":
|
||||||
|
"745b3b8c0c2ea5b3ae253bc4c01fa5026ef399f4836749bef468d44747f291b0",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.8":
|
||||||
|
"2eecc3b90d2316a85c9245107ddc6a5eecb9f481d97f4da94845972db0e93457",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.8":
|
||||||
|
"f30278b8a479e5d5e55f69432e4fcfc2b7ef20fa6e7aebfe92c30fb6bcef93c7",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.8":
|
||||||
|
"59c1e1a3c2aa50ad06495655d3ae1f0a58d9ec3c6179aecd6f3a6b5a01a30fde",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.8":
|
||||||
|
"a697d9cee4e1698a4e9634caa57fc3f0afca370014bb37cc8d13a339374bf1da",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.8":
|
||||||
|
"596a103852edd5e09c8acd12206b123a1c1808c9161271c2819572477d4694f5",
|
||||||
|
"i686-pc-windows-msvc-0.5.8":
|
||||||
|
"2e1dc6042c1d419c296d4fa424218b24fb87a2fc6c8b61280f9d7df26a90e3f7",
|
||||||
|
"i686-unknown-linux-gnu-0.5.8":
|
||||||
|
"e4edad6a7a772ccf7695ece61698fa289cb9ef113fb3e3b5ce8739cfee7ab8d6",
|
||||||
|
"i686-unknown-linux-musl-0.5.8":
|
||||||
|
"878cd30bfbfbe53b721970d72961f1a1694afba3de6df96aa15d0f3782fa249b",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.8":
|
||||||
|
"36735c72bb137cdd44f7d534da570d99354f08b1bf2e704616a946cf58f37c71",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.8":
|
||||||
|
"a00e19ebf37b384abdb19968e65d38503880d5dc093f9795bc3d5d45ca9db6b3",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.8":
|
||||||
|
"b8feaf065cad523651936acd62d90d4d37d4cb5b52703cf753f6cd1eb97cb6ea",
|
||||||
|
"x86_64-apple-darwin-0.5.8":
|
||||||
|
"c3da7bebc434c59264737ff2430d942cb1d8605f20a7f4093232b1715eaafdca",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.8":
|
||||||
|
"9335f35ebfb29ad2cc8b65862f43d5f72ee50038a22b216e999342efb402e319",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.8":
|
||||||
|
"dd73615862bb9cfb1f31a491b486123eb7730f99a815ec38baf297a37c749a14",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.8":
|
||||||
|
"b503c9e5a9aacba7f9283a1595931656cbac652c7fda1c486935af7d6e82b0c2",
|
||||||
|
"aarch64-apple-darwin-0.5.7":
|
||||||
|
"b8cab25ab2ec0714dbb34179f948c27aa4ab307be54e0628e9e1eef1d2264f9f",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.7":
|
||||||
|
"d4dd7a72689888c92b5191902fd4ec9d25b7eeba07be41ba4a8f89acbb403e2d",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.7":
|
||||||
|
"2c0fdf774ebfabecadf403c2fb966cc1a023b3db3907041fae34c77464a38a2b",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.7":
|
||||||
|
"7d375c18cb8819f712072fa64cbfeede37bc246513d2bcdabb06e08999ac3908",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.7":
|
||||||
|
"2495d0c98b18b0fb1e258bcefd05d9771720e769f642046e6943aa9c8dc3a006",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.7":
|
||||||
|
"070f3c59782832f1befd054053ba9def92e94e265aea2c06078c127525d2b086",
|
||||||
|
"i686-pc-windows-msvc-0.5.7":
|
||||||
|
"d207a2791a513e3d645779e5d86cc88f7040426ec5e4a5521498b87558f93db6",
|
||||||
|
"i686-unknown-linux-gnu-0.5.7":
|
||||||
|
"01d7c0444812563712038f472fcac77981a5dac9c44d507ccbccd49ec1828a12",
|
||||||
|
"i686-unknown-linux-musl-0.5.7":
|
||||||
|
"ad934cb434d896637a4a9bf9defd309ebd71b46294aa6d878cf23d8377d3b2e1",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.7":
|
||||||
|
"ff17ee98044a38d65f177d4534c10d7e971f7df13ee4b50710f7929cc6cb1342",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.7":
|
||||||
|
"080de54bc6b2a2c56c3d39d3ae857bac322702fd5a53b7732260a04ea6f25f67",
|
||||||
|
"powerpc64le-unknown-linux-musl-0.5.7":
|
||||||
|
"326c1da6f0bbd16350a45243a4ebe4deab838c2af5662c20514ae878986689c2",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.7":
|
||||||
|
"ad94c056abf9a5caf652136de3569b999a5e0cba0456e41459e5ee34215465b0",
|
||||||
|
"x86_64-apple-darwin-0.5.7":
|
||||||
|
"b0ff9937005e9dbc68798f587e72cedfe488f0866bb47532a8c3273e7222090a",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.7":
|
||||||
|
"cb2aea0d8f85ffe1c4e2a431cbbd6e5c8faeb732e7cf8e4bee1c10b7779e7352",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.7":
|
||||||
|
"8a0a3e823684dec6e49ae17f31bf6483c778fd579671992d9156875210e5161e",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.7":
|
||||||
|
"4433fddf179fb49c962d6b4f824602b81cc20228406382b6fd21da33f816f8db",
|
||||||
|
"aarch64-apple-darwin-0.5.6":
|
||||||
|
"dc122e0c41f7a3fbc8004802062785e6b5c8171bc2a2ca0adc5485165c92452d",
|
||||||
|
"aarch64-unknown-linux-gnu-0.5.6":
|
||||||
|
"e90777ae28652cc7c40084ca2156bd344b5f95ee2ea9792b6e0c3a15f527c778",
|
||||||
|
"aarch64-unknown-linux-musl-0.5.6":
|
||||||
|
"b7e346728daac9c0d0d2e5df333f19275c232373a9ad29255b7aab2d8972f7fe",
|
||||||
|
"arm-unknown-linux-musleabihf-0.5.6":
|
||||||
|
"89ab758f876a6724ad1667f9e267369892dc7c570c136e40651ecbfd3a78e0e5",
|
||||||
|
"armv7-unknown-linux-gnueabihf-0.5.6":
|
||||||
|
"6e17c62e361400498f95d39c0565e1e71fd252c732485ff0bea7af68ea24739c",
|
||||||
|
"armv7-unknown-linux-musleabihf-0.5.6":
|
||||||
|
"c1806fb75ebc416e50e796ad3a61b82d096172d46fd4701c431cb54df4faf85a",
|
||||||
|
"i686-pc-windows-msvc-0.5.6":
|
||||||
|
"4e387415a2238a7e827cf653448c032aa7085ccb4e14c5376f022aa52a3b145d",
|
||||||
|
"i686-unknown-linux-gnu-0.5.6":
|
||||||
|
"d61e0b1aa8fa302f39604ba8080972fccd9e2b76b653c0ae4d9fffc0b91e193d",
|
||||||
|
"i686-unknown-linux-musl-0.5.6":
|
||||||
|
"3ca5626e6325a116aad2f44ba30bccc31a15b35ac2e67349982b9c717900004f",
|
||||||
|
"powerpc64-unknown-linux-gnu-0.5.6":
|
||||||
|
"112fd134f44c35800c1321bdd5ffc081d1d0bcd439e43fc3043829ed718fb7d5",
|
||||||
|
"powerpc64le-unknown-linux-gnu-0.5.6":
|
||||||
|
"56fcf8a19260d25ebda937422382c701446ff7849d86fc0aba37d9b60e8dcca9",
|
||||||
|
"powerpc64le-unknown-linux-musl-0.5.6":
|
||||||
|
"86f0347ff9cdfa214192d0143e673c61aca0981ab330f9ecf967acce2002f0df",
|
||||||
|
"s390x-unknown-linux-gnu-0.5.6":
|
||||||
|
"170beaaa681acf3c7535dbca04808f1ad51689c86a3439f93eb6e0a4567ea24d",
|
||||||
|
"x86_64-apple-darwin-0.5.6":
|
||||||
|
"9c45d209e5abdcfa42aa44cf456df6c0952b9d719b01d9c9e787886b17a5080e",
|
||||||
|
"x86_64-pc-windows-msvc-0.5.6":
|
||||||
|
"46c21ac0449ae967d65518d8025f6ae4006387802373bce0e72ebd133d77e94f",
|
||||||
|
"x86_64-unknown-linux-gnu-0.5.6":
|
||||||
|
"83521a07922e4ddff61b9204890a974e56ad9333f295690d3ddae931243ec3db",
|
||||||
|
"x86_64-unknown-linux-musl-0.5.6":
|
||||||
|
"0578a350834a79f39dc2301b613e094597fc6b7937e5249519a7e1fd17f6184f",
|
||||||
"aarch64-apple-darwin-0.5.5":
|
"aarch64-apple-darwin-0.5.5":
|
||||||
"9368ad5eb6dfb414e88b1ab70ef03a15963569a2bba5b2ad79f8cd0cdde01646",
|
"9368ad5eb6dfb414e88b1ab70ef03a15963569a2bba5b2ad79f8cd0cdde01646",
|
||||||
"aarch64-unknown-linux-gnu-0.5.5":
|
"aarch64-unknown-linux-gnu-0.5.5":
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
import * as core from "@actions/core";
|
|
||||||
import * as tc from "@actions/tool-cache";
|
|
||||||
import * as exec from "@actions/exec";
|
|
||||||
import * as path from "node:path";
|
|
||||||
import { promises as fs } from "node:fs";
|
|
||||||
import type { Architecture, Platform } from "../utils/platforms";
|
|
||||||
import { validateChecksum } from "./checksum/checksum";
|
|
||||||
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
|
|
||||||
|
|
||||||
export async function downloadLatest(
|
|
||||||
platform: Platform,
|
|
||||||
arch: Architecture,
|
|
||||||
checkSum: string | undefined,
|
|
||||||
githubToken: string | undefined,
|
|
||||||
): Promise<{ cachedToolDir: string; version: string }> {
|
|
||||||
const artifact = `uv-${arch}-${platform}`;
|
|
||||||
let extension = ".tar.gz";
|
|
||||||
if (platform === "pc-windows-msvc") {
|
|
||||||
extension = ".zip";
|
|
||||||
}
|
|
||||||
const downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/latest/download/${artifact}${extension}`;
|
|
||||||
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
|
||||||
|
|
||||||
const downloadPath = await tc.downloadTool(
|
|
||||||
downloadUrl,
|
|
||||||
undefined,
|
|
||||||
githubToken,
|
|
||||||
);
|
|
||||||
let uvExecutablePath: string;
|
|
||||||
let uvDir: string;
|
|
||||||
if (platform === "pc-windows-msvc") {
|
|
||||||
const fullPathWithExtension = `${downloadPath}${extension}`;
|
|
||||||
await fs.copyFile(downloadPath, fullPathWithExtension);
|
|
||||||
uvDir = await tc.extractZip(fullPathWithExtension);
|
|
||||||
// On windows extracting the zip does not create an intermediate directory
|
|
||||||
uvExecutablePath = path.join(uvDir, "uv.exe");
|
|
||||||
} else {
|
|
||||||
const extractedDir = await tc.extractTar(downloadPath);
|
|
||||||
uvDir = path.join(extractedDir, artifact);
|
|
||||||
uvExecutablePath = path.join(uvDir, "uv");
|
|
||||||
}
|
|
||||||
const version = await getVersion(uvExecutablePath);
|
|
||||||
await validateChecksum(checkSum, downloadPath, arch, platform, version);
|
|
||||||
const cachedToolDir = await tc.cacheDir(
|
|
||||||
uvDir,
|
|
||||||
TOOL_CACHE_NAME,
|
|
||||||
version,
|
|
||||||
arch,
|
|
||||||
);
|
|
||||||
|
|
||||||
return { cachedToolDir, version };
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getVersion(uvExecutablePath: string): Promise<string> {
|
|
||||||
// Parse the output of `uv --version` to get the version
|
|
||||||
// The output looks like
|
|
||||||
// uv 0.3.1 (be17d132a 2024-08-21)
|
|
||||||
|
|
||||||
const options: exec.ExecOptions = {
|
|
||||||
silent: !core.isDebug(),
|
|
||||||
};
|
|
||||||
const execArgs = ["--version"];
|
|
||||||
|
|
||||||
let output = "";
|
|
||||||
options.listeners = {
|
|
||||||
stdout: (data: Buffer) => {
|
|
||||||
output += data.toString();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
await exec.exec(uvExecutablePath, execArgs, options);
|
|
||||||
const parts = output.split(" ");
|
|
||||||
return parts[1].trim();
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,12 @@ import * as core from "@actions/core";
|
|||||||
import * as tc from "@actions/tool-cache";
|
import * as tc from "@actions/tool-cache";
|
||||||
import * as path from "node:path";
|
import * as path from "node:path";
|
||||||
import { promises as fs } from "node:fs";
|
import { promises as fs } from "node:fs";
|
||||||
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
|
import {
|
||||||
|
GITHUB_COM_API,
|
||||||
|
OWNER,
|
||||||
|
REPO,
|
||||||
|
TOOL_CACHE_NAME,
|
||||||
|
} from "../utils/constants";
|
||||||
import type { Architecture, Platform } from "../utils/platforms";
|
import type { Architecture, Platform } from "../utils/platforms";
|
||||||
import { validateChecksum } from "./checksum/checksum";
|
import { validateChecksum } from "./checksum/checksum";
|
||||||
import * as github from "@actions/github";
|
import * as github from "@actions/github";
|
||||||
@@ -70,10 +75,14 @@ export async function downloadVersion(
|
|||||||
return { version: resolvedVersion, cachedToolDir };
|
return { version: resolvedVersion, cachedToolDir };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resolveVersion(
|
export async function resolveVersion(
|
||||||
version: string,
|
versionInput: string,
|
||||||
githubToken: string,
|
githubToken: string,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
|
const version =
|
||||||
|
versionInput === "latest"
|
||||||
|
? await getLatestVersion(githubToken)
|
||||||
|
: versionInput;
|
||||||
if (tc.isExplicitVersion(version)) {
|
if (tc.isExplicitVersion(version)) {
|
||||||
core.debug(`Version ${version} is an explicit version.`);
|
core.debug(`Version ${version} is an explicit version.`);
|
||||||
return version;
|
return version;
|
||||||
@@ -87,7 +96,7 @@ async function resolveVersion(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getAvailableVersions(githubToken: string): Promise<string[]> {
|
async function getAvailableVersions(githubToken: string): Promise<string[]> {
|
||||||
const octokit = github.getOctokit(githubToken);
|
const octokit = github.getOctokit(githubToken, { baseUrl: GITHUB_COM_API });
|
||||||
|
|
||||||
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
|
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
|
||||||
owner: OWNER,
|
owner: OWNER,
|
||||||
@@ -95,3 +104,17 @@ async function getAvailableVersions(githubToken: string): Promise<string[]> {
|
|||||||
});
|
});
|
||||||
return response.map((release) => release.tag_name);
|
return response.map((release) => release.tag_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getLatestVersion(githubToken: string) {
|
||||||
|
const octokit = github.getOctokit(githubToken, { baseUrl: GITHUB_COM_API });
|
||||||
|
|
||||||
|
const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({
|
||||||
|
owner: OWNER,
|
||||||
|
repo: REPO,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!latestRelease) {
|
||||||
|
throw new Error("Could not determine latest release.");
|
||||||
|
}
|
||||||
|
return latestRelease.tag_name;
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import * as path from "node:path";
|
|||||||
import {
|
import {
|
||||||
downloadVersion,
|
downloadVersion,
|
||||||
tryGetFromToolCache,
|
tryGetFromToolCache,
|
||||||
|
resolveVersion,
|
||||||
} from "./download/download-version";
|
} from "./download/download-version";
|
||||||
import { restoreCache } from "./cache/restore-cache";
|
import { restoreCache } from "./cache/restore-cache";
|
||||||
|
|
||||||
import { downloadLatest } from "./download/download-latest";
|
|
||||||
import {
|
import {
|
||||||
type Architecture,
|
type Architecture,
|
||||||
getArch,
|
getArch,
|
||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
toolDir,
|
toolDir,
|
||||||
version,
|
version,
|
||||||
} from "./utils/inputs";
|
} from "./utils/inputs";
|
||||||
|
import * as exec from "@actions/exec";
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
const platform = getPlatform();
|
const platform = getPlatform();
|
||||||
@@ -46,7 +47,7 @@ async function run(): Promise<void> {
|
|||||||
addUvToPath(setupResult.uvDir);
|
addUvToPath(setupResult.uvDir);
|
||||||
addToolBinToPath();
|
addToolBinToPath();
|
||||||
setToolDir();
|
setToolDir();
|
||||||
setupPython();
|
await setupPython();
|
||||||
addMatchers();
|
addMatchers();
|
||||||
setCacheDir(cacheLocalPath);
|
setCacheDir(cacheLocalPath);
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ async function run(): Promise<void> {
|
|||||||
core.info(`Successfully installed uv version ${setupResult.version}`);
|
core.info(`Successfully installed uv version ${setupResult.version}`);
|
||||||
|
|
||||||
if (enableCache) {
|
if (enableCache) {
|
||||||
await restoreCache(setupResult.version);
|
await restoreCache();
|
||||||
}
|
}
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -69,38 +70,28 @@ async function setupUv(
|
|||||||
checkSum: string | undefined,
|
checkSum: string | undefined,
|
||||||
githubToken: string,
|
githubToken: string,
|
||||||
): Promise<{ uvDir: string; version: string }> {
|
): Promise<{ uvDir: string; version: string }> {
|
||||||
let installedPath: string | undefined;
|
const resolvedVersion = await resolveVersion(versionInput, githubToken);
|
||||||
let cachedToolDir: string;
|
const toolCacheResult = tryGetFromToolCache(arch, resolvedVersion);
|
||||||
let version: string;
|
if (toolCacheResult.installedPath) {
|
||||||
if (versionInput === "latest") {
|
core.info(`Found uv in tool-cache for ${toolCacheResult.version}`);
|
||||||
const latestResult = await downloadLatest(
|
return {
|
||||||
platform,
|
uvDir: toolCacheResult.installedPath,
|
||||||
arch,
|
version: toolCacheResult.version,
|
||||||
checkSum,
|
};
|
||||||
githubToken,
|
|
||||||
);
|
|
||||||
version = latestResult.version;
|
|
||||||
cachedToolDir = latestResult.cachedToolDir;
|
|
||||||
} else {
|
|
||||||
const toolCacheResult = tryGetFromToolCache(arch, versionInput);
|
|
||||||
version = toolCacheResult.version;
|
|
||||||
installedPath = toolCacheResult.installedPath;
|
|
||||||
if (installedPath) {
|
|
||||||
core.info(`Found uv in tool-cache for ${versionInput}`);
|
|
||||||
return { uvDir: installedPath, version };
|
|
||||||
}
|
|
||||||
const versionResult = await downloadVersion(
|
|
||||||
platform,
|
|
||||||
arch,
|
|
||||||
versionInput,
|
|
||||||
checkSum,
|
|
||||||
githubToken,
|
|
||||||
);
|
|
||||||
cachedToolDir = versionResult.cachedToolDir;
|
|
||||||
version = versionResult.version;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { uvDir: cachedToolDir, version };
|
const downloadVersionResult = await downloadVersion(
|
||||||
|
platform,
|
||||||
|
arch,
|
||||||
|
resolvedVersion,
|
||||||
|
checkSum,
|
||||||
|
githubToken,
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
uvDir: downloadVersionResult.cachedToolDir,
|
||||||
|
version: downloadVersionResult.version,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function addUvToPath(cachedPath: string): void {
|
function addUvToPath(cachedPath: string): void {
|
||||||
@@ -135,10 +126,24 @@ function setToolDir(): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupPython(): void {
|
async function setupPython(): Promise<void> {
|
||||||
if (pythonVersion !== "") {
|
if (pythonVersion !== "") {
|
||||||
core.exportVariable("UV_PYTHON", pythonVersion);
|
core.exportVariable("UV_PYTHON", pythonVersion);
|
||||||
core.info(`Set UV_PYTHON to ${pythonVersion}`);
|
core.info(`Set UV_PYTHON to ${pythonVersion}`);
|
||||||
|
const options: exec.ExecOptions = {
|
||||||
|
silent: !core.isDebug(),
|
||||||
|
};
|
||||||
|
const execArgs = ["venv", "--python", pythonVersion];
|
||||||
|
|
||||||
|
core.info("Activating python venv...");
|
||||||
|
await exec.exec("uv", execArgs, options);
|
||||||
|
|
||||||
|
let venvBinPath = ".venv/bin";
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
venvBinPath = ".venv/Scripts";
|
||||||
|
}
|
||||||
|
core.addPath(venvBinPath);
|
||||||
|
core.exportVariable("VIRTUAL_ENV", ".venv");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as github from "@actions/github";
|
import * as github from "@actions/github";
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
|
|
||||||
import { OWNER, REPO } from "./utils/constants";
|
import { GITHUB_COM_API, OWNER, REPO } from "./utils/constants";
|
||||||
import * as semver from "semver";
|
import * as semver from "semver";
|
||||||
|
|
||||||
import { updateChecksums } from "./download/checksum/update-known-checksums";
|
import { updateChecksums } from "./download/checksum/update-known-checksums";
|
||||||
@@ -10,7 +10,7 @@ async function run(): Promise<void> {
|
|||||||
const checksumFilePath = process.argv.slice(2)[0];
|
const checksumFilePath = process.argv.slice(2)[0];
|
||||||
const github_token = process.argv.slice(2)[1];
|
const github_token = process.argv.slice(2)[1];
|
||||||
|
|
||||||
const octokit = github.getOctokit(github_token);
|
const octokit = github.getOctokit(github_token, { baseUrl: GITHUB_COM_API });
|
||||||
|
|
||||||
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
|
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
|
||||||
owner: OWNER,
|
owner: OWNER,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
export const REPO = "uv";
|
export const REPO = "uv";
|
||||||
export const OWNER = "astral-sh";
|
export const OWNER = "astral-sh";
|
||||||
export const TOOL_CACHE_NAME = "uv";
|
export const TOOL_CACHE_NAME = "uv";
|
||||||
|
export const GITHUB_COM_API = "https://api.github.com";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import path from "node:path";
|
|||||||
export const version = core.getInput("version");
|
export const version = core.getInput("version");
|
||||||
export const pythonVersion = core.getInput("python-version");
|
export const pythonVersion = core.getInput("python-version");
|
||||||
export const checkSum = core.getInput("checksum");
|
export const checkSum = core.getInput("checksum");
|
||||||
export const enableCache = core.getInput("enable-cache") === "true";
|
export const enableCache = getEnableCache();
|
||||||
export const cacheSuffix = core.getInput("cache-suffix") || "";
|
export const cacheSuffix = core.getInput("cache-suffix") || "";
|
||||||
export const cacheLocalPath = getCacheLocalPath();
|
export const cacheLocalPath = getCacheLocalPath();
|
||||||
export const cacheDependencyGlob = core.getInput("cache-dependency-glob");
|
export const cacheDependencyGlob = core.getInput("cache-dependency-glob");
|
||||||
@@ -15,6 +15,14 @@ export const toolBinDir = getToolBinDir();
|
|||||||
export const toolDir = getToolDir();
|
export const toolDir = getToolDir();
|
||||||
export const githubToken = core.getInput("github-token");
|
export const githubToken = core.getInput("github-token");
|
||||||
|
|
||||||
|
function getEnableCache(): boolean {
|
||||||
|
const enableCacheInput = core.getInput("enable-cache");
|
||||||
|
if (enableCacheInput === "auto") {
|
||||||
|
return process.env.RUNNER_ENVIRONMENT === "github-hosted";
|
||||||
|
}
|
||||||
|
return enableCacheInput === "true";
|
||||||
|
}
|
||||||
|
|
||||||
function getToolBinDir(): string | undefined {
|
function getToolBinDir(): string | undefined {
|
||||||
const toolBinDirInput = core.getInput("tool-bin-dir");
|
const toolBinDirInput = core.getInput("tool-bin-dir");
|
||||||
if (toolBinDirInput !== "") {
|
if (toolBinDirInput !== "") {
|
||||||
|
|||||||
Reference in New Issue
Block a user