@ms-cloudpack/remote-cache 0.5.2 → 0.5.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AzureRemoteCacheClient-R5HCIW6L.js +65 -0
- package/dist/ReporterDecorator-SNBYNGOT.js +134 -0
- package/dist/chunk-4P62L7ZZ.js +1530 -0
- package/dist/chunk-KFSFZYG6.js +49961 -0
- package/dist/chunk-R2VDVRDZ.js +15 -0
- package/dist/chunk-TQLTL4XO.js +65 -0
- package/dist/getCredential-QMMPE77Q.js +24525 -0
- package/dist/getListOfBlobs-E5OFG2MF.js +29 -0
- package/dist/index.js +109 -0
- package/lib/decorators/InMemoryDecorator.test.d.ts +2 -0
- package/lib/decorators/RetryDecorator.test.d.ts +2 -0
- package/package.json +13 -12
- package/lib/AzureRemoteCacheClient.d.ts.map +0 -1
- package/lib/AzureRemoteCacheClient.js +0 -51
- package/lib/AzureRemoteCacheClient.js.map +0 -1
- package/lib/Task.d.ts.map +0 -1
- package/lib/Task.js +0 -2
- package/lib/Task.js.map +0 -1
- package/lib/authentication/getAuthenticationRecord.d.ts.map +0 -1
- package/lib/authentication/getAuthenticationRecord.js +0 -17
- package/lib/authentication/getAuthenticationRecord.js.map +0 -1
- package/lib/authentication/getAuthenticationRecordPath.d.ts.map +0 -1
- package/lib/authentication/getAuthenticationRecordPath.js +0 -10
- package/lib/authentication/getAuthenticationRecordPath.js.map +0 -1
- package/lib/authentication/getCredential.d.ts.map +0 -1
- package/lib/authentication/getCredential.js +0 -61
- package/lib/authentication/getCredential.js.map +0 -1
- package/lib/authentication/saveAuthenticationRecord.d.ts.map +0 -1
- package/lib/authentication/saveAuthenticationRecord.js +0 -17
- package/lib/authentication/saveAuthenticationRecord.js.map +0 -1
- package/lib/cache-persistance/cachePersistencePlugin.d.ts +0 -32
- package/lib/cache-persistance/cachePersistencePlugin.d.ts.map +0 -1
- package/lib/cache-persistance/cachePersistencePlugin.js +0 -35
- package/lib/cache-persistance/cachePersistencePlugin.js.map +0 -1
- package/lib/cache-persistance/platforms.d.ts +0 -55
- package/lib/cache-persistance/platforms.d.ts.map +0 -1
- package/lib/cache-persistance/platforms.js +0 -109
- package/lib/cache-persistance/platforms.js.map +0 -1
- package/lib/cache-persistance/provider.d.ts +0 -15
- package/lib/cache-persistance/provider.d.ts.map +0 -1
- package/lib/cache-persistance/provider.js +0 -26
- package/lib/cache-persistance/provider.js.map +0 -1
- package/lib/createBlobStorageUrl.d.ts.map +0 -1
- package/lib/createBlobStorageUrl.js +0 -4
- package/lib/createBlobStorageUrl.js.map +0 -1
- package/lib/createRemoteCacheClient.d.ts.map +0 -1
- package/lib/createRemoteCacheClient.js +0 -27
- package/lib/createRemoteCacheClient.js.map +0 -1
- package/lib/decorators/InMemoryDecorator.d.ts.map +0 -1
- package/lib/decorators/InMemoryDecorator.js +0 -29
- package/lib/decorators/InMemoryDecorator.js.map +0 -1
- package/lib/decorators/ReporterDecorator.d.ts.map +0 -1
- package/lib/decorators/ReporterDecorator.js +0 -126
- package/lib/decorators/ReporterDecorator.js.map +0 -1
- package/lib/decorators/RetryDecorator.d.ts.map +0 -1
- package/lib/decorators/RetryDecorator.js +0 -27
- package/lib/decorators/RetryDecorator.js.map +0 -1
- package/lib/getListOfBlobs.d.ts.map +0 -1
- package/lib/getListOfBlobs.js +0 -15
- package/lib/getListOfBlobs.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -2
- package/lib/index.js.map +0 -1
- package/lib/retry/blockListIsInvalidRetryPolicy.d.ts.map +0 -1
- package/lib/retry/blockListIsInvalidRetryPolicy.js +0 -8
- package/lib/retry/blockListIsInvalidRetryPolicy.js.map +0 -1
- package/lib/tsdoc-metadata.json +0 -11
- package/lib/types/LoginMethod.d.ts.map +0 -1
- package/lib/types/LoginMethod.js +0 -2
- package/lib/types/LoginMethod.js.map +0 -1
- package/lib/types/RemoteCacheClient.d.ts.map +0 -1
- package/lib/types/RemoteCacheClient.js +0 -2
- package/lib/types/RemoteCacheClient.js.map +0 -1
- package/lib/types/RemoteCacheClientOptions.d.ts.map +0 -1
- package/lib/types/RemoteCacheClientOptions.js +0 -2
- package/lib/types/RemoteCacheClientOptions.js.map +0 -1
- package/lib/types/RetryPolicy.d.ts.map +0 -1
- package/lib/types/RetryPolicy.js +0 -2
- package/lib/types/RetryPolicy.js.map +0 -1
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence
|
|
3
|
-
*/
|
|
4
|
-
// Copyright (c) Microsoft Corporation.
|
|
5
|
-
// Licensed under the MIT license.
|
|
6
|
-
import * as path from 'path';
|
|
7
|
-
import { DataProtectionScope, FilePersistence, FilePersistenceWithDataProtection, KeychainPersistence, LibSecretPersistence, } from '@azure/msal-node-extensions';
|
|
8
|
-
/**
|
|
9
|
-
* Local application data folder
|
|
10
|
-
* Expected values:
|
|
11
|
-
* - Darwin: '/Users/user/'
|
|
12
|
-
* - Windows 8+: 'C:\Users\user\AppData\Local'
|
|
13
|
-
* - Linux: '/home/user/.local/share'
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
17
|
-
const localApplicationDataFolder = process.env.APPDATA?.replace?.(/(.Roaming)*$/, '\\Local') ?? process.env.HOME;
|
|
18
|
-
/**
|
|
19
|
-
* Dictionary of values that we use as default as we discover, pick and enable the persistence layer.
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export const defaultMsalValues = {
|
|
23
|
-
tokenCache: {
|
|
24
|
-
name: 'msal.cache',
|
|
25
|
-
// Expected values:
|
|
26
|
-
// - Darwin: '/Users/user/.IdentityService'
|
|
27
|
-
// - Windows 8+: 'C:\Users\user\AppData\Local\.IdentityService'
|
|
28
|
-
// - Linux: '/home/user/.IdentityService'
|
|
29
|
-
directory: path.join(localApplicationDataFolder, '.IdentityService'),
|
|
30
|
-
},
|
|
31
|
-
keyRing: {
|
|
32
|
-
label: 'MSALCache',
|
|
33
|
-
schema: 'msal.cache',
|
|
34
|
-
collection: 'default',
|
|
35
|
-
attributes: {
|
|
36
|
-
MsalClientID: 'Microsoft.Developer.IdentityService',
|
|
37
|
-
'Microsoft.Developer.IdentityService': '1.0.0.0',
|
|
38
|
-
},
|
|
39
|
-
service: 'Microsoft.Developer.IdentityService',
|
|
40
|
-
account: 'MSALCache',
|
|
41
|
-
},
|
|
42
|
-
keyChain: {
|
|
43
|
-
service: 'Microsoft.Developer.IdentityService',
|
|
44
|
-
account: 'MSALCache',
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Expected responses:
|
|
49
|
-
* - Darwin: '/Users/user/.IdentityService/<name>'
|
|
50
|
-
* - Windows 8+: 'C:\Users\user\AppData\Local\.IdentityService\<name>'
|
|
51
|
-
* - Linux: '/home/user/.IdentityService/<name>'
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
function getPersistencePath(name) {
|
|
55
|
-
return path.join(defaultMsalValues.tokenCache.directory, name);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Set of the platforms we attempt to deliver persistence on.
|
|
59
|
-
*
|
|
60
|
-
* - On Windows we use DPAPI.
|
|
61
|
-
* - On OSX (Darwin), we try to use the system's Keychain, otherwise if the property `unsafeAllowUnencryptedStorage` is set to true, we use an unencrypted file.
|
|
62
|
-
* - On Linux, we try to use the system's Keyring, otherwise if the property `unsafeAllowUnencryptedStorage` is set to true, we use an unencrypted file.
|
|
63
|
-
*
|
|
64
|
-
* Other platforms _are not supported_ at this time.
|
|
65
|
-
*
|
|
66
|
-
* @internal
|
|
67
|
-
*/
|
|
68
|
-
export const msalPersistencePlatforms = {
|
|
69
|
-
win32: ({ name = defaultMsalValues.tokenCache.name } = {}) => FilePersistenceWithDataProtection.create(getPersistencePath(name), DataProtectionScope.CurrentUser),
|
|
70
|
-
darwin: async (options = {}) => {
|
|
71
|
-
const { name, unsafeAllowUnencryptedStorage } = options;
|
|
72
|
-
const { service, account } = defaultMsalValues.keyChain;
|
|
73
|
-
const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);
|
|
74
|
-
try {
|
|
75
|
-
const persistence = await KeychainPersistence.create(persistencePath, service, account);
|
|
76
|
-
// If we don't encounter an error when trying to read from the keychain, then we should be good to go.
|
|
77
|
-
await persistence.load();
|
|
78
|
-
return persistence;
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
// If we got an error while trying to read from the keyring,
|
|
82
|
-
// we will proceed only if the user has specified that unencrypted storage is allowed.
|
|
83
|
-
if (!unsafeAllowUnencryptedStorage) {
|
|
84
|
-
throw new Error('Unable to read from the macOS Keychain.');
|
|
85
|
-
}
|
|
86
|
-
return FilePersistence.create(persistencePath);
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
linux: async (options = {}) => {
|
|
90
|
-
const { name, unsafeAllowUnencryptedStorage } = options;
|
|
91
|
-
const { service, account } = defaultMsalValues.keyRing;
|
|
92
|
-
const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);
|
|
93
|
-
try {
|
|
94
|
-
const persistence = await LibSecretPersistence.create(persistencePath, service, account);
|
|
95
|
-
// If we don't encounter an error when trying to read from the keyring, then we should be good to go.
|
|
96
|
-
await persistence.load();
|
|
97
|
-
return persistence;
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
// If we got an error while trying to read from the keyring,
|
|
101
|
-
// we will proceed only if the user has specified that unencrypted storage is allowed.
|
|
102
|
-
if (!unsafeAllowUnencryptedStorage) {
|
|
103
|
-
throw new Error('Unable to read from the system keyring (libsecret).');
|
|
104
|
-
}
|
|
105
|
-
return FilePersistence.create(persistencePath);
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
//# sourceMappingURL=platforms.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"platforms.js","sourceRoot":"","sources":["../../src/cache-persistance/platforms.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence\n */\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport * as path from 'path';\nimport {\n DataProtectionScope,\n FilePersistence,\n FilePersistenceWithDataProtection,\n KeychainPersistence,\n LibSecretPersistence,\n type IPersistence as Persistence,\n} from '@azure/msal-node-extensions';\nimport type { TokenCachePersistenceOptions } from '@azure/identity';\n\n/**\n * Local application data folder\n * Expected values:\n * - Darwin: '/Users/user/'\n * - Windows 8+: 'C:\\Users\\user\\AppData\\Local'\n * - Linux: '/home/user/.local/share'\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\nconst localApplicationDataFolder = process.env.APPDATA?.replace?.(/(.Roaming)*$/, '\\\\Local') ?? process.env.HOME!;\n\n/**\n * Dictionary of values that we use as default as we discover, pick and enable the persistence layer.\n * @internal\n */\nexport const defaultMsalValues = {\n tokenCache: {\n name: 'msal.cache',\n // Expected values:\n // - Darwin: '/Users/user/.IdentityService'\n // - Windows 8+: 'C:\\Users\\user\\AppData\\Local\\.IdentityService'\n // - Linux: '/home/user/.IdentityService'\n directory: path.join(localApplicationDataFolder, '.IdentityService'),\n },\n keyRing: {\n label: 'MSALCache',\n schema: 'msal.cache',\n collection: 'default',\n attributes: {\n MsalClientID: 'Microsoft.Developer.IdentityService',\n 'Microsoft.Developer.IdentityService': '1.0.0.0',\n },\n service: 'Microsoft.Developer.IdentityService',\n account: 'MSALCache',\n },\n keyChain: {\n service: 'Microsoft.Developer.IdentityService',\n account: 'MSALCache',\n },\n};\n\n/**\n * Options that are used by the underlying MSAL cache provider.\n * @internal\n */\nexport type MsalPersistenceOptions = Omit<TokenCachePersistenceOptions, 'enabled'>;\n\n/**\n * A function that returns a persistent token cache instance.\n * @internal\n */\ntype MsalPersistenceFactory = (options?: MsalPersistenceOptions) => Promise<Persistence>;\n\n/**\n * Expected responses:\n * - Darwin: '/Users/user/.IdentityService/<name>'\n * - Windows 8+: 'C:\\Users\\user\\AppData\\Local\\.IdentityService\\<name>'\n * - Linux: '/home/user/.IdentityService/<name>'\n * @internal\n */\nfunction getPersistencePath(name: string): string {\n return path.join(defaultMsalValues.tokenCache.directory, name);\n}\n\n/**\n * Set of the platforms we attempt to deliver persistence on.\n *\n * - On Windows we use DPAPI.\n * - On OSX (Darwin), we try to use the system's Keychain, otherwise if the property `unsafeAllowUnencryptedStorage` is set to true, we use an unencrypted file.\n * - On Linux, we try to use the system's Keyring, otherwise if the property `unsafeAllowUnencryptedStorage` is set to true, we use an unencrypted file.\n *\n * Other platforms _are not supported_ at this time.\n *\n * @internal\n */\nexport const msalPersistencePlatforms: Partial<Record<NodeJS.Platform, MsalPersistenceFactory>> = {\n win32: ({ name = defaultMsalValues.tokenCache.name } = {}): Promise<Persistence> =>\n FilePersistenceWithDataProtection.create(getPersistencePath(name), DataProtectionScope.CurrentUser),\n\n darwin: async (options: MsalPersistenceOptions = {}): Promise<Persistence> => {\n const { name, unsafeAllowUnencryptedStorage } = options;\n const { service, account } = defaultMsalValues.keyChain;\n const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);\n\n try {\n const persistence = await KeychainPersistence.create(persistencePath, service, account);\n // If we don't encounter an error when trying to read from the keychain, then we should be good to go.\n await persistence.load();\n return persistence;\n } catch {\n // If we got an error while trying to read from the keyring,\n // we will proceed only if the user has specified that unencrypted storage is allowed.\n if (!unsafeAllowUnencryptedStorage) {\n throw new Error('Unable to read from the macOS Keychain.');\n }\n return FilePersistence.create(persistencePath);\n }\n },\n\n linux: async (options: MsalPersistenceOptions = {}): Promise<Persistence> => {\n const { name, unsafeAllowUnencryptedStorage } = options;\n const { service, account } = defaultMsalValues.keyRing;\n const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);\n\n try {\n const persistence = await LibSecretPersistence.create(persistencePath, service, account);\n // If we don't encounter an error when trying to read from the keyring, then we should be good to go.\n await persistence.load();\n return persistence;\n } catch {\n // If we got an error while trying to read from the keyring,\n // we will proceed only if the user has specified that unencrypted storage is allowed.\n if (!unsafeAllowUnencryptedStorage) {\n throw new Error('Unable to read from the system keyring (libsecret).');\n }\n return FilePersistence.create(persistencePath);\n }\n },\n};\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence
|
|
3
|
-
*/
|
|
4
|
-
import type { MsalPersistenceOptions } from './platforms.js';
|
|
5
|
-
import type { IPersistence as Persistence } from '@azure/msal-node-extensions';
|
|
6
|
-
import type { ICachePlugin as CachePlugin } from '@azure/msal-node';
|
|
7
|
-
/**
|
|
8
|
-
* This is used to gain access to the underlying Persistence instance, which we use for testing
|
|
9
|
-
*
|
|
10
|
-
* @returns a raw persistence instance
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export declare function createPersistence(options: MsalPersistenceOptions): Promise<Persistence>;
|
|
14
|
-
export declare function createPersistenceCachePlugin(options?: MsalPersistenceOptions): Promise<CachePlugin>;
|
|
15
|
-
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/cache-persistance/provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,IAAI,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/E,OAAO,KAAK,EAAE,YAAY,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpE;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,CAQ7F;AAED,wBAAsB,4BAA4B,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,CAOzG"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence
|
|
3
|
-
*/
|
|
4
|
-
import { msalPersistencePlatforms } from './platforms.js';
|
|
5
|
-
import { PersistenceCachePlugin } from '@azure/msal-node-extensions';
|
|
6
|
-
/**
|
|
7
|
-
* This is used to gain access to the underlying Persistence instance, which we use for testing
|
|
8
|
-
*
|
|
9
|
-
* @returns a raw persistence instance
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export async function createPersistence(options) {
|
|
13
|
-
const persistence = await msalPersistencePlatforms[process.platform]?.(options);
|
|
14
|
-
if (persistence === undefined) {
|
|
15
|
-
throw new Error('no persistence providers are available on this platform');
|
|
16
|
-
}
|
|
17
|
-
return persistence;
|
|
18
|
-
}
|
|
19
|
-
export async function createPersistenceCachePlugin(options) {
|
|
20
|
-
const persistence = await createPersistence(options ?? {});
|
|
21
|
-
return new PersistenceCachePlugin(persistence, {
|
|
22
|
-
retryNumber: 100,
|
|
23
|
-
retryDelay: 50,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/cache-persistance/provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAA+B;IACrE,MAAM,WAAW,GAAG,MAAM,wBAAwB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;IAEhF,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,OAAgC;IACjF,MAAM,WAAW,GAAG,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAE3D,OAAO,IAAI,sBAAsB,CAAC,WAAW,EAAE;QAC7C,WAAW,EAAE,GAAG;QAChB,UAAU,EAAE,EAAE;KACf,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * This file is a fork of https://github.com/altinokdarici/azure-sdk-for-js/tree/main/sdk/identity/identity-cache-persistence\n */\n\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport type { MsalPersistenceOptions } from './platforms.js';\nimport { msalPersistencePlatforms } from './platforms.js';\nimport type { IPersistence as Persistence } from '@azure/msal-node-extensions';\nimport { PersistenceCachePlugin } from '@azure/msal-node-extensions';\nimport type { ICachePlugin as CachePlugin } from '@azure/msal-node';\n\n/**\n * This is used to gain access to the underlying Persistence instance, which we use for testing\n *\n * @returns a raw persistence instance\n * @internal\n */\nexport async function createPersistence(options: MsalPersistenceOptions): Promise<Persistence> {\n const persistence = await msalPersistencePlatforms[process.platform]?.(options);\n\n if (persistence === undefined) {\n throw new Error('no persistence providers are available on this platform');\n }\n\n return persistence;\n}\n\nexport async function createPersistenceCachePlugin(options?: MsalPersistenceOptions): Promise<CachePlugin> {\n const persistence = await createPersistence(options ?? {});\n\n return new PersistenceCachePlugin(persistence, {\n retryNumber: 100,\n retryDelay: 50,\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBlobStorageUrl.d.ts","sourceRoot":"","sources":["../src/createBlobStorageUrl.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,UAE1D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBlobStorageUrl.js","sourceRoot":"","sources":["../src/createBlobStorageUrl.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB,CAAC,cAAsB;IACzD,OAAO,WAAW,cAAc,wBAAwB,CAAC;AAC3D,CAAC","sourcesContent":["export function createBlobStorageUrl(storageAccount: string) {\n return `https://${storageAccount}.blob.core.windows.net`;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createRemoteCacheClient.d.ts","sourceRoot":"","sources":["../src/createRemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAMtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE;QACP,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,WAAW,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,YAAY,CAAC;QACvB,eAAe,EAAE,eAAe,CAAC;KAClC,CAAC;CACH;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAwB/G"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AzureRemoteCacheClient } from './AzureRemoteCacheClient.js';
|
|
2
|
-
import { InMemoryDecorator } from './decorators/InMemoryDecorator.js';
|
|
3
|
-
import { ReporterDecorator } from './decorators/ReporterDecorator.js';
|
|
4
|
-
import { getListOfBlobs } from './getListOfBlobs.js';
|
|
5
|
-
import { RetryDecorator } from './decorators/RetryDecorator.js';
|
|
6
|
-
import { blockListIsInvalidRetryPolicy } from './retry/blockListIsInvalidRetryPolicy.js';
|
|
7
|
-
import { RetryManager } from '@ms-cloudpack/retry';
|
|
8
|
-
import { getCredential } from './authentication/getCredential.js';
|
|
9
|
-
export async function createRemoteCacheClient(params) {
|
|
10
|
-
const { context, options } = params;
|
|
11
|
-
const { container, loginMethod, storageAccount, cachePath } = options;
|
|
12
|
-
const credential = await getCredential(loginMethod, cachePath);
|
|
13
|
-
const remoteCacheClientOptions = {
|
|
14
|
-
storageAccount,
|
|
15
|
-
container,
|
|
16
|
-
credential,
|
|
17
|
-
};
|
|
18
|
-
const client = new ReporterDecorator(new RetryDecorator({
|
|
19
|
-
retryManager: new RetryManager([blockListIsInvalidRetryPolicy]),
|
|
20
|
-
cacheClient: new InMemoryDecorator({
|
|
21
|
-
cacheClient: new AzureRemoteCacheClient(remoteCacheClientOptions),
|
|
22
|
-
getList: () => getListOfBlobs(remoteCacheClientOptions),
|
|
23
|
-
}),
|
|
24
|
-
}), context);
|
|
25
|
-
return client;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=createRemoteCacheClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createRemoteCacheClient.js","sourceRoot":"","sources":["../src/createRemoteCacheClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAiBlE,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,MAAqC;IACjF,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAEtE,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAE/D,MAAM,wBAAwB,GAA6B;QACzD,cAAc;QACd,SAAS;QACT,UAAU;KACX,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAClC,IAAI,cAAc,CAAC;QACjB,YAAY,EAAE,IAAI,YAAY,CAAC,CAAC,6BAA6B,CAAC,CAAC;QAC/D,WAAW,EAAE,IAAI,iBAAiB,CAAC;YACjC,WAAW,EAAE,IAAI,sBAAsB,CAAC,wBAAwB,CAAC;YACjE,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,wBAAwB,CAAC;SACxD,CAAC;KACH,CAAC,EACF,OAAO,CACR,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport { AzureRemoteCacheClient } from './AzureRemoteCacheClient.js';\nimport { InMemoryDecorator } from './decorators/InMemoryDecorator.js';\nimport { ReporterDecorator } from './decorators/ReporterDecorator.js';\nimport { getListOfBlobs } from './getListOfBlobs.js';\nimport type { RemoteCacheClient } from './types/RemoteCacheClient.js';\nimport { RetryDecorator } from './decorators/RetryDecorator.js';\nimport { blockListIsInvalidRetryPolicy } from './retry/blockListIsInvalidRetryPolicy.js';\nimport { RetryManager } from '@ms-cloudpack/retry';\nimport type { RemoteCacheClientOptions } from './types/RemoteCacheClientOptions.js';\nimport { getCredential } from './authentication/getCredential.js';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { LoginMethod } from './types/LoginMethod.js';\n\nexport interface CreateRemoteCacheClientParams {\n options: {\n storageAccount: string;\n container: string;\n loginMethod: LoginMethod;\n cachePath: string;\n };\n context: {\n reporter: TaskReporter;\n telemetryClient: TelemetryClient;\n };\n}\n\nexport async function createRemoteCacheClient(params: CreateRemoteCacheClientParams): Promise<RemoteCacheClient> {\n const { context, options } = params;\n const { container, loginMethod, storageAccount, cachePath } = options;\n\n const credential = await getCredential(loginMethod, cachePath);\n\n const remoteCacheClientOptions: RemoteCacheClientOptions = {\n storageAccount,\n container,\n credential,\n };\n\n const client = new ReporterDecorator(\n new RetryDecorator({\n retryManager: new RetryManager([blockListIsInvalidRetryPolicy]),\n cacheClient: new InMemoryDecorator({\n cacheClient: new AzureRemoteCacheClient(remoteCacheClientOptions),\n getList: () => getListOfBlobs(remoteCacheClientOptions),\n }),\n }),\n context,\n );\n\n return client;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InMemoryDecorator.d.ts","sourceRoot":"","sources":["../../src/decorators/InMemoryDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,uCAAuC,EACvC,iCAAiC,EACjC,gCAAgC,EACjC,MAAM,+BAA+B,CAAC;AAEvC;;GAEG;AACH,qBAAa,iBAAkB,YAAW,iBAAiB;IACzD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAuB;gBAEhC,OAAO,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAC;QAAC,OAAO,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;KAAE;IAKtF,YAAY,CAAC,OAAO,EAAE,uCAAuC,GAAG,OAAO,CAAC,gCAAgC,CAAC;IAgBzG,cAAc,CAAC,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,gCAAgC,CAAC;CAQ5G"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A decorator for a RemoteCacheClient that keeps a list of remote resources locally.
|
|
3
|
-
*/
|
|
4
|
-
export class InMemoryDecorator {
|
|
5
|
-
constructor(options) {
|
|
6
|
-
this.cacheClient = options.cacheClient;
|
|
7
|
-
this.list = options.getList();
|
|
8
|
-
}
|
|
9
|
-
async uploadFolder(options) {
|
|
10
|
-
if ((await this.list).has(options.id)) {
|
|
11
|
-
// This resource already exists in the remote cache, no need to upload it again.
|
|
12
|
-
return 'already-exist';
|
|
13
|
-
}
|
|
14
|
-
const result = await this.cacheClient.uploadFolder(options);
|
|
15
|
-
if (result === 'success') {
|
|
16
|
-
// The upload is successful, add the resource to the list.
|
|
17
|
-
(await this.list).add(options.id);
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
async downloadFolder(options) {
|
|
22
|
-
if (!(await this.list).has(options.id)) {
|
|
23
|
-
// This resource doesn't exist in the remote cache, can't download it.
|
|
24
|
-
return 'not-found';
|
|
25
|
-
}
|
|
26
|
-
return this.cacheClient.downloadFolder(options);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=InMemoryDecorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InMemoryDecorator.js","sourceRoot":"","sources":["../../src/decorators/InMemoryDecorator.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAI5B,YAAY,OAAgF;QAC1F,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAgD;QACjE,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;YACtC,gFAAgF;YAChF,OAAO,eAAe,CAAC;QACzB,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAE5D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,0DAA0D;YAC1D,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAA0C;QAC7D,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;YACvC,sEAAsE;YACtE,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;CACF","sourcesContent":["import type {\n RemoteCacheClient,\n RemoteCacheClientUploadOperationOptions,\n RemoteCacheClientOperationOptions,\n RemoteCacheClientOperationResult,\n} from '../types/RemoteCacheClient.js';\n\n/**\n * A decorator for a RemoteCacheClient that keeps a list of remote resources locally.\n */\nexport class InMemoryDecorator implements RemoteCacheClient {\n private readonly cacheClient: RemoteCacheClient;\n private readonly list: Promise<Set<string>>;\n\n constructor(options: { cacheClient: RemoteCacheClient; getList: () => Promise<Set<string>> }) {\n this.cacheClient = options.cacheClient;\n this.list = options.getList();\n }\n\n async uploadFolder(options: RemoteCacheClientUploadOperationOptions): Promise<RemoteCacheClientOperationResult> {\n if ((await this.list).has(options.id)) {\n // This resource already exists in the remote cache, no need to upload it again.\n return 'already-exist';\n }\n\n const result = await this.cacheClient.uploadFolder(options);\n\n if (result === 'success') {\n // The upload is successful, add the resource to the list.\n (await this.list).add(options.id);\n }\n\n return result;\n }\n\n async downloadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult> {\n if (!(await this.list).has(options.id)) {\n // This resource doesn't exist in the remote cache, can't download it.\n return 'not-found';\n }\n\n return this.cacheClient.downloadFolder(options);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReporterDecorator.d.ts","sourceRoot":"","sources":["../../src/decorators/ReporterDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,YAAY,EAA+B,MAAM,6BAA6B,CAAC;AAC3G,OAAO,KAAK,EACV,iBAAiB,EACjB,uCAAuC,EACvC,iCAAiC,EACjC,gCAAgC,EACjC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAuB/D,qBAAa,iBAAkB,YAAW,iBAAiB;IAEvD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE;QACxB,QAAQ,EAAE,YAAY,CAAC;QACvB,eAAe,EAAE,eAAe,CAAC;KAClC;IAGH,OAAO,CAAC,kBAAkB;IAuBpB,YAAY,CAAC,OAAO,EAAE,uCAAuC;IAgD7D,cAAc,CAAC,OAAO,EAAE,iCAAiC;CA+ChE"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { bulletedList } from '@ms-cloudpack/task-reporter';
|
|
2
|
-
import { RestError } from '@azure/storage-blob';
|
|
3
|
-
let isAuthErrorReported = false;
|
|
4
|
-
/**
|
|
5
|
-
* Reports an error to the telemetry client. If the error is an auth error, it will be reported only once.
|
|
6
|
-
* @param telemetryClient - The telemetry client to report the error to.
|
|
7
|
-
* @param error - The error to report.
|
|
8
|
-
*/
|
|
9
|
-
function reportError(telemetryClient, error) {
|
|
10
|
-
const isAuthError = error instanceof RestError && error.statusCode === 403;
|
|
11
|
-
if (isAuthError && isAuthErrorReported) {
|
|
12
|
-
return; // No need to proceed if auth error is already reported
|
|
13
|
-
}
|
|
14
|
-
telemetryClient.rootSpan.recordException(error);
|
|
15
|
-
// Set isAuthErrorReported only if it's an auth error
|
|
16
|
-
isAuthErrorReported = isAuthError;
|
|
17
|
-
}
|
|
18
|
-
export class ReporterDecorator {
|
|
19
|
-
constructor(client, context) {
|
|
20
|
-
this.client = client;
|
|
21
|
-
this.context = context;
|
|
22
|
-
}
|
|
23
|
-
buildFailureResult({ id, friendlyName, path }, error) {
|
|
24
|
-
const list = bulletedList([
|
|
25
|
-
`Id: ${id}`,
|
|
26
|
-
`Path: ${path}`,
|
|
27
|
-
`Name: ${friendlyName}`,
|
|
28
|
-
`Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
29
|
-
]);
|
|
30
|
-
const result = {
|
|
31
|
-
status: 'fail',
|
|
32
|
-
message: `\n${list}`,
|
|
33
|
-
};
|
|
34
|
-
if (error instanceof Error && error.stack) {
|
|
35
|
-
result.details = error.stack.includes(error.message) ? error.stack.split(error.message)[1] : error.stack;
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
async uploadFolder(options) {
|
|
40
|
-
const { id, path, friendlyName } = options;
|
|
41
|
-
const task = this.context.reporter.addTask(`Uploading to remote cache: ${friendlyName}`);
|
|
42
|
-
let uploadResult;
|
|
43
|
-
try {
|
|
44
|
-
uploadResult = await this.client.uploadFolder(options);
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
task.complete(this.buildFailureResult(options, e));
|
|
48
|
-
if (e instanceof Error) {
|
|
49
|
-
reportError(this.context.telemetryClient, e);
|
|
50
|
-
// Clear the stack since it was already included in the task details
|
|
51
|
-
e.stack = undefined;
|
|
52
|
-
}
|
|
53
|
-
throw e;
|
|
54
|
-
}
|
|
55
|
-
const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);
|
|
56
|
-
switch (uploadResult) {
|
|
57
|
-
case 'success':
|
|
58
|
-
task.complete({
|
|
59
|
-
status: 'complete',
|
|
60
|
-
details,
|
|
61
|
-
});
|
|
62
|
-
break;
|
|
63
|
-
case 'not-found':
|
|
64
|
-
task.complete({
|
|
65
|
-
status: 'skip',
|
|
66
|
-
message: `Not found in the local cache.`,
|
|
67
|
-
details,
|
|
68
|
-
});
|
|
69
|
-
break;
|
|
70
|
-
case 'already-exist':
|
|
71
|
-
task.complete({
|
|
72
|
-
status: 'skip',
|
|
73
|
-
message: `Package is already exist in the remote cache.`,
|
|
74
|
-
details,
|
|
75
|
-
});
|
|
76
|
-
break;
|
|
77
|
-
default:
|
|
78
|
-
throw new Error(`Unknown upload result: ${uploadResult}`);
|
|
79
|
-
}
|
|
80
|
-
return uploadResult;
|
|
81
|
-
}
|
|
82
|
-
async downloadFolder(options) {
|
|
83
|
-
const { id, path, friendlyName } = options;
|
|
84
|
-
const task = this.context.reporter.addTask(`Downloading from remote cache: ${friendlyName}`);
|
|
85
|
-
let downloadResult;
|
|
86
|
-
try {
|
|
87
|
-
downloadResult = await this.client.downloadFolder(options);
|
|
88
|
-
}
|
|
89
|
-
catch (e) {
|
|
90
|
-
task.complete(this.buildFailureResult(options, e));
|
|
91
|
-
if (e instanceof Error) {
|
|
92
|
-
reportError(this.context.telemetryClient, e);
|
|
93
|
-
// Clear the stack since it was already included in the task details
|
|
94
|
-
e.stack = undefined;
|
|
95
|
-
}
|
|
96
|
-
throw e;
|
|
97
|
-
}
|
|
98
|
-
const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);
|
|
99
|
-
switch (downloadResult) {
|
|
100
|
-
case 'success':
|
|
101
|
-
task.complete({
|
|
102
|
-
status: 'complete',
|
|
103
|
-
details,
|
|
104
|
-
});
|
|
105
|
-
break;
|
|
106
|
-
case 'not-found':
|
|
107
|
-
task.complete({
|
|
108
|
-
status: 'skip',
|
|
109
|
-
message: `Not found in the remote cache.`,
|
|
110
|
-
details,
|
|
111
|
-
});
|
|
112
|
-
break;
|
|
113
|
-
case 'already-exist':
|
|
114
|
-
task.complete({
|
|
115
|
-
status: 'skip',
|
|
116
|
-
message: `Package is already exist in the local cache.`,
|
|
117
|
-
details,
|
|
118
|
-
});
|
|
119
|
-
break;
|
|
120
|
-
default:
|
|
121
|
-
throw new Error(`Unknown download result: ${downloadResult}`);
|
|
122
|
-
}
|
|
123
|
-
return downloadResult;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
//# sourceMappingURL=ReporterDecorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReporterDecorator.js","sourceRoot":"","sources":["../../src/decorators/ReporterDecorator.ts"],"names":[],"mappings":"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","sourcesContent":["import { bulletedList, type TaskReporter, type TaskReporterTaskResult } from '@ms-cloudpack/task-reporter';\nimport type {\n RemoteCacheClient,\n RemoteCacheClientUploadOperationOptions,\n RemoteCacheClientOperationOptions,\n RemoteCacheClientOperationResult,\n} from '../types/RemoteCacheClient.js';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport { RestError } from '@azure/storage-blob';\n\nlet isAuthErrorReported: boolean = false;\n\n/**\n * Reports an error to the telemetry client. If the error is an auth error, it will be reported only once.\n * @param telemetryClient - The telemetry client to report the error to.\n * @param error - The error to report.\n */\nfunction reportError(telemetryClient: TelemetryClient, error: Error) {\n const isAuthError = error instanceof RestError && error.statusCode === 403;\n\n if (isAuthError && isAuthErrorReported) {\n return; // No need to proceed if auth error is already reported\n }\n\n telemetryClient.rootSpan.recordException(error);\n\n // Set isAuthErrorReported only if it's an auth error\n isAuthErrorReported = isAuthError;\n}\n\nexport class ReporterDecorator implements RemoteCacheClient {\n constructor(\n private readonly client: RemoteCacheClient,\n private readonly context: {\n reporter: TaskReporter;\n telemetryClient: TelemetryClient;\n },\n ) {}\n\n private buildFailureResult(\n { id, friendlyName, path }: RemoteCacheClientOperationOptions,\n error: unknown,\n ): TaskReporterTaskResult {\n const list = bulletedList([\n `Id: ${id}`,\n `Path: ${path}`,\n `Name: ${friendlyName}`,\n `Error: ${error instanceof Error ? error.message : String(error)}`,\n ]);\n\n const result: TaskReporterTaskResult = {\n status: 'fail',\n message: `\\n${list}`,\n };\n\n if (error instanceof Error && error.stack) {\n result.details = error.stack.includes(error.message) ? error.stack.split(error.message)[1] : error.stack;\n }\n\n return result;\n }\n\n async uploadFolder(options: RemoteCacheClientUploadOperationOptions) {\n const { id, path, friendlyName } = options;\n const task = this.context.reporter.addTask(`Uploading to remote cache: ${friendlyName}`);\n\n let uploadResult: RemoteCacheClientOperationResult;\n\n try {\n uploadResult = await this.client.uploadFolder(options);\n } catch (e) {\n task.complete(this.buildFailureResult(options, e));\n if (e instanceof Error) {\n reportError(this.context.telemetryClient, e);\n // Clear the stack since it was already included in the task details\n e.stack = undefined;\n }\n throw e;\n }\n\n const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);\n\n switch (uploadResult) {\n case 'success':\n task.complete({\n status: 'complete',\n details,\n });\n break;\n case 'not-found':\n task.complete({\n status: 'skip',\n message: `Not found in the local cache.`,\n details,\n });\n break;\n case 'already-exist':\n task.complete({\n status: 'skip',\n message: `Package is already exist in the remote cache.`,\n details,\n });\n break;\n default:\n throw new Error(`Unknown upload result: ${uploadResult}`);\n }\n\n return uploadResult;\n }\n\n async downloadFolder(options: RemoteCacheClientOperationOptions) {\n const { id, path, friendlyName } = options;\n const task = this.context.reporter.addTask(`Downloading from remote cache: ${friendlyName}`);\n\n let downloadResult: RemoteCacheClientOperationResult;\n\n try {\n downloadResult = await this.client.downloadFolder(options);\n } catch (e) {\n task.complete(this.buildFailureResult(options, e));\n if (e instanceof Error) {\n reportError(this.context.telemetryClient, e);\n // Clear the stack since it was already included in the task details\n e.stack = undefined;\n }\n throw e;\n }\n\n const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);\n\n switch (downloadResult) {\n case 'success':\n task.complete({\n status: 'complete',\n details,\n });\n break;\n case 'not-found':\n task.complete({\n status: 'skip',\n message: `Not found in the remote cache.`,\n details,\n });\n break;\n case 'already-exist':\n task.complete({\n status: 'skip',\n message: `Package is already exist in the local cache.`,\n details,\n });\n break;\n default:\n throw new Error(`Unknown download result: ${downloadResult}`);\n }\n\n return downloadResult;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RetryDecorator.d.ts","sourceRoot":"","sources":["../../src/decorators/RetryDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,uCAAuC,EACvC,iCAAiC,EACjC,gCAAgC,EACjC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,qBAAa,cAAe,YAAW,iBAAiB;IACtD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;gBAEhC,OAAO,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAC;QAAC,YAAY,EAAE,YAAY,CAAA;KAAE;IAKnF,OAAO,CAAC,iBAAiB;IAYnB,YAAY,CAAC,OAAO,EAAE,uCAAuC,GAAG,OAAO,CAAC,gCAAgC,CAAC;IAOzG,cAAc,CAAC,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,gCAAgC,CAAC;CAM5G"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A decorator that retries the upload/download operation if it fails.
|
|
3
|
-
*/
|
|
4
|
-
export class RetryDecorator {
|
|
5
|
-
constructor(options) {
|
|
6
|
-
this.cacheClient = options.cacheClient;
|
|
7
|
-
this.retryManager = options.retryManager;
|
|
8
|
-
}
|
|
9
|
-
printRetryContext(operationName, options, retryContext) {
|
|
10
|
-
if (retryContext) {
|
|
11
|
-
console.warn(`Retrying ${operationName} ${options.friendlyName} ... [${retryContext.retryAttempt}/${retryContext.maxRetries}]`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
async uploadFolder(options) {
|
|
15
|
-
return this.retryManager.retry((retryContext) => {
|
|
16
|
-
this.printRetryContext('upload', options, retryContext);
|
|
17
|
-
return this.cacheClient.uploadFolder(options);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async downloadFolder(options) {
|
|
21
|
-
return this.retryManager.retry((retryContext) => {
|
|
22
|
-
this.printRetryContext('download', options, retryContext);
|
|
23
|
-
return this.cacheClient.downloadFolder(options);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=RetryDecorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RetryDecorator.js","sourceRoot":"","sources":["../../src/decorators/RetryDecorator.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,OAAO,cAAc;IAIzB,YAAY,OAAuE;QACjF,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAC3C,CAAC;IAEO,iBAAiB,CACvB,aAAqB,EACrB,OAA0C,EAC1C,YAA2D;QAE3D,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,CAAC,IAAI,CACV,YAAY,aAAa,IAAI,OAAO,CAAC,YAAY,SAAS,YAAY,CAAC,YAAY,IAAI,YAAY,CAAC,UAAU,GAAG,CAClH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAgD;QACjE,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,EAAE;YAC9C,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAA0C;QAC7D,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,EAAE;YAC9C,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;YAC1D,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type {\n RemoteCacheClient,\n RemoteCacheClientUploadOperationOptions,\n RemoteCacheClientOperationOptions,\n RemoteCacheClientOperationResult,\n} from '../types/RemoteCacheClient.js';\nimport type { RetryManager } from '@ms-cloudpack/retry';\n\n/**\n * A decorator that retries the upload/download operation if it fails.\n */\nexport class RetryDecorator implements RemoteCacheClient {\n private readonly cacheClient: RemoteCacheClient;\n private readonly retryManager: RetryManager;\n\n constructor(options: { cacheClient: RemoteCacheClient; retryManager: RetryManager }) {\n this.cacheClient = options.cacheClient;\n this.retryManager = options.retryManager;\n }\n\n private printRetryContext(\n operationName: string,\n options: RemoteCacheClientOperationOptions,\n retryContext?: { retryAttempt: number; maxRetries: number },\n ) {\n if (retryContext) {\n console.warn(\n `Retrying ${operationName} ${options.friendlyName} ... [${retryContext.retryAttempt}/${retryContext.maxRetries}]`,\n );\n }\n }\n\n async uploadFolder(options: RemoteCacheClientUploadOperationOptions): Promise<RemoteCacheClientOperationResult> {\n return this.retryManager.retry((retryContext) => {\n this.printRetryContext('upload', options, retryContext);\n return this.cacheClient.uploadFolder(options);\n });\n }\n\n async downloadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult> {\n return this.retryManager.retry((retryContext) => {\n this.printRetryContext('download', options, retryContext);\n return this.cacheClient.downloadFolder(options);\n });\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getListOfBlobs.d.ts","sourceRoot":"","sources":["../src/getListOfBlobs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAGpF;;GAEG;AACH,wBAAsB,cAAc,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,wBAAwB,wBAQvG"}
|
package/lib/getListOfBlobs.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createBlobStorageUrl } from './createBlobStorageUrl.js';
|
|
2
|
-
import { BlobServiceClient } from '@azure/storage-blob';
|
|
3
|
-
/**
|
|
4
|
-
* Gets all the blobs in the remote cache.
|
|
5
|
-
*/
|
|
6
|
-
export async function getListOfBlobs({ container, storageAccount, credential }) {
|
|
7
|
-
const blobStorageClient = new BlobServiceClient(createBlobStorageUrl(storageAccount), credential);
|
|
8
|
-
const containerClient = blobStorageClient.getContainerClient(container);
|
|
9
|
-
const blobs = new Set();
|
|
10
|
-
for await (const blob of containerClient.listBlobsFlat()) {
|
|
11
|
-
blobs.add(blob.name);
|
|
12
|
-
}
|
|
13
|
-
return blobs;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=getListOfBlobs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getListOfBlobs.js","sourceRoot":"","sources":["../src/getListOfBlobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAA4B;IACtG,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,oBAAoB,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;IAClG,MAAM,eAAe,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACxE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,eAAe,CAAC,aAAa,EAAE,EAAE,CAAC;QACzD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { createBlobStorageUrl } from './createBlobStorageUrl.js';\nimport type { RemoteCacheClientOptions } from './types/RemoteCacheClientOptions.js';\nimport { BlobServiceClient } from '@azure/storage-blob';\n\n/**\n * Gets all the blobs in the remote cache.\n */\nexport async function getListOfBlobs({ container, storageAccount, credential }: RemoteCacheClientOptions) {\n const blobStorageClient = new BlobServiceClient(createBlobStorageUrl(storageAccount), credential);\n const containerClient = blobStorageClient.getContainerClient(container);\n const blobs = new Set<string>();\n for await (const blob of containerClient.listBlobsFlat()) {\n blobs.add(blob.name);\n }\n return blobs;\n}\n"]}
|
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,KAAK,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAE3G,YAAY,EACV,iBAAiB,EACjB,uCAAuC,IAAI,yCAAyC,EACpF,iCAAiC,EACjC,gCAAgC,GACjC,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC"}
|
package/lib/index.js
DELETED
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAsC,MAAM,8BAA8B,CAAC","sourcesContent":["export { createRemoteCacheClient, type CreateRemoteCacheClientParams } from './createRemoteCacheClient.js';\n\nexport type {\n RemoteCacheClient,\n RemoteCacheClientUploadOperationOptions as RemoteCacheClientDownloadOperationOptions,\n RemoteCacheClientOperationOptions,\n RemoteCacheClientOperationResult,\n} from './types/RemoteCacheClient.js';\nexport type { LoginMethod } from './types/LoginMethod.js';\nexport type { RemoteCacheClientOptions } from './types/RemoteCacheClientOptions.js';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blockListIsInvalidRetryPolicy.d.ts","sourceRoot":"","sources":["../../src/retry/blockListIsInvalidRetryPolicy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,eAAO,MAAM,6BAA6B,EAAE,WAM3C,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const blockListIsInvalidRetryPolicy = {
|
|
2
|
-
maxRetries: 1,
|
|
3
|
-
handle: (error) => {
|
|
4
|
-
return error instanceof Error && error.message.indexOf('The specified block list is invalid.') > -1;
|
|
5
|
-
},
|
|
6
|
-
wait: () => 0,
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=blockListIsInvalidRetryPolicy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blockListIsInvalidRetryPolicy.js","sourceRoot":"","sources":["../../src/retry/blockListIsInvalidRetryPolicy.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,6BAA6B,GAAgB;IACxD,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;QAChB,OAAO,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,sCAAsC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtG,CAAC;IACD,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;CACd,CAAC","sourcesContent":["import type { RetryPolicy } from '../types/RetryPolicy.js';\n\nexport const blockListIsInvalidRetryPolicy: RetryPolicy = {\n maxRetries: 1,\n handle: (error) => {\n return error instanceof Error && error.message.indexOf('The specified block list is invalid.') > -1;\n },\n wait: () => 0,\n};\n"]}
|
package/lib/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.39.4"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoginMethod.d.ts","sourceRoot":"","sources":["../../src/types/LoginMethod.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,WAAW,GAAG,aAAa,CAAC"}
|
package/lib/types/LoginMethod.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoginMethod.js","sourceRoot":"","sources":["../../src/types/LoginMethod.ts"],"names":[],"mappings":"","sourcesContent":["export type LoginMethod = 'interactive' | 'azure-cli' | 'device-code';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteCacheClient.d.ts","sourceRoot":"","sources":["../../src/types/RemoteCacheClient.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gCAAgC,GAAG,SAAS,GAAG,WAAW,GAAG,eAAe,CAAC;AAEzF,MAAM,WAAW,iCAAiC;IAChD;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uCAAwC,SAAQ,iCAAiC;IAChG,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,OAAO,EAAE,uCAAuC,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAC1G,cAAc,CAAC,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;CACvG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteCacheClient.js","sourceRoot":"","sources":["../../src/types/RemoteCacheClient.ts"],"names":[],"mappings":"","sourcesContent":["export type RemoteCacheClientOperationResult = 'success' | 'not-found' | 'already-exist';\n\nexport interface RemoteCacheClientOperationOptions {\n /**\n * The unique identifier of the asset\n */\n id: string;\n\n /**\n * Local path to the asset\n */\n path: string;\n\n /**\n * The friendly name of the asset to be used in logs\n */\n friendlyName: string;\n}\n\nexport interface RemoteCacheClientUploadOperationOptions extends RemoteCacheClientOperationOptions {\n globMatches: string[];\n}\n\nexport interface RemoteCacheClient {\n uploadFolder(options: RemoteCacheClientUploadOperationOptions): Promise<RemoteCacheClientOperationResult>;\n downloadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult>;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteCacheClientOptions.d.ts","sourceRoot":"","sources":["../../src/types/RemoteCacheClientOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,eAAe,CAAC;CAC7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteCacheClientOptions.js","sourceRoot":"","sources":["../../src/types/RemoteCacheClientOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { TokenCredential } from '@azure/identity';\n\nexport interface RemoteCacheClientOptions {\n storageAccount: string;\n container: string;\n credential: TokenCredential;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RetryPolicy.d.ts","sourceRoot":"","sources":["../../src/types/RetryPolicy.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IAEpC;;OAEG;IACH,IAAI,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC,CAAC"}
|
package/lib/types/RetryPolicy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RetryPolicy.js","sourceRoot":"","sources":["../../src/types/RetryPolicy.ts"],"names":[],"mappings":"","sourcesContent":["export type RetryPolicy = {\n /**\n * The maximum number of retries.\n */\n maxRetries: number;\n\n /**\n * Given the error, return true if the operation should be handled by this policy.\n */\n handle: (error: unknown) => boolean;\n\n /**\n * Given the retry attempt, return the number of milliseconds to wait before retrying.\n */\n wait: (retryAttempt: number) => number;\n};\n"]}
|