@blocklet/sdk 1.16.21-beta-2e75c75c → 1.16.21-beta-da3f852a

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.
@@ -27,15 +27,20 @@ declare const getResourceExportDir: ({ projectId, releaseId }?: {
27
27
  projectId: string;
28
28
  releaseId?: string;
29
29
  }) => string;
30
- declare const getResources: ({ scope, did, types, skipRunningCheck, }?: {
30
+ declare const getResources: ({ scope, types, skipRunningCheck, }?: {
31
31
  scope?: 'all' | 'pack' | 'excludePack';
32
32
  did?: string;
33
- types?: string[];
33
+ types?: {
34
+ did: string;
35
+ type: string;
36
+ }[];
34
37
  skipRunningCheck?: boolean;
35
38
  }) => Resource[];
36
- declare const getPackResources: ({ did, types, }?: {
37
- did?: string;
38
- types?: string[];
39
+ declare const getPackResources: ({ types, }?: {
40
+ types?: {
41
+ did: string;
42
+ type: string;
43
+ }[];
39
44
  }) => Resource[];
40
45
  declare const waitForComponentRunning: (name: string, timeout?: number, interval?: number) => Promise<boolean>;
41
46
  export { call };
@@ -56,15 +61,20 @@ declare const _default: {
56
61
  projectId: string;
57
62
  releaseId?: string;
58
63
  }) => string;
59
- getResources: ({ scope, did, types, skipRunningCheck, }?: {
64
+ getResources: ({ scope, types, skipRunningCheck, }?: {
60
65
  scope?: "pack" | "all" | "excludePack";
61
66
  did?: string;
62
- types?: string[];
67
+ types?: {
68
+ did: string;
69
+ type: string;
70
+ }[];
63
71
  skipRunningCheck?: boolean;
64
72
  }) => Util.Resource[];
65
- getPackResources: ({ did, types, }?: {
66
- did?: string;
67
- types?: string[];
73
+ getPackResources: ({ types, }?: {
74
+ types?: {
75
+ did: string;
76
+ type: string;
77
+ }[];
68
78
  }) => Util.Resource[];
69
79
  };
70
80
  export default _default;
@@ -119,12 +119,12 @@ const getResourceExportDir = ({ projectId, releaseId } = { projectId: '' }) => {
119
119
  return dir;
120
120
  };
121
121
  exports.getResourceExportDir = getResourceExportDir;
122
- const getResources = ({ scope = 'all', did, types, skipRunningCheck, } = {}) => {
123
- return Util.getResources({ components: config_1.components, scope, did, types, skipRunningCheck });
122
+ const getResources = ({ scope = 'all', types, skipRunningCheck, } = {}) => {
123
+ return Util.getResources({ components: config_1.components, scope, types, skipRunningCheck });
124
124
  };
125
125
  exports.getResources = getResources;
126
- const getPackResources = ({ did, types, } = {}) => {
127
- return Util.getResources({ components: config_1.components, scope: 'pack', did, types, ignorePublic: true });
126
+ const getPackResources = ({ types, } = {}) => {
127
+ return Util.getResources({ components: config_1.components, scope: 'pack', types, ignorePublic: true });
128
128
  };
129
129
  exports.getPackResources = getPackResources;
130
130
  const waitForComponentRunning = async (name, timeout = 30000, interval = 250) => {
@@ -6,11 +6,13 @@ type Resource = {
6
6
  status?: number;
7
7
  path?: string;
8
8
  };
9
- declare function getResources({ scope, components: allComponents, did, types, skipRunningCheck, ignorePublic, }?: {
9
+ declare function getResources({ scope, components: allComponents, types, skipRunningCheck, ignorePublic, }?: {
10
10
  scope?: 'all' | 'pack' | 'excludePack';
11
11
  components: TComponent[];
12
- did?: string;
13
- types?: string[];
12
+ types?: {
13
+ did: string;
14
+ type: string;
15
+ }[];
14
16
  skipRunningCheck?: boolean;
15
17
  ignorePublic?: boolean;
16
18
  }): Resource[];
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getResources = void 0;
7
7
  const pick_1 = __importDefault(require("lodash/pick"));
8
8
  const constant_1 = require("@blocklet/constant");
9
- function getResources({ scope, components: allComponents, did, types, skipRunningCheck, ignorePublic, } = {
9
+ function getResources({ scope, components: allComponents, types, skipRunningCheck, ignorePublic, } = {
10
10
  scope: 'all',
11
11
  components: [],
12
12
  }) {
13
13
  const list = [];
14
- if (!did && !types?.length) {
14
+ if (!types?.length) {
15
15
  return list;
16
16
  }
17
17
  let components = allComponents;
@@ -26,18 +26,14 @@ function getResources({ scope, components: allComponents, did, types, skipRunnin
26
26
  .filter((x) => scope === 'pack' || skipRunningCheck || x.status === constant_1.BlockletStatus.running)
27
27
  .forEach((component) => {
28
28
  const resources = component.resourcesV2 || [].filter((x) => ignorePublic || x.public);
29
- let resourcePath;
30
- if (did && types?.length) {
31
- const resource = resources.find((x) => {
32
- const [resourceDid, resourceType] = x.path.split('/').slice(-2);
33
- return did === resourceDid && types.includes(resourceType);
34
- });
35
- resourcePath = resource?.path;
36
- }
37
- if (resourcePath) {
29
+ const resource = resources.find((x) => {
30
+ const [resourceDid, resourceType] = x.path.split('/').slice(-2);
31
+ return types.some((item) => item?.did === resourceDid && item?.type === resourceType);
32
+ });
33
+ if (resource?.path) {
38
34
  list.push({
39
35
  ...(0, pick_1.default)(component, ['title', 'did', 'version', 'status']),
40
- path: resourcePath,
36
+ path: resource.path,
41
37
  });
42
38
  }
43
39
  });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.21-beta-2e75c75c",
6
+ "version": "1.16.21-beta-da3f852a",
7
7
  "description": "graphql client to read/write data on abt node",
8
8
  "main": "lib/index.js",
9
9
  "typings": "lib/index.d.ts",
@@ -26,15 +26,15 @@
26
26
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
27
27
  "license": "Apache-2.0",
28
28
  "dependencies": {
29
- "@abtnode/client": "1.16.21-beta-2e75c75c",
30
- "@abtnode/constant": "1.16.21-beta-2e75c75c",
29
+ "@abtnode/client": "1.16.21-beta-da3f852a",
30
+ "@abtnode/constant": "1.16.21-beta-da3f852a",
31
31
  "@arcblock/did": "1.18.108",
32
32
  "@arcblock/did-auth": "1.18.108",
33
33
  "@arcblock/jwt": "1.18.108",
34
34
  "@arcblock/ws": "1.18.108",
35
- "@blocklet/constant": "1.16.21-beta-2e75c75c",
36
- "@blocklet/env": "1.16.21-beta-2e75c75c",
37
- "@blocklet/meta": "1.16.21-beta-2e75c75c",
35
+ "@blocklet/constant": "1.16.21-beta-da3f852a",
36
+ "@blocklet/env": "1.16.21-beta-da3f852a",
37
+ "@blocklet/meta": "1.16.21-beta-da3f852a",
38
38
  "@did-connect/authenticator": "^2.2.1",
39
39
  "@did-connect/handler": "^2.2.1",
40
40
  "@nedb/core": "^2.1.5",
@@ -75,5 +75,5 @@
75
75
  "ts-node": "^10.9.1",
76
76
  "typescript": "^5.0.4"
77
77
  },
78
- "gitHead": "1fca0b58e1ed4f7a9bb268829a7c84290a01c89d"
78
+ "gitHead": "57b315bdb59f2125c5f0595d5cb21c92196710ba"
79
79
  }