@ms-cloudpack/remote-cache 0.4.6 → 0.5.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/lib/AzureRemoteCacheClient.d.ts +5 -5
- package/lib/AzureRemoteCacheClient.d.ts.map +1 -1
- package/lib/AzureRemoteCacheClient.js +6 -6
- package/lib/AzureRemoteCacheClient.js.map +1 -1
- package/lib/decorators/InMemoryDecorator.d.ts +2 -2
- package/lib/decorators/InMemoryDecorator.d.ts.map +1 -1
- package/lib/decorators/InMemoryDecorator.js +3 -3
- package/lib/decorators/InMemoryDecorator.js.map +1 -1
- package/lib/decorators/ReporterDecorator.d.ts +2 -2
- package/lib/decorators/ReporterDecorator.d.ts.map +1 -1
- package/lib/decorators/ReporterDecorator.js +6 -6
- package/lib/decorators/ReporterDecorator.js.map +1 -1
- package/lib/decorators/RetryDecorator.d.ts +2 -2
- package/lib/decorators/RetryDecorator.d.ts.map +1 -1
- package/lib/decorators/RetryDecorator.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/types/RemoteCacheClient.d.ts +12 -3
- package/lib/types/RemoteCacheClient.d.ts.map +1 -1
- package/lib/types/RemoteCacheClient.js.map +1 -1
- package/package.json +3 -4
- package/lib/types/PackageToSync.d.ts +0 -7
- package/lib/types/PackageToSync.d.ts.map +0 -1
- package/lib/types/PackageToSync.js +0 -2
- package/lib/types/PackageToSync.js.map +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import type { RemoteCacheClientOptions } from './types/RemoteCacheClientOptions.js';
|
|
2
|
-
import type { RemoteCacheClient, RemoteCacheClientOperationOptions,
|
|
2
|
+
import type { RemoteCacheClient, RemoteCacheClientOperationOptions, RemoteCacheClientUploadOperationOptions } from './types/RemoteCacheClient.js';
|
|
3
3
|
export declare class AzureRemoteCacheClient implements RemoteCacheClient {
|
|
4
4
|
private readonly logger;
|
|
5
5
|
private readonly config;
|
|
6
6
|
constructor({ container, storageAccount, credential }: RemoteCacheClientOptions);
|
|
7
7
|
/**
|
|
8
8
|
* Uploads the folder to the remote cache.
|
|
9
|
-
* @param
|
|
9
|
+
* @param id - The unique identifier of the asset to upload.
|
|
10
10
|
* @param path - The path to the folder to upload.
|
|
11
11
|
* @param globMatches - The glob pattern to use when uploading the folder.
|
|
12
12
|
* @returns - A promise that resolves when the folder has been uploaded.
|
|
13
13
|
*/
|
|
14
|
-
uploadFolder({
|
|
14
|
+
uploadFolder({ id, path, globMatches }: RemoteCacheClientUploadOperationOptions): Promise<"success" | "not-found">;
|
|
15
15
|
/**
|
|
16
16
|
* Downloads the folder from the remote cache.
|
|
17
|
-
* @param
|
|
17
|
+
* @param id - The unique identifier of the asset to download.
|
|
18
18
|
* @param path - The path to download the folder to.
|
|
19
19
|
* @returns - A promise that resolves when the folder has been downloaded.
|
|
20
20
|
*/
|
|
21
|
-
downloadFolder({
|
|
21
|
+
downloadFolder({ id, path }: RemoteCacheClientOperationOptions): Promise<"success" | "not-found" | "already-exist">;
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=AzureRemoteCacheClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureRemoteCacheClient.d.ts","sourceRoot":"","sources":["../src/AzureRemoteCacheClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAGpF,OAAO,KAAK,EACV,iBAAiB,EACjB,iCAAiC,EACjC,
|
|
1
|
+
{"version":3,"file":"AzureRemoteCacheClient.d.ts","sourceRoot":"","sources":["../src/AzureRemoteCacheClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAGpF,OAAO,KAAK,EACV,iBAAiB,EACjB,iCAAiC,EACjC,uCAAuC,EACxC,MAAM,8BAA8B,CAAC;AAGtC,qBAAa,sBAAuB,YAAW,iBAAiB;IAC9D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsD;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAIrB;gBAEU,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,wBAAwB;IAe/E;;;;;;OAMG;IACG,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,uCAAuC;IASrF;;;;;OAKG;IACG,cAAc,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,iCAAiC;CAYrE"}
|
|
@@ -19,29 +19,29 @@ export class AzureRemoteCacheClient {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Uploads the folder to the remote cache.
|
|
22
|
-
* @param
|
|
22
|
+
* @param id - The unique identifier of the asset to upload.
|
|
23
23
|
* @param path - The path to the folder to upload.
|
|
24
24
|
* @param globMatches - The glob pattern to use when uploading the folder.
|
|
25
25
|
* @returns - A promise that resolves when the folder has been uploaded.
|
|
26
26
|
*/
|
|
27
|
-
async uploadFolder({
|
|
27
|
+
async uploadFolder({ id, path, globMatches }) {
|
|
28
28
|
if (!existsSync(path)) {
|
|
29
29
|
return 'not-found';
|
|
30
30
|
}
|
|
31
|
-
await put(path,
|
|
31
|
+
await put(path, id, this.logger, { ...this.config, outputGlob: globMatches });
|
|
32
32
|
return 'success';
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Downloads the folder from the remote cache.
|
|
36
|
-
* @param
|
|
36
|
+
* @param id - The unique identifier of the asset to download.
|
|
37
37
|
* @param path - The path to download the folder to.
|
|
38
38
|
* @returns - A promise that resolves when the folder has been downloaded.
|
|
39
39
|
*/
|
|
40
|
-
async downloadFolder({
|
|
40
|
+
async downloadFolder({ id, path }) {
|
|
41
41
|
if (existsSync(path)) {
|
|
42
42
|
return 'already-exist';
|
|
43
43
|
}
|
|
44
|
-
const result = await fetch(path,
|
|
44
|
+
const result = await fetch(path, id, this.logger, this.config);
|
|
45
45
|
if (!result) {
|
|
46
46
|
return 'not-found';
|
|
47
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureRemoteCacheClient.js","sourceRoot":"","sources":["../src/AzureRemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAMhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,OAAO,sBAAsB;IAQjC,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAA4B;QAP9D,WAAM,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAQ3E,IAAI,CAAC,MAAM,GAAG;YACZ,kBAAkB,EAAE,IAAI;YACxB,mBAAmB,EAAE,EAAE,EAAE,yBAAyB;YAClD,kBAAkB,EAAE;gBAClB,QAAQ,EAAE,YAAY;gBACtB,OAAO,EAAE;oBACP,gBAAgB,EAAE,oBAAoB,CAAC,cAAc,CAAC;oBACtD,UAAU;oBACV,SAAS;iBACV;aACF;SACF,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,YAAY,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"AzureRemoteCacheClient.js","sourceRoot":"","sources":["../src/AzureRemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAMhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,OAAO,sBAAsB;IAQjC,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAA4B;QAP9D,WAAM,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAQ3E,IAAI,CAAC,MAAM,GAAG;YACZ,kBAAkB,EAAE,IAAI;YACxB,mBAAmB,EAAE,EAAE,EAAE,yBAAyB;YAClD,kBAAkB,EAAE;gBAClB,QAAQ,EAAE,YAAY;gBACtB,OAAO,EAAE;oBACP,gBAAgB,EAAE,oBAAoB,CAAC,cAAc,CAAC;oBACtD,UAAU;oBACV,SAAS;iBACV;aACF;SACF,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAA2C;QACnF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACtB,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC;QAC9E,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,IAAI,EAAqC;QAClE,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,OAAO,eAAe,CAAC;QACzB,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["import { makeLogger, put, fetch } from 'backfill/lib/api.js';\nimport type { RemoteCacheClientOptions } from './types/RemoteCacheClientOptions.js';\nimport type { AzureBlobCacheStorageConfig } from 'backfill-config';\nimport { existsSync } from 'fs';\nimport type {\n RemoteCacheClient,\n RemoteCacheClientOperationOptions,\n RemoteCacheClientUploadOperationOptions,\n} from './types/RemoteCacheClient.js';\nimport { createBlobStorageUrl } from './createBlobStorageUrl.js';\n\nexport class AzureRemoteCacheClient implements RemoteCacheClient {\n private readonly logger = makeLogger('mute', process.stdout, process.stderr);\n private readonly config: {\n cacheStorageConfig: AzureBlobCacheStorageConfig;\n incrementalCaching: boolean;\n internalCacheFolder: string;\n };\n\n constructor({ container, storageAccount, credential }: RemoteCacheClientOptions) {\n this.config = {\n incrementalCaching: true,\n internalCacheFolder: '', // not used by azure-blob\n cacheStorageConfig: {\n provider: 'azure-blob',\n options: {\n connectionString: createBlobStorageUrl(storageAccount),\n credential,\n container,\n },\n },\n };\n }\n\n /**\n * Uploads the folder to the remote cache.\n * @param id - The unique identifier of the asset to upload.\n * @param path - The path to the folder to upload.\n * @param globMatches - The glob pattern to use when uploading the folder.\n * @returns - A promise that resolves when the folder has been uploaded.\n */\n async uploadFolder({ id, path, globMatches }: RemoteCacheClientUploadOperationOptions) {\n if (!existsSync(path)) {\n return 'not-found';\n }\n\n await put(path, id, this.logger, { ...this.config, outputGlob: globMatches });\n return 'success';\n }\n\n /**\n * Downloads the folder from the remote cache.\n * @param id - The unique identifier of the asset to download.\n * @param path - The path to download the folder to.\n * @returns - A promise that resolves when the folder has been downloaded.\n */\n async downloadFolder({ id, path }: RemoteCacheClientOperationOptions) {\n if (existsSync(path)) {\n return 'already-exist';\n }\n\n const result = await fetch(path, id, this.logger, this.config);\n if (!result) {\n return 'not-found';\n }\n\n return 'success';\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RemoteCacheClient,
|
|
1
|
+
import type { RemoteCacheClient, RemoteCacheClientUploadOperationOptions, RemoteCacheClientOperationOptions, RemoteCacheClientOperationResult } from '../types/RemoteCacheClient.js';
|
|
2
2
|
/**
|
|
3
3
|
* A decorator for a RemoteCacheClient that keeps a list of remote resources locally.
|
|
4
4
|
*/
|
|
@@ -9,7 +9,7 @@ export declare class InMemoryDecorator implements RemoteCacheClient {
|
|
|
9
9
|
cacheClient: RemoteCacheClient;
|
|
10
10
|
getList: () => Promise<Set<string>>;
|
|
11
11
|
});
|
|
12
|
-
uploadFolder(options:
|
|
12
|
+
uploadFolder(options: RemoteCacheClientUploadOperationOptions): Promise<RemoteCacheClientOperationResult>;
|
|
13
13
|
downloadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult>;
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=InMemoryDecorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InMemoryDecorator.d.ts","sourceRoot":"","sources":["../../src/decorators/InMemoryDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,
|
|
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"}
|
|
@@ -7,19 +7,19 @@ export class InMemoryDecorator {
|
|
|
7
7
|
this.list = options.getList();
|
|
8
8
|
}
|
|
9
9
|
async uploadFolder(options) {
|
|
10
|
-
if ((await this.list).has(options.
|
|
10
|
+
if ((await this.list).has(options.id)) {
|
|
11
11
|
// This resource already exists in the remote cache, no need to upload it again.
|
|
12
12
|
return 'already-exist';
|
|
13
13
|
}
|
|
14
14
|
const result = await this.cacheClient.uploadFolder(options);
|
|
15
15
|
if (result === 'success') {
|
|
16
16
|
// The upload is successful, add the resource to the list.
|
|
17
|
-
(await this.list).add(options.
|
|
17
|
+
(await this.list).add(options.id);
|
|
18
18
|
}
|
|
19
19
|
return result;
|
|
20
20
|
}
|
|
21
21
|
async downloadFolder(options) {
|
|
22
|
-
if (!(await this.list).has(options.
|
|
22
|
+
if (!(await this.list).has(options.id)) {
|
|
23
23
|
// This resource doesn't exist in the remote cache, can't download it.
|
|
24
24
|
return 'not-found';
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import { type TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
2
|
-
import type { RemoteCacheClient,
|
|
2
|
+
import type { RemoteCacheClient, RemoteCacheClientUploadOperationOptions, RemoteCacheClientOperationOptions, RemoteCacheClientOperationResult } from '../types/RemoteCacheClient.js';
|
|
3
3
|
import type { TelemetryClient } from '@ms-cloudpack/telemetry';
|
|
4
4
|
export declare class ReporterDecorator implements RemoteCacheClient {
|
|
5
5
|
private readonly client;
|
|
@@ -9,7 +9,7 @@ export declare class ReporterDecorator implements RemoteCacheClient {
|
|
|
9
9
|
telemetryClient: TelemetryClient;
|
|
10
10
|
});
|
|
11
11
|
private buildFailureMessage;
|
|
12
|
-
uploadFolder(options:
|
|
12
|
+
uploadFolder(options: RemoteCacheClientUploadOperationOptions): Promise<RemoteCacheClientOperationResult>;
|
|
13
13
|
downloadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult>;
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=ReporterDecorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
|
@@ -20,9 +20,9 @@ export class ReporterDecorator {
|
|
|
20
20
|
this.client = client;
|
|
21
21
|
this.context = context;
|
|
22
22
|
}
|
|
23
|
-
buildFailureMessage({
|
|
23
|
+
buildFailureMessage({ id, friendlyName, path }, error) {
|
|
24
24
|
const list = bulletedList([
|
|
25
|
-
`
|
|
25
|
+
`Id: ${id}`,
|
|
26
26
|
`Path: ${path}`,
|
|
27
27
|
`Name: ${friendlyName}`,
|
|
28
28
|
`Error: ${error instanceof Error ? error.message : '<Unknown>'}`,
|
|
@@ -30,7 +30,7 @@ export class ReporterDecorator {
|
|
|
30
30
|
return `\n${list}`;
|
|
31
31
|
}
|
|
32
32
|
async uploadFolder(options) {
|
|
33
|
-
const {
|
|
33
|
+
const { id, path, friendlyName } = options;
|
|
34
34
|
const task = this.context.reporter.addTask(`Uploading to remote cache: ${friendlyName}`);
|
|
35
35
|
let uploadResult;
|
|
36
36
|
try {
|
|
@@ -46,7 +46,7 @@ export class ReporterDecorator {
|
|
|
46
46
|
});
|
|
47
47
|
throw e;
|
|
48
48
|
}
|
|
49
|
-
const details = bulletedList([`
|
|
49
|
+
const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);
|
|
50
50
|
switch (uploadResult) {
|
|
51
51
|
case 'success':
|
|
52
52
|
task.complete({
|
|
@@ -74,7 +74,7 @@ export class ReporterDecorator {
|
|
|
74
74
|
return uploadResult;
|
|
75
75
|
}
|
|
76
76
|
async downloadFolder(options) {
|
|
77
|
-
const {
|
|
77
|
+
const { id, path, friendlyName } = options;
|
|
78
78
|
const task = this.context.reporter.addTask(`Downloading from remote cache: ${friendlyName}`);
|
|
79
79
|
let downloadResult;
|
|
80
80
|
try {
|
|
@@ -90,7 +90,7 @@ export class ReporterDecorator {
|
|
|
90
90
|
});
|
|
91
91
|
throw e;
|
|
92
92
|
}
|
|
93
|
-
const details = bulletedList([`
|
|
93
|
+
const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);
|
|
94
94
|
switch (downloadResult) {
|
|
95
95
|
case 'success':
|
|
96
96
|
task.complete({
|
|
@@ -1 +1 @@
|
|
|
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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;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,4 +1,4 @@
|
|
|
1
|
-
import type { RemoteCacheClient,
|
|
1
|
+
import type { RemoteCacheClient, RemoteCacheClientUploadOperationOptions, RemoteCacheClientOperationOptions, RemoteCacheClientOperationResult } from '../types/RemoteCacheClient.js';
|
|
2
2
|
import type { RetryManager } from '@ms-cloudpack/retry';
|
|
3
3
|
/**
|
|
4
4
|
* A decorator that retries the upload/download operation if it fails.
|
|
@@ -11,7 +11,7 @@ export declare class RetryDecorator implements RemoteCacheClient {
|
|
|
11
11
|
retryManager: RetryManager;
|
|
12
12
|
});
|
|
13
13
|
private printRetryContext;
|
|
14
|
-
uploadFolder(options:
|
|
14
|
+
uploadFolder(options: RemoteCacheClientUploadOperationOptions): Promise<RemoteCacheClientOperationResult>;
|
|
15
15
|
downloadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult>;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=RetryDecorator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RetryDecorator.d.ts","sourceRoot":"","sources":["../../src/decorators/RetryDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,
|
|
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 +1 @@
|
|
|
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,
|
|
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"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createRemoteCacheClient, type CreateRemoteCacheClientParams } from './createRemoteCacheClient.js';
|
|
2
|
-
export type { RemoteCacheClient, RemoteCacheClientDownloadOperationOptions, RemoteCacheClientOperationOptions, RemoteCacheClientOperationResult, } from './types/RemoteCacheClient.js';
|
|
2
|
+
export type { RemoteCacheClient, RemoteCacheClientUploadOperationOptions as RemoteCacheClientDownloadOperationOptions, RemoteCacheClientOperationOptions, RemoteCacheClientOperationResult, } from './types/RemoteCacheClient.js';
|
|
3
3
|
export type { LoginMethod } from './types/LoginMethod.js';
|
|
4
4
|
export type { RemoteCacheClientOptions } from './types/RemoteCacheClientOptions.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,yCAAyC,
|
|
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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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 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
|
+
{"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"]}
|
package/lib/tsdoc-metadata.json
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
export type RemoteCacheClientOperationResult = 'success' | 'not-found' | 'already-exist';
|
|
2
2
|
export interface RemoteCacheClientOperationOptions {
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The unique identifier of the asset
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* Local path to the asset
|
|
9
|
+
*/
|
|
4
10
|
path: string;
|
|
11
|
+
/**
|
|
12
|
+
* The friendly name of the asset to be used in logs
|
|
13
|
+
*/
|
|
5
14
|
friendlyName: string;
|
|
6
15
|
}
|
|
7
|
-
export interface
|
|
16
|
+
export interface RemoteCacheClientUploadOperationOptions extends RemoteCacheClientOperationOptions {
|
|
8
17
|
globMatches: string[];
|
|
9
18
|
}
|
|
10
19
|
export interface RemoteCacheClient {
|
|
11
|
-
uploadFolder(options:
|
|
20
|
+
uploadFolder(options: RemoteCacheClientUploadOperationOptions): Promise<RemoteCacheClientOperationResult>;
|
|
12
21
|
downloadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult>;
|
|
13
22
|
}
|
|
14
23
|
//# sourceMappingURL=RemoteCacheClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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 +1 @@
|
|
|
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
|
|
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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/remote-cache",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Manages syncing the local Cloudpack cached assets to/from a remote storage service.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@ms-cloudpack/eslint-plugin-internal": "*",
|
|
18
|
-
"@ms-cloudpack/scripts": "*"
|
|
19
|
-
"uuid": "^9.0.0"
|
|
18
|
+
"@ms-cloudpack/scripts": "*"
|
|
20
19
|
},
|
|
21
20
|
"scripts": {
|
|
22
21
|
"api": "cloudpack-scripts api",
|
|
@@ -34,7 +33,7 @@
|
|
|
34
33
|
"@azure/msal-node": "^2.6.0",
|
|
35
34
|
"@azure/msal-node-extensions": "^1.0.10",
|
|
36
35
|
"@ms-cloudpack/task-reporter": "^0.11.1",
|
|
37
|
-
"@ms-cloudpack/telemetry": "^0.4.
|
|
36
|
+
"@ms-cloudpack/telemetry": "^0.4.6",
|
|
38
37
|
"@ms-cloudpack/retry": "^0.1.1",
|
|
39
38
|
"@azure/identity": "^3.4.0",
|
|
40
39
|
"@azure/storage-blob": "^12.17.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PackageToSync.d.ts","sourceRoot":"","sources":["../../src/types/PackageToSync.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PackageToSync.js","sourceRoot":"","sources":["../../src/types/PackageToSync.ts"],"names":[],"mappings":"","sourcesContent":["export interface PackageToSync {\n path: string;\n folderName: string;\n packageName: string;\n version: string;\n}\n"]}
|