@fileverse-dev/formulajs 4.4.11-mod-93 → 4.4.11-mod-89-tally-2

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/cjs/index.cjs CHANGED
@@ -18475,214 +18475,35 @@ async function SMARTCONTRACT() {
18475
18475
  }
18476
18476
  }
18477
18477
 
18478
- var src = {};
18479
-
18480
- var lib = {exports: {}};
18481
-
18482
- /**
18483
- * The code was extracted from:
18484
- * https://github.com/davidchambers/Base64.js
18485
- */
18486
-
18487
- var atob$1;
18488
- var hasRequiredAtob;
18489
-
18490
- function requireAtob () {
18491
- if (hasRequiredAtob) return atob$1;
18492
- hasRequiredAtob = 1;
18493
- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
18494
-
18495
- function InvalidCharacterError(message) {
18496
- this.message = message;
18497
- }
18498
-
18499
- InvalidCharacterError.prototype = new Error();
18500
- InvalidCharacterError.prototype.name = 'InvalidCharacterError';
18501
-
18502
- function polyfill (input) {
18503
- var str = String(input).replace(/=+$/, '');
18504
- if (str.length % 4 == 1) {
18505
- throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
18506
- }
18507
- for (
18508
- // initialize result and counters
18509
- var bc = 0, bs, buffer, idx = 0, output = '';
18510
- // get next character
18511
- buffer = str.charAt(idx++);
18512
- // character found in table? initialize bit storage and add its ascii value;
18513
- ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
18514
- // and if not first of each 4 characters,
18515
- // convert the first 8 bits to one ascii character
18516
- bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
18517
- ) {
18518
- // try to find character in table (0-63, not found => -1)
18519
- buffer = chars.indexOf(buffer);
18520
- }
18521
- return output;
18522
- }
18523
-
18524
-
18525
- atob$1 = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;
18526
- return atob$1;
18527
- }
18528
-
18529
- var base64_url_decode;
18530
- var hasRequiredBase64_url_decode;
18531
-
18532
- function requireBase64_url_decode () {
18533
- if (hasRequiredBase64_url_decode) return base64_url_decode;
18534
- hasRequiredBase64_url_decode = 1;
18535
- var atob = requireAtob();
18536
-
18537
- function b64DecodeUnicode(str) {
18538
- return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {
18539
- var code = p.charCodeAt(0).toString(16).toUpperCase();
18540
- if (code.length < 2) {
18541
- code = '0' + code;
18542
- }
18543
- return '%' + code;
18544
- }));
18545
- }
18546
-
18547
- base64_url_decode = function(str) {
18548
- var output = str.replace(/-/g, "+").replace(/_/g, "/");
18549
- switch (output.length % 4) {
18550
- case 0:
18551
- break;
18552
- case 2:
18553
- output += "==";
18554
- break;
18555
- case 3:
18556
- output += "=";
18557
- break;
18558
- default:
18559
- throw "Illegal base64url string!";
18560
- }
18561
-
18562
- try{
18563
- return b64DecodeUnicode(output);
18564
- } catch (err) {
18565
- return atob(output);
18566
- }
18567
- };
18568
- return base64_url_decode;
18569
- }
18570
-
18571
- var hasRequiredLib;
18572
-
18573
- function requireLib () {
18574
- if (hasRequiredLib) return lib.exports;
18575
- hasRequiredLib = 1;
18576
-
18577
- var base64_url_decode = requireBase64_url_decode();
18578
-
18579
- function InvalidTokenError(message) {
18580
- this.message = message;
18581
- }
18582
-
18583
- InvalidTokenError.prototype = new Error();
18584
- InvalidTokenError.prototype.name = 'InvalidTokenError';
18585
-
18586
- lib.exports = function (token,options) {
18587
- if (typeof token !== 'string') {
18588
- throw new InvalidTokenError('Invalid token specified');
18589
- }
18590
-
18591
- options = options || {};
18592
- var pos = options.header === true ? 0 : 1;
18593
- try {
18594
- return JSON.parse(base64_url_decode(token.split('.')[pos]));
18595
- } catch (e) {
18596
- throw new InvalidTokenError('Invalid token specified: ' + e.message);
18597
- }
18598
- };
18599
-
18600
- lib.exports.InvalidTokenError = InvalidTokenError;
18601
- return lib.exports;
18602
- }
18603
-
18604
- /**
18605
- * @author Charles Markovich
18606
- * @summary Check if JWT is expired
18607
- * @description A global validator utility to share validation rules across all apps for a given project.
18608
- * @public
18609
- */
18610
-
18611
- var hasRequiredSrc;
18612
-
18613
- function requireSrc () {
18614
- if (hasRequiredSrc) return src;
18615
- hasRequiredSrc = 1;
18616
- var jwtDecode = requireLib();
18617
-
18618
- const isJwtExpired = (token) => {
18619
- if (typeof(token) !== 'string' || !token) throw new Error('Invalid token provided');
18620
-
18621
- let isJwtExpired = false;
18622
- const { exp } = jwtDecode(token);
18623
- const currentTime = new Date().getTime() / 1000;
18624
-
18625
- if (currentTime > exp) isJwtExpired = true;
18626
-
18627
- return isJwtExpired;
18628
- };
18629
-
18630
- src.isJwtExpired = isJwtExpired;
18631
- return src;
18632
- }
18633
-
18634
- var srcExports = requireSrc();
18635
-
18636
- function isExpired(access) {
18637
- return srcExports.isJwtExpired(access)
18638
- }
18639
-
18640
- async function GNOSISPAY() {
18478
+ const tallyParamsSchema = objectType({
18479
+ query: enumType(['organisation']),
18480
+ slug: stringType(),
18481
+ });
18641
18482
 
18483
+ async function TALLY() {
18642
18484
  try {
18643
- const access = window.localStorage.getItem('GNOSIS_PAY_ACCESS');
18485
+ const [query, slug] = argsToArray(arguments);
18644
18486
 
18645
- if(!access){
18646
- throw new ValidationError('Gnosispay access is required. Grant access to query your account')
18647
- }
18648
- if(!access || isExpired(access)){
18649
- throw new ValidationError('Expired or invalid access token')
18650
- }
18651
-
18652
- const url = new URL(`https://api.gnosispay.com/api/v1/transactions`);
18653
- const res = await fetch(url.toString(), {
18654
- headers: {
18655
- Authorization: `Bearer ${access.token}`,
18656
- 'Content-Type': 'application/json',
18657
- },
18658
- });
18487
+ validateParams(tallyParamsSchema, { query, slug });
18659
18488
 
18660
- if (!res.ok) throw new NetworkError('GNOSIS_PAY', res.status);
18661
-
18662
- const json = await res.json();
18663
- if(!Array.isArray(json)){
18664
- return [{message: 'Unexpected response'}]
18489
+ const baseUrl = 'http://localhost:3008/third-party';
18490
+ const url =
18491
+ `${baseUrl}` +
18492
+ `?service=tally` +
18493
+ `&input1=${encodeURIComponent(query)}` +
18494
+ `&input2=${encodeURIComponent(slug)}`;
18495
+ const res = await fetch(url);
18496
+ if (!res.ok) {
18497
+ throw new NetworkError('TALLY', res.status)
18665
18498
  }
18666
- const result = json.map((transactions) => {
18667
- return {
18668
- createdAt: transactions.createdAt,
18669
- clearedAt: transactions.clearedAt,
18670
- country: transactions.country?.name || '',
18671
- isPending: transactions.isPending,
18672
- mcc: transactions.mcc,
18673
- merchant: transactions.merchant?.name || '',
18674
- billingAmount: transactions.billingAmount,
18675
- billingCurrency: transactions.billingCurrency,
18676
- transactionAmount: transactions.transactionAmount,
18677
- transactionCurrency: transactions.transactionCurrency,
18678
- transactionType: transactions.transactionType,
18679
- kind: transactions.kind,
18680
- status: transactions.status
18681
- }
18682
- });
18683
- return result
18499
+
18500
+ const data = await res.json();
18501
+ if(data.organisation){
18502
+ return [data.organisation]
18503
+ }
18504
+ return data
18684
18505
  } catch (err) {
18685
- return errorMessageHandler(err, 'GNOSISPAY')
18506
+ return errorMessageHandler(err, 'TALLY')
18686
18507
  }
18687
18508
  }
18688
18509
 
@@ -18714,10 +18535,6 @@ function ARTEMIS() {
18714
18535
  return 'Coming Soon'
18715
18536
  }
18716
18537
 
18717
- function TALLY() {
18718
- return 'Coming Soon'
18719
- }
18720
-
18721
18538
  function MYANIMELIST() {
18722
18539
  return 'Coming Soon'
18723
18540
  }
@@ -18887,7 +18704,6 @@ exports.GCD = GCD;
18887
18704
  exports.GEOMEAN = GEOMEAN;
18888
18705
  exports.GESTEP = GESTEP;
18889
18706
  exports.GNOSIS = GNOSIS;
18890
- exports.GNOSISPAY = GNOSISPAY;
18891
18707
  exports.GROWTH = GROWTH;
18892
18708
  exports.HARMEAN = HARMEAN;
18893
18709
  exports.HEX2BIN = HEX2BIN;
@@ -1,138 +1,3 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
- // If the importer is in node compatibility mode or this is not an ESM
20
- // file that has been converted to a CommonJS file using a Babel-
21
- // compatible transform (i.e. "__esModule" has not been set), then set
22
- // "default" to the CommonJS "module.exports" for node compatibility.
23
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
- mod
25
- ));
26
-
27
- // node_modules/jwt-decode/lib/atob.js
28
- var require_atob = __commonJS({
29
- "node_modules/jwt-decode/lib/atob.js"(exports, module) {
30
- var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
31
- function InvalidCharacterError(message) {
32
- this.message = message;
33
- }
34
- InvalidCharacterError.prototype = new Error();
35
- InvalidCharacterError.prototype.name = "InvalidCharacterError";
36
- function polyfill(input) {
37
- var str = String(input).replace(/=+$/, "");
38
- if (str.length % 4 == 1) {
39
- throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
40
- }
41
- for (
42
- var bc = 0, bs, buffer, idx = 0, output = "";
43
- // get next character
44
- buffer = str.charAt(idx++);
45
- // character found in table? initialize bit storage and add its ascii value;
46
- ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, // and if not first of each 4 characters,
47
- // convert the first 8 bits to one ascii character
48
- bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
49
- ) {
50
- buffer = chars.indexOf(buffer);
51
- }
52
- return output;
53
- }
54
- module.exports = typeof window !== "undefined" && window.atob && window.atob.bind(window) || polyfill;
55
- }
56
- });
57
-
58
- // node_modules/jwt-decode/lib/base64_url_decode.js
59
- var require_base64_url_decode = __commonJS({
60
- "node_modules/jwt-decode/lib/base64_url_decode.js"(exports, module) {
61
- var atob = require_atob();
62
- function b64DecodeUnicode(str) {
63
- return decodeURIComponent(atob(str).replace(/(.)/g, function(m, p) {
64
- var code = p.charCodeAt(0).toString(16).toUpperCase();
65
- if (code.length < 2) {
66
- code = "0" + code;
67
- }
68
- return "%" + code;
69
- }));
70
- }
71
- module.exports = function(str) {
72
- var output = str.replace(/-/g, "+").replace(/_/g, "/");
73
- switch (output.length % 4) {
74
- case 0:
75
- break;
76
- case 2:
77
- output += "==";
78
- break;
79
- case 3:
80
- output += "=";
81
- break;
82
- default:
83
- throw "Illegal base64url string!";
84
- }
85
- try {
86
- return b64DecodeUnicode(output);
87
- } catch (err) {
88
- return atob(output);
89
- }
90
- };
91
- }
92
- });
93
-
94
- // node_modules/jwt-decode/lib/index.js
95
- var require_lib = __commonJS({
96
- "node_modules/jwt-decode/lib/index.js"(exports, module) {
97
- "use strict";
98
- var base64_url_decode = require_base64_url_decode();
99
- function InvalidTokenError(message) {
100
- this.message = message;
101
- }
102
- InvalidTokenError.prototype = new Error();
103
- InvalidTokenError.prototype.name = "InvalidTokenError";
104
- module.exports = function(token, options) {
105
- if (typeof token !== "string") {
106
- throw new InvalidTokenError("Invalid token specified");
107
- }
108
- options = options || {};
109
- var pos = options.header === true ? 0 : 1;
110
- try {
111
- return JSON.parse(base64_url_decode(token.split(".")[pos]));
112
- } catch (e) {
113
- throw new InvalidTokenError("Invalid token specified: " + e.message);
114
- }
115
- };
116
- module.exports.InvalidTokenError = InvalidTokenError;
117
- }
118
- });
119
-
120
- // node_modules/jwt-check-expiration/src/index.js
121
- var require_src = __commonJS({
122
- "node_modules/jwt-check-expiration/src/index.js"(exports, module) {
123
- var jwtDecode = require_lib();
124
- var isJwtExpired2 = (token) => {
125
- if (typeof token !== "string" || !token) throw new Error("Invalid token provided");
126
- let isJwtExpired3 = false;
127
- const { exp } = jwtDecode(token);
128
- const currentTime = (/* @__PURE__ */ new Date()).getTime() / 1e3;
129
- if (currentTime > exp) isJwtExpired3 = true;
130
- return isJwtExpired3;
131
- };
132
- module.exports.isJwtExpired = isJwtExpired2;
133
- }
134
- });
135
-
136
1
  // src/utils/constants.js
137
2
  var CHAIN_ID_MAP = {
138
3
  ethereum: 1,
@@ -847,16 +712,31 @@ var SMARTCONTRACT_metadata = {
847
712
  ]
848
713
  };
849
714
 
850
- // src/crypto/gnosispay/metadata.js
851
- var GNOSISPAY_metadata = {
852
- LOGO: "https://gnosisscan.io/assets/generic/html/favicon-light.ico",
853
- BRAND_COLOR: "#F6F7F6",
854
- BRAND_SECONDARY_COLOR: "#84968f",
855
- n: "GNOSISPAY",
715
+ // src/crypto/tally/metadata.js
716
+ var TALLY_metadata = {
717
+ LOGO: "https://www.tally.xyz/favicon.ico",
718
+ BRAND_COLOR: "#f9f8ff",
719
+ BRAND_SECONDARY_COLOR: "#725bff",
720
+ n: "TALLY",
856
721
  t: 20,
857
- d: "Access transactions, balances, and more from your Gnosis Pay account.",
858
- a: "Access transactions, balances, and more from your Gnosis Pay account.",
859
- p: []
722
+ d: "Query information on tally",
723
+ a: "Query information on tally",
724
+ p: [
725
+ {
726
+ name: "query",
727
+ detail: "Type of query you want make on tally",
728
+ example: `"organisation"`,
729
+ require: "m",
730
+ type: "string"
731
+ },
732
+ {
733
+ name: "input1",
734
+ detail: "Query input",
735
+ example: `"arbitrum"`,
736
+ require: "m",
737
+ type: "string"
738
+ }
739
+ ]
860
740
  };
861
741
 
862
742
  // src/crypto/crypto-metadata.js
@@ -877,7 +757,7 @@ var FUNCTION_LOCALE = [
877
757
  FIREFLY_metadata,
878
758
  Neynar_metadata,
879
759
  SMARTCONTRACT_metadata,
880
- GNOSISPAY_metadata,
760
+ TALLY_metadata,
881
761
  {
882
762
  LOGO: "https://raw.githubusercontent.com/mritunjayz/github-storage/refs/heads/main/ploymarket.png",
883
763
  n: "POLYMARKET",
@@ -935,12 +815,6 @@ var FUNCTION_LOCALE = [
935
815
  p: []
936
816
  }
937
817
  ];
938
-
939
- // src/crypto/gnosispay/gnosispay.js
940
- var import_jwt_check_expiration = __toESM(require_src(), 1);
941
- function isExpired(access) {
942
- return (0, import_jwt_check_expiration.isJwtExpired)(access);
943
- }
944
818
  export {
945
819
  BLOCKSCOUT_CHAINS_MAP,
946
820
  CHAIN_ID_MAP,
@@ -949,6 +823,5 @@ export {
949
823
  MAX_PAGE_LIMIT,
950
824
  SAFE_CHAIN_MAP,
951
825
  SERVICES_API_KEY,
952
- UTILITY,
953
- isExpired as isGnosisPayAccessExpired
826
+ UTILITY
954
827
  };