@ms-cloudpack/remote-cache 0.7.4 → 0.7.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.
|
@@ -2349,9 +2349,9 @@ var require_package2 = __commonJS({
|
|
|
2349
2349
|
}
|
|
2350
2350
|
});
|
|
2351
2351
|
|
|
2352
|
-
// ../../node_modules/.store/debug-virtual-
|
|
2352
|
+
// ../../node_modules/.store/debug-virtual-11377b508d/package/src/common.js
|
|
2353
2353
|
var require_common = __commonJS({
|
|
2354
|
-
"../../node_modules/.store/debug-virtual-
|
|
2354
|
+
"../../node_modules/.store/debug-virtual-11377b508d/package/src/common.js"(exports, module) {
|
|
2355
2355
|
function setup(env) {
|
|
2356
2356
|
createDebug.debug = createDebug;
|
|
2357
2357
|
createDebug.default = createDebug;
|
|
@@ -2523,9 +2523,9 @@ var require_common = __commonJS({
|
|
|
2523
2523
|
}
|
|
2524
2524
|
});
|
|
2525
2525
|
|
|
2526
|
-
// ../../node_modules/.store/debug-virtual-
|
|
2526
|
+
// ../../node_modules/.store/debug-virtual-11377b508d/package/src/browser.js
|
|
2527
2527
|
var require_browser = __commonJS({
|
|
2528
|
-
"../../node_modules/.store/debug-virtual-
|
|
2528
|
+
"../../node_modules/.store/debug-virtual-11377b508d/package/src/browser.js"(exports, module) {
|
|
2529
2529
|
exports.formatArgs = formatArgs;
|
|
2530
2530
|
exports.save = save;
|
|
2531
2531
|
exports.load = load;
|
|
@@ -2697,9 +2697,9 @@ var require_browser = __commonJS({
|
|
|
2697
2697
|
}
|
|
2698
2698
|
});
|
|
2699
2699
|
|
|
2700
|
-
// ../../node_modules/.store/debug-virtual-
|
|
2700
|
+
// ../../node_modules/.store/debug-virtual-11377b508d/package/src/node.js
|
|
2701
2701
|
var require_node = __commonJS({
|
|
2702
|
-
"../../node_modules/.store/debug-virtual-
|
|
2702
|
+
"../../node_modules/.store/debug-virtual-11377b508d/package/src/node.js"(exports, module) {
|
|
2703
2703
|
var tty = __require("tty");
|
|
2704
2704
|
var util = __require("util");
|
|
2705
2705
|
exports.init = init;
|
|
@@ -2878,9 +2878,9 @@ var require_node = __commonJS({
|
|
|
2878
2878
|
}
|
|
2879
2879
|
});
|
|
2880
2880
|
|
|
2881
|
-
// ../../node_modules/.store/debug-virtual-
|
|
2881
|
+
// ../../node_modules/.store/debug-virtual-11377b508d/package/src/index.js
|
|
2882
2882
|
var require_src = __commonJS({
|
|
2883
|
-
"../../node_modules/.store/debug-virtual-
|
|
2883
|
+
"../../node_modules/.store/debug-virtual-11377b508d/package/src/index.js"(exports, module) {
|
|
2884
2884
|
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
2885
2885
|
module.exports = require_browser();
|
|
2886
2886
|
} else {
|
|
@@ -25501,6 +25501,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
|
25501
25501
|
try {
|
|
25502
25502
|
const interactiveRequest = {
|
|
25503
25503
|
openBrowser: async (url) => {
|
|
25504
|
+
this.logger.verbose(`Opening browser to ${url}`);
|
|
25504
25505
|
await interactiveBrowserMockable.open(url, { wait: true, newInstance: true });
|
|
25505
25506
|
},
|
|
25506
25507
|
scopes,
|
|
@@ -26297,10 +26298,19 @@ function getCredentialInternal(loginMethod, authenticationRecord, tenantId) {
|
|
|
26297
26298
|
}
|
|
26298
26299
|
}
|
|
26299
26300
|
__name(getCredentialInternal, "getCredentialInternal");
|
|
26300
|
-
async function getCredential(
|
|
26301
|
+
async function getCredential(options, context) {
|
|
26302
|
+
var _a;
|
|
26303
|
+
const { loginMethod, cachePath, tenantId } = options;
|
|
26304
|
+
const { reporter, azureLogger, telemetryClient } = context;
|
|
26301
26305
|
if (loginMethod == "azure-cli") {
|
|
26302
26306
|
return new import_identity3.AzureCliCredential();
|
|
26303
26307
|
}
|
|
26308
|
+
const tasks = {};
|
|
26309
|
+
azureLogger.once("MsalBrowserOpen", (url) => {
|
|
26310
|
+
tasks.interactiveAuthentication = reporter.addTask(
|
|
26311
|
+
`Prepare to sign in \u2013 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}`
|
|
26312
|
+
);
|
|
26313
|
+
});
|
|
26304
26314
|
(0, import_identity3.useIdentityPlugin)(import_identity_cache_persistence.cachePersistencePlugin);
|
|
26305
26315
|
const credential = getCredentialInternal(loginMethod, getAuthenticationRecord(cachePath), tenantId);
|
|
26306
26316
|
tryCleaningLockFile();
|
|
@@ -26313,6 +26323,13 @@ async function getCredential(loginMethod, cachePath, tenantId) {
|
|
|
26313
26323
|
if (authenticationRecord) {
|
|
26314
26324
|
saveAuthenticationRecord(cachePath, authenticationRecord);
|
|
26315
26325
|
}
|
|
26326
|
+
(_a = tasks.interactiveAuthentication) == null ? void 0 : _a.complete({
|
|
26327
|
+
message: "You have successfully signed in."
|
|
26328
|
+
});
|
|
26329
|
+
telemetryClient.rootSpan.addEvent("SYNC_AUTH", {
|
|
26330
|
+
loginMethod,
|
|
26331
|
+
browserActionRequired: !!tasks.interactiveAuthentication
|
|
26332
|
+
});
|
|
26316
26333
|
return storageCustomCredential;
|
|
26317
26334
|
}
|
|
26318
26335
|
__name(getCredential, "getCredential");
|
package/dist/index.js
CHANGED
|
@@ -10,16 +10,18 @@ import {
|
|
|
10
10
|
} from "./chunk-B4GP6UPK.js";
|
|
11
11
|
|
|
12
12
|
// src/registerAzureLogger.ts
|
|
13
|
+
import EventEmitter from "events";
|
|
13
14
|
var logger = require_commonjs();
|
|
14
15
|
function registerAzureLogger() {
|
|
16
|
+
const emitter = new EventEmitter();
|
|
15
17
|
logger.setLogLevel("verbose");
|
|
16
|
-
logger.AzureLogger.log = (...
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
18
|
+
logger.AzureLogger.log = (...messages) => {
|
|
19
|
+
if (messages[0] === "azure:identity:verbose Node.js MSAL Open Browser =>" && messages[1].includes("Opening browser")) {
|
|
20
|
+
const url = messages[1].split(" ")[3];
|
|
21
|
+
emitter.emit("MsalBrowserOpen", url);
|
|
21
22
|
}
|
|
22
23
|
};
|
|
24
|
+
return emitter;
|
|
23
25
|
}
|
|
24
26
|
__name(registerAzureLogger, "registerAzureLogger");
|
|
25
27
|
|
|
@@ -90,14 +92,17 @@ var blockListIsInvalidRetryPolicy = {
|
|
|
90
92
|
// src/createRemoteCacheClient.ts
|
|
91
93
|
import { RetryManager } from "@ms-cloudpack/retry";
|
|
92
94
|
async function createRemoteCacheClient(params) {
|
|
93
|
-
registerAzureLogger();
|
|
95
|
+
const azureLogEventHandler = registerAzureLogger();
|
|
94
96
|
const { context, options } = params;
|
|
95
97
|
const { container, loginMethod, storageAccount, cachePath, tenantId } = options;
|
|
96
|
-
const { getCredential } = await import("./getCredential-
|
|
98
|
+
const { getCredential } = await import("./getCredential-MVHPI27L.js");
|
|
97
99
|
const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-ZZ27K4AF.js");
|
|
98
100
|
const { ReporterDecorator } = await import("./ReporterDecorator-I4CR7TWD.js");
|
|
99
101
|
const { getListOfBlobs } = await import("./getListOfBlobs-YTVBR3IU.js");
|
|
100
|
-
const credential = await getCredential(
|
|
102
|
+
const credential = await getCredential(
|
|
103
|
+
{ loginMethod, cachePath, tenantId },
|
|
104
|
+
{ ...context, azureLogger: azureLogEventHandler }
|
|
105
|
+
);
|
|
101
106
|
const remoteCacheClientOptions = {
|
|
102
107
|
storageAccount,
|
|
103
108
|
container,
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
1
2
|
import { type TokenCredential } from '@azure/identity';
|
|
2
3
|
import type { LoginMethod } from '../types/LoginMethod.js';
|
|
4
|
+
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
5
|
+
import type EventEmitter from 'events';
|
|
6
|
+
import type { TelemetryClient } from '@ms-cloudpack/telemetry';
|
|
3
7
|
/**
|
|
4
8
|
* Gets a credential for the given login method.
|
|
5
9
|
* If the login method is 'azure-cli', it will return an AzureCliCredential.
|
|
6
10
|
* Otherwise, it will return an InteractiveBrowserCredential or a DeviceCodeCredential with persistent token settings.
|
|
7
11
|
* If an authentication record has never been saved before, it will authenticate the credential and save the authentication record.
|
|
8
12
|
*/
|
|
9
|
-
export declare function getCredential(
|
|
13
|
+
export declare function getCredential(options: {
|
|
14
|
+
loginMethod: LoginMethod;
|
|
15
|
+
cachePath: string;
|
|
16
|
+
tenantId?: string;
|
|
17
|
+
}, context: {
|
|
18
|
+
reporter: TaskReporter;
|
|
19
|
+
azureLogger: EventEmitter;
|
|
20
|
+
telemetryClient: TelemetryClient;
|
|
21
|
+
}): Promise<TokenCredential>;
|
|
10
22
|
//# sourceMappingURL=getCredential.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import EventEmitter from 'events';
|
|
1
3
|
/**
|
|
2
|
-
* Registers a custom logger for the Azure SDK that
|
|
4
|
+
* Registers a custom logger for the Azure SDK that emits events for some specific log messages.
|
|
3
5
|
*/
|
|
4
|
-
export declare function registerAzureLogger():
|
|
6
|
+
export declare function registerAzureLogger(): EventEmitter<[never]>;
|
|
5
7
|
//# sourceMappingURL=registerAzureLogger.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/remote-cache",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.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",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@azure/msal-node-extensions": "^1.0.10",
|
|
31
31
|
"@ms-cloudpack/retry": "^0.1.1",
|
|
32
|
-
"@ms-cloudpack/task-reporter": "^0.14.
|
|
32
|
+
"@ms-cloudpack/task-reporter": "^0.14.1",
|
|
33
33
|
"@ms-cloudpack/telemetry": "^0.5.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|