@luka-cat-mimi/n8n-nodes-feishu 0.5.11 → 0.6.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/README.md +30 -2
- package/dist/credentials/FeishuNodeCredentialsApi.credentials.js +56 -9
- package/dist/credentials/FeishuNodeCredentialsApi.credentials.js.map +1 -1
- package/dist/credentials/FeishuNodeOauth2Api.credentials.js +89 -9
- package/dist/credentials/FeishuNodeOauth2Api.credentials.js.map +1 -1
- package/dist/nodes/FeishuNode/FeishuNode.node.js +11 -0
- package/dist/nodes/FeishuNode/FeishuNode.node.js.map +1 -1
- package/dist/nodes/FeishuNode/FeishuNodeTrigger.node.d.ts +5 -0
- package/dist/nodes/FeishuNode/FeishuNodeTrigger.node.js +200 -0
- package/dist/nodes/FeishuNode/FeishuNodeTrigger.node.js.map +1 -0
- package/dist/nodes/FeishuNode/FeishuTrigger.node.json +19 -0
- package/dist/nodes/FeishuNode/RespondToFeishu.node.d.ts +5 -0
- package/dist/nodes/FeishuNode/RespondToFeishu.node.js +129 -0
- package/dist/nodes/FeishuNode/RespondToFeishu.node.js.map +1 -0
- package/dist/nodes/FeishuNode/resource/message/MessageEphemeralSendOperate.js +1 -1
- package/dist/nodes/FeishuNode/resource/message/MessageEphemeralSendOperate.js.map +1 -1
- package/dist/nodes/FeishuNode/resource/message/MessageEventDecryptOperate.js +2 -55
- package/dist/nodes/FeishuNode/resource/message/MessageEventDecryptOperate.js.map +1 -1
- package/dist/nodes/FeishuNode/resource/user/DepartmentListChildrenOperate.d.ts +3 -0
- package/dist/nodes/FeishuNode/resource/user/DepartmentListChildrenOperate.js +225 -0
- package/dist/nodes/FeishuNode/resource/user/DepartmentListChildrenOperate.js.map +1 -0
- package/dist/nodes/FeishuNode/resource/user/DepartmentUserListOperate.d.ts +3 -0
- package/dist/nodes/FeishuNode/resource/user/DepartmentUserListOperate.js +184 -0
- package/dist/nodes/FeishuNode/resource/user/DepartmentUserListOperate.js.map +1 -0
- package/dist/nodes/help/type/enums.d.ts +14 -0
- package/dist/nodes/help/type/enums.js +18 -0
- package/dist/nodes/help/type/enums.js.map +1 -1
- package/dist/nodes/help/utils/FeishuDecryptUtils.d.ts +1 -0
- package/dist/nodes/help/utils/FeishuDecryptUtils.js +61 -0
- package/dist/nodes/help/utils/FeishuDecryptUtils.js.map +1 -0
- package/dist/nodes/help/utils/FeishuResponseManager.d.ts +11 -0
- package/dist/nodes/help/utils/FeishuResponseManager.js +51 -0
- package/dist/nodes/help/utils/FeishuResponseManager.js.map +1 -0
- package/dist/nodes/help/utils/RequestUtils.js +3 -2
- package/dist/nodes/help/utils/RequestUtils.js.map +1 -1
- package/dist/nodes/help/utils/lark-sdk/consts.d.ts +4 -0
- package/dist/nodes/help/utils/lark-sdk/consts.js +8 -0
- package/dist/nodes/help/utils/lark-sdk/consts.js.map +1 -0
- package/dist/nodes/help/utils/lark-sdk/data-cache.d.ts +23 -0
- package/dist/nodes/help/utils/lark-sdk/data-cache.js +63 -0
- package/dist/nodes/help/utils/lark-sdk/data-cache.js.map +1 -0
- package/dist/nodes/help/utils/lark-sdk/enum.d.ts +37 -0
- package/dist/nodes/help/utils/lark-sdk/enum.js +47 -0
- package/dist/nodes/help/utils/lark-sdk/enum.js.map +1 -0
- package/dist/nodes/help/utils/lark-sdk/handler/cache.d.ts +16 -0
- package/dist/nodes/help/utils/lark-sdk/handler/cache.js +37 -0
- package/dist/nodes/help/utils/lark-sdk/handler/cache.js.map +1 -0
- package/dist/nodes/help/utils/lark-sdk/handler/event-handler.d.ts +26 -0
- package/dist/nodes/help/utils/lark-sdk/handler/event-handler.js +92 -0
- package/dist/nodes/help/utils/lark-sdk/handler/event-handler.js.map +1 -0
- package/dist/nodes/help/utils/lark-sdk/handler/events-template.d.ts +4 -0
- package/dist/nodes/help/utils/lark-sdk/handler/events-template.js +3 -0
- package/dist/nodes/help/utils/lark-sdk/handler/events-template.js.map +1 -0
- package/dist/nodes/help/utils/lark-sdk/handler/request-handle.d.ts +15 -0
- package/dist/nodes/help/utils/lark-sdk/handler/request-handle.js +77 -0
- package/dist/nodes/help/utils/lark-sdk/handler/request-handle.js.map +1 -0
- package/dist/nodes/help/utils/lark-sdk/interfaces.d.ts +8 -0
- package/dist/nodes/help/utils/lark-sdk/interfaces.js +3 -0
- package/dist/nodes/help/utils/lark-sdk/interfaces.js.map +1 -0
- package/dist/nodes/help/utils/lark-sdk/proto-buf/index.d.ts +3 -0
- package/dist/nodes/help/utils/lark-sdk/proto-buf/index.js +13 -0
- package/dist/nodes/help/utils/lark-sdk/proto-buf/index.js.map +1 -0
- package/dist/nodes/help/utils/lark-sdk/proto-buf/pbbp2.js +718 -0
- package/dist/nodes/help/utils/lark-sdk/utils/aes-cipher.d.ts +5 -0
- package/dist/nodes/help/utils/lark-sdk/utils/aes-cipher.js +23 -0
- package/dist/nodes/help/utils/lark-sdk/utils/aes-cipher.js.map +1 -0
- package/dist/nodes/help/utils/lark-sdk/ws-client/index.d.ts +43 -0
- package/dist/nodes/help/utils/lark-sdk/ws-client/index.js +364 -0
- package/dist/nodes/help/utils/lark-sdk/ws-client/index.js.map +1 -0
- package/dist/nodes/help/utils/lark-sdk/ws-client/ws-config.d.ts +33 -0
- package/dist/nodes/help/utils/lark-sdk/ws-client/ws-config.js +53 -0
- package/dist/nodes/help/utils/lark-sdk/ws-client/ws-config.js.map +1 -0
- package/dist/nodes/help/utils/outputs.d.ts +6 -0
- package/dist/nodes/help/utils/outputs.js +21 -0
- package/dist/nodes/help/utils/outputs.js.map +1 -0
- package/dist/nodes/help/utils/properties.d.ts +12 -0
- package/dist/nodes/help/utils/properties.js +156 -0
- package/dist/nodes/help/utils/properties.js.map +1 -0
- package/dist/package.json +10 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -3
|
@@ -0,0 +1,184 @@
|
|
|
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
|
+
const RequestUtils_1 = __importDefault(require("../../../help/utils/RequestUtils"));
|
|
7
|
+
const DepartmentUserListOperate = {
|
|
8
|
+
name: '获取部门直属用户列表',
|
|
9
|
+
value: 'department:userList',
|
|
10
|
+
options: [
|
|
11
|
+
{
|
|
12
|
+
displayName: '部门 ID',
|
|
13
|
+
name: 'department_id',
|
|
14
|
+
type: 'string',
|
|
15
|
+
required: true,
|
|
16
|
+
default: '0',
|
|
17
|
+
description: '部门 ID,ID 类型与 department_id_type 的取值保持一致。根部门的部门 ID 为 0。',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: '用户 ID 类型',
|
|
21
|
+
name: 'user_id_type',
|
|
22
|
+
type: 'options',
|
|
23
|
+
options: [
|
|
24
|
+
{ name: 'Open ID', value: 'open_id' },
|
|
25
|
+
{ name: 'Union ID', value: 'union_id' },
|
|
26
|
+
{ name: 'User ID', value: 'user_id' },
|
|
27
|
+
],
|
|
28
|
+
default: 'open_id',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
displayName: '部门 ID 类型',
|
|
32
|
+
name: 'department_id_type',
|
|
33
|
+
type: 'options',
|
|
34
|
+
options: [
|
|
35
|
+
{ name: 'Department ID', value: 'department_id' },
|
|
36
|
+
{ name: 'Open Department ID', value: 'open_department_id' },
|
|
37
|
+
],
|
|
38
|
+
default: 'open_department_id',
|
|
39
|
+
description: '此次调用中使用的部门 ID 类型',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
displayName: 'Return All',
|
|
43
|
+
name: 'returnAll',
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
default: false,
|
|
46
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
displayName: 'Limit',
|
|
50
|
+
name: 'limit',
|
|
51
|
+
type: 'number',
|
|
52
|
+
default: 50,
|
|
53
|
+
typeOptions: {
|
|
54
|
+
minValue: 1,
|
|
55
|
+
maxValue: 50,
|
|
56
|
+
},
|
|
57
|
+
displayOptions: {
|
|
58
|
+
show: {
|
|
59
|
+
returnAll: [false],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
description: 'Max number of results to return',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
displayName: '获取部门直属用户列表数据中可能存在重复用户数据,这是预期行为,因为有的用户存在多个部门。如需去重请在后续节点自行使用 Remove Duplicates 节点去重。',
|
|
66
|
+
name: 'duplicateNotice',
|
|
67
|
+
type: 'notice',
|
|
68
|
+
default: '',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
displayName: 'Options',
|
|
72
|
+
name: 'options',
|
|
73
|
+
type: 'collection',
|
|
74
|
+
placeholder: 'Add option',
|
|
75
|
+
default: {},
|
|
76
|
+
options: [
|
|
77
|
+
{
|
|
78
|
+
displayName: 'Batching',
|
|
79
|
+
name: 'batching',
|
|
80
|
+
placeholder: 'Add Batching',
|
|
81
|
+
type: 'fixedCollection',
|
|
82
|
+
typeOptions: {
|
|
83
|
+
multipleValues: false,
|
|
84
|
+
},
|
|
85
|
+
default: {
|
|
86
|
+
batch: {},
|
|
87
|
+
},
|
|
88
|
+
options: [
|
|
89
|
+
{
|
|
90
|
+
displayName: 'Batching',
|
|
91
|
+
name: 'batch',
|
|
92
|
+
values: [
|
|
93
|
+
{
|
|
94
|
+
displayName: 'Items per Batch',
|
|
95
|
+
name: 'batchSize',
|
|
96
|
+
type: 'number',
|
|
97
|
+
typeOptions: {
|
|
98
|
+
minValue: 1,
|
|
99
|
+
},
|
|
100
|
+
default: 50,
|
|
101
|
+
description: '每批并发请求数量。添加此选项后启用并发模式。0 将被视为 1。',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
displayName: 'Batch Interval (Ms)',
|
|
105
|
+
name: 'batchInterval',
|
|
106
|
+
type: 'number',
|
|
107
|
+
typeOptions: {
|
|
108
|
+
minValue: 0,
|
|
109
|
+
},
|
|
110
|
+
default: 1000,
|
|
111
|
+
description: '每批请求之间的时间(毫秒)。0 表示禁用。',
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
displayName: 'Timeout',
|
|
119
|
+
name: 'timeout',
|
|
120
|
+
type: 'number',
|
|
121
|
+
typeOptions: {
|
|
122
|
+
minValue: 0,
|
|
123
|
+
},
|
|
124
|
+
default: 0,
|
|
125
|
+
description: '等待服务器发送响应头(并开始响应体)的时间(毫秒),超过此时间将中止请求。0 表示不限制超时。',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
async call(index) {
|
|
131
|
+
const department_id = this.getNodeParameter('department_id', index);
|
|
132
|
+
const user_id_type = this.getNodeParameter('user_id_type', index, 'open_id');
|
|
133
|
+
const department_id_type = this.getNodeParameter('department_id_type', index, 'open_department_id');
|
|
134
|
+
const returnAll = this.getNodeParameter('returnAll', index, false);
|
|
135
|
+
const limit = this.getNodeParameter('limit', index, 50);
|
|
136
|
+
const options = this.getNodeParameter('options', index, {});
|
|
137
|
+
const fetchPage = async (pageToken, pageSize) => {
|
|
138
|
+
const qs = {
|
|
139
|
+
user_id_type,
|
|
140
|
+
department_id_type,
|
|
141
|
+
department_id,
|
|
142
|
+
page_size: pageSize,
|
|
143
|
+
};
|
|
144
|
+
if (pageToken) {
|
|
145
|
+
qs.page_token = pageToken;
|
|
146
|
+
}
|
|
147
|
+
const requestOptions = {
|
|
148
|
+
method: 'GET',
|
|
149
|
+
url: '/open-apis/contact/v3/users/find_by_department',
|
|
150
|
+
qs,
|
|
151
|
+
};
|
|
152
|
+
if (options.timeout) {
|
|
153
|
+
requestOptions.timeout = options.timeout;
|
|
154
|
+
}
|
|
155
|
+
const response = await RequestUtils_1.default.request.call(this, requestOptions);
|
|
156
|
+
const responseData = response;
|
|
157
|
+
return {
|
|
158
|
+
items: responseData.items || [],
|
|
159
|
+
pageToken: responseData.page_token,
|
|
160
|
+
hasMore: responseData.has_more || false,
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
if (returnAll) {
|
|
164
|
+
let allResults = [];
|
|
165
|
+
let pageToken = undefined;
|
|
166
|
+
const pageSize = 50;
|
|
167
|
+
while (true) {
|
|
168
|
+
const { items, pageToken: nextPageToken, hasMore } = await fetchPage(pageToken, pageSize);
|
|
169
|
+
allResults = allResults.concat(items);
|
|
170
|
+
if (!hasMore || !nextPageToken) {
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
pageToken = nextPageToken;
|
|
174
|
+
}
|
|
175
|
+
return allResults;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
const { items } = await fetchPage(undefined, limit);
|
|
179
|
+
return items;
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
exports.default = DepartmentUserListOperate;
|
|
184
|
+
//# sourceMappingURL=DepartmentUserListOperate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DepartmentUserListOperate.js","sourceRoot":"","sources":["../../../../../nodes/FeishuNode/resource/user/DepartmentUserListOperate.ts"],"names":[],"mappings":";;;;;AAMA,oFAA4D;AAG5D,MAAM,yBAAyB,GAAuB;IACrD,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,qBAAqB;IAC5B,OAAO,EAAE;QACR;YACC,WAAW,EAAE,OAAO;YACpB,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,GAAG;YACZ,WAAW,EAAE,wDAAwD;SACrE;QACD;YACC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE;gBACR,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;gBACr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C;gBAC1F,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAGtC,IAAI,CAAC,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;oBAChC,MAAM;gBACP,CAAC;gBAED,SAAS,GAAG,aAAa,CAAC;YAC3B,CAAC;YAED,OAAO,UAAU,CAAC;QACnB,CAAC;aAAM,CAAC;YAEP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YACpD,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;CACD,CAAC;AAEF,kBAAe,yBAAyB,CAAC"}
|
|
@@ -7,3 +7,17 @@ export declare const enum Credentials {
|
|
|
7
7
|
FeishuCredentialsApi = "feishuNodeCredentialsApi",
|
|
8
8
|
FeishuOauth2Api = "feishuNodeOauth2Api"
|
|
9
9
|
}
|
|
10
|
+
export declare enum TriggerEventType {
|
|
11
|
+
ReceiveMessage = "im.message.receive_v1"
|
|
12
|
+
}
|
|
13
|
+
export declare enum FileType {
|
|
14
|
+
Bitable = "bitable",
|
|
15
|
+
Docx = "docx",
|
|
16
|
+
Folder = "folder",
|
|
17
|
+
File = "file",
|
|
18
|
+
Slides = "slides"
|
|
19
|
+
}
|
|
20
|
+
export declare enum BaseUrl {
|
|
21
|
+
China = "https://open.feishu.cn",
|
|
22
|
+
Global = "https://open.larksuite.com"
|
|
23
|
+
}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseUrl = exports.FileType = exports.TriggerEventType = void 0;
|
|
4
|
+
var TriggerEventType;
|
|
5
|
+
(function (TriggerEventType) {
|
|
6
|
+
TriggerEventType["ReceiveMessage"] = "im.message.receive_v1";
|
|
7
|
+
})(TriggerEventType || (exports.TriggerEventType = TriggerEventType = {}));
|
|
8
|
+
var FileType;
|
|
9
|
+
(function (FileType) {
|
|
10
|
+
FileType["Bitable"] = "bitable";
|
|
11
|
+
FileType["Docx"] = "docx";
|
|
12
|
+
FileType["Folder"] = "folder";
|
|
13
|
+
FileType["File"] = "file";
|
|
14
|
+
FileType["Slides"] = "slides";
|
|
15
|
+
})(FileType || (exports.FileType = FileType = {}));
|
|
16
|
+
var BaseUrl;
|
|
17
|
+
(function (BaseUrl) {
|
|
18
|
+
BaseUrl["China"] = "https://open.feishu.cn";
|
|
19
|
+
BaseUrl["Global"] = "https://open.larksuite.com";
|
|
20
|
+
})(BaseUrl || (exports.BaseUrl = BaseUrl = {}));
|
|
3
21
|
//# sourceMappingURL=enums.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../../nodes/help/type/enums.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../../nodes/help/type/enums.ts"],"names":[],"mappings":";;;AAoBA,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC3B,4DAAwC,CAAA;AACzC,CAAC,EAFW,gBAAgB,gCAAhB,gBAAgB,QAE3B;AAKD,IAAY,QAMX;AAND,WAAY,QAAQ;IACnB,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB,yBAAa,CAAA;IACb,6BAAiB,CAAA;AAClB,CAAC,EANW,QAAQ,wBAAR,QAAQ,QAMnB;AAKD,IAAY,OAGX;AAHD,WAAY,OAAO;IAClB,2CAAgC,CAAA;IAChC,gDAAqC,CAAA;AACtC,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function decryptFeishuEvent(encryptKey: string, encryptData: string): string | null;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.decryptFeishuEvent = decryptFeishuEvent;
|
|
37
|
+
const crypto = __importStar(require("crypto"));
|
|
38
|
+
class AESCipher {
|
|
39
|
+
constructor(key) {
|
|
40
|
+
const hash = crypto.createHash('sha256');
|
|
41
|
+
hash.update(key);
|
|
42
|
+
this.key = hash.digest();
|
|
43
|
+
}
|
|
44
|
+
decrypt(encrypt) {
|
|
45
|
+
try {
|
|
46
|
+
const encryptBuffer = Buffer.from(encrypt, 'base64');
|
|
47
|
+
const decipher = crypto.createDecipheriv('aes-256-cbc', this.key, encryptBuffer.slice(0, 16));
|
|
48
|
+
let decrypted = decipher.update(encryptBuffer.slice(16).toString('hex'), 'hex', 'utf8');
|
|
49
|
+
decrypted += decipher.final('utf8');
|
|
50
|
+
return decrypted;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function decryptFeishuEvent(encryptKey, encryptData) {
|
|
58
|
+
const cipher = new AESCipher(encryptKey);
|
|
59
|
+
return cipher.decrypt(encryptData);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=FeishuDecryptUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeishuDecryptUtils.js","sourceRoot":"","sources":["../../../../nodes/help/utils/FeishuDecryptUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,gDAGC;AAjCD,+CAAiC;AAEjC,MAAM,SAAS;IAGd,YAAY,GAAW;QACtB,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;IAED,OAAO,CAAC,OAAe;QACtB,IAAI,CAAC;YACJ,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAC9F,IAAI,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACxF,SAAS,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACpC,OAAO,SAAS,CAAC;QAClB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;CACD;AAQD,SAAgB,kBAAkB,CAAC,UAAkB,EAAE,WAAmB;IACzE,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,UAAU,CAAC,CAAC;IACzC,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IDataObject } from 'n8n-workflow';
|
|
2
|
+
declare class FeishuResponseManager {
|
|
3
|
+
private pendingResponses;
|
|
4
|
+
waitForResponse(executionId: string, timeout?: number): Promise<IDataObject>;
|
|
5
|
+
sendResponse(executionId: string, response: IDataObject): boolean;
|
|
6
|
+
hasPendingResponse(executionId: string): boolean;
|
|
7
|
+
cancelResponse(executionId: string): void;
|
|
8
|
+
clearAll(): void;
|
|
9
|
+
}
|
|
10
|
+
export declare const feishuResponseManager: FeishuResponseManager;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.feishuResponseManager = void 0;
|
|
4
|
+
class FeishuResponseManager {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.pendingResponses = new Map();
|
|
7
|
+
}
|
|
8
|
+
waitForResponse(executionId, timeout = 30000) {
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const timeoutHandle = setTimeout(() => {
|
|
11
|
+
this.pendingResponses.delete(executionId);
|
|
12
|
+
reject(new Error(`Response timeout for execution: ${executionId}`));
|
|
13
|
+
}, timeout);
|
|
14
|
+
this.pendingResponses.set(executionId, {
|
|
15
|
+
resolve,
|
|
16
|
+
reject,
|
|
17
|
+
timeout: timeoutHandle,
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
sendResponse(executionId, response) {
|
|
22
|
+
const pending = this.pendingResponses.get(executionId);
|
|
23
|
+
if (pending) {
|
|
24
|
+
clearTimeout(pending.timeout);
|
|
25
|
+
pending.resolve(response);
|
|
26
|
+
this.pendingResponses.delete(executionId);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
hasPendingResponse(executionId) {
|
|
32
|
+
return this.pendingResponses.has(executionId);
|
|
33
|
+
}
|
|
34
|
+
cancelResponse(executionId) {
|
|
35
|
+
const pending = this.pendingResponses.get(executionId);
|
|
36
|
+
if (pending) {
|
|
37
|
+
clearTimeout(pending.timeout);
|
|
38
|
+
pending.reject(new Error('Response cancelled'));
|
|
39
|
+
this.pendingResponses.delete(executionId);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
clearAll() {
|
|
43
|
+
for (const [, pending] of this.pendingResponses) {
|
|
44
|
+
clearTimeout(pending.timeout);
|
|
45
|
+
pending.reject(new Error('All responses cleared'));
|
|
46
|
+
}
|
|
47
|
+
this.pendingResponses.clear();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.feishuResponseManager = new FeishuResponseManager();
|
|
51
|
+
//# sourceMappingURL=FeishuResponseManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeishuResponseManager.js","sourceRoot":"","sources":["../../../../nodes/help/utils/FeishuResponseManager.ts"],"names":[],"mappings":";;;AAYA,MAAM,qBAAqB;IAA3B;QACS,qBAAgB,GAAiC,IAAI,GAAG,EAAE,CAAC;IAwEpE,CAAC;IAhEA,eAAe,CAAC,WAAmB,EAAE,UAAkB,KAAK;QAC3D,O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CAAC,WAAW,CAAC,CAAC;QAC3C,CAAC;IACF,CAAC;IAKD,QAAQ;QACP,KAAK,MAAM,CAAC,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACjD,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC9B,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;CACD;AAGY,QAAA,qBAAqB,GAAG,IAAI,qBAAqB,EAAE,CAAC"}
|
|
@@ -6,7 +6,7 @@ class RequestUtils {
|
|
|
6
6
|
let additionalCredentialOptions = {};
|
|
7
7
|
if (authentication === "feishuNodeCredentialsApi") {
|
|
8
8
|
const credentials = await this.getCredentials(authentication);
|
|
9
|
-
options.baseURL =
|
|
9
|
+
options.baseURL = credentials.baseURL;
|
|
10
10
|
additionalCredentialOptions = {
|
|
11
11
|
credentialsDecrypted: {
|
|
12
12
|
data: {
|
|
@@ -17,7 +17,8 @@ class RequestUtils {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
else if (authentication === "feishuNodeOauth2Api") {
|
|
20
|
-
|
|
20
|
+
const credentials = await this.getCredentials(authentication);
|
|
21
|
+
options.baseURL = credentials.baseURL;
|
|
21
22
|
let oauth2 = {
|
|
22
23
|
keepBearer: true
|
|
23
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestUtils.js","sourceRoot":"","sources":["../../../../nodes/help/utils/RequestUtils.ts"],"names":[],"mappings":";;AAOA,MAAM,YAAY;IACjB,MAAM,CAAC,KAAK,CAAC,aAAa,CAEzB,OAAwB,EACxB,gBAAgB,GAAG,KAAK;QAExB,IAAI,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,CAAW,CAAC;QAE1E,IAAI,2BAA2B,GAAG,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EVENT = exports.CAppTicketHandle = exports.CAppTicket = exports.CEventType = void 0;
|
|
4
|
+
exports.CEventType = Symbol('event-type');
|
|
5
|
+
exports.CAppTicket = Symbol('app-ticket');
|
|
6
|
+
exports.CAppTicketHandle = 'app_ticket';
|
|
7
|
+
exports.ANY_EVENT = 'any_event';
|
|
8
|
+
//# sourceMappingURL=consts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../../../../nodes/help/utils/lark-sdk/consts.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAClC,QAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAClC,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAChC,QAAA,SAAS,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Logger } from 'n8n-workflow';
|
|
2
|
+
export declare class DataCache {
|
|
3
|
+
cache: Map<string, {
|
|
4
|
+
buffer: Uint8Array[];
|
|
5
|
+
trace_id: string;
|
|
6
|
+
message_id: string;
|
|
7
|
+
create_time: number;
|
|
8
|
+
}>;
|
|
9
|
+
logger?: Logger;
|
|
10
|
+
constructor(params: {
|
|
11
|
+
logger?: Logger;
|
|
12
|
+
});
|
|
13
|
+
mergeData(params: {
|
|
14
|
+
message_id: string;
|
|
15
|
+
sum: number;
|
|
16
|
+
seq: number;
|
|
17
|
+
trace_id: string;
|
|
18
|
+
data: Uint8Array;
|
|
19
|
+
}): any;
|
|
20
|
+
private deleteCache;
|
|
21
|
+
private clearAtInterval;
|
|
22
|
+
clear(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataCache = void 0;
|
|
4
|
+
class DataCache {
|
|
5
|
+
constructor(params) {
|
|
6
|
+
this.cache = new Map();
|
|
7
|
+
this.logger = params.logger;
|
|
8
|
+
this.clearAtInterval();
|
|
9
|
+
}
|
|
10
|
+
mergeData(params) {
|
|
11
|
+
const { message_id, sum, seq, trace_id, data } = params;
|
|
12
|
+
const cache = this.cache.get(message_id);
|
|
13
|
+
if (!cache) {
|
|
14
|
+
const buffer = new Array(sum).fill(undefined);
|
|
15
|
+
buffer[seq] = data;
|
|
16
|
+
this.cache.set(message_id, {
|
|
17
|
+
buffer,
|
|
18
|
+
trace_id,
|
|
19
|
+
message_id,
|
|
20
|
+
create_time: Date.now(),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
cache.buffer[seq] = data;
|
|
25
|
+
}
|
|
26
|
+
const mergedCache = this.cache.get(message_id);
|
|
27
|
+
if (mergedCache === null || mergedCache === void 0 ? void 0 : mergedCache.buffer.every((item) => !!item)) {
|
|
28
|
+
const mergedBuffer = mergedCache.buffer.reduce((acc, cur) => {
|
|
29
|
+
const combined = new Uint8Array(acc.byteLength + cur.byteLength);
|
|
30
|
+
combined.set(acc, 0);
|
|
31
|
+
combined.set(cur, acc.length);
|
|
32
|
+
return combined;
|
|
33
|
+
}, new Uint8Array([]));
|
|
34
|
+
const string = new TextDecoder('utf-8').decode(mergedBuffer);
|
|
35
|
+
const data = JSON.parse(string);
|
|
36
|
+
this.deleteCache(message_id);
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
deleteCache(message_id) {
|
|
42
|
+
this.cache.delete(message_id);
|
|
43
|
+
}
|
|
44
|
+
clearAtInterval() {
|
|
45
|
+
const clearIntervalMs = 10000;
|
|
46
|
+
setInterval(() => {
|
|
47
|
+
const now = Date.now();
|
|
48
|
+
this.cache.forEach((value, key) => {
|
|
49
|
+
var _a;
|
|
50
|
+
const { create_time, trace_id, message_id } = value;
|
|
51
|
+
if (now - create_time > clearIntervalMs) {
|
|
52
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.debug(`${message_id} event data is deleted as expired, trace_id: ${trace_id}`);
|
|
53
|
+
this.deleteCache(key);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}, clearIntervalMs);
|
|
57
|
+
}
|
|
58
|
+
clear() {
|
|
59
|
+
this.cache.clear();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.DataCache = DataCache;
|
|
63
|
+
//# sourceMappingURL=data-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-cache.js","sourceRoot":"","sources":["../../../../../nodes/help/utils/lark-sdk/data-cache.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IAarB,YAAY,MAA2B;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,eAAe,EAAE,CAAC;IACxB,CAAC;IAED,SAAS,CAAC,MAMT;QACA,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAExD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE;gBAC1B,MAAM;gBACN,QAAQ;gBACR,UAAU;gBACV,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE;aACvB,CAAC,CAAC;QACJ,CAAC;aAAM,CAAC;YACP,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;QAC1B,CAAC;QAED,M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AAM,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;gBACpD,IAAI,GAAG,GAAG,WAAW,GAAG,eAAe,EAAE,CAAC;oBACzC,MAAA,IAAI,CAAC,MAAM,0CAAE,KAAK,CACjB,GAAG,UAAU,gDAAgD,QAAQ,EAAE,CACvE,CAAC;oBACF,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;gBACvB,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC,EAAE,eAAe,CAAC,CAAC;IACrB,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACD;AAvFD,8BAuFC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare enum ErrorCode {
|
|
2
|
+
ok = 0,
|
|
3
|
+
system_busy = 1,
|
|
4
|
+
forbidden = 403,
|
|
5
|
+
auth_failed = 514,
|
|
6
|
+
internal_error = 1000040343,
|
|
7
|
+
exceed_conn_limit = 1000040350
|
|
8
|
+
}
|
|
9
|
+
export declare enum FrameType {
|
|
10
|
+
control = 0,
|
|
11
|
+
data = 1
|
|
12
|
+
}
|
|
13
|
+
export declare enum HeaderKey {
|
|
14
|
+
type = "type",
|
|
15
|
+
message_id = "message_id",
|
|
16
|
+
sum = "sum",
|
|
17
|
+
seq = "seq",
|
|
18
|
+
trace_id = "trace_id",
|
|
19
|
+
biz_rt = "biz_rt",
|
|
20
|
+
handshake_status = "handshake-status",
|
|
21
|
+
handshake_msg = "handshake-msg",
|
|
22
|
+
handshake_autherrcode = "handshake-autherrcode"
|
|
23
|
+
}
|
|
24
|
+
export declare enum MessageType {
|
|
25
|
+
event = "event",
|
|
26
|
+
card = "card",
|
|
27
|
+
ping = "ping",
|
|
28
|
+
pong = "pong"
|
|
29
|
+
}
|
|
30
|
+
export declare enum HttpStatusCode {
|
|
31
|
+
ok = 200,
|
|
32
|
+
internal_server_error = 500
|
|
33
|
+
}
|
|
34
|
+
export declare enum Domain {
|
|
35
|
+
Feishu = 0,
|
|
36
|
+
Lark = 1
|
|
37
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Domain = exports.HttpStatusCode = exports.MessageType = exports.HeaderKey = exports.FrameType = exports.ErrorCode = void 0;
|
|
4
|
+
var ErrorCode;
|
|
5
|
+
(function (ErrorCode) {
|
|
6
|
+
ErrorCode[ErrorCode["ok"] = 0] = "ok";
|
|
7
|
+
ErrorCode[ErrorCode["system_busy"] = 1] = "system_busy";
|
|
8
|
+
ErrorCode[ErrorCode["forbidden"] = 403] = "forbidden";
|
|
9
|
+
ErrorCode[ErrorCode["auth_failed"] = 514] = "auth_failed";
|
|
10
|
+
ErrorCode[ErrorCode["internal_error"] = 1000040343] = "internal_error";
|
|
11
|
+
ErrorCode[ErrorCode["exceed_conn_limit"] = 1000040350] = "exceed_conn_limit";
|
|
12
|
+
})(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
|
|
13
|
+
var FrameType;
|
|
14
|
+
(function (FrameType) {
|
|
15
|
+
FrameType[FrameType["control"] = 0] = "control";
|
|
16
|
+
FrameType[FrameType["data"] = 1] = "data";
|
|
17
|
+
})(FrameType || (exports.FrameType = FrameType = {}));
|
|
18
|
+
var HeaderKey;
|
|
19
|
+
(function (HeaderKey) {
|
|
20
|
+
HeaderKey["type"] = "type";
|
|
21
|
+
HeaderKey["message_id"] = "message_id";
|
|
22
|
+
HeaderKey["sum"] = "sum";
|
|
23
|
+
HeaderKey["seq"] = "seq";
|
|
24
|
+
HeaderKey["trace_id"] = "trace_id";
|
|
25
|
+
HeaderKey["biz_rt"] = "biz_rt";
|
|
26
|
+
HeaderKey["handshake_status"] = "handshake-status";
|
|
27
|
+
HeaderKey["handshake_msg"] = "handshake-msg";
|
|
28
|
+
HeaderKey["handshake_autherrcode"] = "handshake-autherrcode";
|
|
29
|
+
})(HeaderKey || (exports.HeaderKey = HeaderKey = {}));
|
|
30
|
+
var MessageType;
|
|
31
|
+
(function (MessageType) {
|
|
32
|
+
MessageType["event"] = "event";
|
|
33
|
+
MessageType["card"] = "card";
|
|
34
|
+
MessageType["ping"] = "ping";
|
|
35
|
+
MessageType["pong"] = "pong";
|
|
36
|
+
})(MessageType || (exports.MessageType = MessageType = {}));
|
|
37
|
+
var HttpStatusCode;
|
|
38
|
+
(function (HttpStatusCode) {
|
|
39
|
+
HttpStatusCode[HttpStatusCode["ok"] = 200] = "ok";
|
|
40
|
+
HttpStatusCode[HttpStatusCode["internal_server_error"] = 500] = "internal_server_error";
|
|
41
|
+
})(HttpStatusCode || (exports.HttpStatusCode = HttpStatusCode = {}));
|
|
42
|
+
var Domain;
|
|
43
|
+
(function (Domain) {
|
|
44
|
+
Domain[Domain["Feishu"] = 0] = "Feishu";
|
|
45
|
+
Domain[Domain["Lark"] = 1] = "Lark";
|
|
46
|
+
})(Domain || (exports.Domain = Domain = {}));
|
|
47
|
+
//# sourceMappingURL=enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../../../nodes/help/utils/lark-sdk/enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAOX;AAPD,WAAY,SAAS;IACpB,qCAAM,CAAA;IACN,uDAAe,CAAA;IACf,qDAAe,CAAA;IACf,yDAAiB,CAAA;IACjB,sEAA2B,CAAA;IAC3B,4EAA8B,CAAA;AAC/B,CAAC,EAPW,SAAS,yBAAT,SAAS,QAOpB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACpB,+CAAW,CAAA;IACX,yCAAQ,CAAA;AACT,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,SAUX;AAVD,WAAY,SAAS;IACpB,0BAAa,CAAA;IACb,sCAAyB,CAAA;IACzB,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;IACjB,kDAAqC,CAAA;IACrC,4CAA+B,CAAA;IAC/B,4DAA+C,CAAA;AAChD,CAAC,EAVW,SAAS,yBAAT,SAAS,QAUpB;AAED,IAAY,WAKX;AALD,WAAY,WAAW;IACtB,8BAAe,CAAA;IACf,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,4BAAa,CAAA;AACd,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAED,IAAY,cAKX;AALD,WAAY,cAAc;IAEzB,iDAAQ,CAAA;IAER,uFAA2B,CAAA;AAC5B,CAAC,EALW,cAAc,8BAAd,cAAc,QAKzB;AAED,IAAY,MAGX;AAHD,WAAY,MAAM;IACjB,uCAAM,CAAA;IACN,mCAAI,CAAA;AACL,CAAC,EAHW,MAAM,sBAAN,MAAM,QAGjB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Cache } from '../interfaces';
|
|
2
|
+
export declare class DefaultCache implements Cache {
|
|
3
|
+
values: Map<string | symbol, {
|
|
4
|
+
value: any;
|
|
5
|
+
expiredTime?: number;
|
|
6
|
+
}>;
|
|
7
|
+
constructor();
|
|
8
|
+
private getCacheKey;
|
|
9
|
+
get(key: string | symbol, options?: {
|
|
10
|
+
namespace?: string;
|
|
11
|
+
}): Promise<any>;
|
|
12
|
+
set(key: string | symbol, value: string, expiredTime?: number, options?: {
|
|
13
|
+
namespace?: string;
|
|
14
|
+
}): Promise<boolean>;
|
|
15
|
+
}
|
|
16
|
+
export declare const internalCache: DefaultCache;
|