Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit e568d9a

Browse files
committed
add export function api
1 parent 0aa4360 commit e568d9a

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

lib/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const env_1 = require("./env");
1212
const function_1 = require("./function");
1313
const storage = __importStar(require("./storage"));
1414
const utils_1 = require("./utils");
15+
const code_update_1 = require("./commands/functions/code-update");
1516
module.exports = class CloudBase {
1617
constructor(secretId, secretKey) {
1718
this.login = auth_1.login;
@@ -36,14 +37,18 @@ module.exports = class CloudBase {
3637
delete: function_1.deleteFunction,
3738
detail: function_1.getFunctionDetail,
3839
log: function_1.getFunctionLog,
40+
code: {
41+
update: code_update_1.codeUpdate
42+
},
3943
config: {
4044
update: function_1.updateFunctionConfig
4145
},
4246
trigger: {
4347
create: function_1.createFunctionTriggers,
4448
delete: function_1.deleteFunctionTrigger
4549
},
46-
download: function_1.downloadFunctionCode
50+
download: function_1.downloadFunctionCode,
51+
copy: function_1.copyFunction
4752
};
4853
this.storage = storage;
4954
if (secretId && secretKey) {

src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ import {
2020
createFunctionTriggers,
2121
deleteFunctionTrigger,
2222
invokeFunction,
23-
downloadFunctionCode
23+
downloadFunctionCode,
24+
copyFunction
2425
} from './function'
2526
import * as storage from './storage'
2627
import { authStore } from './utils'
2728
import { ILoginOptions } from './types'
29+
import { codeUpdate } from './commands/functions/code-update'
2830

2931
export = class CloudBase {
3032
login: (
@@ -53,14 +55,18 @@ export = class CloudBase {
5355
delete: deleteFunction,
5456
detail: getFunctionDetail,
5557
log: getFunctionLog,
58+
code: {
59+
update: codeUpdate
60+
},
5661
config: {
5762
update: updateFunctionConfig
5863
},
5964
trigger: {
6065
create: createFunctionTriggers,
6166
delete: deleteFunctionTrigger
6267
},
63-
download: downloadFunctionCode
68+
download: downloadFunctionCode,
69+
copy: copyFunction
6470
}
6571

6672
storage = storage

types/index.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import './commands';
22
import { listEnvs, createEnv, getEnvAuthDomains, createEnvDomain, deleteEnvDomain, getLoginConfigList, createLoginConfig, updateLoginConfig } from './env';
3-
import { createFunction, listFunction, deleteFunction, getFunctionDetail, getFunctionLog, updateFunctionConfig, createFunctionTriggers, deleteFunctionTrigger, invokeFunction, downloadFunctionCode } from './function';
3+
import { createFunction, listFunction, deleteFunction, getFunctionDetail, getFunctionLog, updateFunctionConfig, createFunctionTriggers, deleteFunctionTrigger, invokeFunction, downloadFunctionCode, copyFunction } from './function';
44
import * as storage from './storage';
55
import { ILoginOptions } from './types';
6+
import { codeUpdate } from './commands/functions/code-update';
67
declare const _default: {
78
new (secretId: any, secretKey: any): {
89
login: (options: ILoginOptions) => Promise<{
@@ -30,6 +31,9 @@ declare const _default: {
3031
delete: typeof deleteFunction;
3132
detail: typeof getFunctionDetail;
3233
log: typeof getFunctionLog;
34+
code: {
35+
update: typeof codeUpdate;
36+
};
3337
config: {
3438
update: typeof updateFunctionConfig;
3539
};
@@ -38,6 +42,7 @@ declare const _default: {
3842
delete: typeof deleteFunctionTrigger;
3943
};
4044
download: typeof downloadFunctionCode;
45+
copy: typeof copyFunction;
4146
};
4247
storage: typeof storage;
4348
};

0 commit comments

Comments
 (0)