@sonarwatch/portfolio-plugins 0.11.193 → 0.11.195
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +9 -1
- package/package.json +2 -2
- package/src/AirdropFetcher.d.ts +11 -0
- package/src/AirdropFetcher.js +92 -0
- package/src/AirdropFetcher.js.map +1 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +10 -1
- package/src/index.js.map +1 -1
- package/src/plugins/drift/airdropFetcher.js +7 -21
- package/src/plugins/drift/airdropFetcher.js.map +1 -1
- package/src/plugins/drift/constants.d.ts +4 -0
- package/src/plugins/drift/constants.js +8 -4
- package/src/plugins/drift/constants.js.map +1 -1
- package/src/plugins/drift/helpersAirdrop.d.ts +3 -0
- package/src/plugins/drift/helpersAirdrop.js +59 -0
- package/src/plugins/drift/helpersAirdrop.js.map +1 -0
- package/src/plugins/drift/index.d.ts +1 -0
- package/src/plugins/drift/index.js +3 -1
- package/src/plugins/drift/index.js.map +1 -1
- package/src/plugins/kriya/constants.d.ts +13 -0
- package/src/plugins/kriya/constants.js +30 -0
- package/src/plugins/kriya/constants.js.map +1 -0
- package/src/plugins/kriya/farmsFetcher.d.ts +3 -0
- package/src/plugins/kriya/farmsFetcher.js +104 -0
- package/src/plugins/kriya/farmsFetcher.js.map +1 -0
- package/src/plugins/kriya/farmsJob.d.ts +3 -0
- package/src/plugins/kriya/farmsJob.js +47 -0
- package/src/plugins/kriya/farmsJob.js.map +1 -0
- package/src/plugins/kriya/index.d.ts +6 -0
- package/src/plugins/kriya/index.js +15 -0
- package/src/plugins/kriya/index.js.map +1 -0
- package/src/plugins/kriya/types.d.ts +155 -0
- package/src/plugins/kriya/types.js +16 -0
- package/src/plugins/kriya/types.js.map +1 -0
- package/src/plugins/kriya/vaultsFetcher.d.ts +3 -0
- package/src/plugins/kriya/vaultsFetcher.js +94 -0
- package/src/plugins/kriya/vaultsFetcher.js.map +1 -0
- package/src/plugins/kriya/vaultsJob.d.ts +3 -0
- package/src/plugins/kriya/vaultsJob.js +57 -0
- package/src/plugins/kriya/vaultsJob.js.map +1 -0
- package/src/plugins/parcl/airdropFetcher.js +7 -45
- package/src/plugins/parcl/airdropFetcher.js.map +1 -1
- package/src/plugins/parcl/constants.d.ts +3 -0
- package/src/plugins/parcl/constants.js +7 -4
- package/src/plugins/parcl/constants.js.map +1 -1
- package/src/plugins/parcl/helpersAirdrop.d.ts +19 -0
- package/src/plugins/parcl/helpersAirdrop.js +99 -0
- package/src/plugins/parcl/helpersAirdrop.js.map +1 -0
- package/src/plugins/parcl/index.d.ts +1 -0
- package/src/plugins/parcl/index.js +3 -1
- package/src/plugins/parcl/index.js.map +1 -1
- package/src/plugins/parcl/types.d.ts +6 -1
- package/src/plugins/sandglass/marketsJob.js +3 -2
- package/src/plugins/sandglass/marketsJob.js.map +1 -1
- package/src/utils/sui/mulitpleGetBalances.d.ts +3 -0
- package/src/utils/sui/mulitpleGetBalances.js +19 -0
- package/src/utils/sui/mulitpleGetBalances.js.map +1 -0
- package/src/utils/sui/multipleGetDynamicFieldsObjects.d.ts +4 -0
- package/src/utils/sui/multipleGetDynamicFieldsObjects.js +25 -0
- package/src/utils/sui/multipleGetDynamicFieldsObjects.js.map +1 -0
@@ -0,0 +1,99 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.airdropFetcher = exports.fetchAirdrop = exports.airdropStatics = exports.fetchAllocation = void 0;
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
17
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
18
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
19
|
+
const constants_1 = require("./constants");
|
20
|
+
const helpers_1 = require("../jupiter/helpers");
|
21
|
+
const getParsedAccountInfo_1 = require("../../utils/solana/getParsedAccountInfo");
|
22
|
+
const structs_1 = require("../jupiter/launchpad/structs");
|
23
|
+
const clients_1 = require("../../utils/clients");
|
24
|
+
function fetchAllocation(owner, cache) {
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
26
|
+
const cachedAllocation = yield cache.getItem(owner, {
|
27
|
+
prefix: constants_1.allocationPrefix,
|
28
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
29
|
+
});
|
30
|
+
if (cachedAllocation)
|
31
|
+
return cachedAllocation;
|
32
|
+
let allocation;
|
33
|
+
const apiResponse = yield axios_1.default.get(constants_1.airdropApi + owner, {
|
34
|
+
headers: {
|
35
|
+
origin: 'https://app.parcl.co',
|
36
|
+
referer: 'https://app.parcl.co',
|
37
|
+
},
|
38
|
+
validateStatus(status) {
|
39
|
+
return status === 200 || status === 404;
|
40
|
+
},
|
41
|
+
});
|
42
|
+
if (apiResponse.data.error ||
|
43
|
+
!apiResponse.data.amount ||
|
44
|
+
!apiResponse.data.merkle_tree) {
|
45
|
+
allocation = {
|
46
|
+
amount: 0,
|
47
|
+
};
|
48
|
+
}
|
49
|
+
else {
|
50
|
+
const amount = new bignumber_js_1.default(apiResponse.data.amount)
|
51
|
+
.dividedBy(Math.pow(10, constants_1.prclDecimals))
|
52
|
+
.toNumber();
|
53
|
+
allocation = {
|
54
|
+
amount,
|
55
|
+
merkleTree: apiResponse.data.merkle_tree,
|
56
|
+
};
|
57
|
+
}
|
58
|
+
yield cache.setItem(owner, allocation, {
|
59
|
+
prefix: constants_1.allocationPrefix,
|
60
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
61
|
+
ttl: 86400000, // 24h
|
62
|
+
});
|
63
|
+
return allocation;
|
64
|
+
});
|
65
|
+
}
|
66
|
+
exports.fetchAllocation = fetchAllocation;
|
67
|
+
exports.airdropStatics = {
|
68
|
+
id: 'parcl-airdrop-1',
|
69
|
+
claimLink: 'https://claims.parcllimited.com/',
|
70
|
+
image: constants_1.platformImage,
|
71
|
+
label: 'PRCL',
|
72
|
+
organizerLink: constants_1.platformWebsite,
|
73
|
+
organizerName: constants_1.platformName,
|
74
|
+
claimStart: 0,
|
75
|
+
claimEnd: 1735603200000,
|
76
|
+
name: undefined,
|
77
|
+
};
|
78
|
+
function fetchAirdrop(owner, client, cache) {
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
80
|
+
const prclTokenPrice = yield cache.getTokenPrice(constants_1.prclMint, portfolio_core_1.NetworkId.solana);
|
81
|
+
const allocation = yield fetchAllocation(owner, cache);
|
82
|
+
if (allocation.amount === 0 || !allocation.merkleTree)
|
83
|
+
return Object.assign(Object.assign(Object.assign({}, exports.airdropStatics), (0, portfolio_core_1.getAirdropStatus)(exports.airdropStatics.claimStart, exports.airdropStatics.claimEnd)), { price: (prclTokenPrice === null || prclTokenPrice === void 0 ? void 0 : prclTokenPrice.price) || null });
|
84
|
+
const claimStatusPubkey = (0, helpers_1.deriveClaimStatus)(owner, allocation.merkleTree, constants_1.distributorProgram);
|
85
|
+
const claimStatusAccounts = yield (0, getParsedAccountInfo_1.getParsedAccountInfo)(client, structs_1.claimStatusStruct, claimStatusPubkey);
|
86
|
+
const isClaimed = claimStatusAccounts !== null;
|
87
|
+
return Object.assign(Object.assign(Object.assign({}, exports.airdropStatics), (0, portfolio_core_1.getAirdropStatus)(exports.airdropStatics.claimStart, exports.airdropStatics.claimEnd, allocation.amount, isClaimed)), { amount: allocation.amount, price: (prclTokenPrice === null || prclTokenPrice === void 0 ? void 0 : prclTokenPrice.price) || null });
|
88
|
+
});
|
89
|
+
}
|
90
|
+
exports.fetchAirdrop = fetchAirdrop;
|
91
|
+
exports.airdropFetcher = {
|
92
|
+
id: exports.airdropStatics.id,
|
93
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
94
|
+
executor: (owner, cache) => {
|
95
|
+
const client = (0, clients_1.getClientSolana)();
|
96
|
+
return fetchAirdrop(owner, client, cache);
|
97
|
+
},
|
98
|
+
};
|
99
|
+
//# sourceMappingURL=helpersAirdrop.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helpersAirdrop.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/helpersAirdrop.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA6C;AAC7C,gEAAqC;AACrC,+DAIoC;AACpC,2CASqB;AAGrB,gDAAuD;AACvD,kFAA+E;AAE/E,0DAAiE;AAEjE,iDAAsD;AAEtD,SAAsB,eAAe,CACnC,KAAa,EACb,KAAY;;QAEZ,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,OAAO,CAAa,KAAK,EAAE;YAC9D,MAAM,EAAE,4BAAgB;YACxB,SAAS,EAAE,0BAAS,CAAC,MAAM;SAC5B,CAAC,CAAC;QACH,IAAI,gBAAgB;YAAE,OAAO,gBAAgB,CAAC;QAE9C,IAAI,UAAsB,CAAC;QAC3B,MAAM,WAAW,GAAG,MAAM,eAAK,CAAC,GAAG,CAGjC,sBAAU,GAAG,KAAK,EAAE;YACpB,OAAO,EAAE;gBACP,MAAM,EAAE,sBAAsB;gBAC9B,OAAO,EAAE,sBAAsB;aAChC;YACD,cAAc,CAAC,MAAM;gBACnB,OAAO,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,CAAC;YAC1C,CAAC;SACF,CAAC,CAAC;QAEH,IACE,WAAW,CAAC,IAAI,CAAC,KAAK;YACtB,CAAC,WAAW,CAAC,IAAI,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,IAAA,iCAAgB,EAAC,sBAAc,CAAC,UAAU,EAAE,sBAAc,CAAC,QAAQ,CAAC,KACvE,KAAK,EAAE,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,KAAI,IAAI,IACpC;QAEJ,MAAM,iBAAiB,GAAG,IAAA,2BAAiB,EACzC,KAAK,EACL,UAAU,CAAC,UAAU,EACrB,8BAAkB,CACnB,CAAC;QACF,MAAM,mBAAmB,GAAG,MAAM,IAAA,2CAAoB,EACpD,MAAM,EACN,2BAAiB,EACjB,iBAAiB,CAClB,CAAC;QACF,MAAM,SAAS,GAAG,mBAAmB,KAAK,IAAI,CAAC;QAE/C,qDACK,sBAAc,GACd,IAAA,iCAAgB,EACjB,sBAAc,CAAC,UAAU,EACzB,sBAAc,CAAC,QAAQ,EACvB,UAAU,CAAC,MAAM,EACjB,SAAS,CACV,KACD,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,KAAK,EAAE,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,KAAI,IAAI,IACpC;IACJ,CAAC;CAAA;AArCD,oCAqCC;AAEY,QAAA,cAAc,GAAmB;IAC5C,EAAE,EAAE,sBAAc,CAAC,EAAE;IACrB,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACzB,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;QACjC,OAAO,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF,CAAC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Platform } from '@sonarwatch/portfolio-core';
|
2
2
|
import { Fetcher } from '../../Fetcher';
|
3
3
|
import { Job } from '../../Job';
|
4
|
+
export { airdropFetcher } from './helpersAirdrop';
|
4
5
|
export declare const platforms: Platform[];
|
5
6
|
export declare const jobs: Job[];
|
6
7
|
export declare const fetchers: Fetcher[];
|
@@ -3,11 +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.fetchers = exports.jobs = exports.platforms = void 0;
|
6
|
+
exports.fetchers = exports.jobs = exports.platforms = exports.airdropFetcher = void 0;
|
7
7
|
const constants_1 = require("./constants");
|
8
8
|
const depositsFetcher_1 = __importDefault(require("./depositsFetcher"));
|
9
9
|
const marginFetcher_1 = __importDefault(require("./marginFetcher"));
|
10
10
|
const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
|
11
|
+
var helpersAirdrop_1 = require("./helpersAirdrop");
|
12
|
+
Object.defineProperty(exports, "airdropFetcher", { enumerable: true, get: function () { return helpersAirdrop_1.airdropFetcher; } });
|
11
13
|
exports.platforms = [constants_1.platform];
|
12
14
|
exports.jobs = [];
|
13
15
|
exports.fetchers = [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wEAAgD;AAChD,oEAA4C;AAC5C,sEAA8C;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/parcl/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,wEAAgD;AAChD,oEAA4C;AAC5C,sEAA8C;AAE9C,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACV,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,EAAE,CAAC;AACjB,QAAA,QAAQ,GAAc;IACjC,yBAAe;IACf,uBAAa;IACb,wBAAc;CACf,CAAC"}
|
@@ -19,6 +19,7 @@ const solana_1 = require("../../utils/solana");
|
|
19
19
|
const constants_1 = require("./constants");
|
20
20
|
const structs_1 = require("./structs");
|
21
21
|
const filters_1 = require("./filters");
|
22
|
+
const constants_2 = require("../tokens/constants");
|
22
23
|
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
23
24
|
var _a, _b;
|
24
25
|
const client = (0, clients_1.getClientSolana)();
|
@@ -57,7 +58,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
58
|
decimals: ptDecimals,
|
58
59
|
id: market.pubkey.toString(),
|
59
60
|
networkId: portfolio_core_1.NetworkId.solana,
|
60
|
-
platformId:
|
61
|
+
platformId: constants_2.walletTokensPlatform.id,
|
61
62
|
price: ptPrice.times(baseTokenPrice.price).toNumber(),
|
62
63
|
timestamp: Date.now(),
|
63
64
|
weight: 1,
|
@@ -68,7 +69,7 @@ const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
69
|
decimals: ytDecimals,
|
69
70
|
id: market.pubkey.toString(),
|
70
71
|
networkId: portfolio_core_1.NetworkId.solana,
|
71
|
-
platformId:
|
72
|
+
platformId: constants_2.walletTokensPlatform.id,
|
72
73
|
price: ytPrice.times(baseTokenPrice.price).toNumber(),
|
73
74
|
timestamp: Date.now(),
|
74
75
|
weight: 1,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sandglass/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,+DAAyE;AAGzE,iDAAsD;AACtD,+CAK4B;AAC5B,2CAAoE;AACpE,uCAAyC;AACzC,uCAAiD;
|
1
|
+
{"version":3,"file":"marketsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/sandglass/marketsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,+DAAyE;AAGzE,iDAAsD;AACtD,+CAK4B;AAC5B,2CAAoE;AACpE,uCAAyC;AACzC,uCAAiD;AAEjD,mDAA2D;AAE3D,MAAM,QAAQ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ACnC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;gBACrD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,MAAM,EAAE,CAAC;aACV,CAAC,CAAC;QAEL,YAAY,CAAC,IAAI,CAAC;YAChB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;YAChC,MAAM,EAAE,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE;YAC5C,MAAM,EAAE,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE;YAC5C,MAAM,EAAE,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE;YAC5C,MAAM,EAAE,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE;SAC7C,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,0BAAc,EAAE,YAAY,EAAE;QAChD,MAAM,EAAE,sBAAU;QAClB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IAEH,MAAM,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,UAAU;IAC3B,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AACF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.getMultipleBalances = void 0;
|
13
|
+
function getMultipleBalances(client, owner, coinsTypes) {
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
15
|
+
return Promise.all(coinsTypes.map((coinType) => client.getBalance({ owner, coinType })));
|
16
|
+
});
|
17
|
+
}
|
18
|
+
exports.getMultipleBalances = getMultipleBalances;
|
19
|
+
//# sourceMappingURL=mulitpleGetBalances.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mulitpleGetBalances.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/mulitpleGetBalances.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,SAAsB,mBAAmB,CACvC,MAAiB,EACjB,KAAa,EACb,UAAoB;;QAEpB,OAAO,OAAO,CAAC,GAAG,CAChB,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CACrE,CAAC;IACJ,CAAC;CAAA;AARD,kDAQC"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { SuiObjectDataOptions } from '@mysten/sui.js/dist/cjs/client';
|
2
|
+
import { SuiClient } from '../clients/types';
|
3
|
+
import { ObjectResponse } from './types';
|
4
|
+
export declare function multipleGetDynamicFieldsObjects<K>(client: SuiClient, parentIds: string[], options?: SuiObjectDataOptions): Promise<ObjectResponse<K>[][]>;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.multipleGetDynamicFieldsObjects = void 0;
|
16
|
+
const runInBatch_1 = __importDefault(require("../misc/runInBatch"));
|
17
|
+
const getDynamicFieldObjects_1 = require("./getDynamicFieldObjects");
|
18
|
+
function multipleGetDynamicFieldsObjects(client, parentIds, options) {
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
20
|
+
const result = yield (0, runInBatch_1.default)(parentIds.map((parentId) => () => (0, getDynamicFieldObjects_1.getDynamicFieldObjects)(client, parentId, options)), 10);
|
21
|
+
return result.flatMap((r) => (r.status === 'fulfilled' ? [r.value] : []));
|
22
|
+
});
|
23
|
+
}
|
24
|
+
exports.multipleGetDynamicFieldsObjects = multipleGetDynamicFieldsObjects;
|
25
|
+
//# sourceMappingURL=multipleGetDynamicFieldsObjects.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"multipleGetDynamicFieldsObjects.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/sui/multipleGetDynamicFieldsObjects.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,oEAA4C;AAC5C,qEAAkE;AAGlE,SAAsB,+BAA+B,CACnD,MAAiB,EACjB,SAAmB,EACnB,OAA8B;;QAE9B,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAU,EAC7B,SAAS,CAAC,GAAG,CACX,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,IAAA,+CAAsB,EAAI,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CACzE,EACD,EAAE,CACH,CAAC;QAEF,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC;CAAA;AAbD,0EAaC"}
|