@ms-cloudpack/remote-cache 0.5.0 → 0.5.1-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.
Files changed (87) hide show
  1. package/dist/AzureRemoteCacheClient-2PRAPCJH.js +52049 -0
  2. package/dist/AzureRemoteCacheClient-2PRAPCJH.js.map +7 -0
  3. package/dist/ReporterDecorator-BYNXV72I.js +126 -0
  4. package/dist/ReporterDecorator-BYNXV72I.js.map +7 -0
  5. package/dist/chunk-G3ME7OWS.js +49567 -0
  6. package/dist/chunk-G3ME7OWS.js.map +7 -0
  7. package/dist/chunk-GFT2G5UO.js +50 -0
  8. package/dist/chunk-GFT2G5UO.js.map +7 -0
  9. package/dist/chunk-KKZU5JW4.js +1071 -0
  10. package/dist/chunk-KKZU5JW4.js.map +7 -0
  11. package/dist/chunk-VVROC42R.js +182 -0
  12. package/dist/chunk-VVROC42R.js.map +7 -0
  13. package/dist/chunk-XKOU5VXX.js +9 -0
  14. package/dist/chunk-XKOU5VXX.js.map +7 -0
  15. package/dist/getCredential-MJEIGDVB.js +23981 -0
  16. package/dist/getCredential-MJEIGDVB.js.map +7 -0
  17. package/dist/getListOfBlobs-LKU62UR5.js +26 -0
  18. package/dist/getListOfBlobs-LKU62UR5.js.map +7 -0
  19. package/dist/index.js +93 -0
  20. package/dist/index.js.map +7 -0
  21. package/lib/decorators/InMemoryDecorator.test.d.ts +2 -0
  22. package/lib/decorators/RetryDecorator.test.d.ts +2 -0
  23. package/package.json +13 -12
  24. package/lib/AzureRemoteCacheClient.d.ts.map +0 -1
  25. package/lib/AzureRemoteCacheClient.js +0 -51
  26. package/lib/AzureRemoteCacheClient.js.map +0 -1
  27. package/lib/Task.d.ts.map +0 -1
  28. package/lib/Task.js +0 -2
  29. package/lib/Task.js.map +0 -1
  30. package/lib/authentication/getAuthenticationRecord.d.ts.map +0 -1
  31. package/lib/authentication/getAuthenticationRecord.js +0 -17
  32. package/lib/authentication/getAuthenticationRecord.js.map +0 -1
  33. package/lib/authentication/getAuthenticationRecordPath.d.ts.map +0 -1
  34. package/lib/authentication/getAuthenticationRecordPath.js +0 -10
  35. package/lib/authentication/getAuthenticationRecordPath.js.map +0 -1
  36. package/lib/authentication/getCredential.d.ts.map +0 -1
  37. package/lib/authentication/getCredential.js +0 -61
  38. package/lib/authentication/getCredential.js.map +0 -1
  39. package/lib/authentication/saveAuthenticationRecord.d.ts.map +0 -1
  40. package/lib/authentication/saveAuthenticationRecord.js +0 -17
  41. package/lib/authentication/saveAuthenticationRecord.js.map +0 -1
  42. package/lib/cache-persistance/cachePersistencePlugin.d.ts.map +0 -1
  43. package/lib/cache-persistance/cachePersistencePlugin.js +0 -35
  44. package/lib/cache-persistance/cachePersistencePlugin.js.map +0 -1
  45. package/lib/cache-persistance/platforms.d.ts.map +0 -1
  46. package/lib/cache-persistance/platforms.js +0 -109
  47. package/lib/cache-persistance/platforms.js.map +0 -1
  48. package/lib/cache-persistance/provider.d.ts.map +0 -1
  49. package/lib/cache-persistance/provider.js +0 -26
  50. package/lib/cache-persistance/provider.js.map +0 -1
  51. package/lib/createBlobStorageUrl.d.ts.map +0 -1
  52. package/lib/createBlobStorageUrl.js +0 -4
  53. package/lib/createBlobStorageUrl.js.map +0 -1
  54. package/lib/createRemoteCacheClient.d.ts.map +0 -1
  55. package/lib/createRemoteCacheClient.js +0 -27
  56. package/lib/createRemoteCacheClient.js.map +0 -1
  57. package/lib/decorators/InMemoryDecorator.d.ts.map +0 -1
  58. package/lib/decorators/InMemoryDecorator.js +0 -29
  59. package/lib/decorators/InMemoryDecorator.js.map +0 -1
  60. package/lib/decorators/ReporterDecorator.d.ts.map +0 -1
  61. package/lib/decorators/ReporterDecorator.js +0 -121
  62. package/lib/decorators/ReporterDecorator.js.map +0 -1
  63. package/lib/decorators/RetryDecorator.d.ts.map +0 -1
  64. package/lib/decorators/RetryDecorator.js +0 -27
  65. package/lib/decorators/RetryDecorator.js.map +0 -1
  66. package/lib/getListOfBlobs.d.ts.map +0 -1
  67. package/lib/getListOfBlobs.js +0 -15
  68. package/lib/getListOfBlobs.js.map +0 -1
  69. package/lib/index.d.ts.map +0 -1
  70. package/lib/index.js +0 -2
  71. package/lib/index.js.map +0 -1
  72. package/lib/retry/blockListIsInvalidRetryPolicy.d.ts.map +0 -1
  73. package/lib/retry/blockListIsInvalidRetryPolicy.js +0 -8
  74. package/lib/retry/blockListIsInvalidRetryPolicy.js.map +0 -1
  75. package/lib/tsdoc-metadata.json +0 -11
  76. package/lib/types/LoginMethod.d.ts.map +0 -1
  77. package/lib/types/LoginMethod.js +0 -2
  78. package/lib/types/LoginMethod.js.map +0 -1
  79. package/lib/types/RemoteCacheClient.d.ts.map +0 -1
  80. package/lib/types/RemoteCacheClient.js +0 -2
  81. package/lib/types/RemoteCacheClient.js.map +0 -1
  82. package/lib/types/RemoteCacheClientOptions.d.ts.map +0 -1
  83. package/lib/types/RemoteCacheClientOptions.js +0 -2
  84. package/lib/types/RemoteCacheClientOptions.js.map +0 -1
  85. package/lib/types/RetryPolicy.d.ts.map +0 -1
  86. package/lib/types/RetryPolicy.js +0 -2
  87. package/lib/types/RetryPolicy.js.map +0 -1
@@ -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,4 +0,0 @@
1
- export function createBlobStorageUrl(storageAccount) {
2
- return `https://${storageAccount}.blob.core.windows.net`;
3
- }
4
- //# sourceMappingURL=createBlobStorageUrl.js.map
@@ -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,EAAE,MAAM,6BAA6B,CAAC;AAC9E,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,mBAAmB;IAWrB,YAAY,CAAC,OAAO,EAAE,uCAAuC;IAiD7D,cAAc,CAAC,OAAO,EAAE,iCAAiC;CAiDhE"}
@@ -1,121 +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
- buildFailureMessage({ id, friendlyName, path }, error) {
24
- const list = bulletedList([
25
- `Id: ${id}`,
26
- `Path: ${path}`,
27
- `Name: ${friendlyName}`,
28
- `Error: ${error instanceof Error ? error.message : '<Unknown>'}`,
29
- ]);
30
- return `\n${list}`;
31
- }
32
- async uploadFolder(options) {
33
- const { id, path, friendlyName } = options;
34
- const task = this.context.reporter.addTask(`Uploading to remote cache: ${friendlyName}`);
35
- let uploadResult;
36
- try {
37
- uploadResult = await this.client.uploadFolder(options);
38
- }
39
- catch (e) {
40
- if (e instanceof Error) {
41
- reportError(this.context.telemetryClient, e);
42
- }
43
- task.complete({
44
- status: 'fail',
45
- message: this.buildFailureMessage(options, e),
46
- });
47
- throw e;
48
- }
49
- const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);
50
- switch (uploadResult) {
51
- case 'success':
52
- task.complete({
53
- status: 'complete',
54
- details,
55
- });
56
- break;
57
- case 'not-found':
58
- task.complete({
59
- status: 'skip',
60
- message: `Not found in the local cache.`,
61
- details,
62
- });
63
- break;
64
- case 'already-exist':
65
- task.complete({
66
- status: 'skip',
67
- message: `Package is already exist in the remote cache.`,
68
- details,
69
- });
70
- break;
71
- default:
72
- throw new Error(`Unknown upload result: ${uploadResult}`);
73
- }
74
- return uploadResult;
75
- }
76
- async downloadFolder(options) {
77
- const { id, path, friendlyName } = options;
78
- const task = this.context.reporter.addTask(`Downloading from remote cache: ${friendlyName}`);
79
- let downloadResult;
80
- try {
81
- downloadResult = await this.client.downloadFolder(options);
82
- }
83
- catch (e) {
84
- if (e instanceof Error) {
85
- reportError(this.context.telemetryClient, e);
86
- }
87
- task.complete({
88
- status: 'fail',
89
- message: this.buildFailureMessage(options, e),
90
- });
91
- throw e;
92
- }
93
- const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);
94
- switch (downloadResult) {
95
- case 'success':
96
- task.complete({
97
- status: 'complete',
98
- details,
99
- });
100
- break;
101
- case 'not-found':
102
- task.complete({
103
- status: 'skip',
104
- message: `Not found in the remote cache.`,
105
- details,
106
- });
107
- break;
108
- case 'already-exist':
109
- task.complete({
110
- status: 'skip',
111
- message: `Package is already exist in the local cache.`,
112
- details,
113
- });
114
- break;
115
- default:
116
- throw new Error(`Unknown download result: ${downloadResult}`);
117
- }
118
- return downloadResult;
119
- }
120
- }
121
- //# sourceMappingURL=ReporterDecorator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ReporterDecorator.js","sourceRoot":"","sources":["../../src/decorators/ReporterDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAQ9E,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,IAAI,mBAAmB,GAAY,KAAK,CAAC;AAEzC;;;;GAIG;AACH,SAAS,WAAW,CAAC,eAAgC,EAAE,KAAY;IACjE,MAAM,WAAW,GAAG,KAAK,YAAY,SAAS,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,CAAC;IAE3E,IAAI,WAAW,IAAI,mBAAmB,EAAE,CAAC;QACvC,OAAO,CAAC,uDAAuD;IACjE,CAAC;IAED,eAAe,CAAC,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAEhD,qDAAqD;IACrD,mBAAmB,GAAG,WAAW,CAAC;AACpC,CAAC;AAED,MAAM,OAAO,iBAAiB;IAC5B,YACmB,MAAyB,EACzB,OAGhB;QAJgB,WAAM,GAAN,MAAM,CAAmB;QACzB,YAAO,GAAP,OAAO,CAGvB;IACA,CAAC;IAEI,mBAAmB,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAqC,EAAE,KAAc;QACvG,MAAM,IAAI,GAAG,YAAY,CAAC;YACxB,OAAO,EAAE,EAAE;YACX,SAAS,IAAI,EAAE;YACf,SAAS,YAAY,EAAE;YACvB,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE;SACjE,CAAC,CAAC;QAEH,OAAO,KAAK,IAAI,EAAE,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAgD;QACjE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,8BAA8B,YAAY,EAAE,CAAC,CAAC;QAEzF,IAAI,YAA8C,CAAC;QAEnD,IAAI,CAAC;YACH,YAAY,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;gBACvB,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;YAC/C,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC;gBACZ,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC,CAAC;aAC9C,CAAC,CAAC;YACH,MAAM,CAAC,CAAC;QACV,CAAC;QAED,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,SAAS,IAAI,EAAE,EAAE,SAAS,YAAY,EAAE,CAAC,CAAC,CAAC;QAEtF,QAAQ,YAAY,EAAE,CAAC;YACrB,KAAK,SAAS;gBACZ,IAAI,CAAC,QAAQ,CAAC;oBACZ,MAAM,EAAE,UAAU;oBAClB,OAAO;iBACR,CAAC,CAAC;gBACH,MAAM;YACR,KAAK,WAAW;gBACd,IAAI,CAAC,QAAQ,CAAC;oBACZ,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,+BAA+B;oBACxC,OAAO;iBACR,CAAC,CAAC;gBACH,MAAM;YACR,KAAK,eAAe;gBAClB,IAAI,CAAC,QAAQ,CAAC;oBACZ,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,+CAA+C;oBACxD,OAAO;iBACR,CAAC,CAAC;gBACH,MAAM;YACR;gBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,YAAY,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAA0C;QAC7D,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,kCAAkC,YAAY,EAAE,CAAC,CAAC;QAE7F,IAAI,cAAgD,CAAC;QAErD,IAAI,CAAC;YACH,cAAc,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;gBACvB,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;YAC/C,CAAC;YAED,IAAI,CAAC,QAAQ,CAAC;gBACZ,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC,CAAC;aAC9C,CAAC,CAAC;YACH,MAAM,CAAC,CAAC;QACV,CAAC;QAED,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,SAAS,IAAI,EAAE,EAAE,SAAS,YAAY,EAAE,CAAC,CAAC,CAAC;QAEtF,QAAQ,cAAc,EAAE,CAAC;YACvB,KAAK,SAAS;gBACZ,IAAI,CAAC,QAAQ,CAAC;oBACZ,MAAM,EAAE,UAAU;oBAClB,OAAO;iBACR,CAAC,CAAC;gBACH,MAAM;YACR,KAAK,WAAW;gBACd,IAAI,CAAC,QAAQ,CAAC;oBACZ,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,gCAAgC;oBACzC,OAAO;iBACR,CAAC,CAAC;gBACH,MAAM;YACR,KAAK,eAAe;gBAClB,IAAI,CAAC,QAAQ,CAAC;oBACZ,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,8CAA8C;oBACvD,OAAO;iBACR,CAAC,CAAC;gBACH,MAAM;YACR;gBACE,MAAM,IAAI,KAAK,CAAC,4BAA4B,cAAc,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,cAAc,CAAC;IACxB,CAAC;CACF","sourcesContent":["import { bulletedList, type TaskReporter } 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 buildFailureMessage({ id, friendlyName, path }: RemoteCacheClientOperationOptions, error: unknown) {\n const list = bulletedList([\n `Id: ${id}`,\n `Path: ${path}`,\n `Name: ${friendlyName}`,\n `Error: ${error instanceof Error ? error.message : '<Unknown>'}`,\n ]);\n\n return `\\n${list}`;\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 if (e instanceof Error) {\n reportError(this.context.telemetryClient, e);\n }\n task.complete({\n status: 'fail',\n message: this.buildFailureMessage(options, e),\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 if (e instanceof Error) {\n reportError(this.context.telemetryClient, e);\n }\n\n task.complete({\n status: 'fail',\n message: this.buildFailureMessage(options, e),\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"}
@@ -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"]}
@@ -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
@@ -1,2 +0,0 @@
1
- export { createRemoteCacheClient } from './createRemoteCacheClient.js';
2
- //# sourceMappingURL=index.js.map
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"]}
@@ -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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=LoginMethod.js.map
@@ -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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RemoteCacheClient.js.map
@@ -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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RemoteCacheClientOptions.js.map
@@ -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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RetryPolicy.js.map
@@ -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"]}