@skillful-ai/piece-coinmarketcap 0.0.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 +7 -0
- package/package.json +30 -0
- package/skillful-ai-piece-coinmarketcap-0.0.1.tgz +0 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +44 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/convert-price.d.ts +7 -0
- package/src/lib/actions/convert-price.js +93 -0
- package/src/lib/actions/convert-price.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-info.d.ts +5 -0
- package/src/lib/actions/get-cryptocurrency-info.js +72 -0
- package/src/lib/actions/get-cryptocurrency-info.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-listings-latest.d.ts +9 -0
- package/src/lib/actions/get-cryptocurrency-listings-latest.js +112 -0
- package/src/lib/actions/get-cryptocurrency-listings-latest.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-listings-new.d.ts +5 -0
- package/src/lib/actions/get-cryptocurrency-listings-new.js +73 -0
- package/src/lib/actions/get-cryptocurrency-listings-new.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-historical.d.ts +7 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-historical.js +90 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-historical.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-latest.d.ts +6 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-latest.js +81 -0
- package/src/lib/actions/get-cryptocurrency-ohlcv-latest.js.map +1 -0
- package/src/lib/actions/get-cryptocurrency-quotes-latest.d.ts +6 -0
- package/src/lib/actions/get-cryptocurrency-quotes-latest.js +81 -0
- package/src/lib/actions/get-cryptocurrency-quotes-latest.js.map +1 -0
- package/src/lib/actions/get-exchange-info.d.ts +5 -0
- package/src/lib/actions/get-exchange-info.js +73 -0
- package/src/lib/actions/get-exchange-info.js.map +1 -0
- package/src/lib/actions/get-fear-and-greed-historical.d.ts +4 -0
- package/src/lib/actions/get-fear-and-greed-historical.js +70 -0
- package/src/lib/actions/get-fear-and-greed-historical.js.map +1 -0
- package/src/lib/actions/get-fear-and-greed-latest.d.ts +1 -0
- package/src/lib/actions/get-fear-and-greed-latest.js +43 -0
- package/src/lib/actions/get-fear-and-greed-latest.js.map +1 -0
- package/src/lib/actions/get-global-metrics-quotes-historical.d.ts +6 -0
- package/src/lib/actions/get-global-metrics-quotes-historical.js +79 -0
- package/src/lib/actions/get-global-metrics-quotes-historical.js.map +1 -0
- package/src/lib/actions/get-global-metrics-quotes-latest.d.ts +3 -0
- package/src/lib/actions/get-global-metrics-quotes-latest.js +52 -0
- package/src/lib/actions/get-global-metrics-quotes-latest.js.map +1 -0
- package/src/lib/auth.d.ts +3 -0
- package/src/lib/auth.js +16 -0
- package/src/lib/auth.js.map +1 -0
- package/src/lib/common.d.ts +1 -0
- package/src/lib/common.js +37 -0
- package/src/lib/common.js.map +1 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapGetCryptocurrencyOhlcvLatest = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapGetCryptocurrencyOhlcvLatest = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_get_cryptocurrency_ohlcv_latest',
|
|
10
|
+
displayName: 'CoinMarketCap Get Cryptocurrency OHLCV Latest',
|
|
11
|
+
description: 'Fetch the latest OHLCV (Open, High, Low, Close, Volume) market data for a cryptocurrency from CoinMarketCap.',
|
|
12
|
+
props: {
|
|
13
|
+
id: pieces_framework_1.Property.Number({
|
|
14
|
+
displayName: 'CoinMarketCap ID',
|
|
15
|
+
description: 'The CoinMarketCap ID of the cryptocurrency (required if slug or symbol is not provided)',
|
|
16
|
+
required: false,
|
|
17
|
+
}),
|
|
18
|
+
slug: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'Slug',
|
|
20
|
+
description: 'The URL-friendly identifier of the cryptocurrency (required if id or symbol is not provided)',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
symbol: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Symbol',
|
|
25
|
+
description: 'The ticker symbol of the cryptocurrency (required if id or slug is not provided)',
|
|
26
|
+
required: false,
|
|
27
|
+
}),
|
|
28
|
+
convert: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'Convert',
|
|
30
|
+
description: 'Currency code to convert prices into (e.g. USD)',
|
|
31
|
+
required: false,
|
|
32
|
+
defaultValue: 'USD',
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
run(context) {
|
|
36
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const { id, slug, symbol, convert } = context.propsValue;
|
|
38
|
+
// Validate: at least one identifier must be provided
|
|
39
|
+
if (!id && !slug && !symbol) {
|
|
40
|
+
throw new Error('One of id, slug, or symbol must be provided.');
|
|
41
|
+
}
|
|
42
|
+
const url = new URL('https://pro-api.coinmarketcap.com/v1/cryptocurrency/ohlcv/latest');
|
|
43
|
+
const params = {};
|
|
44
|
+
if (id)
|
|
45
|
+
params['id'] = id.toString();
|
|
46
|
+
if (slug)
|
|
47
|
+
params['slug'] = slug;
|
|
48
|
+
if (symbol)
|
|
49
|
+
params['symbol'] = symbol;
|
|
50
|
+
if (convert)
|
|
51
|
+
params['convert'] = convert;
|
|
52
|
+
Object.entries(params).forEach(([key, value]) => url.searchParams.append(key, value));
|
|
53
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
54
|
+
if (!apiKey) {
|
|
55
|
+
return {
|
|
56
|
+
success: false,
|
|
57
|
+
errorType: 'MissingApiKey',
|
|
58
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.'
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const response = yield (0, node_fetch_1.default)(url.toString(), {
|
|
62
|
+
method: 'GET',
|
|
63
|
+
headers: {
|
|
64
|
+
Accept: 'application/json',
|
|
65
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
if (!response.ok) {
|
|
69
|
+
const errorText = yield response.text();
|
|
70
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
71
|
+
}
|
|
72
|
+
const data = yield response.json();
|
|
73
|
+
return {
|
|
74
|
+
success: true,
|
|
75
|
+
identifier: id || slug || symbol,
|
|
76
|
+
data,
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=get-cryptocurrency-ohlcv-latest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-cryptocurrency-ohlcv-latest.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/actions/get-cryptocurrency-ohlcv-latest.ts"],"names":[],"mappings":";;;;AAAA,qEAAuE;AACvE,oEAA8B;AAC9B,sCAAwC;AAE3B,QAAA,yCAAyC,GAAG,IAAA,+BAAY,EAAC;IACpE,IAAI,EAAE,+CAA+C;IACrD,WAAW,EAAE,+CAA+C;IAC5D,WAAW,EACT,8GAA8G;IAChH,KAAK,EAAE;QACL,EAAE,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAClB,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EACT,yFAAyF;YAC3F,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EACT,8FAA8F;YAChG,QAAQ,EAAE,KAAK;SAChB,CAAC;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EAAE,CAAC;gBACV,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,SAAS,EAAE,eAAe;oBAC1B,KAAK,EAAE,uFAAuF;iBAC/F,CAAA;YACH,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;gBAC3C,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,MAAM,EAAE,kBAAkB;oBAC1B,mBAAmB,EAAE,MAAM;iBAC5B;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;gBACvC,MAAM,IAAI,KAAK,CACb,qCAAqC,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CACtE,CAAA;YACH,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAElC,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,UAAU,EAAE,EAAE,IAAI,IAAI,IAAI,MAAM;gBAChC,IAAI;aACL,CAAA;QACH,CAAC;KAAA;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const coinMarketCapGetCryptocurrencyQuotesLatest: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
3
|
+
slug: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
symbol: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
convert: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapGetCryptocurrencyQuotesLatest = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapGetCryptocurrencyQuotesLatest = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_get_cryptocurrency_quotes_latest',
|
|
10
|
+
displayName: 'CoinMarketCap Get Cryptocurrency Quotes Latest',
|
|
11
|
+
description: 'Retrieve the latest market quote for a specific cryptocurrency from CoinMarketCap.',
|
|
12
|
+
props: {
|
|
13
|
+
id: pieces_framework_1.Property.ShortText({
|
|
14
|
+
displayName: 'CoinMarketCap ID',
|
|
15
|
+
description: 'The CoinMarketCap ID of the cryptocurrency (required if slug or symbol is not provided)',
|
|
16
|
+
required: false,
|
|
17
|
+
}),
|
|
18
|
+
slug: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'Slug',
|
|
20
|
+
description: 'The URL-friendly identifier of the cryptocurrency (required if id or symbol is not provided)',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
symbol: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Symbol',
|
|
25
|
+
description: 'The ticker symbol of the cryptocurrency (required if id or slug is not provided)',
|
|
26
|
+
required: false,
|
|
27
|
+
}),
|
|
28
|
+
convert: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'Convert',
|
|
30
|
+
description: 'Currency code to convert prices into (e.g. USD)',
|
|
31
|
+
required: false,
|
|
32
|
+
defaultValue: 'USD',
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
run(context) {
|
|
36
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const { id, slug, symbol, convert } = context.propsValue;
|
|
38
|
+
// Validate: at least one identifier must be provided
|
|
39
|
+
if (!id && !slug && !symbol) {
|
|
40
|
+
throw new Error('One of id, slug, or symbol must be provided.');
|
|
41
|
+
}
|
|
42
|
+
const url = new URL('https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest');
|
|
43
|
+
const params = {};
|
|
44
|
+
if (id)
|
|
45
|
+
params['id'] = id.toString();
|
|
46
|
+
if (slug)
|
|
47
|
+
params['slug'] = slug;
|
|
48
|
+
if (symbol)
|
|
49
|
+
params['symbol'] = symbol;
|
|
50
|
+
if (convert)
|
|
51
|
+
params['convert'] = convert;
|
|
52
|
+
Object.entries(params).forEach(([key, value]) => url.searchParams.append(key, value));
|
|
53
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
54
|
+
if (!apiKey) {
|
|
55
|
+
return {
|
|
56
|
+
success: false,
|
|
57
|
+
errorType: 'MissingApiKey',
|
|
58
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.',
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const response = yield (0, node_fetch_1.default)(url.toString(), {
|
|
62
|
+
method: 'GET',
|
|
63
|
+
headers: {
|
|
64
|
+
Accept: 'application/json',
|
|
65
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
if (!response.ok) {
|
|
69
|
+
const errorText = yield response.text();
|
|
70
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
71
|
+
}
|
|
72
|
+
const data = yield response.json();
|
|
73
|
+
return {
|
|
74
|
+
success: true,
|
|
75
|
+
identifier: id || slug || symbol,
|
|
76
|
+
data,
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=get-cryptocurrency-quotes-latest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-cryptocurrency-quotes-latest.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/actions/get-cryptocurrency-quotes-latest.ts"],"names":[],"mappings":";;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|
1
|
+
export declare const coinMarketCapGetExchangeInfo: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
3
|
+
slug: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
symbol: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapGetExchangeInfo = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapGetExchangeInfo = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_get_exchange_info',
|
|
10
|
+
displayName: 'CoinMarketCap Get Exchange Info',
|
|
11
|
+
description: 'Retrieve information for one or more exchanges from CoinMarketCap.',
|
|
12
|
+
props: {
|
|
13
|
+
id: pieces_framework_1.Property.ShortText({
|
|
14
|
+
displayName: 'CoinMarketCap ID',
|
|
15
|
+
description: 'The CoinMarketCap ID of the exchange (required if slug or symbol is not provided)',
|
|
16
|
+
required: false,
|
|
17
|
+
}),
|
|
18
|
+
slug: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'Slug',
|
|
20
|
+
description: 'The URL-friendly identifier of the exchange (required if id or symbol is not provided)',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
symbol: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Symbol',
|
|
25
|
+
description: 'The ticker symbol of the exchange (required if id or slug is not provided)',
|
|
26
|
+
required: false,
|
|
27
|
+
}),
|
|
28
|
+
},
|
|
29
|
+
run(context) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const { id, slug, symbol } = context.propsValue;
|
|
32
|
+
// Validate: at least one identifier must be provided
|
|
33
|
+
if (!id && !slug && !symbol) {
|
|
34
|
+
throw new Error('One of id, slug, or symbol must be provided.');
|
|
35
|
+
}
|
|
36
|
+
const url = new URL('https://pro-api.coinmarketcap.com/v1/exchange/info');
|
|
37
|
+
const params = {};
|
|
38
|
+
if (id)
|
|
39
|
+
params['id'] = id.toString();
|
|
40
|
+
if (slug)
|
|
41
|
+
params['slug'] = slug;
|
|
42
|
+
if (symbol)
|
|
43
|
+
params['symbol'] = symbol;
|
|
44
|
+
Object.entries(params).forEach(([key, value]) => url.searchParams.append(key, value));
|
|
45
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
46
|
+
if (!apiKey) {
|
|
47
|
+
return {
|
|
48
|
+
success: false,
|
|
49
|
+
errorType: 'MissingApiKey',
|
|
50
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const response = yield (0, node_fetch_1.default)(url.toString(), {
|
|
54
|
+
method: 'GET',
|
|
55
|
+
headers: {
|
|
56
|
+
Accept: 'application/json',
|
|
57
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
const errorText = yield response.text();
|
|
62
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
63
|
+
}
|
|
64
|
+
const data = yield response.json();
|
|
65
|
+
return {
|
|
66
|
+
success: true,
|
|
67
|
+
identifier: id || slug || symbol,
|
|
68
|
+
data,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=get-exchange-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-exchange-info.js","sourceRoot":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AAC,GAAG,MAAM,CAAA;YAErC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAC9C,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CACpC,CAAA;YAED,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC,OAAO,CAAC,CAAA;YAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,SAAS,EAAE,eAAe;oBAC1B,KAAK,EACH,uFAAuF;iBAC1F,CAAA;YACH,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;gBAC3C,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,MAAM,EAAE,kBAAkB;oBAC1B,mBAAmB,EAAE,MAAM;iBAC5B;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;gBACvC,MAAM,IAAI,KAAK,CACb,qCAAqC,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CACtE,CAAA;YACH,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAElC,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,UAAU,EAAE,EAAE,IAAI,IAAI,IAAI,MAAM;gBAChC,IAAI;aACL,CAAA;QACH,CAAC;KAAA;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const coinMarketCapGetFearAndGreedHistorical: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
start: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
3
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapGetFearAndGreedHistorical = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapGetFearAndGreedHistorical = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_get_fear_and_greed_historical',
|
|
10
|
+
displayName: 'CoinMarketCap Get Historical Fear and Greed Index',
|
|
11
|
+
description: 'Retrieve the historical Fear and Greed Index from CoinMarketCap.',
|
|
12
|
+
props: {
|
|
13
|
+
start: pieces_framework_1.Property.Number({
|
|
14
|
+
displayName: 'Start',
|
|
15
|
+
description: 'Optionally offset the start (1-based index) of the paginated list of items to return.',
|
|
16
|
+
required: false,
|
|
17
|
+
defaultValue: 1,
|
|
18
|
+
}),
|
|
19
|
+
limit: pieces_framework_1.Property.Number({
|
|
20
|
+
displayName: 'Limit',
|
|
21
|
+
description: 'Optionally specify the number of results to return (max 50).',
|
|
22
|
+
required: false,
|
|
23
|
+
defaultValue: 50,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
run(context) {
|
|
27
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const { start, limit } = context.propsValue;
|
|
29
|
+
const url = new URL('https://pro-api.coinmarketcap.com/v3/fear-and-greed/historical');
|
|
30
|
+
if (start)
|
|
31
|
+
url.searchParams.append('start', start.toString());
|
|
32
|
+
if (limit)
|
|
33
|
+
url.searchParams.append('limit', limit.toString());
|
|
34
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
35
|
+
if (!apiKey) {
|
|
36
|
+
return {
|
|
37
|
+
success: false,
|
|
38
|
+
errorType: 'MissingApiKey',
|
|
39
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const response = yield (0, node_fetch_1.default)(url.toString(), {
|
|
43
|
+
method: 'GET',
|
|
44
|
+
headers: {
|
|
45
|
+
Accept: 'application/json',
|
|
46
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
const errorText = yield response.text();
|
|
51
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
52
|
+
}
|
|
53
|
+
const data = yield response.json();
|
|
54
|
+
// Convert UNIX timestamp to human-readable format
|
|
55
|
+
if (Array.isArray(data.data)) {
|
|
56
|
+
data.data.forEach((entry) => {
|
|
57
|
+
if (entry.timestamp) {
|
|
58
|
+
const date = new Date(Number(entry.timestamp) * 1000);
|
|
59
|
+
entry.timestamp = date.toISOString().replace('T', ' ').split('.')[0];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
success: true,
|
|
65
|
+
data,
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=get-fear-and-greed-historical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-fear-and-greed-historical.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/actions/get-fear-and-greed-historical.ts"],"names":[],"mappings":";;;;AAAA,qEAAuE;AACvE,oEAA8B;AAC9B,sCAAwC;AAE3B,QAAA,sCAAsC,GAAG,IAAA,+BAAY,EAAC;IACjE,IAAI,EAAE,6CAA6C;IACnD,WAAW,EAAE,mDAAmD;IAChE,WAAW,EAAE,kEAAkE;IAC/E,KAAK,EAAE;QACL,KAAK,EAAE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,KAAK,CACb,qCAAqC,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CACtE,CAAA;YACH,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAElC,kDAAkD;YAClD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC7B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;oBAC/B,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;wBACpB,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAA;wBACrD,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;oBACtE,CAAC;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI;aACL,CAAA;QACH,CAAC;KAAA;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const coinMarketCapGetFearAndGreedLatest: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {}>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapGetFearAndGreedLatest = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapGetFearAndGreedLatest = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_get_fear_and_greed_latest',
|
|
10
|
+
displayName: 'CoinMarketCap Get Latest Fear and Greed Index',
|
|
11
|
+
description: 'Retrieve the current Fear and Greed Index from CoinMarketCap.',
|
|
12
|
+
props: {},
|
|
13
|
+
run(context) {
|
|
14
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
16
|
+
if (!apiKey) {
|
|
17
|
+
return {
|
|
18
|
+
success: false,
|
|
19
|
+
errorType: 'MissingApiKey',
|
|
20
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const url = 'https://pro-api.coinmarketcap.com/v3/fear-and-greed/latest';
|
|
24
|
+
const response = yield (0, node_fetch_1.default)(url, {
|
|
25
|
+
method: 'GET',
|
|
26
|
+
headers: {
|
|
27
|
+
Accept: 'application/json',
|
|
28
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
const errorText = yield response.text();
|
|
33
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
34
|
+
}
|
|
35
|
+
const data = yield response.json();
|
|
36
|
+
return {
|
|
37
|
+
success: true,
|
|
38
|
+
data,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=get-fear-and-greed-latest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-fear-and-greed-latest.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/actions/get-fear-and-greed-latest.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,oEAA8B;AAC9B,sCAAwC;AAE3B,QAAA,kCAAkC,GAAG,IAAA,+BAAY,EAAC;IAC7D,IAAI,EAAE,yCAAyC;IAC/C,WAAW,EAAE,+CAA+C;IAC5D,WAAW,EAAE,+DAA+D;IAC5E,KAAK,EAAE,EAAE;IACH,GAAG,CAAC,OAAO;;YACf,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC,OAAO,CAAC,CAAA;YAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,SAAS,EAAE,eAAe;oBAC1B,KAAK,EACH,uFAAuF;iBAC1F,CAAA;YACH,CAAC;YAED,MAAM,GAAG,GAAG,4DAA4D,CAAA;YAExE,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,GAAG,EAAE;gBAChC,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,MAAM,EAAE,kBAAkB;oBAC1B,mBAAmB,EAAE,MAAM;iBAC5B;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;gBACvC,MAAM,IAAI,KAAK,CACb,qCAAqC,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CACtE,CAAA;YACH,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAElC,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI;aACL,CAAA;QACH,CAAC;KAAA;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const coinMarketCapGetGlobalMetricsQuotesHistorical: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
time_start: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
3
|
+
time_end: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
count: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
5
|
+
convert: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapGetGlobalMetricsQuotesHistorical = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapGetGlobalMetricsQuotesHistorical = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_get_global_metrics_quotes_historical',
|
|
10
|
+
displayName: 'CoinMarketCap Get Global Metrics Quotes Historical',
|
|
11
|
+
description: 'Get historical global cryptocurrency market metrics from CoinMarketCap.',
|
|
12
|
+
props: {
|
|
13
|
+
time_start: pieces_framework_1.Property.ShortText({
|
|
14
|
+
displayName: 'Start Time',
|
|
15
|
+
description: 'Start datetime in ISO 8601 format (e.g., 2023-10-01T00:00:00.000Z)',
|
|
16
|
+
required: false,
|
|
17
|
+
}),
|
|
18
|
+
time_end: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'End Time',
|
|
20
|
+
description: 'End datetime in ISO 8601 format (e.g., 2023-10-31T23:59:59.000Z)',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
count: pieces_framework_1.Property.Number({
|
|
24
|
+
displayName: 'Count',
|
|
25
|
+
description: 'Number of historical metric records to retrieve (max 10)',
|
|
26
|
+
required: false,
|
|
27
|
+
defaultValue: 10,
|
|
28
|
+
}),
|
|
29
|
+
convert: pieces_framework_1.Property.ShortText({
|
|
30
|
+
displayName: 'Convert',
|
|
31
|
+
description: 'Currency code for converting global metrics (default USD)',
|
|
32
|
+
required: false,
|
|
33
|
+
defaultValue: 'USD',
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
run(context) {
|
|
37
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const { time_start, time_end, count, convert } = context.propsValue;
|
|
39
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
40
|
+
if (!apiKey) {
|
|
41
|
+
return {
|
|
42
|
+
success: false,
|
|
43
|
+
errorType: 'MissingApiKey',
|
|
44
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// Enforce maximum record limit of 10 like Python's estimate_limit
|
|
48
|
+
const enforcedCount = count && count > 10 ? 10 : count || 10;
|
|
49
|
+
const url = new URL('https://pro-api.coinmarketcap.com/v1/global-metrics/quotes/historical');
|
|
50
|
+
const params = {
|
|
51
|
+
count: enforcedCount.toString(),
|
|
52
|
+
interval: 'daily', // interval handling like Python estimate_time_interval
|
|
53
|
+
convert: convert || 'USD',
|
|
54
|
+
};
|
|
55
|
+
if (time_start)
|
|
56
|
+
params['time_start'] = time_start;
|
|
57
|
+
if (time_end)
|
|
58
|
+
params['time_end'] = time_end;
|
|
59
|
+
Object.entries(params).forEach(([key, value]) => url.searchParams.append(key, value));
|
|
60
|
+
const response = yield (0, node_fetch_1.default)(url.toString(), {
|
|
61
|
+
method: 'GET',
|
|
62
|
+
headers: {
|
|
63
|
+
Accept: 'application/json',
|
|
64
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
if (!response.ok) {
|
|
68
|
+
const errorText = yield response.text();
|
|
69
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
70
|
+
}
|
|
71
|
+
const data = yield response.json();
|
|
72
|
+
return {
|
|
73
|
+
success: true,
|
|
74
|
+
data,
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=get-global-metrics-quotes-historical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-global-metrics-quotes-historical.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/actions/get-global-metrics-quotes-historical.ts"],"names":[],"mappings":";;;;AAAA,qEAAuE;AACvE,oEAA8B;AAC9B,sCAAwC;AAE3B,QAAA,6CAA6C,GAAG,IAAA,+BAAY,EAAC;IACxE,IAAI,EAAE,oDAAoD;IAC1D,WAAW,EAAE,oDAAoD;IACjE,WAAW,EAAE,yEAAyE;IACtF,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,oEAAoE;YACjF,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,kEAAkE;YAC/E,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,EAAE;SACjB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,2DAA2D;YACxE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAA;YACnE,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC,OAAO,CAAC,CAAA;YAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,SAAS,EAAE,eAAe;oBAC1B,KAAK,EACH,uFAAuF;iBAC1F,CAAA;YACH,CAAC;YAED,kEAAk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,CAAC,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinMarketCapGetGlobalMetricsQuotesLatest = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
exports.coinMarketCapGetGlobalMetricsQuotesLatest = (0, pieces_framework_1.createAction)({
|
|
9
|
+
name: 'coinmarketcap_get_global_metrics_quotes_latest',
|
|
10
|
+
displayName: 'CoinMarketCap Get Latest Global Metrics Quotes',
|
|
11
|
+
description: 'Get the latest global cryptocurrency market metrics from CoinMarketCap.',
|
|
12
|
+
props: {
|
|
13
|
+
convert: pieces_framework_1.Property.ShortText({
|
|
14
|
+
displayName: 'Convert',
|
|
15
|
+
description: 'Currency code for converting global metrics (optional, e.g., USD)',
|
|
16
|
+
required: false,
|
|
17
|
+
}),
|
|
18
|
+
},
|
|
19
|
+
run(context) {
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const { convert } = context.propsValue;
|
|
22
|
+
const apiKey = yield (0, common_1.getCmcApiKey)(context);
|
|
23
|
+
if (!apiKey) {
|
|
24
|
+
return {
|
|
25
|
+
success: false,
|
|
26
|
+
errorType: 'MissingApiKey',
|
|
27
|
+
error: 'No CoinMarketCap API key available. Please configure a connection or contact support.',
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const url = new URL('https://pro-api.coinmarketcap.com/v1/global-metrics/quotes/latest');
|
|
31
|
+
if (convert)
|
|
32
|
+
url.searchParams.append('convert', convert);
|
|
33
|
+
const response = yield (0, node_fetch_1.default)(url.toString(), {
|
|
34
|
+
method: 'GET',
|
|
35
|
+
headers: {
|
|
36
|
+
Accept: 'application/json',
|
|
37
|
+
'X-CMC_PRO_API_KEY': apiKey,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
if (!response.ok) {
|
|
41
|
+
const errorText = yield response.text();
|
|
42
|
+
throw new Error(`CoinMarketCap API request failed: ${response.status} - ${errorText}`);
|
|
43
|
+
}
|
|
44
|
+
const data = yield response.json();
|
|
45
|
+
return {
|
|
46
|
+
success: true,
|
|
47
|
+
data,
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=get-global-metrics-quotes-latest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-global-metrics-quotes-latest.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/actions/get-global-metrics-quotes-latest.ts"],"names":[],"mappings":";;;;AAAA,qEAAuE;AACvE,oEAA8B;AAC9B,sCAAwC;AAE3B,QAAA,yCAAyC,GAAG,IAAA,+BAAY,EAAC;IACpE,IAAI,EAAE,gDAAgD;IACtD,WAAW,EAAE,gDAAgD;IAC7D,WAAW,EAAE,yEAAyE;IACtF,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,mEAAmE;YAChF,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAA;YACtC,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,EAAC,OAAO,CAAC,CAAA;YAE1C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,SAAS,EAAE,eAAe;oBAC1B,KAAK,EACH,uFAAuF;iBAC1F,CAAA;YACH,CAAC;YAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,mEAAmE,CAAC,CAAA;YACxF,IAAI,OAAO;gBAAE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;YAExD,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;gBAC3C,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,MAAM,EAAE,kBAAkB;oBAC1B,mBAAmB,EAAE,MAAM;iBAC5B;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;gBACvC,MAAM,IAAI,KAAK,CAAC,qCAAqC,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CAAC,CAAA;YACxF,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAElC,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,IAAI;aACL,CAAA;QACH,CAAC;KAAA;CACF,CAAC,CAAA"}
|
package/src/lib/auth.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coinmarketcapAuth = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
exports.coinmarketcapAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
6
|
+
description: 'Configure API keys for CoinMarketCap actions',
|
|
7
|
+
required: true,
|
|
8
|
+
props: {
|
|
9
|
+
coinmarketcapApiKey: pieces_framework_1.PieceAuth.SecretText({
|
|
10
|
+
displayName: 'CoinMarketCap API Key',
|
|
11
|
+
description: 'For CoinMarketCap API',
|
|
12
|
+
required: false,
|
|
13
|
+
})
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/auth.ts"],"names":[],"mappings":";;;AAAA,qEAA2D;AAE9C,QAAA,iBAAiB,GAAG,4BAAS,CAAC,UAAU,CAAC;IAClD,WAAW,EAAE,8CAA8C;IAC3D,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,mBAAmB,EAAE,4BAAS,CAAC,UAAU,CAAC;YACxC,WAAW,EAAE,uBAAuB;YACpC,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCmcApiKey(context: any): Promise<string | null>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCmcApiKey = getCmcApiKey;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
function getApiKey(context, config) {
|
|
6
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
// Priority 1: User-provided API key from connection
|
|
9
|
+
if ((_b = (_a = context.auth) === null || _a === void 0 ? void 0 : _a[config.authKey]) === null || _b === void 0 ? void 0 : _b.trim()) {
|
|
10
|
+
return context.auth[config.authKey].trim();
|
|
11
|
+
}
|
|
12
|
+
// Priority 2: Try to get from platform connection
|
|
13
|
+
try {
|
|
14
|
+
const connection = yield context.connections.get(config.platformConnectionId);
|
|
15
|
+
if (connection === null || connection === void 0 ? void 0 : connection[config.platformKey]) {
|
|
16
|
+
return connection[config.platformKey];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.warn(`Failed to retrieve platform ${config.platformKey}:`, error);
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const API_KEY_CONFIGS = {
|
|
26
|
+
CMC_API: {
|
|
27
|
+
authKey: 'coinmarketcapApiKey',
|
|
28
|
+
platformConnectionId: 'cmc_platform_default',
|
|
29
|
+
platformKey: 'coinmarketcapApiKey',
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
function getCmcApiKey(context) {
|
|
33
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return getApiKey(context, API_KEY_CONFIGS.CMC_API);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/custom/coinmarketcap/src/lib/common.ts"],"names":[],"mappings":";;AAsCA,oCAEC;;AAlCD,SAAe,SAAS,CACpB,OAAY,EACZ,MAAoB;;;QAEpB,oDAAoD;QACpD,IAAI,MAAA,MAAA,OAAO,CAAC,IAAI,0CAAG,MAAM,CAAC,OAAO,CAAC,0CAAE,IAAI,EAAE,EAAE,CAAC;YACzC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAA;QAC9C,CAAC;QAED,kDAAkD;QAClD,IAAI,CAAC;YACD,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAA;YAC7E,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;gBACvC,OAAO,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;YACrC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,+BAA+B,MAAM,CAAC,WAAW,GAAG,EAAE,KAAK,CAAC,CAAA;QAC7E,CAAC;QAGD,OAAO,IAAI,CAAA;IACX,CAAC;CAAA;AAEL,MAAM,eAAe,GAAG;IACpB,OAAO,EAAE;QACL,OAAO,EAAE,qBAAqB;QAC9B,oBAAoB,EAAE,sBAAsB;QAC5C,WAAW,EAAE,qBAAqB;KACrC;CACK,CAAA;AAGV,SAAsB,YAAY,CAAC,OAAY;;QAC3C,OAAO,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;IACtD,CAAC;CAAA"}
|