@ms-cloudpack/remote-cache 0.9.4 → 0.9.6
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-MGVQID6U.js → AzureRemoteCacheClient-PJKUPDPI.js} +6 -7
- package/dist/ReporterDecorator-FZKB4MWN.js +122 -0
- package/dist/{chunk-FCLWQPWW.js → chunk-ADYZUCCL.js} +16 -7
- package/dist/{chunk-J2GVYUBP.js → chunk-N4V3CONX.js} +1 -1
- package/dist/chunk-NFU5RQB4.js +56 -0
- package/dist/{chunk-YJE37DFQ.js → chunk-PCVVIHN2.js} +7 -5
- package/dist/{chunk-FWAX6DIR.js → chunk-TDGUF35H.js} +8 -47
- package/dist/{getCredential-HAVZEKRP.js → getCredential-3OW4WEJU.js} +38 -34
- package/dist/{getListOfBlobs-S2XCR2P4.js → getListOfBlobs-KAWJXC5J.js} +5 -6
- package/dist/index.js +8 -6
- package/lib/decorators/ReporterDecorator.d.ts +3 -3
- package/package.json +3 -3
- package/dist/ReporterDecorator-GABX72QZ.js +0 -138
- package/dist/chunk-QZWJDZ4T.js +0 -19
|
@@ -6,22 +6,21 @@ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = topLevelPath.dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
require_package as require_package2
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
createBlobStorageUrl
|
|
12
|
-
} from "./chunk-QZWJDZ4T.js";
|
|
9
|
+
} from "./chunk-N4V3CONX.js";
|
|
13
10
|
import {
|
|
11
|
+
createBlobStorageUrl,
|
|
14
12
|
require_dist
|
|
15
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ADYZUCCL.js";
|
|
16
14
|
import {
|
|
17
15
|
require_package2 as require_package
|
|
18
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PCVVIHN2.js";
|
|
17
|
+
import "./chunk-TDGUF35H.js";
|
|
19
18
|
import {
|
|
20
19
|
__commonJS,
|
|
21
20
|
__name,
|
|
22
21
|
__require,
|
|
23
22
|
__toESM
|
|
24
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-NFU5RQB4.js";
|
|
25
24
|
|
|
26
25
|
// ../../node_modules/.store/p-try-npm-2.2.0-e0390dbaf8/package/index.js
|
|
27
26
|
var require_package3 = __commonJS({
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { createRequire as topLevelCreateRequire } from 'node:module';
|
|
2
|
+
import topLevelPath from 'node:path';
|
|
3
|
+
import topLevelUrl from 'node:url';
|
|
4
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
5
|
+
const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = topLevelPath.dirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
__name
|
|
9
|
+
} from "./chunk-NFU5RQB4.js";
|
|
10
|
+
|
|
11
|
+
// src/decorators/ReporterDecorator.ts
|
|
12
|
+
import { bulletedList } from "@ms-cloudpack/task-reporter";
|
|
13
|
+
var _ReporterDecorator = class _ReporterDecorator {
|
|
14
|
+
constructor(client, context) {
|
|
15
|
+
this.client = client;
|
|
16
|
+
this.context = context;
|
|
17
|
+
}
|
|
18
|
+
buildFailureResult({ id, friendlyName, path }, error) {
|
|
19
|
+
const list = bulletedList([
|
|
20
|
+
`Id: ${id}`,
|
|
21
|
+
`Path: ${path}`,
|
|
22
|
+
`Name: ${friendlyName}`,
|
|
23
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`
|
|
24
|
+
]);
|
|
25
|
+
const result = {
|
|
26
|
+
status: "fail",
|
|
27
|
+
message: `
|
|
28
|
+
${list}`
|
|
29
|
+
};
|
|
30
|
+
if (error instanceof Error && error.stack) {
|
|
31
|
+
result.details = error.stack.includes(error.message) ? error.stack.split(error.message)[1] : error.stack;
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
uploadFolder(options) {
|
|
36
|
+
const { id, path, friendlyName } = options;
|
|
37
|
+
const task = this.context.reporter.addTask(`Uploading to remote cache: ${friendlyName}`);
|
|
38
|
+
return this.context.telemetryClient.tracer.startActiveSpan("UPLOAD_FOLDER", async () => {
|
|
39
|
+
try {
|
|
40
|
+
const uploadResult = await this.client.uploadFolder(options);
|
|
41
|
+
const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);
|
|
42
|
+
switch (uploadResult) {
|
|
43
|
+
case "success":
|
|
44
|
+
task.complete({
|
|
45
|
+
status: "complete",
|
|
46
|
+
details
|
|
47
|
+
});
|
|
48
|
+
break;
|
|
49
|
+
case "not-found":
|
|
50
|
+
task.complete({
|
|
51
|
+
status: "skip",
|
|
52
|
+
message: `Not found in the local cache.`,
|
|
53
|
+
details
|
|
54
|
+
});
|
|
55
|
+
break;
|
|
56
|
+
case "already-exist":
|
|
57
|
+
task.complete({
|
|
58
|
+
status: "skip",
|
|
59
|
+
message: `Package is already exist in the remote cache.`,
|
|
60
|
+
details
|
|
61
|
+
});
|
|
62
|
+
break;
|
|
63
|
+
default:
|
|
64
|
+
throw new Error(`Unknown upload result: ${uploadResult}`);
|
|
65
|
+
}
|
|
66
|
+
return uploadResult;
|
|
67
|
+
} catch (e) {
|
|
68
|
+
task.complete(this.buildFailureResult(options, e));
|
|
69
|
+
if (e instanceof Error) {
|
|
70
|
+
e.stack = void 0;
|
|
71
|
+
}
|
|
72
|
+
throw e;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
downloadFolder(options) {
|
|
77
|
+
const { id, path, friendlyName } = options;
|
|
78
|
+
const task = this.context.reporter.addTask(`Downloading from remote cache: ${friendlyName}`);
|
|
79
|
+
return this.context.telemetryClient.tracer.startActiveSpan("UPLOAD_FOLDER", async () => {
|
|
80
|
+
try {
|
|
81
|
+
const downloadResult = await this.client.downloadFolder(options);
|
|
82
|
+
const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);
|
|
83
|
+
switch (downloadResult) {
|
|
84
|
+
case "success":
|
|
85
|
+
task.complete({
|
|
86
|
+
status: "complete",
|
|
87
|
+
details
|
|
88
|
+
});
|
|
89
|
+
break;
|
|
90
|
+
case "not-found":
|
|
91
|
+
task.complete({
|
|
92
|
+
status: "skip",
|
|
93
|
+
message: `Not found in the remote cache.`,
|
|
94
|
+
details
|
|
95
|
+
});
|
|
96
|
+
break;
|
|
97
|
+
case "already-exist":
|
|
98
|
+
task.complete({
|
|
99
|
+
status: "skip",
|
|
100
|
+
message: `Package is already exist in the local cache.`,
|
|
101
|
+
details
|
|
102
|
+
});
|
|
103
|
+
break;
|
|
104
|
+
default:
|
|
105
|
+
throw new Error(`Unknown download result: ${downloadResult}`);
|
|
106
|
+
}
|
|
107
|
+
return downloadResult;
|
|
108
|
+
} catch (e) {
|
|
109
|
+
task.complete(this.buildFailureResult(options, e));
|
|
110
|
+
if (e instanceof Error) {
|
|
111
|
+
e.stack = void 0;
|
|
112
|
+
}
|
|
113
|
+
throw e;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
__name(_ReporterDecorator, "ReporterDecorator");
|
|
119
|
+
var ReporterDecorator = _ReporterDecorator;
|
|
120
|
+
export {
|
|
121
|
+
ReporterDecorator
|
|
122
|
+
};
|
|
@@ -10,16 +10,18 @@ import {
|
|
|
10
10
|
require_commonjs3 as require_commonjs4,
|
|
11
11
|
require_commonjs4 as require_commonjs5,
|
|
12
12
|
require_commonjs5 as require_commonjs6
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PCVVIHN2.js";
|
|
14
14
|
import {
|
|
15
|
-
__commonJS,
|
|
16
|
-
__name,
|
|
17
|
-
__require,
|
|
18
|
-
__toCommonJS,
|
|
19
15
|
init_tslib_es6,
|
|
20
16
|
require_commonjs,
|
|
21
17
|
tslib_es6_exports
|
|
22
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-TDGUF35H.js";
|
|
19
|
+
import {
|
|
20
|
+
__commonJS,
|
|
21
|
+
__name,
|
|
22
|
+
__require,
|
|
23
|
+
__toCommonJS
|
|
24
|
+
} from "./chunk-NFU5RQB4.js";
|
|
23
25
|
|
|
24
26
|
// ../../node_modules/.store/@azure-core-auth-npm-1.8.0-4c3deacbe4/package/dist/commonjs/azureKeyCredential.js
|
|
25
27
|
var require_azureKeyCredential = __commonJS({
|
|
@@ -27376,6 +27378,13 @@ ${key}:${decodeURIComponent(lowercaseQueries[key])}`;
|
|
|
27376
27378
|
}
|
|
27377
27379
|
});
|
|
27378
27380
|
|
|
27381
|
+
// src/createBlobStorageUrl.ts
|
|
27382
|
+
function createBlobStorageUrl(storageAccount) {
|
|
27383
|
+
return `https://${storageAccount}.blob.core.windows.net`;
|
|
27384
|
+
}
|
|
27385
|
+
__name(createBlobStorageUrl, "createBlobStorageUrl");
|
|
27386
|
+
|
|
27379
27387
|
export {
|
|
27380
|
-
require_dist
|
|
27388
|
+
require_dist,
|
|
27389
|
+
createBlobStorageUrl
|
|
27381
27390
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createRequire as topLevelCreateRequire } from 'node:module';
|
|
2
|
+
import topLevelPath from 'node:path';
|
|
3
|
+
import topLevelUrl from 'node:url';
|
|
4
|
+
const require = topLevelCreateRequire(import.meta.url);
|
|
5
|
+
const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = topLevelPath.dirname(__filename);
|
|
7
|
+
var __create = Object.create;
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
12
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
14
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
15
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
16
|
+
}) : x)(function(x) {
|
|
17
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
18
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
19
|
+
});
|
|
20
|
+
var __esm = (fn, res) => function __init() {
|
|
21
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
22
|
+
};
|
|
23
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
24
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
25
|
+
};
|
|
26
|
+
var __export = (target, all) => {
|
|
27
|
+
for (var name in all)
|
|
28
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
29
|
+
};
|
|
30
|
+
var __copyProps = (to, from, except, desc) => {
|
|
31
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
32
|
+
for (let key of __getOwnPropNames(from))
|
|
33
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
34
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
35
|
+
}
|
|
36
|
+
return to;
|
|
37
|
+
};
|
|
38
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
39
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
40
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
41
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
42
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
43
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
44
|
+
mod
|
|
45
|
+
));
|
|
46
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
__name,
|
|
50
|
+
__require,
|
|
51
|
+
__esm,
|
|
52
|
+
__commonJS,
|
|
53
|
+
__export,
|
|
54
|
+
__toESM,
|
|
55
|
+
__toCommonJS
|
|
56
|
+
};
|
|
@@ -5,14 +5,16 @@ const require = topLevelCreateRequire(import.meta.url);
|
|
|
5
5
|
const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = topLevelPath.dirname(__filename);
|
|
7
7
|
import {
|
|
8
|
-
__commonJS,
|
|
9
|
-
__name,
|
|
10
|
-
__require,
|
|
11
|
-
__toCommonJS,
|
|
12
8
|
init_tslib_es6,
|
|
13
9
|
require_commonjs,
|
|
14
10
|
tslib_es6_exports
|
|
15
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TDGUF35H.js";
|
|
12
|
+
import {
|
|
13
|
+
__commonJS,
|
|
14
|
+
__name,
|
|
15
|
+
__require,
|
|
16
|
+
__toCommonJS
|
|
17
|
+
} from "./chunk-NFU5RQB4.js";
|
|
16
18
|
|
|
17
19
|
// ../../node_modules/.store/@azure-abort-controller-npm-2.1.2-a36d73ebb9/package/dist/commonjs/AbortError.js
|
|
18
20
|
var require_AbortError = __commonJS({
|
|
@@ -4,46 +4,14 @@ import topLevelUrl from 'node:url';
|
|
|
4
4
|
const require = topLevelCreateRequire(import.meta.url);
|
|
5
5
|
const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = topLevelPath.dirname(__filename);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
16
|
-
}) : x)(function(x) {
|
|
17
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
18
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
19
|
-
});
|
|
20
|
-
var __esm = (fn, res) => function __init() {
|
|
21
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
22
|
-
};
|
|
23
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
24
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
25
|
-
};
|
|
26
|
-
var __export = (target, all) => {
|
|
27
|
-
for (var name in all)
|
|
28
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
29
|
-
};
|
|
30
|
-
var __copyProps = (to, from, except, desc) => {
|
|
31
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
32
|
-
for (let key of __getOwnPropNames(from))
|
|
33
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
34
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
35
|
-
}
|
|
36
|
-
return to;
|
|
37
|
-
};
|
|
38
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
39
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
40
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
41
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
42
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
43
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
44
|
-
mod
|
|
45
|
-
));
|
|
46
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
7
|
+
import {
|
|
8
|
+
__commonJS,
|
|
9
|
+
__esm,
|
|
10
|
+
__export,
|
|
11
|
+
__name,
|
|
12
|
+
__require,
|
|
13
|
+
__toCommonJS
|
|
14
|
+
} from "./chunk-NFU5RQB4.js";
|
|
47
15
|
|
|
48
16
|
// ../../node_modules/.store/tslib-npm-2.8.0-6ce3ffdd05/package/tslib.es6.mjs
|
|
49
17
|
var tslib_es6_exports = {};
|
|
@@ -825,13 +793,6 @@ var require_commonjs = __commonJS({
|
|
|
825
793
|
});
|
|
826
794
|
|
|
827
795
|
export {
|
|
828
|
-
__name,
|
|
829
|
-
__require,
|
|
830
|
-
__esm,
|
|
831
|
-
__commonJS,
|
|
832
|
-
__export,
|
|
833
|
-
__toESM,
|
|
834
|
-
__toCommonJS,
|
|
835
796
|
tslib_es6_exports,
|
|
836
797
|
init_tslib_es6,
|
|
837
798
|
require_commonjs
|
|
@@ -6,14 +6,17 @@ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = topLevelPath.dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
require_package as require_package2
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-N4V3CONX.js";
|
|
10
10
|
import {
|
|
11
11
|
require_commonjs2,
|
|
12
12
|
require_commonjs3,
|
|
13
13
|
require_commonjs4,
|
|
14
14
|
require_commonjs5,
|
|
15
15
|
require_package
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PCVVIHN2.js";
|
|
17
|
+
import {
|
|
18
|
+
require_commonjs
|
|
19
|
+
} from "./chunk-TDGUF35H.js";
|
|
17
20
|
import {
|
|
18
21
|
__commonJS,
|
|
19
22
|
__esm,
|
|
@@ -21,9 +24,8 @@ import {
|
|
|
21
24
|
__name,
|
|
22
25
|
__require,
|
|
23
26
|
__toCommonJS,
|
|
24
|
-
__toESM
|
|
25
|
-
|
|
26
|
-
} from "./chunk-FWAX6DIR.js";
|
|
27
|
+
__toESM
|
|
28
|
+
} from "./chunk-NFU5RQB4.js";
|
|
27
29
|
|
|
28
30
|
// ../../node_modules/.store/@azure-abort-controller-npm-1.1.0-5b4e309629/package/dist/index.js
|
|
29
31
|
var require_dist = __commonJS({
|
|
@@ -19655,38 +19657,40 @@ function getCredentialInternal(loginMethod, authenticationRecord, tenantId) {
|
|
|
19655
19657
|
}
|
|
19656
19658
|
__name(getCredentialInternal, "getCredentialInternal");
|
|
19657
19659
|
async function getCredential(options, context) {
|
|
19658
|
-
var _a2;
|
|
19659
19660
|
const { loginMethod, cachePath, tenantId } = options;
|
|
19660
19661
|
const { reporter, azureLogger, telemetryClient } = context;
|
|
19661
|
-
|
|
19662
|
-
|
|
19663
|
-
|
|
19664
|
-
|
|
19665
|
-
|
|
19666
|
-
tasks
|
|
19667
|
-
|
|
19668
|
-
|
|
19669
|
-
|
|
19670
|
-
|
|
19671
|
-
|
|
19672
|
-
|
|
19673
|
-
|
|
19674
|
-
|
|
19675
|
-
|
|
19676
|
-
|
|
19677
|
-
|
|
19678
|
-
|
|
19679
|
-
|
|
19680
|
-
|
|
19681
|
-
|
|
19682
|
-
|
|
19683
|
-
|
|
19684
|
-
|
|
19685
|
-
|
|
19686
|
-
|
|
19687
|
-
|
|
19662
|
+
return telemetryClient.tracer.startActiveSpan("GET_CREDENTIAL", async (span) => {
|
|
19663
|
+
var _a2;
|
|
19664
|
+
if (loginMethod == "azure-cli") {
|
|
19665
|
+
return new import_identity3.AzureCliCredential();
|
|
19666
|
+
}
|
|
19667
|
+
const tasks = {};
|
|
19668
|
+
azureLogger.once("MsalBrowserOpen", (url) => {
|
|
19669
|
+
tasks.interactiveAuthentication = reporter.addTask(
|
|
19670
|
+
`Prepare to sign in - we are launching a browser page for you. Simply follow the instructions on the login page to seamlessly complete the authentication process. You can manually access the login page by navigating to the folliwing url if you inadvertently close the authentication page or prefer to use a different web browser or a profile. ${url}`
|
|
19671
|
+
);
|
|
19672
|
+
});
|
|
19673
|
+
tryCleaningLockFile();
|
|
19674
|
+
(0, import_identity3.useIdentityPlugin)(cachePersistencePlugin);
|
|
19675
|
+
const credential = getCredentialInternal(loginMethod, getAuthenticationRecord(cachePath), tenantId);
|
|
19676
|
+
const storageScope = "https://storage.azure.com/.default";
|
|
19677
|
+
const authenticationRecord = await credential.authenticate(storageScope);
|
|
19678
|
+
const token = await credential.getToken(storageScope);
|
|
19679
|
+
const storageCustomCredential = {
|
|
19680
|
+
getToken: /* @__PURE__ */ __name(() => Promise.resolve(token), "getToken")
|
|
19681
|
+
};
|
|
19682
|
+
if (authenticationRecord) {
|
|
19683
|
+
saveAuthenticationRecord(cachePath, authenticationRecord);
|
|
19684
|
+
}
|
|
19685
|
+
(_a2 = tasks.interactiveAuthentication) == null ? void 0 : _a2.complete({
|
|
19686
|
+
message: "You have successfully signed in."
|
|
19687
|
+
});
|
|
19688
|
+
span.setAttributes({
|
|
19689
|
+
loginMethod,
|
|
19690
|
+
browserActionRequired: !!tasks.interactiveAuthentication
|
|
19691
|
+
});
|
|
19692
|
+
return storageCustomCredential;
|
|
19688
19693
|
});
|
|
19689
|
-
return storageCustomCredential;
|
|
19690
19694
|
}
|
|
19691
19695
|
__name(getCredential, "getCredential");
|
|
19692
19696
|
export {
|
|
@@ -5,16 +5,15 @@ const require = topLevelCreateRequire(import.meta.url);
|
|
|
5
5
|
const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = topLevelPath.dirname(__filename);
|
|
7
7
|
import {
|
|
8
|
-
createBlobStorageUrl
|
|
9
|
-
} from "./chunk-QZWJDZ4T.js";
|
|
10
|
-
import {
|
|
8
|
+
createBlobStorageUrl,
|
|
11
9
|
require_dist
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-ADYZUCCL.js";
|
|
11
|
+
import "./chunk-PCVVIHN2.js";
|
|
12
|
+
import "./chunk-TDGUF35H.js";
|
|
14
13
|
import {
|
|
15
14
|
__name,
|
|
16
15
|
__toESM
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-NFU5RQB4.js";
|
|
18
17
|
|
|
19
18
|
// src/getListOfBlobs.ts
|
|
20
19
|
var import_storage_blob = __toESM(require_dist(), 1);
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,11 @@ const require = topLevelCreateRequire(import.meta.url);
|
|
|
5
5
|
const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = topLevelPath.dirname(__filename);
|
|
7
7
|
import {
|
|
8
|
-
__name,
|
|
9
8
|
require_commonjs
|
|
10
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TDGUF35H.js";
|
|
10
|
+
import {
|
|
11
|
+
__name
|
|
12
|
+
} from "./chunk-NFU5RQB4.js";
|
|
11
13
|
|
|
12
14
|
// src/registerAzureLogger.ts
|
|
13
15
|
import EventEmitter from "events";
|
|
@@ -96,10 +98,10 @@ async function createRemoteCacheClient(params) {
|
|
|
96
98
|
const azureLogEventHandler = registerAzureLogger();
|
|
97
99
|
const { context, options } = params;
|
|
98
100
|
const { container, loginMethod, storageAccount, cachePath, tenantId } = options;
|
|
99
|
-
const { getCredential } = await import("./getCredential-
|
|
100
|
-
const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-
|
|
101
|
-
const { ReporterDecorator } = await import("./ReporterDecorator-
|
|
102
|
-
const { getListOfBlobs } = await import("./getListOfBlobs-
|
|
101
|
+
const { getCredential } = await import("./getCredential-3OW4WEJU.js");
|
|
102
|
+
const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-PJKUPDPI.js");
|
|
103
|
+
const { ReporterDecorator } = await import("./ReporterDecorator-FZKB4MWN.js");
|
|
104
|
+
const { getListOfBlobs } = await import("./getListOfBlobs-KAWJXC5J.js");
|
|
103
105
|
const credential = await getCredential(
|
|
104
106
|
{ loginMethod, cachePath, tenantId },
|
|
105
107
|
{ ...context, azureLogger: azureLogEventHandler }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
2
|
-
import type { RemoteCacheClient, RemoteCacheClientUploadOperationOptions, RemoteCacheClientOperationOptions
|
|
2
|
+
import type { RemoteCacheClient, RemoteCacheClientUploadOperationOptions, RemoteCacheClientOperationOptions } 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 buildFailureResult;
|
|
12
|
-
uploadFolder(options: RemoteCacheClientUploadOperationOptions): Promise<RemoteCacheClientOperationResult>;
|
|
13
|
-
downloadFolder(options: RemoteCacheClientOperationOptions): Promise<RemoteCacheClientOperationResult>;
|
|
12
|
+
uploadFolder(options: RemoteCacheClientUploadOperationOptions): Promise<import("../types/RemoteCacheClient.js").RemoteCacheClientOperationResult>;
|
|
13
|
+
downloadFolder(options: RemoteCacheClientOperationOptions): Promise<import("../types/RemoteCacheClient.js").RemoteCacheClientOperationResult>;
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=ReporterDecorator.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/remote-cache",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "Manages syncing the local Cloudpack cached assets to/from a remote storage service.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"lib/**/*.d.ts"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ms-cloudpack/common-types": "^0.23.
|
|
30
|
+
"@ms-cloudpack/common-types": "^0.23.3",
|
|
31
31
|
"@ms-cloudpack/retry": "^0.1.2",
|
|
32
32
|
"@ms-cloudpack/task-reporter": "^0.14.5",
|
|
33
|
-
"@ms-cloudpack/telemetry": "^0.
|
|
33
|
+
"@ms-cloudpack/telemetry": "^0.9.0",
|
|
34
34
|
"@napi-rs/keyring": "^1.0.0",
|
|
35
35
|
"mime-types": "^2.0.0",
|
|
36
36
|
"node-dpapi-prebuilt": "^1.0.3"
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { createRequire as topLevelCreateRequire } from 'node:module';
|
|
2
|
-
import topLevelPath from 'node:path';
|
|
3
|
-
import topLevelUrl from 'node:url';
|
|
4
|
-
const require = topLevelCreateRequire(import.meta.url);
|
|
5
|
-
const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = topLevelPath.dirname(__filename);
|
|
7
|
-
import {
|
|
8
|
-
require_dist
|
|
9
|
-
} from "./chunk-FCLWQPWW.js";
|
|
10
|
-
import "./chunk-YJE37DFQ.js";
|
|
11
|
-
import {
|
|
12
|
-
__name,
|
|
13
|
-
__toESM
|
|
14
|
-
} from "./chunk-FWAX6DIR.js";
|
|
15
|
-
|
|
16
|
-
// src/decorators/ReporterDecorator.ts
|
|
17
|
-
var import_storage_blob = __toESM(require_dist(), 1);
|
|
18
|
-
import { bulletedList } from "@ms-cloudpack/task-reporter";
|
|
19
|
-
var isAuthErrorReported = false;
|
|
20
|
-
function reportError(telemetryClient, error) {
|
|
21
|
-
const isAuthError = error instanceof import_storage_blob.RestError && error.statusCode === 403;
|
|
22
|
-
if (isAuthError && isAuthErrorReported) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
telemetryClient.rootSpan.recordException(error);
|
|
26
|
-
isAuthErrorReported = isAuthError;
|
|
27
|
-
}
|
|
28
|
-
__name(reportError, "reportError");
|
|
29
|
-
var _ReporterDecorator = class _ReporterDecorator {
|
|
30
|
-
constructor(client, context) {
|
|
31
|
-
this.client = client;
|
|
32
|
-
this.context = context;
|
|
33
|
-
}
|
|
34
|
-
buildFailureResult({ id, friendlyName, path }, error) {
|
|
35
|
-
const list = bulletedList([
|
|
36
|
-
`Id: ${id}`,
|
|
37
|
-
`Path: ${path}`,
|
|
38
|
-
`Name: ${friendlyName}`,
|
|
39
|
-
`Error: ${error instanceof Error ? error.message : String(error)}`
|
|
40
|
-
]);
|
|
41
|
-
const result = {
|
|
42
|
-
status: "fail",
|
|
43
|
-
message: `
|
|
44
|
-
${list}`
|
|
45
|
-
};
|
|
46
|
-
if (error instanceof Error && error.stack) {
|
|
47
|
-
result.details = error.stack.includes(error.message) ? error.stack.split(error.message)[1] : error.stack;
|
|
48
|
-
}
|
|
49
|
-
return result;
|
|
50
|
-
}
|
|
51
|
-
async uploadFolder(options) {
|
|
52
|
-
const { id, path, friendlyName } = options;
|
|
53
|
-
const task = this.context.reporter.addTask(`Uploading to remote cache: ${friendlyName}`);
|
|
54
|
-
let uploadResult;
|
|
55
|
-
try {
|
|
56
|
-
uploadResult = await this.client.uploadFolder(options);
|
|
57
|
-
} catch (e) {
|
|
58
|
-
task.complete(this.buildFailureResult(options, e));
|
|
59
|
-
if (e instanceof Error) {
|
|
60
|
-
reportError(this.context.telemetryClient, e);
|
|
61
|
-
e.stack = void 0;
|
|
62
|
-
}
|
|
63
|
-
throw e;
|
|
64
|
-
}
|
|
65
|
-
const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);
|
|
66
|
-
switch (uploadResult) {
|
|
67
|
-
case "success":
|
|
68
|
-
task.complete({
|
|
69
|
-
status: "complete",
|
|
70
|
-
details
|
|
71
|
-
});
|
|
72
|
-
break;
|
|
73
|
-
case "not-found":
|
|
74
|
-
task.complete({
|
|
75
|
-
status: "skip",
|
|
76
|
-
message: `Not found in the local cache.`,
|
|
77
|
-
details
|
|
78
|
-
});
|
|
79
|
-
break;
|
|
80
|
-
case "already-exist":
|
|
81
|
-
task.complete({
|
|
82
|
-
status: "skip",
|
|
83
|
-
message: `Package is already exist in the remote cache.`,
|
|
84
|
-
details
|
|
85
|
-
});
|
|
86
|
-
break;
|
|
87
|
-
default:
|
|
88
|
-
throw new Error(`Unknown upload result: ${uploadResult}`);
|
|
89
|
-
}
|
|
90
|
-
return uploadResult;
|
|
91
|
-
}
|
|
92
|
-
async downloadFolder(options) {
|
|
93
|
-
const { id, path, friendlyName } = options;
|
|
94
|
-
const task = this.context.reporter.addTask(`Downloading from remote cache: ${friendlyName}`);
|
|
95
|
-
let downloadResult;
|
|
96
|
-
try {
|
|
97
|
-
downloadResult = await this.client.downloadFolder(options);
|
|
98
|
-
} catch (e) {
|
|
99
|
-
task.complete(this.buildFailureResult(options, e));
|
|
100
|
-
if (e instanceof Error) {
|
|
101
|
-
reportError(this.context.telemetryClient, e);
|
|
102
|
-
e.stack = void 0;
|
|
103
|
-
}
|
|
104
|
-
throw e;
|
|
105
|
-
}
|
|
106
|
-
const details = bulletedList([`Id: ${id}`, `Path: ${path}`, `Name: ${friendlyName}`]);
|
|
107
|
-
switch (downloadResult) {
|
|
108
|
-
case "success":
|
|
109
|
-
task.complete({
|
|
110
|
-
status: "complete",
|
|
111
|
-
details
|
|
112
|
-
});
|
|
113
|
-
break;
|
|
114
|
-
case "not-found":
|
|
115
|
-
task.complete({
|
|
116
|
-
status: "skip",
|
|
117
|
-
message: `Not found in the remote cache.`,
|
|
118
|
-
details
|
|
119
|
-
});
|
|
120
|
-
break;
|
|
121
|
-
case "already-exist":
|
|
122
|
-
task.complete({
|
|
123
|
-
status: "skip",
|
|
124
|
-
message: `Package is already exist in the local cache.`,
|
|
125
|
-
details
|
|
126
|
-
});
|
|
127
|
-
break;
|
|
128
|
-
default:
|
|
129
|
-
throw new Error(`Unknown download result: ${downloadResult}`);
|
|
130
|
-
}
|
|
131
|
-
return downloadResult;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
__name(_ReporterDecorator, "ReporterDecorator");
|
|
135
|
-
var ReporterDecorator = _ReporterDecorator;
|
|
136
|
-
export {
|
|
137
|
-
ReporterDecorator
|
|
138
|
-
};
|
package/dist/chunk-QZWJDZ4T.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createRequire as topLevelCreateRequire } from 'node:module';
|
|
2
|
-
import topLevelPath from 'node:path';
|
|
3
|
-
import topLevelUrl from 'node:url';
|
|
4
|
-
const require = topLevelCreateRequire(import.meta.url);
|
|
5
|
-
const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = topLevelPath.dirname(__filename);
|
|
7
|
-
import {
|
|
8
|
-
__name
|
|
9
|
-
} from "./chunk-FWAX6DIR.js";
|
|
10
|
-
|
|
11
|
-
// src/createBlobStorageUrl.ts
|
|
12
|
-
function createBlobStorageUrl(storageAccount) {
|
|
13
|
-
return `https://${storageAccount}.blob.core.windows.net`;
|
|
14
|
-
}
|
|
15
|
-
__name(createBlobStorageUrl, "createBlobStorageUrl");
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
createBlobStorageUrl
|
|
19
|
-
};
|