@blocklet/meta 1.16.11-next-3d2b39f7 → 1.16.11-next-09bc31f8

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 CHANGED
@@ -83,6 +83,7 @@ declare const findComponentById: (blocklet: BlockletState | ComponentState, comp
83
83
  };
84
84
  declare const findComponentV2: (app: TApp, isEqualFn: (component: TComponent, app: TApp) => boolean) => ComponentState;
85
85
  declare const findComponentByIdV2: (app: TApp, componentId: string | Array<string>) => ComponentState;
86
+ declare const filterComponentsV2: (app: TApp, isEqualFn: (component: TComponent, app: TApp) => boolean) => any[];
86
87
  declare const isEnvShareable: (env?: TConfig) => boolean;
87
88
  declare const getSharedConfigObj: (component: BlockletState, ancestors?: any[]) => any;
88
89
  declare const isPreferenceKey: (x: TConfig) => Boolean;
@@ -148,7 +149,7 @@ type TComponentInternalInfo = {
148
149
  port: number;
149
150
  };
150
151
  declare const getComponentsInternalInfo: (app: TApp) => Array<TComponentInternalInfo>;
151
- export { isFreeBlocklet, isFreeComponent, isComponentBlocklet, forEachBlocklet, forEachBlockletSync, forEachChild, forEachChildSync, forEachComponentV2, forEachComponentV2Sync, isDeletableBlocklet, getSharedConfigObj, getAppMissingConfigs, getComponentMissingConfigs, isEnvShareable, wipeSensitiveData, hasRunnableComponent, getAppName, getAppName as getDisplayName, getAppDescription, fixBlockletStatus, findWebInterface, findWebInterfacePort, findServiceFromMeta, getWhoCanAccess, replaceSlotToIp, getComponentId, getComponentName, getComponentBundleId, findComponent, findComponentById, findComponentV2, findComponentByIdV2, getParentComponentName, getConnectAppUrl, getChainInfo, getBlockletChainInfo, isExternalBlocklet, isPreferenceKey, getRolesFromAuthConfig, getBlockletAppIdList, getBlockletServices, isInProgress, isBeforeInstalled, isRunning, getComponentsInternalInfo, TComponentInternalInfo, };
152
+ export { isFreeBlocklet, isFreeComponent, isComponentBlocklet, forEachBlocklet, forEachBlockletSync, forEachChild, forEachChildSync, forEachComponentV2, forEachComponentV2Sync, isDeletableBlocklet, getSharedConfigObj, getAppMissingConfigs, getComponentMissingConfigs, isEnvShareable, wipeSensitiveData, hasRunnableComponent, getAppName, getAppName as getDisplayName, getAppDescription, fixBlockletStatus, findWebInterface, findWebInterfacePort, findServiceFromMeta, getWhoCanAccess, replaceSlotToIp, getComponentId, getComponentName, getComponentBundleId, findComponent, findComponentById, findComponentV2, findComponentByIdV2, filterComponentsV2, getParentComponentName, getConnectAppUrl, getChainInfo, getBlockletChainInfo, isExternalBlocklet, isPreferenceKey, getRolesFromAuthConfig, getBlockletAppIdList, getBlockletServices, isInProgress, isBeforeInstalled, isRunning, getComponentsInternalInfo, TComponentInternalInfo, };
152
153
  declare const _default: {
153
154
  isFreeBlocklet: (meta: TBlockletMeta) => boolean;
154
155
  isFreeComponent: (meta: TBlockletMeta) => boolean;
@@ -231,6 +232,7 @@ declare const _default: {
231
232
  };
232
233
  findComponentV2: (app: BlockletState, isEqualFn: (component: TComponent, app: BlockletState) => boolean) => ComponentState;
233
234
  findComponentByIdV2: (app: BlockletState, componentId: string | string[]) => ComponentState;
235
+ filterComponentsV2: (app: BlockletState, isEqualFn: (component: TComponent, app: BlockletState) => boolean) => any[];
234
236
  getParentComponentName: (name?: string) => string;
235
237
  getConnectAppUrl: ({ request, baseUrl }: {
236
238
  request: Partial<Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>>;
package/lib/util.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getComponentsInternalInfo = exports.isRunning = exports.isBeforeInstalled = exports.isInProgress = exports.getBlockletServices = exports.getBlockletAppIdList = exports.getRolesFromAuthConfig = exports.isPreferenceKey = exports.isExternalBlocklet = exports.getBlockletChainInfo = exports.getChainInfo = exports.getConnectAppUrl = exports.getParentComponentName = exports.findComponentByIdV2 = exports.findComponentV2 = exports.findComponentById = exports.findComponent = exports.getComponentBundleId = exports.getComponentName = exports.getComponentId = exports.replaceSlotToIp = exports.getWhoCanAccess = exports.findServiceFromMeta = exports.findWebInterfacePort = exports.findWebInterface = exports.fixBlockletStatus = exports.getAppDescription = exports.getDisplayName = exports.getAppName = exports.hasRunnableComponent = exports.wipeSensitiveData = exports.isEnvShareable = exports.getComponentMissingConfigs = exports.getAppMissingConfigs = exports.getSharedConfigObj = exports.isDeletableBlocklet = exports.forEachComponentV2Sync = exports.forEachComponentV2 = exports.forEachChildSync = exports.forEachChild = exports.forEachBlockletSync = exports.forEachBlocklet = exports.isComponentBlocklet = exports.isFreeComponent = exports.isFreeBlocklet = void 0;
6
+ exports.getComponentsInternalInfo = exports.isRunning = exports.isBeforeInstalled = exports.isInProgress = exports.getBlockletServices = exports.getBlockletAppIdList = exports.getRolesFromAuthConfig = exports.isPreferenceKey = exports.isExternalBlocklet = exports.getBlockletChainInfo = exports.getChainInfo = exports.getConnectAppUrl = exports.getParentComponentName = exports.filterComponentsV2 = exports.findComponentByIdV2 = exports.findComponentV2 = exports.findComponentById = exports.findComponent = exports.getComponentBundleId = exports.getComponentName = exports.getComponentId = exports.replaceSlotToIp = exports.getWhoCanAccess = exports.findServiceFromMeta = exports.findWebInterfacePort = exports.findWebInterface = exports.fixBlockletStatus = exports.getAppDescription = exports.getDisplayName = exports.getAppName = exports.hasRunnableComponent = exports.wipeSensitiveData = exports.isEnvShareable = exports.getComponentMissingConfigs = exports.getAppMissingConfigs = exports.getSharedConfigObj = exports.isDeletableBlocklet = exports.forEachComponentV2Sync = exports.forEachComponentV2 = exports.forEachChildSync = exports.forEachChild = exports.forEachBlockletSync = exports.forEachBlocklet = exports.isComponentBlocklet = exports.isFreeComponent = exports.isFreeBlocklet = void 0;
7
7
  /* eslint-disable no-await-in-loop */
8
8
  const get_1 = __importDefault(require("lodash/get"));
9
9
  const uniq_1 = __importDefault(require("lodash/uniq"));
@@ -246,6 +246,19 @@ const findComponentByIdV2 = (app, componentId) => {
246
246
  });
247
247
  };
248
248
  exports.findComponentByIdV2 = findComponentByIdV2;
249
+ const filterComponentsV2 = (app, isEqualFn) => {
250
+ if (!isEqualFn) {
251
+ return [];
252
+ }
253
+ const list = [];
254
+ for (const child of app.children || []) {
255
+ if (isEqualFn(child, app)) {
256
+ list.push(child);
257
+ }
258
+ }
259
+ return list;
260
+ };
261
+ exports.filterComponentsV2 = filterComponentsV2;
249
262
  const isEnvShareable = (env) => {
250
263
  return (!!env &&
251
264
  !!(env.key || env.name) &&
@@ -697,6 +710,7 @@ exports.default = {
697
710
  findComponentById,
698
711
  findComponentV2,
699
712
  findComponentByIdV2,
713
+ filterComponentsV2,
700
714
  getParentComponentName,
701
715
  getConnectAppUrl,
702
716
  getChainInfo,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.11-next-3d2b39f7",
6
+ "version": "1.16.11-next-09bc31f8",
7
7
  "description": "Library to parse/validate/fix blocklet meta",
8
8
  "main": "./lib/index.js",
9
9
  "typings": "./lib/index.d.ts",
@@ -24,13 +24,13 @@
24
24
  "author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@abtnode/constant": "1.16.11-next-3d2b39f7",
28
- "@abtnode/util": "1.16.11-next-3d2b39f7",
27
+ "@abtnode/constant": "1.16.11-next-09bc31f8",
28
+ "@abtnode/util": "1.16.11-next-09bc31f8",
29
29
  "@arcblock/did": "1.18.80",
30
30
  "@arcblock/did-ext": "1.18.80",
31
31
  "@arcblock/did-util": "1.18.80",
32
32
  "@arcblock/jwt": "1.18.80",
33
- "@blocklet/constant": "1.16.11-next-3d2b39f7",
33
+ "@blocklet/constant": "1.16.11-next-09bc31f8",
34
34
  "@ocap/asset": "1.18.80",
35
35
  "@ocap/mcrypto": "1.18.80",
36
36
  "@ocap/types": "1.18.80",
@@ -79,5 +79,5 @@
79
79
  "ts-node": "^10.9.1",
80
80
  "typescript": "^5.0.4"
81
81
  },
82
- "gitHead": "d0142bd2d1e49b94dcb5542d78e294a7b2258faa"
82
+ "gitHead": "c51355ac77d07dc27e2fb6c44ce2a45432a9469b"
83
83
  }