@collabland/common
Advanced tools
Comparing version 0.31.0 to 0.32.0
@@ -145,5 +145,6 @@ "use strict"; | ||
}, | ||
envVarName: 'COLLABLAND_API_SERVER_NAME', | ||
}, | ||
SecretName: { | ||
template: 'collabland-api/${envType}', | ||
template: 'collabland-api/${envName}', | ||
mappedNames: { | ||
@@ -150,0 +151,0 @@ [EnvType.PROD]: 'collabland-api/prod', |
@@ -0,1 +1,3 @@ | ||
/// <reference types="node" /> | ||
import { URL } from 'url'; | ||
export * from 'cross-fetch'; | ||
@@ -17,3 +19,3 @@ export { default as HttpErrors } from 'http-errors'; | ||
*/ | ||
export declare type FetchInterceptor = (next: InvokeFetch, info: RequestInfo, init: RequestInit) => Promise<Response>; | ||
export declare type FetchInterceptor = (next: InvokeFetch, info: RequestInfo | URL, init: RequestInit) => Promise<Response>; | ||
/** | ||
@@ -20,0 +22,0 @@ * Options to get an instance of `Fetch` |
@@ -9,6 +9,7 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const bignumber_1 = require("@ethersproject/bignumber"); | ||
const jsonata_1 = tslib_1.__importDefault(require("jsonata")); | ||
const lodash_1 = tslib_1.__importDefault(require("lodash")); | ||
const minimatch_1 = require("minimatch"); | ||
const bignumber_1 = require("./bignumber"); | ||
const bignumber_2 = require("./bignumber"); | ||
const debug_1 = require("./debug"); | ||
@@ -81,3 +82,3 @@ const http_client_fetch_1 = require("./http-client-fetch"); | ||
val = val !== null && val !== void 0 ? val : '0'; | ||
return (0, bignumber_1.toBigNumber)(val); | ||
return (0, bignumber_2.toBigNumber)(val); | ||
} | ||
@@ -95,3 +96,3 @@ function _add(a, b) { | ||
const vals = Array.isArray(items) ? items : [items]; | ||
let result = bignumber_1.BN.from(0); | ||
let result = bignumber_2.BN.from(0); | ||
vals.forEach(v => { | ||
@@ -121,4 +122,4 @@ result = result.add(toBN(v)); | ||
return undefined; | ||
const x = (0, bignumber_1.toBigNumber)(a); | ||
const y = (0, bignumber_1.toBigNumber)(b); | ||
const x = (0, bignumber_2.toBigNumber)(a); | ||
const y = (0, bignumber_2.toBigNumber)(b); | ||
let result; | ||
@@ -283,3 +284,8 @@ if (x.gt(y)) { | ||
var _a; | ||
const count = tokens.filter(t => matchesTraitsPerToken(t, traits)).length; | ||
const count = tokens.reduce((total, t) => { | ||
var _a; | ||
return matchesTraitsPerToken(t, traits) | ||
? _add(total, (_a = t.balance) !== null && _a !== void 0 ? _a : '1') | ||
: total; | ||
}, bignumber_1.BigNumber.from(0)); | ||
return _between(count, (_a = traits.minCount) !== null && _a !== void 0 ? _a : 1, traits.maxCount); | ||
@@ -303,3 +309,3 @@ }; | ||
if (balances == null) | ||
return bignumber_1.BN.from(0); | ||
return bignumber_2.BN.from(0); | ||
if (!Array.isArray(balances)) { | ||
@@ -495,3 +501,3 @@ balances = [balances]; | ||
try { | ||
hexIdString = bignumber_1.BN.from(idStr).toHexString(); | ||
hexIdString = bignumber_2.BN.from(idStr).toHexString(); | ||
} | ||
@@ -523,5 +529,5 @@ catch (err) { | ||
try { | ||
const val = bignumber_1.BN.from(idStr); | ||
return ((range[0] === '' || val.gte(bignumber_1.BN.from(range[0]))) && | ||
(range[1] === '' || val.lte(bignumber_1.BN.from(range[1])))); | ||
const val = bignumber_2.BN.from(idStr); | ||
return ((range[0] === '' || val.gte(bignumber_2.BN.from(range[0]))) && | ||
(range[1] === '' || val.lte(bignumber_2.BN.from(range[1])))); | ||
} | ||
@@ -528,0 +534,0 @@ catch (err) { |
{ | ||
"name": "@collabland/common", | ||
"version": "0.31.0", | ||
"version": "0.32.0", | ||
"description": "CollabLand common utilities", | ||
@@ -52,3 +52,3 @@ "main": "dist/index.js", | ||
"p-map": "^4.0.0", | ||
"pino": "^7.3.0", | ||
"pino": "^8.0.0", | ||
"tslib": "^2.0.0" | ||
@@ -66,3 +66,3 @@ }, | ||
"author": "Abridged, Inc.", | ||
"gitHead": "77c49c79497520440839ab041695d4b3f99f86d9" | ||
"gitHead": "4e9414d0d7713c5b9b65b63e5b50f316f19c257b" | ||
} |
@@ -167,5 +167,6 @@ // Copyright Abridged, Inc. 2021. All Rights Reserved. | ||
}, | ||
envVarName: 'COLLABLAND_API_SERVER_NAME', | ||
}, | ||
SecretName: { | ||
template: 'collabland-api/${envType}', | ||
template: 'collabland-api/${envName}', | ||
mappedNames: { | ||
@@ -172,0 +173,0 @@ [EnvType.PROD]: 'collabland-api/prod', |
@@ -8,2 +8,3 @@ // Copyright Abridged, Inc. 2021. All Rights Reserved. | ||
import HttpErrors from 'http-errors'; | ||
import {URL} from 'url'; | ||
import {debugFactory, stringify} from './debug'; | ||
@@ -73,3 +74,3 @@ | ||
next: InvokeFetch, | ||
info: RequestInfo, | ||
info: RequestInfo | URL, | ||
init: RequestInit, | ||
@@ -76,0 +77,0 @@ ) => Promise<Response>; |
@@ -6,2 +6,3 @@ // Copyright Abridged, Inc. 2021. All Rights Reserved. | ||
import {BigNumber} from '@ethersproject/bignumber'; | ||
import jsonata, {Expression, Focus} from 'jsonata'; | ||
@@ -383,5 +384,9 @@ import lodash from 'lodash'; | ||
const fn = (traits: TraitFilterPerToken) => { | ||
const count = tokens.filter(t => | ||
matchesTraitsPerToken(t, traits), | ||
).length; | ||
const count = tokens.reduce<BigNumber>( | ||
(total, t) => | ||
matchesTraitsPerToken(t, traits) | ||
? _add(total, t.balance ?? '1') | ||
: total, | ||
BigNumber.from(0), | ||
); | ||
return _between(count, traits.minCount ?? 1, traits.maxCount); | ||
@@ -388,0 +393,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
186634
4601
+ Addedabort-controller@3.0.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedevent-target-shim@5.0.1(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedon-exit-leak-free@2.1.2(transitive)
+ Addedpino@8.21.0(transitive)
+ Addedpino-abstract-transport@1.2.0(transitive)
+ Addedpino-std-serializers@6.2.2(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedprocess-warning@3.0.0(transitive)
+ Addedreadable-stream@4.7.0(transitive)
+ Addedreal-require@0.2.0(transitive)
+ Addedsonic-boom@3.8.1(transitive)
+ Addedsplit2@4.2.0(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedthread-stream@2.7.0(transitive)
- Removedon-exit-leak-free@0.2.0(transitive)
- Removedpino@7.11.0(transitive)
- Removedpino-std-serializers@4.0.0(transitive)
- Removedprocess-warning@1.0.0(transitive)
- Removedreal-require@0.1.0(transitive)
- Removedsonic-boom@2.8.0(transitive)
- Removedthread-stream@0.15.2(transitive)
Updatedpino@^8.0.0