@ms-cloudpack/remote-cache 0.6.4 → 0.6.5
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-NEV2XCF7.js → AzureRemoteCacheClient-NBBUAAXL.js} +3 -4
- package/dist/{ReporterDecorator-SNBYNGOT.js → ReporterDecorator-YCOIU5LI.js} +2 -3
- package/dist/{chunk-R2VDVRDZ.js → chunk-5BUSQ7SW.js} +1 -1
- package/dist/{chunk-4P62L7ZZ.js → chunk-OPD65OLQ.js} +823 -769
- package/dist/{chunk-KFSFZYG6.js → chunk-YAIY33BG.js} +17 -19
- package/dist/{getCredential-DHB4UIE2.js → getCredential-FIEDCLGJ.js} +16 -18
- package/dist/{getListOfBlobs-E5OFG2MF.js → getListOfBlobs-VRDJ4A5S.js} +3 -4
- package/dist/index.js +71 -22
- package/lib/error/RemoteCacheError.d.ts +10 -0
- package/lib/error/isRestError.d.ts +3 -0
- package/lib/error/transformError.d.ts +7 -0
- package/lib/index.d.ts +2 -0
- package/package.json +2 -2
- package/dist/chunk-TQLTL4XO.js +0 -65
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__esm,
|
|
4
|
+
__export,
|
|
5
|
+
__name,
|
|
6
|
+
__require,
|
|
7
|
+
__toCommonJS,
|
|
2
8
|
esm_node_exports,
|
|
9
|
+
init_esbuildCjsShims,
|
|
3
10
|
init_esm_node,
|
|
4
11
|
init_tslib_es6,
|
|
5
12
|
require_dist,
|
|
6
13
|
require_dist2,
|
|
7
14
|
require_dist3,
|
|
8
15
|
tslib_es6_exports
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
__commonJS,
|
|
12
|
-
__esm,
|
|
13
|
-
__export,
|
|
14
|
-
__name,
|
|
15
|
-
__require,
|
|
16
|
-
__toCommonJS,
|
|
17
|
-
init_esbuildCjsShims
|
|
18
|
-
} from "./chunk-TQLTL4XO.js";
|
|
16
|
+
} from "./chunk-OPD65OLQ.js";
|
|
19
17
|
|
|
20
18
|
// ../../node_modules/.store/xml2js-npm-0.5.0-06e57a2771/package/lib/defaults.js
|
|
21
19
|
var require_defaults = __commonJS({
|
|
@@ -6069,7 +6067,7 @@ var require_dist4 = __commonJS({
|
|
|
6069
6067
|
"use strict";
|
|
6070
6068
|
init_esbuildCjsShims();
|
|
6071
6069
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6072
|
-
var coreUtil =
|
|
6070
|
+
var coreUtil = require_dist2();
|
|
6073
6071
|
var _AzureKeyCredential = class _AzureKeyCredential {
|
|
6074
6072
|
/**
|
|
6075
6073
|
* The value of the key to be used in authentication
|
|
@@ -20927,13 +20925,13 @@ var require_dist6 = __commonJS({
|
|
|
20927
20925
|
var util = __require("util");
|
|
20928
20926
|
var tslib = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
20929
20927
|
var xml2js = require_xml2js();
|
|
20930
|
-
var coreUtil =
|
|
20931
|
-
var logger$1 =
|
|
20928
|
+
var coreUtil = require_dist2();
|
|
20929
|
+
var logger$1 = require_dist3();
|
|
20932
20930
|
var coreAuth = require_dist4();
|
|
20933
20931
|
var os = __require("os");
|
|
20934
20932
|
var http = __require("http");
|
|
20935
20933
|
var https = __require("https");
|
|
20936
|
-
var abortController =
|
|
20934
|
+
var abortController = require_dist();
|
|
20937
20935
|
var tunnel = require_package();
|
|
20938
20936
|
var stream = __require("stream");
|
|
20939
20937
|
var FormData = require_form_data();
|
|
@@ -25487,9 +25485,9 @@ var require_dist8 = __commonJS({
|
|
|
25487
25485
|
"use strict";
|
|
25488
25486
|
init_esbuildCjsShims();
|
|
25489
25487
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25490
|
-
var logger$1 =
|
|
25491
|
-
var abortController =
|
|
25492
|
-
var coreUtil =
|
|
25488
|
+
var logger$1 = require_dist3();
|
|
25489
|
+
var abortController = require_dist();
|
|
25490
|
+
var coreUtil = require_dist2();
|
|
25493
25491
|
var logger = logger$1.createClientLogger("core-lro");
|
|
25494
25492
|
var POLL_INTERVAL_IN_MS = 2e3;
|
|
25495
25493
|
var terminalStates = ["succeeded", "canceled", "failed"];
|
|
@@ -26538,8 +26536,8 @@ var require_dist9 = __commonJS({
|
|
|
26538
26536
|
var coreHttp = require_dist6();
|
|
26539
26537
|
var tslib = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
26540
26538
|
var coreTracing = require_dist5();
|
|
26541
|
-
var logger$1 =
|
|
26542
|
-
var abortController =
|
|
26539
|
+
var logger$1 = require_dist3();
|
|
26540
|
+
var abortController = require_dist();
|
|
26543
26541
|
var os = __require("os");
|
|
26544
26542
|
var crypto = __require("crypto");
|
|
26545
26543
|
var stream = __require("stream");
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_esm_node,
|
|
3
|
-
init_tslib_es6,
|
|
4
|
-
require_dist,
|
|
5
|
-
require_dist2,
|
|
6
|
-
require_dist3,
|
|
7
|
-
tslib_es6_exports,
|
|
8
|
-
v4_default
|
|
9
|
-
} from "./chunk-4P62L7ZZ.js";
|
|
10
1
|
import {
|
|
11
2
|
__commonJS,
|
|
12
3
|
__esm,
|
|
@@ -15,8 +6,15 @@ import {
|
|
|
15
6
|
__require,
|
|
16
7
|
__toCommonJS,
|
|
17
8
|
__toESM,
|
|
18
|
-
init_esbuildCjsShims
|
|
19
|
-
|
|
9
|
+
init_esbuildCjsShims,
|
|
10
|
+
init_esm_node,
|
|
11
|
+
init_tslib_es6,
|
|
12
|
+
require_dist,
|
|
13
|
+
require_dist2,
|
|
14
|
+
require_dist3,
|
|
15
|
+
tslib_es6_exports,
|
|
16
|
+
v4_default
|
|
17
|
+
} from "./chunk-OPD65OLQ.js";
|
|
20
18
|
|
|
21
19
|
// ../../node_modules/.store/@azure-msal-node-npm-2.6.2-9183813942/package/dist/cache/serializer/Serializer.mjs
|
|
22
20
|
var _Serializer, Serializer;
|
|
@@ -16524,10 +16522,10 @@ var require_dist8 = __commonJS({
|
|
|
16524
16522
|
"use strict";
|
|
16525
16523
|
init_esbuildCjsShims();
|
|
16526
16524
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16527
|
-
var logger$1 =
|
|
16528
|
-
var coreUtil =
|
|
16525
|
+
var logger$1 = require_dist3();
|
|
16526
|
+
var coreUtil = require_dist2();
|
|
16529
16527
|
var os = __require("os");
|
|
16530
|
-
var abortController =
|
|
16528
|
+
var abortController = require_dist();
|
|
16531
16529
|
var httpsProxyAgent = require_dist4();
|
|
16532
16530
|
var httpProxyAgent = require_dist6();
|
|
16533
16531
|
var coreTracing = require_dist7();
|
|
@@ -18555,7 +18553,7 @@ var require_dist9 = __commonJS({
|
|
|
18555
18553
|
init_esbuildCjsShims();
|
|
18556
18554
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18557
18555
|
var coreRestPipeline = require_dist8();
|
|
18558
|
-
var logger$1 =
|
|
18556
|
+
var logger$1 = require_dist3();
|
|
18559
18557
|
function encodeByteArray(value) {
|
|
18560
18558
|
const bufferValue = value instanceof Buffer ? value : Buffer.from(value.buffer);
|
|
18561
18559
|
return bufferValue.toString("base64");
|
|
@@ -20641,9 +20639,9 @@ var require_dist10 = __commonJS({
|
|
|
20641
20639
|
init_esbuildCjsShims();
|
|
20642
20640
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20643
20641
|
var msalCommon = (init_dist2(), __toCommonJS(dist_exports));
|
|
20644
|
-
var logger$o =
|
|
20645
|
-
var abortController =
|
|
20646
|
-
var coreUtil =
|
|
20642
|
+
var logger$o = require_dist3();
|
|
20643
|
+
var abortController = require_dist();
|
|
20644
|
+
var coreUtil = require_dist2();
|
|
20647
20645
|
var coreClient = require_dist9();
|
|
20648
20646
|
var coreRestPipeline = require_dist8();
|
|
20649
20647
|
var coreTracing = require_dist7();
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createBlobStorageUrl
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5BUSQ7SW.js";
|
|
4
4
|
import {
|
|
5
5
|
require_dist
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-4P62L7ZZ.js";
|
|
6
|
+
} from "./chunk-YAIY33BG.js";
|
|
8
7
|
import {
|
|
9
8
|
__name,
|
|
10
9
|
__toESM,
|
|
11
10
|
init_esbuildCjsShims
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OPD65OLQ.js";
|
|
13
12
|
|
|
14
13
|
// src/getListOfBlobs.ts
|
|
15
14
|
init_esbuildCjsShims();
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_dist
|
|
3
|
+
} from "./chunk-YAIY33BG.js";
|
|
1
4
|
import {
|
|
2
5
|
__name,
|
|
6
|
+
__toESM,
|
|
3
7
|
init_esbuildCjsShims
|
|
4
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-OPD65OLQ.js";
|
|
5
9
|
|
|
6
10
|
// src/index.ts
|
|
7
11
|
init_esbuildCjsShims();
|
|
@@ -78,32 +82,77 @@ var blockListIsInvalidRetryPolicy = {
|
|
|
78
82
|
|
|
79
83
|
// src/createRemoteCacheClient.ts
|
|
80
84
|
import { RetryManager } from "@ms-cloudpack/retry";
|
|
85
|
+
|
|
86
|
+
// src/error/transformError.ts
|
|
87
|
+
init_esbuildCjsShims();
|
|
88
|
+
|
|
89
|
+
// src/error/RemoteCacheError.ts
|
|
90
|
+
init_esbuildCjsShims();
|
|
91
|
+
var _RemoteCacheError = class _RemoteCacheError extends Error {
|
|
92
|
+
constructor(code, message) {
|
|
93
|
+
super(message);
|
|
94
|
+
this._code = code;
|
|
95
|
+
}
|
|
96
|
+
get code() {
|
|
97
|
+
return this._code;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
__name(_RemoteCacheError, "RemoteCacheError");
|
|
101
|
+
var RemoteCacheError = _RemoteCacheError;
|
|
102
|
+
|
|
103
|
+
// src/error/isRestError.ts
|
|
104
|
+
init_esbuildCjsShims();
|
|
105
|
+
var import_storage_blob = __toESM(require_dist(), 1);
|
|
106
|
+
function isRestError(error) {
|
|
107
|
+
return error instanceof import_storage_blob.RestError;
|
|
108
|
+
}
|
|
109
|
+
__name(isRestError, "isRestError");
|
|
110
|
+
|
|
111
|
+
// src/error/transformError.ts
|
|
112
|
+
function transformError(error) {
|
|
113
|
+
if (isRestError(error) && error.statusCode === 401 || error instanceof Error && error.name === "AuthenticationRequiredError") {
|
|
114
|
+
return new RemoteCacheError("AUTH_ERROR", "Authentication failed. Please check your credentials and try again.");
|
|
115
|
+
}
|
|
116
|
+
if (isRestError(error) && error.code === "REQUEST_SEND_ERROR") {
|
|
117
|
+
return new RemoteCacheError("CONNECTION_ERROR", "Connection failed. Please check your connection.");
|
|
118
|
+
}
|
|
119
|
+
return error;
|
|
120
|
+
}
|
|
121
|
+
__name(transformError, "transformError");
|
|
122
|
+
|
|
123
|
+
// src/createRemoteCacheClient.ts
|
|
81
124
|
async function createRemoteCacheClient(params) {
|
|
82
125
|
const { context, options } = params;
|
|
83
126
|
const { container, loginMethod, storageAccount, cachePath, tenantId } = options;
|
|
84
|
-
const { getCredential } = await import("./getCredential-
|
|
85
|
-
const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-
|
|
86
|
-
const { ReporterDecorator } = await import("./ReporterDecorator-
|
|
87
|
-
const { getListOfBlobs } = await import("./getListOfBlobs-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
127
|
+
const { getCredential } = await import("./getCredential-FIEDCLGJ.js");
|
|
128
|
+
const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-NBBUAAXL.js");
|
|
129
|
+
const { ReporterDecorator } = await import("./ReporterDecorator-YCOIU5LI.js");
|
|
130
|
+
const { getListOfBlobs } = await import("./getListOfBlobs-VRDJ4A5S.js");
|
|
131
|
+
try {
|
|
132
|
+
const credential = await getCredential(loginMethod, cachePath, tenantId);
|
|
133
|
+
const remoteCacheClientOptions = {
|
|
134
|
+
storageAccount,
|
|
135
|
+
container,
|
|
136
|
+
credential
|
|
137
|
+
};
|
|
138
|
+
const listOfBlobs = await getListOfBlobs(remoteCacheClientOptions);
|
|
139
|
+
const client = new ReporterDecorator(
|
|
140
|
+
new RetryDecorator({
|
|
141
|
+
retryManager: new RetryManager([blockListIsInvalidRetryPolicy]),
|
|
142
|
+
cacheClient: new InMemoryDecorator({
|
|
143
|
+
cacheClient: new AzureRemoteCacheClient(remoteCacheClientOptions),
|
|
144
|
+
getList: () => Promise.resolve(listOfBlobs)
|
|
145
|
+
})
|
|
146
|
+
}),
|
|
147
|
+
context
|
|
148
|
+
);
|
|
149
|
+
return client;
|
|
150
|
+
} catch (error) {
|
|
151
|
+
throw transformError(error);
|
|
152
|
+
}
|
|
105
153
|
}
|
|
106
154
|
__name(createRemoteCacheClient, "createRemoteCacheClient");
|
|
107
155
|
export {
|
|
156
|
+
RemoteCacheError,
|
|
108
157
|
createRemoteCacheClient
|
|
109
158
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type RemoteCacheErrorType = 'CONNECTION_ERROR' | 'AUTH_ERROR';
|
|
2
|
+
/**
|
|
3
|
+
* An error thrown by a remote cache client.
|
|
4
|
+
*/
|
|
5
|
+
export declare class RemoteCacheError extends Error {
|
|
6
|
+
private _code;
|
|
7
|
+
constructor(code: RemoteCacheErrorType, message: string);
|
|
8
|
+
get code(): RemoteCacheErrorType;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=RemoteCacheError.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms an error into a RemoteCacheError if it is a known error type.
|
|
3
|
+
* @param error - The error to transform.
|
|
4
|
+
* @returns - The transformed error or the original error if it is not a known error type.
|
|
5
|
+
*/
|
|
6
|
+
export declare function transformError(error: unknown): unknown;
|
|
7
|
+
//# sourceMappingURL=transformError.d.ts.map
|
package/lib/index.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ export { createRemoteCacheClient, type CreateRemoteCacheClientParams } from './c
|
|
|
2
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
|
+
export { RemoteCacheError } from './error/RemoteCacheError.js';
|
|
6
|
+
export type { RemoteCacheErrorType } from './error/RemoteCacheError.js';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/remote-cache",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
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.13.
|
|
32
|
+
"@ms-cloudpack/task-reporter": "^0.13.1",
|
|
33
33
|
"@ms-cloudpack/telemetry": "^0.5.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
package/dist/chunk-TQLTL4XO.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
-
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined")
|
|
12
|
-
return require.apply(this, arguments);
|
|
13
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
-
});
|
|
15
|
-
var __esm = (fn, res) => function __init() {
|
|
16
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
|
-
};
|
|
18
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
19
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
20
|
-
};
|
|
21
|
-
var __export = (target, all) => {
|
|
22
|
-
for (var name in all)
|
|
23
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
-
};
|
|
25
|
-
var __copyProps = (to, from, except, desc) => {
|
|
26
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
-
for (let key of __getOwnPropNames(from))
|
|
28
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
30
|
-
}
|
|
31
|
-
return to;
|
|
32
|
-
};
|
|
33
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
34
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
35
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
36
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
37
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
38
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
39
|
-
mod
|
|
40
|
-
));
|
|
41
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
42
|
-
|
|
43
|
-
// ../../scripts/esbuildCjsShims.js
|
|
44
|
-
import { createRequire } from "node:module";
|
|
45
|
-
import path from "node:path";
|
|
46
|
-
import url from "node:url";
|
|
47
|
-
var init_esbuildCjsShims = __esm({
|
|
48
|
-
"../../scripts/esbuildCjsShims.js"() {
|
|
49
|
-
"use strict";
|
|
50
|
-
globalThis.require = createRequire(import.meta.url);
|
|
51
|
-
globalThis.__filename = url.fileURLToPath(import.meta.url);
|
|
52
|
-
globalThis.__dirname = path.dirname(__filename);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
export {
|
|
57
|
-
__name,
|
|
58
|
-
__require,
|
|
59
|
-
__esm,
|
|
60
|
-
__commonJS,
|
|
61
|
-
__export,
|
|
62
|
-
__toESM,
|
|
63
|
-
__toCommonJS,
|
|
64
|
-
init_esbuildCjsShims
|
|
65
|
-
};
|