@yuants/vendor-solscan 0.0.0
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/dist/extension.bundle.js +118 -0
- package/package.json +41 -0
@@ -0,0 +1,118 @@
|
|
1
|
+
(function () {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @public
|
6
|
+
*/
|
7
|
+
/**
|
8
|
+
* Generates environment variables in the format of a Docker Compose file.
|
9
|
+
* @public
|
10
|
+
* @param env - The environment variables.
|
11
|
+
* @returns The environment variables in the format of a Docker Compose file.
|
12
|
+
*/
|
13
|
+
function makeDockerEnvs(env) {
|
14
|
+
return Object.entries(env !== null && env !== void 0 ? env : {}).map(([k, v]) => `${k}=${v}`);
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* Generates environment variables in the format of a Kubernetes pod.
|
18
|
+
* @public
|
19
|
+
* @param env - The environment variables.
|
20
|
+
* @returns The environment variables in the format of a Kubernetes pod.
|
21
|
+
*/
|
22
|
+
function makeK8sEnvs(env) {
|
23
|
+
return Object.entries(env !== null && env !== void 0 ? env : {}).map(([k, v]) => ({
|
24
|
+
name: k,
|
25
|
+
value: `${v}`,
|
26
|
+
}));
|
27
|
+
}
|
28
|
+
|
29
|
+
var extension = (context) => {
|
30
|
+
const PACKAGE_NAME = 'vendor-solscan';
|
31
|
+
context.registerDeployProvider({
|
32
|
+
make_json_schema: () => ({
|
33
|
+
type: 'object',
|
34
|
+
properties: {
|
35
|
+
env: {
|
36
|
+
type: 'object',
|
37
|
+
required: ['HOST_URL', 'SOLSCAN_API_TOKEN'],
|
38
|
+
properties: {
|
39
|
+
HOST_URL: { type: 'string' },
|
40
|
+
TERMINAL_ID: { type: 'string' },
|
41
|
+
SOLSCAN_API_TOKEN: { type: 'string' },
|
42
|
+
},
|
43
|
+
},
|
44
|
+
},
|
45
|
+
}),
|
46
|
+
make_docker_compose_file: async (ctx, envCtx) => {
|
47
|
+
var _a;
|
48
|
+
return {
|
49
|
+
[`${PACKAGE_NAME}-${ctx.key}`.replace(/\s/g, '')]: {
|
50
|
+
image: `ghcr.io/no-trade-no-life/${PACKAGE_NAME}:${(_a = ctx.version) !== null && _a !== void 0 ? _a : envCtx.version}`,
|
51
|
+
restart: 'always',
|
52
|
+
environment: makeDockerEnvs(ctx.env),
|
53
|
+
},
|
54
|
+
};
|
55
|
+
},
|
56
|
+
make_k8s_resource_objects: async (ctx, envCtx) => {
|
57
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
58
|
+
return {
|
59
|
+
deployment: {
|
60
|
+
apiVersion: 'apps/v1',
|
61
|
+
kind: 'Deployment',
|
62
|
+
metadata: {
|
63
|
+
labels: {
|
64
|
+
'y.ntnl.io/version': (_a = ctx.version) !== null && _a !== void 0 ? _a : envCtx.version,
|
65
|
+
'y.ntnl.io/manifest_key': ctx.key,
|
66
|
+
'y.ntnl.io/component': PACKAGE_NAME,
|
67
|
+
},
|
68
|
+
name: `${PACKAGE_NAME}-${ctx.key}`.replace(/\s/g, '').toLocaleLowerCase(),
|
69
|
+
namespace: 'yuan',
|
70
|
+
},
|
71
|
+
spec: {
|
72
|
+
replicas: 1,
|
73
|
+
selector: {
|
74
|
+
matchLabels: {
|
75
|
+
'y.ntnl.io/component': PACKAGE_NAME,
|
76
|
+
'y.ntnl.io/manifest_key': ctx.key,
|
77
|
+
},
|
78
|
+
},
|
79
|
+
template: {
|
80
|
+
metadata: {
|
81
|
+
labels: {
|
82
|
+
'y.ntnl.io/version': (_b = ctx.version) !== null && _b !== void 0 ? _b : envCtx.version,
|
83
|
+
'y.ntnl.io/manifest_key': ctx.key,
|
84
|
+
'y.ntnl.io/component': PACKAGE_NAME,
|
85
|
+
},
|
86
|
+
},
|
87
|
+
spec: {
|
88
|
+
containers: [
|
89
|
+
{
|
90
|
+
env: makeK8sEnvs(ctx.env),
|
91
|
+
image: `ghcr.io/no-trade-no-life/${PACKAGE_NAME}:${(_c = ctx.version) !== null && _c !== void 0 ? _c : envCtx.version}`,
|
92
|
+
imagePullPolicy: 'IfNotPresent',
|
93
|
+
name: PACKAGE_NAME,
|
94
|
+
resources: {
|
95
|
+
limits: {
|
96
|
+
cpu: (_e = (_d = ctx.cpu) === null || _d === void 0 ? void 0 : _d.max) !== null && _e !== void 0 ? _e : '500m',
|
97
|
+
memory: (_g = (_f = ctx.memory) === null || _f === void 0 ? void 0 : _f.max) !== null && _g !== void 0 ? _g : '256Mi',
|
98
|
+
},
|
99
|
+
requests: {
|
100
|
+
cpu: (_j = (_h = ctx.cpu) === null || _h === void 0 ? void 0 : _h.min) !== null && _j !== void 0 ? _j : '100m',
|
101
|
+
memory: (_l = (_k = ctx.memory) === null || _k === void 0 ? void 0 : _k.min) !== null && _l !== void 0 ? _l : '128Mi',
|
102
|
+
},
|
103
|
+
},
|
104
|
+
},
|
105
|
+
],
|
106
|
+
hostname: PACKAGE_NAME,
|
107
|
+
},
|
108
|
+
},
|
109
|
+
},
|
110
|
+
},
|
111
|
+
};
|
112
|
+
},
|
113
|
+
});
|
114
|
+
};
|
115
|
+
|
116
|
+
return extension;
|
117
|
+
|
118
|
+
})();
|
package/package.json
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"name": "@yuants/vendor-solscan",
|
3
|
+
"version": "0.0.0",
|
4
|
+
"files": [
|
5
|
+
"dist/extension.bundle.js"
|
6
|
+
],
|
7
|
+
"dependencies": {
|
8
|
+
"@yuants/protocol": "0.32.0",
|
9
|
+
"@yuants/data-model": "0.17.6",
|
10
|
+
"@yuants/utils": "0.3.7",
|
11
|
+
"rxjs": "~7.5.6",
|
12
|
+
"crypto-js": "^4.2.0"
|
13
|
+
},
|
14
|
+
"devDependencies": {
|
15
|
+
"@microsoft/api-extractor": "~7.30.0",
|
16
|
+
"@rushstack/heft": "~0.47.5",
|
17
|
+
"@rushstack/heft-jest-plugin": "~0.3.30",
|
18
|
+
"@rushstack/heft-node-rig": "~1.10.7",
|
19
|
+
"@types/heft-jest": "1.0.3",
|
20
|
+
"@types/node": "18",
|
21
|
+
"@yuants/extension": "0.2.16",
|
22
|
+
"@yuants/tool-kit": "0.1.9",
|
23
|
+
"typescript": "~4.7.4",
|
24
|
+
"ts-node": "~10.9.2"
|
25
|
+
},
|
26
|
+
"publishConfig": {
|
27
|
+
"registry": "https://registry.npmjs.org",
|
28
|
+
"access": "public"
|
29
|
+
},
|
30
|
+
"io_ntnl": {
|
31
|
+
"deploy_files": [
|
32
|
+
"dist",
|
33
|
+
"lib",
|
34
|
+
"temp"
|
35
|
+
]
|
36
|
+
},
|
37
|
+
"scripts": {
|
38
|
+
"dev": "ts-node src/index.ts",
|
39
|
+
"build": "heft test --clean && api-extractor run --local && yuan-toolkit post-build"
|
40
|
+
}
|
41
|
+
}
|