@lage-run/cache 1.1.7 → 1.3.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/CHANGELOG.json +31 -1
- package/CHANGELOG.md +18 -2
- package/README.md +1 -1
- package/lib/CredentialCache.d.ts +5 -0
- package/lib/CredentialCache.js +33 -0
- package/lib/backfillWrapper.d.ts +2 -1
- package/lib/backfillWrapper.js +25 -1
- package/package.json +2 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,37 @@
|
|
|
2
2
|
"name": "@lage-run/cache",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 18 Jun 2024 00:31:16 GMT",
|
|
6
|
+
"version": "1.3.0",
|
|
7
|
+
"tag": "@lage-run/cache_v1.3.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "brunoru@microsoft.com",
|
|
12
|
+
"package": "@lage-run/cache",
|
|
13
|
+
"commit": "e937af3a04e0af29a2ad36e57b2f4169d4d5c628",
|
|
14
|
+
"comment": "Default fallback with optional pre-set credentials"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Mon, 10 Jun 2024 23:50:39 GMT",
|
|
21
|
+
"version": "1.2.0",
|
|
22
|
+
"tag": "@lage-run/cache_v1.2.0",
|
|
23
|
+
"comments": {
|
|
24
|
+
"minor": [
|
|
25
|
+
{
|
|
26
|
+
"author": "brunoru@microsoft.com",
|
|
27
|
+
"package": "@lage-run/cache",
|
|
28
|
+
"commit": "0894d97ebfedc339b77161c40fa8643d93e4486d",
|
|
29
|
+
"comment": "Add support for DefaultAzureCredentials when storage endpoint is passed in."
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Thu, 23 May 2024 18:15:05 GMT",
|
|
6
36
|
"version": "1.1.7",
|
|
7
37
|
"tag": "@lage-run/cache_v1.1.7",
|
|
8
38
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
# Change Log - @lage-run/cache
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 18 Jun 2024 00:31:16 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.3.0
|
|
8
|
+
|
|
9
|
+
Tue, 18 Jun 2024 00:31:16 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Default fallback with optional pre-set credentials (brunoru@microsoft.com)
|
|
14
|
+
|
|
15
|
+
## 1.2.0
|
|
16
|
+
|
|
17
|
+
Mon, 10 Jun 2024 23:50:39 GMT
|
|
18
|
+
|
|
19
|
+
### Minor changes
|
|
20
|
+
|
|
21
|
+
- Add support for DefaultAzureCredentials when storage endpoint is passed in. (brunoru@microsoft.com)
|
|
22
|
+
|
|
7
23
|
## 1.1.7
|
|
8
24
|
|
|
9
|
-
Thu, 23 May 2024 18:
|
|
25
|
+
Thu, 23 May 2024 18:15:05 GMT
|
|
10
26
|
|
|
11
27
|
### Patches
|
|
12
28
|
|
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ const remoteFallbackCacheProviderOptions = {
|
|
|
32
32
|
cacheStorageOptions: {
|
|
33
33
|
provider: "azure-blob",
|
|
34
34
|
options: {
|
|
35
|
-
connectionString: "asdfasdfasdfafds";
|
|
35
|
+
connectionString: "asdfasdfasdfafds"; // Providing an un-authenitcated Blob Service Endpoint will force use of Azure DefualtAzureCredentials
|
|
36
36
|
container: "container";
|
|
37
37
|
maxSize?: 150;
|
|
38
38
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "CredentialCache", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return CredentialCache;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _identity = require("@azure/identity");
|
|
12
|
+
function _define_property(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
25
|
+
class CredentialCache {
|
|
26
|
+
static getInstance() {
|
|
27
|
+
if (!this.credential) {
|
|
28
|
+
this.credential = new _identity.DefaultAzureCredential();
|
|
29
|
+
}
|
|
30
|
+
return this.credential;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
_define_property(CredentialCache, "credential", null);
|
package/lib/backfillWrapper.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Backfill wrappers: some functions that uses the `backfill` library that doesn't require them to be inside a class
|
|
3
3
|
*/
|
|
4
|
+
import { CacheStorageConfig } from "backfill-config";
|
|
4
5
|
import type { Logger as BackfillLogger } from "backfill-logger";
|
|
5
6
|
import type { CacheOptions } from "./types/CacheOptions.js";
|
|
6
7
|
export declare function createBackfillLogger(): BackfillLogger;
|
|
7
8
|
export declare function createBackfillCacheConfig(cwd: string, cacheOptions: Partial<CacheOptions> | undefined, backfillLogger: BackfillLogger): {
|
|
8
|
-
cacheStorageConfig:
|
|
9
|
+
cacheStorageConfig: CacheStorageConfig;
|
|
9
10
|
clearOutput: boolean;
|
|
10
11
|
internalCacheFolder: string;
|
|
11
12
|
logFolder: string;
|
package/lib/backfillWrapper.js
CHANGED
|
@@ -21,6 +21,7 @@ _export(exports, {
|
|
|
21
21
|
const _os = /*#__PURE__*/ _interop_require_wildcard(require("os"));
|
|
22
22
|
const _backfillconfig = require("backfill-config");
|
|
23
23
|
const _backfilllogger = require("backfill-logger");
|
|
24
|
+
const _CredentialCache = require("./CredentialCache.js");
|
|
24
25
|
function _getRequireWildcardCache(nodeInterop) {
|
|
25
26
|
if (typeof WeakMap !== "function") return null;
|
|
26
27
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -79,9 +80,32 @@ function createBackfillLogger() {
|
|
|
79
80
|
}
|
|
80
81
|
function createBackfillCacheConfig(cwd, cacheOptions = {}, backfillLogger) {
|
|
81
82
|
const envConfig = (0, _backfillconfig.getEnvConfig)(backfillLogger);
|
|
82
|
-
|
|
83
|
+
// To avoid weakmap issues, we need to store the credential and restore post-merge
|
|
84
|
+
const credentialStash = getCredentialStash(cacheOptions);
|
|
85
|
+
const mergedConfig = {
|
|
83
86
|
...(0, _backfillconfig.createDefaultConfig)(cwd),
|
|
84
87
|
...cacheOptions,
|
|
85
88
|
...envConfig
|
|
86
89
|
};
|
|
90
|
+
applyCredentialStashToMergedConfig(mergedConfig, credentialStash);
|
|
91
|
+
return mergedConfig;
|
|
92
|
+
}
|
|
93
|
+
function getCredentialStash(cacheOptions) {
|
|
94
|
+
if (cacheOptions.cacheStorageConfig && cacheOptions.cacheStorageConfig.provider === "azure-blob" && cacheOptions.cacheStorageConfig.options.credential) {
|
|
95
|
+
const stashedCredential = cacheOptions.cacheStorageConfig.options.credential;
|
|
96
|
+
delete cacheOptions.cacheStorageConfig.options.credential;
|
|
97
|
+
return stashedCredential;
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
function applyCredentialStashToMergedConfig(mergedConfig, credentialStash) {
|
|
102
|
+
if (mergedConfig.cacheStorageConfig.provider === "azure-blob") {
|
|
103
|
+
const connectionString = mergedConfig.cacheStorageConfig.options.connectionString;
|
|
104
|
+
if (connectionString && !isTokenConnectionString(connectionString)) {
|
|
105
|
+
mergedConfig.cacheStorageConfig.options.credential = credentialStash || _CredentialCache.CredentialCache.getInstance();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function isTokenConnectionString(connectionString) {
|
|
110
|
+
return connectionString.includes("SharedAccessSignature");
|
|
87
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/cache",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Cache for Lage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"lint": "monorepo-scripts lint"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@azure/identity": "^4.0.1",
|
|
20
21
|
"@lage-run/target-graph": "^0.8.9",
|
|
21
22
|
"@lage-run/logger": "^1.3.0",
|
|
22
23
|
"backfill-cache": "5.8.0",
|