@ms-cloudpack/remote-cache 0.6.5 → 0.7.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/dist/{AzureRemoteCacheClient-NBBUAAXL.js → AzureRemoteCacheClient-NEV2XCF7.js} +4 -3
- package/dist/{ReporterDecorator-YCOIU5LI.js → ReporterDecorator-SNBYNGOT.js} +3 -2
- package/dist/{chunk-OPD65OLQ.js → chunk-4P62L7ZZ.js} +762 -816
- package/dist/{chunk-YAIY33BG.js → chunk-KFSFZYG6.js} +19 -17
- package/dist/{chunk-5BUSQ7SW.js → chunk-R2VDVRDZ.js} +1 -1
- package/dist/chunk-TQLTL4XO.js +65 -0
- package/dist/{getCredential-FIEDCLGJ.js → getCredential-DHB4UIE2.js} +18 -16
- package/dist/{getListOfBlobs-VRDJ4A5S.js → getListOfBlobs-E5OFG2MF.js} +4 -3
- package/dist/index.js +23 -71
- package/lib/index.d.ts +0 -2
- package/package.json +1 -1
- package/lib/error/RemoteCacheError.d.ts +0 -10
- package/lib/error/isRestError.d.ts +0 -3
- package/lib/error/transformError.d.ts +0 -7
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__commonJS,
|
|
3
|
-
__esm,
|
|
4
|
-
__export,
|
|
5
|
-
__name,
|
|
6
|
-
__require,
|
|
7
|
-
__toCommonJS,
|
|
8
2
|
esm_node_exports,
|
|
9
|
-
init_esbuildCjsShims,
|
|
10
3
|
init_esm_node,
|
|
11
4
|
init_tslib_es6,
|
|
12
5
|
require_dist,
|
|
13
6
|
require_dist2,
|
|
14
7
|
require_dist3,
|
|
15
8
|
tslib_es6_exports
|
|
16
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4P62L7ZZ.js";
|
|
10
|
+
import {
|
|
11
|
+
__commonJS,
|
|
12
|
+
__esm,
|
|
13
|
+
__export,
|
|
14
|
+
__name,
|
|
15
|
+
__require,
|
|
16
|
+
__toCommonJS,
|
|
17
|
+
init_esbuildCjsShims
|
|
18
|
+
} from "./chunk-TQLTL4XO.js";
|
|
17
19
|
|
|
18
20
|
// ../../node_modules/.store/xml2js-npm-0.5.0-06e57a2771/package/lib/defaults.js
|
|
19
21
|
var require_defaults = __commonJS({
|
|
@@ -6067,7 +6069,7 @@ var require_dist4 = __commonJS({
|
|
|
6067
6069
|
"use strict";
|
|
6068
6070
|
init_esbuildCjsShims();
|
|
6069
6071
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6070
|
-
var coreUtil =
|
|
6072
|
+
var coreUtil = require_dist3();
|
|
6071
6073
|
var _AzureKeyCredential = class _AzureKeyCredential {
|
|
6072
6074
|
/**
|
|
6073
6075
|
* The value of the key to be used in authentication
|
|
@@ -20925,13 +20927,13 @@ var require_dist6 = __commonJS({
|
|
|
20925
20927
|
var util = __require("util");
|
|
20926
20928
|
var tslib = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
20927
20929
|
var xml2js = require_xml2js();
|
|
20928
|
-
var coreUtil =
|
|
20929
|
-
var logger$1 =
|
|
20930
|
+
var coreUtil = require_dist3();
|
|
20931
|
+
var logger$1 = require_dist();
|
|
20930
20932
|
var coreAuth = require_dist4();
|
|
20931
20933
|
var os = __require("os");
|
|
20932
20934
|
var http = __require("http");
|
|
20933
20935
|
var https = __require("https");
|
|
20934
|
-
var abortController =
|
|
20936
|
+
var abortController = require_dist2();
|
|
20935
20937
|
var tunnel = require_package();
|
|
20936
20938
|
var stream = __require("stream");
|
|
20937
20939
|
var FormData = require_form_data();
|
|
@@ -25485,9 +25487,9 @@ var require_dist8 = __commonJS({
|
|
|
25485
25487
|
"use strict";
|
|
25486
25488
|
init_esbuildCjsShims();
|
|
25487
25489
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25488
|
-
var logger$1 =
|
|
25489
|
-
var abortController =
|
|
25490
|
-
var coreUtil =
|
|
25490
|
+
var logger$1 = require_dist();
|
|
25491
|
+
var abortController = require_dist2();
|
|
25492
|
+
var coreUtil = require_dist3();
|
|
25491
25493
|
var logger = logger$1.createClientLogger("core-lro");
|
|
25492
25494
|
var POLL_INTERVAL_IN_MS = 2e3;
|
|
25493
25495
|
var terminalStates = ["succeeded", "canceled", "failed"];
|
|
@@ -26536,8 +26538,8 @@ var require_dist9 = __commonJS({
|
|
|
26536
26538
|
var coreHttp = require_dist6();
|
|
26537
26539
|
var tslib = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
|
26538
26540
|
var coreTracing = require_dist5();
|
|
26539
|
-
var logger$1 =
|
|
26540
|
-
var abortController =
|
|
26541
|
+
var logger$1 = require_dist();
|
|
26542
|
+
var abortController = require_dist2();
|
|
26541
26543
|
var os = __require("os");
|
|
26542
26544
|
var crypto = __require("crypto");
|
|
26543
26545
|
var stream = __require("stream");
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
};
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__commonJS,
|
|
3
|
-
__esm,
|
|
4
|
-
__export,
|
|
5
|
-
__name,
|
|
6
|
-
__require,
|
|
7
|
-
__toCommonJS,
|
|
8
|
-
__toESM,
|
|
9
|
-
init_esbuildCjsShims,
|
|
10
2
|
init_esm_node,
|
|
11
3
|
init_tslib_es6,
|
|
12
4
|
require_dist,
|
|
@@ -14,7 +6,17 @@ import {
|
|
|
14
6
|
require_dist3,
|
|
15
7
|
tslib_es6_exports,
|
|
16
8
|
v4_default
|
|
17
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-4P62L7ZZ.js";
|
|
10
|
+
import {
|
|
11
|
+
__commonJS,
|
|
12
|
+
__esm,
|
|
13
|
+
__export,
|
|
14
|
+
__name,
|
|
15
|
+
__require,
|
|
16
|
+
__toCommonJS,
|
|
17
|
+
__toESM,
|
|
18
|
+
init_esbuildCjsShims
|
|
19
|
+
} from "./chunk-TQLTL4XO.js";
|
|
18
20
|
|
|
19
21
|
// ../../node_modules/.store/@azure-msal-node-npm-2.6.2-9183813942/package/dist/cache/serializer/Serializer.mjs
|
|
20
22
|
var _Serializer, Serializer;
|
|
@@ -16522,10 +16524,10 @@ var require_dist8 = __commonJS({
|
|
|
16522
16524
|
"use strict";
|
|
16523
16525
|
init_esbuildCjsShims();
|
|
16524
16526
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16525
|
-
var logger$1 =
|
|
16526
|
-
var coreUtil =
|
|
16527
|
+
var logger$1 = require_dist();
|
|
16528
|
+
var coreUtil = require_dist3();
|
|
16527
16529
|
var os = __require("os");
|
|
16528
|
-
var abortController =
|
|
16530
|
+
var abortController = require_dist2();
|
|
16529
16531
|
var httpsProxyAgent = require_dist4();
|
|
16530
16532
|
var httpProxyAgent = require_dist6();
|
|
16531
16533
|
var coreTracing = require_dist7();
|
|
@@ -18553,7 +18555,7 @@ var require_dist9 = __commonJS({
|
|
|
18553
18555
|
init_esbuildCjsShims();
|
|
18554
18556
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18555
18557
|
var coreRestPipeline = require_dist8();
|
|
18556
|
-
var logger$1 =
|
|
18558
|
+
var logger$1 = require_dist();
|
|
18557
18559
|
function encodeByteArray(value) {
|
|
18558
18560
|
const bufferValue = value instanceof Buffer ? value : Buffer.from(value.buffer);
|
|
18559
18561
|
return bufferValue.toString("base64");
|
|
@@ -20639,9 +20641,9 @@ var require_dist10 = __commonJS({
|
|
|
20639
20641
|
init_esbuildCjsShims();
|
|
20640
20642
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20641
20643
|
var msalCommon = (init_dist2(), __toCommonJS(dist_exports));
|
|
20642
|
-
var logger$o =
|
|
20643
|
-
var abortController =
|
|
20644
|
-
var coreUtil =
|
|
20644
|
+
var logger$o = require_dist();
|
|
20645
|
+
var abortController = require_dist2();
|
|
20646
|
+
var coreUtil = require_dist3();
|
|
20645
20647
|
var coreClient = require_dist9();
|
|
20646
20648
|
var coreRestPipeline = require_dist8();
|
|
20647
20649
|
var coreTracing = require_dist7();
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createBlobStorageUrl
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-R2VDVRDZ.js";
|
|
4
4
|
import {
|
|
5
5
|
require_dist
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KFSFZYG6.js";
|
|
7
|
+
import "./chunk-4P62L7ZZ.js";
|
|
7
8
|
import {
|
|
8
9
|
__name,
|
|
9
10
|
__toESM,
|
|
10
11
|
init_esbuildCjsShims
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TQLTL4XO.js";
|
|
12
13
|
|
|
13
14
|
// src/getListOfBlobs.ts
|
|
14
15
|
init_esbuildCjsShims();
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
require_dist
|
|
3
|
-
} from "./chunk-YAIY33BG.js";
|
|
4
1
|
import {
|
|
5
2
|
__name,
|
|
6
|
-
__toESM,
|
|
7
3
|
init_esbuildCjsShims
|
|
8
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TQLTL4XO.js";
|
|
9
5
|
|
|
10
6
|
// src/index.ts
|
|
11
7
|
init_esbuildCjsShims();
|
|
@@ -82,77 +78,33 @@ var blockListIsInvalidRetryPolicy = {
|
|
|
82
78
|
|
|
83
79
|
// src/createRemoteCacheClient.ts
|
|
84
80
|
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
|
|
124
81
|
async function createRemoteCacheClient(params) {
|
|
125
82
|
const { context, options } = params;
|
|
126
83
|
const { container, loginMethod, storageAccount, cachePath, tenantId } = options;
|
|
127
|
-
const { getCredential } = await import("./getCredential-
|
|
128
|
-
const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-
|
|
129
|
-
const { ReporterDecorator } = await import("./ReporterDecorator-
|
|
130
|
-
const { getListOfBlobs } = await import("./getListOfBlobs-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
new
|
|
141
|
-
|
|
142
|
-
cacheClient: new
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return client;
|
|
150
|
-
} catch (error) {
|
|
151
|
-
throw transformError(error);
|
|
152
|
-
}
|
|
84
|
+
const { getCredential } = await import("./getCredential-DHB4UIE2.js");
|
|
85
|
+
const { AzureRemoteCacheClient } = await import("./AzureRemoteCacheClient-NEV2XCF7.js");
|
|
86
|
+
const { ReporterDecorator } = await import("./ReporterDecorator-SNBYNGOT.js");
|
|
87
|
+
const { getListOfBlobs } = await import("./getListOfBlobs-E5OFG2MF.js");
|
|
88
|
+
const credential = await getCredential(loginMethod, cachePath, tenantId);
|
|
89
|
+
const remoteCacheClientOptions = {
|
|
90
|
+
storageAccount,
|
|
91
|
+
container,
|
|
92
|
+
credential
|
|
93
|
+
};
|
|
94
|
+
const listOfBlobs = await getListOfBlobs(remoteCacheClientOptions);
|
|
95
|
+
const client = new ReporterDecorator(
|
|
96
|
+
new RetryDecorator({
|
|
97
|
+
retryManager: new RetryManager([blockListIsInvalidRetryPolicy]),
|
|
98
|
+
cacheClient: new InMemoryDecorator({
|
|
99
|
+
cacheClient: new AzureRemoteCacheClient(remoteCacheClientOptions),
|
|
100
|
+
getList: () => Promise.resolve(listOfBlobs)
|
|
101
|
+
})
|
|
102
|
+
}),
|
|
103
|
+
context
|
|
104
|
+
);
|
|
105
|
+
return client;
|
|
153
106
|
}
|
|
154
107
|
__name(createRemoteCacheClient, "createRemoteCacheClient");
|
|
155
108
|
export {
|
|
156
|
-
RemoteCacheError,
|
|
157
109
|
createRemoteCacheClient
|
|
158
110
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,4 @@ 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';
|
|
7
5
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|