@blocklet/sdk 1.16.19-beta-710018ca → 1.16.19-beta-ba354e01
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/component/index.d.ts +11 -0
- package/lib/component/index.js +30 -1
- package/lib/component/util.d.ts +19 -0
- package/lib/component/util.js +29 -0
- package/lib/index.d.ts +28 -27
- package/package.json +7 -7
package/lib/component/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { AxiosResponse, Method } from 'axios';
|
|
3
3
|
import { IncomingMessage } from 'http';
|
|
4
|
+
import * as Util from './util';
|
|
5
|
+
import type { Resource } from './util';
|
|
4
6
|
declare const getChildWebEndpoint: (name: string) => string;
|
|
5
7
|
declare const getParentWebEndpoint: () => string;
|
|
6
8
|
declare const getComponentWebEndpoint: (keyword: string) => string;
|
|
@@ -24,11 +26,16 @@ declare const getResourceExportDir: ({ projectId, releaseId }?: {
|
|
|
24
26
|
projectId: string;
|
|
25
27
|
releaseId?: string;
|
|
26
28
|
}) => string;
|
|
29
|
+
declare const getResources: ({ types, skipRunningCheck, }?: {
|
|
30
|
+
types?: string[];
|
|
31
|
+
skipRunningCheck?: boolean;
|
|
32
|
+
}) => Resource[];
|
|
27
33
|
export { call };
|
|
28
34
|
export { getUrl };
|
|
29
35
|
export { getComponentMountPoint };
|
|
30
36
|
export { getComponentWebEndpoint };
|
|
31
37
|
export { getResourceExportDir };
|
|
38
|
+
export { getResources };
|
|
32
39
|
export { getChildWebEndpoint };
|
|
33
40
|
export { getParentWebEndpoint };
|
|
34
41
|
declare const _default: {
|
|
@@ -40,6 +47,10 @@ declare const _default: {
|
|
|
40
47
|
projectId: string;
|
|
41
48
|
releaseId?: string;
|
|
42
49
|
}) => string;
|
|
50
|
+
getResources: ({ types, skipRunningCheck, }?: {
|
|
51
|
+
types?: string[];
|
|
52
|
+
skipRunningCheck?: boolean;
|
|
53
|
+
}) => Util.Resource[];
|
|
43
54
|
getChildWebEndpoint: (name: string) => string;
|
|
44
55
|
getParentWebEndpoint: () => string;
|
|
45
56
|
};
|
package/lib/component/index.js
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getParentWebEndpoint = exports.getChildWebEndpoint = exports.getResourceExportDir = exports.getComponentWebEndpoint = exports.getComponentMountPoint = exports.getUrl = exports.call = void 0;
|
|
29
|
+
exports.getParentWebEndpoint = exports.getChildWebEndpoint = exports.getResources = exports.getResourceExportDir = exports.getComponentWebEndpoint = exports.getComponentMountPoint = exports.getUrl = exports.call = void 0;
|
|
7
30
|
const path_1 = require("path");
|
|
8
31
|
const util_1 = require("@blocklet/meta/lib/util");
|
|
9
32
|
const axios_1 = __importDefault(require("axios"));
|
|
@@ -13,6 +36,7 @@ const url_join_1 = __importDefault(require("url-join"));
|
|
|
13
36
|
const constant_1 = require("@blocklet/constant");
|
|
14
37
|
const config_1 = require("../config");
|
|
15
38
|
const verify_sign_1 = require("../util/verify-sign");
|
|
39
|
+
const Util = __importStar(require("./util"));
|
|
16
40
|
const doCall = async ({ url, ...options }) => {
|
|
17
41
|
try {
|
|
18
42
|
const resp = await (0, axios_1.default)({
|
|
@@ -113,12 +137,17 @@ const getResourceExportDir = ({ projectId, releaseId } = { projectId: '' }) => {
|
|
|
113
137
|
return dir;
|
|
114
138
|
};
|
|
115
139
|
exports.getResourceExportDir = getResourceExportDir;
|
|
140
|
+
const getResources = ({ types, skipRunningCheck, } = {}) => {
|
|
141
|
+
return Util.getResources({ components: config_1.components, types, skipRunningCheck });
|
|
142
|
+
};
|
|
143
|
+
exports.getResources = getResources;
|
|
116
144
|
exports.default = {
|
|
117
145
|
call,
|
|
118
146
|
getUrl,
|
|
119
147
|
getComponentMountPoint,
|
|
120
148
|
getComponentWebEndpoint,
|
|
121
149
|
getResourceExportDir,
|
|
150
|
+
getResources,
|
|
122
151
|
getChildWebEndpoint,
|
|
123
152
|
getParentWebEndpoint, // deprecated
|
|
124
153
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TComponent } from '../config';
|
|
2
|
+
type Resource = {
|
|
3
|
+
title: string;
|
|
4
|
+
did: string;
|
|
5
|
+
version: string;
|
|
6
|
+
status?: number;
|
|
7
|
+
path?: string;
|
|
8
|
+
};
|
|
9
|
+
declare function getResources({ components, types, skipRunningCheck, }?: {
|
|
10
|
+
components: TComponent[];
|
|
11
|
+
types?: string[];
|
|
12
|
+
skipRunningCheck?: boolean;
|
|
13
|
+
}): Resource[];
|
|
14
|
+
export { getResources };
|
|
15
|
+
export { Resource };
|
|
16
|
+
declare const _default: {
|
|
17
|
+
getResources: typeof getResources;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getResources = void 0;
|
|
7
|
+
const pick_1 = __importDefault(require("lodash/pick"));
|
|
8
|
+
const constant_1 = require("@blocklet/constant");
|
|
9
|
+
function getResources({ components, types, skipRunningCheck, } = {
|
|
10
|
+
components: [],
|
|
11
|
+
}) {
|
|
12
|
+
const list = [];
|
|
13
|
+
components
|
|
14
|
+
.filter((x) => skipRunningCheck || x.status === constant_1.BlockletStatus.running)
|
|
15
|
+
.forEach((component) => {
|
|
16
|
+
const resource = component.resources?.find((x) => (types || []).some((type) => x.endsWith(type)));
|
|
17
|
+
if (resource) {
|
|
18
|
+
list.push({
|
|
19
|
+
...(0, pick_1.default)(component, ['title', 'did', 'version', 'status']),
|
|
20
|
+
path: resource,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return list;
|
|
25
|
+
}
|
|
26
|
+
exports.getResources = getResources;
|
|
27
|
+
exports.default = {
|
|
28
|
+
getResources,
|
|
29
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -28,35 +28,36 @@ export { Component as component };
|
|
|
28
28
|
export { Component };
|
|
29
29
|
export { Security };
|
|
30
30
|
export { config };
|
|
31
|
+
export interface WindowBlocklet {
|
|
32
|
+
[x: string]: any;
|
|
33
|
+
appId: string;
|
|
34
|
+
appIds: string[];
|
|
35
|
+
appPid: string;
|
|
36
|
+
appName: string;
|
|
37
|
+
appDescription: string;
|
|
38
|
+
appLogo: string;
|
|
39
|
+
appLogoRect: string;
|
|
40
|
+
appUrl: string;
|
|
41
|
+
isComponent: boolean;
|
|
42
|
+
prefix: string;
|
|
43
|
+
groupPrefix: string;
|
|
44
|
+
pageGroup: string;
|
|
45
|
+
version: string;
|
|
46
|
+
theme: TTheme;
|
|
47
|
+
navigation: TNavigation[];
|
|
48
|
+
preferences: Record<string, any>;
|
|
49
|
+
languages: {
|
|
50
|
+
code: string;
|
|
51
|
+
name: string;
|
|
52
|
+
}[];
|
|
53
|
+
passportColor: string;
|
|
54
|
+
componentMountPoints: TComponent[];
|
|
55
|
+
alsoKnownAs: string[];
|
|
56
|
+
trustedFactories: string[];
|
|
57
|
+
}
|
|
31
58
|
declare global {
|
|
32
59
|
interface Window {
|
|
33
|
-
blocklet:
|
|
34
|
-
[x: string]: any;
|
|
35
|
-
appId: string;
|
|
36
|
-
appIds: string[];
|
|
37
|
-
appPid: string;
|
|
38
|
-
appName: string;
|
|
39
|
-
appDescription: string;
|
|
40
|
-
appLogo: string;
|
|
41
|
-
appLogoRect: string;
|
|
42
|
-
appUrl: string;
|
|
43
|
-
isComponent: boolean;
|
|
44
|
-
prefix: string;
|
|
45
|
-
groupPrefix: string;
|
|
46
|
-
pageGroup: string;
|
|
47
|
-
version: string;
|
|
48
|
-
theme: TTheme;
|
|
49
|
-
navigation: TNavigation[];
|
|
50
|
-
preferences: Record<string, any>;
|
|
51
|
-
languages: {
|
|
52
|
-
code: string;
|
|
53
|
-
name: string;
|
|
54
|
-
}[];
|
|
55
|
-
passportColor: string;
|
|
56
|
-
componentMountPoints: TComponent[];
|
|
57
|
-
alsoKnownAs: string[];
|
|
58
|
-
trustedFactories: string[];
|
|
59
|
-
};
|
|
60
|
+
blocklet: WindowBlocklet;
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
export * from './component';
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.19-beta-
|
|
6
|
+
"version": "1.16.19-beta-ba354e01",
|
|
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.19-beta-
|
|
30
|
-
"@abtnode/constant": "1.16.19-beta-
|
|
29
|
+
"@abtnode/client": "1.16.19-beta-ba354e01",
|
|
30
|
+
"@abtnode/constant": "1.16.19-beta-ba354e01",
|
|
31
31
|
"@arcblock/did": "1.18.95",
|
|
32
32
|
"@arcblock/did-auth": "1.18.95",
|
|
33
33
|
"@arcblock/jwt": "1.18.95",
|
|
34
34
|
"@arcblock/ws": "1.18.95",
|
|
35
|
-
"@blocklet/constant": "1.16.19-beta-
|
|
36
|
-
"@blocklet/env": "1.16.19-beta-
|
|
37
|
-
"@blocklet/meta": "1.16.19-beta-
|
|
35
|
+
"@blocklet/constant": "1.16.19-beta-ba354e01",
|
|
36
|
+
"@blocklet/env": "1.16.19-beta-ba354e01",
|
|
37
|
+
"@blocklet/meta": "1.16.19-beta-ba354e01",
|
|
38
38
|
"@did-connect/authenticator": "^2.2.1",
|
|
39
39
|
"@did-connect/handler": "^2.2.1",
|
|
40
40
|
"@nedb/core": "^2.1.5",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"ts-node": "^10.9.1",
|
|
75
75
|
"typescript": "^5.0.4"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "d685f8ca8f2fe49298aa0e94f2f15e1e7ebf761b"
|
|
78
78
|
}
|