@blocklet/meta 1.8.36 → 1.8.37

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/schema.js CHANGED
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.statsSchema = exports.titleSchema = exports.themeSchema = exports.signatureSchema = exports.serviceSchema = exports.scriptsSchema = exports.personSchema = exports.navigationSchema = exports.navigationItemSchema = exports.mountPointSchema = exports.logoSchema = exports.interfaceSchema = exports.environmentSchema = exports.engineSchema = exports.endpointSchema = exports.distSchema = exports.descriptionSchema = exports.createBlockletSchema = exports.componentSchema = exports.blockletNameSchema = exports.blockletMetaSchema = void 0;
18
18
  const fs_1 = __importDefault(require("fs"));
19
19
  const joi_1 = __importDefault(require("joi"));
20
+ const constant_1 = require("@abtnode/constant");
20
21
  // eslint-disable-next-line import/no-named-default
21
22
  const cjk_length_1 = __importDefault(require("cjk-length"));
22
23
  const is_glob_1 = __importDefault(require("is-glob"));
@@ -71,6 +72,10 @@ const environmentSchema = Joi.object({
71
72
  shared: Joi.boolean().default((parent) => !parent.secure),
72
73
  })
73
74
  .custom((x, helper) => {
75
+ if (x.name.startsWith(constant_1.BLOCKLET_PREFERENCE_PREFIX)) {
76
+ // @ts-expect-error
77
+ return helper.message(`Env name can not start with ${constant_1.BLOCKLET_PREFERENCE_PREFIX}`);
78
+ }
74
79
  if (x.secure && x.default) {
75
80
  // @ts-expect-error
76
81
  return helper.message(`Cannot declare default value for secure env ${x.name}`);
package/lib/util.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BlockletState } from '@abtnode/client';
1
+ import { BlockletState, ComponentState } from '@abtnode/client';
2
2
  import { Request } from 'express';
3
3
  import { TBlockletMeta, TEnvironment } from './types';
4
4
  declare const getComponentId: (component?: {
@@ -36,7 +36,7 @@ declare const getComponentBundleId: (component: {
36
36
  * @a/b/@c/d/@e/f => @a/b/@c/d
37
37
  */
38
38
  declare const getParentComponentName: (name?: string) => string;
39
- declare const forEachBlocklet: (blocklet: BlockletState, cb: Function, { parallel, sync, params: inputParams, _parent, _root, _level, _tasks: inputTasks, _ancestors, }?: {
39
+ declare const forEachBlocklet: (blocklet: BlockletState | ComponentState, cb: Function, { parallel, sync, params: inputParams, _parent, _root, _level, _tasks: inputTasks, _ancestors, }?: {
40
40
  parallel?: boolean;
41
41
  sync?: boolean;
42
42
  params?: any;
@@ -49,7 +49,7 @@ declare const forEachBlocklet: (blocklet: BlockletState, cb: Function, { paralle
49
49
  declare const forEachBlockletSync: (blocklet: any, cb: Function) => Promise<unknown>;
50
50
  declare const forEachChild: (blocklet: any, cb: Function, params?: any) => Promise<any>;
51
51
  declare const forEachChildSync: (blocklet: BlockletState, cb: Function) => Promise<any>;
52
- declare const findComponentById: (blocklet: BlockletState, componentId: string, { _ancestors, returnAncestors, }?: {
52
+ declare const findComponentById: (blocklet: BlockletState | ComponentState, componentId: string, { _ancestors, returnAncestors, }?: {
53
53
  _ancestors?: any[];
54
54
  returnAncestors?: boolean;
55
55
  }) => any;
@@ -117,7 +117,7 @@ declare const _default: {
117
117
  isFreeBlocklet: (meta: TBlockletMeta) => boolean;
118
118
  isFreeComponent: (meta: TBlockletMeta) => boolean;
119
119
  isComponentBlocklet: (meta?: TBlockletMeta) => boolean;
120
- forEachBlocklet: (blocklet: BlockletState, cb: Function, { parallel, sync, params: inputParams, _parent, _root, _level, _tasks: inputTasks, _ancestors, }?: {
120
+ forEachBlocklet: (blocklet: BlockletState | ComponentState, cb: Function, { parallel, sync, params: inputParams, _parent, _root, _level, _tasks: inputTasks, _ancestors, }?: {
121
121
  parallel?: boolean;
122
122
  sync?: boolean;
123
123
  params?: any;
@@ -170,7 +170,7 @@ declare const _default: {
170
170
  version: string;
171
171
  };
172
172
  }) => string;
173
- findComponentById: (blocklet: BlockletState, componentId: string, { _ancestors, returnAncestors, }?: {
173
+ findComponentById: (blocklet: BlockletState | ComponentState, componentId: string, { _ancestors, returnAncestors, }?: {
174
174
  _ancestors?: any[];
175
175
  returnAncestors?: boolean;
176
176
  }) => any;
package/lib/util.js CHANGED
@@ -18,6 +18,7 @@ const get_1 = __importDefault(require("lodash/get"));
18
18
  const slugify_1 = __importDefault(require("slugify"));
19
19
  const url_join_1 = __importDefault(require("url-join"));
20
20
  const constant_1 = __importDefault(require("@abtnode/constant"));
21
+ const constant_2 = require("@blocklet/constant");
21
22
  const constants_1 = __importDefault(require("./constants"));
22
23
  const { NODE_SERVICES, SLOT_FOR_IP_DNS_SITE, WHO_CAN_ACCESS } = constant_1.default;
23
24
  const { BlockletGroup, fromBlockletStatus, fromBlockletSource, BLOCKLET_INTERFACE_TYPE_WEB, BLOCKLET_CONFIGURABLE_KEY, CHAIN_INFO_CONFIG, } = constants_1.default;
@@ -216,7 +217,7 @@ const getAppMissingConfigs = (blocklet = {}) => {
216
217
  }
217
218
  });
218
219
  });
219
- return missingConfigs;
220
+ return missingConfigs.filter((x) => x.key.startsWith(constant_2.BLOCKLET_PREFERENCE_PREFIX) === false);
220
221
  };
221
222
  exports.getAppMissingConfigs = getAppMissingConfigs;
222
223
  const getComponentMissingConfigs = (component = {}, ancestors = []) => {
@@ -258,11 +259,14 @@ const wipeSensitiveData = (blocklet) => {
258
259
  return blocklet;
259
260
  }
260
261
  forEachBlocklet(blocklet, (d) => {
261
- (d.configs || []).forEach((x) => {
262
- if (x.secure) {
263
- x.value = x.value ? '__encrypted__' : '';
264
- }
265
- });
262
+ if (d.configs) {
263
+ d.configs = d.configs.filter((x) => x.key.startsWith(constant_2.BLOCKLET_PREFERENCE_PREFIX) === false);
264
+ d.configs.forEach((x) => {
265
+ if (x.secure) {
266
+ x.value = x.value ? '__encrypted__' : '';
267
+ }
268
+ });
269
+ }
266
270
  (d.environments || []).forEach((x) => {
267
271
  if (['BLOCKLET_APP_SK'].includes(x.key)) {
268
272
  x.value = '__encrypted__';
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.36",
6
+ "version": "1.8.37",
7
7
  "description": "Library to parse/validate/fix blocklet meta",
8
8
  "main": "./lib/index.js",
9
9
  "typings": "./lib/index.d.ts",
@@ -24,14 +24,14 @@
24
24
  "author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
- "@abtnode/client": "1.8.36",
28
- "@abtnode/constant": "1.8.36",
29
- "@abtnode/util": "1.8.36",
27
+ "@abtnode/client": "1.8.37",
28
+ "@abtnode/constant": "1.8.37",
29
+ "@abtnode/util": "1.8.37",
30
30
  "@arcblock/did": "1.18.15",
31
31
  "@arcblock/did-ext": "1.18.15",
32
32
  "@arcblock/did-util": "1.18.15",
33
33
  "@arcblock/jwt": "1.18.15",
34
- "@blocklet/constant": "1.8.36",
34
+ "@blocklet/constant": "1.8.37",
35
35
  "@ocap/asset": "1.18.15",
36
36
  "@ocap/mcrypto": "1.18.15",
37
37
  "@ocap/types": "1.18.15",
@@ -56,7 +56,7 @@
56
56
  "validate-npm-package-name": "^3.0.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@abtnode/client": "^1.8.34",
59
+ "@abtnode/client": "^1.8.36",
60
60
  "@arcblock/eslint-config-ts": "^0.2.3",
61
61
  "@types/express": "^4.17.14",
62
62
  "@types/jest": "^29.2.2",
@@ -77,5 +77,5 @@
77
77
  "ts-node": "^10.9.1",
78
78
  "typescript": "^4.8.4"
79
79
  },
80
- "gitHead": "507e974ce88bad1aa002c593130b32982207f803"
80
+ "gitHead": "f26f451c6e2b1168b36f78269eafdf3f671236bf"
81
81
  }