@lage-run/cache 1.2.0 → 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 CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@lage-run/cache",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 10 Jun 2024 23:50:24 GMT",
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",
6
21
  "version": "1.2.0",
7
22
  "tag": "@lage-run/cache_v1.2.0",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @lage-run/cache
2
2
 
3
- This log was last generated on Mon, 10 Jun 2024 23:50:24 GMT and should not be manually modified.
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
+
7
15
  ## 1.2.0
8
16
 
9
- Mon, 10 Jun 2024 23:50:24 GMT
17
+ Mon, 10 Jun 2024 23:50:39 GMT
10
18
 
11
19
  ### Minor changes
12
20
 
@@ -80,17 +80,31 @@ function createBackfillLogger() {
80
80
  }
81
81
  function createBackfillCacheConfig(cwd, cacheOptions = {}, backfillLogger) {
82
82
  const envConfig = (0, _backfillconfig.getEnvConfig)(backfillLogger);
83
+ // To avoid weakmap issues, we need to store the credential and restore post-merge
84
+ const credentialStash = getCredentialStash(cacheOptions);
83
85
  const mergedConfig = {
84
86
  ...(0, _backfillconfig.createDefaultConfig)(cwd),
85
87
  ...cacheOptions,
86
88
  ...envConfig
87
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) {
88
102
  if (mergedConfig.cacheStorageConfig.provider === "azure-blob") {
89
- if (mergedConfig.cacheStorageConfig.options.connectionString && !isTokenConnectionString(mergedConfig.cacheStorageConfig.options.connectionString)) {
90
- mergedConfig.cacheStorageConfig.options.credential = _CredentialCache.CredentialCache.getInstance();
103
+ const connectionString = mergedConfig.cacheStorageConfig.options.connectionString;
104
+ if (connectionString && !isTokenConnectionString(connectionString)) {
105
+ mergedConfig.cacheStorageConfig.options.credential = credentialStash || _CredentialCache.CredentialCache.getInstance();
91
106
  }
92
107
  }
93
- return mergedConfig;
94
108
  }
95
109
  function isTokenConnectionString(connectionString) {
96
110
  return connectionString.includes("SharedAccessSignature");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/cache",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Cache for Lage",
5
5
  "repository": {
6
6
  "type": "git",