@forge/cli-shared 2.4.0-next.5 → 2.4.0-next.8
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 +23 -0
- package/out/cache/cached-conf.d.ts +14 -0
- package/out/cache/cached-conf.d.ts.map +1 -1
- package/out/cache/cached-conf.js +30 -4
- package/out/graphql/graphql-types.d.ts +507 -190
- package/out/graphql/graphql-types.d.ts.map +1 -1
- package/out/graphql/graphql-types.js +15 -1
- package/out/graphql/mutation-aware-graphql-client.d.ts +1 -1
- package/out/ui/text.d.ts +0 -2
- package/out/ui/text.d.ts.map +1 -1
- package/out/ui/text.js +2 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @forge/cli-shared
|
|
2
2
|
|
|
3
|
+
## 2.4.0-next.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [3d82376]
|
|
8
|
+
- @forge/manifest@3.5.0-next.7
|
|
9
|
+
|
|
10
|
+
## 2.4.0-next.7
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [f3ac287]
|
|
15
|
+
- Updated dependencies [0accde8]
|
|
16
|
+
- Updated dependencies [ffb508a]
|
|
17
|
+
- @forge/manifest@3.5.0-next.6
|
|
18
|
+
|
|
19
|
+
## 2.4.0-next.6
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [d196b41]
|
|
24
|
+
- @forge/manifest@3.5.0-next.5
|
|
25
|
+
|
|
3
26
|
## 2.4.0-next.5
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
interface CachedValue<E> {
|
|
2
|
+
value: E;
|
|
3
|
+
expiry: number | undefined;
|
|
4
|
+
}
|
|
5
|
+
interface ConfStore {
|
|
6
|
+
get(key: string): CachedValue<any> | undefined;
|
|
7
|
+
set(key: string, value: CachedValue<any>): void;
|
|
8
|
+
delete(key: string): void;
|
|
9
|
+
}
|
|
1
10
|
export declare class CachedConf {
|
|
2
11
|
private readonly conf;
|
|
3
12
|
constructor(projectName: string);
|
|
13
|
+
constructor(store: ConfStore);
|
|
4
14
|
get<T = string | object>(key: string): T | undefined;
|
|
5
15
|
set<T = string | object>(key: string, value: T, age?: number): void;
|
|
6
16
|
delete(key: string): void;
|
|
17
|
+
cached<T = string | object>(key: string, getter: () => T, age?: number): T;
|
|
18
|
+
cached<T = string | object>(key: string, getter: () => Promise<T>, age?: number): Promise<T>;
|
|
7
19
|
static getCache(projectName: string): CachedConf;
|
|
20
|
+
static memoryCache(): CachedConf;
|
|
8
21
|
}
|
|
22
|
+
export {};
|
|
9
23
|
//# sourceMappingURL=cached-conf.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cached-conf.d.ts","sourceRoot":"","sources":["../../src/cache/cached-conf.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cached-conf.d.ts","sourceRoot":"","sources":["../../src/cache/cached-conf.ts"],"names":[],"mappings":"AAEA,UAAU,WAAW,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC;IACT,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,UAAU,SAAS;IACjB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC/C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAChD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAID,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;gBAErB,WAAW,EAAE,MAAM;gBACnB,KAAK,EAAE,SAAS;IAYrB,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAapD,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAOnE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAWzB,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC;IAC1E,MAAM,CAAC,CAAC,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAkBnG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU;IAQhD,MAAM,CAAC,WAAW,IAAI,UAAU;CAGjC"}
|
package/out/cache/cached-conf.js
CHANGED
|
@@ -3,11 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CachedConf = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const conf_1 = tslib_1.__importDefault(require("conf"));
|
|
6
|
+
const isThenable = (input) => input && typeof input.then === 'function';
|
|
6
7
|
class CachedConf {
|
|
7
|
-
constructor(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
constructor(arg) {
|
|
9
|
+
if (typeof arg === 'string') {
|
|
10
|
+
this.conf = new conf_1.default({
|
|
11
|
+
projectName: arg
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
this.conf = arg;
|
|
16
|
+
}
|
|
11
17
|
}
|
|
12
18
|
get(key) {
|
|
13
19
|
const result = this.conf.get(key);
|
|
@@ -28,8 +34,28 @@ class CachedConf {
|
|
|
28
34
|
delete(key) {
|
|
29
35
|
this.conf.delete(key);
|
|
30
36
|
}
|
|
37
|
+
cached(key, getter, age) {
|
|
38
|
+
const cached = this.get(key);
|
|
39
|
+
if (cached) {
|
|
40
|
+
return cached;
|
|
41
|
+
}
|
|
42
|
+
const valuePromise = getter();
|
|
43
|
+
if (isThenable(valuePromise)) {
|
|
44
|
+
return valuePromise.then((value) => {
|
|
45
|
+
this.set(key, value, age);
|
|
46
|
+
return value;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.set(key, valuePromise, age);
|
|
51
|
+
return valuePromise;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
31
54
|
static getCache(projectName) {
|
|
32
55
|
return new CachedConf(projectName);
|
|
33
56
|
}
|
|
57
|
+
static memoryCache() {
|
|
58
|
+
return new CachedConf(new Map());
|
|
59
|
+
}
|
|
34
60
|
}
|
|
35
61
|
exports.CachedConf = CachedConf;
|