@lage-run/cache 1.1.6 → 1.2.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,37 @@
2
2
  "name": "@lage-run/cache",
3
3
  "entries": [
4
4
  {
5
- "date": "Sun, 05 May 2024 22:55:31 GMT",
5
+ "date": "Mon, 10 Jun 2024 23:50:24 GMT",
6
+ "version": "1.2.0",
7
+ "tag": "@lage-run/cache_v1.2.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "brunoru@microsoft.com",
12
+ "package": "@lage-run/cache",
13
+ "commit": "0894d97ebfedc339b77161c40fa8643d93e4486d",
14
+ "comment": "Add support for DefaultAzureCredentials when storage endpoint is passed in."
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Thu, 23 May 2024 18:15:05 GMT",
21
+ "version": "1.1.7",
22
+ "tag": "@lage-run/cache_v1.1.7",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "renovate@whitesourcesoftware.com",
27
+ "package": "@lage-run/cache",
28
+ "commit": "04cdac2a148208348ea26f0d0190b90f947d2cfd",
29
+ "comment": "Update backfill monorepo"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Sun, 05 May 2024 22:55:45 GMT",
6
36
  "version": "1.1.6",
7
37
  "tag": "@lage-run/cache_v1.1.6",
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 Sun, 05 May 2024 22:55:31 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 10 Jun 2024 23:50:24 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.2.0
8
+
9
+ Mon, 10 Jun 2024 23:50:24 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Add support for DefaultAzureCredentials when storage endpoint is passed in. (brunoru@microsoft.com)
14
+
15
+ ## 1.1.7
16
+
17
+ Thu, 23 May 2024 18:15:05 GMT
18
+
19
+ ### Patches
20
+
21
+ - Update backfill monorepo (renovate@whitesourcesoftware.com)
22
+
7
23
  ## 1.1.6
8
24
 
9
- Sun, 05 May 2024 22:55:31 GMT
25
+ Sun, 05 May 2024 22:55:45 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,5 @@
1
+ import { DefaultAzureCredential } from "@azure/identity";
2
+ export declare class CredentialCache {
3
+ private static credential;
4
+ static getInstance(): DefaultAzureCredential;
5
+ }
@@ -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);
@@ -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: import("backfill-config").CacheStorageConfig;
9
+ cacheStorageConfig: CacheStorageConfig;
9
10
  clearOutput: boolean;
10
11
  internalCacheFolder: string;
11
12
  logFolder: string;
@@ -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,18 @@ function createBackfillLogger() {
79
80
  }
80
81
  function createBackfillCacheConfig(cwd, cacheOptions = {}, backfillLogger) {
81
82
  const envConfig = (0, _backfillconfig.getEnvConfig)(backfillLogger);
82
- return {
83
+ const mergedConfig = {
83
84
  ...(0, _backfillconfig.createDefaultConfig)(cwd),
84
85
  ...cacheOptions,
85
86
  ...envConfig
86
87
  };
88
+ 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();
91
+ }
92
+ }
93
+ return mergedConfig;
94
+ }
95
+ function isTokenConnectionString(connectionString) {
96
+ return connectionString.includes("SharedAccessSignature");
87
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/cache",
3
- "version": "1.1.6",
3
+ "version": "1.2.0",
4
4
  "description": "Cache for Lage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,10 +17,11 @@
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
- "backfill-cache": "5.7.1",
23
- "backfill-config": "6.4.1",
23
+ "backfill-cache": "5.8.0",
24
+ "backfill-config": "6.4.2",
24
25
  "backfill-logger": "5.2.1",
25
26
  "glob-hasher": "^1.4.2"
26
27
  },