itrm-tools 1.3.24 → 1.3.25
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/api/external/ExternalApiConnection.d.ts +6 -2
- package/dist/api/external/ExternalApiConnection.js +30 -4
- package/dist/api/external/ExternalApiConnection.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/api/external/cetus/CetusStrategyApiManager.d.ts +0 -29
- package/dist/api/external/cetus/CetusStrategyApiManager.js +0 -32
- package/dist/api/external/cetus/CetusStrategyApiManager.js.map +0 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { StandardKeyGroup } from "../../cryptography/generate/StandardApiKeyGenerator";
|
|
2
2
|
import { ApiSignValues } from "../../cryptography/sign/ApiKeySigner";
|
|
3
3
|
import { ApiResponse } from "../../types/api";
|
|
4
|
+
import { RequestMethod } from "../APIRequest";
|
|
4
5
|
export declare class ExternalApiConnection {
|
|
5
6
|
private signer;
|
|
6
|
-
private
|
|
7
|
+
private application;
|
|
8
|
+
private apiUrl;
|
|
7
9
|
private cipher;
|
|
8
10
|
private keys;
|
|
9
|
-
constructor(
|
|
11
|
+
constructor(application: string, apiUrl: string, keys: StandardKeyGroup);
|
|
10
12
|
sign(input: ApiSignValues): {
|
|
11
13
|
headers: {
|
|
12
14
|
Authorization: string;
|
|
@@ -14,4 +16,6 @@ export declare class ExternalApiConnection {
|
|
|
14
16
|
};
|
|
15
17
|
encryptBody(body: any): string;
|
|
16
18
|
decryptResponse(response: ApiResponse<string>): any;
|
|
19
|
+
request<T>(method: RequestMethod, path: string, body?: any): Promise<T>;
|
|
20
|
+
private executeRequest;
|
|
17
21
|
}
|
|
@@ -3,22 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ExternalApiConnection = void 0;
|
|
4
4
|
const AesCipheringAlgorithm_1 = require("../../cryptography/algorithm/AesCipheringAlgorithm");
|
|
5
5
|
const ApiKeySigner_1 = require("../../cryptography/sign/ApiKeySigner");
|
|
6
|
+
const APIRequest_1 = require("../APIRequest");
|
|
7
|
+
const RequestAxiosCall_1 = require("../request/RequestAxiosCall");
|
|
6
8
|
class ExternalApiConnection {
|
|
7
9
|
signer;
|
|
8
|
-
|
|
10
|
+
application;
|
|
11
|
+
apiUrl;
|
|
9
12
|
cipher;
|
|
10
13
|
keys;
|
|
11
|
-
constructor(
|
|
14
|
+
constructor(application, apiUrl, keys) {
|
|
15
|
+
this.application = application.toLowerCase();
|
|
12
16
|
this.cipher = new AesCipheringAlgorithm_1.AesCipheringAlgorithm();
|
|
13
17
|
this.signer = new ApiKeySigner_1.ApiKeySigner();
|
|
14
|
-
this.
|
|
18
|
+
this.apiUrl = apiUrl;
|
|
15
19
|
this.keys = keys;
|
|
16
20
|
}
|
|
17
21
|
sign(input) {
|
|
18
22
|
let signature = this.signer.sign(input, this.keys);
|
|
19
23
|
return {
|
|
20
24
|
headers: {
|
|
21
|
-
Authorization: `${this.
|
|
25
|
+
Authorization: `${this.application} ${signature}`
|
|
22
26
|
}
|
|
23
27
|
};
|
|
24
28
|
}
|
|
@@ -28,6 +32,28 @@ class ExternalApiConnection {
|
|
|
28
32
|
decryptResponse(response) {
|
|
29
33
|
return JSON.parse(this.cipher.decrypt(response.payload, this.keys.secretKey));
|
|
30
34
|
}
|
|
35
|
+
async request(method, path, body) {
|
|
36
|
+
if (body) {
|
|
37
|
+
let encryptedtBody = { payload: this.encryptBody(body) };
|
|
38
|
+
let headers = this.sign({ method: method, path: path, body: encryptedtBody });
|
|
39
|
+
return this.executeRequest(method, path, headers, encryptedtBody);
|
|
40
|
+
}
|
|
41
|
+
return this.executeRequest(method, path, this.sign({ method: method, path: path }));
|
|
42
|
+
}
|
|
43
|
+
async executeRequest(method, path, headers, encryptedtBody) {
|
|
44
|
+
switch (method) {
|
|
45
|
+
case APIRequest_1.RequestMethod.GET:
|
|
46
|
+
return (this.decryptResponse(await RequestAxiosCall_1.RequestAxiosCall.get(`${this.apiUrl}${path}`, headers)));
|
|
47
|
+
case APIRequest_1.RequestMethod.POST:
|
|
48
|
+
return (this.decryptResponse(await RequestAxiosCall_1.RequestAxiosCall.post(`${this.apiUrl}${path}`, encryptedtBody, headers)));
|
|
49
|
+
case APIRequest_1.RequestMethod.PUT:
|
|
50
|
+
return (this.decryptResponse(await RequestAxiosCall_1.RequestAxiosCall.put(`${this.apiUrl}${path}`, encryptedtBody, headers)));
|
|
51
|
+
case APIRequest_1.RequestMethod.DELETE:
|
|
52
|
+
return (this.decryptResponse(await RequestAxiosCall_1.RequestAxiosCall.delete(`${this.apiUrl}${path}`, headers)));
|
|
53
|
+
default:
|
|
54
|
+
throw new Error(`Unsupported method: ${method}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
31
57
|
}
|
|
32
58
|
exports.ExternalApiConnection = ExternalApiConnection;
|
|
33
59
|
//# sourceMappingURL=ExternalApiConnection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalApiConnection.js","sourceRoot":"","sources":["../../../src/api/external/ExternalApiConnection.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ExternalApiConnection.js","sourceRoot":"","sources":["../../../src/api/external/ExternalApiConnection.ts"],"names":[],"mappings":";;;AACA,8FAA2F;AAE3F,uEAAmF;AAEnF,8CAA8C;AAC9C,kEAA+D;AAE/D,MAAa,qBAAqB;IACtB,MAAM,CAAe;IACrB,WAAW,CAAS;IACpB,MAAM,CAAS;IACf,MAAM,CAAwB;IAC9B,IAAI,CAAmB;IAE/B,YAAY,WAAmB,EAAE,MAAc,EAAE,IAAsB;QACnE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,IAAI,6CAAqB,EAAE,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,IAAI,2BAAY,EAAE,CAAC;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AAC,CAAC;IAC3F,CAAC;IAEO,KAAK,CAAC,cAAc,CAAI,MAAqB,EAAE,IAAY,EAAE,OAA2B,EAAE,cAAoC;QAClI,QAAQ,MAAM,EAAE,CAAC;YACb,KAAK,0BAAa,CAAC,GAAG;gBAClB,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,mCAAgB,CAAC,GAAG,CAAsB,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAM,CAAC;YAC1H,KAAK,0BAAa,CAAC,IAAI;gBACnB,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,mCAAgB,CAAC,IAAI,CAAsB,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC,CAAM,CAAC;YAC3I,KAAK,0BAAa,CAAC,GAAG;gBAClB,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,mCAAgB,CAAC,GAAG,CAAsB,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC,CAAM,CAAC;YAC1I,KAAK,0BAAa,CAAC,MAAM;gBACrB,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,mCAAgB,CAAC,MAAM,CAAsB,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAM,CAAC;YAC7H;gBACI,MAAM,IAAI,KAAK,CAAC,uBAAuB,MAAM,EAAE,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;CACJ;AAvDD,sDAuDC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export { ExpressCookieParserConfiguration as ExpressCookieParserConfiguration }
|
|
|
12
12
|
export { ExpressStandardConfiguration as ExpressStandardConfiguration } from './api/express/ExpressStandardConfiguration';
|
|
13
13
|
export { ExpressFileUploadingConfiguration as ExpressFileUploadingConfiguration } from './api/express/ExpressFileUploadingConfiguration';
|
|
14
14
|
export { ExternalApiConnection as ExternalApiConnection } from './api/external/ExternalApiConnection';
|
|
15
|
-
export { CetusStrategyApiManager as CetusStrategyApiManager, CetusPair as CetusPair, CetusRate as CetusRate, CetusStrategy as CetusStrategy } from './api/external/cetus/CetusStrategyApiManager';
|
|
16
15
|
export { APIRequest as APIRequest, RequestMethod as RequestMethod, RequestContext as RequestContext, GroupedParameters as GroupedParameters, APIRequestConfig as APIRequestConfig, RequestParameterType as RequestParameterType } from './api/APIRequest';
|
|
17
16
|
export { APIRequestBuilder as APIRequestBuilder, DocDetails as DocDetails, ISamples as ISamples } from './api/APIRequestBuilder';
|
|
18
17
|
export { APIRouter as APIRouter } from './api/APIRouter';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ServiceSessionManager = exports.UserManager = exports.UserCredentialsManager = exports.TypeManager = exports.StatusManager = exports.RoleManager = exports.PlatformManager = exports.KeyManager = exports.ComponentManager = exports.AvailablePlatformManager = exports.ApplicationManager = exports.ActivityHistoryManager = exports.SimpleCheckableAPIRouter = exports.CorsCheckApiRouter = exports.CheckableAPIRouter = exports.CheckableFileUploadingPostRequest = exports.CheckablePutRequest = exports.CheckablePostRequest = exports.CheckableGetRequest = exports.CheckableDeleteRequest = exports.APIChecker = exports.CheckableAPIRequest = exports.DeleteRequest = exports.PutRequest = exports.PostRequest = exports.GetRequest = exports.RequestAxiosCall = exports.SimpleAPIRouter = exports.APIRouter = exports.APIRequestBuilder = exports.RequestParameterType = exports.RequestContext = exports.RequestMethod = exports.APIRequest = exports.
|
|
4
|
-
exports.PAYMENT_TYPES = exports.DOCUMENT_TYPES = exports.BANKS = exports.round = exports.CoingeckoPriceFinder = exports.Coin = exports.LoggerWebSocket = exports.LoggerManager = exports.Logger = exports.SequelizeModelManager = exports.SequelizeConnection = exports.MongooseModelManager = exports.JwtUtils = exports.PasswordUtils = exports.ApiKeySigner = exports.StandardApiKeyGenerator = exports.AesCipheringAlgorithm = exports.CrudServiceManager = exports.KindOfPersonManager = exports.IdentificationTypeManager = exports.CityManager =
|
|
3
|
+
exports.DepartmentManager = exports.CountryManager = exports.ServiceSessionManager = exports.UserManager = exports.UserCredentialsManager = exports.TypeManager = exports.StatusManager = exports.RoleManager = exports.PlatformManager = exports.KeyManager = exports.ComponentManager = exports.AvailablePlatformManager = exports.ApplicationManager = exports.ActivityHistoryManager = exports.SimpleCheckableAPIRouter = exports.CorsCheckApiRouter = exports.CheckableAPIRouter = exports.CheckableFileUploadingPostRequest = exports.CheckablePutRequest = exports.CheckablePostRequest = exports.CheckableGetRequest = exports.CheckableDeleteRequest = exports.APIChecker = exports.CheckableAPIRequest = exports.DeleteRequest = exports.PutRequest = exports.PostRequest = exports.GetRequest = exports.RequestAxiosCall = exports.SimpleAPIRouter = exports.APIRouter = exports.APIRequestBuilder = exports.RequestParameterType = exports.RequestContext = exports.RequestMethod = exports.APIRequest = exports.ExternalApiConnection = exports.ExpressFileUploadingConfiguration = exports.ExpressStandardConfiguration = exports.ExpressCookieParserConfiguration = exports.ExpressLogableConfig = exports.StandardGetRequestBuilder = exports.HttpsAPIService = exports.ITRMAPIServiceGlobal = exports.APIService = exports.HttpCode = exports.mapErrorCodeToHttpStatus = exports.ResponseUtils = exports.ApiServiceError = exports.AlegraConnectionManager = void 0;
|
|
4
|
+
exports.PAYMENT_TYPES = exports.DOCUMENT_TYPES = exports.BANKS = exports.round = exports.CoingeckoPriceFinder = exports.Coin = exports.LoggerWebSocket = exports.LoggerManager = exports.Logger = exports.SequelizeModelManager = exports.SequelizeConnection = exports.MongooseModelManager = exports.JwtUtils = exports.PasswordUtils = exports.ApiKeySigner = exports.StandardApiKeyGenerator = exports.AesCipheringAlgorithm = exports.CrudServiceManager = exports.KindOfPersonManager = exports.IdentificationTypeManager = exports.CityManager = void 0;
|
|
5
5
|
var AlegraConnectionManager_1 = require("./api/alegra/AlegraConnectionManager");
|
|
6
6
|
Object.defineProperty(exports, "AlegraConnectionManager", { enumerable: true, get: function () { return AlegraConnectionManager_1.AlegraConnectionManager; } });
|
|
7
7
|
var Response_1 = require("./api/utils/Response");
|
|
@@ -26,9 +26,6 @@ var ExpressFileUploadingConfiguration_1 = require("./api/express/ExpressFileUplo
|
|
|
26
26
|
Object.defineProperty(exports, "ExpressFileUploadingConfiguration", { enumerable: true, get: function () { return ExpressFileUploadingConfiguration_1.ExpressFileUploadingConfiguration; } });
|
|
27
27
|
var ExternalApiConnection_1 = require("./api/external/ExternalApiConnection");
|
|
28
28
|
Object.defineProperty(exports, "ExternalApiConnection", { enumerable: true, get: function () { return ExternalApiConnection_1.ExternalApiConnection; } });
|
|
29
|
-
var CetusStrategyApiManager_1 = require("./api/external/cetus/CetusStrategyApiManager");
|
|
30
|
-
Object.defineProperty(exports, "CetusStrategyApiManager", { enumerable: true, get: function () { return CetusStrategyApiManager_1.CetusStrategyApiManager; } });
|
|
31
|
-
Object.defineProperty(exports, "CetusPair", { enumerable: true, get: function () { return CetusStrategyApiManager_1.CetusPair; } });
|
|
32
29
|
var APIRequest_1 = require("./api/APIRequest");
|
|
33
30
|
Object.defineProperty(exports, "APIRequest", { enumerable: true, get: function () { return APIRequest_1.APIRequest; } });
|
|
34
31
|
Object.defineProperty(exports, "RequestMethod", { enumerable: true, get: function () { return APIRequest_1.RequestMethod; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAEA,gFAA0G;AAAjG,kIAAA,uBAAuB,OAA2B;AAG3D,iDAAsL;AAA7K,2GAAA,eAAe,OAAmB;AAAE,yGAAA,aAAa,OAAiB;AAAE,oHAAA,wBAAwB,OAA4B;AAAE,oGAAA,QAAQ,OAAY;AAGvJ,+CAA0L;AAA3I,wGAAA,UAAU,OAAc;AAA4C,k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AA,iBAAiB,OAAqB;AAC/C,qEAA2K;AAAlK,0GAAA,WAAW,OAAe;AACnC,iGAAyS;AAAhS,sIAAA,yBAAyB,OAA6B;AAC/D,qFAAmP;AAA1O,0HAAA,mBAAmB,OAAuB;AAGnD,4EAA6J;AAApJ,wHAAA,kBAAkB,OAAsB;AAGjD,wFAAgH;AAAvG,8HAAA,qBAAqB,OAAyB;AACvD,2FAA2J;AAA5G,kIAAA,uBAAuB,OAA2B;AACjG,iEAAgF;AAAvE,4GAAA,YAAY,OAAgB;AACrC,uEAAuF;AAA9E,8GAAA,aAAa,OAAiB;AACvC,wDAAiI;AAAxH,oGAAA,QAAQ,OAAY;AAE7B,iFAAwG;AAA/F,4HAAA,oBAAoB,OAAwB;AACrD,gFAAsG;AAA7F,0HAAA,mBAAmB,OAAuB;AACnD,oFAA4G;AAAnG,8HAAA,qBAAqB,OAAyB;AAEvD,uCAAgD;AAAvC,gGAAA,MAAM,OAAU;AACzB,qDAAqE;AAA5D,8GAAA,aAAa,OAAiB;AACvC,yDAA2E;AAAlE,kHAAA,eAAe,OAAmB;AAE3C,oCAA2C;AAAlC,4FAAA,IAAI,OAAQ;AACrB,8EAAqG;AAA5F,4HAAA,oBAAoB,OAAwB;AAErD,sCAA8C;AAArC,8FAAA,KAAK,OAAS;AAEvB,6CAAoH;AAA3G,iGAAA,KAAK,OAAS;AAAE,0GAAA,cAAc,OAAkB;AAAE,yGAAA,aAAa,OAAiB"}
|
package/package.json
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ExternalApiConnection } from "../ExternalApiConnection";
|
|
2
|
-
import { StandardKeyGroup } from "../../../cryptography/generate/StandardApiKeyGenerator";
|
|
3
|
-
export interface CetusRate {
|
|
4
|
-
symbol: string;
|
|
5
|
-
source: string;
|
|
6
|
-
bid?: number;
|
|
7
|
-
ask?: number;
|
|
8
|
-
spot?: number;
|
|
9
|
-
prevDayClose?: number;
|
|
10
|
-
}
|
|
11
|
-
export declare enum CetusPair {
|
|
12
|
-
USDCOP = "USDCOP"
|
|
13
|
-
}
|
|
14
|
-
export interface CetusStrategy {
|
|
15
|
-
id: number;
|
|
16
|
-
name: string;
|
|
17
|
-
settings: any;
|
|
18
|
-
memory: any;
|
|
19
|
-
account: string;
|
|
20
|
-
pair: string;
|
|
21
|
-
intermediary: string;
|
|
22
|
-
status: string;
|
|
23
|
-
}
|
|
24
|
-
export declare class CetusStrategyApiManager extends ExternalApiConnection {
|
|
25
|
-
private apiUrl;
|
|
26
|
-
constructor(keys: StandardKeyGroup, apiUrl: string);
|
|
27
|
-
getRates(): Promise<CetusRate[]>;
|
|
28
|
-
getStrategies(name: string, pair: CetusPair, account: string): Promise<CetusStrategy[]>;
|
|
29
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CetusStrategyApiManager = exports.CetusPair = void 0;
|
|
4
|
-
const ExternalApiConnection_1 = require("../ExternalApiConnection");
|
|
5
|
-
const APIRequest_1 = require("../../APIRequest");
|
|
6
|
-
const RequestAxiosCall_1 = require("../../request/RequestAxiosCall");
|
|
7
|
-
;
|
|
8
|
-
var CetusPair;
|
|
9
|
-
(function (CetusPair) {
|
|
10
|
-
CetusPair["USDCOP"] = "USDCOP";
|
|
11
|
-
})(CetusPair || (exports.CetusPair = CetusPair = {}));
|
|
12
|
-
class CetusStrategyApiManager extends ExternalApiConnection_1.ExternalApiConnection {
|
|
13
|
-
apiUrl;
|
|
14
|
-
constructor(keys, apiUrl) {
|
|
15
|
-
super('cetus', keys);
|
|
16
|
-
this.apiUrl = apiUrl;
|
|
17
|
-
}
|
|
18
|
-
async getRates() {
|
|
19
|
-
let signature = this.sign({ method: APIRequest_1.RequestMethod.GET, path: '/v1/rates' });
|
|
20
|
-
//let signature: AxiosRequestConfig = this.sign({ method: RequestMethod.POST, path: '/v1/rates', body: this.encryptBody({ message: "Ejemplo de body" }) });
|
|
21
|
-
let response = this.decryptResponse(await RequestAxiosCall_1.RequestAxiosCall.get(`${this.apiUrl}/v1/rates`, signature));
|
|
22
|
-
return response;
|
|
23
|
-
}
|
|
24
|
-
async getStrategies(name, pair, account) {
|
|
25
|
-
let url = `/v1/strategies?name=${name}&pair=${pair}&account=${account}`;
|
|
26
|
-
let signature = this.sign({ method: APIRequest_1.RequestMethod.GET, path: url });
|
|
27
|
-
let response = this.decryptResponse(await RequestAxiosCall_1.RequestAxiosCall.get(`${this.apiUrl}${url}`, signature));
|
|
28
|
-
return response;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.CetusStrategyApiManager = CetusStrategyApiManager;
|
|
32
|
-
//# sourceMappingURL=CetusStrategyApiManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CetusStrategyApiManager.js","sourceRoot":"","sources":["../../../../src/api/external/cetus/CetusStrategyApiManager.ts"],"names":[],"mappings":";;;AACA,oEAAiE;AACjE,iDAAiD;AACjD,qEAAkE;AAWjE,CAAC;AAEF,IAAY,SAEX;AAFD,WAAY,SAAS;IACjB,8BAAiB,CAAA;AACrB,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB;AAaD,MAAa,uBAAwB,SAAQ,6CAAqB;IACtD,MAAM,CAAS;IAEvB,YAAY,IAAsB,EAAE,MAAc;QAC9C,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,QAAQ;QACjB,IAAI,SAAS,GAAuB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,0BAAa,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;QAChG,2JAA2J;QAC3J,IAAI,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,mCAAgB,CAAC,GAAG,CAAsB,GAAG,IAAI,CAAC,MAAM,WAAW,EAAE,SAAS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