@ms-cloudpack/remote-cache 0.7.3 → 0.7.4

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.
@@ -8,7 +8,7 @@ import {
8
8
  __commonJS,
9
9
  __name,
10
10
  __require
11
- } from "./chunk-E6II3DDV.js";
11
+ } from "./chunk-B4GP6UPK.js";
12
12
 
13
13
  // ../../node_modules/.store/safe-buffer-npm-5.2.1-3481c8aa9b/package/index.js
14
14
  var require_package = __commonJS({
@@ -6,7 +6,7 @@ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
6
6
  const __dirname = topLevelPath.dirname(__filename);
7
7
  import {
8
8
  __name
9
- } from "./chunk-E6II3DDV.js";
9
+ } from "./chunk-B4GP6UPK.js";
10
10
 
11
11
  // src/createBlobStorageUrl.ts
12
12
  function createBlobStorageUrl(storageAccount) {
@@ -7,20 +7,20 @@ const __dirname = topLevelPath.dirname(__filename);
7
7
  import {
8
8
  esm_node_exports,
9
9
  init_esm_node,
10
- init_tslib_es6,
11
- require_commonjs,
12
- require_commonjs3 as require_commonjs2,
13
- require_dist,
14
- tslib_es6_exports
15
- } from "./chunk-LRLTRMOZ.js";
10
+ require_commonjs2,
11
+ require_dist
12
+ } from "./chunk-26KCJU2L.js";
16
13
  import {
17
14
  __commonJS,
18
15
  __esm,
19
16
  __export,
20
17
  __name,
21
18
  __require,
22
- __toCommonJS
23
- } from "./chunk-E6II3DDV.js";
19
+ __toCommonJS,
20
+ init_tslib_es6,
21
+ require_commonjs,
22
+ tslib_es6_exports
23
+ } from "./chunk-B4GP6UPK.js";
24
24
 
25
25
  // ../../node_modules/.store/xml2js-npm-0.5.0-06e57a2771/package/lib/defaults.js
26
26
  var require_defaults = __commonJS({
@@ -6,17 +6,14 @@ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
6
6
  const __dirname = topLevelPath.dirname(__filename);
7
7
  import {
8
8
  require_package
9
- } from "./chunk-YEA5VY6V.js";
9
+ } from "./chunk-FUGMINXQ.js";
10
10
  import {
11
11
  init_esm_node,
12
- init_tslib_es6,
13
- require_commonjs,
14
- require_commonjs2,
15
- require_commonjs3,
12
+ require_commonjs as require_commonjs2,
13
+ require_commonjs2 as require_commonjs3,
16
14
  require_dist,
17
- tslib_es6_exports,
18
15
  v4_default
19
- } from "./chunk-LRLTRMOZ.js";
16
+ } from "./chunk-26KCJU2L.js";
20
17
  import {
21
18
  __commonJS,
22
19
  __esm,
@@ -24,8 +21,11 @@ import {
24
21
  __name,
25
22
  __require,
26
23
  __toCommonJS,
27
- __toESM
28
- } from "./chunk-E6II3DDV.js";
24
+ __toESM,
25
+ init_tslib_es6,
26
+ require_commonjs,
27
+ tslib_es6_exports
28
+ } from "./chunk-B4GP6UPK.js";
29
29
 
30
30
  // ../../node_modules/.store/@azure-core-client-npm-1.9.2-1ef0857920/package/dist/commonjs/base64.js
31
31
  var require_base64 = __commonJS({
@@ -26177,17 +26177,24 @@ var tokenCachePersistenceOptions = {
26177
26177
  };
26178
26178
 
26179
26179
  // src/utils/isProcessRunning.ts
26180
+ function isErrorWithCode(error) {
26181
+ return error instanceof Error && "code" in error;
26182
+ }
26183
+ __name(isErrorWithCode, "isErrorWithCode");
26180
26184
  function isProcessRunning(pid) {
26181
26185
  try {
26182
26186
  process.kill(pid, 0);
26183
26187
  return true;
26184
26188
  } catch (error) {
26185
- if (error instanceof Error && "code" in error && error.code === "EPERM") {
26189
+ if (isErrorWithCode(error) && error.code === "ERR_INVALID_ARG_TYPE") {
26190
+ console.log(`Invalid PID: ${pid}`);
26191
+ return false;
26192
+ } else if (isErrorWithCode(error) && error.code === "EPERM") {
26186
26193
  console.log(
26187
26194
  `Permission issue indicates that process ${pid} exists but user doesn't have permission to signal it.`
26188
26195
  );
26189
26196
  return true;
26190
- } else if (error instanceof Error && "code" in error && error.code === "ESRCH") {
26197
+ } else if (isErrorWithCode(error) && error.code === "ESRCH") {
26191
26198
  console.log(`Process ${pid} does not exist.`);
26192
26199
  return false;
26193
26200
  } else {
@@ -26296,11 +26303,6 @@ async function getCredential(loginMethod, cachePath, tenantId) {
26296
26303
  }
26297
26304
  (0, import_identity3.useIdentityPlugin)(import_identity_cache_persistence.cachePersistencePlugin);
26298
26305
  const credential = getCredentialInternal(loginMethod, getAuthenticationRecord(cachePath), tenantId);
26299
- if (loginMethod == "interactive") {
26300
- console.warn(
26301
- "Prepare to sign in \u2013 we may launch a browser page for you. Simply follow the instructions on the login page to seamlessly complete the authentication process."
26302
- );
26303
- }
26304
26306
  tryCleaningLockFile();
26305
26307
  const storageScope = "https://storage.azure.com/.default";
26306
26308
  const authenticationRecord = await credential.authenticate(storageScope);
@@ -6,15 +6,15 @@ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
6
6
  const __dirname = topLevelPath.dirname(__filename);
7
7
  import {
8
8
  createBlobStorageUrl
9
- } from "./chunk-65RH3KSH.js";
9
+ } from "./chunk-IVPGYNQL.js";
10
10
  import {
11
11
  require_dist
12
- } from "./chunk-W3GZC77T.js";
13
- import "./chunk-LRLTRMOZ.js";
12
+ } from "./chunk-OXARBRZV.js";
13
+ import "./chunk-26KCJU2L.js";
14
14
  import {
15
15
  __name,
16
16
  __toESM
17
- } from "./chunk-E6II3DDV.js";
17
+ } from "./chunk-B4GP6UPK.js";
18
18
 
19
19
  // src/getListOfBlobs.ts
20
20
  var import_storage_blob = __toESM(require_dist(), 1);
package/dist/index.js CHANGED
@@ -5,8 +5,23 @@ 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
- } from "./chunk-E6II3DDV.js";
8
+ __name,
9
+ require_commonjs
10
+ } from "./chunk-B4GP6UPK.js";
11
+
12
+ // src/registerAzureLogger.ts
13
+ var logger = require_commonjs();
14
+ function registerAzureLogger() {
15
+ logger.setLogLevel("verbose");
16
+ logger.AzureLogger.log = (...msgs) => {
17
+ if (msgs[0] === "azure:identity:info Node.js MSAL Open Browser =>" && msgs[1].includes("falling back to interactive method")) {
18
+ console.warn(
19
+ "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 http://localhost:1337 if you inadvertently close the authentication page or prefer to use a different web browser or a profile."
20
+ );
21
+ }
22
+ };
23
+ }
24
+ __name(registerAzureLogger, "registerAzureLogger");
10
25
 
11
26
  // src/decorators/InMemoryDecorator.ts
12
27
  var _InMemoryDecorator = class _InMemoryDecorator {
@@ -75,12 +90,13 @@ var blockListIsInvalidRetryPolicy = {
75
90
  // src/createRemoteCacheClient.ts
76
91
  import { RetryManager } from "@ms-cloudpack/retry";
77
92
  async function createRemoteCacheClient(params) {
93
+ registerAzureLogger();
78
94
  const { context, options } = params;
79
95
  const { container, loginMethod, storageAccount, cachePath, tenantId } = options;
80
- const { getCredential } = await import("./getCredential-TIS4HQAY.js");
81
- const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-4Q4WE4D3.js");
82
- const { ReporterDecorator } = await import("./ReporterDecorator-YVGD2WYR.js");
83
- const { getListOfBlobs } = await import("./getListOfBlobs-ZMH5R6FS.js");
96
+ const { getCredential } = await import("./getCredential-ONYVRAN5.js");
97
+ const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-ZZ27K4AF.js");
98
+ const { ReporterDecorator } = await import("./ReporterDecorator-I4CR7TWD.js");
99
+ const { getListOfBlobs } = await import("./getListOfBlobs-YTVBR3IU.js");
84
100
  const credential = await getCredential(loginMethod, cachePath, tenantId);
85
101
  const remoteCacheClientOptions = {
86
102
  storageAccount,
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Registers a custom logger for the Azure SDK that logs only the necessary information.
3
+ */
4
+ export declare function registerAzureLogger(): void;
5
+ //# 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",
3
+ "version": "0.7.4",
4
4
  "description": "Manages syncing the local Cloudpack cached assets to/from a remote storage service.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,6 +35,7 @@
35
35
  "devDependencies": {
36
36
  "@azure/identity": "^4.0.0",
37
37
  "@azure/identity-cache-persistence": "^1.1.0",
38
+ "@azure/logger": "^1.0.0",
38
39
  "@azure/storage-blob": "^12.17.0",
39
40
  "@ms-cloudpack/eslint-plugin-internal": "*",
40
41
  "@ms-cloudpack/scripts": "*",
@@ -1,57 +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
- 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")
18
- return require.apply(this, arguments);
19
- throw Error('Dynamic require of "' + x + '" is not supported');
20
- });
21
- var __esm = (fn, res) => function __init() {
22
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
23
- };
24
- var __commonJS = (cb, mod) => function __require2() {
25
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
26
- };
27
- var __export = (target, all) => {
28
- for (var name in all)
29
- __defProp(target, name, { get: all[name], enumerable: true });
30
- };
31
- var __copyProps = (to, from, except, desc) => {
32
- if (from && typeof from === "object" || typeof from === "function") {
33
- for (let key of __getOwnPropNames(from))
34
- if (!__hasOwnProp.call(to, key) && key !== except)
35
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
36
- }
37
- return to;
38
- };
39
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
40
- // If the importer is in node compatibility mode or this is not an ESM
41
- // file that has been converted to a CommonJS file using a Babel-
42
- // compatible transform (i.e. "__esModule" has not been set), then set
43
- // "default" to the CommonJS "module.exports" for node compatibility.
44
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
45
- mod
46
- ));
47
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
48
-
49
- export {
50
- __name,
51
- __require,
52
- __esm,
53
- __commonJS,
54
- __export,
55
- __toESM,
56
- __toCommonJS
57
- };