@0xpolygonid/js-sdk 1.27.2 → 1.27.3
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/dist/browser/esm/index.js +74 -34
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +73 -33
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/storage/filters/jsonQuery.js +74 -34
- package/dist/node/esm/storage/filters/jsonQuery.js +73 -33
- package/dist/types/storage/filters/jsonQuery.d.ts +12 -0
- package/package.json +1 -1
|
@@ -56898,6 +56898,19 @@ var SearchError;
|
|
|
56898
56898
|
SearchError["NotDefinedQueryKey"] = "not defined query key";
|
|
56899
56899
|
SearchError["NotDefinedComparator"] = "not defined comparator";
|
|
56900
56900
|
})(SearchError || (SearchError = {}));
|
|
56901
|
+
/**
|
|
56902
|
+
* supported data formats
|
|
56903
|
+
*
|
|
56904
|
+
* @enum {number}
|
|
56905
|
+
*/
|
|
56906
|
+
var SupportedDataFormat;
|
|
56907
|
+
(function (SupportedDataFormat) {
|
|
56908
|
+
SupportedDataFormat[SupportedDataFormat["BigInt"] = 0] = "BigInt";
|
|
56909
|
+
SupportedDataFormat[SupportedDataFormat["Boolean"] = 1] = "Boolean";
|
|
56910
|
+
SupportedDataFormat[SupportedDataFormat["Double"] = 2] = "Double";
|
|
56911
|
+
SupportedDataFormat[SupportedDataFormat["DateTime"] = 3] = "DateTime";
|
|
56912
|
+
SupportedDataFormat[SupportedDataFormat["String"] = 4] = "String";
|
|
56913
|
+
})(SupportedDataFormat || (SupportedDataFormat = {}));
|
|
56901
56914
|
const truthyValues = [true, 1, 'true'];
|
|
56902
56915
|
const falsyValues = [false, 0, 'false'];
|
|
56903
56916
|
const equalsComparator = (a, b) => {
|
|
@@ -56921,40 +56934,38 @@ const equalsComparator = (a, b) => {
|
|
|
56921
56934
|
return a === b;
|
|
56922
56935
|
};
|
|
56923
56936
|
const greaterThan = (a, b) => {
|
|
56924
|
-
|
|
56925
|
-
|
|
56926
|
-
|
|
56927
|
-
|
|
56928
|
-
|
|
56929
|
-
|
|
56930
|
-
|
|
56931
|
-
|
|
56932
|
-
|
|
56933
|
-
|
|
56937
|
+
const predicate = (a, b) => {
|
|
56938
|
+
const dataFormat = detectDataFormat(a.toString());
|
|
56939
|
+
switch (dataFormat) {
|
|
56940
|
+
case SupportedDataFormat.BigInt:
|
|
56941
|
+
case SupportedDataFormat.Boolean:
|
|
56942
|
+
return BigInt(a) > BigInt(b);
|
|
56943
|
+
case SupportedDataFormat.DateTime:
|
|
56944
|
+
return Date.parse(a.toString()) > Date.parse(b.toString()); /// nanoseconds won't be compared.
|
|
56945
|
+
case SupportedDataFormat.Double:
|
|
56946
|
+
case SupportedDataFormat.String:
|
|
56947
|
+
default:
|
|
56948
|
+
return a > b;
|
|
56949
|
+
}
|
|
56950
|
+
};
|
|
56951
|
+
return operatorIndependentCheck(a, b, predicate);
|
|
56934
56952
|
};
|
|
56935
56953
|
const greaterThanOrEqual = (a, b) => {
|
|
56936
|
-
|
|
56937
|
-
|
|
56938
|
-
|
|
56939
|
-
|
|
56940
|
-
|
|
56941
|
-
|
|
56942
|
-
|
|
56943
|
-
|
|
56944
|
-
|
|
56945
|
-
|
|
56946
|
-
|
|
56947
|
-
|
|
56948
|
-
|
|
56949
|
-
|
|
56950
|
-
|
|
56951
|
-
if (!Array.isArray(a) && Array.isArray(b)) {
|
|
56952
|
-
return b.every((val) => a <= val);
|
|
56953
|
-
}
|
|
56954
|
-
if (Array.isArray(a) && !Array.isArray(b)) {
|
|
56955
|
-
return a.every((val) => val <= b);
|
|
56956
|
-
}
|
|
56957
|
-
return a <= b;
|
|
56954
|
+
const predicate = (a, b) => {
|
|
56955
|
+
const dataFormat = detectDataFormat(a.toString());
|
|
56956
|
+
switch (dataFormat) {
|
|
56957
|
+
case SupportedDataFormat.BigInt:
|
|
56958
|
+
case SupportedDataFormat.Boolean:
|
|
56959
|
+
return BigInt(a) >= BigInt(b);
|
|
56960
|
+
case SupportedDataFormat.DateTime:
|
|
56961
|
+
return Date.parse(a.toString()) >= Date.parse(b.toString()); /// nanoseconds won't be compared.
|
|
56962
|
+
case SupportedDataFormat.Double:
|
|
56963
|
+
case SupportedDataFormat.String:
|
|
56964
|
+
default:
|
|
56965
|
+
return a >= b;
|
|
56966
|
+
}
|
|
56967
|
+
};
|
|
56968
|
+
return operatorIndependentCheck(a, b, predicate);
|
|
56958
56969
|
};
|
|
56959
56970
|
// a - field value
|
|
56960
56971
|
// b - true / false (exists operator values)
|
|
@@ -57003,7 +57014,7 @@ const comparatorOptions = {
|
|
|
57003
57014
|
$lt: (a, b) => !greaterThanOrEqual(a, b),
|
|
57004
57015
|
$ne: (a, b) => !equalsComparator(a, b),
|
|
57005
57016
|
$gte: (a, b) => greaterThanOrEqual(a, b),
|
|
57006
|
-
$lte: (a, b) =>
|
|
57017
|
+
$lte: (a, b) => !greaterThan(a, b),
|
|
57007
57018
|
$between: (a, b) => betweenOperator(a, b),
|
|
57008
57019
|
$nonbetween: (a, b) => !betweenOperator(a, b)
|
|
57009
57020
|
};
|
|
@@ -57117,6 +57128,35 @@ const StandardJSONCredentialsQueryFilter = (query) => {
|
|
|
57117
57128
|
}
|
|
57118
57129
|
}, []);
|
|
57119
57130
|
};
|
|
57131
|
+
const operatorIndependentCheck = (a, b, predicate) => {
|
|
57132
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
57133
|
+
return a.every((val, index) => predicate(val, b[index]));
|
|
57134
|
+
}
|
|
57135
|
+
if (!Array.isArray(a) && Array.isArray(b)) {
|
|
57136
|
+
return b.every((val) => predicate(a, val));
|
|
57137
|
+
}
|
|
57138
|
+
if (Array.isArray(a) && !Array.isArray(b)) {
|
|
57139
|
+
return a.every((val) => predicate(val, b));
|
|
57140
|
+
}
|
|
57141
|
+
// in this case a and b are not arrays
|
|
57142
|
+
return predicate(a, b);
|
|
57143
|
+
};
|
|
57144
|
+
const regExBigInt = /^[+-]?\d+$/;
|
|
57145
|
+
const regExDouble = /^(-?)(0|([1-9][0-9]*))(\\.[0-9]+)?$/;
|
|
57146
|
+
const regExDateTimeRFC3339Nano =
|
|
57147
|
+
/* eslint-disable-next-line */
|
|
57148
|
+
/^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([\+|\-]([01][0-9]|2[0-3]):[0-5][0-9]))$/;
|
|
57149
|
+
const regExBoolean = /^(true)|(false)$/;
|
|
57150
|
+
const regExDateTimeYYYYMMDD = /^\d{4}-\d{2}-\d{2}$/;
|
|
57151
|
+
const detectDataFormat = (s) => regExBigInt.test(s)
|
|
57152
|
+
? SupportedDataFormat.BigInt
|
|
57153
|
+
: regExDouble.test(s)
|
|
57154
|
+
? SupportedDataFormat.Double
|
|
57155
|
+
: regExDateTimeRFC3339Nano.test(s) || regExDateTimeYYYYMMDD.test(s)
|
|
57156
|
+
? SupportedDataFormat.DateTime
|
|
57157
|
+
: regExBoolean.test(s)
|
|
57158
|
+
? SupportedDataFormat.Boolean
|
|
57159
|
+
: SupportedDataFormat.String;
|
|
57120
57160
|
|
|
57121
57161
|
const MERKLE_TREE_TYPES = [
|
|
57122
57162
|
MerkleTreeType.Claims,
|
|
@@ -64049,5 +64089,5 @@ class IdentityWallet {
|
|
|
64049
64089
|
}
|
|
64050
64090
|
}
|
|
64051
64091
|
|
|
64052
|
-
export { AbstractMessageHandler, AbstractPrivateKeyStore, AgentResolver, AtomicQueryMTPV2Inputs, AtomicQueryMTPV2OnChainInputs, AtomicQueryMTPV2OnChainPubSignals, AtomicQueryMTPV2PubSignals, AtomicQuerySigV2Inputs, AtomicQuerySigV2OnChainCircuitInputs, AtomicQuerySigV2OnChainInputs, AtomicQuerySigV2OnChainPubSignals, AtomicQuerySigV2PubSignals, AtomicQueryV3Inputs, AtomicQueryV3OnChainInputs, AtomicQueryV3OnChainPubSignals, AtomicQueryV3PubSignals, AuthHandler, AuthV2Inputs, AuthV2PubSignals, BJJSignatureProof2021, BaseConfig, BjjProvider, BrowserDataSource, CircuitClaim, CircuitError, CircuitId, CircuitStorage, ContractRequestHandler, CredentialOfferStatus, CredentialProposalHandler, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DIDDocumentSignature, DataPrepareHandlerFunc, DidDocumentCredentialStatusResolver, DidResolverStateReadonlyStorage, DiscoverFeatureQueryType, DiscoveryProtocolFeatureType, DiscoveryProtocolHandler, DisplayMethodType, Ed25519Provider, ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof, ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof, EthStateStorage, FSCircuitStorage, FetchHandler, FilterQuery, FunctionSignatures, Iden3OnchainSmtCredentialStatusPublisher, Iden3SmtRhsCredentialStatusPublisher, Iden3SparseMerkleTreeProof, IdentityStorage, IdentityWallet, InMemoryDataSource, InMemoryMerkleTreeStorage, InMemoryPrivateKeyStore, IndexedDBDataSource, IndexedDBPrivateKeyStore, InputGenerator, IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY, JWSPacker, JsonSchemaValidator, KMS, KmsKeyType, LDParser, LinkedMultiQueryInputs, LinkedMultiQueryPubSignals, LocalStoragePrivateKeyStore, MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage, MerkleTreeType, MerklizedRootPosition, MessageBus, MessageHandler, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, OnchainIssuer, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PaymentFeatures, PaymentHandler, PaymentRequestDataType, PaymentType, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, PubSignalsVerifier, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, RevocationStatusHandler, SDK_EVENTS, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, SupportedCurrencies, SupportedPaymentProofType, TransactionService, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes$1 as base58ToBytes, base64ToBytes$1 as base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, bigIntCompare, buildAccept, buildDIDFromEthPubKey, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58$1 as bytesToBase58, bytesToBase64, bytesToBase64url$1 as bytesToBase64url, bytesToHex$3 as bytesToHex, cacheLoader, calculateCoreSchemaHash, calculateQueryHashV2, calculateQueryHashV3, checkCircuitOperator, checkCircuitQueriesLength, checkDataInField, checkQueryRequest, circuitValidator, comparatorOptions, createAuthorizationRequest, createAuthorizationRequestWithMessage, createDiscoveryFeatureDiscloseMessage, createDiscoveryFeatureQueryMessage, createPayment, createPaymentRequest, createProposal, createProposalRequest, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url$1 as decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fieldValueFromVerifiablePresentation, fillCoreClaimSlot, fillSlot, findCredentialType, findValue, generateProfileDID, getERC20Decimals, getFieldSlotIndex, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getOperatorNameByValue, getPermitSignature, getProperties, getSerializationAttrFromContext, getSerializationAttrFromParsedContext, getUserDIDFromCredential, hexToBytes$3 as hexToBytes, isEthereumIdentity, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseAcceptProfile, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, processZeroKnowledgeProofRequests, pushHashesToRHS, resolveDIDDocumentAuth, resolveDidDocument, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, userStateError, validateDIDDocumentAuth, validateDisclosureNativeSDSupport, validateDisclosureV2Circuit, validateEmptyCredentialSubjectNoopNativeSupport, validateEmptyCredentialSubjectV2Circuit, validateOperators, validateTreeState, verifyEIP712TypedData, verifyExpiresTime, verifyFieldValueInclusionNativeExistsSupport, verifyFieldValueInclusionV2, witnessBuilder };
|
|
64092
|
+
export { AbstractMessageHandler, AbstractPrivateKeyStore, AgentResolver, AtomicQueryMTPV2Inputs, AtomicQueryMTPV2OnChainInputs, AtomicQueryMTPV2OnChainPubSignals, AtomicQueryMTPV2PubSignals, AtomicQuerySigV2Inputs, AtomicQuerySigV2OnChainCircuitInputs, AtomicQuerySigV2OnChainInputs, AtomicQuerySigV2OnChainPubSignals, AtomicQuerySigV2PubSignals, AtomicQueryV3Inputs, AtomicQueryV3OnChainInputs, AtomicQueryV3OnChainPubSignals, AtomicQueryV3PubSignals, AuthHandler, AuthV2Inputs, AuthV2PubSignals, BJJSignatureProof2021, BaseConfig, BjjProvider, BrowserDataSource, CircuitClaim, CircuitError, CircuitId, CircuitStorage, ContractRequestHandler, CredentialOfferStatus, CredentialProposalHandler, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DIDDocumentSignature, DataPrepareHandlerFunc, DidDocumentCredentialStatusResolver, DidResolverStateReadonlyStorage, DiscoverFeatureQueryType, DiscoveryProtocolFeatureType, DiscoveryProtocolHandler, DisplayMethodType, Ed25519Provider, ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof, ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof, EthStateStorage, FSCircuitStorage, FetchHandler, FilterQuery, FunctionSignatures, Iden3OnchainSmtCredentialStatusPublisher, Iden3SmtRhsCredentialStatusPublisher, Iden3SparseMerkleTreeProof, IdentityStorage, IdentityWallet, InMemoryDataSource, InMemoryMerkleTreeStorage, InMemoryPrivateKeyStore, IndexedDBDataSource, IndexedDBPrivateKeyStore, InputGenerator, IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY, JWSPacker, JsonSchemaValidator, KMS, KmsKeyType, LDParser, LinkedMultiQueryInputs, LinkedMultiQueryPubSignals, LocalStoragePrivateKeyStore, MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage, MerkleTreeType, MerklizedRootPosition, MessageBus, MessageHandler, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, OnchainIssuer, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PaymentFeatures, PaymentHandler, PaymentRequestDataType, PaymentType, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, PubSignalsVerifier, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, RevocationStatusHandler, SDK_EVENTS, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, SupportedCurrencies, SupportedDataFormat, SupportedPaymentProofType, TransactionService, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes$1 as base58ToBytes, base64ToBytes$1 as base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, bigIntCompare, buildAccept, buildDIDFromEthPubKey, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58$1 as bytesToBase58, bytesToBase64, bytesToBase64url$1 as bytesToBase64url, bytesToHex$3 as bytesToHex, cacheLoader, calculateCoreSchemaHash, calculateQueryHashV2, calculateQueryHashV3, checkCircuitOperator, checkCircuitQueriesLength, checkDataInField, checkQueryRequest, circuitValidator, comparatorOptions, createAuthorizationRequest, createAuthorizationRequestWithMessage, createDiscoveryFeatureDiscloseMessage, createDiscoveryFeatureQueryMessage, createPayment, createPaymentRequest, createProposal, createProposalRequest, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url$1 as decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fieldValueFromVerifiablePresentation, fillCoreClaimSlot, fillSlot, findCredentialType, findValue, generateProfileDID, getERC20Decimals, getFieldSlotIndex, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getOperatorNameByValue, getPermitSignature, getProperties, getSerializationAttrFromContext, getSerializationAttrFromParsedContext, getUserDIDFromCredential, hexToBytes$3 as hexToBytes, isEthereumIdentity, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseAcceptProfile, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, processZeroKnowledgeProofRequests, pushHashesToRHS, resolveDIDDocumentAuth, resolveDidDocument, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, userStateError, validateDIDDocumentAuth, validateDisclosureNativeSDSupport, validateDisclosureV2Circuit, validateEmptyCredentialSubjectNoopNativeSupport, validateEmptyCredentialSubjectV2Circuit, validateOperators, validateTreeState, verifyEIP712TypedData, verifyExpiresTime, verifyFieldValueInclusionNativeExistsSupport, verifyFieldValueInclusionV2, witnessBuilder };
|
|
64053
64093
|
//# sourceMappingURL=index.js.map
|