@forge/cli-shared 0.0.0-experimental-e1cefc4 → 0.0.0-experimental-29a2cc1

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,6 +1,208 @@
1
1
  # @forge/cli-shared
2
2
 
3
- ## 0.0.0-experimental-e1cefc4
3
+ ## 0.0.0-experimental-29a2cc1
4
+
5
+ ### Minor Changes
6
+
7
+ - 69f42bd: Added a utility function to wrap potentially unknown errors in an error, or return the original error"
8
+ - 4d1c111: Add keytar to shrinkwrap package list
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [b447be2]
13
+ - Updated dependencies [4285fc3]
14
+ - Updated dependencies [74e00c8]
15
+ - @forge/manifest@0.0.0-experimental-29a2cc1
16
+
17
+ ## 2.6.0-next.3
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [4285fc36]
22
+ - @forge/manifest@3.9.0-next.2
23
+
24
+ ## 2.6.0-next.2
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [b447be27]
29
+ - @forge/manifest@3.9.0-next.1
30
+
31
+ ## 2.6.0-next.1
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [74e00c86]
36
+ - @forge/manifest@3.8.2-next.0
37
+
38
+ ## 2.6.0-next.0
39
+
40
+ ### Minor Changes
41
+
42
+ - 69f42bdc: Added a utility function to wrap potentially unknown errors in an error, or return the original error"
43
+
44
+ ## 2.5.1
45
+
46
+ ### Patch Changes
47
+
48
+ - Updated dependencies [a85953d8]
49
+ - Updated dependencies [2c42df96]
50
+ - Updated dependencies [c52209fd]
51
+ - @forge/manifest@3.8.1
52
+
53
+ ## 2.5.1-next.1
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies [a85953d8]
58
+ - @forge/manifest@3.8.1-next.1
59
+
60
+ ## 2.5.1-next.0
61
+
62
+ ### Patch Changes
63
+
64
+ - Updated dependencies [2c42df9]
65
+ - Updated dependencies [c52209f]
66
+ - @forge/manifest@3.8.1-next.0
67
+
68
+ ## 2.5.0
69
+
70
+ ### Minor Changes
71
+
72
+ - 6d7a574e: Add the ability to query feature flags in the CLI
73
+
74
+ ### Patch Changes
75
+
76
+ - 4f86661: Fix dependency
77
+ - Updated dependencies [74b6c3c]
78
+ - Updated dependencies [e892d27]
79
+ - @forge/manifest@3.8.0
80
+
81
+ ## 2.5.0-next.3
82
+
83
+ ### Patch Changes
84
+
85
+ - 4f86661c: Fix dependency
86
+
87
+ ## 2.5.0-next.2
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies [e892d27d]
92
+ - @forge/manifest@3.8.0-next.1
93
+
94
+ ## 2.5.0-next.1
95
+
96
+ ### Patch Changes
97
+
98
+ - Updated dependencies [74b6c3c]
99
+ - @forge/manifest@3.8.0-next.0
100
+
101
+ ## 2.5.0-next.0
102
+
103
+ ### Minor Changes
104
+
105
+ - 6d7a574: Add the ability to query feature flags in the CLI
106
+
107
+ ## 2.4.2
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [34d085a]
112
+ - Updated dependencies [9e700ef]
113
+ - Updated dependencies [c87cdea]
114
+ - Updated dependencies [ce4a65f]
115
+ - @forge/manifest@3.7.0
116
+
117
+ ## 2.4.2-next.1
118
+
119
+ ### Patch Changes
120
+
121
+ - Updated dependencies [34d085a]
122
+ - Updated dependencies [c87cdea]
123
+ - Updated dependencies [ce4a65f]
124
+ - @forge/manifest@3.7.0-next.1
125
+
126
+ ## 2.4.2-next.0
127
+
128
+ ### Patch Changes
129
+
130
+ - Updated dependencies [9e700ef8]
131
+ - @forge/manifest@3.6.1-next.0
132
+
133
+ ## 2.4.1
134
+
135
+ ### Patch Changes
136
+
137
+ - Updated dependencies [1a8d47c]
138
+ - Updated dependencies [e314dd0]
139
+ - Updated dependencies [0137135]
140
+ - Updated dependencies [2bd062d]
141
+ - Updated dependencies [9047581]
142
+ - Updated dependencies [5c9419f]
143
+ - Updated dependencies [e8a6926]
144
+ - Updated dependencies [cb28bc0]
145
+ - Updated dependencies [0920759]
146
+ - @forge/manifest@3.6.0
147
+
148
+ ## 2.4.1-next.7
149
+
150
+ ### Patch Changes
151
+
152
+ - Updated dependencies [0920759f]
153
+ - @forge/manifest@3.6.0-next.7
154
+
155
+ ## 2.4.1-next.6
156
+
157
+ ### Patch Changes
158
+
159
+ - Updated dependencies [2bd062d0]
160
+ - @forge/manifest@3.6.0-next.6
161
+
162
+ ## 2.4.1-next.5
163
+
164
+ ### Patch Changes
165
+
166
+ - Updated dependencies [cb28bc0]
167
+ - @forge/manifest@3.6.0-next.5
168
+
169
+ ## 2.4.1-next.4
170
+
171
+ ### Patch Changes
172
+
173
+ - Updated dependencies [e314dd0]
174
+ - @forge/manifest@3.6.0-next.4
175
+
176
+ ## 2.4.1-next.3
177
+
178
+ ### Patch Changes
179
+
180
+ - Updated dependencies [90475812]
181
+ - @forge/manifest@3.6.0-next.3
182
+
183
+ ## 2.4.1-next.2
184
+
185
+ ### Patch Changes
186
+
187
+ - Updated dependencies [5c9419f4]
188
+ - Updated dependencies [e8a69267]
189
+ - @forge/manifest@3.6.0-next.2
190
+
191
+ ## 2.4.1-next.1
192
+
193
+ ### Patch Changes
194
+
195
+ - Updated dependencies [1a8d47c0]
196
+ - @forge/manifest@3.6.0-next.1
197
+
198
+ ## 2.4.1-next.0
199
+
200
+ ### Patch Changes
201
+
202
+ - Updated dependencies [01371351]
203
+ - @forge/manifest@3.5.1-next.0
204
+
205
+ ## 2.4.0
4
206
 
5
207
  ### Minor Changes
6
208
 
@@ -9,8 +211,9 @@
9
211
 
10
212
  ### Patch Changes
11
213
 
214
+ - Updated dependencies [3d82376]
12
215
  - Updated dependencies [d094c69]
13
- - Updated dependencies [ba67459]
216
+ - Updated dependencies [ba674590]
14
217
  - Updated dependencies [f3ac287]
15
218
  - Updated dependencies [d196b41]
16
219
  - Updated dependencies [e411a29]
@@ -18,7 +221,14 @@
18
221
  - Updated dependencies [a3bfe81]
19
222
  - Updated dependencies [02839be]
20
223
  - Updated dependencies [ffb508a]
21
- - @forge/manifest@0.0.0-experimental-e1cefc4
224
+ - @forge/manifest@3.5.0
225
+
226
+ ## 2.4.0-next.8
227
+
228
+ ### Patch Changes
229
+
230
+ - Updated dependencies [3d82376]
231
+ - @forge/manifest@3.5.0-next.7
22
232
 
23
233
  ## 2.4.0-next.7
24
234
 
@@ -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":"AAOA,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAO;gBAEhB,WAAW,EAAE,MAAM;IAOxB,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,IAA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C,CAAC,CAAC;IAkBnG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU;IAQhD,MAAM,CAAC,WAAW,IAAI,UAAU;CAGjC"}
@@ -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(projectName) {
8
- this.conf = new conf_1.default({
9
- projectName
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;
@@ -5,12 +5,12 @@ declare enum Environments {
5
5
  STG = "staging",
6
6
  PROD = "prod"
7
7
  }
8
+ declare type EnvironmentOptions = Record<keyof typeof Environments, string>;
8
9
  export declare enum CDNEnvironments {
9
10
  DEV = "dev",
10
11
  STG = "stg",
11
12
  PROD = "prod"
12
13
  }
13
- declare type EnvironmentOptions = typeof Environments | typeof CDNEnvironments;
14
14
  export declare const getEnvironment: (envOptions?: EnvironmentOptions) => string;
15
15
  export {};
16
16
  //# sourceMappingURL=gateway.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/graphql/gateway.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,uBAAuB,sCAAsC,CAAC;AAE3E,eAAO,MAAM,iBAAiB,QAAO,MAEpC,CAAC;AAEF,aAAK,YAAY;IACf,GAAG,QAAQ;IACX,GAAG,YAAY;IACf,IAAI,SAAS;CACd;AAED,oBAAY,eAAe;IACzB,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AACD,aAAK,kBAAkB,GAAG,OAAO,YAAY,GAAG,OAAO,eAAe,CAAC;AAEvE,eAAO,MAAM,cAAc,gBAAgB,kBAAkB,KAAkB,MAS9E,CAAC"}
1
+ {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/graphql/gateway.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,uBAAuB,sCAAsC,CAAC;AAE3E,eAAO,MAAM,iBAAiB,QAAO,MAEpC,CAAC;AAEF,aAAK,YAAY;IACf,GAAG,QAAQ;IACX,GAAG,YAAY;IACf,IAAI,SAAS;CACd;AAED,aAAK,kBAAkB,GAAG,MAAM,CAAC,MAAM,OAAO,YAAY,EAAE,MAAM,CAAC,CAAC;AAEpE,oBAAY,eAAe;IACzB,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,eAAO,MAAM,cAAc,gBAAgB,kBAAkB,KAAkB,MAS9E,CAAC"}