Compare commits

..
33 Commits
Author SHA1 Message Date
48af2dc4a9 Update actions/cache version (#786)
* Updang actions/cache version

* New build

* Update licenses

Co-authored-by: vsvipul <vsvipul@github.com>
2022-04-11 11:56:23 +05:30
Anurag ChauhanandGitHub f63a711791 Merge pull request #781 from actions/t-dedah/cacheSize
Updated @actions/cache to 2.0.1
2022-04-05 15:48:50 +05:30
vsvipul 770a27cf65 Update licenses 2022-04-05 12:17:59 +05:30
Deepak DahiyaandGitHub c2131abcd8 New build 2022-04-05 06:40:46 +00:00
Deepak DahiyaandGitHub 575160481d Updated @actions/cache to 2.0.1 2022-04-05 05:53:11 +00:00
Shubham TiwariandGitHub 136d96b4ae Enabling actions/cache for GHES based on presence of AC service (#774)
* initial changes

* Update package-lock.json

* Update package-lock.json

* review comments and updated test cases

* package.json

* changed name

* added new line

* changed tookit

* updated with 2.0

* changed with public released package

* ran code format

* linting errors

* Update actionUtils.test.ts

* Update cache.dep.yml

* Update package.json

* Update README.md

* Create RELEASES.md

* Update RELEASES.md

* Update package.json

* Update package-lock.json

* typo
2022-03-30 15:46:49 +05:30
7d4f40b464 Bumping up the version to fix download issue for files > 2 GB. (#775)
* Bumping up the version to fix download issue for files > 2 GB.

* Update license for cache

Co-authored-by: vsvipul <vsvipul@github.com>
2022-03-30 15:33:23 +05:30
Ashwin SangemandGitHub 2d8d0d1c9b Updated what's new. (#771)
* Updated what's new.

* Segregated major versions and added changelog.

* Update README.md
2022-03-22 14:04:39 +05:30
Ashwin SangemandGitHub 7799d864d9 Updated the usage and docs to the major version release. (#770) 2022-03-21 14:31:26 +05:30
Ashwin SangemandGitHub 4b0cf6cc46 Merge pull request #769 from actions/users/ashwinsangem/bump_major_version
Bumped up to a major version(v3.0.0)
2022-03-21 13:56:53 +05:30
vsvipul 60c606a2b4 Update licensed files 2022-03-21 12:01:49 +05:30
Ashwin SangemandGitHub b6e9a919a7 Revert "Updated to the latest version."
This reverts commit c842503583.
2022-03-21 04:56:07 +00:00
Ashwin SangemandGitHub c842503583 Updated to the latest version. 2022-03-21 04:53:37 +00:00
Ashwin SangemandGitHub 2b7da2a62c Bumped up to a major version. 2022-03-21 04:42:02 +00:00
VipulandGitHub deae296ab3 Merge pull request #651 from magnetikonline/fix-golang-windows-example
Fix Golang windows example - updated `README.md` test badge markdown.
2022-03-09 18:22:38 +05:30
VipulandGitHub c7c46bcb6d Merge pull request #707 from duxtland/main
Add Deno cache example
2022-02-24 15:51:48 +05:30
Peter Mescalchin 6535c5fb5f Regenerated examples.md TOC 2022-02-24 16:36:38 +11:00
Peter Mescalchin 3fdafa472e Update GitHub Actions status badge markdown in README.md 2022-02-24 16:32:52 +11:00
Peter MescalchinandGitHub 341e6d75d9 Merge branch 'actions:main' into fix-golang-windows-example 2022-02-24 16:28:28 +11:00
Jheyson SaavedraandGitHub 3fe001f5ca chore: add Deno cache example to readme 2022-02-23 16:18:41 -05:00
VipulandGitHub ab4bea262c Merge pull request #567 from yuichkun/fix-typo-in-lerna-example
Fix typo of cache path in Lerna example
2022-02-23 11:24:07 +05:30
Yuichi Yogo 7772fcab79 remove unnecessary sub directory from search path 2022-02-23 12:39:46 +09:00
VipulandGitHub 6c2ab9416b Merge pull request #747 from malob/add-stack-example
Add example for Haskell Stack
2022-02-23 02:21:45 +05:30
Malo Bourgon 2c7b30f330 Add example for Haskell Stack 2022-02-22 10:21:09 -08:00
VipulandGitHub 73cb7e0405 Merge pull request #742 from actions/node-update
Update node version, @types/node and some outdated dependencies
2022-02-16 11:09:30 +05:30
vsvipul 757c5a8ca4 Update deps 2022-02-15 16:44:17 +05:30
Thomas Boopandvsvipul 4e817c1f42 Update to node16
Node 12 has an end of life on April 30, 2022.

This PR updates the default runtime to [node16](https://github.blog/changelog/2021-12-10-github-actions-github-hosted-runners-now-run-node-js-16-by-default/), rather then node12. 

This is supported on all Actions Runners v2.285.0 or later.
2022-02-15 16:38:00 +05:30
Jheyson SaavedraandGitHub de7c17c6a9 chore: add Deno cache example 2022-01-15 19:33:29 -05:00
Peter Mescalchin 447f0fd1d3 Chomp some markdown whitespace 2021-09-26 22:10:48 +10:00
Peter Mescalchin 47e8bd685f Small fix to README.md examples link 2021-09-26 22:10:29 +10:00
Peter Mescalchin 795a8f09a9 Fixed Windows Golang cache paths in example 2021-09-26 22:05:48 +10:00
Yuichi Yogo 4762de4681 simplify path in lerna example 2021-04-21 02:47:03 +09:00
Yuichi Yogo 12ed05f49a Fix typo of cache path in Lerna example 2021-04-17 12:35:30 +09:00
25 changed files with 4865 additions and 4476 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ jobs:
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Restore npm cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
+3 -3
View File
@@ -1,9 +1,9 @@
---
name: "@actions/cache"
version: 1.0.9
version: 2.0.2
type: npm
summary: Actions cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
summary:
homepage:
license: mit
licenses:
- sources: LICENSE.md
+3 -3
View File
@@ -1,9 +1,9 @@
---
name: "@actions/exec"
version: 1.1.0
version: 1.1.1
type: npm
summary: Actions exec lib
homepage: https://github.com/actions/toolkit/tree/main/packages/exec
summary:
homepage:
license: mit
licenses:
- sources: LICENSE.md
+3 -3
View File
@@ -1,9 +1,9 @@
---
name: "@actions/io"
version: 1.1.1
version: 1.1.2
type: npm
summary: Actions io lib
homepage: https://github.com/actions/toolkit/tree/main/packages/io
summary:
homepage:
license: mit
licenses:
- sources: LICENSE.md
+3 -3
View File
@@ -1,9 +1,9 @@
---
name: "@azure/core-asynciterator-polyfill"
version: 1.0.0
version: 1.0.2
type: npm
summary: Polyfill for IE/Node 8 for Symbol.asyncIterator
homepage: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/core-asynciterator-polyfill
summary:
homepage:
license: mit
licenses:
- sources: LICENSE
+3 -4
View File
@@ -1,10 +1,9 @@
---
name: "@azure/core-lro"
version: 2.2.3
version: 2.2.4
type: npm
summary: Isomorphic client library for supporting long-running operations in node.js
and browser.
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-lro/README.md
summary:
homepage:
license: mit
licenses:
- sources: LICENSE
+3 -4
View File
@@ -1,10 +1,9 @@
---
name: "@azure/ms-rest-js"
version: 2.6.0
version: 2.6.1
type: npm
summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client
libraries generated using AutoRest
homepage: https://github.com/Azure/ms-rest-js
summary:
homepage:
license: mit
licenses:
- sources: LICENSE
+3 -3
View File
@@ -1,9 +1,9 @@
---
name: "@azure/storage-blob"
version: 12.8.0
version: 12.9.0
type: npm
summary: Microsoft Azure Storage SDK for JavaScript - Blob
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/
summary:
homepage:
license: mit
licenses:
- sources: LICENSE
+3 -3
View File
@@ -1,9 +1,9 @@
---
name: "@types/node-fetch"
version: 2.5.12
version: 2.6.1
type: npm
summary: TypeScript definitions for node-fetch
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch
summary:
homepage:
license: mit
licenses:
- sources: LICENSE
+3 -3
View File
@@ -1,9 +1,9 @@
---
name: "@types/node"
version: 12.20.42
version: 16.11.26
type: npm
summary: TypeScript definitions for Node.js
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
summary:
homepage:
license: mit
licenses:
- sources: LICENSE
+20 -18
View File
@@ -2,19 +2,25 @@
This action allows caching dependencies and build outputs to improve workflow execution time.
<a href="https://github.com/actions/cache/actions?query=workflow%3ATests"><img alt="GitHub Actions status" src="https://github.com/actions/cache/workflows/Tests/badge.svg?branch=main&event=push"></a>
[![Tests](https://github.com/actions/cache/actions/workflows/workflow.yml/badge.svg)](https://github.com/actions/cache/actions/workflows/workflow.yml)
## Documentation
See ["Caching dependencies to speed up workflows"](https://help.github.com/github/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows).
## What's New
### v3
* Added support for caching from GHES 3.5.
* Fixed download issue for files > 2GB during restore.
* Updated the minimum runner version support from node 12 -> node 16.
* Added support for multiple paths, [glob patterns](https://github.com/actions/toolkit/tree/main/packages/glob), and single file caches.
### v2
* Increased the cache size limit to 10 GB.
* Added support for multiple paths, [glob patterns](https://github.com/actions/toolkit/tree/main/packages/glob), and single file caches.
```yaml
- name: Cache multiple paths
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/cache
@@ -38,7 +44,7 @@ If you are using this inside a container, a POSIX-compliant `tar` needs to be in
### Inputs
* `path` - A list of files, directories, and wildcard patterns to cache and restore. See [`@actions/glob`](https://github.com/actions/toolkit/tree/main/packages/glob) for supported patterns.
* `path` - A list of files, directories, and wildcard patterns to cache and restore. See [`@actions/glob`](https://github.com/actions/toolkit/tree/main/packages/glob) for supported patterns.
* `key` - An explicit key for restoring and saving the cache
* `restore-keys` - An ordered list of keys to use for restoring the cache if no cache hit occurred for key
@@ -49,7 +55,7 @@ If you are using this inside a container, a POSIX-compliant `tar` needs to be in
> See [Skipping steps based on cache-hit](#Skipping-steps-based-on-cache-hit) for info on using this output
### Cache scopes
The cache is scoped to the key and branch. The default branch cache is available to other branches.
The cache is scoped to the key and branch. The default branch cache is available to other branches.
See [Matching a cache key](https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key) for more info.
@@ -69,7 +75,7 @@ jobs:
- name: Cache Primes
id: cache-primes
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: prime-numbers
key: ${{ runner.os }}-primes
@@ -88,11 +94,13 @@ Every programming language and framework has its own way of caching.
See [Examples](examples.md) for a list of `actions/cache` implementations for use with:
- [C# - Nuget](./examples.md#c---nuget)
- [C# - NuGet](./examples.md#c---nuget)
- [D - DUB](./examples.md#d---dub)
- [Deno](./examples.md#deno)
- [Elixir - Mix](./examples.md#elixir---mix)
- [Go - Modules](./examples.md#go---modules)
- [Haskell - Cabal](./examples.md#haskell---cabal)
- [Haskell - Stack](./examples.md#haskell---stack)
- [Java - Gradle](./examples.md#java---gradle)
- [Java - Maven](./examples.md#java---maven)
- [Node - npm](./examples.md#node---npm)
@@ -117,11 +125,11 @@ A cache key can include any of the contexts, functions, literals, and operators
For example, using the [`hashFiles`](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#hashfiles) function allows you to create a new cache when dependencies change.
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
path: |
path/to/dependencies
some/other/dependencies
some/other/dependencies
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
```
@@ -135,7 +143,7 @@ Additionally, you can use arbitrary command output in a cache key, such as a dat
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: path/to/dependencies
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/lockfiles') }}
@@ -156,7 +164,7 @@ Example:
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/cache@v3
id: cache
with:
path: path/to/dependencies
@@ -169,12 +177,6 @@ steps:
> Note: The `id` defined in `actions/cache` must match the `id` in the `if` statement (i.e. `steps.[ID].outputs.cache-hit`)
## Known limitation
- `action/cache` is currently not supported on GitHub Enterprise Server. <https://github.com/github/roadmap/issues/273> is tracking this.
Since GitHub Enterprise Server uses self-hosted runners, dependencies are typically cached on the runner by whatever dependency management tool is being used (npm, maven, etc.). This eliminates the need for explicit caching in some scenarios.
## Contributing
We would love for you to contribute to `actions/cache`, pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
+8
View File
@@ -0,0 +1,8 @@
# Releases
### 3.0.0
- Updated minimum runner version support from node 12 -> node 16
### 3.0.1
- Added support for caching from GHES 3.5.
- Fixed download issue for files > 2GB during restore.
+40
View File
@@ -1,3 +1,4 @@
import * as cache from "@actions/cache";
import * as core from "@actions/core";
import { Events, Outputs, RefKey, State } from "../src/constants";
@@ -5,6 +6,7 @@ import * as actionUtils from "../src/utils/actionUtils";
import * as testUtils from "../src/utils/testUtils";
jest.mock("@actions/core");
jest.mock("@actions/cache");
beforeAll(() => {
jest.spyOn(core, "getInput").mockImplementation((name, options) => {
@@ -232,3 +234,41 @@ test("getInputAsInt throws if required and value missing", () => {
actionUtils.getInputAsInt("undefined", { required: true })
).toThrowError();
});
test("isCacheFeatureAvailable for ac enabled", () => {
jest.spyOn(cache, "isFeatureAvailable").mockImplementation(() => true);
expect(actionUtils.isCacheFeatureAvailable()).toBe(true);
});
test("isCacheFeatureAvailable for ac disabled on GHES", () => {
jest.spyOn(cache, "isFeatureAvailable").mockImplementation(() => false);
const message =
"Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.";
const infoMock = jest.spyOn(core, "info");
try {
process.env["GITHUB_SERVER_URL"] = "http://example.com";
expect(actionUtils.isCacheFeatureAvailable()).toBe(false);
expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`);
} finally {
delete process.env["GITHUB_SERVER_URL"];
}
});
test("isCacheFeatureAvailable for ac disabled on dotcom", () => {
jest.spyOn(cache, "isFeatureAvailable").mockImplementation(() => false);
const message =
"An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.";
const infoMock = jest.spyOn(core, "info");
try {
process.env["GITHUB_SERVER_URL"] = "http://github.com";
expect(actionUtils.isCacheFeatureAvailable()).toBe(false);
expect(infoMock).toHaveBeenCalledWith(`[warning]${message}`);
} finally {
delete process.env["GITHUB_SERVER_URL"];
}
});
+55 -5
View File
@@ -34,6 +34,9 @@ beforeEach(() => {
process.env[RefKey] = "refs/heads/feature-branch";
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false);
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
() => true
);
});
afterEach(() => {
@@ -55,10 +58,12 @@ test("restore with invalid event outputs warning", async () => {
expect(failedMock).toHaveBeenCalledTimes(0);
});
test("restore on GHES should no-op", async () => {
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true);
test("restore without AC available should no-op", async () => {
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false);
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
() => false
);
const logWarningMock = jest.spyOn(actionUtils, "logWarning");
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
@@ -67,9 +72,54 @@ test("restore on GHES should no-op", async () => {
expect(restoreCacheMock).toHaveBeenCalledTimes(0);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
expect(setCacheHitOutputMock).toHaveBeenCalledWith(false);
expect(logWarningMock).toHaveBeenCalledWith(
"Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details"
});
test("restore on GHES without AC available should no-op", async () => {
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true);
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
() => false
);
const restoreCacheMock = jest.spyOn(cache, "restoreCache");
const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
await run();
expect(restoreCacheMock).toHaveBeenCalledTimes(0);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
expect(setCacheHitOutputMock).toHaveBeenCalledWith(false);
});
test("restore on GHES with AC available ", async () => {
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true);
const path = "node_modules";
const key = "node-test";
testUtils.setInputs({
path: path,
key
});
const infoMock = jest.spyOn(core, "info");
const failedMock = jest.spyOn(core, "setFailed");
const stateMock = jest.spyOn(core, "saveState");
const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
const restoreCacheMock = jest
.spyOn(cache, "restoreCache")
.mockImplementationOnce(() => {
return Promise.resolve(key);
});
await run();
expect(restoreCacheMock).toHaveBeenCalledTimes(1);
expect(restoreCacheMock).toHaveBeenCalledWith([path], key, []);
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
expect(setCacheHitOutputMock).toHaveBeenCalledWith(true);
expect(infoMock).toHaveBeenCalledWith(`Cache restored from key: ${key}`);
expect(failedMock).toHaveBeenCalledTimes(0);
});
test("restore with no path should fail", async () => {
+57 -5
View File
@@ -54,6 +54,9 @@ beforeEach(() => {
process.env[RefKey] = "refs/heads/feature-branch";
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => false);
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
() => true
);
});
afterEach(() => {
@@ -101,18 +104,67 @@ test("save with no primary key in state outputs warning", async () => {
expect(failedMock).toHaveBeenCalledTimes(0);
});
test("save on GHES should no-op", async () => {
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true);
test("save without AC available should no-op", async () => {
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
() => false
);
const logWarningMock = jest.spyOn(actionUtils, "logWarning");
const saveCacheMock = jest.spyOn(cache, "saveCache");
await run();
expect(saveCacheMock).toHaveBeenCalledTimes(0);
expect(logWarningMock).toHaveBeenCalledWith(
"Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details"
});
test("save on ghes without AC available should no-op", async () => {
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true);
jest.spyOn(actionUtils, "isCacheFeatureAvailable").mockImplementation(
() => false
);
const saveCacheMock = jest.spyOn(cache, "saveCache");
await run();
expect(saveCacheMock).toHaveBeenCalledTimes(0);
});
test("save on GHES with AC available", async () => {
jest.spyOn(actionUtils, "isGhes").mockImplementation(() => true);
const failedMock = jest.spyOn(core, "setFailed");
const primaryKey = "Linux-node-bb828da54c148048dd17899ba9fda624811cfb43";
const savedCacheKey = "Linux-node-";
jest.spyOn(core, "getState")
// Cache Entry State
.mockImplementationOnce(() => {
return savedCacheKey;
})
// Cache Key State
.mockImplementationOnce(() => {
return primaryKey;
});
const inputPath = "node_modules";
testUtils.setInput(Inputs.Path, inputPath);
testUtils.setInput(Inputs.UploadChunkSize, "4000000");
const cacheId = 4;
const saveCacheMock = jest
.spyOn(cache, "saveCache")
.mockImplementationOnce(() => {
return Promise.resolve(cacheId);
});
await run();
expect(saveCacheMock).toHaveBeenCalledTimes(1);
expect(saveCacheMock).toHaveBeenCalledWith([inputPath], primaryKey, {
uploadChunkSize: 4000000
});
expect(failedMock).toHaveBeenCalledTimes(0);
});
test("save with exact match returns early", async () => {
+1 -1
View File
@@ -18,7 +18,7 @@ outputs:
cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key'
runs:
using: 'node12'
using: 'node16'
main: 'dist/restore/index.js'
post: 'dist/save/index.js'
post-if: 'success()'
Binary file not shown.
+1701 -542
View File
@@ -1199,6 +1199,11 @@ function assertDefined(name, value) {
return value;
}
exports.assertDefined = assertDefined;
function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
}
exports.isGhes = isGhes;
//# sourceMappingURL=cacheUtils.js.map
/***/ }),
@@ -3192,10 +3197,7 @@ const options_1 = __webpack_require__(538);
const requestUtils_1 = __webpack_require__(899);
const versionSalt = '1.0';
function getCacheApiUrl(resource) {
// Ideally we just use ACTIONS_CACHE_URL
const baseUrl = (process.env['ACTIONS_CACHE_URL'] ||
process.env['ACTIONS_RUNTIME_URL'] ||
'').replace('pipelines', 'artifactcache');
const baseUrl = process.env['ACTIONS_CACHE_URL'] || '';
if (!baseUrl) {
throw new Error('Cache Service Url not found, unable to restore cache.');
}
@@ -3273,18 +3275,18 @@ function downloadCache(archiveLocation, archivePath, options) {
exports.downloadCache = downloadCache;
// Reserve Cache
function reserveCache(key, paths, options) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
const httpClient = createHttpClient();
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
const reserveCacheRequest = {
key,
version
version,
cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
};
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
}));
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
return response;
});
}
exports.reserveCache = reserveCache;
@@ -5490,7 +5492,8 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
//
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
// on 64-bit systems), split the download into multiple segments
const maxSegmentSize = buffer.constants.MAX_LENGTH;
// ~2 GB = 2147483647, beyond this, we start getting out of range error. So, capping it accordingly.
const maxSegmentSize = Math.min(2147483647, buffer.constants.MAX_LENGTH);
const downloadProgress = new DownloadProgress(contentLength);
const fd = fs.openSync(archivePath, 'w');
try {
@@ -9647,6 +9650,29 @@ var events = __webpack_require__(614);
var fs = __webpack_require__(747);
var util = __webpack_require__(669);
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var coreHttp__namespace = /*#__PURE__*/_interopNamespace(coreHttp);
var os__namespace = /*#__PURE__*/_interopNamespace(os);
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
var util__namespace = /*#__PURE__*/_interopNamespace(util);
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
@@ -10601,10 +10627,10 @@ const BlobItemInternal = {
modelProperties: {
name: {
serializedName: "Name",
required: true,
xmlName: "Name",
type: {
name: "String"
name: "Composite",
className: "BlobName"
}
},
deleted: {
@@ -10679,6 +10705,30 @@ const BlobItemInternal = {
}
}
};
const BlobName = {
serializedName: "BlobName",
type: {
name: "Composite",
className: "BlobName",
modelProperties: {
encoded: {
serializedName: "Encoded",
xmlName: "Encoded",
xmlIsAttribute: true,
type: {
name: "Boolean"
}
},
content: {
serializedName: "content",
xmlName: "content",
type: {
name: "String"
}
}
}
}
};
const BlobPropertiesInternal = {
serializedName: "BlobPropertiesInternal",
xmlName: "Properties",
@@ -11122,10 +11172,10 @@ const BlobPrefix = {
modelProperties: {
name: {
serializedName: "Name",
required: true,
xmlName: "Name",
type: {
name: "String"
name: "Composite",
className: "BlobName"
}
}
}
@@ -12748,6 +12798,59 @@ const ContainerSubmitBatchExceptionHeaders = {
}
}
};
const ContainerFilterBlobsHeaders = {
serializedName: "Container_filterBlobsHeaders",
type: {
name: "Composite",
className: "ContainerFilterBlobsHeaders",
modelProperties: {
clientRequestId: {
serializedName: "x-ms-client-request-id",
xmlName: "x-ms-client-request-id",
type: {
name: "String"
}
},
requestId: {
serializedName: "x-ms-request-id",
xmlName: "x-ms-request-id",
type: {
name: "String"
}
},
version: {
serializedName: "x-ms-version",
xmlName: "x-ms-version",
type: {
name: "String"
}
},
date: {
serializedName: "date",
xmlName: "date",
type: {
name: "DateTimeRfc1123"
}
}
}
}
};
const ContainerFilterBlobsExceptionHeaders = {
serializedName: "Container_filterBlobsExceptionHeaders",
type: {
name: "Composite",
className: "ContainerFilterBlobsExceptionHeaders",
modelProperties: {
errorCode: {
serializedName: "x-ms-error-code",
xmlName: "x-ms-error-code",
type: {
name: "String"
}
}
}
}
};
const ContainerAcquireLeaseHeaders = {
serializedName: "Container_acquireLeaseHeaders",
type: {
@@ -15256,6 +15359,13 @@ const BlobCopyFromURLHeaders = {
name: "ByteArray"
}
},
encryptionScope: {
serializedName: "x-ms-encryption-scope",
xmlName: "x-ms-encryption-scope",
type: {
name: "String"
}
},
errorCode: {
serializedName: "x-ms-error-code",
xmlName: "x-ms-error-code",
@@ -17773,6 +17883,7 @@ var Mappers = /*#__PURE__*/Object.freeze({
ListBlobsFlatSegmentResponse: ListBlobsFlatSegmentResponse,
BlobFlatListSegment: BlobFlatListSegment,
BlobItemInternal: BlobItemInternal,
BlobName: BlobName,
BlobPropertiesInternal: BlobPropertiesInternal,
ListBlobsHierarchySegmentResponse: ListBlobsHierarchySegmentResponse,
BlobHierarchyListSegment: BlobHierarchyListSegment,
@@ -17824,6 +17935,8 @@ var Mappers = /*#__PURE__*/Object.freeze({
ContainerRenameExceptionHeaders: ContainerRenameExceptionHeaders,
ContainerSubmitBatchHeaders: ContainerSubmitBatchHeaders,
ContainerSubmitBatchExceptionHeaders: ContainerSubmitBatchExceptionHeaders,
ContainerFilterBlobsHeaders: ContainerFilterBlobsHeaders,
ContainerFilterBlobsExceptionHeaders: ContainerFilterBlobsExceptionHeaders,
ContainerAcquireLeaseHeaders: ContainerAcquireLeaseHeaders,
ContainerAcquireLeaseExceptionHeaders: ContainerAcquireLeaseExceptionHeaders,
ContainerReleaseLeaseHeaders: ContainerReleaseLeaseHeaders,
@@ -18011,7 +18124,7 @@ const timeoutInSeconds = {
const version = {
parameterPath: "version",
mapper: {
defaultValue: "2020-10-02",
defaultValue: "2021-04-10",
isConstant: true,
serializedName: "x-ms-version",
type: {
@@ -18106,7 +18219,7 @@ const include = {
element: {
type: {
name: "Enum",
allowedValues: ["metadata", "deleted"]
allowedValues: ["metadata", "deleted", "system"]
}
}
}
@@ -18628,11 +18741,10 @@ const encryptionKeySha256 = {
}
};
const encryptionAlgorithm = {
parameterPath: ["options", "encryptionAlgorithm"],
parameterPath: ["options", "cpkInfo", "encryptionAlgorithm"],
mapper: {
defaultValue: "AES256",
isConstant: true,
serializedName: "x-ms-encryption-algorithm",
xmlName: "x-ms-encryption-algorithm",
type: {
name: "String"
}
@@ -19549,7 +19661,7 @@ class Service {
setProperties(blobServiceProperties, options) {
const operationArguments = {
blobServiceProperties,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setPropertiesOperationSpec);
}
@@ -19560,9 +19672,9 @@ class Service {
*/
getProperties(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec);
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec$2);
}
/**
* Retrieves statistics related to replication for the Blob service. It is only available on the
@@ -19572,7 +19684,7 @@ class Service {
*/
getStatistics(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getStatisticsOperationSpec);
}
@@ -19582,7 +19694,7 @@ class Service {
*/
listContainersSegment(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, listContainersSegmentOperationSpec);
}
@@ -19595,7 +19707,7 @@ class Service {
getUserDelegationKey(keyInfo, options) {
const operationArguments = {
keyInfo,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getUserDelegationKeyOperationSpec);
}
@@ -19605,9 +19717,9 @@ class Service {
*/
getAccountInfo(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getAccountInfoOperationSpec);
return this.client.sendOperationRequest(operationArguments, getAccountInfoOperationSpec$2);
}
/**
* The Batch operation allows multiple API calls to be embedded into a single HTTP request.
@@ -19622,9 +19734,9 @@ class Service {
contentLength,
multipartContentType,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, submitBatchOperationSpec);
return this.client.sendOperationRequest(operationArguments, submitBatchOperationSpec$1);
}
/**
* The Filter Blobs operation enables callers to list blobs across all containers whose tags match a
@@ -19634,13 +19746,13 @@ class Service {
*/
filterBlobs(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, filterBlobsOperationSpec);
return this.client.sendOperationRequest(operationArguments, filterBlobsOperationSpec$1);
}
}
// Operation Specifications
const xmlSerializer = new coreHttp.Serializer(Mappers, /* isXml */ true);
const xmlSerializer$5 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const setPropertiesOperationSpec = {
path: "/",
httpMethod: "PUT",
@@ -19669,9 +19781,9 @@ const setPropertiesOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const getPropertiesOperationSpec = {
const getPropertiesOperationSpec$2 = {
path: "/",
httpMethod: "GET",
responses: {
@@ -19696,7 +19808,7 @@ const getPropertiesOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const getStatisticsOperationSpec = {
path: "/",
@@ -19723,7 +19835,7 @@ const getStatisticsOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const listContainersSegmentOperationSpec = {
path: "/",
@@ -19753,7 +19865,7 @@ const listContainersSegmentOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const getUserDelegationKeyOperationSpec = {
path: "/",
@@ -19784,9 +19896,9 @@ const getUserDelegationKeyOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const getAccountInfoOperationSpec = {
const getAccountInfoOperationSpec$2 = {
path: "/",
httpMethod: "GET",
responses: {
@@ -19802,9 +19914,9 @@ const getAccountInfoOperationSpec = {
urlParameters: [url],
headerParameters: [version, accept1],
isXML: true,
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const submitBatchOperationSpec = {
const submitBatchOperationSpec$1 = {
path: "/",
httpMethod: "POST",
responses: {
@@ -19834,9 +19946,9 @@ const submitBatchOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const filterBlobsOperationSpec = {
const filterBlobsOperationSpec$1 = {
path: "/",
httpMethod: "GET",
responses: {
@@ -19863,7 +19975,7 @@ const filterBlobsOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer
serializer: xmlSerializer$5
};
/*
@@ -19889,9 +20001,9 @@ class Container {
*/
create(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, createOperationSpec);
return this.client.sendOperationRequest(operationArguments, createOperationSpec$2);
}
/**
* returns all user-defined metadata and system properties for the specified container. The data
@@ -19900,7 +20012,7 @@ class Container {
*/
getProperties(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec$1);
}
@@ -19911,9 +20023,9 @@ class Container {
*/
delete(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec);
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec$1);
}
/**
* operation sets one or more user-defined name-value pairs for the specified container.
@@ -19921,9 +20033,9 @@ class Container {
*/
setMetadata(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setMetadataOperationSpec);
return this.client.sendOperationRequest(operationArguments, setMetadataOperationSpec$1);
}
/**
* gets the permissions for the specified container. The permissions indicate whether container data
@@ -19932,7 +20044,7 @@ class Container {
*/
getAccessPolicy(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getAccessPolicyOperationSpec);
}
@@ -19943,7 +20055,7 @@ class Container {
*/
setAccessPolicy(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setAccessPolicyOperationSpec);
}
@@ -19953,7 +20065,7 @@ class Container {
*/
restore(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, restoreOperationSpec);
}
@@ -19965,7 +20077,7 @@ class Container {
rename(sourceContainerName, options) {
const operationArguments = {
sourceContainerName,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, renameOperationSpec);
}
@@ -19982,9 +20094,20 @@ class Container {
contentLength,
multipartContentType,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, submitBatchOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, submitBatchOperationSpec);
}
/**
* The Filter Blobs operation enables callers to list blobs in a container whose tags match a given
* search expression. Filter blobs searches within the given container.
* @param options The options parameters.
*/
filterBlobs(options) {
const operationArguments = {
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, filterBlobsOperationSpec);
}
/**
* [Update] establishes and manages a lock on a container for delete operations. The lock duration can
@@ -19993,9 +20116,9 @@ class Container {
*/
acquireLease(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, acquireLeaseOperationSpec);
return this.client.sendOperationRequest(operationArguments, acquireLeaseOperationSpec$1);
}
/**
* [Update] establishes and manages a lock on a container for delete operations. The lock duration can
@@ -20006,9 +20129,9 @@ class Container {
releaseLease(leaseId, options) {
const operationArguments = {
leaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, releaseLeaseOperationSpec);
return this.client.sendOperationRequest(operationArguments, releaseLeaseOperationSpec$1);
}
/**
* [Update] establishes and manages a lock on a container for delete operations. The lock duration can
@@ -20019,9 +20142,9 @@ class Container {
renewLease(leaseId, options) {
const operationArguments = {
leaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, renewLeaseOperationSpec);
return this.client.sendOperationRequest(operationArguments, renewLeaseOperationSpec$1);
}
/**
* [Update] establishes and manages a lock on a container for delete operations. The lock duration can
@@ -20030,9 +20153,9 @@ class Container {
*/
breakLease(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, breakLeaseOperationSpec);
return this.client.sendOperationRequest(operationArguments, breakLeaseOperationSpec$1);
}
/**
* [Update] establishes and manages a lock on a container for delete operations. The lock duration can
@@ -20047,9 +20170,9 @@ class Container {
const operationArguments = {
leaseId,
proposedLeaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, changeLeaseOperationSpec);
return this.client.sendOperationRequest(operationArguments, changeLeaseOperationSpec$1);
}
/**
* [Update] The List Blobs operation returns a list of the blobs under the specified container
@@ -20057,7 +20180,7 @@ class Container {
*/
listBlobFlatSegment(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, listBlobFlatSegmentOperationSpec);
}
@@ -20072,7 +20195,7 @@ class Container {
listBlobHierarchySegment(delimiter, options) {
const operationArguments = {
delimiter,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, listBlobHierarchySegmentOperationSpec);
}
@@ -20082,14 +20205,14 @@ class Container {
*/
getAccountInfo(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getAccountInfoOperationSpec$1);
}
}
// Operation Specifications
const xmlSerializer$1 = new coreHttp.Serializer(Mappers, /* isXml */ true);
const createOperationSpec = {
const xmlSerializer$4 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const createOperationSpec$2 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20113,7 +20236,7 @@ const createOperationSpec = {
preventEncryptionScopeOverride
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const getPropertiesOperationSpec$1 = {
path: "/{containerName}",
@@ -20136,9 +20259,9 @@ const getPropertiesOperationSpec$1 = {
leaseId
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const deleteOperationSpec = {
const deleteOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "DELETE",
responses: {
@@ -20161,9 +20284,9 @@ const deleteOperationSpec = {
ifUnmodifiedSince
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const setMetadataOperationSpec = {
const setMetadataOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20190,7 +20313,7 @@ const setMetadataOperationSpec = {
ifModifiedSince
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const getAccessPolicyOperationSpec = {
path: "/{containerName}",
@@ -20229,7 +20352,7 @@ const getAccessPolicyOperationSpec = {
leaseId
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const setAccessPolicyOperationSpec = {
path: "/{containerName}",
@@ -20263,7 +20386,7 @@ const setAccessPolicyOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const restoreOperationSpec = {
path: "/{containerName}",
@@ -20291,7 +20414,7 @@ const restoreOperationSpec = {
deletedContainerVersion
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const renameOperationSpec = {
path: "/{containerName}",
@@ -20319,9 +20442,9 @@ const renameOperationSpec = {
sourceLeaseId
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const submitBatchOperationSpec$1 = {
const submitBatchOperationSpec = {
path: "/{containerName}",
httpMethod: "POST",
responses: {
@@ -20355,9 +20478,39 @@ const submitBatchOperationSpec$1 = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const acquireLeaseOperationSpec = {
const filterBlobsOperationSpec = {
path: "/{containerName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: FilterBlobSegment,
headersMapper: ContainerFilterBlobsHeaders
},
default: {
bodyMapper: StorageError,
headersMapper: ContainerFilterBlobsExceptionHeaders
}
},
queryParameters: [
timeoutInSeconds,
marker,
maxPageSize,
comp5,
where,
restype2
],
urlParameters: [url],
headerParameters: [
version,
requestId,
accept1
],
isXML: true,
serializer: xmlSerializer$4
};
const acquireLeaseOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20386,9 +20539,9 @@ const acquireLeaseOperationSpec = {
proposedLeaseId
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const releaseLeaseOperationSpec = {
const releaseLeaseOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20416,9 +20569,9 @@ const releaseLeaseOperationSpec = {
leaseId1
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const renewLeaseOperationSpec = {
const renewLeaseOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20446,9 +20599,9 @@ const renewLeaseOperationSpec = {
action2
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const breakLeaseOperationSpec = {
const breakLeaseOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20476,9 +20629,9 @@ const breakLeaseOperationSpec = {
breakPeriod
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const changeLeaseOperationSpec = {
const changeLeaseOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20507,7 +20660,7 @@ const changeLeaseOperationSpec = {
proposedLeaseId1
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const listBlobFlatSegmentOperationSpec = {
path: "/{containerName}",
@@ -20538,7 +20691,7 @@ const listBlobFlatSegmentOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const listBlobHierarchySegmentOperationSpec = {
path: "/{containerName}",
@@ -20570,7 +20723,7 @@ const listBlobHierarchySegmentOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const getAccountInfoOperationSpec$1 = {
path: "/{containerName}",
@@ -20588,7 +20741,7 @@ const getAccountInfoOperationSpec$1 = {
urlParameters: [url],
headerParameters: [version, accept1],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
/*
@@ -20614,7 +20767,7 @@ class Blob$1 {
*/
download(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, downloadOperationSpec);
}
@@ -20625,9 +20778,9 @@ class Blob$1 {
*/
getProperties(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec$2);
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec);
}
/**
* If the storage account's soft delete feature is disabled then, when a blob is deleted, it is
@@ -20646,9 +20799,9 @@ class Blob$1 {
*/
delete(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec);
}
/**
* Undelete a blob that was previously soft deleted
@@ -20656,7 +20809,7 @@ class Blob$1 {
*/
undelete(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, undeleteOperationSpec);
}
@@ -20668,7 +20821,7 @@ class Blob$1 {
setExpiry(expiryOptions, options) {
const operationArguments = {
expiryOptions,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setExpiryOperationSpec);
}
@@ -20678,7 +20831,7 @@ class Blob$1 {
*/
setHttpHeaders(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setHttpHeadersOperationSpec);
}
@@ -20688,7 +20841,7 @@ class Blob$1 {
*/
setImmutabilityPolicy(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setImmutabilityPolicyOperationSpec);
}
@@ -20698,7 +20851,7 @@ class Blob$1 {
*/
deleteImmutabilityPolicy(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, deleteImmutabilityPolicyOperationSpec);
}
@@ -20710,7 +20863,7 @@ class Blob$1 {
setLegalHold(legalHold, options) {
const operationArguments = {
legalHold,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setLegalHoldOperationSpec);
}
@@ -20721,9 +20874,9 @@ class Blob$1 {
*/
setMetadata(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setMetadataOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, setMetadataOperationSpec);
}
/**
* [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
@@ -20732,9 +20885,9 @@ class Blob$1 {
*/
acquireLease(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, acquireLeaseOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, acquireLeaseOperationSpec);
}
/**
* [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
@@ -20745,9 +20898,9 @@ class Blob$1 {
releaseLease(leaseId, options) {
const operationArguments = {
leaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, releaseLeaseOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, releaseLeaseOperationSpec);
}
/**
* [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
@@ -20758,9 +20911,9 @@ class Blob$1 {
renewLease(leaseId, options) {
const operationArguments = {
leaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, renewLeaseOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, renewLeaseOperationSpec);
}
/**
* [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
@@ -20775,9 +20928,9 @@ class Blob$1 {
const operationArguments = {
leaseId,
proposedLeaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, changeLeaseOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, changeLeaseOperationSpec);
}
/**
* [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
@@ -20786,9 +20939,9 @@ class Blob$1 {
*/
breakLease(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, breakLeaseOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, breakLeaseOperationSpec);
}
/**
* The Create Snapshot operation creates a read-only snapshot of a blob
@@ -20796,7 +20949,7 @@ class Blob$1 {
*/
createSnapshot(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, createSnapshotOperationSpec);
}
@@ -20811,7 +20964,7 @@ class Blob$1 {
startCopyFromURL(copySource, options) {
const operationArguments = {
copySource,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, startCopyFromURLOperationSpec);
}
@@ -20827,7 +20980,7 @@ class Blob$1 {
copyFromURL(copySource, options) {
const operationArguments = {
copySource,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, copyFromURLOperationSpec);
}
@@ -20841,7 +20994,7 @@ class Blob$1 {
abortCopyFromURL(copyId, options) {
const operationArguments = {
copyId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, abortCopyFromURLOperationSpec);
}
@@ -20857,7 +21010,7 @@ class Blob$1 {
setTier(tier, options) {
const operationArguments = {
tier,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setTierOperationSpec);
}
@@ -20867,9 +21020,9 @@ class Blob$1 {
*/
getAccountInfo(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getAccountInfoOperationSpec$2);
return this.client.sendOperationRequest(operationArguments, getAccountInfoOperationSpec);
}
/**
* The Query operation enables users to select/project on blob data by providing simple query
@@ -20878,7 +21031,7 @@ class Blob$1 {
*/
query(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, queryOperationSpec);
}
@@ -20888,7 +21041,7 @@ class Blob$1 {
*/
getTags(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getTagsOperationSpec);
}
@@ -20898,13 +21051,13 @@ class Blob$1 {
*/
setTags(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setTagsOperationSpec);
}
}
// Operation Specifications
const xmlSerializer$2 = new coreHttp.Serializer(Mappers, /* isXml */ true);
const xmlSerializer$3 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const downloadOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "GET",
@@ -20952,9 +21105,9 @@ const downloadOperationSpec = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const getPropertiesOperationSpec$2 = {
const getPropertiesOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "HEAD",
responses: {
@@ -20987,9 +21140,9 @@ const getPropertiesOperationSpec$2 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const deleteOperationSpec$1 = {
const deleteOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "DELETE",
responses: {
@@ -21021,7 +21174,7 @@ const deleteOperationSpec$1 = {
deleteSnapshots
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const undeleteOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21043,7 +21196,7 @@ const undeleteOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setExpiryOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21067,7 +21220,7 @@ const setExpiryOperationSpec = {
expiresOn
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setHttpHeadersOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21101,7 +21254,7 @@ const setHttpHeadersOperationSpec = {
blobContentDisposition
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setImmutabilityPolicyOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21126,7 +21279,7 @@ const setImmutabilityPolicyOperationSpec = {
immutabilityPolicyMode
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const deleteImmutabilityPolicyOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21148,7 +21301,7 @@ const deleteImmutabilityPolicyOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setLegalHoldOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21171,9 +21324,9 @@ const setLegalHoldOperationSpec = {
legalHold
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setMetadataOperationSpec$1 = {
const setMetadataOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21204,9 +21357,9 @@ const setMetadataOperationSpec$1 = {
encryptionScope
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const acquireLeaseOperationSpec$1 = {
const acquireLeaseOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21234,9 +21387,9 @@ const acquireLeaseOperationSpec$1 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const releaseLeaseOperationSpec$1 = {
const releaseLeaseOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21263,9 +21416,9 @@ const releaseLeaseOperationSpec$1 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const renewLeaseOperationSpec$1 = {
const renewLeaseOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21292,9 +21445,9 @@ const renewLeaseOperationSpec$1 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const changeLeaseOperationSpec$1 = {
const changeLeaseOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21322,9 +21475,9 @@ const changeLeaseOperationSpec$1 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const breakLeaseOperationSpec$1 = {
const breakLeaseOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21351,7 +21504,7 @@ const breakLeaseOperationSpec$1 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const createSnapshotOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21384,7 +21537,7 @@ const createSnapshotOperationSpec = {
encryptionScope
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const startCopyFromURLOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21426,7 +21579,7 @@ const startCopyFromURLOperationSpec = {
legalHold1
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const copyFromURLOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21455,6 +21608,7 @@ const copyFromURLOperationSpec = {
ifTags,
immutabilityPolicyExpiry,
immutabilityPolicyMode,
encryptionScope,
tier,
sourceIfModifiedSince,
sourceIfUnmodifiedSince,
@@ -21468,7 +21622,7 @@ const copyFromURLOperationSpec = {
copySourceAuthorization
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const abortCopyFromURLOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21496,7 +21650,7 @@ const abortCopyFromURLOperationSpec = {
copyActionAbortConstant
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setTierOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21530,9 +21684,9 @@ const setTierOperationSpec = {
tier1
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const getAccountInfoOperationSpec$2 = {
const getAccountInfoOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "GET",
responses: {
@@ -21548,7 +21702,7 @@ const getAccountInfoOperationSpec$2 = {
urlParameters: [url],
headerParameters: [version, accept1],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const queryOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21598,7 +21752,7 @@ const queryOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const getTagsOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21628,7 +21782,7 @@ const getTagsOperationSpec = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setTagsOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21662,7 +21816,7 @@ const setTagsOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
/*
@@ -21692,7 +21846,7 @@ class PageBlob {
const operationArguments = {
contentLength,
blobContentLength,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, createOperationSpec$1);
}
@@ -21706,7 +21860,7 @@ class PageBlob {
const operationArguments = {
contentLength,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, uploadPagesOperationSpec);
}
@@ -21718,7 +21872,7 @@ class PageBlob {
clearPages(contentLength, options) {
const operationArguments = {
contentLength,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, clearPagesOperationSpec);
}
@@ -21739,7 +21893,7 @@ class PageBlob {
sourceRange,
contentLength,
range,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, uploadPagesFromURLOperationSpec);
}
@@ -21750,7 +21904,7 @@ class PageBlob {
*/
getPageRanges(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getPageRangesOperationSpec);
}
@@ -21761,7 +21915,7 @@ class PageBlob {
*/
getPageRangesDiff(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getPageRangesDiffOperationSpec);
}
@@ -21774,7 +21928,7 @@ class PageBlob {
resize(blobContentLength, options) {
const operationArguments = {
blobContentLength,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, resizeOperationSpec);
}
@@ -21788,7 +21942,7 @@ class PageBlob {
updateSequenceNumber(sequenceNumberAction, options) {
const operationArguments = {
sequenceNumberAction,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, updateSequenceNumberOperationSpec);
}
@@ -21807,14 +21961,14 @@ class PageBlob {
copyIncremental(copySource, options) {
const operationArguments = {
copySource,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, copyIncrementalOperationSpec);
}
}
// Operation Specifications
const xmlSerializer$3 = new coreHttp.Serializer(Mappers, /* isXml */ true);
const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false);
const xmlSerializer$2 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const serializer$2 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ false);
const createOperationSpec$1 = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
@@ -21861,7 +22015,7 @@ const createOperationSpec$1 = {
blobSequenceNumber
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const uploadPagesOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21903,7 +22057,7 @@ const uploadPagesOperationSpec = {
ifSequenceNumberEqualTo
],
mediaType: "binary",
serializer
serializer: serializer$2
};
const clearPagesOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21941,7 +22095,7 @@ const clearPagesOperationSpec = {
pageWrite1
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const uploadPagesFromURLOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21988,7 +22142,7 @@ const uploadPagesFromURLOperationSpec = {
range1
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const getPageRangesOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22022,7 +22176,7 @@ const getPageRangesOperationSpec = {
ifTags
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const getPageRangesDiffOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22058,7 +22212,7 @@ const getPageRangesDiffOperationSpec = {
prevSnapshotUrl
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const resizeOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22091,7 +22245,7 @@ const resizeOperationSpec = {
blobContentLength
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const updateSequenceNumberOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22121,7 +22275,7 @@ const updateSequenceNumberOperationSpec = {
sequenceNumberAction
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const copyIncrementalOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22149,7 +22303,7 @@ const copyIncrementalOperationSpec = {
copySource
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
/*
@@ -22176,9 +22330,9 @@ class AppendBlob {
create(contentLength, options) {
const operationArguments = {
contentLength,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, createOperationSpec$2);
return this.client.sendOperationRequest(operationArguments, createOperationSpec);
}
/**
* The Append Block operation commits a new block of data to the end of an existing append blob. The
@@ -22192,7 +22346,7 @@ class AppendBlob {
const operationArguments = {
contentLength,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, appendBlockOperationSpec);
}
@@ -22209,7 +22363,7 @@ class AppendBlob {
const operationArguments = {
sourceUrl,
contentLength,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, appendBlockFromUrlOperationSpec);
}
@@ -22220,15 +22374,15 @@ class AppendBlob {
*/
seal(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, sealOperationSpec);
}
}
// Operation Specifications
const xmlSerializer$4 = new coreHttp.Serializer(Mappers, /* isXml */ true);
const serializer$1 = new coreHttp.Serializer(Mappers, /* isXml */ false);
const createOperationSpec$2 = {
const xmlSerializer$1 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const serializer$1 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ false);
const createOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -22271,7 +22425,7 @@ const createOperationSpec$2 = {
blobType1
],
isXML: true,
serializer: xmlSerializer$4
serializer: xmlSerializer$1
};
const appendBlockOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22355,7 +22509,7 @@ const appendBlockFromUrlOperationSpec = {
sourceRange1
],
isXML: true,
serializer: xmlSerializer$4
serializer: xmlSerializer$1
};
const sealOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22383,7 +22537,7 @@ const sealOperationSpec = {
appendPosition
],
isXML: true,
serializer: xmlSerializer$4
serializer: xmlSerializer$1
};
/*
@@ -22415,7 +22569,7 @@ class BlockBlob {
const operationArguments = {
contentLength,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, uploadOperationSpec);
}
@@ -22436,7 +22590,7 @@ class BlockBlob {
const operationArguments = {
contentLength,
copySource,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, putBlobFromUrlOperationSpec);
}
@@ -22454,7 +22608,7 @@ class BlockBlob {
blockId,
contentLength,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, stageBlockOperationSpec);
}
@@ -22473,7 +22627,7 @@ class BlockBlob {
blockId,
contentLength,
sourceUrl,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, stageBlockFromURLOperationSpec);
}
@@ -22491,7 +22645,7 @@ class BlockBlob {
commitBlockList(blocks, options) {
const operationArguments = {
blocks,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, commitBlockListOperationSpec);
}
@@ -22505,14 +22659,14 @@ class BlockBlob {
getBlockList(listType, options) {
const operationArguments = {
listType,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getBlockListOperationSpec);
}
}
// Operation Specifications
const xmlSerializer$5 = new coreHttp.Serializer(Mappers, /* isXml */ true);
const serializer$2 = new coreHttp.Serializer(Mappers, /* isXml */ false);
const xmlSerializer = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const serializer = new coreHttp__namespace.Serializer(Mappers, /* isXml */ false);
const uploadOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
@@ -22560,7 +22714,7 @@ const uploadOperationSpec = {
blobType2
],
mediaType: "binary",
serializer: serializer$2
serializer
};
const putBlobFromUrlOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22613,7 +22767,7 @@ const putBlobFromUrlOperationSpec = {
copySourceBlobProperties
],
isXML: true,
serializer: xmlSerializer$5
serializer: xmlSerializer
};
const stageBlockOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22649,7 +22803,7 @@ const stageBlockOperationSpec = {
accept2
],
mediaType: "binary",
serializer: serializer$2
serializer
};
const stageBlockFromURLOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22690,7 +22844,7 @@ const stageBlockFromURLOperationSpec = {
sourceRange1
],
isXML: true,
serializer: xmlSerializer$5
serializer: xmlSerializer
};
const commitBlockListOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22740,7 +22894,7 @@ const commitBlockListOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer$5
serializer: xmlSerializer
};
const getBlockListOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22770,7 +22924,7 @@ const getBlockListOperationSpec = {
ifTags
],
isXML: true,
serializer: xmlSerializer$5
serializer: xmlSerializer
};
// Copyright (c) Microsoft Corporation.
@@ -22781,8 +22935,8 @@ const logger = logger$1.createClientLogger("storage-blob");
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
const SDK_VERSION = "12.8.0";
const SERVICE_VERSION = "2020-10-02";
const SDK_VERSION = "12.9.0";
const SERVICE_VERSION = "2021-04-10";
const BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB
const BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB
const BLOCK_BLOB_MAX_BLOCKS = 50000;
@@ -22799,15 +22953,15 @@ const URLConstants = {
SIGNATURE: "sig",
SNAPSHOT: "snapshot",
VERSIONID: "versionid",
TIMEOUT: "timeout"
}
TIMEOUT: "timeout",
},
};
const HTTPURLConnection = {
HTTP_ACCEPTED: 202,
HTTP_CONFLICT: 409,
HTTP_NOT_FOUND: 404,
HTTP_PRECON_FAILED: 412,
HTTP_RANGE_NOT_SATISFIABLE: 416
HTTP_RANGE_NOT_SATISFIABLE: 416,
};
const HeaderConstants = {
AUTHORIZATION: "Authorization",
@@ -22832,7 +22986,7 @@ const HeaderConstants = {
X_MS_COPY_SOURCE: "x-ms-copy-source",
X_MS_DATE: "x-ms-date",
X_MS_ERROR_CODE: "x-ms-error-code",
X_MS_VERSION: "x-ms-version"
X_MS_VERSION: "x-ms-version",
};
const ETagNone = "";
const ETagAny = "*";
@@ -22937,7 +23091,7 @@ const StorageBlobLoggingAllowedHeaderNames = [
"x-ms-tag-count",
"x-ms-encryption-key-sha256",
"x-ms-if-tags",
"x-ms-source-if-tags"
"x-ms-source-if-tags",
];
const StorageBlobLoggingAllowedQueryParameters = [
"comp",
@@ -22972,8 +23126,9 @@ const StorageBlobLoggingAllowedQueryParameters = [
"skt",
"sktid",
"skv",
"snapshot"
"snapshot",
];
const BlobUsesCustomerSpecifiedEncryptionMsg = "BlobUsesCustomerSpecifiedEncryption";
// Copyright (c) Microsoft Corporation.
/**
@@ -23113,7 +23268,7 @@ function extractConnectionStringParts(connectionString) {
url: blobEndpoint,
accountName,
accountKey,
proxyUri
proxyUri,
};
}
else {
@@ -23445,14 +23600,14 @@ function toBlobTags(tags) {
return undefined;
}
const res = {
blobTagSet: []
blobTagSet: [],
};
for (const key in tags) {
if (Object.prototype.hasOwnProperty.call(tags, key)) {
const value = tags[key];
res.blobTagSet.push({
key,
value
value,
});
}
}
@@ -23492,33 +23647,33 @@ function toQuerySerialization(textConfiguration) {
fieldQuote: textConfiguration.fieldQuote || "",
recordSeparator: textConfiguration.recordSeparator,
escapeChar: textConfiguration.escapeCharacter || "",
headersPresent: textConfiguration.hasHeaders || false
}
}
headersPresent: textConfiguration.hasHeaders || false,
},
},
};
case "json":
return {
format: {
type: "json",
jsonTextConfiguration: {
recordSeparator: textConfiguration.recordSeparator
}
}
recordSeparator: textConfiguration.recordSeparator,
},
},
};
case "arrow":
return {
format: {
type: "arrow",
arrowConfiguration: {
schema: textConfiguration.schema
}
}
schema: textConfiguration.schema,
},
},
};
case "parquet":
return {
format: {
type: "parquet"
}
type: "parquet",
},
};
default:
throw Error("Invalid BlobQueryTextConfiguration.");
@@ -23542,7 +23697,7 @@ function parseObjectReplicationRecord(objectReplicationRecord) {
}
const rule = {
ruleId: ids[1],
replicationStatus: objectReplicationRecord[key]
replicationStatus: objectReplicationRecord[key],
};
const policyIndex = orProperties.findIndex((policy) => policy.policyId === ids[0]);
if (policyIndex > -1) {
@@ -23551,7 +23706,7 @@ function parseObjectReplicationRecord(objectReplicationRecord) {
else {
orProperties.push({
policyId: ids[0],
rules: [rule]
rules: [rule],
});
}
}
@@ -23570,6 +23725,202 @@ function attachCredential(thing, credential) {
function httpAuthorizationToString(httpAuthorization) {
return httpAuthorization ? httpAuthorization.scheme + " " + httpAuthorization.value : undefined;
}
function BlobNameToString(name) {
if (name.encoded) {
return decodeURIComponent(name.content);
}
else {
return name.content;
}
}
function ConvertInternalResponseOfListBlobFlat(internalResponse) {
return Object.assign(Object.assign({}, internalResponse), { segment: {
blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name) });
return blobItem;
}),
} });
}
function ConvertInternalResponseOfListBlobHierarchy(internalResponse) {
var _a;
return Object.assign(Object.assign({}, internalResponse), { segment: {
blobPrefixes: (_a = internalResponse.segment.blobPrefixes) === null || _a === void 0 ? void 0 : _a.map((blobPrefixInternal) => {
const blobPrefix = {
name: BlobNameToString(blobPrefixInternal.name),
};
return blobPrefix;
}),
blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name) });
return blobItem;
}),
} });
}
function decodeBase64String(value) {
if (coreHttp.isNode) {
return Buffer.from(value, "base64");
}
else {
const byteString = atob(value);
const arr = new Uint8Array(byteString.length);
for (let i = 0; i < byteString.length; i++) {
arr[i] = byteString.charCodeAt(i);
}
return arr;
}
}
function ParseBoolean(content) {
if (content === undefined)
return undefined;
if (content === "true")
return true;
if (content === "false")
return false;
return undefined;
}
function ParseBlobName(blobNameInXML) {
if (blobNameInXML["$"] !== undefined && blobNameInXML["#"] !== undefined) {
return {
encoded: ParseBoolean(blobNameInXML["$"]["Encoded"]),
content: blobNameInXML["#"],
};
}
else {
return {
encoded: false,
content: blobNameInXML,
};
}
}
function ParseBlobItem(blobInXML) {
const blobPropertiesInXML = blobInXML["Properties"];
const blobProperties = {
createdOn: new Date(blobPropertiesInXML["Creation-Time"]),
lastModified: new Date(blobPropertiesInXML["Last-Modified"]),
etag: blobPropertiesInXML["Etag"],
contentLength: blobPropertiesInXML["Content-Length"] === undefined
? undefined
: parseFloat(blobPropertiesInXML["Content-Length"]),
contentType: blobPropertiesInXML["Content-Type"],
contentEncoding: blobPropertiesInXML["Content-Encoding"],
contentLanguage: blobPropertiesInXML["Content-Language"],
contentMD5: decodeBase64String(blobPropertiesInXML["Content-MD5"]),
contentDisposition: blobPropertiesInXML["Content-Disposition"],
cacheControl: blobPropertiesInXML["Cache-Control"],
blobSequenceNumber: blobPropertiesInXML["x-ms-blob-sequence-number"] === undefined
? undefined
: parseFloat(blobPropertiesInXML["x-ms-blob-sequence-number"]),
blobType: blobPropertiesInXML["BlobType"],
leaseStatus: blobPropertiesInXML["LeaseStatus"],
leaseState: blobPropertiesInXML["LeaseState"],
leaseDuration: blobPropertiesInXML["LeaseDuration"],
copyId: blobPropertiesInXML["CopyId"],
copyStatus: blobPropertiesInXML["CopyStatus"],
copySource: blobPropertiesInXML["CopySource"],
copyProgress: blobPropertiesInXML["CopyProgress"],
copyCompletedOn: blobPropertiesInXML["CopyCompletionTime"] === undefined
? undefined
: new Date(blobPropertiesInXML["CopyCompletionTime"]),
copyStatusDescription: blobPropertiesInXML["CopyStatusDescription"],
serverEncrypted: ParseBoolean(blobPropertiesInXML["ServerEncrypted"]),
incrementalCopy: ParseBoolean(blobPropertiesInXML["IncrementalCopy"]),
destinationSnapshot: blobPropertiesInXML["DestinationSnapshot"],
deletedOn: blobPropertiesInXML["DeletedTime"] === undefined
? undefined
: new Date(blobPropertiesInXML["DeletedTime"]),
remainingRetentionDays: blobPropertiesInXML["RemainingRetentionDays"] === undefined
? undefined
: parseFloat(blobPropertiesInXML["RemainingRetentionDays"]),
accessTier: blobPropertiesInXML["AccessTier"],
accessTierInferred: ParseBoolean(blobPropertiesInXML["AccessTierInferred"]),
archiveStatus: blobPropertiesInXML["ArchiveStatus"],
customerProvidedKeySha256: blobPropertiesInXML["CustomerProvidedKeySha256"],
encryptionScope: blobPropertiesInXML["EncryptionScope"],
accessTierChangedOn: blobPropertiesInXML["AccessTierChangeTime"] === undefined
? undefined
: new Date(blobPropertiesInXML["AccessTierChangeTime"]),
tagCount: blobPropertiesInXML["TagCount"] === undefined
? undefined
: parseFloat(blobPropertiesInXML["TagCount"]),
expiresOn: blobPropertiesInXML["Expiry-Time"] === undefined
? undefined
: new Date(blobPropertiesInXML["Expiry-Time"]),
isSealed: ParseBoolean(blobPropertiesInXML["Sealed"]),
rehydratePriority: blobPropertiesInXML["RehydratePriority"],
lastAccessedOn: blobPropertiesInXML["LastAccessTime"] === undefined
? undefined
: new Date(blobPropertiesInXML["LastAccessTime"]),
immutabilityPolicyExpiresOn: blobPropertiesInXML["ImmutabilityPolicyUntilDate"] === undefined
? undefined
: new Date(blobPropertiesInXML["ImmutabilityPolicyUntilDate"]),
immutabilityPolicyMode: blobPropertiesInXML["ImmutabilityPolicyMode"],
legalHold: ParseBoolean(blobPropertiesInXML["LegalHold"]),
};
return {
name: ParseBlobName(blobInXML["Name"]),
deleted: ParseBoolean(blobInXML["Deleted"]),
snapshot: blobInXML["Snapshot"],
versionId: blobInXML["VersionId"],
isCurrentVersion: ParseBoolean(blobInXML["IsCurrentVersion"]),
properties: blobProperties,
metadata: blobInXML["Metadata"],
blobTags: ParseBlobTags(blobInXML["Tags"]),
objectReplicationMetadata: blobInXML["OrMetadata"],
hasVersionsOnly: ParseBoolean(blobInXML["HasVersionsOnly"]),
};
}
function ParseBlobPrefix(blobPrefixInXML) {
return {
name: ParseBlobName(blobPrefixInXML["Name"]),
};
}
function ParseBlobTag(blobTagInXML) {
return {
key: blobTagInXML["Key"],
value: blobTagInXML["Value"],
};
}
function ParseBlobTags(blobTagsInXML) {
if (blobTagsInXML === undefined ||
blobTagsInXML["TagSet"] === undefined ||
blobTagsInXML["TagSet"]["Tag"] === undefined) {
return undefined;
}
const blobTagSet = [];
if (blobTagsInXML["TagSet"]["Tag"] instanceof Array) {
blobTagsInXML["TagSet"]["Tag"].forEach((blobTagInXML) => {
blobTagSet.push(ParseBlobTag(blobTagInXML));
});
}
else {
blobTagSet.push(ParseBlobTag(blobTagsInXML["TagSet"]["Tag"]));
}
return { blobTagSet: blobTagSet };
}
function ProcessBlobItems(blobArrayInXML) {
const blobItems = [];
if (blobArrayInXML instanceof Array) {
blobArrayInXML.forEach((blobInXML) => {
blobItems.push(ParseBlobItem(blobInXML));
});
}
else {
blobItems.push(ParseBlobItem(blobArrayInXML));
}
return blobItems;
}
function ProcessBlobPrefixes(blobPrefixesInXML) {
const blobPrefixes = [];
if (blobPrefixesInXML instanceof Array) {
blobPrefixesInXML.forEach((blobPrefixInXML) => {
blobPrefixes.push(ParseBlobPrefix(blobPrefixInXML));
});
}
else {
blobPrefixes.push(ParseBlobPrefix(blobPrefixesInXML));
}
return blobPrefixes;
}
// Copyright (c) Microsoft Corporation.
/**
@@ -23600,9 +23951,16 @@ class StorageBrowserPolicy extends coreHttp.BaseRequestPolicy {
* @param request -
*/
async sendRequest(request) {
{
if (coreHttp.isNode) {
return this._nextPolicy.sendRequest(request);
}
if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") {
request.url = setURLParameter(request.url, URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString());
}
request.headers.remove(HeaderConstants.COOKIE);
// According to XHR standards, content-length should be fully controlled by browsers
request.headers.remove(HeaderConstants.CONTENT_LENGTH);
return this._nextPolicy.sendRequest(request);
}
}
@@ -23623,6 +23981,10 @@ class StorageBrowserPolicyFactory {
}
// Copyright (c) Microsoft Corporation.
/**
* RetryPolicy types.
*/
exports.StorageRetryPolicyType = void 0;
(function (StorageRetryPolicyType) {
/**
* Exponential retry. Retry time delay grows exponentially.
@@ -23640,7 +24002,7 @@ const DEFAULT_RETRY_OPTIONS = {
retryDelayInMs: 4 * 1000,
retryPolicyType: exports.StorageRetryPolicyType.EXPONENTIAL,
secondaryHost: "",
tryTimeoutInMs: undefined // Use server side default timeout strategy
tryTimeoutInMs: undefined, // Use server side default timeout strategy
};
const RETRY_ABORT_ERROR = new abortController.AbortError("The operation was aborted.");
/**
@@ -23677,7 +24039,7 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
: DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs,
secondaryHost: retryOptions.secondaryHost
? retryOptions.secondaryHost
: DEFAULT_RETRY_OPTIONS.secondaryHost
: DEFAULT_RETRY_OPTIONS.secondaryHost,
};
}
/**
@@ -23754,7 +24116,7 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
"ENOTFOUND",
"TIMEOUT",
"EPIPE",
"REQUEST_SEND_ERROR" // For default xhr based http client provided in ms-rest-js
"REQUEST_SEND_ERROR", // For default xhr based http client provided in ms-rest-js
];
if (err) {
for (const retriableError of retriableErrors) {
@@ -23940,7 +24302,7 @@ class TelemetryPolicy extends coreHttp.BaseRequestPolicy {
* @param request -
*/
async sendRequest(request) {
{
if (coreHttp.isNode) {
if (!request.headers) {
request.headers = new coreHttp.HttpHeaders();
}
@@ -23963,7 +24325,7 @@ class TelemetryPolicyFactory {
*/
constructor(telemetry) {
const userAgentInfo = [];
{
if (coreHttp.isNode) {
if (telemetry) {
const telemetryString = telemetry.userAgentPrefix || "";
if (telemetryString.length > 0 && userAgentInfo.indexOf(telemetryString) === -1) {
@@ -23976,7 +24338,7 @@ class TelemetryPolicyFactory {
userAgentInfo.push(libInfo);
}
// e.g. (NODE-VERSION 4.9.1; Windows_NT 10.0.16299)
const runtimeInfo = `(NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`;
const runtimeInfo = `(NODE-VERSION ${process.version}; ${os__namespace.type()} ${os__namespace.release()})`;
if (userAgentInfo.indexOf(runtimeInfo) === -1) {
userAgentInfo.push(runtimeInfo);
}
@@ -24000,6 +24362,247 @@ function getCachedDefaultHttpClient() {
return _defaultHttpClient;
}
// Copyright (c) Microsoft Corporation.
/**
* A set of constants used internally when processing requests.
*/
const Constants = {
DefaultScope: "/.default",
/**
* Defines constants for use with HTTP headers.
*/
HeaderConstants: {
/**
* The Authorization header.
*/
AUTHORIZATION: "authorization",
},
};
// Default options for the cycler if none are provided
const DEFAULT_CYCLER_OPTIONS = {
forcedRefreshWindowInMs: 1000,
retryIntervalInMs: 3000,
refreshWindowInMs: 1000 * 60 * 2, // Start refreshing 2m before expiry
};
/**
* Converts an an unreliable access token getter (which may resolve with null)
* into an AccessTokenGetter by retrying the unreliable getter in a regular
* interval.
*
* @param getAccessToken - a function that produces a promise of an access
* token that may fail by returning null
* @param retryIntervalInMs - the time (in milliseconds) to wait between retry
* attempts
* @param timeoutInMs - the timestamp after which the refresh attempt will fail,
* throwing an exception
* @returns - a promise that, if it resolves, will resolve with an access token
*/
async function beginRefresh(getAccessToken, retryIntervalInMs, timeoutInMs) {
// This wrapper handles exceptions gracefully as long as we haven't exceeded
// the timeout.
async function tryGetAccessToken() {
if (Date.now() < timeoutInMs) {
try {
return await getAccessToken();
}
catch (_a) {
return null;
}
}
else {
const finalToken = await getAccessToken();
// Timeout is up, so throw if it's still null
if (finalToken === null) {
throw new Error("Failed to refresh access token.");
}
return finalToken;
}
}
let token = await tryGetAccessToken();
while (token === null) {
await coreHttp.delay(retryIntervalInMs);
token = await tryGetAccessToken();
}
return token;
}
/**
* Creates a token cycler from a credential, scopes, and optional settings.
*
* A token cycler represents a way to reliably retrieve a valid access token
* from a TokenCredential. It will handle initializing the token, refreshing it
* when it nears expiration, and synchronizes refresh attempts to avoid
* concurrency hazards.
*
* @param credential - the underlying TokenCredential that provides the access
* token
* @param scopes - the scopes to request authorization for
* @param tokenCyclerOptions - optionally override default settings for the cycler
*
* @returns - a function that reliably produces a valid access token
*/
function createTokenCycler(credential, scopes, tokenCyclerOptions) {
let refreshWorker = null;
let token = null;
const options = Object.assign(Object.assign({}, DEFAULT_CYCLER_OPTIONS), tokenCyclerOptions);
/**
* This little holder defines several predicates that we use to construct
* the rules of refreshing the token.
*/
const cycler = {
/**
* Produces true if a refresh job is currently in progress.
*/
get isRefreshing() {
return refreshWorker !== null;
},
/**
* Produces true if the cycler SHOULD refresh (we are within the refresh
* window and not already refreshing)
*/
get shouldRefresh() {
var _a;
return (!cycler.isRefreshing &&
((_a = token === null || token === void 0 ? void 0 : token.expiresOnTimestamp) !== null && _a !== void 0 ? _a : 0) - options.refreshWindowInMs < Date.now());
},
/**
* Produces true if the cycler MUST refresh (null or nearly-expired
* token).
*/
get mustRefresh() {
return (token === null || token.expiresOnTimestamp - options.forcedRefreshWindowInMs < Date.now());
},
};
/**
* Starts a refresh job or returns the existing job if one is already
* running.
*/
function refresh(getTokenOptions) {
var _a;
if (!cycler.isRefreshing) {
// We bind `scopes` here to avoid passing it around a lot
const tryGetAccessToken = () => credential.getToken(scopes, getTokenOptions);
// Take advantage of promise chaining to insert an assignment to `token`
// before the refresh can be considered done.
refreshWorker = beginRefresh(tryGetAccessToken, options.retryIntervalInMs,
// If we don't have a token, then we should timeout immediately
(_a = token === null || token === void 0 ? void 0 : token.expiresOnTimestamp) !== null && _a !== void 0 ? _a : Date.now())
.then((_token) => {
refreshWorker = null;
token = _token;
return token;
})
.catch((reason) => {
// We also should reset the refresher if we enter a failed state. All
// existing awaiters will throw, but subsequent requests will start a
// new retry chain.
refreshWorker = null;
token = null;
throw reason;
});
}
return refreshWorker;
}
return async (tokenOptions) => {
//
// Simple rules:
// - If we MUST refresh, then return the refresh task, blocking
// the pipeline until a token is available.
// - If we SHOULD refresh, then run refresh but don't return it
// (we can still use the cached token).
// - Return the token, since it's fine if we didn't return in
// step 1.
//
if (cycler.mustRefresh)
return refresh(tokenOptions);
if (cycler.shouldRefresh) {
refresh(tokenOptions);
}
return token;
};
}
/**
* We will retrieve the challenge only if the response status code was 401,
* and if the response contained the header "WWW-Authenticate" with a non-empty value.
*/
function getChallenge(response) {
const challenge = response.headers.get("WWW-Authenticate");
if (response.status === 401 && challenge) {
return challenge;
}
return;
}
/**
* Converts: `Bearer a="b" c="d"`.
* Into: `[ { a: 'b', c: 'd' }]`.
*
* @internal
*/
function parseChallenge(challenge) {
const bearerChallenge = challenge.slice("Bearer ".length);
const challengeParts = `${bearerChallenge.trim()} `.split(" ").filter((x) => x);
const keyValuePairs = challengeParts.map((keyValue) => (([key, value]) => ({ [key]: value }))(keyValue.trim().split("=")));
// Key-value pairs to plain object:
return keyValuePairs.reduce((a, b) => (Object.assign(Object.assign({}, a), b)), {});
}
// #endregion
/**
* Creates a new factory for a RequestPolicy that applies a bearer token to
* the requests' `Authorization` headers.
*
* @param credential - The TokenCredential implementation that can supply the bearer token.
* @param scopes - The scopes for which the bearer token applies.
*/
function storageBearerTokenChallengeAuthenticationPolicy(credential, scopes) {
// This simple function encapsulates the entire process of reliably retrieving the token
let getToken = createTokenCycler(credential, scopes);
class StorageBearerTokenChallengeAuthenticationPolicy extends coreHttp.BaseRequestPolicy {
constructor(nextPolicy, options) {
super(nextPolicy, options);
}
async sendRequest(webResource) {
if (!webResource.url.toLowerCase().startsWith("https://")) {
throw new Error("Bearer token authentication is not permitted for non-TLS protected (non-https) URLs.");
}
const getTokenInternal = getToken;
const token = (await getTokenInternal({
abortSignal: webResource.abortSignal,
tracingOptions: {
tracingContext: webResource.tracingContext,
},
})).token;
webResource.headers.set(Constants.HeaderConstants.AUTHORIZATION, `Bearer ${token}`);
const response = await this._nextPolicy.sendRequest(webResource);
if ((response === null || response === void 0 ? void 0 : response.status) === 401) {
const challenge = getChallenge(response);
if (challenge) {
const challengeInfo = parseChallenge(challenge);
const challengeScopes = challengeInfo.resource_id + Constants.DefaultScope;
const parsedAuthUri = coreHttp.URLBuilder.parse(challengeInfo.authorization_uri);
const pathSegments = parsedAuthUri.getPath().split("/");
const tenantId = pathSegments[1];
const getTokenForChallenge = createTokenCycler(credential, challengeScopes);
const tokenForChallenge = (await getTokenForChallenge({
abortSignal: webResource.abortSignal,
tracingOptions: {
tracingContext: webResource.tracingContext,
},
tenantId: tenantId,
})).token;
getToken = getTokenForChallenge;
webResource.headers.set(Constants.HeaderConstants.AUTHORIZATION, `Bearer ${tokenForChallenge}`);
return this._nextPolicy.sendRequest(webResource);
}
}
return response;
}
}
return {
create: (nextPolicy, options) => {
return new StorageBearerTokenChallengeAuthenticationPolicy(nextPolicy, options);
},
};
}
// Copyright (c) Microsoft Corporation.
/**
* A helper to decide if a given argument satisfies the Pipeline contract
@@ -24045,7 +24648,7 @@ class Pipeline {
toServiceClientOptions() {
return {
httpClient: this.options.httpClient,
requestPolicyFactories: this.factories
requestPolicyFactories: this.factories,
};
}
}
@@ -24057,6 +24660,7 @@ class Pipeline {
* @returns A new Pipeline object.
*/
function newPipeline(credential, pipelineOptions = {}) {
var _a;
if (credential === undefined) {
credential = new AnonymousCredential();
}
@@ -24078,16 +24682,16 @@ function newPipeline(credential, pipelineOptions = {}) {
coreHttp.logPolicy({
logger: logger.info,
allowedHeaderNames: StorageBlobLoggingAllowedHeaderNames,
allowedQueryParameters: StorageBlobLoggingAllowedQueryParameters
})
allowedQueryParameters: StorageBlobLoggingAllowedQueryParameters,
}),
];
{
if (coreHttp.isNode) {
// policies only available in Node.js runtime, not in browsers
factories.push(coreHttp.proxyPolicy(pipelineOptions.proxyOptions));
factories.push(coreHttp.disableResponseDecompressionPolicy());
}
factories.push(coreHttp.isTokenCredential(credential)
? attachCredential(coreHttp.bearerTokenAuthenticationPolicy(credential, StorageOAuthScopes), credential)
? attachCredential(storageBearerTokenChallengeAuthenticationPolicy(credential, (_a = pipelineOptions.audience) !== null && _a !== void 0 ? _a : StorageOAuthScopes), credential)
: credential);
return new Pipeline(factories, pipelineOptions);
}
@@ -24114,7 +24718,9 @@ class StorageSharedKeyCredentialPolicy extends CredentialPolicy {
*/
signRequest(request) {
request.headers.set(HeaderConstants.X_MS_DATE, new Date().toUTCString());
if (request.body && typeof request.body === "string" && request.body.length > 0) {
if (request.body &&
(typeof request.body === "string" || request.body !== undefined) &&
request.body.length > 0) {
request.headers.set(HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body));
}
const stringToSign = [
@@ -24129,7 +24735,7 @@ class StorageSharedKeyCredentialPolicy extends CredentialPolicy {
this.getHeaderValueToSign(request, HeaderConstants.IF_MATCH),
this.getHeaderValueToSign(request, HeaderConstants.IF_NONE_MATCH),
this.getHeaderValueToSign(request, HeaderConstants.IF_UNMODIFIED_SINCE),
this.getHeaderValueToSign(request, HeaderConstants.RANGE)
this.getHeaderValueToSign(request, HeaderConstants.RANGE),
].join("\n") +
"\n" +
this.getCanonicalizedHeadersString(request) +
@@ -24258,9 +24864,7 @@ class StorageSharedKeyCredential extends Credential {
* @param stringToSign -
*/
computeHMACSHA256(stringToSign) {
return crypto.createHmac("sha256", this.accountKey)
.update(stringToSign, "utf8")
.digest("base64");
return crypto.createHmac("sha256", this.accountKey).update(stringToSign, "utf8").digest("base64");
}
}
@@ -24272,8 +24876,8 @@ class StorageSharedKeyCredential extends Credential {
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
const packageName = "azure-storage-blob";
const packageVersion = "12.8.0";
class StorageClientContext extends coreHttp.ServiceClient {
const packageVersion = "12.9.0";
class StorageClientContext extends coreHttp__namespace.ServiceClient {
/**
* Initializes a new instance of the StorageClientContext class.
* @param url The URL of the service account, container, or blob that is the target of the desired
@@ -24289,7 +24893,7 @@ class StorageClientContext extends coreHttp.ServiceClient {
options = {};
}
if (!options.userAgent) {
const defaultUserAgent = coreHttp.getDefaultUserAgentValue();
const defaultUserAgent = coreHttp__namespace.getDefaultUserAgentValue();
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
}
super(undefined, options);
@@ -24298,7 +24902,7 @@ class StorageClientContext extends coreHttp.ServiceClient {
// Parameter assignments
this.url = url;
// Assigning values to Constant parameters
this.version = options.version || "2020-10-02";
this.version = options.version || "2021-04-10";
}
}
@@ -24345,7 +24949,7 @@ class StorageClient {
*/
const createSpan = coreTracing.createSpanFunction({
packagePrefix: "Azure.Storage.Blob",
namespace: "Microsoft.Storage"
namespace: "Microsoft.Storage",
});
/**
* @internal
@@ -24359,7 +24963,7 @@ function convertTracingToRequestOptionsBase(options) {
return {
// By passing spanOptions if they exist at runtime, we're backwards compatible with @azure/core-tracing@preview.13 and earlier.
spanOptions: (_a = options === null || options === void 0 ? void 0 : options.tracingOptions) === null || _a === void 0 ? void 0 : _a.spanOptions,
tracingContext: (_b = options === null || options === void 0 ? void 0 : options.tracingOptions) === null || _b === void 0 ? void 0 : _b.tracingContext
tracingContext: (_b = options === null || options === void 0 ? void 0 : options.tracingOptions) === null || _b === void 0 ? void 0 : _b.tracingContext,
};
}
@@ -24416,6 +25020,10 @@ class BlobSASPermissions {
* Specifies SetImmutabilityPolicy access granted.
*/
this.setImmutabilityPolicy = false;
/**
* Specifies that Permanent Delete is permitted.
*/
this.permanentDelete = false;
}
/**
* Creates a {@link BlobSASPermissions} from the specified permissions string. This method will throw an
@@ -24457,6 +25065,9 @@ class BlobSASPermissions {
case "i":
blobSASPermissions.setImmutabilityPolicy = true;
break;
case "y":
blobSASPermissions.permanentDelete = true;
break;
default:
throw new RangeError(`Invalid permission: ${char}`);
}
@@ -24501,6 +25112,9 @@ class BlobSASPermissions {
if (permissionLike.setImmutabilityPolicy) {
blobSASPermissions.setImmutabilityPolicy = true;
}
if (permissionLike.permanentDelete) {
blobSASPermissions.permanentDelete = true;
}
return blobSASPermissions;
}
/**
@@ -24541,6 +25155,9 @@ class BlobSASPermissions {
if (this.setImmutabilityPolicy) {
permissions.push("i");
}
if (this.permanentDelete) {
permissions.push("y");
}
return permissions.join("");
}
}
@@ -24600,6 +25217,14 @@ class ContainerSASPermissions {
* Specifies SetImmutabilityPolicy access granted.
*/
this.setImmutabilityPolicy = false;
/**
* Specifies that Permanent Delete is permitted.
*/
this.permanentDelete = false;
/**
* Specifies that Filter Blobs by Tags is permitted.
*/
this.filterByTags = false;
}
/**
* Creates an {@link ContainerSASPermissions} from the specified permissions string. This method will throw an
@@ -24644,6 +25269,12 @@ class ContainerSASPermissions {
case "i":
containerSASPermissions.setImmutabilityPolicy = true;
break;
case "y":
containerSASPermissions.permanentDelete = true;
break;
case "f":
containerSASPermissions.filterByTags = true;
break;
default:
throw new RangeError(`Invalid permission ${char}`);
}
@@ -24691,6 +25322,12 @@ class ContainerSASPermissions {
if (permissionLike.setImmutabilityPolicy) {
containerSASPermissions.setImmutabilityPolicy = true;
}
if (permissionLike.permanentDelete) {
containerSASPermissions.permanentDelete = true;
}
if (permissionLike.filterByTags) {
containerSASPermissions.filterByTags = true;
}
return containerSASPermissions;
}
/**
@@ -24736,6 +25373,12 @@ class ContainerSASPermissions {
if (this.setImmutabilityPolicy) {
permissions.push("i");
}
if (this.permanentDelete) {
permissions.push("y");
}
if (this.filterByTags) {
permissions.push("f");
}
return permissions.join("");
}
}
@@ -24765,9 +25408,7 @@ class UserDelegationKeyCredential {
*/
computeHMACSHA256(stringToSign) {
// console.log(`stringToSign: ${JSON.stringify(stringToSign)}`);
return crypto.createHmac("sha256", this.key)
.update(stringToSign, "utf8")
.digest("base64");
return crypto.createHmac("sha256", this.key).update(stringToSign, "utf8").digest("base64");
}
}
@@ -24785,6 +25426,10 @@ function ipRangeToString(ipRange) {
}
// Copyright (c) Microsoft Corporation.
/**
* Protocols for generated SAS.
*/
exports.SASProtocol = void 0;
(function (SASProtocol) {
/**
* Protocol that allows HTTPS only
@@ -24805,7 +25450,7 @@ function ipRangeToString(ipRange) {
* NOTE: Instances of this class are immutable.
*/
class SASQueryParameters {
constructor(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, preauthorizedAgentObjectId, correlationId) {
constructor(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, preauthorizedAgentObjectId, correlationId, encryptionScope) {
this.version = version;
this.signature = signature;
if (permissionsOrOptions !== undefined && typeof permissionsOrOptions !== "string") {
@@ -24818,6 +25463,7 @@ class SASQueryParameters {
this.expiresOn = permissionsOrOptions.expiresOn;
this.ipRangeInner = permissionsOrOptions.ipRange;
this.identifier = permissionsOrOptions.identifier;
this.encryptionScope = permissionsOrOptions.encryptionScope;
this.resource = permissionsOrOptions.resource;
this.cacheControl = permissionsOrOptions.cacheControl;
this.contentDisposition = permissionsOrOptions.contentDisposition;
@@ -24843,6 +25489,7 @@ class SASQueryParameters {
this.protocol = protocol;
this.startsOn = startsOn;
this.ipRangeInner = ipRange;
this.encryptionScope = encryptionScope;
this.identifier = identifier;
this.resource = resource;
this.cacheControl = cacheControl;
@@ -24871,7 +25518,7 @@ class SASQueryParameters {
if (this.ipRangeInner) {
return {
end: this.ipRangeInner.end,
start: this.ipRangeInner.start
start: this.ipRangeInner.start,
};
}
return undefined;
@@ -24890,6 +25537,7 @@ class SASQueryParameters {
"se",
"sip",
"si",
"ses",
"skoid",
"sktid",
"skt",
@@ -24905,7 +25553,7 @@ class SASQueryParameters {
"rscl",
"rsct",
"saoid",
"scid"
"scid",
];
const queries = [];
for (const param of params) {
@@ -24934,6 +25582,9 @@ class SASQueryParameters {
case "si":
this.tryAppendQueryParameter(queries, param, this.identifier);
break;
case "ses":
this.tryAppendQueryParameter(queries, param, this.encryptionScope);
break;
case "skoid": // Signed object ID
this.tryAppendQueryParameter(queries, param, this.signedOid);
break;
@@ -25018,6 +25669,15 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent
if (sharedKeyCredential === undefined && userDelegationKeyCredential === undefined) {
throw TypeError("Invalid sharedKeyCredential, userDelegationKey or accountName.");
}
// Version 2020-12-06 adds support for encryptionscope in SAS.
if (version >= "2020-12-06") {
if (sharedKeyCredential !== undefined) {
return generateBlobSASQueryParameters20201206(blobSASSignatureValues, sharedKeyCredential);
}
else {
return generateBlobSASQueryParametersUDK20201206(blobSASSignatureValues, userDelegationKeyCredential);
}
}
// Version 2019-12-12 adds support for the blob tags permission.
// Version 2018-11-09 adds support for the signed resource and signed blob snapshot time fields.
// https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas#constructing-the-signature-string
@@ -25099,7 +25759,7 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe
blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "",
blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "",
blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "",
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : ""
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "",
].join("\n");
const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
@@ -25168,11 +25828,81 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "",
blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "",
blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "",
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : ""
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "",
].join("\n");
const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
* IMPLEMENTATION FOR API VERSION FROM 2020-12-06.
*
* Creates an instance of SASQueryParameters.
*
* Only accepts required settings needed to create a SAS. For optional settings please
* set corresponding properties directly, such as permissions, startsOn and identifier.
*
* WARNING: When identifier is not provided, permissions and expiresOn are required.
* You MUST assign value to identifier or expiresOn & permissions manually if you initial with
* this constructor.
*
* @param blobSASSignatureValues -
* @param sharedKeyCredential -
*/
function generateBlobSASQueryParameters20201206(blobSASSignatureValues, sharedKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
if (!blobSASSignatureValues.identifier &&
!(blobSASSignatureValues.permissions && blobSASSignatureValues.expiresOn)) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided.");
}
let resource = "c";
let timestamp = blobSASSignatureValues.snapshotTime;
if (blobSASSignatureValues.blobName) {
resource = "b";
if (blobSASSignatureValues.snapshotTime) {
resource = "bs";
}
else if (blobSASSignatureValues.versionId) {
resource = "bv";
timestamp = blobSASSignatureValues.versionId;
}
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
let verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
else {
verifiedPermissions = ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
}
// Signature is generated on the un-url-encoded values.
const stringToSign = [
verifiedPermissions ? verifiedPermissions : "",
blobSASSignatureValues.startsOn
? truncatedISO8061Date(blobSASSignatureValues.startsOn, false)
: "",
blobSASSignatureValues.expiresOn
? truncatedISO8061Date(blobSASSignatureValues.expiresOn, false)
: "",
getCanonicalName(sharedKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName),
blobSASSignatureValues.identifier,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
blobSASSignatureValues.version,
resource,
timestamp,
blobSASSignatureValues.encryptionScope,
blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "",
blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "",
blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "",
blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "",
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "",
].join("\n");
const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, undefined, undefined, undefined, blobSASSignatureValues.encryptionScope);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
* IMPLEMENTATION FOR API VERSION FROM 2018-11-09.
@@ -25244,7 +25974,7 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD
blobSASSignatureValues.contentDisposition,
blobSASSignatureValues.contentEncoding,
blobSASSignatureValues.contentLanguage,
blobSASSignatureValues.contentType
blobSASSignatureValues.contentType,
].join("\n");
const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey);
@@ -25323,11 +26053,91 @@ function generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userD
blobSASSignatureValues.contentDisposition,
blobSASSignatureValues.contentEncoding,
blobSASSignatureValues.contentLanguage,
blobSASSignatureValues.contentType
blobSASSignatureValues.contentType,
].join("\n");
const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
* IMPLEMENTATION FOR API VERSION FROM 2020-12-06.
*
* Creates an instance of SASQueryParameters.
*
* Only accepts required settings needed to create a SAS. For optional settings please
* set corresponding properties directly, such as permissions, startsOn.
*
* WARNING: identifier will be ignored, permissions and expiresOn are required.
*
* @param blobSASSignatureValues -
* @param userDelegationKeyCredential -
*/
function generateBlobSASQueryParametersUDK20201206(blobSASSignatureValues, userDelegationKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
// Stored access policies are not supported for a user delegation SAS.
if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS.");
}
let resource = "c";
let timestamp = blobSASSignatureValues.snapshotTime;
if (blobSASSignatureValues.blobName) {
resource = "b";
if (blobSASSignatureValues.snapshotTime) {
resource = "bs";
}
else if (blobSASSignatureValues.versionId) {
resource = "bv";
timestamp = blobSASSignatureValues.versionId;
}
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
let verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
else {
verifiedPermissions = ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
}
// Signature is generated on the un-url-encoded values.
const stringToSign = [
verifiedPermissions ? verifiedPermissions : "",
blobSASSignatureValues.startsOn
? truncatedISO8061Date(blobSASSignatureValues.startsOn, false)
: "",
blobSASSignatureValues.expiresOn
? truncatedISO8061Date(blobSASSignatureValues.expiresOn, false)
: "",
getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName),
userDelegationKeyCredential.userDelegationKey.signedObjectId,
userDelegationKeyCredential.userDelegationKey.signedTenantId,
userDelegationKeyCredential.userDelegationKey.signedStartsOn
? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false)
: "",
userDelegationKeyCredential.userDelegationKey.signedExpiresOn
? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false)
: "",
userDelegationKeyCredential.userDelegationKey.signedService,
userDelegationKeyCredential.userDelegationKey.signedVersion,
blobSASSignatureValues.preauthorizedAgentObjectId,
undefined,
blobSASSignatureValues.correlationId,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
blobSASSignatureValues.version,
resource,
timestamp,
blobSASSignatureValues.encryptionScope,
blobSASSignatureValues.cacheControl,
blobSASSignatureValues.contentDisposition,
blobSASSignatureValues.contentEncoding,
blobSASSignatureValues.contentLanguage,
blobSASSignatureValues.contentType,
].join("\n");
const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId, blobSASSignatureValues.encryptionScope);
}
function getCanonicalName(accountName, containerName, blobName) {
// Container: "/blob/account/containerName"
// Blob: "/blob/account/containerName/blobName"
@@ -25361,6 +26171,11 @@ function SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues) {
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when providing 'x' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.permanentDelete &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when providing 'y' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
@@ -25371,10 +26186,18 @@ function SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues) {
(blobSASSignatureValues.permissions.move || blobSASSignatureValues.permissions.execute)) {
throw RangeError("'version' must be >= '2020-02-10' when providing the 'm' or 'e' permission.");
}
if (version < "2021-04-10" &&
blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.filterByTags) {
throw RangeError("'version' must be >= '2021-04-10' when providing the 'f' permission.");
}
if (version < "2020-02-10" &&
(blobSASSignatureValues.preauthorizedAgentObjectId || blobSASSignatureValues.correlationId)) {
throw RangeError("'version' must be >= '2020-02-10' when providing 'preauthorizedAgentObjectId' or 'correlationId'.");
}
if (blobSASSignatureValues.encryptionScope && version < "2020-12-06") {
throw RangeError("'version' must be >= '2020-12-06' when provided 'encryptionScope' in SAS.");
}
blobSASSignatureValues.version = version;
return blobSASSignatureValues;
}
@@ -25448,7 +26271,7 @@ class BlobLeaseClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -25483,7 +26306,7 @@ class BlobLeaseClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -25516,7 +26339,7 @@ class BlobLeaseClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -25548,7 +26371,7 @@ class BlobLeaseClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -25583,7 +26406,7 @@ class BlobLeaseClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -25663,8 +26486,7 @@ class RetriableReadableStream extends stream.Readable {
});
}
else {
this.destroy(new Error(`Data corruption failure: received less data than required and reached maxRetires limitation. Received data offset: ${this
.offset - 1}, data needed offset: ${this.end}, retries: ${this.retries}, max retries: ${this.maxRetryRequests}`));
this.destroy(new Error(`Data corruption failure: received less data than required and reached maxRetires limitation. Received data offset: ${this.offset - 1}, data needed offset: ${this.end}, retries: ${this.retries}, max retries: ${this.maxRetryRequests}`));
}
}
else {
@@ -26509,7 +27331,7 @@ class AvroReader {
}
async initialize(options = {}) {
const header = await AvroParser.readFixedBytes(this._headerStream, AVRO_INIT_BYTES.length, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
});
if (!arraysEqual(header, AVRO_INIT_BYTES)) {
throw new Error("Stream is not an Avro file.");
@@ -26517,7 +27339,7 @@ class AvroReader {
// File metadata is written as if defined by the following map schema:
// { "type": "map", "values": "bytes"}
this._metadata = await AvroParser.readMap(this._headerStream, AvroParser.readString, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
});
// Validate codec
const codec = this._metadata[AVRO_CODEC_KEY];
@@ -26526,7 +27348,7 @@ class AvroReader {
}
// The 16-byte, randomly-generated sync marker for this file.
this._syncMarker = await AvroParser.readFixedBytes(this._headerStream, AVRO_SYNC_MARKER_SIZE, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
});
// Parse the schema
const schema = JSON.parse(this._metadata[AVRO_SCHEMA_KEY]);
@@ -26535,7 +27357,7 @@ class AvroReader {
this._blockOffset = this._initialBlockOffset + this._dataStream.position;
}
this._itemsRemainingInBlock = await AvroParser.readLong(this._dataStream, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
});
// skip block length
await AvroParser.readLong(this._dataStream, { abortSignal: options.abortSignal });
@@ -26557,13 +27379,13 @@ class AvroReader {
}
while (this.hasNext()) {
const result = yield tslib.__await(this._itemType.read(this._dataStream, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
}));
this._itemsRemainingInBlock--;
this._objectIndex++;
if (this._itemsRemainingInBlock == 0) {
const marker = yield tslib.__await(AvroParser.readFixedBytes(this._dataStream, AVRO_SYNC_MARKER_SIZE, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
}));
this._blockOffset = this._initialBlockOffset + this._dataStream.position;
this._objectIndex = 0;
@@ -26572,7 +27394,7 @@ class AvroReader {
}
try {
this._itemsRemainingInBlock = yield tslib.__await(AvroParser.readLong(this._dataStream, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
}));
}
catch (err) {
@@ -26771,7 +27593,7 @@ class BlobQuickQueryStream extends stream.Readable {
position,
name,
isFatal: fatal,
description
description,
});
}
break;
@@ -27147,6 +27969,11 @@ class BlobQueryResponse {
}
// Copyright (c) Microsoft Corporation.
/**
* Represents the access tier on a blob.
* For detailed information about block blob level tiering see {@link https://docs.microsoft.com/azure/storage/blobs/storage-blob-storage-tiers|Hot, cool and archive storage tiers.}
*/
exports.BlockBlobTier = void 0;
(function (BlockBlobTier) {
/**
* Optimized for storing data that is accessed frequently.
@@ -27162,6 +27989,12 @@ class BlobQueryResponse {
*/
BlockBlobTier["Archive"] = "Archive";
})(exports.BlockBlobTier || (exports.BlockBlobTier = {}));
/**
* Specifies the page blob tier to set the blob to. This is only applicable to page blobs on premium storage accounts.
* Please see {@link https://docs.microsoft.com/azure/storage/storage-premium-storage#scalability-and-performance-targets|here}
* for detailed information on the corresponding IOPS and throughput per PageBlobTier.
*/
exports.PremiumPageBlobTier = void 0;
(function (PremiumPageBlobTier) {
/**
* P4 Tier.
@@ -27222,6 +28055,20 @@ function ensureCpkIfSpecified(cpk, isHttps) {
cpk.encryptionAlgorithm = EncryptionAlgorithmAES25;
}
}
/**
* Defines the known cloud audiences for Storage.
*/
exports.StorageBlobAudience = void 0;
(function (StorageBlobAudience) {
/**
* The OAuth scope to use to retrieve an AAD token for Azure Storage.
*/
StorageBlobAudience["StorageOAuthScopes"] = "https://storage.azure.com/.default";
/**
* The OAuth scope to use to retrieve an AAD token for Azure Disk.
*/
StorageBlobAudience["DiskComputeOAuthScopes"] = "https://disk.compute.azure.com/.default";
})(exports.StorageBlobAudience || (exports.StorageBlobAudience = {}));
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
@@ -27234,16 +28081,16 @@ function ensureCpkIfSpecified(cpk, isHttps) {
function rangeResponseFromModel(response) {
const pageRange = (response._response.parsedBody.pageRange || []).map((x) => ({
offset: x.start,
count: x.end - x.start
count: x.end - x.start,
}));
const clearRange = (response._response.parsedBody.clearRange || []).map((x) => ({
offset: x.start,
count: x.end - x.start
count: x.end - x.start,
}));
return Object.assign(Object.assign({}, response), { pageRange,
clearRange, _response: Object.assign(Object.assign({}, response._response), { parsedBody: {
pageRange,
clearRange
clearRange,
} }) });
}
@@ -27256,7 +28103,7 @@ function rangeResponseFromModel(response) {
*/
class BlobBeginCopyFromUrlPoller extends coreLro.Poller {
constructor(options) {
const { blobClient, copySource, intervalInMs = 15000, onProgress, resumeFrom, startCopyFromURLOptions } = options;
const { blobClient, copySource, intervalInMs = 15000, onProgress, resumeFrom, startCopyFromURLOptions, } = options;
let state;
if (resumeFrom) {
state = JSON.parse(resumeFrom).state;
@@ -27292,7 +28139,7 @@ const cancel = async function cancel(options = {}) {
}
// if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call
await state.blobClient.abortCopyFromURL(copyId, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
});
state.isCancelled = true;
return makeBlobBeginCopyFromURLPollOperation(state);
@@ -27370,7 +28217,7 @@ function makeBlobBeginCopyFromURLPollOperation(state) {
state: Object.assign({}, state),
cancel,
toString,
update
update,
};
}
@@ -28012,7 +28859,7 @@ async function streamToBuffer2(stream, buffer, encoding) {
*/
async function readStreamToLocalFile(rs, file) {
return new Promise((resolve, reject) => {
const ws = fs.createWriteStream(file);
const ws = fs__namespace.createWriteStream(file);
rs.on("error", (err) => {
reject(err);
});
@@ -28028,8 +28875,8 @@ async function readStreamToLocalFile(rs, file) {
*
* Promisified version of fs.stat().
*/
const fsStat = util.promisify(fs.stat);
const fsCreateReadStream = fs.createReadStream;
const fsStat = util__namespace.promisify(fs__namespace.stat);
const fsCreateReadStream = fs__namespace.createReadStream;
/**
* A BlobClient represents a URL to an Azure Storage blob; the blob may be a block blob,
@@ -28072,12 +28919,17 @@ class BlobClient extends StorageClient {
const blobName = blobNameOrOptions;
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
pipeline = newPipeline(sharedKeyCredential, options);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
url =
@@ -28094,10 +28946,8 @@ class BlobClient extends StorageClient {
throw new Error("Expecting non-empty strings for containerName and blobName parameters");
}
super(url, pipeline);
({
blobName: this._name,
containerName: this._containerName
} = this.getBlobAndContainerNamesFromUrl());
({ blobName: this._name, containerName: this._containerName } =
this.getBlobAndContainerNamesFromUrl());
this.blobContext = new Blob$1(this.storageClientContext);
this._snapshot = getURLParameter(this.url, URLConstants.Parameters.SNAPSHOT);
this._versionId = getURLParameter(this.url, URLConstants.Parameters.VERSIONID);
@@ -28222,11 +29072,13 @@ class BlobClient extends StorageClient {
const { span, updatedOptions } = createSpan("BlobClient-download", options);
try {
const res = await this.blobContext.download(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
onDownloadProgress: coreHttp.isNode ? undefined : options.onProgress // for Node.js, progress is reported by RetriableReadableStream
onDownloadProgress: coreHttp.isNode ? undefined : options.onProgress, // for Node.js, progress is reported by RetriableReadableStream
}, range: offset === 0 && !count ? undefined : rangeToString({ offset, count }), rangeGetContentMD5: options.rangeGetContentMD5, rangeGetContentCRC64: options.rangeGetContentCrc64, snapshot: options.snapshot, cpkInfo: options.customerProvidedKey }, convertTracingToRequestOptionsBase(updatedOptions)));
const wrappedRes = Object.assign(Object.assign({}, res), { _response: res._response, objectReplicationDestinationPolicyId: res.objectReplicationPolicyId, objectReplicationSourceProperties: parseObjectReplicationRecord(res.objectReplicationRules) });
// Return browser response immediately
if (false) {}
if (!coreHttp.isNode) {
return wrappedRes;
}
// We support retrying when download stream unexpected ends in Node.js runtime
// Following code shouldn't be bundled into browser build, however some
// bundlers may try to bundle following code and "FileReadResponse.ts".
@@ -28251,16 +29103,16 @@ class BlobClient extends StorageClient {
ifModifiedSince: options.conditions.ifModifiedSince,
ifNoneMatch: options.conditions.ifNoneMatch,
ifUnmodifiedSince: options.conditions.ifUnmodifiedSince,
ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions
ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions,
},
range: rangeToString({
count: offset + res.contentLength - start,
offset: start
offset: start,
}),
rangeGetContentMD5: options.rangeGetContentMD5,
rangeGetContentCRC64: options.rangeGetContentCrc64,
snapshot: options.snapshot,
cpkInfo: options.customerProvidedKey
cpkInfo: options.customerProvidedKey,
};
// Debug purpose only
// console.log(
@@ -28271,13 +29123,13 @@ class BlobClient extends StorageClient {
return (await this.blobContext.download(Object.assign({ abortSignal: options.abortSignal }, updatedDownloadOptions))).readableStreamBody;
}, offset, res.contentLength, {
maxRetryRequests: options.maxRetryRequests,
onProgress: options.onProgress
onProgress: options.onProgress,
});
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28302,21 +29154,23 @@ class BlobClient extends StorageClient {
abortSignal: options.abortSignal,
customerProvidedKey: options.customerProvidedKey,
conditions: options.conditions,
tracingOptions: updatedOptions.tracingOptions
tracingOptions: updatedOptions.tracingOptions,
});
return true;
}
catch (e) {
if (e.statusCode === 404) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when checking blob existence"
});
// Expected exception when checking blob existence
return false;
}
else if (e.statusCode === 409 &&
e.details.errorCode === BlobUsesCustomerSpecifiedEncryptionMsg) {
// Expected exception when checking blob existence
return true;
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28348,7 +29202,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28375,7 +29229,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28397,20 +29251,19 @@ class BlobClient extends StorageClient {
const { span, updatedOptions } = createSpan("BlobClient-deleteIfExists", options);
try {
const res = await this.delete(updatedOptions);
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
});
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
}
catch (e) {
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobNotFound") {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when deleting a blob or snapshot only if it exists."
message: "Expected exception when deleting a blob or snapshot only if it exists.",
});
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28434,7 +29287,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28468,7 +29321,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28498,7 +29351,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28524,7 +29377,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28548,7 +29401,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28582,7 +29435,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28666,7 +29519,7 @@ class BlobClient extends StorageClient {
const client = {
abortCopyFromURL: (...args) => this.abortCopyFromURL(...args),
getProperties: (...args) => this.getProperties(...args),
startCopyFromURL: (...args) => this.startCopyFromURL(...args)
startCopyFromURL: (...args) => this.startCopyFromURL(...args),
};
const poller = new BlobBeginCopyFromUrlPoller({
blobClient: client,
@@ -28674,7 +29527,7 @@ class BlobClient extends StorageClient {
intervalInMs: options.intervalInMs,
onProgress: options.onProgress,
resumeFrom: options.resumeFrom,
startCopyFromURLOptions: options
startCopyFromURLOptions: options,
});
// Trigger the startCopyFromURL call by calling poll.
// Any errors from this method should be surfaced to the user.
@@ -28697,7 +29550,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28723,13 +29576,13 @@ class BlobClient extends StorageClient {
sourceIfMatch: options.sourceConditions.ifMatch,
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince
}, sourceContentMD5: options.sourceContentMD5, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), blobTagsString: toBlobTagsString(options.tags), immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold }, convertTracingToRequestOptionsBase(updatedOptions)));
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
}, sourceContentMD5: options.sourceContentMD5, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), blobTagsString: toBlobTagsString(options.tags), immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28757,7 +29610,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28834,7 +29687,7 @@ class BlobClient extends StorageClient {
conditions: options.conditions,
maxRetryRequests: options.maxRetryRequestsPerBlock,
customerProvidedKey: options.customerProvidedKey,
tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions))
tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions)),
});
const stream = response.readableStreamBody;
await streamToBuffer(stream, buffer, off - offset, chunkEnd - offset);
@@ -28853,7 +29706,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28891,7 +29744,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28972,13 +29825,13 @@ class BlobClient extends StorageClient {
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
sourceIfTags: options.sourceConditions.tagConditions
sourceIfTags: options.sourceConditions.tagConditions,
}, immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, rehydratePriority: options.rehydratePriority, tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags), sealBlob: options.sealBlob }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29019,7 +29872,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29040,7 +29893,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29061,7 +29914,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29112,12 +29965,17 @@ class AppendBlobClient extends BlobClient {
const blobName = blobNameOrOptions;
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
pipeline = newPipeline(sharedKeyCredential, options);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
url =
@@ -29172,7 +30030,7 @@ class AppendBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29193,20 +30051,19 @@ class AppendBlobClient extends BlobClient {
const conditions = { ifNoneMatch: ETagAny };
try {
const res = await this.create(Object.assign(Object.assign({}, updatedOptions), { conditions }));
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
});
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
}
catch (e) {
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when creating a blob only if it does not already exist."
message: "Expected exception when creating a blob only if it does not already exist.",
});
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29229,7 +30086,7 @@ class AppendBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29268,13 +30125,13 @@ class AppendBlobClient extends BlobClient {
try {
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
return await this.appendBlobContext.appendBlock(contentLength, body, Object.assign({ abortSignal: options.abortSignal, appendPositionAccessConditions: options.conditions, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
onUploadProgress: options.onProgress
onUploadProgress: options.onProgress,
}, transactionalContentMD5: options.transactionalContentMD5, transactionalContentCrc64: options.transactionalContentCrc64, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29307,13 +30164,13 @@ class AppendBlobClient extends BlobClient {
sourceIfMatch: options.sourceConditions.ifMatch,
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
}, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29364,12 +30221,17 @@ class BlockBlobClient extends BlobClient {
const blobName = blobNameOrOptions;
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
pipeline = newPipeline(sharedKeyCredential, options);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
url =
@@ -29435,23 +30297,25 @@ class BlockBlobClient extends BlobClient {
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
const { span, updatedOptions } = createSpan("BlockBlobClient-query", options);
try {
if (false) {}
if (!coreHttp.isNode) {
throw new Error("This operation currently is only supported in Node.js.");
}
const response = await this._blobContext.query(Object.assign({ abortSignal: options.abortSignal, queryRequest: {
queryType: "SQL",
expression: query,
inputSerialization: toQuerySerialization(options.inputTextConfiguration),
outputSerialization: toQuerySerialization(options.outputTextConfiguration)
outputSerialization: toQuerySerialization(options.outputTextConfiguration),
}, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions)));
return new BlobQueryResponse(response, {
abortSignal: options.abortSignal,
onProgress: options.onProgress,
onError: options.onError
onError: options.onError,
});
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29493,13 +30357,13 @@ class BlockBlobClient extends BlobClient {
try {
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
return await this.blockBlobContext.upload(contentLength, body, Object.assign({ abortSignal: options.abortSignal, blobHttpHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, metadata: options.metadata, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
onUploadProgress: options.onProgress
onUploadProgress: options.onProgress,
}, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags) }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29536,13 +30400,13 @@ class BlockBlobClient extends BlobClient {
sourceIfModifiedSince: (_b = options.sourceConditions) === null || _b === void 0 ? void 0 : _b.ifModifiedSince,
sourceIfNoneMatch: (_c = options.sourceConditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch,
sourceIfUnmodifiedSince: (_d = options.sourceConditions) === null || _d === void 0 ? void 0 : _d.ifUnmodifiedSince,
sourceIfTags: (_e = options.sourceConditions) === null || _e === void 0 ? void 0 : _e.tagConditions
sourceIfTags: (_e = options.sourceConditions) === null || _e === void 0 ? void 0 : _e.tagConditions,
}, cpkInfo: options.customerProvidedKey, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags) }), convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29566,13 +30430,13 @@ class BlockBlobClient extends BlobClient {
try {
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
return await this.blockBlobContext.stageBlock(blockId, contentLength, body, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, requestOptions: {
onUploadProgress: options.onProgress
onUploadProgress: options.onProgress,
}, transactionalContentMD5: options.transactionalContentMD5, transactionalContentCrc64: options.transactionalContentCrc64, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29610,7 +30474,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29641,7 +30505,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29675,7 +30539,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29702,7 +30566,7 @@ class BlockBlobClient extends BlobClient {
async uploadData(data, options = {}) {
const { span, updatedOptions } = createSpan("BlockBlobClient-uploadData", options);
try {
if (true) {
if (coreHttp.isNode) {
let buffer;
if (data instanceof Buffer) {
buffer = data;
@@ -29716,12 +30580,15 @@ class BlockBlobClient extends BlobClient {
}
return this.uploadSeekableInternal((offset, size) => buffer.slice(offset, offset + size), buffer.byteLength, updatedOptions);
}
else {}
else {
const browserBlob = new Blob([data]);
return this.uploadSeekableInternal((offset, size) => browserBlob.slice(offset, offset + size), browserBlob.size, updatedOptions);
}
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29757,7 +30624,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29770,7 +30637,7 @@ class BlockBlobClient extends BlobClient {
* Uploads data to block blob. Requires a bodyFactory as the data source,
* which need to return a {@link HttpRequestBody} object with the offset and size provided.
*
* When data length is no more than the specifiled {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is
* When data length is no more than the specified {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is
* {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload.
* Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList}
* to commit the block list.
@@ -29836,14 +30703,14 @@ class BlockBlobClient extends BlobClient {
abortSignal: options.abortSignal,
conditions: options.conditions,
encryptionScope: options.encryptionScope,
tracingOptions: updatedOptions.tracingOptions
tracingOptions: updatedOptions.tracingOptions,
});
// Update progress after block is successfully uploaded to server, in case of block trying
// TODO: Hook with convenience layer progress event in finer level
transferProgress += contentLength;
if (options.onProgress) {
options.onProgress({
loadedBytes: transferProgress
loadedBytes: transferProgress,
});
}
});
@@ -29854,7 +30721,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29883,14 +30750,14 @@ class BlockBlobClient extends BlobClient {
return () => fsCreateReadStream(filePath, {
autoClose: true,
end: count ? offset + count - 1 : Infinity,
start: offset
start: offset,
});
}, size, Object.assign(Object.assign({}, options), { tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions)) }));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29934,7 +30801,7 @@ class BlockBlobClient extends BlobClient {
await this.stageBlock(blockID, body, length, {
conditions: options.conditions,
encryptionScope: options.encryptionScope,
tracingOptions: updatedOptions.tracingOptions
tracingOptions: updatedOptions.tracingOptions,
});
// Update progress after block is successfully uploaded to server, in case of block trying
transferProgress += length;
@@ -29953,7 +30820,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30004,12 +30871,17 @@ class PageBlobClient extends BlobClient {
const blobName = blobNameOrOptions;
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
pipeline = newPipeline(sharedKeyCredential, options);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
url =
@@ -30059,7 +30931,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30082,20 +30954,19 @@ class PageBlobClient extends BlobClient {
try {
const conditions = { ifNoneMatch: ETagAny };
const res = await this.create(size, Object.assign(Object.assign({}, options), { conditions, tracingOptions: updatedOptions.tracingOptions }));
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
});
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
}
catch (e) {
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when creating a blob only if it does not already exist."
message: "Expected exception when creating a blob only if it does not already exist.",
});
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30120,13 +30991,13 @@ class PageBlobClient extends BlobClient {
try {
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
return await this.pageBlobContext.uploadPages(count, body, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
onUploadProgress: options.onProgress
onUploadProgress: options.onProgress,
}, range: rangeToString({ offset, count }), sequenceNumberAccessConditions: options.conditions, transactionalContentMD5: options.transactionalContentMD5, transactionalContentCrc64: options.transactionalContentCrc64, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30156,13 +31027,13 @@ class PageBlobClient extends BlobClient {
sourceIfMatch: options.sourceConditions.ifMatch,
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
}, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization) }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30189,7 +31060,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30218,7 +31089,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30248,7 +31119,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30278,7 +31149,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30304,7 +31175,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30331,7 +31202,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30361,7 +31232,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30509,7 +31380,7 @@ class BatchResponseParser {
return {
subResponses: deserializedSubResponses,
subResponsesSucceededCount: subResponsesSucceededCount,
subResponsesFailedCount: subResponsesFailedCount
subResponsesFailedCount: subResponsesFailedCount,
};
}
}
@@ -30656,7 +31527,7 @@ class BlobBatch {
this.setBatchType("delete");
await this.addSubRequestInternal({
url: url,
credential: credential
credential: credential,
}, async () => {
await new BlobClient(url, this.batchRequest.createPipeline(credential)).delete(updatedOptions);
});
@@ -30664,7 +31535,7 @@ class BlobBatch {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30703,7 +31574,7 @@ class BlobBatch {
this.setBatchType("setAccessTier");
await this.addSubRequestInternal({
url: url,
credential: credential
credential: credential,
}, async () => {
await new BlobClient(url, this.batchRequest.createPipeline(credential)).setAccessTier(tier, updatedOptions);
});
@@ -30711,7 +31582,7 @@ class BlobBatch {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30768,7 +31639,7 @@ class InnerBatchRequest {
this.subRequestPrefix,
`${HeaderConstants.CONTENT_ID}: ${this.operationCount}`,
"",
`${request.method.toString()} ${getURLPathAndQuery(request.url)} ${HTTP_VERSION_1_1}${HTTP_LINE_ENDING}` // sub request start line with method
`${request.method.toString()} ${getURLPathAndQuery(request.url)} ${HTTP_VERSION_1_1}${HTTP_LINE_ENDING}`, // sub request start line with method
].join(HTTP_LINE_ENDING);
for (const header of request.headers.headersArray()) {
this.body += `${header.name}: ${header.value}${HTTP_LINE_ENDING}`;
@@ -30808,7 +31679,7 @@ class BatchRequestAssemblePolicy extends coreHttp.BaseRequestPolicy {
this.dummyResponse = {
request: new coreHttp.WebResource(),
status: 200,
headers: new coreHttp.HttpHeaders()
headers: new coreHttp.HttpHeaders(),
};
this.batchRequest = batchRequest;
}
@@ -30975,14 +31846,14 @@ class BlobBatchClient {
version: rawBatchResponse.version,
subResponses: responseSummary.subResponses,
subResponsesSucceededCount: responseSummary.subResponsesSucceededCount,
subResponsesFailedCount: responseSummary.subResponsesFailedCount
subResponsesFailedCount: responseSummary.subResponsesFailedCount,
};
return res;
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31028,12 +31899,17 @@ class ContainerClient extends StorageClient {
const containerName = credentialOrPipelineOrContainerName;
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
url = appendToURLPath(extractedCreds.url, encodeURIComponent(containerName));
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
pipeline = newPipeline(sharedKeyCredential, options);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
url =
@@ -31085,7 +31961,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31105,20 +31981,19 @@ class ContainerClient extends StorageClient {
const { span, updatedOptions } = createSpan("ContainerClient-createIfNotExists", options);
try {
const res = await this.create(updatedOptions);
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
});
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
}
catch (e) {
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when creating a container only if it does not already exist."
message: "Expected exception when creating a container only if it does not already exist.",
});
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31140,7 +32015,7 @@ class ContainerClient extends StorageClient {
try {
await this.getProperties({
abortSignal: options.abortSignal,
tracingOptions: updatedOptions.tracingOptions
tracingOptions: updatedOptions.tracingOptions,
});
return true;
}
@@ -31148,13 +32023,13 @@ class ContainerClient extends StorageClient {
if (e.statusCode === 404) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when checking container existence"
message: "Expected exception when checking container existence",
});
return false;
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31228,7 +32103,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31254,7 +32129,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31274,20 +32149,19 @@ class ContainerClient extends StorageClient {
const { span, updatedOptions } = createSpan("ContainerClient-deleteIfExists", options);
try {
const res = await this.delete(updatedOptions);
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
});
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
}
catch (e) {
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when deleting a container only if it exists."
message: "Expected exception when deleting a container only if it exists.",
});
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31321,7 +32195,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31357,13 +32231,13 @@ class ContainerClient extends StorageClient {
requestId: response.requestId,
clientRequestId: response.clientRequestId,
signedIdentifiers: [],
version: response.version
version: response.version,
};
for (const identifier of response) {
let accessPolicy = undefined;
if (identifier.accessPolicy) {
accessPolicy = {
permissions: identifier.accessPolicy.permissions
permissions: identifier.accessPolicy.permissions,
};
if (identifier.accessPolicy.expiresOn) {
accessPolicy.expiresOn = new Date(identifier.accessPolicy.expiresOn);
@@ -31374,7 +32248,7 @@ class ContainerClient extends StorageClient {
}
res.signedIdentifiers.push({
accessPolicy,
id: identifier.id
id: identifier.id,
});
}
return res;
@@ -31382,7 +32256,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31421,9 +32295,9 @@ class ContainerClient extends StorageClient {
permissions: identifier.accessPolicy.permissions,
startsOn: identifier.accessPolicy.startsOn
? truncatedISO8061Date(identifier.accessPolicy.startsOn)
: ""
: "",
},
id: identifier.id
id: identifier.id,
});
}
return await this.containerContext.setAccessPolicy(Object.assign({ abortSignal: options.abortSignal, access, containerAcl: acl, leaseAccessConditions: options.conditions, modifiedAccessConditions: options.conditions }, convertTracingToRequestOptionsBase(updatedOptions)));
@@ -31431,7 +32305,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31477,13 +32351,13 @@ class ContainerClient extends StorageClient {
const response = await blockBlobClient.upload(body, contentLength, updatedOptions);
return {
blockBlobClient,
response
response,
};
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31514,7 +32388,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31536,8 +32410,12 @@ class ContainerClient extends StorageClient {
const { span, updatedOptions } = createSpan("ContainerClient-listBlobFlatSegment", options);
try {
const response = await this.containerContext.listBlobFlatSegment(Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
response.segment.blobItems = [];
if (response.segment["Blob"] !== undefined) {
response.segment.blobItems = ProcessBlobItems(response.segment["Blob"]);
}
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListBlobFlat(response._response.parsedBody) }), segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name), tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
return blobItem;
}) }) });
return wrappedResponse;
@@ -31545,7 +32423,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31565,19 +32443,33 @@ class ContainerClient extends StorageClient {
* @param options - Options to Container List Blob Hierarchy Segment operation.
*/
async listBlobHierarchySegment(delimiter, marker, options = {}) {
var _a;
const { span, updatedOptions } = createSpan("ContainerClient-listBlobHierarchySegment", options);
try {
const response = await this.containerContext.listBlobHierarchySegment(delimiter, Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
response.segment.blobItems = [];
if (response.segment["Blob"] !== undefined) {
response.segment.blobItems = ProcessBlobItems(response.segment["Blob"]);
}
response.segment.blobPrefixes = [];
if (response.segment["BlobPrefix"] !== undefined) {
response.segment.blobPrefixes = ProcessBlobPrefixes(response.segment["BlobPrefix"]);
}
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListBlobHierarchy(response._response.parsedBody) }), segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name), tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
return blobItem;
}), blobPrefixes: (_a = response.segment.blobPrefixes) === null || _a === void 0 ? void 0 : _a.map((blobPrefixInternal) => {
const blobPrefix = {
name: BlobNameToString(blobPrefixInternal.name),
};
return blobPrefix;
}) }) });
return wrappedResponse;
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31759,7 +32651,7 @@ class ContainerClient extends StorageClient {
*/
byPage: (settings = {}) => {
return this.listSegments(settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, updatedOptions));
}
},
};
}
/**
@@ -31833,7 +32725,7 @@ class ContainerClient extends StorageClient {
* if (item.kind === "prefix") {
* console.log(`\tBlobPrefix: ${item.name}`);
* } else {
* console.log(`\tBlobItem: name - ${item.name}, last modified - ${item.properties.lastModified}`);
* console.log(`\tBlobItem: name - ${item.name}`);
* }
* }
* ```
@@ -31848,7 +32740,7 @@ class ContainerClient extends StorageClient {
* if (item.kind === "prefix") {
* console.log(`\tBlobPrefix: ${item.name}`);
* } else {
* console.log(`\tBlobItem: name - ${item.name}, last modified - ${item.properties.lastModified}`);
* console.log(`\tBlobItem: name - ${item.name}`);
* }
* entity = await iter.next();
* }
@@ -31866,7 +32758,7 @@ class ContainerClient extends StorageClient {
* }
* }
* for (const blob of response.segment.blobItems) {
* console.log(`\tBlobItem: name - ${blob.name}, last modified - ${blob.properties.lastModified}`);
* console.log(`\tBlobItem: name - ${blob.name}`);
* }
* }
* ```
@@ -31877,7 +32769,9 @@ class ContainerClient extends StorageClient {
* console.log("Listing blobs by hierarchy by page, specifying a prefix and a max page size");
*
* let i = 1;
* for await (const response of containerClient.listBlobsByHierarchy("/", { prefix: "prefix2/sub1/"}).byPage({ maxPageSize: 2 })) {
* for await (const response of containerClient
* .listBlobsByHierarchy("/", { prefix: "prefix2/sub1/" })
* .byPage({ maxPageSize: 2 })) {
* console.log(`Page ${i++}`);
* const segment = response.segment;
*
@@ -31888,7 +32782,7 @@ class ContainerClient extends StorageClient {
* }
*
* for (const blob of response.segment.blobItems) {
* console.log(`\tBlobItem: name - ${blob.name}, last modified - ${blob.properties.lastModified}`);
* console.log(`\tBlobItem: name - ${blob.name}`);
* }
* }
* ```
@@ -31955,7 +32849,208 @@ class ContainerClient extends StorageClient {
*/
byPage: (settings = {}) => {
return this.listHierarchySegments(delimiter, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, updatedOptions));
},
};
}
/**
* The Filter Blobs operation enables callers to list blobs in the container whose tags
* match a given search expression.
*
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
* The given expression must evaluate to true for a blob to be returned in the results.
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param marker - A string value that identifies the portion of
* the list of blobs to be returned with the next listing operation. The
* operation returns the continuationToken value within the response body if the
* listing operation did not return all blobs remaining to be listed
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param options - Options to find blobs by tags.
*/
async findBlobsByTagsSegment(tagFilterSqlExpression, marker, options = {}) {
const { span, updatedOptions } = createSpan("ContainerClient-findBlobsByTagsSegment", options);
try {
const response = await this.containerContext.filterBlobs(Object.assign({ abortSignal: options.abortSignal, where: tagFilterSqlExpression, marker, maxPageSize: options.maxPageSize }, convertTracingToRequestOptionsBase(updatedOptions)));
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, blobs: response.blobs.map((blob) => {
var _a;
let tagValue = "";
if (((_a = blob.tags) === null || _a === void 0 ? void 0 : _a.blobTagSet.length) === 1) {
tagValue = blob.tags.blobTagSet[0].value;
}
return Object.assign(Object.assign({}, blob), { tags: toTags(blob.tags), tagValue });
}) });
return wrappedResponse;
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message,
});
throw e;
}
finally {
span.end();
}
}
/**
* Returns an AsyncIterableIterator for ContainerFindBlobsByTagsSegmentResponse.
*
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
* The given expression must evaluate to true for a blob to be returned in the results.
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param marker - A string value that identifies the portion of
* the list of blobs to be returned with the next listing operation. The
* operation returns the continuationToken value within the response body if the
* listing operation did not return all blobs remaining to be listed
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param options - Options to find blobs by tags.
*/
findBlobsByTagsSegments(tagFilterSqlExpression, marker, options = {}) {
return tslib.__asyncGenerator(this, arguments, function* findBlobsByTagsSegments_1() {
let response;
if (!!marker || marker === undefined) {
do {
response = yield tslib.__await(this.findBlobsByTagsSegment(tagFilterSqlExpression, marker, options));
response.blobs = response.blobs || [];
marker = response.continuationToken;
yield yield tslib.__await(response);
} while (marker);
}
});
}
/**
* Returns an AsyncIterableIterator for blobs.
*
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
* The given expression must evaluate to true for a blob to be returned in the results.
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param options - Options to findBlobsByTagsItems.
*/
findBlobsByTagsItems(tagFilterSqlExpression, options = {}) {
return tslib.__asyncGenerator(this, arguments, function* findBlobsByTagsItems_1() {
var e_3, _a;
let marker;
try {
for (var _b = tslib.__asyncValues(this.findBlobsByTagsSegments(tagFilterSqlExpression, marker, options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
const segment = _c.value;
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(segment.blobs)));
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
}
finally { if (e_3) throw e_3.error; }
}
});
}
/**
* Returns an async iterable iterator to find all blobs with specified tag
* under the specified container.
*
* .byPage() returns an async iterable iterator to list the blobs in pages.
*
* Example using `for await` syntax:
*
* ```js
* let i = 1;
* for await (const blob of containerClient.findBlobsByTags("tagkey='tagvalue'")) {
* console.log(`Blob ${i++}: ${blob.name}`);
* }
* ```
*
* Example using `iter.next()`:
*
* ```js
* let i = 1;
* const iter = containerClient.findBlobsByTags("tagkey='tagvalue'");
* let blobItem = await iter.next();
* while (!blobItem.done) {
* console.log(`Blob ${i++}: ${blobItem.value.name}`);
* blobItem = await iter.next();
* }
* ```
*
* Example using `byPage()`:
*
* ```js
* // passing optional maxPageSize in the page settings
* let i = 1;
* for await (const response of containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 20 })) {
* if (response.blobs) {
* for (const blob of response.blobs) {
* console.log(`Blob ${i++}: ${blob.name}`);
* }
* }
* }
* ```
*
* Example using paging with a marker:
*
* ```js
* let i = 1;
* let iterator = containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 2 });
* let response = (await iterator.next()).value;
*
* // Prints 2 blob names
* if (response.blobs) {
* for (const blob of response.blobs) {
* console.log(`Blob ${i++}: ${blob.name}`);
* }
* }
*
* // Gets next marker
* let marker = response.continuationToken;
* // Passing next marker as continuationToken
* iterator = containerClient
* .findBlobsByTags("tagkey='tagvalue'")
* .byPage({ continuationToken: marker, maxPageSize: 10 });
* response = (await iterator.next()).value;
*
* // Prints blob names
* if (response.blobs) {
* for (const blob of response.blobs) {
* console.log(`Blob ${i++}: ${blob.name}`);
* }
* }
* ```
*
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
* The given expression must evaluate to true for a blob to be returned in the results.
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param options - Options to find blobs by tags.
*/
findBlobsByTags(tagFilterSqlExpression, options = {}) {
// AsyncIterableIterator to iterate over blobs
const listSegmentOptions = Object.assign({}, options);
const iter = this.findBlobsByTagsItems(tagFilterSqlExpression, listSegmentOptions);
return {
/**
* The next method, part of the iteration protocol
*/
next() {
return iter.next();
},
/**
* The connection to the async iterator, part of the iteration protocol
*/
[Symbol.asyncIterator]() {
return this;
},
/**
* Return an AsyncIterableIterator that works a page at a time
*/
byPage: (settings = {}) => {
return this.findBlobsByTagsSegments(tagFilterSqlExpression, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions));
},
};
}
getContainerNameFromUrl() {
@@ -32088,6 +33183,10 @@ class AccountSASPermissions {
* Permission to set immutability policy.
*/
this.setImmutabilityPolicy = false;
/**
* Specifies that Permanent Delete is permitted.
*/
this.permanentDelete = false;
}
/**
* Parse initializes the AccountSASPermissions fields from a string.
@@ -32134,6 +33233,9 @@ class AccountSASPermissions {
case "i":
accountSASPermissions.setImmutabilityPolicy = true;
break;
case "y":
accountSASPermissions.permanentDelete = true;
break;
default:
throw new RangeError(`Invalid permission character: ${c}`);
}
@@ -32184,6 +33286,9 @@ class AccountSASPermissions {
if (permissionLike.setImmutabilityPolicy) {
accountSASPermissions.setImmutabilityPolicy = true;
}
if (permissionLike.permanentDelete) {
accountSASPermissions.permanentDelete = true;
}
return accountSASPermissions;
}
/**
@@ -32237,6 +33342,9 @@ class AccountSASPermissions {
if (this.setImmutabilityPolicy) {
permissions.push("i");
}
if (this.permanentDelete) {
permissions.push("y");
}
return permissions.join("");
}
}
@@ -32419,6 +33527,11 @@ function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyC
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission.");
}
if (accountSASSignatureValues.permissions &&
accountSASSignatureValues.permissions.permanentDelete &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'y' permission.");
}
if (accountSASSignatureValues.permissions &&
accountSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
@@ -32429,25 +33542,48 @@ function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyC
version < "2019-12-12") {
throw RangeError("'version' must be >= '2019-12-12' when provided 'f' permission.");
}
if (accountSASSignatureValues.encryptionScope && version < "2020-12-06") {
throw RangeError("'version' must be >= '2020-12-06' when provided 'encryptionScope' in SAS.");
}
const parsedPermissions = AccountSASPermissions.parse(accountSASSignatureValues.permissions.toString());
const parsedServices = AccountSASServices.parse(accountSASSignatureValues.services).toString();
const parsedResourceTypes = AccountSASResourceTypes.parse(accountSASSignatureValues.resourceTypes).toString();
const stringToSign = [
sharedKeyCredential.accountName,
parsedPermissions,
parsedServices,
parsedResourceTypes,
accountSASSignatureValues.startsOn
? truncatedISO8061Date(accountSASSignatureValues.startsOn, false)
: "",
truncatedISO8061Date(accountSASSignatureValues.expiresOn, false),
accountSASSignatureValues.ipRange ? ipRangeToString(accountSASSignatureValues.ipRange) : "",
accountSASSignatureValues.protocol ? accountSASSignatureValues.protocol : "",
version,
"" // Account SAS requires an additional newline character
].join("\n");
let stringToSign;
if (version >= "2020-12-06") {
stringToSign = [
sharedKeyCredential.accountName,
parsedPermissions,
parsedServices,
parsedResourceTypes,
accountSASSignatureValues.startsOn
? truncatedISO8061Date(accountSASSignatureValues.startsOn, false)
: "",
truncatedISO8061Date(accountSASSignatureValues.expiresOn, false),
accountSASSignatureValues.ipRange ? ipRangeToString(accountSASSignatureValues.ipRange) : "",
accountSASSignatureValues.protocol ? accountSASSignatureValues.protocol : "",
version,
accountSASSignatureValues.encryptionScope ? accountSASSignatureValues.encryptionScope : "",
"", // Account SAS requires an additional newline character
].join("\n");
}
else {
stringToSign = [
sharedKeyCredential.accountName,
parsedPermissions,
parsedServices,
parsedResourceTypes,
accountSASSignatureValues.startsOn
? truncatedISO8061Date(accountSASSignatureValues.startsOn, false)
: "",
truncatedISO8061Date(accountSASSignatureValues.expiresOn, false),
accountSASSignatureValues.ipRange ? ipRangeToString(accountSASSignatureValues.ipRange) : "",
accountSASSignatureValues.protocol ? accountSASSignatureValues.protocol : "",
version,
"", // Account SAS requires an additional newline character
].join("\n");
}
const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(version, signature, parsedPermissions.toString(), parsedServices, parsedResourceTypes, accountSASSignatureValues.protocol, accountSASSignatureValues.startsOn, accountSASSignatureValues.expiresOn, accountSASSignatureValues.ipRange);
return new SASQueryParameters(version, signature, parsedPermissions.toString(), parsedServices, parsedResourceTypes, accountSASSignatureValues.protocol, accountSASSignatureValues.startsOn, accountSASSignatureValues.expiresOn, accountSASSignatureValues.ipRange, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, accountSASSignatureValues.encryptionScope);
}
/**
@@ -32494,12 +33630,17 @@ class BlobServiceClient extends StorageClient {
options = options || {};
const extractedCreds = extractConnectionStringParts(connectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
const pipeline = newPipeline(sharedKeyCredential, options);
return new BlobServiceClient(extractedCreds.url, pipeline);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
const pipeline = newPipeline(new AnonymousCredential(), options);
@@ -32538,13 +33679,13 @@ class BlobServiceClient extends StorageClient {
const containerCreateResponse = await containerClient.create(updatedOptions);
return {
containerClient,
containerCreateResponse
containerCreateResponse,
};
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32568,7 +33709,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32598,7 +33739,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32628,7 +33769,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32652,7 +33793,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32677,7 +33818,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32702,7 +33843,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32728,7 +33869,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32758,7 +33899,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32801,7 +33942,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32967,7 +34108,7 @@ class BlobServiceClient extends StorageClient {
*/
byPage: (settings = {}) => {
return this.findBlobsByTagsSegments(tagFilterSqlExpression, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions));
}
},
};
}
/**
@@ -33105,6 +34246,9 @@ class BlobServiceClient extends StorageClient {
if (options.includeMetadata) {
include.push("metadata");
}
if (options.includeSystem) {
include.push("system");
}
// AsyncIterableIterator to iterate over containers
const listSegmentOptions = Object.assign(Object.assign({}, options), (include.length > 0 ? { include } : {}));
const iter = this.listItems(listSegmentOptions);
@@ -33126,7 +34270,7 @@ class BlobServiceClient extends StorageClient {
*/
byPage: (settings = {}) => {
return this.listSegments(settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions));
}
},
};
}
/**
@@ -33145,7 +34289,7 @@ class BlobServiceClient extends StorageClient {
try {
const response = await this.serviceContext.getUserDelegationKey({
startsOn: truncatedISO8061Date(startsOn, false),
expiresOn: truncatedISO8061Date(expiresOn, false)
expiresOn: truncatedISO8061Date(expiresOn, false),
}, Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
const userDelegationKey = {
signedObjectId: response.signedObjectId,
@@ -33154,7 +34298,7 @@ class BlobServiceClient extends StorageClient {
signedExpiresOn: new Date(response.signedExpiresOn),
signedService: response.signedService,
signedVersion: response.signedVersion,
value: response.value
value: response.value,
};
const res = Object.assign({ _response: response._response, requestId: response.requestId, clientRequestId: response.clientRequestId, version: response.version, date: response.date, errorCode: response.errorCode }, userDelegationKey);
return res;
@@ -33162,7 +34306,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -33211,39 +34355,27 @@ class BlobServiceClient extends StorageClient {
Object.defineProperty(exports, 'BaseRequestPolicy', {
enumerable: true,
get: function () {
return coreHttp.BaseRequestPolicy;
}
get: function () { return coreHttp.BaseRequestPolicy; }
});
Object.defineProperty(exports, 'HttpHeaders', {
enumerable: true,
get: function () {
return coreHttp.HttpHeaders;
}
get: function () { return coreHttp.HttpHeaders; }
});
Object.defineProperty(exports, 'RequestPolicyOptions', {
enumerable: true,
get: function () {
return coreHttp.RequestPolicyOptions;
}
get: function () { return coreHttp.RequestPolicyOptions; }
});
Object.defineProperty(exports, 'RestError', {
enumerable: true,
get: function () {
return coreHttp.RestError;
}
get: function () { return coreHttp.RestError; }
});
Object.defineProperty(exports, 'WebResource', {
enumerable: true,
get: function () {
return coreHttp.WebResource;
}
get: function () { return coreHttp.WebResource; }
});
Object.defineProperty(exports, 'deserializationPolicy', {
enumerable: true,
get: function () {
return coreHttp.deserializationPolicy;
}
get: function () { return coreHttp.deserializationPolicy; }
});
exports.AccountSASPermissions = AccountSASPermissions;
exports.AccountSASResourceTypes = AccountSASResourceTypes;
@@ -35988,9 +37120,9 @@ function extractTar(archivePath, compressionMethod) {
function getCompressionProgram() {
switch (compressionMethod) {
case constants_1.CompressionMethod.Zstd:
return ['--use-compress-program', 'zstd -d --fast=1 --long=30'];
return ['--use-compress-program', 'zstd -d --long=30'];
case constants_1.CompressionMethod.ZstdWithoutLong:
return ['--use-compress-program', 'zstd -d --fast=1'];
return ['--use-compress-program', 'zstd -d'];
default:
return ['-z'];
}
@@ -36021,9 +37153,9 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
function getCompressionProgram() {
switch (compressionMethod) {
case constants_1.CompressionMethod.Zstd:
return ['--use-compress-program', 'zstd -T0 --fast=1 --long=30'];
return ['--use-compress-program', 'zstd -T0 --long=30'];
case constants_1.CompressionMethod.ZstdWithoutLong:
return ['--use-compress-program', 'zstd -T0 --fast=1'];
return ['--use-compress-program', 'zstd -T0'];
default:
return ['-z'];
}
@@ -36052,9 +37184,9 @@ function listTar(archivePath, compressionMethod) {
function getCompressionProgram() {
switch (compressionMethod) {
case constants_1.CompressionMethod.Zstd:
return ['--use-compress-program', 'zstd -d --fast=1 --long=30'];
return ['--use-compress-program', 'zstd -d --long=30'];
case constants_1.CompressionMethod.ZstdWithoutLong:
return ['--use-compress-program', 'zstd -d --fast=1'];
return ['--use-compress-program', 'zstd -d'];
default:
return ['-z'];
}
@@ -36296,7 +37428,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0;
exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0;
const cache = __importStar(__webpack_require__(692));
const core = __importStar(__webpack_require__(470));
const constants_1 = __webpack_require__(196);
function isGhes() {
@@ -36361,6 +37494,19 @@ function getInputAsInt(name, options) {
return value;
}
exports.getInputAsInt = getInputAsInt;
function isCacheFeatureAvailable() {
if (!cache.isFeatureAvailable()) {
if (isGhes()) {
logWarning("Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.");
}
else {
logWarning("An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.");
}
return false;
}
return true;
}
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
/***/ }),
@@ -45225,6 +46371,15 @@ function checkKey(key) {
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
}
}
/**
* isFeatureAvailable to check the presence of Actions cache service
*
* @returns boolean return true if Actions cache service feature is available, otherwise false
*/
function isFeatureAvailable() {
return !!process.env['ACTIONS_CACHE_URL'];
}
exports.isFeatureAvailable = isFeatureAvailable;
/**
* Restores cache from keys
*
@@ -45291,18 +46446,12 @@ exports.restoreCache = restoreCache;
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
*/
function saveCache(paths, key, options) {
var _a, _b, _c, _d, _e;
return __awaiter(this, void 0, void 0, function* () {
checkPaths(paths);
checkKey(key);
const compressionMethod = yield utils.getCompressionMethod();
core.debug('Reserving Cache');
const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
compressionMethod
});
if (cacheId === -1) {
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
}
core.debug(`Cache ID: ${cacheId}`);
let cacheId = null;
const cachePaths = yield utils.resolvePaths(paths);
core.debug('Cache Paths:');
core.debug(`${JSON.stringify(cachePaths)}`);
@@ -45317,9 +46466,24 @@ function saveCache(paths, key, options) {
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core.debug(`File Size: ${archiveFileSize}`);
if (archiveFileSize > fileSizeLimit) {
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
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');
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
compressionMethod,
cacheSize: archiveFileSize
});
if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
}
else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
}
else {
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})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
}
@@ -46753,8 +47917,7 @@ const utils = __importStar(__webpack_require__(443));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
if (utils.isGhes()) {
utils.logWarning("Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details");
if (!utils.isCacheFeatureAvailable()) {
utils.setCacheHitOutput(false);
return;
}
@@ -49578,7 +50741,6 @@ class Poller {
});
}
/**
* @internal
* Starts a loop that will break only if the poller is done
* or if the poller is stopped.
*/
@@ -49592,7 +50754,6 @@ class Poller {
}
}
/**
* @internal
* pollOnce does one polling, by calling to the update method of the underlying
* poll operation to make any relevant change effective.
*
@@ -49626,7 +50787,6 @@ class Poller {
}
}
/**
* @internal
* fireProgress calls the functions passed in via onProgress the method of the poller.
*
* It loops over all of the callbacks received from onProgress, and executes them, sending them
@@ -49640,7 +50800,6 @@ class Poller {
}
}
/**
* @internal
* Invokes the underlying operation's cancel method, and rejects the
* pollUntilDone promise.
*/
@@ -49814,7 +50973,7 @@ class Poller {
*/
function getPollingUrl(rawResponse, defaultPath) {
var _a, _b, _c;
return ((_c = (_b = (_a = getAzureAsyncOperation(rawResponse)) !== null && _a !== void 0 ? _a : getLocation(rawResponse)) !== null && _b !== void 0 ? _b : getOperationLocation(rawResponse)) !== null && _c !== void 0 ? _c : defaultPath);
return ((_c = (_b = (_a = getAzureAsyncOperation(rawResponse)) !== null && _a !== void 0 ? _a : getOperationLocation(rawResponse)) !== null && _b !== void 0 ? _b : getLocation(rawResponse)) !== null && _c !== void 0 ? _c : defaultPath);
}
function getLocation(rawResponse) {
return rawResponse.headers["location"];
@@ -49825,19 +50984,29 @@ function getOperationLocation(rawResponse) {
function getAzureAsyncOperation(rawResponse) {
return rawResponse.headers["azure-asyncoperation"];
}
function findResourceLocation(requestMethod, rawResponse, requestPath) {
switch (requestMethod) {
case "PUT": {
return requestPath;
}
case "POST":
case "PATCH": {
return getLocation(rawResponse);
}
default: {
return undefined;
}
}
}
function inferLroMode(requestPath, requestMethod, rawResponse) {
if (getAzureAsyncOperation(rawResponse) !== undefined) {
if (getAzureAsyncOperation(rawResponse) !== undefined ||
getOperationLocation(rawResponse) !== undefined) {
return {
mode: "AzureAsync",
resourceLocation: requestMethod === "PUT"
? requestPath
: requestMethod === "POST" || requestMethod === "PATCH"
? getLocation(rawResponse)
: undefined,
mode: "Location",
resourceLocation: findResourceLocation(requestMethod, rawResponse, requestPath),
};
}
else if (getLocation(rawResponse) !== undefined ||
getOperationLocation(rawResponse) !== undefined) {
else if (getLocation(rawResponse) !== undefined) {
return {
mode: "Location",
};
@@ -49907,13 +51076,13 @@ function processBodyPollingOperationResult(response) {
const logger = logger$1.createClientLogger("core-lro");
// Copyright (c) Microsoft Corporation.
function getResponseStatus(rawResponse) {
function isPollingDone(rawResponse) {
var _a;
if (isUnexpectedPollingResponse(rawResponse) || rawResponse.statusCode === 202) {
return false;
}
const { status } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
return typeof status === "string" ? status.toLowerCase() : "succeeded";
}
function isAzureAsyncPollingDone(rawResponse) {
const state = getResponseStatus(rawResponse);
const state = typeof status === "string" ? status.toLowerCase() : "succeeded";
if (isUnexpectedPollingResponse(rawResponse) || failureStates.includes(state)) {
throw new Error(`The long running operation has failed. The provisioning state: ${state}.`);
}
@@ -49933,9 +51102,9 @@ async function sendFinalRequest(lro, resourceLocation, lroResourceLocationConfig
return lro.sendPollRequest(resourceLocation !== null && resourceLocation !== void 0 ? resourceLocation : lro.requestPath);
}
}
function processAzureAsyncOperationResult(lro, resourceLocation, lroResourceLocationConfig) {
function processLocationPollingOperationResult(lro, resourceLocation, lroResourceLocationConfig) {
return (response) => {
if (isAzureAsyncPollingDone(response.rawResponse)) {
if (isPollingDone(response.rawResponse)) {
if (resourceLocation === undefined) {
return Object.assign(Object.assign({}, response), { done: true });
}
@@ -49950,14 +51119,6 @@ function processAzureAsyncOperationResult(lro, resourceLocation, lroResourceLoca
};
}
// Copyright (c) Microsoft Corporation.
function isLocationPollingDone(rawResponse) {
return !isUnexpectedPollingResponse(rawResponse) && rawResponse.statusCode !== 202;
}
function processLocationPollingOperationResult(response) {
return Object.assign(Object.assign({}, response), { done: isLocationPollingDone(response.rawResponse) });
}
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
function processPassthroughOperationResult(response) {
@@ -49970,11 +51131,8 @@ function processPassthroughOperationResult(response) {
*/
function createGetLroStatusFromResponse(lroPrimitives, config, lroResourceLocationConfig) {
switch (config.mode) {
case "AzureAsync": {
return processAzureAsyncOperationResult(lroPrimitives, config.resourceLocation, lroResourceLocationConfig);
}
case "Location": {
return processLocationPollingOperationResult;
return processLocationPollingOperationResult(lroPrimitives, config.resourceLocation, lroResourceLocationConfig);
}
case "Body": {
return processBodyPollingOperationResult;
@@ -50424,7 +51582,8 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
return {
statusCode: error.statusCode,
result: null,
headers: {}
headers: {},
error
};
}
else {
+1701 -542
View File
@@ -1199,6 +1199,11 @@ function assertDefined(name, value) {
return value;
}
exports.assertDefined = assertDefined;
function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
}
exports.isGhes = isGhes;
//# sourceMappingURL=cacheUtils.js.map
/***/ }),
@@ -3192,10 +3197,7 @@ const options_1 = __webpack_require__(538);
const requestUtils_1 = __webpack_require__(899);
const versionSalt = '1.0';
function getCacheApiUrl(resource) {
// Ideally we just use ACTIONS_CACHE_URL
const baseUrl = (process.env['ACTIONS_CACHE_URL'] ||
process.env['ACTIONS_RUNTIME_URL'] ||
'').replace('pipelines', 'artifactcache');
const baseUrl = process.env['ACTIONS_CACHE_URL'] || '';
if (!baseUrl) {
throw new Error('Cache Service Url not found, unable to restore cache.');
}
@@ -3273,18 +3275,18 @@ function downloadCache(archiveLocation, archivePath, options) {
exports.downloadCache = downloadCache;
// Reserve Cache
function reserveCache(key, paths, options) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
const httpClient = createHttpClient();
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
const reserveCacheRequest = {
key,
version
version,
cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
};
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
}));
return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1;
return response;
});
}
exports.reserveCache = reserveCache;
@@ -5490,7 +5492,8 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
//
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
// on 64-bit systems), split the download into multiple segments
const maxSegmentSize = buffer.constants.MAX_LENGTH;
// ~2 GB = 2147483647, beyond this, we start getting out of range error. So, capping it accordingly.
const maxSegmentSize = Math.min(2147483647, buffer.constants.MAX_LENGTH);
const downloadProgress = new DownloadProgress(contentLength);
const fd = fs.openSync(archivePath, 'w');
try {
@@ -9647,6 +9650,29 @@ var events = __webpack_require__(614);
var fs = __webpack_require__(747);
var util = __webpack_require__(669);
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var coreHttp__namespace = /*#__PURE__*/_interopNamespace(coreHttp);
var os__namespace = /*#__PURE__*/_interopNamespace(os);
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
var util__namespace = /*#__PURE__*/_interopNamespace(util);
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
@@ -10601,10 +10627,10 @@ const BlobItemInternal = {
modelProperties: {
name: {
serializedName: "Name",
required: true,
xmlName: "Name",
type: {
name: "String"
name: "Composite",
className: "BlobName"
}
},
deleted: {
@@ -10679,6 +10705,30 @@ const BlobItemInternal = {
}
}
};
const BlobName = {
serializedName: "BlobName",
type: {
name: "Composite",
className: "BlobName",
modelProperties: {
encoded: {
serializedName: "Encoded",
xmlName: "Encoded",
xmlIsAttribute: true,
type: {
name: "Boolean"
}
},
content: {
serializedName: "content",
xmlName: "content",
type: {
name: "String"
}
}
}
}
};
const BlobPropertiesInternal = {
serializedName: "BlobPropertiesInternal",
xmlName: "Properties",
@@ -11122,10 +11172,10 @@ const BlobPrefix = {
modelProperties: {
name: {
serializedName: "Name",
required: true,
xmlName: "Name",
type: {
name: "String"
name: "Composite",
className: "BlobName"
}
}
}
@@ -12748,6 +12798,59 @@ const ContainerSubmitBatchExceptionHeaders = {
}
}
};
const ContainerFilterBlobsHeaders = {
serializedName: "Container_filterBlobsHeaders",
type: {
name: "Composite",
className: "ContainerFilterBlobsHeaders",
modelProperties: {
clientRequestId: {
serializedName: "x-ms-client-request-id",
xmlName: "x-ms-client-request-id",
type: {
name: "String"
}
},
requestId: {
serializedName: "x-ms-request-id",
xmlName: "x-ms-request-id",
type: {
name: "String"
}
},
version: {
serializedName: "x-ms-version",
xmlName: "x-ms-version",
type: {
name: "String"
}
},
date: {
serializedName: "date",
xmlName: "date",
type: {
name: "DateTimeRfc1123"
}
}
}
}
};
const ContainerFilterBlobsExceptionHeaders = {
serializedName: "Container_filterBlobsExceptionHeaders",
type: {
name: "Composite",
className: "ContainerFilterBlobsExceptionHeaders",
modelProperties: {
errorCode: {
serializedName: "x-ms-error-code",
xmlName: "x-ms-error-code",
type: {
name: "String"
}
}
}
}
};
const ContainerAcquireLeaseHeaders = {
serializedName: "Container_acquireLeaseHeaders",
type: {
@@ -15256,6 +15359,13 @@ const BlobCopyFromURLHeaders = {
name: "ByteArray"
}
},
encryptionScope: {
serializedName: "x-ms-encryption-scope",
xmlName: "x-ms-encryption-scope",
type: {
name: "String"
}
},
errorCode: {
serializedName: "x-ms-error-code",
xmlName: "x-ms-error-code",
@@ -17773,6 +17883,7 @@ var Mappers = /*#__PURE__*/Object.freeze({
ListBlobsFlatSegmentResponse: ListBlobsFlatSegmentResponse,
BlobFlatListSegment: BlobFlatListSegment,
BlobItemInternal: BlobItemInternal,
BlobName: BlobName,
BlobPropertiesInternal: BlobPropertiesInternal,
ListBlobsHierarchySegmentResponse: ListBlobsHierarchySegmentResponse,
BlobHierarchyListSegment: BlobHierarchyListSegment,
@@ -17824,6 +17935,8 @@ var Mappers = /*#__PURE__*/Object.freeze({
ContainerRenameExceptionHeaders: ContainerRenameExceptionHeaders,
ContainerSubmitBatchHeaders: ContainerSubmitBatchHeaders,
ContainerSubmitBatchExceptionHeaders: ContainerSubmitBatchExceptionHeaders,
ContainerFilterBlobsHeaders: ContainerFilterBlobsHeaders,
ContainerFilterBlobsExceptionHeaders: ContainerFilterBlobsExceptionHeaders,
ContainerAcquireLeaseHeaders: ContainerAcquireLeaseHeaders,
ContainerAcquireLeaseExceptionHeaders: ContainerAcquireLeaseExceptionHeaders,
ContainerReleaseLeaseHeaders: ContainerReleaseLeaseHeaders,
@@ -18011,7 +18124,7 @@ const timeoutInSeconds = {
const version = {
parameterPath: "version",
mapper: {
defaultValue: "2020-10-02",
defaultValue: "2021-04-10",
isConstant: true,
serializedName: "x-ms-version",
type: {
@@ -18106,7 +18219,7 @@ const include = {
element: {
type: {
name: "Enum",
allowedValues: ["metadata", "deleted"]
allowedValues: ["metadata", "deleted", "system"]
}
}
}
@@ -18628,11 +18741,10 @@ const encryptionKeySha256 = {
}
};
const encryptionAlgorithm = {
parameterPath: ["options", "encryptionAlgorithm"],
parameterPath: ["options", "cpkInfo", "encryptionAlgorithm"],
mapper: {
defaultValue: "AES256",
isConstant: true,
serializedName: "x-ms-encryption-algorithm",
xmlName: "x-ms-encryption-algorithm",
type: {
name: "String"
}
@@ -19549,7 +19661,7 @@ class Service {
setProperties(blobServiceProperties, options) {
const operationArguments = {
blobServiceProperties,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setPropertiesOperationSpec);
}
@@ -19560,9 +19672,9 @@ class Service {
*/
getProperties(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec);
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec$2);
}
/**
* Retrieves statistics related to replication for the Blob service. It is only available on the
@@ -19572,7 +19684,7 @@ class Service {
*/
getStatistics(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getStatisticsOperationSpec);
}
@@ -19582,7 +19694,7 @@ class Service {
*/
listContainersSegment(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, listContainersSegmentOperationSpec);
}
@@ -19595,7 +19707,7 @@ class Service {
getUserDelegationKey(keyInfo, options) {
const operationArguments = {
keyInfo,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getUserDelegationKeyOperationSpec);
}
@@ -19605,9 +19717,9 @@ class Service {
*/
getAccountInfo(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getAccountInfoOperationSpec);
return this.client.sendOperationRequest(operationArguments, getAccountInfoOperationSpec$2);
}
/**
* The Batch operation allows multiple API calls to be embedded into a single HTTP request.
@@ -19622,9 +19734,9 @@ class Service {
contentLength,
multipartContentType,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, submitBatchOperationSpec);
return this.client.sendOperationRequest(operationArguments, submitBatchOperationSpec$1);
}
/**
* The Filter Blobs operation enables callers to list blobs across all containers whose tags match a
@@ -19634,13 +19746,13 @@ class Service {
*/
filterBlobs(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, filterBlobsOperationSpec);
return this.client.sendOperationRequest(operationArguments, filterBlobsOperationSpec$1);
}
}
// Operation Specifications
const xmlSerializer = new coreHttp.Serializer(Mappers, /* isXml */ true);
const xmlSerializer$5 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const setPropertiesOperationSpec = {
path: "/",
httpMethod: "PUT",
@@ -19669,9 +19781,9 @@ const setPropertiesOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const getPropertiesOperationSpec = {
const getPropertiesOperationSpec$2 = {
path: "/",
httpMethod: "GET",
responses: {
@@ -19696,7 +19808,7 @@ const getPropertiesOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const getStatisticsOperationSpec = {
path: "/",
@@ -19723,7 +19835,7 @@ const getStatisticsOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const listContainersSegmentOperationSpec = {
path: "/",
@@ -19753,7 +19865,7 @@ const listContainersSegmentOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const getUserDelegationKeyOperationSpec = {
path: "/",
@@ -19784,9 +19896,9 @@ const getUserDelegationKeyOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const getAccountInfoOperationSpec = {
const getAccountInfoOperationSpec$2 = {
path: "/",
httpMethod: "GET",
responses: {
@@ -19802,9 +19914,9 @@ const getAccountInfoOperationSpec = {
urlParameters: [url],
headerParameters: [version, accept1],
isXML: true,
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const submitBatchOperationSpec = {
const submitBatchOperationSpec$1 = {
path: "/",
httpMethod: "POST",
responses: {
@@ -19834,9 +19946,9 @@ const submitBatchOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer
serializer: xmlSerializer$5
};
const filterBlobsOperationSpec = {
const filterBlobsOperationSpec$1 = {
path: "/",
httpMethod: "GET",
responses: {
@@ -19863,7 +19975,7 @@ const filterBlobsOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer
serializer: xmlSerializer$5
};
/*
@@ -19889,9 +20001,9 @@ class Container {
*/
create(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, createOperationSpec);
return this.client.sendOperationRequest(operationArguments, createOperationSpec$2);
}
/**
* returns all user-defined metadata and system properties for the specified container. The data
@@ -19900,7 +20012,7 @@ class Container {
*/
getProperties(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec$1);
}
@@ -19911,9 +20023,9 @@ class Container {
*/
delete(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec);
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec$1);
}
/**
* operation sets one or more user-defined name-value pairs for the specified container.
@@ -19921,9 +20033,9 @@ class Container {
*/
setMetadata(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setMetadataOperationSpec);
return this.client.sendOperationRequest(operationArguments, setMetadataOperationSpec$1);
}
/**
* gets the permissions for the specified container. The permissions indicate whether container data
@@ -19932,7 +20044,7 @@ class Container {
*/
getAccessPolicy(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getAccessPolicyOperationSpec);
}
@@ -19943,7 +20055,7 @@ class Container {
*/
setAccessPolicy(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setAccessPolicyOperationSpec);
}
@@ -19953,7 +20065,7 @@ class Container {
*/
restore(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, restoreOperationSpec);
}
@@ -19965,7 +20077,7 @@ class Container {
rename(sourceContainerName, options) {
const operationArguments = {
sourceContainerName,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, renameOperationSpec);
}
@@ -19982,9 +20094,20 @@ class Container {
contentLength,
multipartContentType,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, submitBatchOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, submitBatchOperationSpec);
}
/**
* The Filter Blobs operation enables callers to list blobs in a container whose tags match a given
* search expression. Filter blobs searches within the given container.
* @param options The options parameters.
*/
filterBlobs(options) {
const operationArguments = {
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, filterBlobsOperationSpec);
}
/**
* [Update] establishes and manages a lock on a container for delete operations. The lock duration can
@@ -19993,9 +20116,9 @@ class Container {
*/
acquireLease(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, acquireLeaseOperationSpec);
return this.client.sendOperationRequest(operationArguments, acquireLeaseOperationSpec$1);
}
/**
* [Update] establishes and manages a lock on a container for delete operations. The lock duration can
@@ -20006,9 +20129,9 @@ class Container {
releaseLease(leaseId, options) {
const operationArguments = {
leaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, releaseLeaseOperationSpec);
return this.client.sendOperationRequest(operationArguments, releaseLeaseOperationSpec$1);
}
/**
* [Update] establishes and manages a lock on a container for delete operations. The lock duration can
@@ -20019,9 +20142,9 @@ class Container {
renewLease(leaseId, options) {
const operationArguments = {
leaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, renewLeaseOperationSpec);
return this.client.sendOperationRequest(operationArguments, renewLeaseOperationSpec$1);
}
/**
* [Update] establishes and manages a lock on a container for delete operations. The lock duration can
@@ -20030,9 +20153,9 @@ class Container {
*/
breakLease(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, breakLeaseOperationSpec);
return this.client.sendOperationRequest(operationArguments, breakLeaseOperationSpec$1);
}
/**
* [Update] establishes and manages a lock on a container for delete operations. The lock duration can
@@ -20047,9 +20170,9 @@ class Container {
const operationArguments = {
leaseId,
proposedLeaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, changeLeaseOperationSpec);
return this.client.sendOperationRequest(operationArguments, changeLeaseOperationSpec$1);
}
/**
* [Update] The List Blobs operation returns a list of the blobs under the specified container
@@ -20057,7 +20180,7 @@ class Container {
*/
listBlobFlatSegment(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, listBlobFlatSegmentOperationSpec);
}
@@ -20072,7 +20195,7 @@ class Container {
listBlobHierarchySegment(delimiter, options) {
const operationArguments = {
delimiter,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, listBlobHierarchySegmentOperationSpec);
}
@@ -20082,14 +20205,14 @@ class Container {
*/
getAccountInfo(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getAccountInfoOperationSpec$1);
}
}
// Operation Specifications
const xmlSerializer$1 = new coreHttp.Serializer(Mappers, /* isXml */ true);
const createOperationSpec = {
const xmlSerializer$4 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const createOperationSpec$2 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20113,7 +20236,7 @@ const createOperationSpec = {
preventEncryptionScopeOverride
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const getPropertiesOperationSpec$1 = {
path: "/{containerName}",
@@ -20136,9 +20259,9 @@ const getPropertiesOperationSpec$1 = {
leaseId
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const deleteOperationSpec = {
const deleteOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "DELETE",
responses: {
@@ -20161,9 +20284,9 @@ const deleteOperationSpec = {
ifUnmodifiedSince
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const setMetadataOperationSpec = {
const setMetadataOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20190,7 +20313,7 @@ const setMetadataOperationSpec = {
ifModifiedSince
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const getAccessPolicyOperationSpec = {
path: "/{containerName}",
@@ -20229,7 +20352,7 @@ const getAccessPolicyOperationSpec = {
leaseId
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const setAccessPolicyOperationSpec = {
path: "/{containerName}",
@@ -20263,7 +20386,7 @@ const setAccessPolicyOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const restoreOperationSpec = {
path: "/{containerName}",
@@ -20291,7 +20414,7 @@ const restoreOperationSpec = {
deletedContainerVersion
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const renameOperationSpec = {
path: "/{containerName}",
@@ -20319,9 +20442,9 @@ const renameOperationSpec = {
sourceLeaseId
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const submitBatchOperationSpec$1 = {
const submitBatchOperationSpec = {
path: "/{containerName}",
httpMethod: "POST",
responses: {
@@ -20355,9 +20478,39 @@ const submitBatchOperationSpec$1 = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const acquireLeaseOperationSpec = {
const filterBlobsOperationSpec = {
path: "/{containerName}",
httpMethod: "GET",
responses: {
200: {
bodyMapper: FilterBlobSegment,
headersMapper: ContainerFilterBlobsHeaders
},
default: {
bodyMapper: StorageError,
headersMapper: ContainerFilterBlobsExceptionHeaders
}
},
queryParameters: [
timeoutInSeconds,
marker,
maxPageSize,
comp5,
where,
restype2
],
urlParameters: [url],
headerParameters: [
version,
requestId,
accept1
],
isXML: true,
serializer: xmlSerializer$4
};
const acquireLeaseOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20386,9 +20539,9 @@ const acquireLeaseOperationSpec = {
proposedLeaseId
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const releaseLeaseOperationSpec = {
const releaseLeaseOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20416,9 +20569,9 @@ const releaseLeaseOperationSpec = {
leaseId1
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const renewLeaseOperationSpec = {
const renewLeaseOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20446,9 +20599,9 @@ const renewLeaseOperationSpec = {
action2
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const breakLeaseOperationSpec = {
const breakLeaseOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20476,9 +20629,9 @@ const breakLeaseOperationSpec = {
breakPeriod
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const changeLeaseOperationSpec = {
const changeLeaseOperationSpec$1 = {
path: "/{containerName}",
httpMethod: "PUT",
responses: {
@@ -20507,7 +20660,7 @@ const changeLeaseOperationSpec = {
proposedLeaseId1
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const listBlobFlatSegmentOperationSpec = {
path: "/{containerName}",
@@ -20538,7 +20691,7 @@ const listBlobFlatSegmentOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const listBlobHierarchySegmentOperationSpec = {
path: "/{containerName}",
@@ -20570,7 +20723,7 @@ const listBlobHierarchySegmentOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
const getAccountInfoOperationSpec$1 = {
path: "/{containerName}",
@@ -20588,7 +20741,7 @@ const getAccountInfoOperationSpec$1 = {
urlParameters: [url],
headerParameters: [version, accept1],
isXML: true,
serializer: xmlSerializer$1
serializer: xmlSerializer$4
};
/*
@@ -20614,7 +20767,7 @@ class Blob$1 {
*/
download(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, downloadOperationSpec);
}
@@ -20625,9 +20778,9 @@ class Blob$1 {
*/
getProperties(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec$2);
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec);
}
/**
* If the storage account's soft delete feature is disabled then, when a blob is deleted, it is
@@ -20646,9 +20799,9 @@ class Blob$1 {
*/
delete(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec);
}
/**
* Undelete a blob that was previously soft deleted
@@ -20656,7 +20809,7 @@ class Blob$1 {
*/
undelete(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, undeleteOperationSpec);
}
@@ -20668,7 +20821,7 @@ class Blob$1 {
setExpiry(expiryOptions, options) {
const operationArguments = {
expiryOptions,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setExpiryOperationSpec);
}
@@ -20678,7 +20831,7 @@ class Blob$1 {
*/
setHttpHeaders(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setHttpHeadersOperationSpec);
}
@@ -20688,7 +20841,7 @@ class Blob$1 {
*/
setImmutabilityPolicy(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setImmutabilityPolicyOperationSpec);
}
@@ -20698,7 +20851,7 @@ class Blob$1 {
*/
deleteImmutabilityPolicy(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, deleteImmutabilityPolicyOperationSpec);
}
@@ -20710,7 +20863,7 @@ class Blob$1 {
setLegalHold(legalHold, options) {
const operationArguments = {
legalHold,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setLegalHoldOperationSpec);
}
@@ -20721,9 +20874,9 @@ class Blob$1 {
*/
setMetadata(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setMetadataOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, setMetadataOperationSpec);
}
/**
* [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
@@ -20732,9 +20885,9 @@ class Blob$1 {
*/
acquireLease(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, acquireLeaseOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, acquireLeaseOperationSpec);
}
/**
* [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
@@ -20745,9 +20898,9 @@ class Blob$1 {
releaseLease(leaseId, options) {
const operationArguments = {
leaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, releaseLeaseOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, releaseLeaseOperationSpec);
}
/**
* [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
@@ -20758,9 +20911,9 @@ class Blob$1 {
renewLease(leaseId, options) {
const operationArguments = {
leaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, renewLeaseOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, renewLeaseOperationSpec);
}
/**
* [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
@@ -20775,9 +20928,9 @@ class Blob$1 {
const operationArguments = {
leaseId,
proposedLeaseId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, changeLeaseOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, changeLeaseOperationSpec);
}
/**
* [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete
@@ -20786,9 +20939,9 @@ class Blob$1 {
*/
breakLease(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, breakLeaseOperationSpec$1);
return this.client.sendOperationRequest(operationArguments, breakLeaseOperationSpec);
}
/**
* The Create Snapshot operation creates a read-only snapshot of a blob
@@ -20796,7 +20949,7 @@ class Blob$1 {
*/
createSnapshot(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, createSnapshotOperationSpec);
}
@@ -20811,7 +20964,7 @@ class Blob$1 {
startCopyFromURL(copySource, options) {
const operationArguments = {
copySource,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, startCopyFromURLOperationSpec);
}
@@ -20827,7 +20980,7 @@ class Blob$1 {
copyFromURL(copySource, options) {
const operationArguments = {
copySource,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, copyFromURLOperationSpec);
}
@@ -20841,7 +20994,7 @@ class Blob$1 {
abortCopyFromURL(copyId, options) {
const operationArguments = {
copyId,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, abortCopyFromURLOperationSpec);
}
@@ -20857,7 +21010,7 @@ class Blob$1 {
setTier(tier, options) {
const operationArguments = {
tier,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setTierOperationSpec);
}
@@ -20867,9 +21020,9 @@ class Blob$1 {
*/
getAccountInfo(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getAccountInfoOperationSpec$2);
return this.client.sendOperationRequest(operationArguments, getAccountInfoOperationSpec);
}
/**
* The Query operation enables users to select/project on blob data by providing simple query
@@ -20878,7 +21031,7 @@ class Blob$1 {
*/
query(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, queryOperationSpec);
}
@@ -20888,7 +21041,7 @@ class Blob$1 {
*/
getTags(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getTagsOperationSpec);
}
@@ -20898,13 +21051,13 @@ class Blob$1 {
*/
setTags(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, setTagsOperationSpec);
}
}
// Operation Specifications
const xmlSerializer$2 = new coreHttp.Serializer(Mappers, /* isXml */ true);
const xmlSerializer$3 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const downloadOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "GET",
@@ -20952,9 +21105,9 @@ const downloadOperationSpec = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const getPropertiesOperationSpec$2 = {
const getPropertiesOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "HEAD",
responses: {
@@ -20987,9 +21140,9 @@ const getPropertiesOperationSpec$2 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const deleteOperationSpec$1 = {
const deleteOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "DELETE",
responses: {
@@ -21021,7 +21174,7 @@ const deleteOperationSpec$1 = {
deleteSnapshots
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const undeleteOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21043,7 +21196,7 @@ const undeleteOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setExpiryOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21067,7 +21220,7 @@ const setExpiryOperationSpec = {
expiresOn
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setHttpHeadersOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21101,7 +21254,7 @@ const setHttpHeadersOperationSpec = {
blobContentDisposition
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setImmutabilityPolicyOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21126,7 +21279,7 @@ const setImmutabilityPolicyOperationSpec = {
immutabilityPolicyMode
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const deleteImmutabilityPolicyOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21148,7 +21301,7 @@ const deleteImmutabilityPolicyOperationSpec = {
accept1
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setLegalHoldOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21171,9 +21324,9 @@ const setLegalHoldOperationSpec = {
legalHold
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setMetadataOperationSpec$1 = {
const setMetadataOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21204,9 +21357,9 @@ const setMetadataOperationSpec$1 = {
encryptionScope
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const acquireLeaseOperationSpec$1 = {
const acquireLeaseOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21234,9 +21387,9 @@ const acquireLeaseOperationSpec$1 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const releaseLeaseOperationSpec$1 = {
const releaseLeaseOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21263,9 +21416,9 @@ const releaseLeaseOperationSpec$1 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const renewLeaseOperationSpec$1 = {
const renewLeaseOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21292,9 +21445,9 @@ const renewLeaseOperationSpec$1 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const changeLeaseOperationSpec$1 = {
const changeLeaseOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21322,9 +21475,9 @@ const changeLeaseOperationSpec$1 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const breakLeaseOperationSpec$1 = {
const breakLeaseOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -21351,7 +21504,7 @@ const breakLeaseOperationSpec$1 = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const createSnapshotOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21384,7 +21537,7 @@ const createSnapshotOperationSpec = {
encryptionScope
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const startCopyFromURLOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21426,7 +21579,7 @@ const startCopyFromURLOperationSpec = {
legalHold1
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const copyFromURLOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21455,6 +21608,7 @@ const copyFromURLOperationSpec = {
ifTags,
immutabilityPolicyExpiry,
immutabilityPolicyMode,
encryptionScope,
tier,
sourceIfModifiedSince,
sourceIfUnmodifiedSince,
@@ -21468,7 +21622,7 @@ const copyFromURLOperationSpec = {
copySourceAuthorization
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const abortCopyFromURLOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21496,7 +21650,7 @@ const abortCopyFromURLOperationSpec = {
copyActionAbortConstant
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setTierOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21530,9 +21684,9 @@ const setTierOperationSpec = {
tier1
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const getAccountInfoOperationSpec$2 = {
const getAccountInfoOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "GET",
responses: {
@@ -21548,7 +21702,7 @@ const getAccountInfoOperationSpec$2 = {
urlParameters: [url],
headerParameters: [version, accept1],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const queryOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21598,7 +21752,7 @@ const queryOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const getTagsOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21628,7 +21782,7 @@ const getTagsOperationSpec = {
ifTags
],
isXML: true,
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
const setTagsOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21662,7 +21816,7 @@ const setTagsOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer$2
serializer: xmlSerializer$3
};
/*
@@ -21692,7 +21846,7 @@ class PageBlob {
const operationArguments = {
contentLength,
blobContentLength,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, createOperationSpec$1);
}
@@ -21706,7 +21860,7 @@ class PageBlob {
const operationArguments = {
contentLength,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, uploadPagesOperationSpec);
}
@@ -21718,7 +21872,7 @@ class PageBlob {
clearPages(contentLength, options) {
const operationArguments = {
contentLength,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, clearPagesOperationSpec);
}
@@ -21739,7 +21893,7 @@ class PageBlob {
sourceRange,
contentLength,
range,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, uploadPagesFromURLOperationSpec);
}
@@ -21750,7 +21904,7 @@ class PageBlob {
*/
getPageRanges(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getPageRangesOperationSpec);
}
@@ -21761,7 +21915,7 @@ class PageBlob {
*/
getPageRangesDiff(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getPageRangesDiffOperationSpec);
}
@@ -21774,7 +21928,7 @@ class PageBlob {
resize(blobContentLength, options) {
const operationArguments = {
blobContentLength,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, resizeOperationSpec);
}
@@ -21788,7 +21942,7 @@ class PageBlob {
updateSequenceNumber(sequenceNumberAction, options) {
const operationArguments = {
sequenceNumberAction,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, updateSequenceNumberOperationSpec);
}
@@ -21807,14 +21961,14 @@ class PageBlob {
copyIncremental(copySource, options) {
const operationArguments = {
copySource,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, copyIncrementalOperationSpec);
}
}
// Operation Specifications
const xmlSerializer$3 = new coreHttp.Serializer(Mappers, /* isXml */ true);
const serializer = new coreHttp.Serializer(Mappers, /* isXml */ false);
const xmlSerializer$2 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const serializer$2 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ false);
const createOperationSpec$1 = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
@@ -21861,7 +22015,7 @@ const createOperationSpec$1 = {
blobSequenceNumber
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const uploadPagesOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21903,7 +22057,7 @@ const uploadPagesOperationSpec = {
ifSequenceNumberEqualTo
],
mediaType: "binary",
serializer
serializer: serializer$2
};
const clearPagesOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21941,7 +22095,7 @@ const clearPagesOperationSpec = {
pageWrite1
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const uploadPagesFromURLOperationSpec = {
path: "/{containerName}/{blob}",
@@ -21988,7 +22142,7 @@ const uploadPagesFromURLOperationSpec = {
range1
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const getPageRangesOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22022,7 +22176,7 @@ const getPageRangesOperationSpec = {
ifTags
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const getPageRangesDiffOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22058,7 +22212,7 @@ const getPageRangesDiffOperationSpec = {
prevSnapshotUrl
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const resizeOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22091,7 +22245,7 @@ const resizeOperationSpec = {
blobContentLength
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const updateSequenceNumberOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22121,7 +22275,7 @@ const updateSequenceNumberOperationSpec = {
sequenceNumberAction
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
const copyIncrementalOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22149,7 +22303,7 @@ const copyIncrementalOperationSpec = {
copySource
],
isXML: true,
serializer: xmlSerializer$3
serializer: xmlSerializer$2
};
/*
@@ -22176,9 +22330,9 @@ class AppendBlob {
create(contentLength, options) {
const operationArguments = {
contentLength,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, createOperationSpec$2);
return this.client.sendOperationRequest(operationArguments, createOperationSpec);
}
/**
* The Append Block operation commits a new block of data to the end of an existing append blob. The
@@ -22192,7 +22346,7 @@ class AppendBlob {
const operationArguments = {
contentLength,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, appendBlockOperationSpec);
}
@@ -22209,7 +22363,7 @@ class AppendBlob {
const operationArguments = {
sourceUrl,
contentLength,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, appendBlockFromUrlOperationSpec);
}
@@ -22220,15 +22374,15 @@ class AppendBlob {
*/
seal(options) {
const operationArguments = {
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, sealOperationSpec);
}
}
// Operation Specifications
const xmlSerializer$4 = new coreHttp.Serializer(Mappers, /* isXml */ true);
const serializer$1 = new coreHttp.Serializer(Mappers, /* isXml */ false);
const createOperationSpec$2 = {
const xmlSerializer$1 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const serializer$1 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ false);
const createOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
responses: {
@@ -22271,7 +22425,7 @@ const createOperationSpec$2 = {
blobType1
],
isXML: true,
serializer: xmlSerializer$4
serializer: xmlSerializer$1
};
const appendBlockOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22355,7 +22509,7 @@ const appendBlockFromUrlOperationSpec = {
sourceRange1
],
isXML: true,
serializer: xmlSerializer$4
serializer: xmlSerializer$1
};
const sealOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22383,7 +22537,7 @@ const sealOperationSpec = {
appendPosition
],
isXML: true,
serializer: xmlSerializer$4
serializer: xmlSerializer$1
};
/*
@@ -22415,7 +22569,7 @@ class BlockBlob {
const operationArguments = {
contentLength,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, uploadOperationSpec);
}
@@ -22436,7 +22590,7 @@ class BlockBlob {
const operationArguments = {
contentLength,
copySource,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, putBlobFromUrlOperationSpec);
}
@@ -22454,7 +22608,7 @@ class BlockBlob {
blockId,
contentLength,
body,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, stageBlockOperationSpec);
}
@@ -22473,7 +22627,7 @@ class BlockBlob {
blockId,
contentLength,
sourceUrl,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, stageBlockFromURLOperationSpec);
}
@@ -22491,7 +22645,7 @@ class BlockBlob {
commitBlockList(blocks, options) {
const operationArguments = {
blocks,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, commitBlockListOperationSpec);
}
@@ -22505,14 +22659,14 @@ class BlockBlob {
getBlockList(listType, options) {
const operationArguments = {
listType,
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
};
return this.client.sendOperationRequest(operationArguments, getBlockListOperationSpec);
}
}
// Operation Specifications
const xmlSerializer$5 = new coreHttp.Serializer(Mappers, /* isXml */ true);
const serializer$2 = new coreHttp.Serializer(Mappers, /* isXml */ false);
const xmlSerializer = new coreHttp__namespace.Serializer(Mappers, /* isXml */ true);
const serializer = new coreHttp__namespace.Serializer(Mappers, /* isXml */ false);
const uploadOperationSpec = {
path: "/{containerName}/{blob}",
httpMethod: "PUT",
@@ -22560,7 +22714,7 @@ const uploadOperationSpec = {
blobType2
],
mediaType: "binary",
serializer: serializer$2
serializer
};
const putBlobFromUrlOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22613,7 +22767,7 @@ const putBlobFromUrlOperationSpec = {
copySourceBlobProperties
],
isXML: true,
serializer: xmlSerializer$5
serializer: xmlSerializer
};
const stageBlockOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22649,7 +22803,7 @@ const stageBlockOperationSpec = {
accept2
],
mediaType: "binary",
serializer: serializer$2
serializer
};
const stageBlockFromURLOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22690,7 +22844,7 @@ const stageBlockFromURLOperationSpec = {
sourceRange1
],
isXML: true,
serializer: xmlSerializer$5
serializer: xmlSerializer
};
const commitBlockListOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22740,7 +22894,7 @@ const commitBlockListOperationSpec = {
isXML: true,
contentType: "application/xml; charset=utf-8",
mediaType: "xml",
serializer: xmlSerializer$5
serializer: xmlSerializer
};
const getBlockListOperationSpec = {
path: "/{containerName}/{blob}",
@@ -22770,7 +22924,7 @@ const getBlockListOperationSpec = {
ifTags
],
isXML: true,
serializer: xmlSerializer$5
serializer: xmlSerializer
};
// Copyright (c) Microsoft Corporation.
@@ -22781,8 +22935,8 @@ const logger = logger$1.createClientLogger("storage-blob");
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
const SDK_VERSION = "12.8.0";
const SERVICE_VERSION = "2020-10-02";
const SDK_VERSION = "12.9.0";
const SERVICE_VERSION = "2021-04-10";
const BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB
const BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB
const BLOCK_BLOB_MAX_BLOCKS = 50000;
@@ -22799,15 +22953,15 @@ const URLConstants = {
SIGNATURE: "sig",
SNAPSHOT: "snapshot",
VERSIONID: "versionid",
TIMEOUT: "timeout"
}
TIMEOUT: "timeout",
},
};
const HTTPURLConnection = {
HTTP_ACCEPTED: 202,
HTTP_CONFLICT: 409,
HTTP_NOT_FOUND: 404,
HTTP_PRECON_FAILED: 412,
HTTP_RANGE_NOT_SATISFIABLE: 416
HTTP_RANGE_NOT_SATISFIABLE: 416,
};
const HeaderConstants = {
AUTHORIZATION: "Authorization",
@@ -22832,7 +22986,7 @@ const HeaderConstants = {
X_MS_COPY_SOURCE: "x-ms-copy-source",
X_MS_DATE: "x-ms-date",
X_MS_ERROR_CODE: "x-ms-error-code",
X_MS_VERSION: "x-ms-version"
X_MS_VERSION: "x-ms-version",
};
const ETagNone = "";
const ETagAny = "*";
@@ -22937,7 +23091,7 @@ const StorageBlobLoggingAllowedHeaderNames = [
"x-ms-tag-count",
"x-ms-encryption-key-sha256",
"x-ms-if-tags",
"x-ms-source-if-tags"
"x-ms-source-if-tags",
];
const StorageBlobLoggingAllowedQueryParameters = [
"comp",
@@ -22972,8 +23126,9 @@ const StorageBlobLoggingAllowedQueryParameters = [
"skt",
"sktid",
"skv",
"snapshot"
"snapshot",
];
const BlobUsesCustomerSpecifiedEncryptionMsg = "BlobUsesCustomerSpecifiedEncryption";
// Copyright (c) Microsoft Corporation.
/**
@@ -23113,7 +23268,7 @@ function extractConnectionStringParts(connectionString) {
url: blobEndpoint,
accountName,
accountKey,
proxyUri
proxyUri,
};
}
else {
@@ -23445,14 +23600,14 @@ function toBlobTags(tags) {
return undefined;
}
const res = {
blobTagSet: []
blobTagSet: [],
};
for (const key in tags) {
if (Object.prototype.hasOwnProperty.call(tags, key)) {
const value = tags[key];
res.blobTagSet.push({
key,
value
value,
});
}
}
@@ -23492,33 +23647,33 @@ function toQuerySerialization(textConfiguration) {
fieldQuote: textConfiguration.fieldQuote || "",
recordSeparator: textConfiguration.recordSeparator,
escapeChar: textConfiguration.escapeCharacter || "",
headersPresent: textConfiguration.hasHeaders || false
}
}
headersPresent: textConfiguration.hasHeaders || false,
},
},
};
case "json":
return {
format: {
type: "json",
jsonTextConfiguration: {
recordSeparator: textConfiguration.recordSeparator
}
}
recordSeparator: textConfiguration.recordSeparator,
},
},
};
case "arrow":
return {
format: {
type: "arrow",
arrowConfiguration: {
schema: textConfiguration.schema
}
}
schema: textConfiguration.schema,
},
},
};
case "parquet":
return {
format: {
type: "parquet"
}
type: "parquet",
},
};
default:
throw Error("Invalid BlobQueryTextConfiguration.");
@@ -23542,7 +23697,7 @@ function parseObjectReplicationRecord(objectReplicationRecord) {
}
const rule = {
ruleId: ids[1],
replicationStatus: objectReplicationRecord[key]
replicationStatus: objectReplicationRecord[key],
};
const policyIndex = orProperties.findIndex((policy) => policy.policyId === ids[0]);
if (policyIndex > -1) {
@@ -23551,7 +23706,7 @@ function parseObjectReplicationRecord(objectReplicationRecord) {
else {
orProperties.push({
policyId: ids[0],
rules: [rule]
rules: [rule],
});
}
}
@@ -23570,6 +23725,202 @@ function attachCredential(thing, credential) {
function httpAuthorizationToString(httpAuthorization) {
return httpAuthorization ? httpAuthorization.scheme + " " + httpAuthorization.value : undefined;
}
function BlobNameToString(name) {
if (name.encoded) {
return decodeURIComponent(name.content);
}
else {
return name.content;
}
}
function ConvertInternalResponseOfListBlobFlat(internalResponse) {
return Object.assign(Object.assign({}, internalResponse), { segment: {
blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name) });
return blobItem;
}),
} });
}
function ConvertInternalResponseOfListBlobHierarchy(internalResponse) {
var _a;
return Object.assign(Object.assign({}, internalResponse), { segment: {
blobPrefixes: (_a = internalResponse.segment.blobPrefixes) === null || _a === void 0 ? void 0 : _a.map((blobPrefixInternal) => {
const blobPrefix = {
name: BlobNameToString(blobPrefixInternal.name),
};
return blobPrefix;
}),
blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name) });
return blobItem;
}),
} });
}
function decodeBase64String(value) {
if (coreHttp.isNode) {
return Buffer.from(value, "base64");
}
else {
const byteString = atob(value);
const arr = new Uint8Array(byteString.length);
for (let i = 0; i < byteString.length; i++) {
arr[i] = byteString.charCodeAt(i);
}
return arr;
}
}
function ParseBoolean(content) {
if (content === undefined)
return undefined;
if (content === "true")
return true;
if (content === "false")
return false;
return undefined;
}
function ParseBlobName(blobNameInXML) {
if (blobNameInXML["$"] !== undefined && blobNameInXML["#"] !== undefined) {
return {
encoded: ParseBoolean(blobNameInXML["$"]["Encoded"]),
content: blobNameInXML["#"],
};
}
else {
return {
encoded: false,
content: blobNameInXML,
};
}
}
function ParseBlobItem(blobInXML) {
const blobPropertiesInXML = blobInXML["Properties"];
const blobProperties = {
createdOn: new Date(blobPropertiesInXML["Creation-Time"]),
lastModified: new Date(blobPropertiesInXML["Last-Modified"]),
etag: blobPropertiesInXML["Etag"],
contentLength: blobPropertiesInXML["Content-Length"] === undefined
? undefined
: parseFloat(blobPropertiesInXML["Content-Length"]),
contentType: blobPropertiesInXML["Content-Type"],
contentEncoding: blobPropertiesInXML["Content-Encoding"],
contentLanguage: blobPropertiesInXML["Content-Language"],
contentMD5: decodeBase64String(blobPropertiesInXML["Content-MD5"]),
contentDisposition: blobPropertiesInXML["Content-Disposition"],
cacheControl: blobPropertiesInXML["Cache-Control"],
blobSequenceNumber: blobPropertiesInXML["x-ms-blob-sequence-number"] === undefined
? undefined
: parseFloat(blobPropertiesInXML["x-ms-blob-sequence-number"]),
blobType: blobPropertiesInXML["BlobType"],
leaseStatus: blobPropertiesInXML["LeaseStatus"],
leaseState: blobPropertiesInXML["LeaseState"],
leaseDuration: blobPropertiesInXML["LeaseDuration"],
copyId: blobPropertiesInXML["CopyId"],
copyStatus: blobPropertiesInXML["CopyStatus"],
copySource: blobPropertiesInXML["CopySource"],
copyProgress: blobPropertiesInXML["CopyProgress"],
copyCompletedOn: blobPropertiesInXML["CopyCompletionTime"] === undefined
? undefined
: new Date(blobPropertiesInXML["CopyCompletionTime"]),
copyStatusDescription: blobPropertiesInXML["CopyStatusDescription"],
serverEncrypted: ParseBoolean(blobPropertiesInXML["ServerEncrypted"]),
incrementalCopy: ParseBoolean(blobPropertiesInXML["IncrementalCopy"]),
destinationSnapshot: blobPropertiesInXML["DestinationSnapshot"],
deletedOn: blobPropertiesInXML["DeletedTime"] === undefined
? undefined
: new Date(blobPropertiesInXML["DeletedTime"]),
remainingRetentionDays: blobPropertiesInXML["RemainingRetentionDays"] === undefined
? undefined
: parseFloat(blobPropertiesInXML["RemainingRetentionDays"]),
accessTier: blobPropertiesInXML["AccessTier"],
accessTierInferred: ParseBoolean(blobPropertiesInXML["AccessTierInferred"]),
archiveStatus: blobPropertiesInXML["ArchiveStatus"],
customerProvidedKeySha256: blobPropertiesInXML["CustomerProvidedKeySha256"],
encryptionScope: blobPropertiesInXML["EncryptionScope"],
accessTierChangedOn: blobPropertiesInXML["AccessTierChangeTime"] === undefined
? undefined
: new Date(blobPropertiesInXML["AccessTierChangeTime"]),
tagCount: blobPropertiesInXML["TagCount"] === undefined
? undefined
: parseFloat(blobPropertiesInXML["TagCount"]),
expiresOn: blobPropertiesInXML["Expiry-Time"] === undefined
? undefined
: new Date(blobPropertiesInXML["Expiry-Time"]),
isSealed: ParseBoolean(blobPropertiesInXML["Sealed"]),
rehydratePriority: blobPropertiesInXML["RehydratePriority"],
lastAccessedOn: blobPropertiesInXML["LastAccessTime"] === undefined
? undefined
: new Date(blobPropertiesInXML["LastAccessTime"]),
immutabilityPolicyExpiresOn: blobPropertiesInXML["ImmutabilityPolicyUntilDate"] === undefined
? undefined
: new Date(blobPropertiesInXML["ImmutabilityPolicyUntilDate"]),
immutabilityPolicyMode: blobPropertiesInXML["ImmutabilityPolicyMode"],
legalHold: ParseBoolean(blobPropertiesInXML["LegalHold"]),
};
return {
name: ParseBlobName(blobInXML["Name"]),
deleted: ParseBoolean(blobInXML["Deleted"]),
snapshot: blobInXML["Snapshot"],
versionId: blobInXML["VersionId"],
isCurrentVersion: ParseBoolean(blobInXML["IsCurrentVersion"]),
properties: blobProperties,
metadata: blobInXML["Metadata"],
blobTags: ParseBlobTags(blobInXML["Tags"]),
objectReplicationMetadata: blobInXML["OrMetadata"],
hasVersionsOnly: ParseBoolean(blobInXML["HasVersionsOnly"]),
};
}
function ParseBlobPrefix(blobPrefixInXML) {
return {
name: ParseBlobName(blobPrefixInXML["Name"]),
};
}
function ParseBlobTag(blobTagInXML) {
return {
key: blobTagInXML["Key"],
value: blobTagInXML["Value"],
};
}
function ParseBlobTags(blobTagsInXML) {
if (blobTagsInXML === undefined ||
blobTagsInXML["TagSet"] === undefined ||
blobTagsInXML["TagSet"]["Tag"] === undefined) {
return undefined;
}
const blobTagSet = [];
if (blobTagsInXML["TagSet"]["Tag"] instanceof Array) {
blobTagsInXML["TagSet"]["Tag"].forEach((blobTagInXML) => {
blobTagSet.push(ParseBlobTag(blobTagInXML));
});
}
else {
blobTagSet.push(ParseBlobTag(blobTagsInXML["TagSet"]["Tag"]));
}
return { blobTagSet: blobTagSet };
}
function ProcessBlobItems(blobArrayInXML) {
const blobItems = [];
if (blobArrayInXML instanceof Array) {
blobArrayInXML.forEach((blobInXML) => {
blobItems.push(ParseBlobItem(blobInXML));
});
}
else {
blobItems.push(ParseBlobItem(blobArrayInXML));
}
return blobItems;
}
function ProcessBlobPrefixes(blobPrefixesInXML) {
const blobPrefixes = [];
if (blobPrefixesInXML instanceof Array) {
blobPrefixesInXML.forEach((blobPrefixInXML) => {
blobPrefixes.push(ParseBlobPrefix(blobPrefixInXML));
});
}
else {
blobPrefixes.push(ParseBlobPrefix(blobPrefixesInXML));
}
return blobPrefixes;
}
// Copyright (c) Microsoft Corporation.
/**
@@ -23600,9 +23951,16 @@ class StorageBrowserPolicy extends coreHttp.BaseRequestPolicy {
* @param request -
*/
async sendRequest(request) {
{
if (coreHttp.isNode) {
return this._nextPolicy.sendRequest(request);
}
if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") {
request.url = setURLParameter(request.url, URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString());
}
request.headers.remove(HeaderConstants.COOKIE);
// According to XHR standards, content-length should be fully controlled by browsers
request.headers.remove(HeaderConstants.CONTENT_LENGTH);
return this._nextPolicy.sendRequest(request);
}
}
@@ -23623,6 +23981,10 @@ class StorageBrowserPolicyFactory {
}
// Copyright (c) Microsoft Corporation.
/**
* RetryPolicy types.
*/
exports.StorageRetryPolicyType = void 0;
(function (StorageRetryPolicyType) {
/**
* Exponential retry. Retry time delay grows exponentially.
@@ -23640,7 +24002,7 @@ const DEFAULT_RETRY_OPTIONS = {
retryDelayInMs: 4 * 1000,
retryPolicyType: exports.StorageRetryPolicyType.EXPONENTIAL,
secondaryHost: "",
tryTimeoutInMs: undefined // Use server side default timeout strategy
tryTimeoutInMs: undefined, // Use server side default timeout strategy
};
const RETRY_ABORT_ERROR = new abortController.AbortError("The operation was aborted.");
/**
@@ -23677,7 +24039,7 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
: DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs,
secondaryHost: retryOptions.secondaryHost
? retryOptions.secondaryHost
: DEFAULT_RETRY_OPTIONS.secondaryHost
: DEFAULT_RETRY_OPTIONS.secondaryHost,
};
}
/**
@@ -23754,7 +24116,7 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
"ENOTFOUND",
"TIMEOUT",
"EPIPE",
"REQUEST_SEND_ERROR" // For default xhr based http client provided in ms-rest-js
"REQUEST_SEND_ERROR", // For default xhr based http client provided in ms-rest-js
];
if (err) {
for (const retriableError of retriableErrors) {
@@ -23940,7 +24302,7 @@ class TelemetryPolicy extends coreHttp.BaseRequestPolicy {
* @param request -
*/
async sendRequest(request) {
{
if (coreHttp.isNode) {
if (!request.headers) {
request.headers = new coreHttp.HttpHeaders();
}
@@ -23963,7 +24325,7 @@ class TelemetryPolicyFactory {
*/
constructor(telemetry) {
const userAgentInfo = [];
{
if (coreHttp.isNode) {
if (telemetry) {
const telemetryString = telemetry.userAgentPrefix || "";
if (telemetryString.length > 0 && userAgentInfo.indexOf(telemetryString) === -1) {
@@ -23976,7 +24338,7 @@ class TelemetryPolicyFactory {
userAgentInfo.push(libInfo);
}
// e.g. (NODE-VERSION 4.9.1; Windows_NT 10.0.16299)
const runtimeInfo = `(NODE-VERSION ${process.version}; ${os.type()} ${os.release()})`;
const runtimeInfo = `(NODE-VERSION ${process.version}; ${os__namespace.type()} ${os__namespace.release()})`;
if (userAgentInfo.indexOf(runtimeInfo) === -1) {
userAgentInfo.push(runtimeInfo);
}
@@ -24000,6 +24362,247 @@ function getCachedDefaultHttpClient() {
return _defaultHttpClient;
}
// Copyright (c) Microsoft Corporation.
/**
* A set of constants used internally when processing requests.
*/
const Constants = {
DefaultScope: "/.default",
/**
* Defines constants for use with HTTP headers.
*/
HeaderConstants: {
/**
* The Authorization header.
*/
AUTHORIZATION: "authorization",
},
};
// Default options for the cycler if none are provided
const DEFAULT_CYCLER_OPTIONS = {
forcedRefreshWindowInMs: 1000,
retryIntervalInMs: 3000,
refreshWindowInMs: 1000 * 60 * 2, // Start refreshing 2m before expiry
};
/**
* Converts an an unreliable access token getter (which may resolve with null)
* into an AccessTokenGetter by retrying the unreliable getter in a regular
* interval.
*
* @param getAccessToken - a function that produces a promise of an access
* token that may fail by returning null
* @param retryIntervalInMs - the time (in milliseconds) to wait between retry
* attempts
* @param timeoutInMs - the timestamp after which the refresh attempt will fail,
* throwing an exception
* @returns - a promise that, if it resolves, will resolve with an access token
*/
async function beginRefresh(getAccessToken, retryIntervalInMs, timeoutInMs) {
// This wrapper handles exceptions gracefully as long as we haven't exceeded
// the timeout.
async function tryGetAccessToken() {
if (Date.now() < timeoutInMs) {
try {
return await getAccessToken();
}
catch (_a) {
return null;
}
}
else {
const finalToken = await getAccessToken();
// Timeout is up, so throw if it's still null
if (finalToken === null) {
throw new Error("Failed to refresh access token.");
}
return finalToken;
}
}
let token = await tryGetAccessToken();
while (token === null) {
await coreHttp.delay(retryIntervalInMs);
token = await tryGetAccessToken();
}
return token;
}
/**
* Creates a token cycler from a credential, scopes, and optional settings.
*
* A token cycler represents a way to reliably retrieve a valid access token
* from a TokenCredential. It will handle initializing the token, refreshing it
* when it nears expiration, and synchronizes refresh attempts to avoid
* concurrency hazards.
*
* @param credential - the underlying TokenCredential that provides the access
* token
* @param scopes - the scopes to request authorization for
* @param tokenCyclerOptions - optionally override default settings for the cycler
*
* @returns - a function that reliably produces a valid access token
*/
function createTokenCycler(credential, scopes, tokenCyclerOptions) {
let refreshWorker = null;
let token = null;
const options = Object.assign(Object.assign({}, DEFAULT_CYCLER_OPTIONS), tokenCyclerOptions);
/**
* This little holder defines several predicates that we use to construct
* the rules of refreshing the token.
*/
const cycler = {
/**
* Produces true if a refresh job is currently in progress.
*/
get isRefreshing() {
return refreshWorker !== null;
},
/**
* Produces true if the cycler SHOULD refresh (we are within the refresh
* window and not already refreshing)
*/
get shouldRefresh() {
var _a;
return (!cycler.isRefreshing &&
((_a = token === null || token === void 0 ? void 0 : token.expiresOnTimestamp) !== null && _a !== void 0 ? _a : 0) - options.refreshWindowInMs < Date.now());
},
/**
* Produces true if the cycler MUST refresh (null or nearly-expired
* token).
*/
get mustRefresh() {
return (token === null || token.expiresOnTimestamp - options.forcedRefreshWindowInMs < Date.now());
},
};
/**
* Starts a refresh job or returns the existing job if one is already
* running.
*/
function refresh(getTokenOptions) {
var _a;
if (!cycler.isRefreshing) {
// We bind `scopes` here to avoid passing it around a lot
const tryGetAccessToken = () => credential.getToken(scopes, getTokenOptions);
// Take advantage of promise chaining to insert an assignment to `token`
// before the refresh can be considered done.
refreshWorker = beginRefresh(tryGetAccessToken, options.retryIntervalInMs,
// If we don't have a token, then we should timeout immediately
(_a = token === null || token === void 0 ? void 0 : token.expiresOnTimestamp) !== null && _a !== void 0 ? _a : Date.now())
.then((_token) => {
refreshWorker = null;
token = _token;
return token;
})
.catch((reason) => {
// We also should reset the refresher if we enter a failed state. All
// existing awaiters will throw, but subsequent requests will start a
// new retry chain.
refreshWorker = null;
token = null;
throw reason;
});
}
return refreshWorker;
}
return async (tokenOptions) => {
//
// Simple rules:
// - If we MUST refresh, then return the refresh task, blocking
// the pipeline until a token is available.
// - If we SHOULD refresh, then run refresh but don't return it
// (we can still use the cached token).
// - Return the token, since it's fine if we didn't return in
// step 1.
//
if (cycler.mustRefresh)
return refresh(tokenOptions);
if (cycler.shouldRefresh) {
refresh(tokenOptions);
}
return token;
};
}
/**
* We will retrieve the challenge only if the response status code was 401,
* and if the response contained the header "WWW-Authenticate" with a non-empty value.
*/
function getChallenge(response) {
const challenge = response.headers.get("WWW-Authenticate");
if (response.status === 401 && challenge) {
return challenge;
}
return;
}
/**
* Converts: `Bearer a="b" c="d"`.
* Into: `[ { a: 'b', c: 'd' }]`.
*
* @internal
*/
function parseChallenge(challenge) {
const bearerChallenge = challenge.slice("Bearer ".length);
const challengeParts = `${bearerChallenge.trim()} `.split(" ").filter((x) => x);
const keyValuePairs = challengeParts.map((keyValue) => (([key, value]) => ({ [key]: value }))(keyValue.trim().split("=")));
// Key-value pairs to plain object:
return keyValuePairs.reduce((a, b) => (Object.assign(Object.assign({}, a), b)), {});
}
// #endregion
/**
* Creates a new factory for a RequestPolicy that applies a bearer token to
* the requests' `Authorization` headers.
*
* @param credential - The TokenCredential implementation that can supply the bearer token.
* @param scopes - The scopes for which the bearer token applies.
*/
function storageBearerTokenChallengeAuthenticationPolicy(credential, scopes) {
// This simple function encapsulates the entire process of reliably retrieving the token
let getToken = createTokenCycler(credential, scopes);
class StorageBearerTokenChallengeAuthenticationPolicy extends coreHttp.BaseRequestPolicy {
constructor(nextPolicy, options) {
super(nextPolicy, options);
}
async sendRequest(webResource) {
if (!webResource.url.toLowerCase().startsWith("https://")) {
throw new Error("Bearer token authentication is not permitted for non-TLS protected (non-https) URLs.");
}
const getTokenInternal = getToken;
const token = (await getTokenInternal({
abortSignal: webResource.abortSignal,
tracingOptions: {
tracingContext: webResource.tracingContext,
},
})).token;
webResource.headers.set(Constants.HeaderConstants.AUTHORIZATION, `Bearer ${token}`);
const response = await this._nextPolicy.sendRequest(webResource);
if ((response === null || response === void 0 ? void 0 : response.status) === 401) {
const challenge = getChallenge(response);
if (challenge) {
const challengeInfo = parseChallenge(challenge);
const challengeScopes = challengeInfo.resource_id + Constants.DefaultScope;
const parsedAuthUri = coreHttp.URLBuilder.parse(challengeInfo.authorization_uri);
const pathSegments = parsedAuthUri.getPath().split("/");
const tenantId = pathSegments[1];
const getTokenForChallenge = createTokenCycler(credential, challengeScopes);
const tokenForChallenge = (await getTokenForChallenge({
abortSignal: webResource.abortSignal,
tracingOptions: {
tracingContext: webResource.tracingContext,
},
tenantId: tenantId,
})).token;
getToken = getTokenForChallenge;
webResource.headers.set(Constants.HeaderConstants.AUTHORIZATION, `Bearer ${tokenForChallenge}`);
return this._nextPolicy.sendRequest(webResource);
}
}
return response;
}
}
return {
create: (nextPolicy, options) => {
return new StorageBearerTokenChallengeAuthenticationPolicy(nextPolicy, options);
},
};
}
// Copyright (c) Microsoft Corporation.
/**
* A helper to decide if a given argument satisfies the Pipeline contract
@@ -24045,7 +24648,7 @@ class Pipeline {
toServiceClientOptions() {
return {
httpClient: this.options.httpClient,
requestPolicyFactories: this.factories
requestPolicyFactories: this.factories,
};
}
}
@@ -24057,6 +24660,7 @@ class Pipeline {
* @returns A new Pipeline object.
*/
function newPipeline(credential, pipelineOptions = {}) {
var _a;
if (credential === undefined) {
credential = new AnonymousCredential();
}
@@ -24078,16 +24682,16 @@ function newPipeline(credential, pipelineOptions = {}) {
coreHttp.logPolicy({
logger: logger.info,
allowedHeaderNames: StorageBlobLoggingAllowedHeaderNames,
allowedQueryParameters: StorageBlobLoggingAllowedQueryParameters
})
allowedQueryParameters: StorageBlobLoggingAllowedQueryParameters,
}),
];
{
if (coreHttp.isNode) {
// policies only available in Node.js runtime, not in browsers
factories.push(coreHttp.proxyPolicy(pipelineOptions.proxyOptions));
factories.push(coreHttp.disableResponseDecompressionPolicy());
}
factories.push(coreHttp.isTokenCredential(credential)
? attachCredential(coreHttp.bearerTokenAuthenticationPolicy(credential, StorageOAuthScopes), credential)
? attachCredential(storageBearerTokenChallengeAuthenticationPolicy(credential, (_a = pipelineOptions.audience) !== null && _a !== void 0 ? _a : StorageOAuthScopes), credential)
: credential);
return new Pipeline(factories, pipelineOptions);
}
@@ -24114,7 +24718,9 @@ class StorageSharedKeyCredentialPolicy extends CredentialPolicy {
*/
signRequest(request) {
request.headers.set(HeaderConstants.X_MS_DATE, new Date().toUTCString());
if (request.body && typeof request.body === "string" && request.body.length > 0) {
if (request.body &&
(typeof request.body === "string" || request.body !== undefined) &&
request.body.length > 0) {
request.headers.set(HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body));
}
const stringToSign = [
@@ -24129,7 +24735,7 @@ class StorageSharedKeyCredentialPolicy extends CredentialPolicy {
this.getHeaderValueToSign(request, HeaderConstants.IF_MATCH),
this.getHeaderValueToSign(request, HeaderConstants.IF_NONE_MATCH),
this.getHeaderValueToSign(request, HeaderConstants.IF_UNMODIFIED_SINCE),
this.getHeaderValueToSign(request, HeaderConstants.RANGE)
this.getHeaderValueToSign(request, HeaderConstants.RANGE),
].join("\n") +
"\n" +
this.getCanonicalizedHeadersString(request) +
@@ -24258,9 +24864,7 @@ class StorageSharedKeyCredential extends Credential {
* @param stringToSign -
*/
computeHMACSHA256(stringToSign) {
return crypto.createHmac("sha256", this.accountKey)
.update(stringToSign, "utf8")
.digest("base64");
return crypto.createHmac("sha256", this.accountKey).update(stringToSign, "utf8").digest("base64");
}
}
@@ -24272,8 +24876,8 @@ class StorageSharedKeyCredential extends Credential {
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
const packageName = "azure-storage-blob";
const packageVersion = "12.8.0";
class StorageClientContext extends coreHttp.ServiceClient {
const packageVersion = "12.9.0";
class StorageClientContext extends coreHttp__namespace.ServiceClient {
/**
* Initializes a new instance of the StorageClientContext class.
* @param url The URL of the service account, container, or blob that is the target of the desired
@@ -24289,7 +24893,7 @@ class StorageClientContext extends coreHttp.ServiceClient {
options = {};
}
if (!options.userAgent) {
const defaultUserAgent = coreHttp.getDefaultUserAgentValue();
const defaultUserAgent = coreHttp__namespace.getDefaultUserAgentValue();
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
}
super(undefined, options);
@@ -24298,7 +24902,7 @@ class StorageClientContext extends coreHttp.ServiceClient {
// Parameter assignments
this.url = url;
// Assigning values to Constant parameters
this.version = options.version || "2020-10-02";
this.version = options.version || "2021-04-10";
}
}
@@ -24345,7 +24949,7 @@ class StorageClient {
*/
const createSpan = coreTracing.createSpanFunction({
packagePrefix: "Azure.Storage.Blob",
namespace: "Microsoft.Storage"
namespace: "Microsoft.Storage",
});
/**
* @internal
@@ -24359,7 +24963,7 @@ function convertTracingToRequestOptionsBase(options) {
return {
// By passing spanOptions if they exist at runtime, we're backwards compatible with @azure/core-tracing@preview.13 and earlier.
spanOptions: (_a = options === null || options === void 0 ? void 0 : options.tracingOptions) === null || _a === void 0 ? void 0 : _a.spanOptions,
tracingContext: (_b = options === null || options === void 0 ? void 0 : options.tracingOptions) === null || _b === void 0 ? void 0 : _b.tracingContext
tracingContext: (_b = options === null || options === void 0 ? void 0 : options.tracingOptions) === null || _b === void 0 ? void 0 : _b.tracingContext,
};
}
@@ -24416,6 +25020,10 @@ class BlobSASPermissions {
* Specifies SetImmutabilityPolicy access granted.
*/
this.setImmutabilityPolicy = false;
/**
* Specifies that Permanent Delete is permitted.
*/
this.permanentDelete = false;
}
/**
* Creates a {@link BlobSASPermissions} from the specified permissions string. This method will throw an
@@ -24457,6 +25065,9 @@ class BlobSASPermissions {
case "i":
blobSASPermissions.setImmutabilityPolicy = true;
break;
case "y":
blobSASPermissions.permanentDelete = true;
break;
default:
throw new RangeError(`Invalid permission: ${char}`);
}
@@ -24501,6 +25112,9 @@ class BlobSASPermissions {
if (permissionLike.setImmutabilityPolicy) {
blobSASPermissions.setImmutabilityPolicy = true;
}
if (permissionLike.permanentDelete) {
blobSASPermissions.permanentDelete = true;
}
return blobSASPermissions;
}
/**
@@ -24541,6 +25155,9 @@ class BlobSASPermissions {
if (this.setImmutabilityPolicy) {
permissions.push("i");
}
if (this.permanentDelete) {
permissions.push("y");
}
return permissions.join("");
}
}
@@ -24600,6 +25217,14 @@ class ContainerSASPermissions {
* Specifies SetImmutabilityPolicy access granted.
*/
this.setImmutabilityPolicy = false;
/**
* Specifies that Permanent Delete is permitted.
*/
this.permanentDelete = false;
/**
* Specifies that Filter Blobs by Tags is permitted.
*/
this.filterByTags = false;
}
/**
* Creates an {@link ContainerSASPermissions} from the specified permissions string. This method will throw an
@@ -24644,6 +25269,12 @@ class ContainerSASPermissions {
case "i":
containerSASPermissions.setImmutabilityPolicy = true;
break;
case "y":
containerSASPermissions.permanentDelete = true;
break;
case "f":
containerSASPermissions.filterByTags = true;
break;
default:
throw new RangeError(`Invalid permission ${char}`);
}
@@ -24691,6 +25322,12 @@ class ContainerSASPermissions {
if (permissionLike.setImmutabilityPolicy) {
containerSASPermissions.setImmutabilityPolicy = true;
}
if (permissionLike.permanentDelete) {
containerSASPermissions.permanentDelete = true;
}
if (permissionLike.filterByTags) {
containerSASPermissions.filterByTags = true;
}
return containerSASPermissions;
}
/**
@@ -24736,6 +25373,12 @@ class ContainerSASPermissions {
if (this.setImmutabilityPolicy) {
permissions.push("i");
}
if (this.permanentDelete) {
permissions.push("y");
}
if (this.filterByTags) {
permissions.push("f");
}
return permissions.join("");
}
}
@@ -24765,9 +25408,7 @@ class UserDelegationKeyCredential {
*/
computeHMACSHA256(stringToSign) {
// console.log(`stringToSign: ${JSON.stringify(stringToSign)}`);
return crypto.createHmac("sha256", this.key)
.update(stringToSign, "utf8")
.digest("base64");
return crypto.createHmac("sha256", this.key).update(stringToSign, "utf8").digest("base64");
}
}
@@ -24785,6 +25426,10 @@ function ipRangeToString(ipRange) {
}
// Copyright (c) Microsoft Corporation.
/**
* Protocols for generated SAS.
*/
exports.SASProtocol = void 0;
(function (SASProtocol) {
/**
* Protocol that allows HTTPS only
@@ -24805,7 +25450,7 @@ function ipRangeToString(ipRange) {
* NOTE: Instances of this class are immutable.
*/
class SASQueryParameters {
constructor(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, preauthorizedAgentObjectId, correlationId) {
constructor(version, signature, permissionsOrOptions, services, resourceTypes, protocol, startsOn, expiresOn, ipRange, identifier, resource, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType, userDelegationKey, preauthorizedAgentObjectId, correlationId, encryptionScope) {
this.version = version;
this.signature = signature;
if (permissionsOrOptions !== undefined && typeof permissionsOrOptions !== "string") {
@@ -24818,6 +25463,7 @@ class SASQueryParameters {
this.expiresOn = permissionsOrOptions.expiresOn;
this.ipRangeInner = permissionsOrOptions.ipRange;
this.identifier = permissionsOrOptions.identifier;
this.encryptionScope = permissionsOrOptions.encryptionScope;
this.resource = permissionsOrOptions.resource;
this.cacheControl = permissionsOrOptions.cacheControl;
this.contentDisposition = permissionsOrOptions.contentDisposition;
@@ -24843,6 +25489,7 @@ class SASQueryParameters {
this.protocol = protocol;
this.startsOn = startsOn;
this.ipRangeInner = ipRange;
this.encryptionScope = encryptionScope;
this.identifier = identifier;
this.resource = resource;
this.cacheControl = cacheControl;
@@ -24871,7 +25518,7 @@ class SASQueryParameters {
if (this.ipRangeInner) {
return {
end: this.ipRangeInner.end,
start: this.ipRangeInner.start
start: this.ipRangeInner.start,
};
}
return undefined;
@@ -24890,6 +25537,7 @@ class SASQueryParameters {
"se",
"sip",
"si",
"ses",
"skoid",
"sktid",
"skt",
@@ -24905,7 +25553,7 @@ class SASQueryParameters {
"rscl",
"rsct",
"saoid",
"scid"
"scid",
];
const queries = [];
for (const param of params) {
@@ -24934,6 +25582,9 @@ class SASQueryParameters {
case "si":
this.tryAppendQueryParameter(queries, param, this.identifier);
break;
case "ses":
this.tryAppendQueryParameter(queries, param, this.encryptionScope);
break;
case "skoid": // Signed object ID
this.tryAppendQueryParameter(queries, param, this.signedOid);
break;
@@ -25018,6 +25669,15 @@ function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredent
if (sharedKeyCredential === undefined && userDelegationKeyCredential === undefined) {
throw TypeError("Invalid sharedKeyCredential, userDelegationKey or accountName.");
}
// Version 2020-12-06 adds support for encryptionscope in SAS.
if (version >= "2020-12-06") {
if (sharedKeyCredential !== undefined) {
return generateBlobSASQueryParameters20201206(blobSASSignatureValues, sharedKeyCredential);
}
else {
return generateBlobSASQueryParametersUDK20201206(blobSASSignatureValues, userDelegationKeyCredential);
}
}
// Version 2019-12-12 adds support for the blob tags permission.
// Version 2018-11-09 adds support for the signed resource and signed blob snapshot time fields.
// https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas#constructing-the-signature-string
@@ -25099,7 +25759,7 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe
blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "",
blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "",
blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "",
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : ""
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "",
].join("\n");
const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
@@ -25168,11 +25828,81 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "",
blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "",
blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "",
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : ""
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "",
].join("\n");
const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
* IMPLEMENTATION FOR API VERSION FROM 2020-12-06.
*
* Creates an instance of SASQueryParameters.
*
* Only accepts required settings needed to create a SAS. For optional settings please
* set corresponding properties directly, such as permissions, startsOn and identifier.
*
* WARNING: When identifier is not provided, permissions and expiresOn are required.
* You MUST assign value to identifier or expiresOn & permissions manually if you initial with
* this constructor.
*
* @param blobSASSignatureValues -
* @param sharedKeyCredential -
*/
function generateBlobSASQueryParameters20201206(blobSASSignatureValues, sharedKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
if (!blobSASSignatureValues.identifier &&
!(blobSASSignatureValues.permissions && blobSASSignatureValues.expiresOn)) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when 'identifier' is not provided.");
}
let resource = "c";
let timestamp = blobSASSignatureValues.snapshotTime;
if (blobSASSignatureValues.blobName) {
resource = "b";
if (blobSASSignatureValues.snapshotTime) {
resource = "bs";
}
else if (blobSASSignatureValues.versionId) {
resource = "bv";
timestamp = blobSASSignatureValues.versionId;
}
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
let verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
else {
verifiedPermissions = ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
}
// Signature is generated on the un-url-encoded values.
const stringToSign = [
verifiedPermissions ? verifiedPermissions : "",
blobSASSignatureValues.startsOn
? truncatedISO8061Date(blobSASSignatureValues.startsOn, false)
: "",
blobSASSignatureValues.expiresOn
? truncatedISO8061Date(blobSASSignatureValues.expiresOn, false)
: "",
getCanonicalName(sharedKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName),
blobSASSignatureValues.identifier,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
blobSASSignatureValues.version,
resource,
timestamp,
blobSASSignatureValues.encryptionScope,
blobSASSignatureValues.cacheControl ? blobSASSignatureValues.cacheControl : "",
blobSASSignatureValues.contentDisposition ? blobSASSignatureValues.contentDisposition : "",
blobSASSignatureValues.contentEncoding ? blobSASSignatureValues.contentEncoding : "",
blobSASSignatureValues.contentLanguage ? blobSASSignatureValues.contentLanguage : "",
blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "",
].join("\n");
const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, undefined, undefined, undefined, blobSASSignatureValues.encryptionScope);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
* IMPLEMENTATION FOR API VERSION FROM 2018-11-09.
@@ -25244,7 +25974,7 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD
blobSASSignatureValues.contentDisposition,
blobSASSignatureValues.contentEncoding,
blobSASSignatureValues.contentLanguage,
blobSASSignatureValues.contentType
blobSASSignatureValues.contentType,
].join("\n");
const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey);
@@ -25323,11 +26053,91 @@ function generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userD
blobSASSignatureValues.contentDisposition,
blobSASSignatureValues.contentEncoding,
blobSASSignatureValues.contentLanguage,
blobSASSignatureValues.contentType
blobSASSignatureValues.contentType,
].join("\n");
const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId);
}
/**
* ONLY AVAILABLE IN NODE.JS RUNTIME.
* IMPLEMENTATION FOR API VERSION FROM 2020-12-06.
*
* Creates an instance of SASQueryParameters.
*
* Only accepts required settings needed to create a SAS. For optional settings please
* set corresponding properties directly, such as permissions, startsOn.
*
* WARNING: identifier will be ignored, permissions and expiresOn are required.
*
* @param blobSASSignatureValues -
* @param userDelegationKeyCredential -
*/
function generateBlobSASQueryParametersUDK20201206(blobSASSignatureValues, userDelegationKeyCredential) {
blobSASSignatureValues = SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues);
// Stored access policies are not supported for a user delegation SAS.
if (!blobSASSignatureValues.permissions || !blobSASSignatureValues.expiresOn) {
throw new RangeError("Must provide 'permissions' and 'expiresOn' for Blob SAS generation when generating user delegation SAS.");
}
let resource = "c";
let timestamp = blobSASSignatureValues.snapshotTime;
if (blobSASSignatureValues.blobName) {
resource = "b";
if (blobSASSignatureValues.snapshotTime) {
resource = "bs";
}
else if (blobSASSignatureValues.versionId) {
resource = "bv";
timestamp = blobSASSignatureValues.versionId;
}
}
// Calling parse and toString guarantees the proper ordering and throws on invalid characters.
let verifiedPermissions;
if (blobSASSignatureValues.permissions) {
if (blobSASSignatureValues.blobName) {
verifiedPermissions = BlobSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
else {
verifiedPermissions = ContainerSASPermissions.parse(blobSASSignatureValues.permissions.toString()).toString();
}
}
// Signature is generated on the un-url-encoded values.
const stringToSign = [
verifiedPermissions ? verifiedPermissions : "",
blobSASSignatureValues.startsOn
? truncatedISO8061Date(blobSASSignatureValues.startsOn, false)
: "",
blobSASSignatureValues.expiresOn
? truncatedISO8061Date(blobSASSignatureValues.expiresOn, false)
: "",
getCanonicalName(userDelegationKeyCredential.accountName, blobSASSignatureValues.containerName, blobSASSignatureValues.blobName),
userDelegationKeyCredential.userDelegationKey.signedObjectId,
userDelegationKeyCredential.userDelegationKey.signedTenantId,
userDelegationKeyCredential.userDelegationKey.signedStartsOn
? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedStartsOn, false)
: "",
userDelegationKeyCredential.userDelegationKey.signedExpiresOn
? truncatedISO8061Date(userDelegationKeyCredential.userDelegationKey.signedExpiresOn, false)
: "",
userDelegationKeyCredential.userDelegationKey.signedService,
userDelegationKeyCredential.userDelegationKey.signedVersion,
blobSASSignatureValues.preauthorizedAgentObjectId,
undefined,
blobSASSignatureValues.correlationId,
blobSASSignatureValues.ipRange ? ipRangeToString(blobSASSignatureValues.ipRange) : "",
blobSASSignatureValues.protocol ? blobSASSignatureValues.protocol : "",
blobSASSignatureValues.version,
resource,
timestamp,
blobSASSignatureValues.encryptionScope,
blobSASSignatureValues.cacheControl,
blobSASSignatureValues.contentDisposition,
blobSASSignatureValues.contentEncoding,
blobSASSignatureValues.contentLanguage,
blobSASSignatureValues.contentType,
].join("\n");
const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId, blobSASSignatureValues.encryptionScope);
}
function getCanonicalName(accountName, containerName, blobName) {
// Container: "/blob/account/containerName"
// Blob: "/blob/account/containerName/blobName"
@@ -25361,6 +26171,11 @@ function SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues) {
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when providing 'x' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.permanentDelete &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when providing 'y' permission.");
}
if (blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
@@ -25371,10 +26186,18 @@ function SASSignatureValuesSanityCheckAndAutofill(blobSASSignatureValues) {
(blobSASSignatureValues.permissions.move || blobSASSignatureValues.permissions.execute)) {
throw RangeError("'version' must be >= '2020-02-10' when providing the 'm' or 'e' permission.");
}
if (version < "2021-04-10" &&
blobSASSignatureValues.permissions &&
blobSASSignatureValues.permissions.filterByTags) {
throw RangeError("'version' must be >= '2021-04-10' when providing the 'f' permission.");
}
if (version < "2020-02-10" &&
(blobSASSignatureValues.preauthorizedAgentObjectId || blobSASSignatureValues.correlationId)) {
throw RangeError("'version' must be >= '2020-02-10' when providing 'preauthorizedAgentObjectId' or 'correlationId'.");
}
if (blobSASSignatureValues.encryptionScope && version < "2020-12-06") {
throw RangeError("'version' must be >= '2020-12-06' when provided 'encryptionScope' in SAS.");
}
blobSASSignatureValues.version = version;
return blobSASSignatureValues;
}
@@ -25448,7 +26271,7 @@ class BlobLeaseClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -25483,7 +26306,7 @@ class BlobLeaseClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -25516,7 +26339,7 @@ class BlobLeaseClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -25548,7 +26371,7 @@ class BlobLeaseClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -25583,7 +26406,7 @@ class BlobLeaseClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -25663,8 +26486,7 @@ class RetriableReadableStream extends stream.Readable {
});
}
else {
this.destroy(new Error(`Data corruption failure: received less data than required and reached maxRetires limitation. Received data offset: ${this
.offset - 1}, data needed offset: ${this.end}, retries: ${this.retries}, max retries: ${this.maxRetryRequests}`));
this.destroy(new Error(`Data corruption failure: received less data than required and reached maxRetires limitation. Received data offset: ${this.offset - 1}, data needed offset: ${this.end}, retries: ${this.retries}, max retries: ${this.maxRetryRequests}`));
}
}
else {
@@ -26509,7 +27331,7 @@ class AvroReader {
}
async initialize(options = {}) {
const header = await AvroParser.readFixedBytes(this._headerStream, AVRO_INIT_BYTES.length, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
});
if (!arraysEqual(header, AVRO_INIT_BYTES)) {
throw new Error("Stream is not an Avro file.");
@@ -26517,7 +27339,7 @@ class AvroReader {
// File metadata is written as if defined by the following map schema:
// { "type": "map", "values": "bytes"}
this._metadata = await AvroParser.readMap(this._headerStream, AvroParser.readString, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
});
// Validate codec
const codec = this._metadata[AVRO_CODEC_KEY];
@@ -26526,7 +27348,7 @@ class AvroReader {
}
// The 16-byte, randomly-generated sync marker for this file.
this._syncMarker = await AvroParser.readFixedBytes(this._headerStream, AVRO_SYNC_MARKER_SIZE, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
});
// Parse the schema
const schema = JSON.parse(this._metadata[AVRO_SCHEMA_KEY]);
@@ -26535,7 +27357,7 @@ class AvroReader {
this._blockOffset = this._initialBlockOffset + this._dataStream.position;
}
this._itemsRemainingInBlock = await AvroParser.readLong(this._dataStream, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
});
// skip block length
await AvroParser.readLong(this._dataStream, { abortSignal: options.abortSignal });
@@ -26557,13 +27379,13 @@ class AvroReader {
}
while (this.hasNext()) {
const result = yield tslib.__await(this._itemType.read(this._dataStream, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
}));
this._itemsRemainingInBlock--;
this._objectIndex++;
if (this._itemsRemainingInBlock == 0) {
const marker = yield tslib.__await(AvroParser.readFixedBytes(this._dataStream, AVRO_SYNC_MARKER_SIZE, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
}));
this._blockOffset = this._initialBlockOffset + this._dataStream.position;
this._objectIndex = 0;
@@ -26572,7 +27394,7 @@ class AvroReader {
}
try {
this._itemsRemainingInBlock = yield tslib.__await(AvroParser.readLong(this._dataStream, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
}));
}
catch (err) {
@@ -26771,7 +27593,7 @@ class BlobQuickQueryStream extends stream.Readable {
position,
name,
isFatal: fatal,
description
description,
});
}
break;
@@ -27147,6 +27969,11 @@ class BlobQueryResponse {
}
// Copyright (c) Microsoft Corporation.
/**
* Represents the access tier on a blob.
* For detailed information about block blob level tiering see {@link https://docs.microsoft.com/azure/storage/blobs/storage-blob-storage-tiers|Hot, cool and archive storage tiers.}
*/
exports.BlockBlobTier = void 0;
(function (BlockBlobTier) {
/**
* Optimized for storing data that is accessed frequently.
@@ -27162,6 +27989,12 @@ class BlobQueryResponse {
*/
BlockBlobTier["Archive"] = "Archive";
})(exports.BlockBlobTier || (exports.BlockBlobTier = {}));
/**
* Specifies the page blob tier to set the blob to. This is only applicable to page blobs on premium storage accounts.
* Please see {@link https://docs.microsoft.com/azure/storage/storage-premium-storage#scalability-and-performance-targets|here}
* for detailed information on the corresponding IOPS and throughput per PageBlobTier.
*/
exports.PremiumPageBlobTier = void 0;
(function (PremiumPageBlobTier) {
/**
* P4 Tier.
@@ -27222,6 +28055,20 @@ function ensureCpkIfSpecified(cpk, isHttps) {
cpk.encryptionAlgorithm = EncryptionAlgorithmAES25;
}
}
/**
* Defines the known cloud audiences for Storage.
*/
exports.StorageBlobAudience = void 0;
(function (StorageBlobAudience) {
/**
* The OAuth scope to use to retrieve an AAD token for Azure Storage.
*/
StorageBlobAudience["StorageOAuthScopes"] = "https://storage.azure.com/.default";
/**
* The OAuth scope to use to retrieve an AAD token for Azure Disk.
*/
StorageBlobAudience["DiskComputeOAuthScopes"] = "https://disk.compute.azure.com/.default";
})(exports.StorageBlobAudience || (exports.StorageBlobAudience = {}));
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
@@ -27234,16 +28081,16 @@ function ensureCpkIfSpecified(cpk, isHttps) {
function rangeResponseFromModel(response) {
const pageRange = (response._response.parsedBody.pageRange || []).map((x) => ({
offset: x.start,
count: x.end - x.start
count: x.end - x.start,
}));
const clearRange = (response._response.parsedBody.clearRange || []).map((x) => ({
offset: x.start,
count: x.end - x.start
count: x.end - x.start,
}));
return Object.assign(Object.assign({}, response), { pageRange,
clearRange, _response: Object.assign(Object.assign({}, response._response), { parsedBody: {
pageRange,
clearRange
clearRange,
} }) });
}
@@ -27256,7 +28103,7 @@ function rangeResponseFromModel(response) {
*/
class BlobBeginCopyFromUrlPoller extends coreLro.Poller {
constructor(options) {
const { blobClient, copySource, intervalInMs = 15000, onProgress, resumeFrom, startCopyFromURLOptions } = options;
const { blobClient, copySource, intervalInMs = 15000, onProgress, resumeFrom, startCopyFromURLOptions, } = options;
let state;
if (resumeFrom) {
state = JSON.parse(resumeFrom).state;
@@ -27292,7 +28139,7 @@ const cancel = async function cancel(options = {}) {
}
// if abortCopyFromURL throws, it will bubble up to user's poller.cancelOperation call
await state.blobClient.abortCopyFromURL(copyId, {
abortSignal: options.abortSignal
abortSignal: options.abortSignal,
});
state.isCancelled = true;
return makeBlobBeginCopyFromURLPollOperation(state);
@@ -27370,7 +28217,7 @@ function makeBlobBeginCopyFromURLPollOperation(state) {
state: Object.assign({}, state),
cancel,
toString,
update
update,
};
}
@@ -28012,7 +28859,7 @@ async function streamToBuffer2(stream, buffer, encoding) {
*/
async function readStreamToLocalFile(rs, file) {
return new Promise((resolve, reject) => {
const ws = fs.createWriteStream(file);
const ws = fs__namespace.createWriteStream(file);
rs.on("error", (err) => {
reject(err);
});
@@ -28028,8 +28875,8 @@ async function readStreamToLocalFile(rs, file) {
*
* Promisified version of fs.stat().
*/
const fsStat = util.promisify(fs.stat);
const fsCreateReadStream = fs.createReadStream;
const fsStat = util__namespace.promisify(fs__namespace.stat);
const fsCreateReadStream = fs__namespace.createReadStream;
/**
* A BlobClient represents a URL to an Azure Storage blob; the blob may be a block blob,
@@ -28072,12 +28919,17 @@ class BlobClient extends StorageClient {
const blobName = blobNameOrOptions;
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
pipeline = newPipeline(sharedKeyCredential, options);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
url =
@@ -28094,10 +28946,8 @@ class BlobClient extends StorageClient {
throw new Error("Expecting non-empty strings for containerName and blobName parameters");
}
super(url, pipeline);
({
blobName: this._name,
containerName: this._containerName
} = this.getBlobAndContainerNamesFromUrl());
({ blobName: this._name, containerName: this._containerName } =
this.getBlobAndContainerNamesFromUrl());
this.blobContext = new Blob$1(this.storageClientContext);
this._snapshot = getURLParameter(this.url, URLConstants.Parameters.SNAPSHOT);
this._versionId = getURLParameter(this.url, URLConstants.Parameters.VERSIONID);
@@ -28222,11 +29072,13 @@ class BlobClient extends StorageClient {
const { span, updatedOptions } = createSpan("BlobClient-download", options);
try {
const res = await this.blobContext.download(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
onDownloadProgress: coreHttp.isNode ? undefined : options.onProgress // for Node.js, progress is reported by RetriableReadableStream
onDownloadProgress: coreHttp.isNode ? undefined : options.onProgress, // for Node.js, progress is reported by RetriableReadableStream
}, range: offset === 0 && !count ? undefined : rangeToString({ offset, count }), rangeGetContentMD5: options.rangeGetContentMD5, rangeGetContentCRC64: options.rangeGetContentCrc64, snapshot: options.snapshot, cpkInfo: options.customerProvidedKey }, convertTracingToRequestOptionsBase(updatedOptions)));
const wrappedRes = Object.assign(Object.assign({}, res), { _response: res._response, objectReplicationDestinationPolicyId: res.objectReplicationPolicyId, objectReplicationSourceProperties: parseObjectReplicationRecord(res.objectReplicationRules) });
// Return browser response immediately
if (false) {}
if (!coreHttp.isNode) {
return wrappedRes;
}
// We support retrying when download stream unexpected ends in Node.js runtime
// Following code shouldn't be bundled into browser build, however some
// bundlers may try to bundle following code and "FileReadResponse.ts".
@@ -28251,16 +29103,16 @@ class BlobClient extends StorageClient {
ifModifiedSince: options.conditions.ifModifiedSince,
ifNoneMatch: options.conditions.ifNoneMatch,
ifUnmodifiedSince: options.conditions.ifUnmodifiedSince,
ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions
ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions,
},
range: rangeToString({
count: offset + res.contentLength - start,
offset: start
offset: start,
}),
rangeGetContentMD5: options.rangeGetContentMD5,
rangeGetContentCRC64: options.rangeGetContentCrc64,
snapshot: options.snapshot,
cpkInfo: options.customerProvidedKey
cpkInfo: options.customerProvidedKey,
};
// Debug purpose only
// console.log(
@@ -28271,13 +29123,13 @@ class BlobClient extends StorageClient {
return (await this.blobContext.download(Object.assign({ abortSignal: options.abortSignal }, updatedDownloadOptions))).readableStreamBody;
}, offset, res.contentLength, {
maxRetryRequests: options.maxRetryRequests,
onProgress: options.onProgress
onProgress: options.onProgress,
});
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28302,21 +29154,23 @@ class BlobClient extends StorageClient {
abortSignal: options.abortSignal,
customerProvidedKey: options.customerProvidedKey,
conditions: options.conditions,
tracingOptions: updatedOptions.tracingOptions
tracingOptions: updatedOptions.tracingOptions,
});
return true;
}
catch (e) {
if (e.statusCode === 404) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when checking blob existence"
});
// Expected exception when checking blob existence
return false;
}
else if (e.statusCode === 409 &&
e.details.errorCode === BlobUsesCustomerSpecifiedEncryptionMsg) {
// Expected exception when checking blob existence
return true;
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28348,7 +29202,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28375,7 +29229,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28397,20 +29251,19 @@ class BlobClient extends StorageClient {
const { span, updatedOptions } = createSpan("BlobClient-deleteIfExists", options);
try {
const res = await this.delete(updatedOptions);
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
});
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
}
catch (e) {
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobNotFound") {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when deleting a blob or snapshot only if it exists."
message: "Expected exception when deleting a blob or snapshot only if it exists.",
});
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28434,7 +29287,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28468,7 +29321,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28498,7 +29351,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28524,7 +29377,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28548,7 +29401,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28582,7 +29435,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28666,7 +29519,7 @@ class BlobClient extends StorageClient {
const client = {
abortCopyFromURL: (...args) => this.abortCopyFromURL(...args),
getProperties: (...args) => this.getProperties(...args),
startCopyFromURL: (...args) => this.startCopyFromURL(...args)
startCopyFromURL: (...args) => this.startCopyFromURL(...args),
};
const poller = new BlobBeginCopyFromUrlPoller({
blobClient: client,
@@ -28674,7 +29527,7 @@ class BlobClient extends StorageClient {
intervalInMs: options.intervalInMs,
onProgress: options.onProgress,
resumeFrom: options.resumeFrom,
startCopyFromURLOptions: options
startCopyFromURLOptions: options,
});
// Trigger the startCopyFromURL call by calling poll.
// Any errors from this method should be surfaced to the user.
@@ -28697,7 +29550,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28723,13 +29576,13 @@ class BlobClient extends StorageClient {
sourceIfMatch: options.sourceConditions.ifMatch,
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince
}, sourceContentMD5: options.sourceContentMD5, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), blobTagsString: toBlobTagsString(options.tags), immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold }, convertTracingToRequestOptionsBase(updatedOptions)));
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
}, sourceContentMD5: options.sourceContentMD5, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), blobTagsString: toBlobTagsString(options.tags), immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28757,7 +29610,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28834,7 +29687,7 @@ class BlobClient extends StorageClient {
conditions: options.conditions,
maxRetryRequests: options.maxRetryRequestsPerBlock,
customerProvidedKey: options.customerProvidedKey,
tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions))
tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions)),
});
const stream = response.readableStreamBody;
await streamToBuffer(stream, buffer, off - offset, chunkEnd - offset);
@@ -28853,7 +29706,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28891,7 +29744,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -28972,13 +29825,13 @@ class BlobClient extends StorageClient {
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
sourceIfTags: options.sourceConditions.tagConditions
sourceIfTags: options.sourceConditions.tagConditions,
}, immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, rehydratePriority: options.rehydratePriority, tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags), sealBlob: options.sealBlob }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29019,7 +29872,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29040,7 +29893,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29061,7 +29914,7 @@ class BlobClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29112,12 +29965,17 @@ class AppendBlobClient extends BlobClient {
const blobName = blobNameOrOptions;
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
pipeline = newPipeline(sharedKeyCredential, options);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
url =
@@ -29172,7 +30030,7 @@ class AppendBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29193,20 +30051,19 @@ class AppendBlobClient extends BlobClient {
const conditions = { ifNoneMatch: ETagAny };
try {
const res = await this.create(Object.assign(Object.assign({}, updatedOptions), { conditions }));
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
});
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
}
catch (e) {
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when creating a blob only if it does not already exist."
message: "Expected exception when creating a blob only if it does not already exist.",
});
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29229,7 +30086,7 @@ class AppendBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29268,13 +30125,13 @@ class AppendBlobClient extends BlobClient {
try {
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
return await this.appendBlobContext.appendBlock(contentLength, body, Object.assign({ abortSignal: options.abortSignal, appendPositionAccessConditions: options.conditions, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
onUploadProgress: options.onProgress
onUploadProgress: options.onProgress,
}, transactionalContentMD5: options.transactionalContentMD5, transactionalContentCrc64: options.transactionalContentCrc64, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29307,13 +30164,13 @@ class AppendBlobClient extends BlobClient {
sourceIfMatch: options.sourceConditions.ifMatch,
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
}, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29364,12 +30221,17 @@ class BlockBlobClient extends BlobClient {
const blobName = blobNameOrOptions;
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
pipeline = newPipeline(sharedKeyCredential, options);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
url =
@@ -29435,23 +30297,25 @@ class BlockBlobClient extends BlobClient {
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
const { span, updatedOptions } = createSpan("BlockBlobClient-query", options);
try {
if (false) {}
if (!coreHttp.isNode) {
throw new Error("This operation currently is only supported in Node.js.");
}
const response = await this._blobContext.query(Object.assign({ abortSignal: options.abortSignal, queryRequest: {
queryType: "SQL",
expression: query,
inputSerialization: toQuerySerialization(options.inputTextConfiguration),
outputSerialization: toQuerySerialization(options.outputTextConfiguration)
outputSerialization: toQuerySerialization(options.outputTextConfiguration),
}, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions)));
return new BlobQueryResponse(response, {
abortSignal: options.abortSignal,
onProgress: options.onProgress,
onError: options.onError
onError: options.onError,
});
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29493,13 +30357,13 @@ class BlockBlobClient extends BlobClient {
try {
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
return await this.blockBlobContext.upload(contentLength, body, Object.assign({ abortSignal: options.abortSignal, blobHttpHeaders: options.blobHTTPHeaders, leaseAccessConditions: options.conditions, metadata: options.metadata, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
onUploadProgress: options.onProgress
onUploadProgress: options.onProgress,
}, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags) }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29536,13 +30400,13 @@ class BlockBlobClient extends BlobClient {
sourceIfModifiedSince: (_b = options.sourceConditions) === null || _b === void 0 ? void 0 : _b.ifModifiedSince,
sourceIfNoneMatch: (_c = options.sourceConditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch,
sourceIfUnmodifiedSince: (_d = options.sourceConditions) === null || _d === void 0 ? void 0 : _d.ifUnmodifiedSince,
sourceIfTags: (_e = options.sourceConditions) === null || _e === void 0 ? void 0 : _e.tagConditions
sourceIfTags: (_e = options.sourceConditions) === null || _e === void 0 ? void 0 : _e.tagConditions,
}, cpkInfo: options.customerProvidedKey, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags) }), convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29566,13 +30430,13 @@ class BlockBlobClient extends BlobClient {
try {
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
return await this.blockBlobContext.stageBlock(blockId, contentLength, body, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, requestOptions: {
onUploadProgress: options.onProgress
onUploadProgress: options.onProgress,
}, transactionalContentMD5: options.transactionalContentMD5, transactionalContentCrc64: options.transactionalContentCrc64, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29610,7 +30474,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29641,7 +30505,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29675,7 +30539,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29702,7 +30566,7 @@ class BlockBlobClient extends BlobClient {
async uploadData(data, options = {}) {
const { span, updatedOptions } = createSpan("BlockBlobClient-uploadData", options);
try {
if (true) {
if (coreHttp.isNode) {
let buffer;
if (data instanceof Buffer) {
buffer = data;
@@ -29716,12 +30580,15 @@ class BlockBlobClient extends BlobClient {
}
return this.uploadSeekableInternal((offset, size) => buffer.slice(offset, offset + size), buffer.byteLength, updatedOptions);
}
else {}
else {
const browserBlob = new Blob([data]);
return this.uploadSeekableInternal((offset, size) => browserBlob.slice(offset, offset + size), browserBlob.size, updatedOptions);
}
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29757,7 +30624,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29770,7 +30637,7 @@ class BlockBlobClient extends BlobClient {
* Uploads data to block blob. Requires a bodyFactory as the data source,
* which need to return a {@link HttpRequestBody} object with the offset and size provided.
*
* When data length is no more than the specifiled {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is
* When data length is no more than the specified {@link BlockBlobParallelUploadOptions.maxSingleShotSize} (default is
* {@link BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES}), this method will use 1 {@link upload} call to finish the upload.
* Otherwise, this method will call {@link stageBlock} to upload blocks, and finally call {@link commitBlockList}
* to commit the block list.
@@ -29836,14 +30703,14 @@ class BlockBlobClient extends BlobClient {
abortSignal: options.abortSignal,
conditions: options.conditions,
encryptionScope: options.encryptionScope,
tracingOptions: updatedOptions.tracingOptions
tracingOptions: updatedOptions.tracingOptions,
});
// Update progress after block is successfully uploaded to server, in case of block trying
// TODO: Hook with convenience layer progress event in finer level
transferProgress += contentLength;
if (options.onProgress) {
options.onProgress({
loadedBytes: transferProgress
loadedBytes: transferProgress,
});
}
});
@@ -29854,7 +30721,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29883,14 +30750,14 @@ class BlockBlobClient extends BlobClient {
return () => fsCreateReadStream(filePath, {
autoClose: true,
end: count ? offset + count - 1 : Infinity,
start: offset
start: offset,
});
}, size, Object.assign(Object.assign({}, options), { tracingOptions: Object.assign(Object.assign({}, options.tracingOptions), convertTracingToRequestOptionsBase(updatedOptions)) }));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -29934,7 +30801,7 @@ class BlockBlobClient extends BlobClient {
await this.stageBlock(blockID, body, length, {
conditions: options.conditions,
encryptionScope: options.encryptionScope,
tracingOptions: updatedOptions.tracingOptions
tracingOptions: updatedOptions.tracingOptions,
});
// Update progress after block is successfully uploaded to server, in case of block trying
transferProgress += length;
@@ -29953,7 +30820,7 @@ class BlockBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30004,12 +30871,17 @@ class PageBlobClient extends BlobClient {
const blobName = blobNameOrOptions;
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
pipeline = newPipeline(sharedKeyCredential, options);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
url =
@@ -30059,7 +30931,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30082,20 +30954,19 @@ class PageBlobClient extends BlobClient {
try {
const conditions = { ifNoneMatch: ETagAny };
const res = await this.create(size, Object.assign(Object.assign({}, options), { conditions, tracingOptions: updatedOptions.tracingOptions }));
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
});
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
}
catch (e) {
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "BlobAlreadyExists") {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when creating a blob only if it does not already exist."
message: "Expected exception when creating a blob only if it does not already exist.",
});
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30120,13 +30991,13 @@ class PageBlobClient extends BlobClient {
try {
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
return await this.pageBlobContext.uploadPages(count, body, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), requestOptions: {
onUploadProgress: options.onProgress
onUploadProgress: options.onProgress,
}, range: rangeToString({ offset, count }), sequenceNumberAccessConditions: options.conditions, transactionalContentMD5: options.transactionalContentMD5, transactionalContentCrc64: options.transactionalContentCrc64, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30156,13 +31027,13 @@ class PageBlobClient extends BlobClient {
sourceIfMatch: options.sourceConditions.ifMatch,
sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince
sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
}, cpkInfo: options.customerProvidedKey, encryptionScope: options.encryptionScope, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization) }, convertTracingToRequestOptionsBase(updatedOptions)));
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30189,7 +31060,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30218,7 +31089,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30248,7 +31119,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30278,7 +31149,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30304,7 +31175,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30331,7 +31202,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30361,7 +31232,7 @@ class PageBlobClient extends BlobClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30509,7 +31380,7 @@ class BatchResponseParser {
return {
subResponses: deserializedSubResponses,
subResponsesSucceededCount: subResponsesSucceededCount,
subResponsesFailedCount: subResponsesFailedCount
subResponsesFailedCount: subResponsesFailedCount,
};
}
}
@@ -30656,7 +31527,7 @@ class BlobBatch {
this.setBatchType("delete");
await this.addSubRequestInternal({
url: url,
credential: credential
credential: credential,
}, async () => {
await new BlobClient(url, this.batchRequest.createPipeline(credential)).delete(updatedOptions);
});
@@ -30664,7 +31535,7 @@ class BlobBatch {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30703,7 +31574,7 @@ class BlobBatch {
this.setBatchType("setAccessTier");
await this.addSubRequestInternal({
url: url,
credential: credential
credential: credential,
}, async () => {
await new BlobClient(url, this.batchRequest.createPipeline(credential)).setAccessTier(tier, updatedOptions);
});
@@ -30711,7 +31582,7 @@ class BlobBatch {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -30768,7 +31639,7 @@ class InnerBatchRequest {
this.subRequestPrefix,
`${HeaderConstants.CONTENT_ID}: ${this.operationCount}`,
"",
`${request.method.toString()} ${getURLPathAndQuery(request.url)} ${HTTP_VERSION_1_1}${HTTP_LINE_ENDING}` // sub request start line with method
`${request.method.toString()} ${getURLPathAndQuery(request.url)} ${HTTP_VERSION_1_1}${HTTP_LINE_ENDING}`, // sub request start line with method
].join(HTTP_LINE_ENDING);
for (const header of request.headers.headersArray()) {
this.body += `${header.name}: ${header.value}${HTTP_LINE_ENDING}`;
@@ -30808,7 +31679,7 @@ class BatchRequestAssemblePolicy extends coreHttp.BaseRequestPolicy {
this.dummyResponse = {
request: new coreHttp.WebResource(),
status: 200,
headers: new coreHttp.HttpHeaders()
headers: new coreHttp.HttpHeaders(),
};
this.batchRequest = batchRequest;
}
@@ -30975,14 +31846,14 @@ class BlobBatchClient {
version: rawBatchResponse.version,
subResponses: responseSummary.subResponses,
subResponsesSucceededCount: responseSummary.subResponsesSucceededCount,
subResponsesFailedCount: responseSummary.subResponsesFailedCount
subResponsesFailedCount: responseSummary.subResponsesFailedCount,
};
return res;
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31028,12 +31899,17 @@ class ContainerClient extends StorageClient {
const containerName = credentialOrPipelineOrContainerName;
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
url = appendToURLPath(extractedCreds.url, encodeURIComponent(containerName));
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
pipeline = newPipeline(sharedKeyCredential, options);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
url =
@@ -31085,7 +31961,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31105,20 +31981,19 @@ class ContainerClient extends StorageClient {
const { span, updatedOptions } = createSpan("ContainerClient-createIfNotExists", options);
try {
const res = await this.create(updatedOptions);
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
});
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
}
catch (e) {
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when creating a container only if it does not already exist."
message: "Expected exception when creating a container only if it does not already exist.",
});
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31140,7 +32015,7 @@ class ContainerClient extends StorageClient {
try {
await this.getProperties({
abortSignal: options.abortSignal,
tracingOptions: updatedOptions.tracingOptions
tracingOptions: updatedOptions.tracingOptions,
});
return true;
}
@@ -31148,13 +32023,13 @@ class ContainerClient extends StorageClient {
if (e.statusCode === 404) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when checking container existence"
message: "Expected exception when checking container existence",
});
return false;
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31228,7 +32103,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31254,7 +32129,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31274,20 +32149,19 @@ class ContainerClient extends StorageClient {
const { span, updatedOptions } = createSpan("ContainerClient-deleteIfExists", options);
try {
const res = await this.delete(updatedOptions);
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response // _response is made non-enumerable
});
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
}
catch (e) {
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: "Expected exception when deleting a container only if it exists."
message: "Expected exception when deleting a container only if it exists.",
});
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
}
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31321,7 +32195,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31357,13 +32231,13 @@ class ContainerClient extends StorageClient {
requestId: response.requestId,
clientRequestId: response.clientRequestId,
signedIdentifiers: [],
version: response.version
version: response.version,
};
for (const identifier of response) {
let accessPolicy = undefined;
if (identifier.accessPolicy) {
accessPolicy = {
permissions: identifier.accessPolicy.permissions
permissions: identifier.accessPolicy.permissions,
};
if (identifier.accessPolicy.expiresOn) {
accessPolicy.expiresOn = new Date(identifier.accessPolicy.expiresOn);
@@ -31374,7 +32248,7 @@ class ContainerClient extends StorageClient {
}
res.signedIdentifiers.push({
accessPolicy,
id: identifier.id
id: identifier.id,
});
}
return res;
@@ -31382,7 +32256,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31421,9 +32295,9 @@ class ContainerClient extends StorageClient {
permissions: identifier.accessPolicy.permissions,
startsOn: identifier.accessPolicy.startsOn
? truncatedISO8061Date(identifier.accessPolicy.startsOn)
: ""
: "",
},
id: identifier.id
id: identifier.id,
});
}
return await this.containerContext.setAccessPolicy(Object.assign({ abortSignal: options.abortSignal, access, containerAcl: acl, leaseAccessConditions: options.conditions, modifiedAccessConditions: options.conditions }, convertTracingToRequestOptionsBase(updatedOptions)));
@@ -31431,7 +32305,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31477,13 +32351,13 @@ class ContainerClient extends StorageClient {
const response = await blockBlobClient.upload(body, contentLength, updatedOptions);
return {
blockBlobClient,
response
response,
};
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31514,7 +32388,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31536,8 +32410,12 @@ class ContainerClient extends StorageClient {
const { span, updatedOptions } = createSpan("ContainerClient-listBlobFlatSegment", options);
try {
const response = await this.containerContext.listBlobFlatSegment(Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
response.segment.blobItems = [];
if (response.segment["Blob"] !== undefined) {
response.segment.blobItems = ProcessBlobItems(response.segment["Blob"]);
}
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListBlobFlat(response._response.parsedBody) }), segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name), tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
return blobItem;
}) }) });
return wrappedResponse;
@@ -31545,7 +32423,7 @@ class ContainerClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31565,19 +32443,33 @@ class ContainerClient extends StorageClient {
* @param options - Options to Container List Blob Hierarchy Segment operation.
*/
async listBlobHierarchySegment(delimiter, marker, options = {}) {
var _a;
const { span, updatedOptions } = createSpan("ContainerClient-listBlobHierarchySegment", options);
try {
const response = await this.containerContext.listBlobHierarchySegment(delimiter, Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
response.segment.blobItems = [];
if (response.segment["Blob"] !== undefined) {
response.segment.blobItems = ProcessBlobItems(response.segment["Blob"]);
}
response.segment.blobPrefixes = [];
if (response.segment["BlobPrefix"] !== undefined) {
response.segment.blobPrefixes = ProcessBlobPrefixes(response.segment["BlobPrefix"]);
}
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListBlobHierarchy(response._response.parsedBody) }), segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name), tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
return blobItem;
}), blobPrefixes: (_a = response.segment.blobPrefixes) === null || _a === void 0 ? void 0 : _a.map((blobPrefixInternal) => {
const blobPrefix = {
name: BlobNameToString(blobPrefixInternal.name),
};
return blobPrefix;
}) }) });
return wrappedResponse;
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -31759,7 +32651,7 @@ class ContainerClient extends StorageClient {
*/
byPage: (settings = {}) => {
return this.listSegments(settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, updatedOptions));
}
},
};
}
/**
@@ -31833,7 +32725,7 @@ class ContainerClient extends StorageClient {
* if (item.kind === "prefix") {
* console.log(`\tBlobPrefix: ${item.name}`);
* } else {
* console.log(`\tBlobItem: name - ${item.name}, last modified - ${item.properties.lastModified}`);
* console.log(`\tBlobItem: name - ${item.name}`);
* }
* }
* ```
@@ -31848,7 +32740,7 @@ class ContainerClient extends StorageClient {
* if (item.kind === "prefix") {
* console.log(`\tBlobPrefix: ${item.name}`);
* } else {
* console.log(`\tBlobItem: name - ${item.name}, last modified - ${item.properties.lastModified}`);
* console.log(`\tBlobItem: name - ${item.name}`);
* }
* entity = await iter.next();
* }
@@ -31866,7 +32758,7 @@ class ContainerClient extends StorageClient {
* }
* }
* for (const blob of response.segment.blobItems) {
* console.log(`\tBlobItem: name - ${blob.name}, last modified - ${blob.properties.lastModified}`);
* console.log(`\tBlobItem: name - ${blob.name}`);
* }
* }
* ```
@@ -31877,7 +32769,9 @@ class ContainerClient extends StorageClient {
* console.log("Listing blobs by hierarchy by page, specifying a prefix and a max page size");
*
* let i = 1;
* for await (const response of containerClient.listBlobsByHierarchy("/", { prefix: "prefix2/sub1/"}).byPage({ maxPageSize: 2 })) {
* for await (const response of containerClient
* .listBlobsByHierarchy("/", { prefix: "prefix2/sub1/" })
* .byPage({ maxPageSize: 2 })) {
* console.log(`Page ${i++}`);
* const segment = response.segment;
*
@@ -31888,7 +32782,7 @@ class ContainerClient extends StorageClient {
* }
*
* for (const blob of response.segment.blobItems) {
* console.log(`\tBlobItem: name - ${blob.name}, last modified - ${blob.properties.lastModified}`);
* console.log(`\tBlobItem: name - ${blob.name}`);
* }
* }
* ```
@@ -31955,7 +32849,208 @@ class ContainerClient extends StorageClient {
*/
byPage: (settings = {}) => {
return this.listHierarchySegments(delimiter, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, updatedOptions));
},
};
}
/**
* The Filter Blobs operation enables callers to list blobs in the container whose tags
* match a given search expression.
*
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
* The given expression must evaluate to true for a blob to be returned in the results.
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param marker - A string value that identifies the portion of
* the list of blobs to be returned with the next listing operation. The
* operation returns the continuationToken value within the response body if the
* listing operation did not return all blobs remaining to be listed
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param options - Options to find blobs by tags.
*/
async findBlobsByTagsSegment(tagFilterSqlExpression, marker, options = {}) {
const { span, updatedOptions } = createSpan("ContainerClient-findBlobsByTagsSegment", options);
try {
const response = await this.containerContext.filterBlobs(Object.assign({ abortSignal: options.abortSignal, where: tagFilterSqlExpression, marker, maxPageSize: options.maxPageSize }, convertTracingToRequestOptionsBase(updatedOptions)));
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, blobs: response.blobs.map((blob) => {
var _a;
let tagValue = "";
if (((_a = blob.tags) === null || _a === void 0 ? void 0 : _a.blobTagSet.length) === 1) {
tagValue = blob.tags.blobTagSet[0].value;
}
return Object.assign(Object.assign({}, blob), { tags: toTags(blob.tags), tagValue });
}) });
return wrappedResponse;
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message,
});
throw e;
}
finally {
span.end();
}
}
/**
* Returns an AsyncIterableIterator for ContainerFindBlobsByTagsSegmentResponse.
*
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
* The given expression must evaluate to true for a blob to be returned in the results.
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param marker - A string value that identifies the portion of
* the list of blobs to be returned with the next listing operation. The
* operation returns the continuationToken value within the response body if the
* listing operation did not return all blobs remaining to be listed
* with the current page. The continuationToken value can be used as the value for
* the marker parameter in a subsequent call to request the next page of list
* items. The marker value is opaque to the client.
* @param options - Options to find blobs by tags.
*/
findBlobsByTagsSegments(tagFilterSqlExpression, marker, options = {}) {
return tslib.__asyncGenerator(this, arguments, function* findBlobsByTagsSegments_1() {
let response;
if (!!marker || marker === undefined) {
do {
response = yield tslib.__await(this.findBlobsByTagsSegment(tagFilterSqlExpression, marker, options));
response.blobs = response.blobs || [];
marker = response.continuationToken;
yield yield tslib.__await(response);
} while (marker);
}
});
}
/**
* Returns an AsyncIterableIterator for blobs.
*
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
* The given expression must evaluate to true for a blob to be returned in the results.
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param options - Options to findBlobsByTagsItems.
*/
findBlobsByTagsItems(tagFilterSqlExpression, options = {}) {
return tslib.__asyncGenerator(this, arguments, function* findBlobsByTagsItems_1() {
var e_3, _a;
let marker;
try {
for (var _b = tslib.__asyncValues(this.findBlobsByTagsSegments(tagFilterSqlExpression, marker, options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
const segment = _c.value;
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(segment.blobs)));
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
}
finally { if (e_3) throw e_3.error; }
}
});
}
/**
* Returns an async iterable iterator to find all blobs with specified tag
* under the specified container.
*
* .byPage() returns an async iterable iterator to list the blobs in pages.
*
* Example using `for await` syntax:
*
* ```js
* let i = 1;
* for await (const blob of containerClient.findBlobsByTags("tagkey='tagvalue'")) {
* console.log(`Blob ${i++}: ${blob.name}`);
* }
* ```
*
* Example using `iter.next()`:
*
* ```js
* let i = 1;
* const iter = containerClient.findBlobsByTags("tagkey='tagvalue'");
* let blobItem = await iter.next();
* while (!blobItem.done) {
* console.log(`Blob ${i++}: ${blobItem.value.name}`);
* blobItem = await iter.next();
* }
* ```
*
* Example using `byPage()`:
*
* ```js
* // passing optional maxPageSize in the page settings
* let i = 1;
* for await (const response of containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 20 })) {
* if (response.blobs) {
* for (const blob of response.blobs) {
* console.log(`Blob ${i++}: ${blob.name}`);
* }
* }
* }
* ```
*
* Example using paging with a marker:
*
* ```js
* let i = 1;
* let iterator = containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 2 });
* let response = (await iterator.next()).value;
*
* // Prints 2 blob names
* if (response.blobs) {
* for (const blob of response.blobs) {
* console.log(`Blob ${i++}: ${blob.name}`);
* }
* }
*
* // Gets next marker
* let marker = response.continuationToken;
* // Passing next marker as continuationToken
* iterator = containerClient
* .findBlobsByTags("tagkey='tagvalue'")
* .byPage({ continuationToken: marker, maxPageSize: 10 });
* response = (await iterator.next()).value;
*
* // Prints blob names
* if (response.blobs) {
* for (const blob of response.blobs) {
* console.log(`Blob ${i++}: ${blob.name}`);
* }
* }
* ```
*
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
* The given expression must evaluate to true for a blob to be returned in the results.
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
* however, only a subset of the OData filter syntax is supported in the Blob service.
* @param options - Options to find blobs by tags.
*/
findBlobsByTags(tagFilterSqlExpression, options = {}) {
// AsyncIterableIterator to iterate over blobs
const listSegmentOptions = Object.assign({}, options);
const iter = this.findBlobsByTagsItems(tagFilterSqlExpression, listSegmentOptions);
return {
/**
* The next method, part of the iteration protocol
*/
next() {
return iter.next();
},
/**
* The connection to the async iterator, part of the iteration protocol
*/
[Symbol.asyncIterator]() {
return this;
},
/**
* Return an AsyncIterableIterator that works a page at a time
*/
byPage: (settings = {}) => {
return this.findBlobsByTagsSegments(tagFilterSqlExpression, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions));
},
};
}
getContainerNameFromUrl() {
@@ -32088,6 +33183,10 @@ class AccountSASPermissions {
* Permission to set immutability policy.
*/
this.setImmutabilityPolicy = false;
/**
* Specifies that Permanent Delete is permitted.
*/
this.permanentDelete = false;
}
/**
* Parse initializes the AccountSASPermissions fields from a string.
@@ -32134,6 +33233,9 @@ class AccountSASPermissions {
case "i":
accountSASPermissions.setImmutabilityPolicy = true;
break;
case "y":
accountSASPermissions.permanentDelete = true;
break;
default:
throw new RangeError(`Invalid permission character: ${c}`);
}
@@ -32184,6 +33286,9 @@ class AccountSASPermissions {
if (permissionLike.setImmutabilityPolicy) {
accountSASPermissions.setImmutabilityPolicy = true;
}
if (permissionLike.permanentDelete) {
accountSASPermissions.permanentDelete = true;
}
return accountSASPermissions;
}
/**
@@ -32237,6 +33342,9 @@ class AccountSASPermissions {
if (this.setImmutabilityPolicy) {
permissions.push("i");
}
if (this.permanentDelete) {
permissions.push("y");
}
return permissions.join("");
}
}
@@ -32419,6 +33527,11 @@ function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyC
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'x' permission.");
}
if (accountSASSignatureValues.permissions &&
accountSASSignatureValues.permissions.permanentDelete &&
version < "2019-10-10") {
throw RangeError("'version' must be >= '2019-10-10' when provided 'y' permission.");
}
if (accountSASSignatureValues.permissions &&
accountSASSignatureValues.permissions.tag &&
version < "2019-12-12") {
@@ -32429,25 +33542,48 @@ function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyC
version < "2019-12-12") {
throw RangeError("'version' must be >= '2019-12-12' when provided 'f' permission.");
}
if (accountSASSignatureValues.encryptionScope && version < "2020-12-06") {
throw RangeError("'version' must be >= '2020-12-06' when provided 'encryptionScope' in SAS.");
}
const parsedPermissions = AccountSASPermissions.parse(accountSASSignatureValues.permissions.toString());
const parsedServices = AccountSASServices.parse(accountSASSignatureValues.services).toString();
const parsedResourceTypes = AccountSASResourceTypes.parse(accountSASSignatureValues.resourceTypes).toString();
const stringToSign = [
sharedKeyCredential.accountName,
parsedPermissions,
parsedServices,
parsedResourceTypes,
accountSASSignatureValues.startsOn
? truncatedISO8061Date(accountSASSignatureValues.startsOn, false)
: "",
truncatedISO8061Date(accountSASSignatureValues.expiresOn, false),
accountSASSignatureValues.ipRange ? ipRangeToString(accountSASSignatureValues.ipRange) : "",
accountSASSignatureValues.protocol ? accountSASSignatureValues.protocol : "",
version,
"" // Account SAS requires an additional newline character
].join("\n");
let stringToSign;
if (version >= "2020-12-06") {
stringToSign = [
sharedKeyCredential.accountName,
parsedPermissions,
parsedServices,
parsedResourceTypes,
accountSASSignatureValues.startsOn
? truncatedISO8061Date(accountSASSignatureValues.startsOn, false)
: "",
truncatedISO8061Date(accountSASSignatureValues.expiresOn, false),
accountSASSignatureValues.ipRange ? ipRangeToString(accountSASSignatureValues.ipRange) : "",
accountSASSignatureValues.protocol ? accountSASSignatureValues.protocol : "",
version,
accountSASSignatureValues.encryptionScope ? accountSASSignatureValues.encryptionScope : "",
"", // Account SAS requires an additional newline character
].join("\n");
}
else {
stringToSign = [
sharedKeyCredential.accountName,
parsedPermissions,
parsedServices,
parsedResourceTypes,
accountSASSignatureValues.startsOn
? truncatedISO8061Date(accountSASSignatureValues.startsOn, false)
: "",
truncatedISO8061Date(accountSASSignatureValues.expiresOn, false),
accountSASSignatureValues.ipRange ? ipRangeToString(accountSASSignatureValues.ipRange) : "",
accountSASSignatureValues.protocol ? accountSASSignatureValues.protocol : "",
version,
"", // Account SAS requires an additional newline character
].join("\n");
}
const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
return new SASQueryParameters(version, signature, parsedPermissions.toString(), parsedServices, parsedResourceTypes, accountSASSignatureValues.protocol, accountSASSignatureValues.startsOn, accountSASSignatureValues.expiresOn, accountSASSignatureValues.ipRange);
return new SASQueryParameters(version, signature, parsedPermissions.toString(), parsedServices, parsedResourceTypes, accountSASSignatureValues.protocol, accountSASSignatureValues.startsOn, accountSASSignatureValues.expiresOn, accountSASSignatureValues.ipRange, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, accountSASSignatureValues.encryptionScope);
}
/**
@@ -32494,12 +33630,17 @@ class BlobServiceClient extends StorageClient {
options = options || {};
const extractedCreds = extractConnectionStringParts(connectionString);
if (extractedCreds.kind === "AccountConnString") {
{
if (coreHttp.isNode) {
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
if (!options.proxyOptions) {
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
}
const pipeline = newPipeline(sharedKeyCredential, options);
return new BlobServiceClient(extractedCreds.url, pipeline);
}
else {
throw new Error("Account connection string is only supported in Node.js environment");
}
}
else if (extractedCreds.kind === "SASConnString") {
const pipeline = newPipeline(new AnonymousCredential(), options);
@@ -32538,13 +33679,13 @@ class BlobServiceClient extends StorageClient {
const containerCreateResponse = await containerClient.create(updatedOptions);
return {
containerClient,
containerCreateResponse
containerCreateResponse,
};
}
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32568,7 +33709,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32598,7 +33739,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32628,7 +33769,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32652,7 +33793,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32677,7 +33818,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32702,7 +33843,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32728,7 +33869,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32758,7 +33899,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32801,7 +33942,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -32967,7 +34108,7 @@ class BlobServiceClient extends StorageClient {
*/
byPage: (settings = {}) => {
return this.findBlobsByTagsSegments(tagFilterSqlExpression, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions));
}
},
};
}
/**
@@ -33105,6 +34246,9 @@ class BlobServiceClient extends StorageClient {
if (options.includeMetadata) {
include.push("metadata");
}
if (options.includeSystem) {
include.push("system");
}
// AsyncIterableIterator to iterate over containers
const listSegmentOptions = Object.assign(Object.assign({}, options), (include.length > 0 ? { include } : {}));
const iter = this.listItems(listSegmentOptions);
@@ -33126,7 +34270,7 @@ class BlobServiceClient extends StorageClient {
*/
byPage: (settings = {}) => {
return this.listSegments(settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions));
}
},
};
}
/**
@@ -33145,7 +34289,7 @@ class BlobServiceClient extends StorageClient {
try {
const response = await this.serviceContext.getUserDelegationKey({
startsOn: truncatedISO8061Date(startsOn, false),
expiresOn: truncatedISO8061Date(expiresOn, false)
expiresOn: truncatedISO8061Date(expiresOn, false),
}, Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
const userDelegationKey = {
signedObjectId: response.signedObjectId,
@@ -33154,7 +34298,7 @@ class BlobServiceClient extends StorageClient {
signedExpiresOn: new Date(response.signedExpiresOn),
signedService: response.signedService,
signedVersion: response.signedVersion,
value: response.value
value: response.value,
};
const res = Object.assign({ _response: response._response, requestId: response.requestId, clientRequestId: response.clientRequestId, version: response.version, date: response.date, errorCode: response.errorCode }, userDelegationKey);
return res;
@@ -33162,7 +34306,7 @@ class BlobServiceClient extends StorageClient {
catch (e) {
span.setStatus({
code: coreTracing.SpanStatusCode.ERROR,
message: e.message
message: e.message,
});
throw e;
}
@@ -33211,39 +34355,27 @@ class BlobServiceClient extends StorageClient {
Object.defineProperty(exports, 'BaseRequestPolicy', {
enumerable: true,
get: function () {
return coreHttp.BaseRequestPolicy;
}
get: function () { return coreHttp.BaseRequestPolicy; }
});
Object.defineProperty(exports, 'HttpHeaders', {
enumerable: true,
get: function () {
return coreHttp.HttpHeaders;
}
get: function () { return coreHttp.HttpHeaders; }
});
Object.defineProperty(exports, 'RequestPolicyOptions', {
enumerable: true,
get: function () {
return coreHttp.RequestPolicyOptions;
}
get: function () { return coreHttp.RequestPolicyOptions; }
});
Object.defineProperty(exports, 'RestError', {
enumerable: true,
get: function () {
return coreHttp.RestError;
}
get: function () { return coreHttp.RestError; }
});
Object.defineProperty(exports, 'WebResource', {
enumerable: true,
get: function () {
return coreHttp.WebResource;
}
get: function () { return coreHttp.WebResource; }
});
Object.defineProperty(exports, 'deserializationPolicy', {
enumerable: true,
get: function () {
return coreHttp.deserializationPolicy;
}
get: function () { return coreHttp.deserializationPolicy; }
});
exports.AccountSASPermissions = AccountSASPermissions;
exports.AccountSASResourceTypes = AccountSASResourceTypes;
@@ -35988,9 +37120,9 @@ function extractTar(archivePath, compressionMethod) {
function getCompressionProgram() {
switch (compressionMethod) {
case constants_1.CompressionMethod.Zstd:
return ['--use-compress-program', 'zstd -d --fast=1 --long=30'];
return ['--use-compress-program', 'zstd -d --long=30'];
case constants_1.CompressionMethod.ZstdWithoutLong:
return ['--use-compress-program', 'zstd -d --fast=1'];
return ['--use-compress-program', 'zstd -d'];
default:
return ['-z'];
}
@@ -36021,9 +37153,9 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
function getCompressionProgram() {
switch (compressionMethod) {
case constants_1.CompressionMethod.Zstd:
return ['--use-compress-program', 'zstd -T0 --fast=1 --long=30'];
return ['--use-compress-program', 'zstd -T0 --long=30'];
case constants_1.CompressionMethod.ZstdWithoutLong:
return ['--use-compress-program', 'zstd -T0 --fast=1'];
return ['--use-compress-program', 'zstd -T0'];
default:
return ['-z'];
}
@@ -36052,9 +37184,9 @@ function listTar(archivePath, compressionMethod) {
function getCompressionProgram() {
switch (compressionMethod) {
case constants_1.CompressionMethod.Zstd:
return ['--use-compress-program', 'zstd -d --fast=1 --long=30'];
return ['--use-compress-program', 'zstd -d --long=30'];
case constants_1.CompressionMethod.ZstdWithoutLong:
return ['--use-compress-program', 'zstd -d --fast=1'];
return ['--use-compress-program', 'zstd -d'];
default:
return ['-z'];
}
@@ -36296,7 +37428,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0;
exports.isCacheFeatureAvailable = exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0;
const cache = __importStar(__webpack_require__(692));
const core = __importStar(__webpack_require__(470));
const constants_1 = __webpack_require__(196);
function isGhes() {
@@ -36361,6 +37494,19 @@ function getInputAsInt(name, options) {
return value;
}
exports.getInputAsInt = getInputAsInt;
function isCacheFeatureAvailable() {
if (!cache.isFeatureAvailable()) {
if (isGhes()) {
logWarning("Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.");
}
else {
logWarning("An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions.");
}
return false;
}
return true;
}
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
/***/ }),
@@ -45174,8 +46320,7 @@ process.on("uncaughtException", e => utils.logWarning(e.message));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
if (utils.isGhes()) {
utils.logWarning("Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details");
if (!utils.isCacheFeatureAvailable()) {
return;
}
if (!utils.isValidEvent()) {
@@ -45319,6 +46464,15 @@ function checkKey(key) {
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
}
}
/**
* isFeatureAvailable to check the presence of Actions cache service
*
* @returns boolean return true if Actions cache service feature is available, otherwise false
*/
function isFeatureAvailable() {
return !!process.env['ACTIONS_CACHE_URL'];
}
exports.isFeatureAvailable = isFeatureAvailable;
/**
* Restores cache from keys
*
@@ -45385,18 +46539,12 @@ exports.restoreCache = restoreCache;
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
*/
function saveCache(paths, key, options) {
var _a, _b, _c, _d, _e;
return __awaiter(this, void 0, void 0, function* () {
checkPaths(paths);
checkKey(key);
const compressionMethod = yield utils.getCompressionMethod();
core.debug('Reserving Cache');
const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
compressionMethod
});
if (cacheId === -1) {
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
}
core.debug(`Cache ID: ${cacheId}`);
let cacheId = null;
const cachePaths = yield utils.resolvePaths(paths);
core.debug('Cache Paths:');
core.debug(`${JSON.stringify(cachePaths)}`);
@@ -45411,9 +46559,24 @@ function saveCache(paths, key, options) {
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core.debug(`File Size: ${archiveFileSize}`);
if (archiveFileSize > fileSizeLimit) {
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
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');
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
compressionMethod,
cacheSize: archiveFileSize
});
if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
}
else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
}
else {
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})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
}
@@ -49581,7 +50744,6 @@ class Poller {
});
}
/**
* @internal
* Starts a loop that will break only if the poller is done
* or if the poller is stopped.
*/
@@ -49595,7 +50757,6 @@ class Poller {
}
}
/**
* @internal
* pollOnce does one polling, by calling to the update method of the underlying
* poll operation to make any relevant change effective.
*
@@ -49629,7 +50790,6 @@ class Poller {
}
}
/**
* @internal
* fireProgress calls the functions passed in via onProgress the method of the poller.
*
* It loops over all of the callbacks received from onProgress, and executes them, sending them
@@ -49643,7 +50803,6 @@ class Poller {
}
}
/**
* @internal
* Invokes the underlying operation's cancel method, and rejects the
* pollUntilDone promise.
*/
@@ -49817,7 +50976,7 @@ class Poller {
*/
function getPollingUrl(rawResponse, defaultPath) {
var _a, _b, _c;
return ((_c = (_b = (_a = getAzureAsyncOperation(rawResponse)) !== null && _a !== void 0 ? _a : getLocation(rawResponse)) !== null && _b !== void 0 ? _b : getOperationLocation(rawResponse)) !== null && _c !== void 0 ? _c : defaultPath);
return ((_c = (_b = (_a = getAzureAsyncOperation(rawResponse)) !== null && _a !== void 0 ? _a : getOperationLocation(rawResponse)) !== null && _b !== void 0 ? _b : getLocation(rawResponse)) !== null && _c !== void 0 ? _c : defaultPath);
}
function getLocation(rawResponse) {
return rawResponse.headers["location"];
@@ -49828,19 +50987,29 @@ function getOperationLocation(rawResponse) {
function getAzureAsyncOperation(rawResponse) {
return rawResponse.headers["azure-asyncoperation"];
}
function findResourceLocation(requestMethod, rawResponse, requestPath) {
switch (requestMethod) {
case "PUT": {
return requestPath;
}
case "POST":
case "PATCH": {
return getLocation(rawResponse);
}
default: {
return undefined;
}
}
}
function inferLroMode(requestPath, requestMethod, rawResponse) {
if (getAzureAsyncOperation(rawResponse) !== undefined) {
if (getAzureAsyncOperation(rawResponse) !== undefined ||
getOperationLocation(rawResponse) !== undefined) {
return {
mode: "AzureAsync",
resourceLocation: requestMethod === "PUT"
? requestPath
: requestMethod === "POST" || requestMethod === "PATCH"
? getLocation(rawResponse)
: undefined,
mode: "Location",
resourceLocation: findResourceLocation(requestMethod, rawResponse, requestPath),
};
}
else if (getLocation(rawResponse) !== undefined ||
getOperationLocation(rawResponse) !== undefined) {
else if (getLocation(rawResponse) !== undefined) {
return {
mode: "Location",
};
@@ -49910,13 +51079,13 @@ function processBodyPollingOperationResult(response) {
const logger = logger$1.createClientLogger("core-lro");
// Copyright (c) Microsoft Corporation.
function getResponseStatus(rawResponse) {
function isPollingDone(rawResponse) {
var _a;
if (isUnexpectedPollingResponse(rawResponse) || rawResponse.statusCode === 202) {
return false;
}
const { status } = (_a = rawResponse.body) !== null && _a !== void 0 ? _a : {};
return typeof status === "string" ? status.toLowerCase() : "succeeded";
}
function isAzureAsyncPollingDone(rawResponse) {
const state = getResponseStatus(rawResponse);
const state = typeof status === "string" ? status.toLowerCase() : "succeeded";
if (isUnexpectedPollingResponse(rawResponse) || failureStates.includes(state)) {
throw new Error(`The long running operation has failed. The provisioning state: ${state}.`);
}
@@ -49936,9 +51105,9 @@ async function sendFinalRequest(lro, resourceLocation, lroResourceLocationConfig
return lro.sendPollRequest(resourceLocation !== null && resourceLocation !== void 0 ? resourceLocation : lro.requestPath);
}
}
function processAzureAsyncOperationResult(lro, resourceLocation, lroResourceLocationConfig) {
function processLocationPollingOperationResult(lro, resourceLocation, lroResourceLocationConfig) {
return (response) => {
if (isAzureAsyncPollingDone(response.rawResponse)) {
if (isPollingDone(response.rawResponse)) {
if (resourceLocation === undefined) {
return Object.assign(Object.assign({}, response), { done: true });
}
@@ -49953,14 +51122,6 @@ function processAzureAsyncOperationResult(lro, resourceLocation, lroResourceLoca
};
}
// Copyright (c) Microsoft Corporation.
function isLocationPollingDone(rawResponse) {
return !isUnexpectedPollingResponse(rawResponse) && rawResponse.statusCode !== 202;
}
function processLocationPollingOperationResult(response) {
return Object.assign(Object.assign({}, response), { done: isLocationPollingDone(response.rawResponse) });
}
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
function processPassthroughOperationResult(response) {
@@ -49973,11 +51134,8 @@ function processPassthroughOperationResult(response) {
*/
function createGetLroStatusFromResponse(lroPrimitives, config, lroResourceLocationConfig) {
switch (config.mode) {
case "AzureAsync": {
return processAzureAsyncOperationResult(lroPrimitives, config.resourceLocation, lroResourceLocationConfig);
}
case "Location": {
return processLocationPollingOperationResult;
return processLocationPollingOperationResult(lroPrimitives, config.resourceLocation, lroResourceLocationConfig);
}
case "Body": {
return processBodyPollingOperationResult;
@@ -50427,7 +51585,8 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
return {
statusCode: error.statusCode,
result: null,
headers: {}
headers: {},
error
};
}
else {
+101 -44
View File
@@ -4,17 +4,22 @@
- [D - DUB](#d---dub)
- [POSIX](#posix)
- [Windows](#windows)
- [Elixir - Mix](#elixir---mix)
- [Go - Modules](#go---modules)
- [Deno](#deno)
- [Linux](#linux)
- [macOS](#macos)
- [Windows](#windows-1)
- [Elixir - Mix](#elixir---mix)
- [Go - Modules](#go---modules)
- [Linux](#linux-1)
- [macOS](#macos-1)
- [Windows](#windows-2)
- [Haskell - Cabal](#haskell---cabal)
- [Haskell - Stack](#haskell---stack)
- [Java - Gradle](#java---gradle)
- [Java - Maven](#java---maven)
- [Node - npm](#node---npm)
- [macOS and Ubuntu](#macos-and-ubuntu)
- [Windows](#windows-2)
- [Windows](#windows-3)
- [Using multiple systems and `npm config`](#using-multiple-systems-and-npm-config)
- [Node - Lerna](#node---lerna)
- [Node - Yarn](#node---yarn)
@@ -28,8 +33,6 @@
- [Using pip to get cache location](#using-pip-to-get-cache-location)
- [Python - pipenv](#python---pipenv)
- [R - renv](#r---renv)
- [Simple example](#simple-example-1)
- [Multiple OS's in a workflow](#multiple-oss-in-a-workflow-1)
- [Ruby - Bundler](#ruby---bundler)
- [Rust - Cargo](#rust---cargo)
- [Scala - SBT](#scala---sbt)
@@ -42,7 +45,7 @@
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -51,10 +54,10 @@ Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/packa
```
Depending on the environment, huge packages might be pre-installed in the global cache folder.
With `actions/cache@v2` you can now exclude unwanted packages with [exclude pattern](https://github.com/actions/toolkit/tree/main/packages/glob#exclude-patterns)
With `actions/cache@v3` you can now exclude unwanted packages with [exclude pattern](https://github.com/actions/toolkit/tree/main/packages/glob#exclude-patterns)
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.nuget/packages
@@ -66,11 +69,12 @@ With `actions/cache@v2` you can now exclude unwanted packages with [exclude patt
Or you could move the cache folder like below.
>Note: This workflow does not work for projects that require files to be placed in user profile package folder
```yaml
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -83,7 +87,7 @@ steps:
### POSIX
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.dub
key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.json') }}
@@ -94,7 +98,7 @@ steps:
### Windows
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~\AppData\Local\dub
key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.json') }}
@@ -102,10 +106,46 @@ steps:
${{ runner.os }}-dub-
```
## Deno
### Linux
```yaml
- uses: actions/cache@v3
with:
path: |
~/.deno
~/.cache/deno
key: ${{ runner.os }}-deno-${{ hashFiles('**/deps.ts') }}
```
### macOS
```yaml
- uses: actions/cache@v3
with:
path: |
~/.deno
~/Library/Caches/deno
key: ${{ runner.os }}-deno-${{ hashFiles('**/deps.ts') }}
```
### Windows
```yaml
- uses: actions/cache@v3
with:
path: |
~\.deno
%LocalAppData%\deno
key: ${{ runner.os }}-deno-${{ hashFiles('**/deps.ts') }}
```
## Elixir - Mix
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
deps
@@ -120,7 +160,7 @@ steps:
### Linux
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
@@ -133,7 +173,7 @@ steps:
### macOS
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/Library/Caches/go-build
@@ -146,11 +186,11 @@ steps:
### Windows
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
%LocalAppData%\go-build
~/go/pkg/mod
~\AppData\Local\go-build
~\go\pkg\mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
@@ -162,7 +202,7 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba
```yaml
- name: Cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.cabal/packages
@@ -172,12 +212,31 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
```
## Haskell - Stack
```yaml
- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-
- uses: actions/cache@v3
name: Cache .stack-work
with:
path: .stack-work
key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }}
restore-keys: |
${{ runner.os }}-stack-work-
```
## Java - Gradle
>Note: Ensure no Gradle daemons are running anymore when your workflow completes. Creating the cache package might fail due to locks being held by Gradle. Refer to the [Gradle Daemon documentation](https://docs.gradle.org/current/userguide/gradle_daemon.html) on how to disable or stop the Gradle Daemons.
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
@@ -191,7 +250,7 @@ We cache the elements of the Cabal store separately, as the entirety of `~/.caba
```yaml
- name: Cache local Maven repository
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -210,7 +269,7 @@ If using `npm config` to retrieve the cache directory, ensure you run [actions/s
### macOS and Ubuntu
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -225,7 +284,7 @@ If using `npm config` to retrieve the cache directory, ensure you run [actions/s
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -240,7 +299,7 @@ If using `npm config` to retrieve the cache directory, ensure you run [actions/s
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
- uses: actions/cache@v3
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
@@ -253,11 +312,9 @@ If using `npm config` to retrieve the cache directory, ensure you run [actions/s
```yaml
- name: restore lerna
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
node_modules
*/*/node_modules
path: **/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
```
@@ -269,7 +326,7 @@ The yarn cache directory will depend on your operating system and version of `ya
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -287,7 +344,7 @@ The yarn 2 cache directory will depend on your config. See https://yarnpkg.com/c
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -302,7 +359,7 @@ Esy allows you to export built dependencies and import pre-built dependencies.
```yaml
- name: Restore Cache
id: restore-cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: _export
key: ${{ runner.os }}-esy-${{ hashFiles('esy.lock/index.json') }}
@@ -331,7 +388,7 @@ Esy allows you to export built dependencies and import pre-built dependencies.
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -352,7 +409,7 @@ Locations:
### Simple example
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
@@ -365,7 +422,7 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu.
### Multiple OS's in a workflow
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
@@ -373,7 +430,7 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu.
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v2
- uses: actions/cache@v3
if: startsWith(runner.os, 'macOS')
with:
path: ~/Library/Caches/pip
@@ -381,7 +438,7 @@ Replace `~/.cache/pip` with the correct `path` if not using Ubuntu.
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v2
- uses: actions/cache@v3
if: startsWith(runner.os, 'Windows')
with:
path: ~\AppData\Local\pip\Cache
@@ -407,7 +464,7 @@ jobs:
- os: windows-latest
path: ~\AppData\Local\pip\Cache
steps:
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
@@ -425,7 +482,7 @@ jobs:
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
@@ -443,7 +500,7 @@ jobs:
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
@@ -470,7 +527,7 @@ For renv, the cache directory will vary by OS. The `RENV_PATHS_ROOT` environment
cat("##[set-output name=r-version;]", R.Version()$version.string, sep = "")
shell: Rscript {0}
- name: Restore Renv package cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{ inputs.cache-version }}-${{ hashFiles('renv.lock') }}
@@ -496,7 +553,7 @@ whenever possible:
## Rust - Cargo
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
@@ -511,7 +568,7 @@ whenever possible:
```yaml
- name: Cache SBT
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.ivy2/cache
@@ -522,7 +579,7 @@ whenever possible:
## Swift, Objective-C - Carthage
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: Carthage
key: ${{ runner.os }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
@@ -533,7 +590,7 @@ whenever possible:
## Swift, Objective-C - CocoaPods
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
@@ -544,7 +601,7 @@ whenever possible:
## Swift - Swift Package Manager
```yaml
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
+1118 -3266
View File
File diff suppressed because it is too large Load Diff
+15 -15
View File
@@ -1,6 +1,6 @@
{
"name": "cache",
"version": "2.1.7",
"version": "3.0.2",
"private": true,
"description": "Cache dependencies and build outputs",
"main": "dist/restore/index.js",
@@ -23,29 +23,29 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/cache": "file:actions-cache-1.0.9.tgz",
"@actions/cache": "^2.0.2",
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.1",
"@actions/io": "^1.1.0"
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.2"
},
"devDependencies": {
"@types/jest": "^27.4.0",
"@types/jest": "^27.4.1",
"@types/nock": "^11.1.0",
"@types/node": "^12.20.42",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"@types/node": "^16.11.26",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"@zeit/ncc": "^0.20.5",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.0.0",
"eslint-plugin-jest": "^26.1.3",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"jest": "^27.4.7",
"jest-circus": "^27.4.6",
"jest": "^27.5.1",
"jest-circus": "^27.5.1",
"nock": "^11.7.0",
"prettier": "^2.5.1",
"ts-jest": "^27.1.3",
"prettier": "^2.6.1",
"ts-jest": "^27.1.4",
"typescript": "^3.9.9"
}
}
+1 -4
View File
@@ -6,10 +6,7 @@ import * as utils from "./utils/actionUtils";
async function run(): Promise<void> {
try {
if (utils.isGhes()) {
utils.logWarning(
"Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details"
);
if (!utils.isCacheFeatureAvailable()) {
utils.setCacheHitOutput(false);
return;
}
+1 -4
View File
@@ -11,10 +11,7 @@ process.on("uncaughtException", e => utils.logWarning(e.message));
async function run(): Promise<void> {
try {
if (utils.isGhes()) {
utils.logWarning(
"Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details"
);
if (!utils.isCacheFeatureAvailable()) {
return;
}
+18
View File
@@ -1,3 +1,4 @@
import * as cache from "@actions/cache";
import * as core from "@actions/core";
import { Outputs, RefKey, State } from "../constants";
@@ -74,3 +75,20 @@ export function getInputAsInt(
}
return value;
}
export function isCacheFeatureAvailable(): boolean {
if (!cache.isFeatureAvailable()) {
if (isGhes()) {
logWarning(
"Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not."
);
} else {
logWarning(
"An internal error has occurred in cache backend. Please check https://www.githubstatus.com/ for any ongoing issue in actions."
);
}
return false;
}
return true;
}