@blocklet/meta 1.16.33-beta-20241018-093853-2efbcd5e → 1.16.33-beta-20241023-050633-f64145a7
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/lib/util.d.ts +4 -4
- package/lib/util.js +10 -6
- package/package.json +13 -13
package/lib/util.d.ts
CHANGED
|
@@ -89,8 +89,8 @@ declare const isEnvShareableToClient: (env?: TConfig) => boolean;
|
|
|
89
89
|
/**
|
|
90
90
|
* is env shareable between components
|
|
91
91
|
*/
|
|
92
|
-
declare const isEnvShareable: (env?: Partial<TConfig
|
|
93
|
-
declare const getSharedConfigObj: (app?: TComponentPro, component?: TComponentPro) => any;
|
|
92
|
+
declare const isEnvShareable: (env?: Partial<TConfig>, includeSecure?: boolean) => boolean;
|
|
93
|
+
declare const getSharedConfigObj: (app?: TComponentPro, component?: TComponentPro, includeSecure?: boolean) => any;
|
|
94
94
|
declare const isPreferenceKey: (x: Partial<TConfig>) => Boolean;
|
|
95
95
|
declare const getAppMissingConfigs: (app?: any) => any[];
|
|
96
96
|
declare const getComponentMissingConfigs: (component?: any, app?: any) => any[];
|
|
@@ -178,11 +178,11 @@ declare const _default: {
|
|
|
178
178
|
}) => Promise<unknown>;
|
|
179
179
|
forEachComponentV2Sync: (blocklet: any, cb: Function) => Promise<unknown>;
|
|
180
180
|
isDeletableBlocklet: (blocklet?: BlockletState) => boolean;
|
|
181
|
-
getSharedConfigObj: (app?: TComponentPro, component?: TComponentPro) => any;
|
|
181
|
+
getSharedConfigObj: (app?: TComponentPro, component?: TComponentPro, includeSecure?: boolean) => any;
|
|
182
182
|
getAppMissingConfigs: (app?: any) => any[];
|
|
183
183
|
getComponentMissingConfigs: (component?: any, app?: any) => any[];
|
|
184
184
|
isEnvShareableToClient: (env?: TConfig) => boolean;
|
|
185
|
-
isEnvShareable: (env?: Partial<TConfig
|
|
185
|
+
isEnvShareable: (env?: Partial<TConfig>, includeSecure?: boolean) => boolean;
|
|
186
186
|
wipeSensitiveData: (blocklet?: BlockletState) => BlockletState;
|
|
187
187
|
hasRunnableComponent: (blocklet: BlockletState) => boolean;
|
|
188
188
|
getAppName: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
package/lib/util.js
CHANGED
|
@@ -276,11 +276,15 @@ exports.isEnvShareableToClient = isEnvShareableToClient;
|
|
|
276
276
|
/**
|
|
277
277
|
* is env shareable between components
|
|
278
278
|
*/
|
|
279
|
-
const isEnvShareable = (env) => {
|
|
280
|
-
return
|
|
279
|
+
const isEnvShareable = (env, includeSecure = false) => {
|
|
280
|
+
return (!!env &&
|
|
281
|
+
!!(env.key || env.name) &&
|
|
282
|
+
!!env.shared &&
|
|
283
|
+
!constant_2.BLOCKLET_CONFIGURABLE_KEY[env.key || env.name] &&
|
|
284
|
+
(includeSecure ? true : !env.secure));
|
|
281
285
|
};
|
|
282
286
|
exports.isEnvShareable = isEnvShareable;
|
|
283
|
-
const getSharedConfigObj = (app, component) => {
|
|
287
|
+
const getSharedConfigObj = (app, component, includeSecure = false) => {
|
|
284
288
|
const res = {};
|
|
285
289
|
if (!app || !component) {
|
|
286
290
|
return res;
|
|
@@ -288,13 +292,13 @@ const getSharedConfigObj = (app, component) => {
|
|
|
288
292
|
if (Array.isArray(app.configs)) {
|
|
289
293
|
app.configs.forEach(({ key, value: value0, secure }) => {
|
|
290
294
|
// config in container is force shared to components
|
|
291
|
-
if (!isEnvShareable({ key, secure, shared: true })) {
|
|
295
|
+
if (!isEnvShareable({ key, secure, shared: true }, includeSecure)) {
|
|
292
296
|
return;
|
|
293
297
|
}
|
|
294
298
|
const value = (app.configObj || {})[key] || value0;
|
|
295
299
|
const config = (component.configs || []).find((x) => x.key === key);
|
|
296
300
|
if (!config || // component does not have this config
|
|
297
|
-
isEnvShareable(config) || // component config is shareable
|
|
301
|
+
isEnvShareable(config, includeSecure) || // component config is shareable
|
|
298
302
|
(!config.value && !(component.configObj || {})[config.key]) // component config is empty
|
|
299
303
|
) {
|
|
300
304
|
res[key] = value;
|
|
@@ -306,7 +310,7 @@ const getSharedConfigObj = (app, component) => {
|
|
|
306
310
|
.filter((x) => x.meta?.did !== component.meta?.did)
|
|
307
311
|
.forEach((child) => {
|
|
308
312
|
(child.configs || [])
|
|
309
|
-
.filter(isEnvShareable) // only share shareable configs
|
|
313
|
+
.filter((x) => isEnvShareable(x, includeSecure)) // only share shareable configs
|
|
310
314
|
.filter((x) => !(app.configs || []).find((y) => y.key === x.key)) // only share configs that app does not have
|
|
311
315
|
.forEach(({ key, value }) => {
|
|
312
316
|
const config = (component.configs || []).find((x) => x.key === key);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.33-beta-
|
|
6
|
+
"version": "1.16.33-beta-20241023-050633-f64145a7",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@abtnode/constant": "1.16.33-beta-
|
|
29
|
-
"@arcblock/did": "1.18.
|
|
30
|
-
"@arcblock/did-ext": "1.18.
|
|
31
|
-
"@arcblock/did-util": "1.18.
|
|
32
|
-
"@arcblock/jwt": "1.18.
|
|
33
|
-
"@blocklet/constant": "1.16.33-beta-
|
|
34
|
-
"@ocap/asset": "1.18.
|
|
35
|
-
"@ocap/mcrypto": "1.18.
|
|
36
|
-
"@ocap/types": "1.18.
|
|
37
|
-
"@ocap/util": "1.18.
|
|
38
|
-
"@ocap/wallet": "1.18.
|
|
28
|
+
"@abtnode/constant": "1.16.33-beta-20241023-050633-f64145a7",
|
|
29
|
+
"@arcblock/did": "1.18.136",
|
|
30
|
+
"@arcblock/did-ext": "1.18.136",
|
|
31
|
+
"@arcblock/did-util": "1.18.136",
|
|
32
|
+
"@arcblock/jwt": "1.18.136",
|
|
33
|
+
"@blocklet/constant": "1.16.33-beta-20241023-050633-f64145a7",
|
|
34
|
+
"@ocap/asset": "1.18.136",
|
|
35
|
+
"@ocap/mcrypto": "1.18.136",
|
|
36
|
+
"@ocap/types": "1.18.136",
|
|
37
|
+
"@ocap/util": "1.18.136",
|
|
38
|
+
"@ocap/wallet": "1.18.136",
|
|
39
39
|
"ajv": "^8.11.0",
|
|
40
40
|
"axios": "^1.7.5",
|
|
41
41
|
"cjk-length": "^1.0.0",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"ts-node": "^10.9.1",
|
|
80
80
|
"typescript": "^5.6.3"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "ed8130f55cb68a23c72ea0fd58c2bad38de18719"
|
|
83
83
|
}
|