@byted-apaas/integration-connector-sdk 1.0.4 → 1.0.5-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byted-apaas/integration-connector-sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.5-beta.2",
4
4
  "description": "Feishu iPaaS connector SDK for Node.js",
5
5
  "author": "heyan.yanis <heyan.yanis@bytedance.com>",
6
6
  "homepage": "",
@@ -19,7 +19,7 @@
19
19
  "lib"
20
20
  ],
21
21
  "dependencies": {
22
- "@byted-apaas/server-common-node": "^2.0.13"
22
+ "@byted-apaas/server-common-node": "^2.0.28-beta.3"
23
23
  },
24
24
  "scripts": {
25
25
  "compile": "rm -rf lib && tsc -d",
@@ -1,28 +0,0 @@
1
- export type InputDataConfig = Record<string, unknown>;
2
- export interface ConnectorActionResult {
3
- data: unknown;
4
- ok: boolean;
5
- message: string;
6
- suggestion?: {
7
- code: number;
8
- description: string;
9
- };
10
- }
11
- export declare class ActionCaller {
12
- /**
13
- * 调用指定的连接器操作。
14
- * @param connectorKey - 连接器的语义化标识。
15
- * @param version - 连接器的版本,语义化版本
16
- * @param actionKey - 要调用的操作的唯一标识
17
- * @param inputData - 连接器操作的输入数据
18
- * @param connectionAlias - 凭证别名
19
- * @returns 来自连接器操作 API 的响应。
20
- */
21
- callConnectorAction(params: {
22
- connectorKey: string;
23
- version: string;
24
- actionKey: string;
25
- inputData: InputDataConfig;
26
- connectionAlias: string;
27
- }): Promise<ConnectorActionResult>;
28
- }
@@ -1,39 +0,0 @@
1
- "use strict";
2
- // Copyright 2025 ByteDance Ltd. and/or its affiliates
3
- // SPDX-License-Identifier: MIT
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.ActionCaller = void 0;
6
- const common = require("@byted-apaas/server-common-node");
7
- const config_1 = require("@byted-apaas/server-common-node/http/config");
8
- class ActionCaller {
9
- /**
10
- * 调用指定的连接器操作。
11
- * @param connectorKey - 连接器的语义化标识。
12
- * @param version - 连接器的版本,语义化版本
13
- * @param actionKey - 要调用的操作的唯一标识
14
- * @param inputData - 连接器操作的输入数据
15
- * @param connectionAlias - 凭证别名
16
- * @returns 来自连接器操作 API 的响应。
17
- */
18
- async callConnectorAction(params) {
19
- const { connectorKey, version, actionKey, inputData, connectionAlias } = params;
20
- const urlPath = `/ae/oapi/v1/cloudfunction/connectors/${connectorKey}/versions/${version}/actions/${actionKey}/call`;
21
- const options = common.http.getOptions(null, new config_1.PostHttpConfig(urlPath, 'openapi_action_call', 65 * 1000));
22
- const currentUserID = common.utils.getUserIDFromCtx();
23
- if (!!currentUserID) {
24
- options.headers['User'] = `${currentUserID}`;
25
- }
26
- options.json = {
27
- inputData,
28
- apiAlias: connectionAlias,
29
- };
30
- const response = await common.http.openapi.doRequest(null, urlPath, options);
31
- return {
32
- data: response.data,
33
- ok: response.isSuccess,
34
- message: response.message,
35
- suggestion: response.suggestion,
36
- };
37
- }
38
- }
39
- exports.ActionCaller = ActionCaller;
package/lib/index.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import { InputDataConfig } from './actionCaller';
2
- type Caller = (params: {
3
- connector_version: string;
4
- operation: string;
5
- auth: string;
6
- input: InputDataConfig;
7
- }) => Promise<unknown>;
8
- declare global {
9
- var connector: Record<string, Caller>;
10
- }
11
- export declare function initGlobalConnector(): void;
12
- export {};
package/lib/index.js DELETED
@@ -1,36 +0,0 @@
1
- "use strict";
2
- // Copyright 2025 ByteDance Ltd. and/or its affiliates
3
- // SPDX-License-Identifier: MIT
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.initGlobalConnector = void 0;
6
- const actionCaller_1 = require("./actionCaller");
7
- function initGlobalConnector() {
8
- if (global.connector) {
9
- console.warn('global.connector is already initialized. Skipping re-initialization.');
10
- return;
11
- }
12
- const actionCaller = new actionCaller_1.ActionCaller();
13
- global.connector = new Proxy({}, {
14
- get(target, prop) {
15
- if (typeof prop === 'symbol') {
16
- return Reflect.get(target, prop);
17
- }
18
- return async (params) => {
19
- const { connector_version, operation, auth, input, ...restInputDataConfig } = params;
20
- const inputData = {
21
- ...restInputDataConfig,
22
- ...input,
23
- };
24
- return actionCaller.callConnectorAction({
25
- connectorKey: prop,
26
- version: connector_version,
27
- actionKey: operation,
28
- inputData,
29
- connectionAlias: auth,
30
- });
31
- };
32
- },
33
- });
34
- }
35
- exports.initGlobalConnector = initGlobalConnector;
36
- initGlobalConnector();