@blocklet/meta 1.8.34 → 1.8.35
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/channel.d.ts +27 -0
- package/lib/channel.js +32 -32
- package/lib/constants.d.ts +2 -0
- package/lib/constants.js +6 -3
- package/lib/did.d.ts +10 -0
- package/lib/did.js +18 -24
- package/lib/engine.d.ts +7 -0
- package/lib/engine.js +21 -25
- package/lib/entry.d.ts +3 -0
- package/lib/entry.js +51 -64
- package/lib/extension.d.ts +10 -0
- package/lib/extension.js +78 -77
- package/lib/file.d.ts +21 -0
- package/lib/file.js +44 -39
- package/lib/fix.d.ts +33 -0
- package/lib/fix.js +218 -208
- package/lib/get-component-process-id.d.ts +5 -0
- package/lib/get-component-process-id.js +13 -14
- package/lib/has-reserved-key.d.ts +3 -0
- package/lib/has-reserved-key.js +10 -9
- package/lib/index.d.ts +82 -0
- package/lib/index.js +51 -34
- package/lib/info.d.ts +13 -0
- package/lib/info.js +58 -60
- package/lib/name.d.ts +5 -0
- package/lib/name.js +14 -7
- package/lib/nft-templates.d.ts +86 -0
- package/lib/nft-templates.js +47 -42
- package/lib/parse-navigation.d.ts +3 -0
- package/lib/parse-navigation.js +167 -228
- package/lib/parse.d.ts +22 -0
- package/lib/parse.js +71 -82
- package/lib/payment/index.d.ts +254 -0
- package/lib/payment/index.js +13 -6
- package/lib/payment/v1.d.ts +185 -0
- package/lib/payment/v1.js +80 -81
- package/lib/payment/v2.d.ts +242 -0
- package/lib/payment/v2.js +453 -531
- package/lib/schema.d.ts +50 -0
- package/lib/schema.js +405 -402
- package/lib/service-configs/auth.json +61 -61
- package/lib/service.d.ts +26 -0
- package/lib/service.js +69 -85
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +18 -0
- package/lib/types/schema.d.ts +241 -0
- package/lib/types/schema.js +3 -0
- package/lib/util-meta.d.ts +42 -0
- package/lib/util-meta.js +138 -158
- package/lib/util.d.ts +185 -0
- package/lib/util.js +359 -414
- package/lib/validate.d.ts +10 -0
- package/lib/validate.js +28 -34
- package/lib/verify-multi-sig.d.ts +3 -0
- package/lib/verify-multi-sig.js +94 -101
- package/lib/wallet.d.ts +9 -0
- package/lib/wallet.js +17 -27
- package/package.json +40 -18
package/lib/util-meta.js
CHANGED
|
@@ -1,174 +1,154 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getSourceUrlsFromConfig = exports.getBlockletMetaFromUrls = exports.getBlockletMetaFromUrl = exports.getBlockletMetaByUrl = exports.validateUrl = void 0;
|
|
16
|
+
const url_1 = require("url");
|
|
17
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
|
+
const axios_1 = __importDefault(require("@abtnode/util/lib/axios"));
|
|
19
|
+
const promise_any_1 = __importDefault(require("promise.any"));
|
|
20
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
21
|
+
const constant_1 = __importDefault(require("@abtnode/constant"));
|
|
22
|
+
const did_1 = __importDefault(require("./did"));
|
|
23
|
+
const validate_1 = require("./validate");
|
|
24
|
+
const { BLOCKLET_STORE_API_BLOCKLET_PREFIX } = constant_1.default;
|
|
25
|
+
const validateUrl = (url, expectedHttpResTypes = ['application/json', 'text/plain']) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
const parsed = new URL(url);
|
|
27
|
+
const { protocol } = parsed;
|
|
28
|
+
// file
|
|
29
|
+
if (protocol.startsWith('file')) {
|
|
30
|
+
const decoded = decodeURIComponent((0, url_1.fileURLToPath)(url));
|
|
31
|
+
if (!fs_1.default.existsSync(decoded)) {
|
|
32
|
+
throw new Error(`File does not exist: ${decoded}`);
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
33
35
|
}
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
// http(s)
|
|
37
|
+
if (protocol.startsWith('http')) {
|
|
38
|
+
let res;
|
|
39
|
+
try {
|
|
40
|
+
res = yield (0, axios_1.default)({ url, method: 'HEAD', timeout: 1000 * 10 });
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
throw new Error(`Cannot get content-type from ${url}: ${err.message}`);
|
|
44
|
+
}
|
|
45
|
+
if (res.headers['content-type'] &&
|
|
46
|
+
expectedHttpResTypes.some((x) => res.headers['content-type'].includes(x)) === false) {
|
|
47
|
+
throw new Error(`Unexpected content-type from ${url}: ${res.headers['content-type']}`);
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
40
50
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
throw new Error(`Invalid url protocol: ${protocol.replace(/:$/, '')}`);
|
|
46
|
-
};
|
|
47
|
-
|
|
51
|
+
throw new Error(`Invalid url protocol: ${protocol.replace(/:$/, '')}`);
|
|
52
|
+
});
|
|
53
|
+
exports.validateUrl = validateUrl;
|
|
48
54
|
const validateBlockletMeta = (meta, opts = {}) => {
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
(0, validate_1.fixAndValidateService)(meta);
|
|
56
|
+
return (0, validate_1.validateMeta)(meta, opts);
|
|
51
57
|
};
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
const getBlockletMetaByUrl = (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
const { protocol } = new URL(url);
|
|
60
|
+
if (protocol.startsWith('file')) {
|
|
61
|
+
const decoded = decodeURIComponent((0, url_1.fileURLToPath)(url));
|
|
62
|
+
if (!fs_1.default.existsSync(decoded)) {
|
|
63
|
+
throw new Error(`File does not exist: ${decoded}`);
|
|
64
|
+
}
|
|
65
|
+
const d = yield fs_1.default.promises.readFile(decoded);
|
|
66
|
+
// @ts-expect-error TS(2345) FIXME: Argument of type 'Buffer' is not assignable to par... Remove this comment to see the full error message
|
|
67
|
+
const meta = JSON.parse(d);
|
|
68
|
+
return meta;
|
|
60
69
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const { data: meta } = await axios({ url, method: 'GET', timeout: 1000 * 20 });
|
|
68
|
-
if (Object.prototype.toString.call(meta) !== '[object Object]') {
|
|
69
|
-
throw new Error('Url is not valid');
|
|
70
|
+
if (protocol.startsWith('http')) {
|
|
71
|
+
const { data: meta } = yield (0, axios_1.default)({ url, method: 'GET', timeout: 1000 * 20 });
|
|
72
|
+
if (Object.prototype.toString.call(meta) !== '[object Object]') {
|
|
73
|
+
throw new Error('Url is not valid');
|
|
74
|
+
}
|
|
75
|
+
return meta;
|
|
70
76
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
77
|
+
throw new Error(`Invalid url protocol: ${protocol.replace(/:$/, '')}`);
|
|
78
|
+
});
|
|
79
|
+
exports.getBlockletMetaByUrl = getBlockletMetaByUrl;
|
|
80
|
+
const getBlockletMetaFromUrl = (url, { validateFn = validateBlockletMeta, returnUrl = false, ensureTarball = true, logger, } = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
+
const meta = yield getBlockletMetaByUrl(url);
|
|
82
|
+
delete meta.htmlAst;
|
|
83
|
+
const newMeta = validateFn(meta, { ensureDist: true });
|
|
84
|
+
if (ensureTarball) {
|
|
85
|
+
try {
|
|
86
|
+
const { href } = new URL(newMeta.dist.tarball, url);
|
|
87
|
+
const tarball = decodeURIComponent(href);
|
|
88
|
+
try {
|
|
89
|
+
yield validateUrl(tarball, ['application/octet-stream', 'application/x-gzip']);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (!error.message.startsWith('Cannot get content-type')) {
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
newMeta.dist.tarball = tarball;
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
const msg = `Invalid blocklet meta: dist.tarball is not a valid url ${err.message}`;
|
|
100
|
+
if (logger) {
|
|
101
|
+
logger.error(msg);
|
|
102
|
+
}
|
|
103
|
+
throw new Error(msg);
|
|
96
104
|
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
newMeta.dist.tarball = tarball;
|
|
100
|
-
} catch (err) {
|
|
101
|
-
const msg = `Invalid blocklet meta: dist.tarball is not a valid url ${err.message}`;
|
|
102
|
-
|
|
103
|
-
if (logger) {
|
|
104
|
-
logger.error(msg);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
throw new Error(msg);
|
|
108
105
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (returnUrl) {
|
|
112
|
-
return { meta: newMeta, url };
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return newMeta;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const getBlockletMetaFromUrls = async (urls, { validateFn, returnUrl = false, ensureTarball = true, logger } = {}) => {
|
|
119
|
-
try {
|
|
120
|
-
const res = await any(
|
|
121
|
-
urls.map((url) => getBlockletMetaFromUrl(url, { validateFn, returnUrl, ensureTarball, logger }))
|
|
122
|
-
);
|
|
123
|
-
return res;
|
|
124
|
-
} catch (err) {
|
|
125
|
-
let { message } = err;
|
|
126
|
-
if (Array.isArray(err.errors)) {
|
|
127
|
-
message = err.errors.map((x) => x.message).join(', ');
|
|
106
|
+
if (returnUrl) {
|
|
107
|
+
return { meta: newMeta, url };
|
|
128
108
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
109
|
+
return newMeta;
|
|
110
|
+
});
|
|
111
|
+
exports.getBlockletMetaFromUrl = getBlockletMetaFromUrl;
|
|
112
|
+
const getBlockletMetaFromUrls = (urls, { validateFn, returnUrl = false, ensureTarball = true, logger, } = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
113
|
+
try {
|
|
114
|
+
const res = yield (0, promise_any_1.default)(urls.map((url) => getBlockletMetaFromUrl(url, { validateFn, returnUrl, ensureTarball, logger })));
|
|
115
|
+
return res;
|
|
132
116
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
117
|
+
catch (err) {
|
|
118
|
+
let { message } = err;
|
|
119
|
+
if (Array.isArray(err.errors)) {
|
|
120
|
+
message = err.errors.map((x) => x.message).join(', ');
|
|
121
|
+
}
|
|
122
|
+
if (logger) {
|
|
123
|
+
logger.error('failed get blocklet meta', { urls, message });
|
|
124
|
+
}
|
|
125
|
+
throw new Error(message);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
exports.getBlockletMetaFromUrls = getBlockletMetaFromUrls;
|
|
138
129
|
/**
|
|
139
|
-
* @param {*} config defined in
|
|
130
|
+
* @param {*} config defined in componentSchema in blocklet meta schema
|
|
140
131
|
*/
|
|
141
132
|
const getSourceUrlsFromConfig = (config) => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
133
|
+
if (config.source) {
|
|
134
|
+
if (config.source.url) {
|
|
135
|
+
return [config.source.url].flat();
|
|
136
|
+
}
|
|
137
|
+
const { store, version, name } = config.source;
|
|
138
|
+
return [store]
|
|
139
|
+
.flat()
|
|
140
|
+
.map((x) => (0, url_join_1.default)(x, BLOCKLET_STORE_API_BLOCKLET_PREFIX, (0, did_1.default)(name), !version || version === 'latest' ? '' : version, 'blocklet.json'));
|
|
141
|
+
}
|
|
142
|
+
if (config.resolved) {
|
|
143
|
+
return [config.resolved];
|
|
145
144
|
}
|
|
146
|
-
|
|
147
|
-
const { store, version, name } = config.source;
|
|
148
|
-
return [store]
|
|
149
|
-
.flat()
|
|
150
|
-
.map((x) =>
|
|
151
|
-
joinUrl(
|
|
152
|
-
x,
|
|
153
|
-
BLOCKLET_STORE_API_BLOCKLET_PREFIX,
|
|
154
|
-
toBlockletDid(name),
|
|
155
|
-
!version || version === 'latest' ? '' : version,
|
|
156
|
-
'blocklet.json'
|
|
157
|
-
)
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (config.resolved) {
|
|
162
|
-
return [config.resolved];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
throw new Error('Invalid child config');
|
|
145
|
+
throw new Error('Invalid child config');
|
|
166
146
|
};
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
147
|
+
exports.getSourceUrlsFromConfig = getSourceUrlsFromConfig;
|
|
148
|
+
exports.default = {
|
|
149
|
+
validateUrl,
|
|
150
|
+
getBlockletMetaByUrl,
|
|
151
|
+
getBlockletMetaFromUrl,
|
|
152
|
+
getBlockletMetaFromUrls,
|
|
153
|
+
getSourceUrlsFromConfig,
|
|
174
154
|
};
|
package/lib/util.d.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { BlockletState } from '@abtnode/client';
|
|
2
|
+
import { Request } from 'express';
|
|
3
|
+
import { TBlockletMeta, TEnvironment } from './types';
|
|
4
|
+
declare const getComponentId: (component?: {
|
|
5
|
+
meta?: {
|
|
6
|
+
did?: string;
|
|
7
|
+
};
|
|
8
|
+
}, ancestors?: Array<{
|
|
9
|
+
meta?: {
|
|
10
|
+
did?: string;
|
|
11
|
+
};
|
|
12
|
+
}>) => string;
|
|
13
|
+
declare const getComponentName: (component?: {
|
|
14
|
+
meta?: {
|
|
15
|
+
name?: string;
|
|
16
|
+
};
|
|
17
|
+
}, ancestors?: Array<{
|
|
18
|
+
meta?: {
|
|
19
|
+
name?: string;
|
|
20
|
+
};
|
|
21
|
+
}>) => string;
|
|
22
|
+
declare const getComponentBundleId: (component: {
|
|
23
|
+
meta: {
|
|
24
|
+
bundleName: string;
|
|
25
|
+
version: string;
|
|
26
|
+
};
|
|
27
|
+
}) => string;
|
|
28
|
+
/**
|
|
29
|
+
* a => ''
|
|
30
|
+
* @a/b => ''
|
|
31
|
+
* a/b => a
|
|
32
|
+
* @a/b/c => @a/b
|
|
33
|
+
* a/@b/c => a
|
|
34
|
+
* @a/b/@c/d => @a/b
|
|
35
|
+
* @a/b/@c/d/e => @a/b/@c/d
|
|
36
|
+
* @a/b/@c/d/@e/f => @a/b/@c/d
|
|
37
|
+
*/
|
|
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, }?: {
|
|
40
|
+
parallel?: boolean;
|
|
41
|
+
sync?: boolean;
|
|
42
|
+
params?: any;
|
|
43
|
+
_parent?: any;
|
|
44
|
+
_root?: any;
|
|
45
|
+
_level?: number;
|
|
46
|
+
_tasks?: any;
|
|
47
|
+
_ancestors?: any[];
|
|
48
|
+
}) => Promise<unknown>;
|
|
49
|
+
declare const forEachBlockletSync: (blocklet: any, cb: Function) => Promise<unknown>;
|
|
50
|
+
declare const forEachChild: (blocklet: any, cb: Function, params?: any) => Promise<any>;
|
|
51
|
+
declare const forEachChildSync: (blocklet: BlockletState, cb: Function) => Promise<any>;
|
|
52
|
+
declare const findComponentById: (blocklet: BlockletState, componentId: string, { _ancestors, returnAncestors, }?: {
|
|
53
|
+
_ancestors?: any[];
|
|
54
|
+
returnAncestors?: boolean;
|
|
55
|
+
}) => any;
|
|
56
|
+
declare const isEnvShareable: (env?: TEnvironment & {
|
|
57
|
+
key: string;
|
|
58
|
+
}) => boolean;
|
|
59
|
+
declare const getSharedConfigObj: (component: BlockletState, ancestors?: any[]) => any;
|
|
60
|
+
declare const getAppMissingConfigs: (blocklet?: any) => any[];
|
|
61
|
+
declare const getComponentMissingConfigs: (component?: any, ancestors?: any[]) => any[];
|
|
62
|
+
declare const isFreeBlocklet: (meta: TBlockletMeta) => boolean;
|
|
63
|
+
declare const isFreeComponent: (meta: TBlockletMeta) => boolean;
|
|
64
|
+
declare const isComponentBlocklet: (meta?: TBlockletMeta) => boolean;
|
|
65
|
+
declare const wipeSensitiveData: (blocklet?: BlockletState) => BlockletState;
|
|
66
|
+
declare const isDeletableBlocklet: (blocklet?: BlockletState) => boolean;
|
|
67
|
+
declare const hasRunnableComponent: (blocklet: BlockletState) => boolean;
|
|
68
|
+
/**
|
|
69
|
+
* 获取 blocklet 的 name
|
|
70
|
+
* @param {Object} blocklet 应用数据
|
|
71
|
+
* @param {Boolean} onlyUseMeta 优先使用应用元数据的name
|
|
72
|
+
* @returns blocklet display name
|
|
73
|
+
*/
|
|
74
|
+
declare const getDisplayName: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
|
75
|
+
declare const fixBlockletStatus: (blocklet?: BlockletState) => void;
|
|
76
|
+
declare const findWebInterface: (blocklet?: BlockletState | TBlockletMeta) => any;
|
|
77
|
+
declare const findServiceFromMeta: (meta?: TBlockletMeta, ServiceName?: string) => any;
|
|
78
|
+
declare const getWhoCanAccess: (blocklet?: BlockletState) => any;
|
|
79
|
+
declare const getConnectAppUrl: ({ request, baseUrl }: {
|
|
80
|
+
request: Partial<Request>;
|
|
81
|
+
baseUrl: string;
|
|
82
|
+
}) => string;
|
|
83
|
+
declare const replaceSlotToIp: (url?: string, ip?: string) => string;
|
|
84
|
+
declare const urlFriendly: (name: string) => string;
|
|
85
|
+
declare const getChainInfo: (env: Record<string, string>) => Record<string, string>;
|
|
86
|
+
declare const isExternalBlocklet: (blocklet?: BlockletState) => boolean;
|
|
87
|
+
export { isFreeBlocklet };
|
|
88
|
+
export { isFreeComponent };
|
|
89
|
+
export { isComponentBlocklet };
|
|
90
|
+
export { forEachBlocklet };
|
|
91
|
+
export { forEachBlockletSync };
|
|
92
|
+
export { forEachChild };
|
|
93
|
+
export { forEachChildSync };
|
|
94
|
+
export { isDeletableBlocklet };
|
|
95
|
+
export { getSharedConfigObj };
|
|
96
|
+
export { getAppMissingConfigs };
|
|
97
|
+
export { getComponentMissingConfigs };
|
|
98
|
+
export { isEnvShareable };
|
|
99
|
+
export { wipeSensitiveData };
|
|
100
|
+
export { hasRunnableComponent };
|
|
101
|
+
export { getDisplayName };
|
|
102
|
+
export { fixBlockletStatus };
|
|
103
|
+
export { findWebInterface };
|
|
104
|
+
export { findServiceFromMeta };
|
|
105
|
+
export { getWhoCanAccess };
|
|
106
|
+
export { replaceSlotToIp };
|
|
107
|
+
export { urlFriendly };
|
|
108
|
+
export { getComponentId };
|
|
109
|
+
export { getComponentName };
|
|
110
|
+
export { getComponentBundleId };
|
|
111
|
+
export { findComponentById };
|
|
112
|
+
export { getParentComponentName };
|
|
113
|
+
export { getConnectAppUrl };
|
|
114
|
+
export { getChainInfo };
|
|
115
|
+
export { isExternalBlocklet };
|
|
116
|
+
declare const _default: {
|
|
117
|
+
isFreeBlocklet: (meta: TBlockletMeta) => boolean;
|
|
118
|
+
isFreeComponent: (meta: TBlockletMeta) => boolean;
|
|
119
|
+
isComponentBlocklet: (meta?: TBlockletMeta) => boolean;
|
|
120
|
+
forEachBlocklet: (blocklet: BlockletState, cb: Function, { parallel, sync, params: inputParams, _parent, _root, _level, _tasks: inputTasks, _ancestors, }?: {
|
|
121
|
+
parallel?: boolean;
|
|
122
|
+
sync?: boolean;
|
|
123
|
+
params?: any;
|
|
124
|
+
_parent?: any;
|
|
125
|
+
_root?: any;
|
|
126
|
+
_level?: number;
|
|
127
|
+
_tasks?: any;
|
|
128
|
+
_ancestors?: any[];
|
|
129
|
+
}) => Promise<unknown>;
|
|
130
|
+
forEachBlockletSync: (blocklet: any, cb: Function) => Promise<unknown>;
|
|
131
|
+
forEachChild: (blocklet: any, cb: Function, params?: any) => Promise<any>;
|
|
132
|
+
forEachChildSync: (blocklet: BlockletState, cb: Function) => Promise<any>;
|
|
133
|
+
isDeletableBlocklet: (blocklet?: BlockletState) => boolean;
|
|
134
|
+
getSharedConfigObj: (component: BlockletState, ancestors?: any[]) => any;
|
|
135
|
+
getAppMissingConfigs: (blocklet?: any) => any[];
|
|
136
|
+
getComponentMissingConfigs: (component?: any, ancestors?: any[]) => any[];
|
|
137
|
+
isEnvShareable: (env?: TEnvironment & {
|
|
138
|
+
key: string;
|
|
139
|
+
}) => boolean;
|
|
140
|
+
wipeSensitiveData: (blocklet?: BlockletState) => BlockletState;
|
|
141
|
+
hasRunnableComponent: (blocklet: BlockletState) => boolean;
|
|
142
|
+
getDisplayName: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
|
143
|
+
fixBlockletStatus: (blocklet?: BlockletState) => void;
|
|
144
|
+
findWebInterface: (blocklet?: TBlockletMeta | BlockletState) => any;
|
|
145
|
+
findServiceFromMeta: (meta?: TBlockletMeta, ServiceName?: string) => any;
|
|
146
|
+
getWhoCanAccess: (blocklet?: BlockletState) => any;
|
|
147
|
+
replaceSlotToIp: (url?: string, ip?: string) => string;
|
|
148
|
+
urlFriendly: (name: string) => string;
|
|
149
|
+
getComponentId: (component?: {
|
|
150
|
+
meta?: {
|
|
151
|
+
did?: string;
|
|
152
|
+
};
|
|
153
|
+
}, ancestors?: {
|
|
154
|
+
meta?: {
|
|
155
|
+
did?: string;
|
|
156
|
+
};
|
|
157
|
+
}[]) => string;
|
|
158
|
+
getComponentName: (component?: {
|
|
159
|
+
meta?: {
|
|
160
|
+
name?: string;
|
|
161
|
+
};
|
|
162
|
+
}, ancestors?: {
|
|
163
|
+
meta?: {
|
|
164
|
+
name?: string;
|
|
165
|
+
};
|
|
166
|
+
}[]) => string;
|
|
167
|
+
getComponentBundleId: (component: {
|
|
168
|
+
meta: {
|
|
169
|
+
bundleName: string;
|
|
170
|
+
version: string;
|
|
171
|
+
};
|
|
172
|
+
}) => string;
|
|
173
|
+
findComponentById: (blocklet: BlockletState, componentId: string, { _ancestors, returnAncestors, }?: {
|
|
174
|
+
_ancestors?: any[];
|
|
175
|
+
returnAncestors?: boolean;
|
|
176
|
+
}) => any;
|
|
177
|
+
getParentComponentName: (name?: string) => string;
|
|
178
|
+
getConnectAppUrl: ({ request, baseUrl }: {
|
|
179
|
+
request: Partial<Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>>;
|
|
180
|
+
baseUrl: string;
|
|
181
|
+
}) => string;
|
|
182
|
+
getChainInfo: (env: Record<string, string>) => Record<string, string>;
|
|
183
|
+
isExternalBlocklet: (blocklet?: BlockletState) => boolean;
|
|
184
|
+
};
|
|
185
|
+
export default _default;
|