@blocklet/meta 1.8.34 → 1.8.36
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
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
"name": "auth",
|
|
3
|
+
"description": "Neat and easy to use user authentication and authorization service for blocklets",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"schema": {
|
|
6
|
+
"JSONSchema": {
|
|
7
|
+
"title": "Config Auth Service",
|
|
8
|
+
"description": "Customize how Auth Service works",
|
|
9
|
+
"type": "object",
|
|
10
|
+
"required": ["profileFields", "webWalletUrl"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"whoCanAccess": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"title": "Who can access the blocklet?",
|
|
15
|
+
"enum": ["owner", "invited", "all"],
|
|
16
|
+
"default": "all"
|
|
17
|
+
},
|
|
18
|
+
"profileFields": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"title": "What info do you want user to provide when login?",
|
|
21
|
+
"items": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"enum": ["fullName", "email", "avatar", "phone"]
|
|
24
|
+
},
|
|
25
|
+
"default": ["fullName", "email", "avatar"],
|
|
26
|
+
"uniqueItems": true
|
|
27
|
+
},
|
|
28
|
+
"allowSwitchProfile": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"title": "Does you app allow user to switch profile?",
|
|
31
|
+
"default": true
|
|
32
|
+
},
|
|
33
|
+
"webWalletUrl": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"title": "The URL of your preferred web wallet instance",
|
|
36
|
+
"pattern": "^https?://",
|
|
37
|
+
"default": "https://web.abtwallet.io"
|
|
38
|
+
},
|
|
39
|
+
"ignoreUrls": {
|
|
40
|
+
"type": "array",
|
|
41
|
+
"title": "Which URLs do not need to be protected. e.g: /public/**",
|
|
42
|
+
"items": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1
|
|
45
|
+
},
|
|
46
|
+
"default": []
|
|
47
|
+
},
|
|
48
|
+
"blockUnauthenticated": {
|
|
49
|
+
"type": "boolean",
|
|
50
|
+
"title": "Do you want Auth Service block unauthenticated requests for you?",
|
|
51
|
+
"default": false
|
|
52
|
+
},
|
|
53
|
+
"blockUnauthorized": {
|
|
54
|
+
"type": "boolean",
|
|
55
|
+
"title": "Do you want Auth Service block unauthorized requests for you?",
|
|
56
|
+
"default": false
|
|
57
|
+
}
|
|
58
|
+
}
|
|
17
59
|
},
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"type": "string",
|
|
23
|
-
"enum": ["fullName", "email", "avatar", "phone"]
|
|
24
|
-
},
|
|
25
|
-
"default": ["fullName", "email", "avatar"],
|
|
26
|
-
"uniqueItems": true
|
|
27
|
-
},
|
|
28
|
-
"allowSwitchProfile": {
|
|
29
|
-
"type": "boolean",
|
|
30
|
-
"title": "Does you app allow user to switch profile?",
|
|
31
|
-
"default": true
|
|
32
|
-
},
|
|
33
|
-
"webWalletUrl": {
|
|
34
|
-
"type": "string",
|
|
35
|
-
"title": "The URL of your preferred web wallet instance",
|
|
36
|
-
"pattern": "^https?://",
|
|
37
|
-
"default": "https://web.abtwallet.io"
|
|
38
|
-
},
|
|
39
|
-
"ignoreUrls": {
|
|
40
|
-
"type": "array",
|
|
41
|
-
"title": "Which URLs do not need to be protected. e.g: /public/**",
|
|
42
|
-
"items": {
|
|
43
|
-
"type": "string",
|
|
44
|
-
"minLength": 1
|
|
45
|
-
},
|
|
46
|
-
"default": []
|
|
47
|
-
},
|
|
48
|
-
"blockUnauthenticated": {
|
|
49
|
-
"type": "boolean",
|
|
50
|
-
"title": "Do you want Auth Service block unauthenticated requests for you?",
|
|
51
|
-
"default": false
|
|
52
|
-
},
|
|
53
|
-
"blockUnauthorized": {
|
|
54
|
-
"type": "boolean",
|
|
55
|
-
"title": "Do you want Auth Service block unauthorized requests for you?",
|
|
56
|
-
"default": false
|
|
60
|
+
"UISchema": {
|
|
61
|
+
"profileFields": {
|
|
62
|
+
"ui:widget": "checkboxes"
|
|
63
|
+
}
|
|
57
64
|
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"UISchema": {
|
|
61
|
-
"profileFields": {
|
|
62
|
-
"ui:widget": "checkboxes"
|
|
63
|
-
}
|
|
64
65
|
}
|
|
65
|
-
}
|
|
66
66
|
}
|
package/lib/service.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const setService: (meta: any) => void;
|
|
2
|
+
declare const getServiceMetas: ({ stringifySchema }?: {
|
|
3
|
+
stringifySchema?: boolean;
|
|
4
|
+
}) => any[];
|
|
5
|
+
declare const getServiceConfig: (serviceName: string, customConfig: any, { validate }?: {
|
|
6
|
+
validate?: any;
|
|
7
|
+
}) => any;
|
|
8
|
+
declare const getDefaultServiceConfig: (serviceName: string) => any;
|
|
9
|
+
declare const findService: (services: any[], name: string) => any;
|
|
10
|
+
export { getServiceMetas };
|
|
11
|
+
export { getServiceConfig };
|
|
12
|
+
export { getDefaultServiceConfig };
|
|
13
|
+
export { findService };
|
|
14
|
+
export { setService };
|
|
15
|
+
declare const _default: {
|
|
16
|
+
getServiceMetas: ({ stringifySchema }?: {
|
|
17
|
+
stringifySchema?: boolean;
|
|
18
|
+
}) => any[];
|
|
19
|
+
getServiceConfig: (serviceName: string, customConfig: any, { validate }?: {
|
|
20
|
+
validate?: any;
|
|
21
|
+
}) => any;
|
|
22
|
+
getDefaultServiceConfig: (serviceName: string) => any;
|
|
23
|
+
findService: (services: any[], name: string) => any;
|
|
24
|
+
setService: (meta: any) => void;
|
|
25
|
+
};
|
|
26
|
+
export default _default;
|
package/lib/service.js
CHANGED
|
@@ -1,101 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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.setService = exports.findService = exports.getDefaultServiceConfig = exports.getServiceConfig = exports.getServiceMetas = void 0;
|
|
7
|
+
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
8
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
9
|
+
const constant_1 = __importDefault(require("@abtnode/constant"));
|
|
10
|
+
const auth_json_1 = __importDefault(require("./service-configs/auth.json"));
|
|
11
|
+
const { NODE_SERVICES } = constant_1.default;
|
|
12
|
+
const ajv = new ajv_1.default({
|
|
13
|
+
useDefaults: true,
|
|
14
|
+
removeAdditional: 'all',
|
|
9
15
|
});
|
|
10
|
-
|
|
11
16
|
const SERVICES = {};
|
|
12
|
-
|
|
13
17
|
const setService = (meta) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
defaultConfig,
|
|
24
|
-
};
|
|
18
|
+
const validate = ajv.compile(meta.schema.JSONSchema);
|
|
19
|
+
// parse empty custom config to get default config
|
|
20
|
+
const defaultConfig = {};
|
|
21
|
+
validate(defaultConfig);
|
|
22
|
+
SERVICES[meta.name] = {
|
|
23
|
+
meta,
|
|
24
|
+
validate,
|
|
25
|
+
defaultConfig,
|
|
26
|
+
};
|
|
25
27
|
};
|
|
26
|
-
|
|
27
|
-
setService(
|
|
28
|
-
|
|
28
|
+
exports.setService = setService;
|
|
29
|
+
setService(auth_json_1.default);
|
|
29
30
|
// backward compatible
|
|
30
|
-
SERVICES[NODE_SERVICES.AUTH_SERVICE] = {
|
|
31
|
-
...SERVICES[NODE_SERVICES.AUTH],
|
|
32
|
-
meta: {
|
|
33
|
-
...SERVICES[NODE_SERVICES.AUTH].meta,
|
|
34
|
-
name: NODE_SERVICES.AUTH_SERVICE,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
31
|
+
SERVICES[NODE_SERVICES.AUTH_SERVICE] = Object.assign(Object.assign({}, SERVICES[NODE_SERVICES.AUTH]), { meta: Object.assign(Object.assign({}, SERVICES[NODE_SERVICES.AUTH].meta), { name: NODE_SERVICES.AUTH_SERVICE }) });
|
|
38
32
|
const getServiceMetas = ({ stringifySchema = false } = {}) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return list;
|
|
33
|
+
const list = Object.values(SERVICES).map(({ meta }) => {
|
|
34
|
+
const data = (0, cloneDeep_1.default)(meta);
|
|
35
|
+
if (stringifySchema) {
|
|
36
|
+
data.schema = JSON.stringify(meta.schema);
|
|
37
|
+
}
|
|
38
|
+
return data;
|
|
39
|
+
});
|
|
40
|
+
return list;
|
|
48
41
|
};
|
|
49
|
-
|
|
42
|
+
exports.getServiceMetas = getServiceMetas;
|
|
50
43
|
const getService = (serviceName) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return service;
|
|
44
|
+
if (!serviceName) {
|
|
45
|
+
throw new Error('service name should not be empty');
|
|
46
|
+
}
|
|
47
|
+
const service = SERVICES[serviceName];
|
|
48
|
+
if (!service) {
|
|
49
|
+
throw new Error(`service ${serviceName} does not exist`);
|
|
50
|
+
}
|
|
51
|
+
return service;
|
|
61
52
|
};
|
|
62
|
-
|
|
63
53
|
const getServiceConfig = (serviceName, customConfig, { validate } = {}) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return data;
|
|
54
|
+
const service = getService(serviceName);
|
|
55
|
+
const data = (0, cloneDeep_1.default)(customConfig || {});
|
|
56
|
+
// this method may have side effect thar will fill default value to customConfig
|
|
57
|
+
const valid = service.validate(data || {});
|
|
58
|
+
if (validate && !valid) {
|
|
59
|
+
const message = service.validate.errors.map((x) => `${x.instancePath} ${x.message}`).join(', ');
|
|
60
|
+
throw new Error(`Invalid blocklet service config: ${message}`);
|
|
61
|
+
}
|
|
62
|
+
return data;
|
|
76
63
|
};
|
|
77
|
-
|
|
64
|
+
exports.getServiceConfig = getServiceConfig;
|
|
78
65
|
const getDefaultServiceConfig = (serviceName) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return defaultConfig;
|
|
66
|
+
const { defaultConfig } = getService(serviceName);
|
|
67
|
+
return defaultConfig;
|
|
82
68
|
};
|
|
83
|
-
|
|
69
|
+
exports.getDefaultServiceConfig = getDefaultServiceConfig;
|
|
84
70
|
const findService = (services, name) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return (services || []).find((x) => names.includes(x.name));
|
|
71
|
+
const names = [name];
|
|
72
|
+
// backward compatible
|
|
73
|
+
if (name === NODE_SERVICES.AUTH) {
|
|
74
|
+
names.push(NODE_SERVICES.AUTH_SERVICE);
|
|
75
|
+
}
|
|
76
|
+
return (services || []).find((x) => names.includes(x.name));
|
|
93
77
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
78
|
+
exports.findService = findService;
|
|
79
|
+
exports.default = {
|
|
80
|
+
getServiceMetas,
|
|
81
|
+
getServiceConfig,
|
|
82
|
+
getDefaultServiceConfig,
|
|
83
|
+
findService,
|
|
84
|
+
setService,
|
|
101
85
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './schema';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
__exportStar(require("./schema"), exports);
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
export interface TBlockletMeta {
|
|
2
|
+
author?: TPerson;
|
|
3
|
+
bundleDid?: string;
|
|
4
|
+
bundleName?: string;
|
|
5
|
+
capabilities?: {
|
|
6
|
+
clusterMode?: boolean;
|
|
7
|
+
component?: boolean;
|
|
8
|
+
didStorage?: 'required' | 'optional';
|
|
9
|
+
};
|
|
10
|
+
community?: string;
|
|
11
|
+
components?: TComponent[];
|
|
12
|
+
contributors?: TPerson[];
|
|
13
|
+
copyright?: {
|
|
14
|
+
owner?: string;
|
|
15
|
+
year?: string | number;
|
|
16
|
+
};
|
|
17
|
+
description: TDescription;
|
|
18
|
+
did: string;
|
|
19
|
+
dist?: TDist;
|
|
20
|
+
documentation?: string;
|
|
21
|
+
engine?: TEngine | TEngine[];
|
|
22
|
+
environments?: TEnvironment[];
|
|
23
|
+
files?: string[];
|
|
24
|
+
gitHash?: string;
|
|
25
|
+
group: 'dapp' | 'static' | 'gateway';
|
|
26
|
+
homepage?: string;
|
|
27
|
+
htmlAst?: any;
|
|
28
|
+
interfaces?: TInterface[];
|
|
29
|
+
keywords?: string | string[];
|
|
30
|
+
lastPublishedAt?: string;
|
|
31
|
+
license?: string;
|
|
32
|
+
logo?: string;
|
|
33
|
+
logoUrl?: string;
|
|
34
|
+
main: string;
|
|
35
|
+
maintainers?: TPerson[];
|
|
36
|
+
name: TBlockletName;
|
|
37
|
+
navigation?: TNavigation;
|
|
38
|
+
nftFactory?: string;
|
|
39
|
+
path?: string;
|
|
40
|
+
payment?: {
|
|
41
|
+
componentPrice?: {
|
|
42
|
+
parentPriceRange?: number[];
|
|
43
|
+
type: 'fixed' | 'percentage';
|
|
44
|
+
value: number;
|
|
45
|
+
}[];
|
|
46
|
+
price?: {
|
|
47
|
+
address: string;
|
|
48
|
+
value: number;
|
|
49
|
+
}[];
|
|
50
|
+
share?: {
|
|
51
|
+
address: string;
|
|
52
|
+
name: string;
|
|
53
|
+
value: number;
|
|
54
|
+
}[];
|
|
55
|
+
};
|
|
56
|
+
repository?: string | {
|
|
57
|
+
directory?: string;
|
|
58
|
+
type: 'git' | 'https' | 'svn';
|
|
59
|
+
url: string;
|
|
60
|
+
};
|
|
61
|
+
requirements?: {
|
|
62
|
+
abtnode?: string;
|
|
63
|
+
cpu?: '*' | 'arm' | 'arm64' | 'ia32' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x32' | 'x64' | ('arm' | 'arm64' | 'ia32' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x32' | 'x64')[];
|
|
64
|
+
fuels?: {
|
|
65
|
+
address?: string;
|
|
66
|
+
endpoint: string;
|
|
67
|
+
reason: string;
|
|
68
|
+
value: string;
|
|
69
|
+
}[];
|
|
70
|
+
nodejs?: string;
|
|
71
|
+
os?: '*' | 'aix' | 'darwin' | 'freebsd' | 'linux' | 'openbsd' | 'sunos' | 'win32' | ('aix' | 'darwin' | 'freebsd' | 'linux' | 'openbsd' | 'sunos' | 'win32')[];
|
|
72
|
+
server?: string;
|
|
73
|
+
};
|
|
74
|
+
screenshots?: string[];
|
|
75
|
+
scripts?: TScripts;
|
|
76
|
+
signatures?: TSignature[];
|
|
77
|
+
specVersion?: string;
|
|
78
|
+
stats?: TStats;
|
|
79
|
+
storeId?: string;
|
|
80
|
+
support?: string | string;
|
|
81
|
+
tags?: string | string[];
|
|
82
|
+
theme?: TTheme;
|
|
83
|
+
timeout?: {
|
|
84
|
+
start?: number;
|
|
85
|
+
};
|
|
86
|
+
title?: TTitle | '';
|
|
87
|
+
version: string;
|
|
88
|
+
}
|
|
89
|
+
export declare type TBlockletName = string;
|
|
90
|
+
export interface TComponent {
|
|
91
|
+
description?: TDescription;
|
|
92
|
+
mountPoint?: TMountPoint;
|
|
93
|
+
mountPoints?: {
|
|
94
|
+
child: {
|
|
95
|
+
interfaceName: string;
|
|
96
|
+
};
|
|
97
|
+
root: {
|
|
98
|
+
interfaceName: string;
|
|
99
|
+
prefix: string;
|
|
100
|
+
};
|
|
101
|
+
services?: TService[];
|
|
102
|
+
}[];
|
|
103
|
+
name: TBlockletName;
|
|
104
|
+
resolved?: string | string;
|
|
105
|
+
services?: TService[];
|
|
106
|
+
source?: {
|
|
107
|
+
url: string | string[];
|
|
108
|
+
} | {
|
|
109
|
+
name: TBlockletName;
|
|
110
|
+
store: string | string[];
|
|
111
|
+
version?: 'latest' | string;
|
|
112
|
+
};
|
|
113
|
+
title?: TTitle;
|
|
114
|
+
}
|
|
115
|
+
export declare type TDescription = string;
|
|
116
|
+
export interface TDist {
|
|
117
|
+
integrity: string;
|
|
118
|
+
size?: number;
|
|
119
|
+
tarball: string | string;
|
|
120
|
+
}
|
|
121
|
+
export interface TEndpoint {
|
|
122
|
+
meta?: {
|
|
123
|
+
params?: {
|
|
124
|
+
description: string;
|
|
125
|
+
name: string;
|
|
126
|
+
}[];
|
|
127
|
+
payable?: boolean;
|
|
128
|
+
vcType?: string;
|
|
129
|
+
};
|
|
130
|
+
path: string;
|
|
131
|
+
type: string;
|
|
132
|
+
}
|
|
133
|
+
export interface TEngine {
|
|
134
|
+
args?: string[];
|
|
135
|
+
interpreter?: 'binary' | 'node';
|
|
136
|
+
platform?: 'aix' | 'darwin' | 'freebsd' | 'linux' | 'openbsd' | 'sunos' | 'win32';
|
|
137
|
+
script: string;
|
|
138
|
+
}
|
|
139
|
+
export interface TEnvironment {
|
|
140
|
+
default?: string;
|
|
141
|
+
description: string;
|
|
142
|
+
name: string;
|
|
143
|
+
required?: boolean;
|
|
144
|
+
secure?: boolean;
|
|
145
|
+
shared?: boolean;
|
|
146
|
+
validation?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface TInterface {
|
|
149
|
+
endpoints?: TEndpoint[];
|
|
150
|
+
name: string;
|
|
151
|
+
path?: string;
|
|
152
|
+
port?: string | {
|
|
153
|
+
external: number;
|
|
154
|
+
internal: string;
|
|
155
|
+
};
|
|
156
|
+
prefix?: string;
|
|
157
|
+
protocol?: 'tcp' | 'udp' | 'http';
|
|
158
|
+
services?: TService[];
|
|
159
|
+
type: 'web' | 'service' | 'wellknown';
|
|
160
|
+
}
|
|
161
|
+
export declare type TLogo = string;
|
|
162
|
+
export declare type TMountPoint = string;
|
|
163
|
+
export declare type TNavigation = TNavigationItem[];
|
|
164
|
+
export interface TNavigationItem {
|
|
165
|
+
component?: string;
|
|
166
|
+
icon?: string;
|
|
167
|
+
items?: {
|
|
168
|
+
component?: string;
|
|
169
|
+
icon?: string;
|
|
170
|
+
link?: string | {
|
|
171
|
+
en?: string;
|
|
172
|
+
zh?: string;
|
|
173
|
+
};
|
|
174
|
+
role?: string[];
|
|
175
|
+
section?: string[];
|
|
176
|
+
title: string | {
|
|
177
|
+
en?: string;
|
|
178
|
+
zh?: string;
|
|
179
|
+
};
|
|
180
|
+
}[];
|
|
181
|
+
link?: string | {
|
|
182
|
+
en?: string;
|
|
183
|
+
zh?: string;
|
|
184
|
+
};
|
|
185
|
+
role?: string[];
|
|
186
|
+
section?: string[];
|
|
187
|
+
title: string | {
|
|
188
|
+
en?: string;
|
|
189
|
+
zh?: string;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
export interface TPerson {
|
|
193
|
+
email?: string;
|
|
194
|
+
name: string;
|
|
195
|
+
url?: string;
|
|
196
|
+
}
|
|
197
|
+
export interface TScripts {
|
|
198
|
+
dev?: string;
|
|
199
|
+
e2eDev?: string;
|
|
200
|
+
postInstall?: string;
|
|
201
|
+
postStart?: string;
|
|
202
|
+
preConfig?: string;
|
|
203
|
+
preInstall?: string;
|
|
204
|
+
preStart?: string;
|
|
205
|
+
preStop?: string;
|
|
206
|
+
preUninstall?: string;
|
|
207
|
+
}
|
|
208
|
+
export interface TService {
|
|
209
|
+
/**
|
|
210
|
+
* Any Property
|
|
211
|
+
*/
|
|
212
|
+
[x: string]: any;
|
|
213
|
+
config?: object;
|
|
214
|
+
name: string;
|
|
215
|
+
}
|
|
216
|
+
export interface TSignature {
|
|
217
|
+
appended?: string[];
|
|
218
|
+
created: string;
|
|
219
|
+
delegatee?: string;
|
|
220
|
+
delegateePk?: string;
|
|
221
|
+
delegation?: string;
|
|
222
|
+
excludes?: string[];
|
|
223
|
+
name: string;
|
|
224
|
+
pk: string;
|
|
225
|
+
sig: string;
|
|
226
|
+
signer: string;
|
|
227
|
+
type: string;
|
|
228
|
+
}
|
|
229
|
+
export interface TStats {
|
|
230
|
+
downloads?: number;
|
|
231
|
+
purchases?: number;
|
|
232
|
+
star?: number;
|
|
233
|
+
}
|
|
234
|
+
export interface TTheme {
|
|
235
|
+
background?: string | {
|
|
236
|
+
default?: string;
|
|
237
|
+
footer?: string;
|
|
238
|
+
header?: string;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
export declare type TTitle = string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { TBlockletMeta, TComponent } from './types';
|
|
2
|
+
declare const validateUrl: (url: string, expectedHttpResTypes?: string[]) => Promise<boolean>;
|
|
3
|
+
declare const getBlockletMetaByUrl: (url: string) => Promise<TBlockletMeta>;
|
|
4
|
+
declare const getBlockletMetaFromUrl: (url: string, { validateFn, returnUrl, ensureTarball, logger, }?: {
|
|
5
|
+
validateFn?: Function;
|
|
6
|
+
returnUrl?: boolean;
|
|
7
|
+
ensureTarball?: boolean;
|
|
8
|
+
logger?: any;
|
|
9
|
+
}) => Promise<any>;
|
|
10
|
+
declare const getBlockletMetaFromUrls: (urls: string[], { validateFn, returnUrl, ensureTarball, logger, }?: {
|
|
11
|
+
validateFn?: Function;
|
|
12
|
+
returnUrl?: boolean;
|
|
13
|
+
ensureTarball?: boolean;
|
|
14
|
+
logger?: any;
|
|
15
|
+
}) => Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* @param {*} config defined in componentSchema in blocklet meta schema
|
|
18
|
+
*/
|
|
19
|
+
declare const getSourceUrlsFromConfig: (config: TComponent & any) => string[];
|
|
20
|
+
export { validateUrl };
|
|
21
|
+
export { getBlockletMetaByUrl };
|
|
22
|
+
export { getBlockletMetaFromUrl };
|
|
23
|
+
export { getBlockletMetaFromUrls };
|
|
24
|
+
export { getSourceUrlsFromConfig };
|
|
25
|
+
declare const _default: {
|
|
26
|
+
validateUrl: (url: string, expectedHttpResTypes?: string[]) => Promise<boolean>;
|
|
27
|
+
getBlockletMetaByUrl: (url: string) => Promise<TBlockletMeta>;
|
|
28
|
+
getBlockletMetaFromUrl: (url: string, { validateFn, returnUrl, ensureTarball, logger, }?: {
|
|
29
|
+
validateFn?: Function;
|
|
30
|
+
returnUrl?: boolean;
|
|
31
|
+
ensureTarball?: boolean;
|
|
32
|
+
logger?: any;
|
|
33
|
+
}) => Promise<any>;
|
|
34
|
+
getBlockletMetaFromUrls: (urls: string[], { validateFn, returnUrl, ensureTarball, logger, }?: {
|
|
35
|
+
validateFn?: Function;
|
|
36
|
+
returnUrl?: boolean;
|
|
37
|
+
ensureTarball?: boolean;
|
|
38
|
+
logger?: any;
|
|
39
|
+
}) => Promise<any>;
|
|
40
|
+
getSourceUrlsFromConfig: (config: any) => string[];
|
|
41
|
+
};
|
|
42
|
+
export default _default;
|