@fileverse-dev/formulajs 4.4.38-col-3 → 4.4.38

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/lib/esm/index.mjs CHANGED
@@ -17695,16 +17695,15 @@ const aaveParamsSchema = objectType({
17695
17695
  category: enumType(['tokens','markets']),
17696
17696
  param1: stringType().nonempty(),
17697
17697
  param2: stringType().optional(),
17698
- columnName: stringType().optional(),
17699
17698
  });
17700
17699
 
17701
17700
  async function AAVE() {
17702
17701
  try {
17703
17702
 
17704
- const [graphType, category, param1, param2, columnName] = argsToArray(arguments);
17703
+ const [graphType, category, param1, param2] = argsToArray(arguments);
17705
17704
 
17706
17705
 
17707
- validateParams(aaveParamsSchema, { graphType, category, param1, param2, columnName });
17706
+ validateParams(aaveParamsSchema, { graphType, category, param1, param2 });
17708
17707
 
17709
17708
  const baseUrl = 'https://onchain-proxy.fileverse.io/third-party';
17710
17709
  const url =
@@ -17721,25 +17720,16 @@ async function AAVE() {
17721
17720
  }
17722
17721
 
17723
17722
  const json = await res.json();
17724
- const filterColumnName = columnName?.split(',').map(s => s.trim());
17725
-
17726
17723
  if (Array.isArray(json)) {
17727
17724
  return json.map(item => {
17728
17725
  const flat = {};
17729
17726
  Object.entries(item).forEach(([k, v]) => {
17730
- if ((columnName && filterColumnName.includes(k)) && (v === null || typeof v !== 'object')) flat[k] = v;
17727
+ if (v === null || typeof v !== 'object') flat[k] = v;
17731
17728
  });
17732
17729
  return flat
17733
17730
  })
17734
17731
  }
17735
- if(columnName && typeof json === 'object') {
17736
- const data = {};
17737
- filterColumnName.forEach(k => {
17738
- data[k] = json[k];
17739
- });
17740
- return data
17741
- }
17742
- return json;
17732
+ return json
17743
17733
  } catch (err) {
17744
17734
  return errorMessageHandler(err, 'AAVE')
17745
17735
  }
@@ -17779,7 +17769,6 @@ const baseSchema = objectType({
17779
17769
  endTime: dateOrTimestamp.optional(),
17780
17770
  page: numberType().int().nonnegative().default(1),
17781
17771
  offset: numberType().int().nonnegative().max(MAX_PAGE_LIMIT, {message: `"offset" must be less than or equal to ${MAX_PAGE_LIMIT}`}).default(10),
17782
- columnName: stringType().optional(),
17783
17772
  });
17784
17773
 
17785
17774
  const eoaParamsSchema = preprocessType(
@@ -18009,9 +17998,9 @@ function toTimestamp(dateStr) {
18009
17998
 
18010
17999
  async function EOA() {
18011
18000
  try {
18012
- const [addresses, category, chains, startTime, endTime, page = 1, offset = 10, columnName = null] =
18001
+ const [addresses, category, chains, startTime, endTime, page = 1, offset = 10] =
18013
18002
  argsToArray(arguments);
18014
- validateParams(eoaParamsSchema, { addresses, category, chains, startTime, endTime, page, offset, columnName });
18003
+ validateParams(eoaParamsSchema, { addresses, category, chains, startTime, endTime, page, offset });
18015
18004
 
18016
18005
  const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
18017
18006
 
@@ -18081,16 +18070,6 @@ async function EOA() {
18081
18070
  }
18082
18071
  }
18083
18072
  }
18084
- if(columnName){
18085
- const filterColumnName = columnName.split(',').map(s => s.trim());
18086
- return out.map(obj =>
18087
- Object.fromEntries(
18088
- filterColumnName
18089
- .filter(key => key in obj)
18090
- .map(key => [key, obj[key]])
18091
- )
18092
- );
18093
- }
18094
18073
  return out
18095
18074
  } catch (err) {
18096
18075
  return errorMessageHandler(err, 'EOA')
@@ -18103,7 +18082,6 @@ const gasSchema$1 = objectType({
18103
18082
  endDate: dateOrTimestamp.optional(),
18104
18083
  page: numberType().int().nonnegative().default(1),
18105
18084
  limit: numberType().int().nonnegative().max(MAX_PAGE_LIMIT, {message: `"limit" must be less than or equal to ${MAX_PAGE_LIMIT}`}).default(10),
18106
- columnName: stringType().optional(),
18107
18085
  });
18108
18086
 
18109
18087
  const txnSchema$1 = objectType({
@@ -18113,7 +18091,6 @@ const txnSchema$1 = objectType({
18113
18091
  endDate: dateOrTimestamp.optional(),
18114
18092
  page: numberType().int().nonnegative().default(1),
18115
18093
  limit: numberType().int().nonnegative().max(MAX_PAGE_LIMIT, {message: `"limit" must be less than or equal to ${MAX_PAGE_LIMIT}`}).default(10),
18116
- columnName: stringType().optional(),
18117
18094
  });
18118
18095
 
18119
18096
  const baseParamsSchema = discriminatedUnionType('type', [gasSchema$1, txnSchema$1]);
@@ -18190,11 +18167,11 @@ async function handleScanRequest({
18190
18167
 
18191
18168
  async function BASE() {
18192
18169
  try {
18193
- const [type, address, startDate, endDate, page, limit, columnName] = argsToArray(arguments);
18194
- validateParams(baseParamsSchema, { type, address, startDate, endDate, page, limit, columnName });
18170
+ const [type, address, startDate, endDate, page, limit] = argsToArray(arguments);
18171
+ validateParams(baseParamsSchema, { type, address, startDate, endDate, page, limit });
18195
18172
  const API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
18196
18173
 
18197
- const out = await handleScanRequest({
18174
+ return await handleScanRequest({
18198
18175
  type,
18199
18176
  address,
18200
18177
  startDate,
@@ -18205,18 +18182,7 @@ async function BASE() {
18205
18182
  functionName: 'BASE',
18206
18183
  chainId: CHAIN_ID_MAP.base,
18207
18184
  network: 'base'
18208
- });
18209
- if (columnName) {
18210
- const filterColumnName = columnName.split(',').map(s => s.trim());
18211
- return out.map(obj =>
18212
- Object.fromEntries(
18213
- filterColumnName
18214
- .filter(key => key in obj)
18215
- .map(key => [key, obj[key]])
18216
- )
18217
- );
18218
- }
18219
- return out
18185
+ })
18220
18186
  } catch (error) {
18221
18187
  return errorMessageHandler(error, 'BASE')
18222
18188
  }
@@ -18336,7 +18302,6 @@ const derivativesSchema = objectType({
18336
18302
  category: literalType('derivatives'),
18337
18303
  param1: stringType().nonempty(),
18338
18304
  param2: anyType().optional(),
18339
- columnName: stringType().optional(),
18340
18305
  });
18341
18306
  const coingeckoParamsSchema = discriminatedUnionType('category', [
18342
18307
  priceSchema$1,
@@ -18351,8 +18316,8 @@ const coingeckoParamsSchema = discriminatedUnionType('category', [
18351
18316
 
18352
18317
  async function COINGECKO() {
18353
18318
  try {
18354
- const [category, param1, param2, columnName = null] = argsToArray(arguments);
18355
- validateParams(coingeckoParamsSchema, { category, param1, param2, columnName });
18319
+ const [category, param1, param2] = argsToArray(arguments);
18320
+ validateParams(coingeckoParamsSchema, { category, param1, param2 });
18356
18321
 
18357
18322
  const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Coingecko);
18358
18323
 
@@ -18387,7 +18352,7 @@ async function COINGECKO() {
18387
18352
  break
18388
18353
  }
18389
18354
  }
18390
- const { URL: finalUrl, HEADERS } = getUrlAndHeaders({ url, serviceName: 'Coingecko', headers });
18355
+ const {URL: finalUrl, HEADERS} = getUrlAndHeaders({url, serviceName: 'Coingecko', headers});
18391
18356
 
18392
18357
  const res = await fetch(finalUrl + "?refresh=true", { headers: HEADERS });
18393
18358
  const json = await res.json();
@@ -18413,16 +18378,6 @@ async function COINGECKO() {
18413
18378
  flat[key] = value;
18414
18379
  }
18415
18380
  }
18416
- if (columnName) {
18417
- const filterData = {};
18418
- const filterColumnName = columnName.split(',').map(s => s.trim());
18419
- filterColumnName.forEach(col => {
18420
- if (flat[col] !== undefined) {
18421
- filterData[col] = flat[col];
18422
- }
18423
- });
18424
- return filterData;
18425
- }
18426
18381
  return flat
18427
18382
  })
18428
18383
  } catch (err) {
@@ -18432,8 +18387,7 @@ async function COINGECKO() {
18432
18387
 
18433
18388
  const categories = ['protocols','yields','dex','fees'];
18434
18389
  const defillamaParamsSchema = objectType({
18435
- category: enumType(categories),
18436
- columnName: stringType().optional(),
18390
+ category: enumType(categories)
18437
18391
  });
18438
18392
 
18439
18393
  const CATEGORY_URLS = {
@@ -18445,8 +18399,8 @@ const CATEGORY_URLS = {
18445
18399
 
18446
18400
  async function DEFILLAMA() {
18447
18401
  try {
18448
- const [category, columnName = null] = argsToArray(arguments);
18449
- validateParams(defillamaParamsSchema, { category, columnName });
18402
+ const [category] = argsToArray(arguments);
18403
+ validateParams(defillamaParamsSchema, { category });
18450
18404
  const url = CATEGORY_URLS[category];
18451
18405
  if (!url) throw new ValidationError(`Invalid category: ${category}`)
18452
18406
  const res = await fetch(url);
@@ -18466,12 +18420,10 @@ async function DEFILLAMA() {
18466
18420
  break
18467
18421
  }
18468
18422
 
18469
- const filterColumnName = columnName?.split(',').map(s => s.trim());
18470
-
18471
18423
  return (Array.isArray(json) ? json : [json]).map(item => {
18472
18424
  const out = {};
18473
18425
  for (const [k, v] of Object.entries(item)) {
18474
- if ((columnName && filterColumnName.includes(k)) && (v === null || typeof v !== 'object')) out[k] = v;
18426
+ if (v === null || typeof v !== 'object') out[k] = v;
18475
18427
  }
18476
18428
  return out
18477
18429
  })
@@ -18486,7 +18438,6 @@ const gasSchema = objectType({
18486
18438
  endDate: dateOrTimestamp.optional(),
18487
18439
  page: numberType().int().nonnegative().default(1),
18488
18440
  limit: numberType().int().nonnegative().max(MAX_PAGE_LIMIT, {message: `"limit" must be less than or equal to ${MAX_PAGE_LIMIT}`}).default(10),
18489
- columnName: stringType().optional(),
18490
18441
  });
18491
18442
 
18492
18443
  const txnSchema = objectType({
@@ -18497,7 +18448,6 @@ const txnSchema = objectType({
18497
18448
  chain: enumType(['ethereum','base','gnosis']),
18498
18449
  page: numberType().int().nonnegative().default(1),
18499
18450
  limit: numberType().int().nonnegative().max(MAX_PAGE_LIMIT, {message: `"limit" must be less than or equal to ${MAX_PAGE_LIMIT}`}).default(10),
18500
- columnName: stringType().optional(),
18501
18451
  });
18502
18452
 
18503
18453
  const etherscanParamsSchema = discriminatedUnionType('type', [gasSchema, txnSchema]);
@@ -18511,18 +18461,18 @@ const etherscanParamsSchema = discriminatedUnionType('type', [gasSchema, txnSche
18511
18461
 
18512
18462
  async function ETHERSCAN() {
18513
18463
  try {
18514
- const [type, chain, address, startDate, endDate, page = 1, limit = 10, columnName = null] =
18464
+ const [type, chain, address, startDate, endDate, page = 1, limit = 10] =
18515
18465
  argsToArray(arguments);
18516
18466
 
18517
18467
 
18518
- validateParams(etherscanParamsSchema, { type, chain, address, startDate, endDate, page, limit, columnName });
18468
+ validateParams(etherscanParamsSchema, { type, chain, address, startDate, endDate, page, limit });
18519
18469
 
18520
18470
  const chainId = CHAIN_ID_MAP[chain];
18521
18471
  if (!chainId) throw new ValidationError(`Invalid chain: ${chain}`)
18522
18472
 
18523
18473
  const apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
18524
18474
 
18525
- const out = await handleScanRequest({
18475
+ return await handleScanRequest({
18526
18476
  type,
18527
18477
  address,
18528
18478
  startDate,
@@ -18533,18 +18483,7 @@ async function ETHERSCAN() {
18533
18483
  functionName: 'ETHERSCAN',
18534
18484
  chainId,
18535
18485
  network: chain,
18536
- });
18537
- if (columnName) {
18538
- const filterColumnName = columnName.split(',').map(s => s.trim());
18539
- return out.map(obj =>
18540
- Object.fromEntries(
18541
- filterColumnName
18542
- .filter(key => key in obj)
18543
- .map(key => [key, obj[key]])
18544
- )
18545
- );
18546
- }
18547
- return out
18486
+ })
18548
18487
  } catch (err) {
18549
18488
  return errorMessageHandler(err, 'ETHERSCAN')
18550
18489
  }
@@ -18983,14 +18922,13 @@ const uniswapParamsSchema = objectType({
18983
18922
  category: enumType(['tokens','markets']),
18984
18923
  param1: stringType().nonempty(),
18985
18924
  param2: stringType().optional(),
18986
- colummnName: stringType().optional(),
18987
18925
  });
18988
18926
 
18989
18927
  async function UNISWAP() {
18990
18928
  try {
18991
- const [graphType, category, param1, param2, columnName] = argsToArray(arguments);
18929
+ const [graphType, category, param1, param2] = argsToArray(arguments);
18992
18930
 
18993
- validateParams(uniswapParamsSchema, { graphType, category, param1, param2, columnName });
18931
+ validateParams(uniswapParamsSchema, { graphType, category, param1, param2 });
18994
18932
 
18995
18933
  const baseUrl = 'https://onchain-proxy.fileverse.io/third-party';
18996
18934
  const url =
@@ -19008,24 +18946,16 @@ async function UNISWAP() {
19008
18946
  }
19009
18947
 
19010
18948
  const json = await res.json();
19011
- const filterColumnName = columnName?.split(',').map(s => s.trim());
19012
18949
  if (Array.isArray(json)) {
19013
18950
  // flatten nested
19014
18951
  return json.map(item => {
19015
18952
  const flat = {};
19016
18953
  Object.entries(item).forEach(([k, v]) => {
19017
- if ((columnName && filterColumnName.includes(k)) && (v === null || typeof v !== 'object')) flat[k] = v;
18954
+ if (v === null || typeof v !== 'object') flat[k] = v;
19018
18955
  });
19019
18956
  return flat
19020
18957
  })
19021
18958
  }
19022
- if(columnName && typeof json === 'object') {
19023
- const data = {};
19024
- filterColumnName.forEach(k => {
19025
- data[k] = json[k];
19026
- });
19027
- return data
19028
- }
19029
18959
  return json
19030
18960
  } catch (err) {
19031
18961
  return errorMessageHandler(err, 'UNISWAP')
@@ -19035,7 +18965,6 @@ async function UNISWAP() {
19035
18965
  async function SMARTCONTRACT() {
19036
18966
  try {
19037
18967
  const args = argsToArray(arguments);
19038
- console.log(args, arguments);
19039
18968
 
19040
18969
  return new Promise((resolve) => {
19041
18970
  resolve( {
@@ -29939,15 +29868,14 @@ class CirclesData {
29939
29868
  const circlesParamsSchema = objectType({
29940
29869
  functionName: enumType(['trust', 'profile', 'transactions', 'balances']),
29941
29870
  address: stringType().nonempty(),
29942
- entries: numberType().int().nonnegative().default(10),
29943
- columnName: stringType().optional(),
29871
+ entries: numberType().int().nonnegative().default(10)
29944
29872
  });
29945
29873
 
29946
29874
  async function CIRCLES() {
29947
29875
  try {
29948
- const [functionName, address, entries, columnName] = argsToArray(arguments);
29876
+ const [functionName, address, entries] = argsToArray(arguments);
29949
29877
 
29950
- validateParams(circlesParamsSchema, { functionName, address, entries, columnName });
29878
+ validateParams(circlesParamsSchema, { functionName, address, entries });
29951
29879
 
29952
29880
  const resolved = await fromEnsNameToAddress$1.validateAndGetAddress(address);
29953
29881
  const dataClient = new CirclesData('https://rpc.aboutcircles.com');
@@ -29965,34 +29893,10 @@ async function CIRCLES() {
29965
29893
 
29966
29894
  switch (functionName) {
29967
29895
  case 'trust':
29968
- const dataTrust = await runOnePage(dataClient.getTrustRelations(resolved, limit));
29969
- if (columnName) {
29970
- const filterColumnName = columnName.split(',').map(s => s.trim());
29971
- return dataTrust.map(obj =>
29972
- Object.fromEntries(
29973
- filterColumnName
29974
- .filter(key => key in obj)
29975
- .map(key => [key, obj[key]])
29976
- )
29977
- );
29978
- } else {
29979
- return dataTrust;
29980
- }
29896
+ return await runOnePage(dataClient.getTrustRelations(resolved, limit))
29981
29897
 
29982
29898
  case 'transactions':
29983
- const data = await runOnePage(dataClient.getTransactionHistory(resolved, limit));
29984
- if (columnName) {
29985
- const filterColumnName = columnName.split(',').map(s => s.trim());
29986
- return data.map(obj =>
29987
- Object.fromEntries(
29988
- filterColumnName
29989
- .filter(key => key in obj)
29990
- .map(key => [key, obj[key]])
29991
- )
29992
- );
29993
- } else {
29994
- return data;
29995
- }
29899
+ return await runOnePage(dataClient.getTransactionHistory(resolved, limit))
29996
29900
 
29997
29901
  case 'profile': {
29998
29902
  const res = await dataClient.getAvatarInfo(resolved);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/formulajs",
3
- "version": "4.4.38-col-3",
3
+ "version": "4.4.38",
4
4
  "description": "JavaScript implementation of most Microsoft Excel formula functions",
5
5
  "author": "Formulajs",
6
6
  "publishConfig": {