@adobe/helix-shared-config 10.0.1 → 10.0.3

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.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [@adobe/helix-shared-config-v10.0.3](https://github.com/adobe/helix-shared/compare/@adobe/helix-shared-config-v10.0.2...@adobe/helix-shared-config-v10.0.3) (2023-04-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update dependency lru-cache to v9 ([#783](https://github.com/adobe/helix-shared/issues/783)) ([1b454af](https://github.com/adobe/helix-shared/commit/1b454afdcf6a21cf70fcb888fea22a41628abb94))
7
+
8
+ # [@adobe/helix-shared-config-v10.0.2](https://github.com/adobe/helix-shared/compare/@adobe/helix-shared-config-v10.0.1...@adobe/helix-shared-config-v10.0.2) (2023-03-21)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency lru-cache to v8 ([#774](https://github.com/adobe/helix-shared/issues/774)) ([07aa5ba](https://github.com/adobe/helix-shared/commit/07aa5ba969f6043bdf5d07e760d99dcb22f511d7))
14
+
1
15
  # [@adobe/helix-shared-config-v10.0.1](https://github.com/adobe/helix-shared/compare/@adobe/helix-shared-config-v10.0.0...@adobe/helix-shared-config-v10.0.1) (2023-02-22)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-shared-config",
3
- "version": "10.0.1",
3
+ "version": "10.0.3",
4
4
  "description": "Shared modules of the Helix Project - config",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -36,9 +36,9 @@
36
36
  "ajv": "8.12.0",
37
37
  "ajv-formats": "2.1.1",
38
38
  "cookie": "0.5.0",
39
- "fs-extra": "11.1.0",
39
+ "fs-extra": "11.1.1",
40
40
  "ignore": "5.2.4",
41
- "lru-cache": "7.14.1",
41
+ "lru-cache": "9.0.1",
42
42
  "object-hash": "3.0.0",
43
43
  "uri-js": "4.4.1",
44
44
  "yaml": "2.2.1"
@@ -0,0 +1,110 @@
1
+ /*
2
+ * Copyright 2023 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ export interface MountConfig {
13
+ /**
14
+ * Defines a mapping between mount points and source URLs.
15
+ * Mount points **must** start with a slash (`/`) but may not end with one.
16
+ */
17
+ mountpoints: {
18
+ [k: string]: string|MountPoint;
19
+ };
20
+
21
+ /**
22
+ * Mapping from subtrees to single sources for catch-all folder support.
23
+ */
24
+ folders?: {
25
+ /**
26
+ * This interface was referenced by `undefined`'s JSON-Schema definition
27
+ * via the `patternProperty` "^/.*[^/]$".
28
+ */
29
+ [k: string]: string;
30
+ };
31
+
32
+ /**
33
+ * Matches the given resource path against the mount points and returns the mount point if found.
34
+ * The mount point will also include a `relPath` property, which denotes the relative path
35
+ * from the mount points root.
36
+ *
37
+ * @param {string} resourcePath The resource path
38
+ * @returns {MountPoint|null} The matched mount point or {@code null}.
39
+ */
40
+ match(resourcePath): MatchResult|null;
41
+ }
42
+
43
+ export interface MatchResult extends MountPoint {
44
+ relPath:string;
45
+ }
46
+
47
+ export interface MountPoint extends OnedriveMountPoint, GoogleMountPoint, MarkupMountPoint {}
48
+
49
+ /**
50
+ * Defines the target URL where content should be retrieved from.
51
+ */
52
+ export interface BaseMountPoint {
53
+ path: string;
54
+
55
+ url: string;
56
+
57
+ /**
58
+ * mountpoint type
59
+ */
60
+ type?: 'onedrive' | 'google' | 'markup';
61
+
62
+ /**
63
+ * encrypted credentials.
64
+ */
65
+ credentials?: string[];
66
+
67
+ /**
68
+ * computed content-bus id.
69
+ */
70
+ contentBusId?: string;
71
+ }
72
+
73
+ /**
74
+ * Mountpoint to a sharepoint/onedrive root.
75
+ */
76
+ export interface OnedriveMountPoint extends BaseMountPoint {
77
+ /**
78
+ * suffix for markup type
79
+ */
80
+ suffix?: string;
81
+ /**
82
+ * Onedrive tenant id. If missing, it is computed from url.
83
+ */
84
+ tenantId?: string;
85
+ /**
86
+ * drive item id for google type
87
+ */
88
+ id?: string;
89
+ }
90
+
91
+ /**
92
+ * Mountpoint to a googledrive root.
93
+ */
94
+ export interface GoogleMountPoint extends BaseMountPoint {
95
+ /**
96
+ * drive item id
97
+ */
98
+ id?: string;
99
+ }
100
+
101
+ /**
102
+ * Mountpoint to a markup source root.
103
+ */
104
+ export interface MarkupMountPoint extends BaseMountPoint {
105
+ /**
106
+ * suffix
107
+ * @example '.raw.html'
108
+ */
109
+ suffix?: string;
110
+ }
@@ -10,9 +10,9 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import LRU from 'lru-cache';
13
+ import { LRUCache } from 'lru-cache';
14
14
 
15
- let lru = new LRU({ max: 1000, ttl: 60 * 1000 });
15
+ let lru = new LRUCache({ max: 1000, ttl: 60 * 1000 });
16
16
 
17
17
  /**
18
18
  * Returns a memoized version of the function `fn`.
@@ -74,7 +74,7 @@ export function cache(fn, opts = {}) {
74
74
  * @param {number} opts.max maximum size of the cache
75
75
  */
76
76
  export const options = (opts) => {
77
- lru = new LRU(opts);
77
+ lru = new LRUCache(opts);
78
78
 
79
79
  return cache;
80
80
  };
package/src/index.d.ts CHANGED
@@ -11,3 +11,4 @@
11
11
  */
12
12
  export * from './config-wrapper';
13
13
  export * from './ModifiersConfig';
14
+ export * from './MountConfig';