@geek-fun/serverlessinsight 0.4.0 → 0.4.1
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/package.json +1 -1
- package/dist/src/commands/index.js +48 -12
- package/dist/src/commands/template.js +3 -1
- package/dist/src/common/constants.js +2 -1
- package/dist/src/common/context.js +21 -13
- package/dist/src/common/credentials.js +15 -0
- package/dist/src/common/index.d.ts +1 -0
- package/dist/src/common/index.js +1 -0
- package/dist/src/common/logger.js +6 -0
- package/dist/src/common/rosClient.js +3 -0
- package/dist/src/stack/rosStack/bootstrap.js +1 -1
- package/dist/src/validator/iacSchema.js +17 -2
- package/dist/src/validator/rootSchema.js +46 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/layers/si-bootstrap-sdk/README.md +63 -0
- package/layers/si-bootstrap-sdk/package-lock.json +39 -33
- package/layers/si-bootstrap-sdk/package.json +5 -5
- package/layers/si-bootstrap-sdk/support/operation-collection/README.md +47 -0
- package/layers/si-bootstrap-sdk/support/operation-collection/package-lock.json +298 -0
- package/layers/si-bootstrap-sdk/support/operation-collection/package.json +18 -0
- package/layers/si-bootstrap-sdk/support/operation-collection/publish.js +257 -0
- package/package.json +1 -1
- package/samples/aliyun-poc-es.yml +16 -12
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Full life cycle cross providers serverless application management for your fast-growing business.",
|
|
5
5
|
"homepage": "https://serverlessinsight.geekfun.club",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -8,26 +8,62 @@ const deploy_1 = require("./deploy");
|
|
|
8
8
|
const template_1 = require("./template");
|
|
9
9
|
const destroy_1 = require("./destroy");
|
|
10
10
|
const local_1 = require("./local");
|
|
11
|
+
// Global error handler
|
|
12
|
+
const handleCommandError = (error, commandName) => {
|
|
13
|
+
// Log error message as string to preserve newlines
|
|
14
|
+
common_1.logger.error(`Command '${commandName}' failed with error:\n${error?.message || 'Unknown error occurred'}`);
|
|
15
|
+
if (error?.stack && process.env.DEBUG) {
|
|
16
|
+
common_1.logger.debug(`Stack trace:\n${error.stack}`);
|
|
17
|
+
}
|
|
18
|
+
let exitCode = 1;
|
|
19
|
+
if (error?.code) {
|
|
20
|
+
if (typeof error.code === 'number') {
|
|
21
|
+
exitCode = error.code;
|
|
22
|
+
}
|
|
23
|
+
else if (typeof error.code === 'string') {
|
|
24
|
+
const errorCodeMap = {
|
|
25
|
+
ENOENT: 2,
|
|
26
|
+
EACCES: 3,
|
|
27
|
+
VALIDATION: 4,
|
|
28
|
+
NETWORK: 5,
|
|
29
|
+
};
|
|
30
|
+
exitCode = errorCodeMap[error.code] || 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
process.exit(exitCode);
|
|
34
|
+
};
|
|
35
|
+
const actionWrapper = (commandName, handler) => {
|
|
36
|
+
// Reset context before each command execution
|
|
37
|
+
(0, common_1.clearContext)();
|
|
38
|
+
return async (...args) => {
|
|
39
|
+
try {
|
|
40
|
+
await handler(...args);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
handleCommandError(error, commandName);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
11
47
|
const program = new commander_1.Command();
|
|
12
48
|
program.name('si').description('CLI for ServerlessInsight').version((0, common_1.getVersion)());
|
|
13
49
|
program
|
|
14
50
|
.command('show')
|
|
15
51
|
.description('show string')
|
|
16
|
-
.action(async (options) => {
|
|
52
|
+
.action(actionWrapper('show', async (options) => {
|
|
17
53
|
await (0, common_1.setContext)({ ...options });
|
|
18
54
|
const context = (0, common_1.getContext)();
|
|
19
55
|
const result = await (0, common_1.getIamInfo)(context);
|
|
20
56
|
console.log('result:', JSON.stringify(result));
|
|
21
|
-
});
|
|
57
|
+
}));
|
|
22
58
|
program
|
|
23
59
|
.command('validate [stackName]')
|
|
24
60
|
.description('validate serverless Iac yaml')
|
|
25
61
|
.option('-f, --file <path>', 'specify the yaml file')
|
|
26
62
|
.option('-s, --stage <stage>', 'specify the stage')
|
|
27
|
-
.action(async (stackName, { file, stage }) => {
|
|
63
|
+
.action(actionWrapper('validate', async (stackName, { file, stage }) => {
|
|
28
64
|
common_1.logger.debug('log command info');
|
|
29
65
|
await (0, validate_1.validate)(stackName, { stage, location: file });
|
|
30
|
-
});
|
|
66
|
+
}));
|
|
31
67
|
program
|
|
32
68
|
.command('deploy <stackName>')
|
|
33
69
|
.description('deploy serverless Iac yaml')
|
|
@@ -43,7 +79,7 @@ program
|
|
|
43
79
|
previous[key] = val;
|
|
44
80
|
return previous;
|
|
45
81
|
}, {})
|
|
46
|
-
.action(async (stackName, { stage, parameter, file, region, provider, accessKeyId, accessKeySecret, securityToken }) => {
|
|
82
|
+
.action(actionWrapper('deploy', async (stackName, { stage, parameter, file, region, provider, accessKeyId, accessKeySecret, securityToken }) => {
|
|
47
83
|
await (0, deploy_1.deploy)(stackName, {
|
|
48
84
|
stage,
|
|
49
85
|
parameters: parameter,
|
|
@@ -54,16 +90,16 @@ program
|
|
|
54
90
|
accessKeySecret,
|
|
55
91
|
securityToken,
|
|
56
92
|
});
|
|
57
|
-
});
|
|
93
|
+
}));
|
|
58
94
|
program
|
|
59
95
|
.command('template <stackName>')
|
|
60
96
|
.description('print platform specific infrastructure as code template')
|
|
61
97
|
.option('-f, --file <path>', 'specify the yaml file')
|
|
62
98
|
.option('-s, --stage <stage>', 'specify the stage')
|
|
63
99
|
.option('-t, --format <type>', 'output content type (JSON or YAML)', 'JSON')
|
|
64
|
-
.action(async (stackName, { format, file, stage }) => {
|
|
100
|
+
.action(actionWrapper('template', async (stackName, { format, file, stage }) => {
|
|
65
101
|
await (0, template_1.template)(stackName, { format, location: file, stage });
|
|
66
|
-
});
|
|
102
|
+
}));
|
|
67
103
|
program
|
|
68
104
|
.command('destroy <stackName>')
|
|
69
105
|
.option('-f, --file <path>', 'specify the yaml file')
|
|
@@ -73,7 +109,7 @@ program
|
|
|
73
109
|
.option('-x, --accessKeySecret <accessKeySecret>', 'specify the AccessKeySecret')
|
|
74
110
|
.option('-n, --securityToken <securityToken>', 'specify the SecurityToken')
|
|
75
111
|
.description('destroy serverless stack')
|
|
76
|
-
.action(async (stackName, { file, region, provider, accessKeyId, accessKeySecret, securityToken }) => {
|
|
112
|
+
.action(actionWrapper('destroy', async (stackName, { file, region, provider, accessKeyId, accessKeySecret, securityToken }) => {
|
|
77
113
|
await (0, destroy_1.destroyStack)(stackName, {
|
|
78
114
|
location: file,
|
|
79
115
|
region,
|
|
@@ -82,7 +118,7 @@ program
|
|
|
82
118
|
accessKeySecret,
|
|
83
119
|
securityToken,
|
|
84
120
|
});
|
|
85
|
-
});
|
|
121
|
+
}));
|
|
86
122
|
program
|
|
87
123
|
.command('local <stackName>')
|
|
88
124
|
.description('run Serverless application locally for debugging')
|
|
@@ -91,7 +127,7 @@ program
|
|
|
91
127
|
.option('-p, --port <port>', 'specify the port', '3000')
|
|
92
128
|
.option('-d, --debug', 'enable debug mode')
|
|
93
129
|
.option('-w, --watch', 'enable file watch', true)
|
|
94
|
-
.action(async (stackName, { stage, port, debug, watch, file }) => {
|
|
130
|
+
.action(actionWrapper('local', async (stackName, { stage, port, debug, watch, file }) => {
|
|
95
131
|
await (0, local_1.runLocal)(stackName, {
|
|
96
132
|
stage,
|
|
97
133
|
port: Number(port) || 3000,
|
|
@@ -99,5 +135,5 @@ program
|
|
|
99
135
|
watch: typeof watch === 'boolean' ? watch : true,
|
|
100
136
|
location: file,
|
|
101
137
|
});
|
|
102
|
-
});
|
|
138
|
+
}));
|
|
103
139
|
program.parse();
|
|
@@ -11,7 +11,9 @@ const common_1 = require("../common");
|
|
|
11
11
|
const parser_1 = require("../parser");
|
|
12
12
|
const template = async (stackName, options) => {
|
|
13
13
|
const iac = (0, parser_1.parseYaml)((0, common_1.getIacLocation)(options.location));
|
|
14
|
-
|
|
14
|
+
const credentials = (0, common_1.getCredentials)();
|
|
15
|
+
const shouldFetchIamInfo = (0, common_1.hasCredentials)(credentials);
|
|
16
|
+
await (0, common_1.setContext)({ ...options, stackName, provider: iac.provider.name }, shouldFetchIamInfo);
|
|
15
17
|
const { template } = (0, deploy_1.generateStackTemplate)(stackName, iac);
|
|
16
18
|
if (typeof template === 'string') {
|
|
17
19
|
common_1.logger.info(`\n${template}`);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SI_LOCALSTACK_SERVER_PORT = exports.SI_BOOTSTRAP_BUCKET_PREFIX = exports.SI_BOOTSTRAP_FC_PREFIX = exports.OSS_DEPLOYMENT_TIMEOUT = exports.CODE_ZIP_SIZE_LIMIT = void 0;
|
|
3
|
+
exports.SI_LOCALSTACK_SERVER_PORT = exports.SI_BOOTSTRAP_BUCKET_PREFIX = exports.SI_BOOTSTRAP_FC_PREFIX = exports.ROS_STACK_OPERATION_TIMEOUT = exports.OSS_DEPLOYMENT_TIMEOUT = exports.CODE_ZIP_SIZE_LIMIT = void 0;
|
|
4
4
|
exports.CODE_ZIP_SIZE_LIMIT = 300 * 1000; // 300 KB ROS TemplateBody size limit 512 KB
|
|
5
5
|
exports.OSS_DEPLOYMENT_TIMEOUT = 3000; // in seconds
|
|
6
|
+
exports.ROS_STACK_OPERATION_TIMEOUT = 3600; // in seconds
|
|
6
7
|
exports.SI_BOOTSTRAP_FC_PREFIX = 'si-bootstrap-api';
|
|
7
8
|
exports.SI_BOOTSTRAP_BUCKET_PREFIX = 'si-bootstrap-artifacts';
|
|
8
9
|
exports.SI_LOCALSTACK_SERVER_PORT = 4567;
|
|
@@ -3,13 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getContext = exports.setContext = exports.getIacLocation = void 0;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
6
|
+
exports.clearContext = exports.getContext = exports.setContext = exports.getIacLocation = void 0;
|
|
8
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const credentials_1 = require("./credentials");
|
|
11
10
|
const imsClient_1 = require("./imsClient");
|
|
12
|
-
const
|
|
11
|
+
const providerEnum_1 = require("./providerEnum");
|
|
12
|
+
let context;
|
|
13
13
|
const DEFAULT_IAC_FILES = [
|
|
14
14
|
'serverlessinsight.yml',
|
|
15
15
|
'serverlessInsight.yml',
|
|
@@ -58,14 +58,19 @@ const setContext = async (config, reaValToken = false) => {
|
|
|
58
58
|
process.env.ROS_REGION_ID ??
|
|
59
59
|
process.env.ALIYUN_REGION ??
|
|
60
60
|
'cn-hangzhou';
|
|
61
|
-
const
|
|
61
|
+
const credentials = (0, credentials_1.getCredentials)({
|
|
62
|
+
accessKeyId: config.accessKeyId,
|
|
63
|
+
accessKeySecret: config.accessKeySecret,
|
|
64
|
+
securityToken: config.securityToken,
|
|
65
|
+
});
|
|
66
|
+
const newContext = {
|
|
62
67
|
stage: config.stage ?? 'default',
|
|
63
68
|
stackName: config.stackName ?? '',
|
|
64
69
|
provider: (config.provider ?? config.iacProvider?.name ?? providerEnum_1.ProviderEnum.ALIYUN),
|
|
65
70
|
region,
|
|
66
|
-
accessKeyId:
|
|
67
|
-
accessKeySecret:
|
|
68
|
-
securityToken:
|
|
71
|
+
accessKeyId: credentials.accessKeyId,
|
|
72
|
+
accessKeySecret: credentials.accessKeySecret,
|
|
73
|
+
securityToken: credentials.securityToken,
|
|
69
74
|
iacLocation: (0, exports.getIacLocation)(config.location),
|
|
70
75
|
parameters: Object.entries(config.parameters ?? {}).map(([key, value]) => ({ key, value })),
|
|
71
76
|
stages: Object.entries(config.stages ?? {}).reduce((acc, [stage, parameters]) => ({
|
|
@@ -74,17 +79,20 @@ const setContext = async (config, reaValToken = false) => {
|
|
|
74
79
|
}), {}),
|
|
75
80
|
};
|
|
76
81
|
if (reaValToken) {
|
|
77
|
-
const iamInfo = await (0, imsClient_1.getIamInfo)(
|
|
78
|
-
|
|
82
|
+
const iamInfo = await (0, imsClient_1.getIamInfo)(newContext);
|
|
83
|
+
newContext.accountId = iamInfo?.accountId;
|
|
79
84
|
}
|
|
80
|
-
|
|
85
|
+
context = newContext;
|
|
81
86
|
};
|
|
82
87
|
exports.setContext = setContext;
|
|
83
88
|
const getContext = () => {
|
|
84
|
-
const context = asyncLocalStorage.getStore();
|
|
85
89
|
if (!context) {
|
|
86
90
|
throw new Error('No context found');
|
|
87
91
|
}
|
|
88
92
|
return context;
|
|
89
93
|
};
|
|
90
94
|
exports.getContext = getContext;
|
|
95
|
+
const clearContext = () => {
|
|
96
|
+
context = undefined;
|
|
97
|
+
};
|
|
98
|
+
exports.clearContext = clearContext;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasCredentials = exports.getCredentials = void 0;
|
|
4
|
+
const getCredentials = (config) => {
|
|
5
|
+
return {
|
|
6
|
+
accessKeyId: config?.accessKeyId ?? process.env.ALIYUN_ACCESS_KEY_ID,
|
|
7
|
+
accessKeySecret: config?.accessKeySecret ?? process.env.ALIYUN_ACCESS_KEY_SECRET,
|
|
8
|
+
securityToken: config?.securityToken ?? process.env.ALIYUN_SECURITY_TOKEN,
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
exports.getCredentials = getCredentials;
|
|
12
|
+
const hasCredentials = (credentials) => {
|
|
13
|
+
return !!credentials.accessKeyId && !!credentials.accessKeySecret;
|
|
14
|
+
};
|
|
15
|
+
exports.hasCredentials = hasCredentials;
|
package/dist/src/common/index.js
CHANGED
|
@@ -10,6 +10,12 @@ const logger = (0, pino_1.default)({
|
|
|
10
10
|
level: ['ServerlessInsight', '*'].includes(process.env.DEBUG || '') ? 'debug' : 'info',
|
|
11
11
|
transport: {
|
|
12
12
|
target: 'pino-pretty',
|
|
13
|
+
options: {
|
|
14
|
+
colorize: true,
|
|
15
|
+
translateTime: 'HH:MM:ss',
|
|
16
|
+
ignore: 'pid,hostname',
|
|
17
|
+
messageFormat: '{msg}',
|
|
18
|
+
},
|
|
13
19
|
},
|
|
14
20
|
});
|
|
15
21
|
exports.logger = logger;
|
|
@@ -43,11 +43,14 @@ const tea_util_1 = __importDefault(require("@alicloud/tea-util"));
|
|
|
43
43
|
const logger_1 = require("./logger");
|
|
44
44
|
const lang_1 = require("../lang");
|
|
45
45
|
const context_1 = require("./context");
|
|
46
|
+
const constants_1 = require("./constants");
|
|
46
47
|
const client = new ros20190910_1.default(new openapi_client_1.Config({
|
|
47
48
|
accessKeyId: process.env.ALIYUN_ACCESS_KEY_ID,
|
|
48
49
|
accessKeySecret: process.env.ALIYUN_ACCESS_KEY_SECRET,
|
|
49
50
|
regionId: process.env.ALIYUN_REGION,
|
|
50
51
|
disableRollback: false,
|
|
52
|
+
readTimeout: constants_1.ROS_STACK_OPERATION_TIMEOUT,
|
|
53
|
+
connectTimeout: constants_1.ROS_STACK_OPERATION_TIMEOUT,
|
|
51
54
|
}));
|
|
52
55
|
const createStack = async (stackName, templateBody, context) => {
|
|
53
56
|
const parameters = context.parameters?.map((parameter) => new ros20190910_1.CreateStackRequestParameters({
|
|
@@ -33,7 +33,7 @@ const getBootstrapTemplate = async (context) => {
|
|
|
33
33
|
Description: 'ServerlessInsight Bootstrap API',
|
|
34
34
|
Handler: 'index.handler',
|
|
35
35
|
Runtime: 'nodejs20',
|
|
36
|
-
Layers: [`acs:fc:${context.region}:1990893136649406:layers/si-bootstrap-sdk/versions/
|
|
36
|
+
Layers: [`acs:fc:${context.region}:1990893136649406:layers/si-bootstrap-sdk/versions/26`],
|
|
37
37
|
Code: {
|
|
38
38
|
SourceCode: `
|
|
39
39
|
const { bootstrapHandler } = require('@geek-fun/si-bootstrap-sdk');
|
|
@@ -14,14 +14,29 @@ const bucketSchema_1 = require("./bucketSchema");
|
|
|
14
14
|
const tableschema_1 = require("./tableschema");
|
|
15
15
|
class IacSchemaErrors extends Error {
|
|
16
16
|
constructor(errors) {
|
|
17
|
-
|
|
18
|
-
this.schemaErrors = errors.map((error) => ({
|
|
17
|
+
const schemaErrors = errors.map((error) => ({
|
|
19
18
|
instancePath: error.instancePath,
|
|
20
19
|
schemaPath: error.schemaPath,
|
|
21
20
|
message: error.message,
|
|
22
21
|
allowedValues: error.params?.allowedValues,
|
|
23
22
|
type: error.keyword,
|
|
24
23
|
}));
|
|
24
|
+
const formattedMessage = schemaErrors
|
|
25
|
+
.map((error, index) => {
|
|
26
|
+
const parts = [
|
|
27
|
+
`Error ${index + 1}:`,
|
|
28
|
+
` Path: ${error.instancePath || '/'}`,
|
|
29
|
+
` Type: ${error.type}`,
|
|
30
|
+
` Message: ${error.message}`,
|
|
31
|
+
];
|
|
32
|
+
if (error.allowedValues) {
|
|
33
|
+
parts.push(` Allowed values: ${error.allowedValues.join(', ')}`);
|
|
34
|
+
}
|
|
35
|
+
return parts.join('\n');
|
|
36
|
+
})
|
|
37
|
+
.join('\n\n');
|
|
38
|
+
super(`Invalid yaml:\n\n${formattedMessage}`);
|
|
39
|
+
this.schemaErrors = schemaErrors;
|
|
25
40
|
}
|
|
26
41
|
get errors() {
|
|
27
42
|
return this.schemaErrors;
|
|
@@ -12,6 +12,52 @@ exports.rootSchema = {
|
|
|
12
12
|
name: { type: 'string', enum: ['huawei', 'aliyun'] },
|
|
13
13
|
region: { type: 'string' },
|
|
14
14
|
},
|
|
15
|
+
required: ['name', 'region'],
|
|
16
|
+
allOf: [
|
|
17
|
+
{
|
|
18
|
+
if: {
|
|
19
|
+
properties: {
|
|
20
|
+
name: { const: 'aliyun' },
|
|
21
|
+
},
|
|
22
|
+
required: ['name'],
|
|
23
|
+
},
|
|
24
|
+
then: {
|
|
25
|
+
properties: {
|
|
26
|
+
region: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
enum: [
|
|
29
|
+
'cn-qingdao',
|
|
30
|
+
'cn-beijing',
|
|
31
|
+
'cn-zhangjiakou',
|
|
32
|
+
'cn-huhehaote',
|
|
33
|
+
'cn-wulanchabu',
|
|
34
|
+
'cn-hangzhou',
|
|
35
|
+
'cn-shanghai',
|
|
36
|
+
'cn-shenzhen',
|
|
37
|
+
'cn-heyuan',
|
|
38
|
+
'cn-guangzhou',
|
|
39
|
+
'cn-chengdu',
|
|
40
|
+
'cn-hongkong',
|
|
41
|
+
'ap-southeast-1',
|
|
42
|
+
'ap-southeast-3',
|
|
43
|
+
'ap-southeast-5',
|
|
44
|
+
'ap-southeast-6',
|
|
45
|
+
'ap-southeast-7',
|
|
46
|
+
'ap-northeast-1',
|
|
47
|
+
'ap-northeast-2',
|
|
48
|
+
'eu-central-1',
|
|
49
|
+
'eu-west-1',
|
|
50
|
+
'us-east-1',
|
|
51
|
+
'us-west-1',
|
|
52
|
+
'na-south-1',
|
|
53
|
+
'me-east-1',
|
|
54
|
+
'me-central-1',
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
15
61
|
},
|
|
16
62
|
service: { type: 'string' },
|
|
17
63
|
vars: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/commands/deploy.ts","../src/commands/destroy.ts","../src/commands/index.ts","../src/commands/local.ts","../src/commands/template.ts","../src/commands/validate.ts","../src/common/base64.ts","../src/common/constants.ts","../src/common/context.ts","../src/common/getVersion.ts","../src/common/iacHelper.ts","../src/common/imsClient.ts","../src/common/index.ts","../src/common/logger.ts","../src/common/providerEnum.ts","../src/common/requestHelper.ts","../src/common/rosAssets.ts","../src/common/rosClient.ts","../src/lang/index.ts","../src/parser/bucketParser.ts","../src/parser/databaseParser.ts","../src/parser/eventParser.ts","../src/parser/functionParser.ts","../src/parser/index.ts","../src/parser/tableParser.ts","../src/parser/tagParser.ts","../src/stack/deploy.ts","../src/stack/index.ts","../src/stack/localStack/aliyunFc.ts","../src/stack/localStack/bucket.ts","../src/stack/localStack/event.ts","../src/stack/localStack/function.ts","../src/stack/localStack/functionRunner.ts","../src/stack/localStack/index.ts","../src/stack/localStack/localServer.ts","../src/stack/localStack/utils.ts","../src/stack/rfsStack/function.ts","../src/stack/rfsStack/index.ts","../src/stack/rosStack/bootstrap.ts","../src/stack/rosStack/bucket.ts","../src/stack/rosStack/database.ts","../src/stack/rosStack/event.ts","../src/stack/rosStack/function.ts","../src/stack/rosStack/index.ts","../src/stack/rosStack/stage.ts","../src/stack/rosStack/table.ts","../src/stack/rosStack/tag.ts","../src/stack/rosStack/vars.ts","../src/types/assets.ts","../src/types/index.ts","../src/types/domains/bucket.ts","../src/types/domains/context.ts","../src/types/domains/database.ts","../src/types/domains/event.ts","../src/types/domains/function.ts","../src/types/domains/provider.ts","../src/types/domains/table.ts","../src/types/domains/tag.ts","../src/types/domains/vars.ts","../src/types/localStack/index.ts","../src/validator/bucketSchema.ts","../src/validator/databaseSchema.ts","../src/validator/eventSchema.ts","../src/validator/functionSchema.ts","../src/validator/iacSchema.ts","../src/validator/index.ts","../src/validator/rootSchema.ts","../src/validator/tableschema.ts"],"version":"5.9.3"}
|
|
1
|
+
{"root":["../src/index.ts","../src/commands/deploy.ts","../src/commands/destroy.ts","../src/commands/index.ts","../src/commands/local.ts","../src/commands/template.ts","../src/commands/validate.ts","../src/common/base64.ts","../src/common/constants.ts","../src/common/context.ts","../src/common/credentials.ts","../src/common/getVersion.ts","../src/common/iacHelper.ts","../src/common/imsClient.ts","../src/common/index.ts","../src/common/logger.ts","../src/common/providerEnum.ts","../src/common/requestHelper.ts","../src/common/rosAssets.ts","../src/common/rosClient.ts","../src/lang/index.ts","../src/parser/bucketParser.ts","../src/parser/databaseParser.ts","../src/parser/eventParser.ts","../src/parser/functionParser.ts","../src/parser/index.ts","../src/parser/tableParser.ts","../src/parser/tagParser.ts","../src/stack/deploy.ts","../src/stack/index.ts","../src/stack/localStack/aliyunFc.ts","../src/stack/localStack/bucket.ts","../src/stack/localStack/event.ts","../src/stack/localStack/function.ts","../src/stack/localStack/functionRunner.ts","../src/stack/localStack/index.ts","../src/stack/localStack/localServer.ts","../src/stack/localStack/utils.ts","../src/stack/rfsStack/function.ts","../src/stack/rfsStack/index.ts","../src/stack/rosStack/bootstrap.ts","../src/stack/rosStack/bucket.ts","../src/stack/rosStack/database.ts","../src/stack/rosStack/event.ts","../src/stack/rosStack/function.ts","../src/stack/rosStack/index.ts","../src/stack/rosStack/stage.ts","../src/stack/rosStack/table.ts","../src/stack/rosStack/tag.ts","../src/stack/rosStack/vars.ts","../src/types/assets.ts","../src/types/index.ts","../src/types/domains/bucket.ts","../src/types/domains/context.ts","../src/types/domains/database.ts","../src/types/domains/event.ts","../src/types/domains/function.ts","../src/types/domains/provider.ts","../src/types/domains/table.ts","../src/types/domains/tag.ts","../src/types/domains/vars.ts","../src/types/localStack/index.ts","../src/validator/bucketSchema.ts","../src/validator/databaseSchema.ts","../src/validator/eventSchema.ts","../src/validator/functionSchema.ts","../src/validator/iacSchema.ts","../src/validator/index.ts","../src/validator/rootSchema.ts","../src/validator/tableschema.ts"],"version":"5.9.3"}
|
|
@@ -1 +1,64 @@
|
|
|
1
1
|
# ServerlessInsight bootstrap SDK
|
|
2
|
+
|
|
3
|
+
This is the bootstrap SDK for ServerlessInsight, packaged as an Aliyun Function Compute layer.
|
|
4
|
+
|
|
5
|
+
## Automated Publishing
|
|
6
|
+
|
|
7
|
+
The layer is automatically published to Aliyun Function Compute using GitHub Actions whenever changes are pushed to the `layers/si-bootstrap-sdk/` directory on the master branch.
|
|
8
|
+
|
|
9
|
+
### Supported Regions
|
|
10
|
+
|
|
11
|
+
The layer is published to the following Aliyun regions:
|
|
12
|
+
- `cn-beijing` (Beijing)
|
|
13
|
+
- `cn-hangzhou` (Hangzhou)
|
|
14
|
+
- `cn-chengdu` (Chengdu)
|
|
15
|
+
- `ap-southeast-1` (Singapore)
|
|
16
|
+
|
|
17
|
+
### Version Alignment
|
|
18
|
+
|
|
19
|
+
The automation ensures that all regions have the same layer version. If regions have different versions, the script will publish additional versions to align all regions to the latest version.
|
|
20
|
+
|
|
21
|
+
### Manual Trigger
|
|
22
|
+
|
|
23
|
+
You can manually trigger the publishing workflow from the GitHub Actions tab using the "workflow_dispatch" event.
|
|
24
|
+
|
|
25
|
+
### Prerequisites
|
|
26
|
+
|
|
27
|
+
The following secrets must be configured in the repository:
|
|
28
|
+
- `ALIYUN_ACCESS_KEY_ID`: Aliyun access key ID
|
|
29
|
+
- `ALIYUN_ACCESS_KEY_SECRET`: Aliyun access key secret
|
|
30
|
+
|
|
31
|
+
## Local Development
|
|
32
|
+
|
|
33
|
+
### Building the Layer
|
|
34
|
+
|
|
35
|
+
To build the layer locally:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cd layers/si-bootstrap-sdk
|
|
39
|
+
./scripts/package.sh
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This will create a packaged layer at `./artifacts/si-bootstrap-sdk.zip`.
|
|
43
|
+
|
|
44
|
+
### Publishing Manually
|
|
45
|
+
|
|
46
|
+
To publish the layer to all regions manually:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cd layers/si-bootstrap-sdk
|
|
50
|
+
export ALIYUN_ACCESS_KEY_ID="your-access-key-id"
|
|
51
|
+
export ALIYUN_ACCESS_KEY_SECRET="your-access-key-secret"
|
|
52
|
+
export ALIYUN_REGIONS="cn-beijing,cn-hangzhou,cn-chengdu,ap-southeast-1" # Optional, defaults shown
|
|
53
|
+
export ALIYUN_COMPATIBLE_RUNTIMES="nodejs20,nodejs18,nodejs16" # Optional, defaults shown
|
|
54
|
+
./scripts/publish-to-regions.sh
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
You can customize the target regions by setting the `ALIYUN_REGIONS` environment variable with a comma-separated list of region names.
|
|
58
|
+
|
|
59
|
+
You can customize the compatible runtimes by setting the `ALIYUN_COMPATIBLE_RUNTIMES` environment variable with a comma-separated list of runtime identifiers.
|
|
60
|
+
|
|
61
|
+
## Layer Information
|
|
62
|
+
|
|
63
|
+
- **Compatible Runtimes**: nodejs20, nodejs18, nodejs16
|
|
64
|
+
- **License**: Apache-2.0
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/si-bootstrap-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@geek-fun/si-bootstrap-sdk",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.2",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@alicloud/credentials": "^2.4.4",
|
|
13
13
|
"@alicloud/openapi-client": "^0.4.15",
|
|
14
14
|
"@alicloud/tablestore20201209": "^1.2.0",
|
|
15
|
-
"pino": "^
|
|
16
|
-
"pino-pretty": "^13.1.
|
|
17
|
-
"tablestore": "^5.6.
|
|
15
|
+
"pino": "^10.1.0",
|
|
16
|
+
"pino-pretty": "^13.1.3",
|
|
17
|
+
"tablestore": "^5.6.3"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/tablestore": "^5.1.3",
|
|
21
|
-
"typescript": "^5.9.
|
|
21
|
+
"typescript": "^5.9.3"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"node_modules/@alicloud/credentials": {
|
|
@@ -232,6 +232,12 @@
|
|
|
232
232
|
"xml2js": "^0.6.2"
|
|
233
233
|
}
|
|
234
234
|
},
|
|
235
|
+
"node_modules/@pinojs/redact": {
|
|
236
|
+
"version": "0.4.0",
|
|
237
|
+
"resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz",
|
|
238
|
+
"integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==",
|
|
239
|
+
"license": "MIT"
|
|
240
|
+
},
|
|
235
241
|
"node_modules/@protobufjs/aspromise": {
|
|
236
242
|
"version": "1.1.2",
|
|
237
243
|
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
|
|
@@ -410,20 +416,11 @@
|
|
|
410
416
|
}
|
|
411
417
|
},
|
|
412
418
|
"node_modules/fast-copy": {
|
|
413
|
-
"version": "
|
|
414
|
-
"resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-
|
|
415
|
-
"integrity": "sha512-
|
|
419
|
+
"version": "4.0.2",
|
|
420
|
+
"resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-4.0.2.tgz",
|
|
421
|
+
"integrity": "sha512-ybA6PDXIXOXivLJK/z9e+Otk7ve13I4ckBvGO5I2RRmBU1gMHLVDJYEuJYhGwez7YNlYji2M2DvVU+a9mSFDlw==",
|
|
416
422
|
"license": "MIT"
|
|
417
423
|
},
|
|
418
|
-
"node_modules/fast-redact": {
|
|
419
|
-
"version": "3.5.0",
|
|
420
|
-
"resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.5.0.tgz",
|
|
421
|
-
"integrity": "sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==",
|
|
422
|
-
"license": "MIT",
|
|
423
|
-
"engines": {
|
|
424
|
-
"node": ">=6"
|
|
425
|
-
}
|
|
426
|
-
},
|
|
427
424
|
"node_modules/fast-safe-stringify": {
|
|
428
425
|
"version": "2.1.1",
|
|
429
426
|
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
|
|
@@ -593,13 +590,13 @@
|
|
|
593
590
|
}
|
|
594
591
|
},
|
|
595
592
|
"node_modules/pino": {
|
|
596
|
-
"version": "
|
|
597
|
-
"resolved": "https://registry.npmjs.org/pino/-/pino-
|
|
598
|
-
"integrity": "sha512-
|
|
593
|
+
"version": "10.1.0",
|
|
594
|
+
"resolved": "https://registry.npmjs.org/pino/-/pino-10.1.0.tgz",
|
|
595
|
+
"integrity": "sha512-0zZC2ygfdqvqK8zJIr1e+wT1T/L+LF6qvqvbzEQ6tiMAoTqEVK9a1K3YRu8HEUvGEvNqZyPJTtb2sNIoTkB83w==",
|
|
599
596
|
"license": "MIT",
|
|
600
597
|
"dependencies": {
|
|
598
|
+
"@pinojs/redact": "^0.4.0",
|
|
601
599
|
"atomic-sleep": "^1.0.0",
|
|
602
|
-
"fast-redact": "^3.1.1",
|
|
603
600
|
"on-exit-leak-free": "^2.1.0",
|
|
604
601
|
"pino-abstract-transport": "^2.0.0",
|
|
605
602
|
"pino-std-serializers": "^7.0.0",
|
|
@@ -624,20 +621,20 @@
|
|
|
624
621
|
}
|
|
625
622
|
},
|
|
626
623
|
"node_modules/pino-pretty": {
|
|
627
|
-
"version": "13.1.
|
|
628
|
-
"resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-13.1.
|
|
629
|
-
"integrity": "sha512-
|
|
624
|
+
"version": "13.1.3",
|
|
625
|
+
"resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-13.1.3.tgz",
|
|
626
|
+
"integrity": "sha512-ttXRkkOz6WWC95KeY9+xxWL6AtImwbyMHrL1mSwqwW9u+vLp/WIElvHvCSDg0xO/Dzrggz1zv3rN5ovTRVowKg==",
|
|
630
627
|
"license": "MIT",
|
|
631
628
|
"dependencies": {
|
|
632
629
|
"colorette": "^2.0.7",
|
|
633
630
|
"dateformat": "^4.6.3",
|
|
634
|
-
"fast-copy": "^
|
|
631
|
+
"fast-copy": "^4.0.0",
|
|
635
632
|
"fast-safe-stringify": "^2.1.1",
|
|
636
633
|
"help-me": "^5.0.0",
|
|
637
634
|
"joycon": "^3.1.1",
|
|
638
635
|
"minimist": "^1.2.6",
|
|
639
636
|
"on-exit-leak-free": "^2.1.0",
|
|
640
|
-
"pino-abstract-transport": "^
|
|
637
|
+
"pino-abstract-transport": "^3.0.0",
|
|
641
638
|
"pump": "^3.0.0",
|
|
642
639
|
"secure-json-parse": "^4.0.0",
|
|
643
640
|
"sonic-boom": "^4.0.1",
|
|
@@ -647,6 +644,15 @@
|
|
|
647
644
|
"pino-pretty": "bin.js"
|
|
648
645
|
}
|
|
649
646
|
},
|
|
647
|
+
"node_modules/pino-pretty/node_modules/pino-abstract-transport": {
|
|
648
|
+
"version": "3.0.0",
|
|
649
|
+
"resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-3.0.0.tgz",
|
|
650
|
+
"integrity": "sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==",
|
|
651
|
+
"license": "MIT",
|
|
652
|
+
"dependencies": {
|
|
653
|
+
"split2": "^4.0.0"
|
|
654
|
+
}
|
|
655
|
+
},
|
|
650
656
|
"node_modules/pino-std-serializers": {
|
|
651
657
|
"version": "7.0.0",
|
|
652
658
|
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.0.0.tgz",
|
|
@@ -803,9 +809,9 @@
|
|
|
803
809
|
}
|
|
804
810
|
},
|
|
805
811
|
"node_modules/tablestore": {
|
|
806
|
-
"version": "5.6.
|
|
807
|
-
"resolved": "https://registry.npmjs.org/tablestore/-/tablestore-5.6.
|
|
808
|
-
"integrity": "sha512-
|
|
812
|
+
"version": "5.6.3",
|
|
813
|
+
"resolved": "https://registry.npmjs.org/tablestore/-/tablestore-5.6.3.tgz",
|
|
814
|
+
"integrity": "sha512-9DrBbp/Pxaiua9pfyoGAzw+Xl20ZZhMVyoKvGgobJY5lIA6IEz+1tZUmfrrCvztXzKhuf2VF6LQLARhL1aol2w==",
|
|
809
815
|
"license": "Apache-2.0",
|
|
810
816
|
"dependencies": {
|
|
811
817
|
"buffer": "4.9.1",
|
|
@@ -824,9 +830,9 @@
|
|
|
824
830
|
}
|
|
825
831
|
},
|
|
826
832
|
"node_modules/typescript": {
|
|
827
|
-
"version": "5.9.
|
|
828
|
-
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.
|
|
829
|
-
"integrity": "sha512-
|
|
833
|
+
"version": "5.9.3",
|
|
834
|
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
|
835
|
+
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
|
830
836
|
"dev": true,
|
|
831
837
|
"license": "Apache-2.0",
|
|
832
838
|
"bin": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/si-bootstrap-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"description": "Bootstrap SDK for Serverless Insight",
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/tablestore": "^5.1.3",
|
|
23
|
-
"typescript": "^5.9.
|
|
23
|
+
"typescript": "^5.9.3"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@alicloud/credentials": "^2.4.4",
|
|
27
27
|
"@alicloud/openapi-client": "^0.4.15",
|
|
28
28
|
"@alicloud/tablestore20201209": "^1.2.0",
|
|
29
|
-
"pino": "^
|
|
30
|
-
"pino-pretty": "^13.1.
|
|
31
|
-
"tablestore": "^5.6.
|
|
29
|
+
"pino": "^10.1.0",
|
|
30
|
+
"pino-pretty": "^13.1.3",
|
|
31
|
+
"tablestore": "^5.6.3"
|
|
32
32
|
}
|
|
33
33
|
}
|