@wishknish/knishio-client-js 0.6.4 → 0.7.5
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/client.cjs.js +567 -0
- package/dist/client.cjs.js.map +1 -0
- package/dist/client.es.mjs +8665 -0
- package/dist/client.es.mjs.map +1 -0
- package/dist/client.iife.js +84 -45
- package/dist/client.iife.js.map +1 -0
- package/package.json +48 -28
- package/src/Atom.js +132 -5
- package/src/AtomMeta.js +7 -8
- package/src/AuthToken.js +1 -1
- package/src/KnishIOClient.js +180 -78
- package/src/Meta.js +6 -2
- package/src/Molecule.js +383 -44
- package/src/PolicyMeta.js +1 -1
- package/src/Wallet.js +67 -12
- package/src/exception/AtomIndexException.js +1 -1
- package/src/exception/AtomsMissingException.js +1 -1
- package/src/exception/AuthorizationRejectedException.js +1 -1
- package/src/exception/BalanceInsufficientException.js +1 -1
- package/src/exception/BatchIdException.js +1 -1
- package/src/exception/CodeException.js +1 -1
- package/src/exception/DecryptionKeyException.js +1 -1
- package/src/exception/InvalidResponseException.js +1 -1
- package/src/exception/MetaMissingException.js +1 -1
- package/src/exception/MolecularHashMismatchException.js +1 -1
- package/src/exception/MolecularHashMissingException.js +1 -1
- package/src/exception/NegativeAmountException.js +1 -1
- package/src/exception/PolicyInvalidException.js +1 -1
- package/src/exception/SignatureMalformedException.js +1 -1
- package/src/exception/SignatureMismatchException.js +1 -1
- package/src/exception/StackableUnitAmountException.js +1 -1
- package/src/exception/StackableUnitDecimalsException.js +1 -1
- package/src/exception/TransferBalanceException.js +1 -1
- package/src/exception/TransferMalformedException.js +1 -1
- package/src/exception/TransferMismatchedException.js +1 -1
- package/src/exception/TransferRemainderException.js +1 -1
- package/src/exception/TransferToSelfException.js +1 -1
- package/src/exception/TransferUnbalancedException.js +1 -1
- package/src/exception/UnauthenticatedException.js +1 -1
- package/src/exception/WalletCredentialException.js +1 -1
- package/src/exception/WalletShadowException.js +1 -1
- package/src/exception/WrongTokenTypeException.js +1 -1
- package/src/exception/index.js +25 -25
- package/src/index.js +29 -9
- package/src/instance/Rules/Callback.js +5 -5
- package/src/instance/Rules/Condition.js +1 -1
- package/src/instance/Rules/Rule.js +4 -4
- package/src/instance/Rules/exception/RuleArgumentException.js +1 -1
- package/src/libraries/CheckMolecule.js +285 -27
- package/src/libraries/crypto.js +16 -2
- package/src/libraries/strings.js +1 -1
- package/src/libraries/urql/UrqlClientWrapper.js +3 -1
- package/src/mutation/Mutation.js +2 -2
- package/src/mutation/MutationActiveSession.js +2 -2
- package/src/mutation/MutationAppendRequest.js +91 -0
- package/src/mutation/MutationClaimShadowWallet.js +3 -3
- package/src/mutation/MutationCreateIdentifier.js +2 -2
- package/src/mutation/MutationCreateMeta.js +2 -2
- package/src/mutation/MutationCreateRule.js +2 -2
- package/src/mutation/MutationCreateToken.js +2 -2
- package/src/mutation/MutationCreateWallet.js +2 -2
- package/src/mutation/MutationDepositBufferToken.js +1 -1
- package/src/mutation/MutationLinkIdentifier.js +2 -2
- package/src/mutation/MutationPeering.js +82 -0
- package/src/mutation/MutationProposeMolecule.js +2 -2
- package/src/mutation/MutationRequestAuthorization.js +2 -2
- package/src/mutation/MutationRequestAuthorizationGuest.js +2 -2
- package/src/mutation/MutationRequestTokens.js +2 -2
- package/src/mutation/MutationTransferTokens.js +2 -2
- package/src/mutation/MutationWithdrawBufferToken.js +1 -1
- package/src/query/Query.js +2 -2
- package/src/query/QueryActiveSession.js +2 -2
- package/src/query/QueryAtom.js +2 -2
- package/src/query/QueryBalance.js +2 -2
- package/src/query/QueryBatch.js +2 -2
- package/src/query/QueryBatchHistory.js +3 -3
- package/src/query/QueryContinuId.js +2 -2
- package/src/query/QueryMetaType.js +11 -5
- package/src/query/QueryMetaTypeViaAtom.js +11 -4
- package/src/query/QueryMetaTypeViaMolecule.js +223 -0
- package/src/query/QueryPolicy.js +2 -2
- package/src/query/QueryToken.js +2 -2
- package/src/query/QueryUserActivity.js +2 -2
- package/src/query/QueryWalletBundle.js +2 -2
- package/src/query/QueryWalletList.js +2 -2
- package/src/response/Response.js +168 -4
- package/src/response/ResponseActiveSession.js +2 -2
- package/src/response/{ResponseMetaBatch.js → ResponseAppendRequest.js} +4 -21
- package/src/response/ResponseAtom.js +2 -2
- package/src/response/ResponseAuthorizationGuest.js +4 -4
- package/src/response/ResponseBalance.js +9 -4
- package/src/response/ResponseClaimShadowWallet.js +1 -1
- package/src/response/ResponseContinuId.js +4 -4
- package/src/response/ResponseCreateIdentifier.js +1 -1
- package/src/response/ResponseCreateMeta.js +1 -1
- package/src/response/ResponseCreateRule.js +1 -1
- package/src/response/ResponseCreateToken.js +1 -1
- package/src/response/ResponseCreateWallet.js +1 -1
- package/src/response/ResponseLinkIdentifier.js +3 -3
- package/src/response/ResponseMetaType.js +2 -2
- package/src/response/ResponseMetaTypeViaAtom.js +2 -2
- package/src/response/ResponseMetaTypeViaMolecule.js +210 -0
- package/src/response/ResponsePeering.js +55 -0
- package/src/response/ResponsePolicy.js +2 -2
- package/src/response/ResponseProposeMolecule.js +3 -3
- package/src/response/ResponseQueryActiveSession.js +2 -2
- package/src/response/ResponseQueryUserActivity.js +2 -2
- package/src/response/ResponseRequestAuthorization.js +3 -3
- package/src/response/ResponseRequestAuthorizationGuest.js +3 -3
- package/src/response/ResponseRequestTokens.js +1 -1
- package/src/response/ResponseTransferTokens.js +1 -1
- package/src/response/ResponseWalletBundle.js +3 -3
- package/src/response/ResponseWalletList.js +5 -5
- package/src/subscribe/ActiveSessionSubscribe.js +1 -1
- package/src/subscribe/ActiveWalletSubscribe.js +1 -1
- package/src/subscribe/CreateMoleculeSubscribe.js +1 -1
- package/src/subscribe/Subscribe.js +1 -1
- package/src/subscribe/WalletStatusSubscribe.js +1 -1
- package/src/types/index.js +2 -2
- package/src/versions/Version4.js +1 -1
- package/src/versions/index.js +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
(
|
|
3
|
+
(/(
|
|
4
|
+
(//(
|
|
5
|
+
(///(
|
|
6
|
+
(/////(
|
|
7
|
+
(//////( )
|
|
8
|
+
(////////( (/)
|
|
9
|
+
(////////( (///)
|
|
10
|
+
(//////////( (////)
|
|
11
|
+
(//////////( (//////)
|
|
12
|
+
(////////////( (///////)
|
|
13
|
+
(/////////////( (/////////)
|
|
14
|
+
(//////////////( (///////////)
|
|
15
|
+
(///////////////( (/////////////)
|
|
16
|
+
(////////////////( (//////////////)
|
|
17
|
+
((((((((((((((((((( (((((((((((((((
|
|
18
|
+
((((((((((((((((((( ((((((((((((((
|
|
19
|
+
((((((((((((((((((( ((((((((((((((
|
|
20
|
+
(((((((((((((((((((( (((((((((((((
|
|
21
|
+
(((((((((((((((((((( ((((((((((((
|
|
22
|
+
((((((((((((((((((( ((((((((((((
|
|
23
|
+
((((((((((((((((((( ((((((((((
|
|
24
|
+
((((((((((((((((((/ (((((((((
|
|
25
|
+
(((((((((((((((((( ((((((((
|
|
26
|
+
((((((((((((((((( (((((((
|
|
27
|
+
(((((((((((((((((( (((((
|
|
28
|
+
################# ##
|
|
29
|
+
################ #
|
|
30
|
+
################# ##
|
|
31
|
+
%################ ###
|
|
32
|
+
###############( ####
|
|
33
|
+
############### ####
|
|
34
|
+
############### ######
|
|
35
|
+
%#############( (#######
|
|
36
|
+
%############# #########
|
|
37
|
+
############( ##########
|
|
38
|
+
########### #############
|
|
39
|
+
######### ##############
|
|
40
|
+
%######
|
|
41
|
+
|
|
42
|
+
Powered by Knish.IO: Connecting a Decentralized World
|
|
43
|
+
|
|
44
|
+
Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
45
|
+
|
|
46
|
+
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
|
+
*/
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule.js'
|
|
49
|
+
import ResponsePeering from '../response/ResponsePeering.js'
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Mutation for registering a peer node via the P-isotope
|
|
53
|
+
*/
|
|
54
|
+
export default class MutationPeering extends MutationProposeMolecule {
|
|
55
|
+
/**
|
|
56
|
+
* Fills a molecule with a P-isotope peering atom
|
|
57
|
+
*
|
|
58
|
+
* @param {string} host
|
|
59
|
+
*/
|
|
60
|
+
fillMolecule ({
|
|
61
|
+
host
|
|
62
|
+
}) {
|
|
63
|
+
this.$__molecule.initPeering({
|
|
64
|
+
host
|
|
65
|
+
})
|
|
66
|
+
this.$__molecule.sign({})
|
|
67
|
+
this.$__molecule.check()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Builds a new Response object from a JSON string
|
|
72
|
+
*
|
|
73
|
+
* @param {object} json
|
|
74
|
+
* @return {ResponsePeering}
|
|
75
|
+
*/
|
|
76
|
+
createResponse (json) {
|
|
77
|
+
return new ResponsePeering({
|
|
78
|
+
query: this,
|
|
79
|
+
json
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import ResponseProposeMolecule from '../response/ResponseProposeMolecule'
|
|
49
|
-
import Mutation from './Mutation'
|
|
48
|
+
import ResponseProposeMolecule from '../response/ResponseProposeMolecule.js'
|
|
49
|
+
import Mutation from './Mutation.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
export default class MutationProposeMolecule extends Mutation {
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
-
import ResponseRequestAuthorization from '../response/ResponseRequestAuthorization'
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule.js'
|
|
49
|
+
import ResponseRequestAuthorization from '../response/ResponseRequestAuthorization.js'
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Query for requesting an authorization token from the node
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Mutation from '../mutation/Mutation'
|
|
49
|
-
import ResponseRequestAuthorizationGuest from '../response/ResponseRequestAuthorizationGuest'
|
|
48
|
+
import Mutation from '../mutation/Mutation.js'
|
|
49
|
+
import ResponseRequestAuthorizationGuest from '../response/ResponseRequestAuthorizationGuest.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
export default class MutationRequestAuthorizationGuest extends Mutation {
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
-
import ResponseRequestTokens from '../response/ResponseRequestTokens'
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule.js'
|
|
49
|
+
import ResponseRequestTokens from '../response/ResponseRequestTokens.js'
|
|
50
50
|
|
|
51
51
|
export default class MutationRequestTokens extends MutationProposeMolecule {
|
|
52
52
|
/**
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
49
|
-
import ResponseTransferTokens from '../response/ResponseTransferTokens'
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule.js'
|
|
49
|
+
import ResponseTransferTokens from '../response/ResponseTransferTokens.js'
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Query for moving tokens between wallets
|
|
@@ -45,7 +45,7 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import MutationProposeMolecule from './MutationProposeMolecule'
|
|
48
|
+
import MutationProposeMolecule from './MutationProposeMolecule.js'
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
*
|
package/src/query/Query.js
CHANGED
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import CodeException from '../exception/CodeException'
|
|
49
|
-
import Response from '../response/Response'
|
|
48
|
+
import CodeException from '../exception/CodeException.js'
|
|
49
|
+
import Response from '../response/Response.js'
|
|
50
50
|
|
|
51
51
|
export default class Query {
|
|
52
52
|
/**
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import ResponseQueryActiveSession from '../response/ResponseQueryActiveSession'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import ResponseQueryActiveSession from '../response/ResponseQueryActiveSession.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
package/src/query/QueryAtom.js
CHANGED
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import ResponseAtom from '../response/ResponseAtom'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import ResponseAtom from '../response/ResponseAtom.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import ResponseBalance from '../response/ResponseBalance'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import ResponseBalance from '../response/ResponseBalance.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
package/src/query/QueryBatch.js
CHANGED
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import Response from '../response/Response'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import Response from '../response/Response.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -45,9 +45,9 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import QueryBatch from './QueryBatch'
|
|
50
|
-
import Response from '../response/Response'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import QueryBatch from './QueryBatch.js'
|
|
50
|
+
import Response from '../response/Response.js'
|
|
51
51
|
import { gql } from '@urql/core'
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import ResponseContinuId from '../response/ResponseContinuId'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import ResponseContinuId from '../response/ResponseContinuId.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import ResponseMetaType from '../response/ResponseMetaType'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import ResponseMetaType from '../response/ResponseMetaType.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -60,8 +60,8 @@ export default class QueryMetaType extends Query {
|
|
|
60
60
|
constructor (graphQLClient, knishIOClient) {
|
|
61
61
|
super(graphQLClient, knishIOClient)
|
|
62
62
|
|
|
63
|
-
this.$__query = gql`query( $metaType: String, $metaTypes: [ String! ], $metaId: String, $metaIds: [ String! ], $key: String, $keys: [ String! ], $value: String, $values: [ String! ], $count: String, $latest: Boolean, $filter: [ MetaFilter! ], $queryArgs: QueryArgs, $countBy: String ) {
|
|
64
|
-
MetaType( metaType: $metaType, metaTypes: $metaTypes, metaId: $metaId, metaIds: $metaIds, key: $key, keys: $keys, value: $value, values: $values, count: $count, filter: $filter, queryArgs: $queryArgs, countBy: $countBy ) {
|
|
63
|
+
this.$__query = gql`query( $metaType: String, $metaTypes: [ String! ], $metaId: String, $metaIds: [ String! ], $key: String, $keys: [ String! ], $value: String, $values: [ String! ], $count: String, $latest: Boolean, $filter: [ MetaFilter! ], $queryArgs: QueryArgs, $countBy: String, $cellSlug: String ) {
|
|
64
|
+
MetaType( metaType: $metaType, metaTypes: $metaTypes, metaId: $metaId, metaIds: $metaIds, key: $key, keys: $keys, value: $value, values: $values, count: $count, filter: $filter, queryArgs: $queryArgs, countBy: $countBy, cellSlug: $cellSlug ) {
|
|
65
65
|
metaType,
|
|
66
66
|
instanceCount {
|
|
67
67
|
key,
|
|
@@ -99,6 +99,7 @@ export default class QueryMetaType extends Query {
|
|
|
99
99
|
* @param {object|null} queryArgs
|
|
100
100
|
* @param {string|null} count
|
|
101
101
|
* @param {string|null} countBy
|
|
102
|
+
* @param {string|null} cellSlug
|
|
102
103
|
* @return {{}}
|
|
103
104
|
*/
|
|
104
105
|
static createVariables ({
|
|
@@ -110,7 +111,8 @@ export default class QueryMetaType extends Query {
|
|
|
110
111
|
filter = null,
|
|
111
112
|
queryArgs = null,
|
|
112
113
|
count = null,
|
|
113
|
-
countBy = null
|
|
114
|
+
countBy = null,
|
|
115
|
+
cellSlug = null
|
|
114
116
|
}) {
|
|
115
117
|
const variables = {}
|
|
116
118
|
|
|
@@ -152,6 +154,10 @@ export default class QueryMetaType extends Query {
|
|
|
152
154
|
variables.countBy = countBy
|
|
153
155
|
}
|
|
154
156
|
|
|
157
|
+
if (cellSlug) {
|
|
158
|
+
variables.cellSlug = cellSlug
|
|
159
|
+
}
|
|
160
|
+
|
|
155
161
|
return variables
|
|
156
162
|
}
|
|
157
163
|
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import ResponseMetaTypeViaAtom from '../response/ResponseMetaTypeViaAtom'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import ResponseMetaTypeViaAtom from '../response/ResponseMetaTypeViaAtom.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
export default class QueryMetaTypeViaAtom extends Query {
|
|
@@ -57,11 +57,12 @@ export default class QueryMetaTypeViaAtom extends Query {
|
|
|
57
57
|
constructor (graphQLClient, knishIOClient) {
|
|
58
58
|
super(graphQLClient, knishIOClient)
|
|
59
59
|
|
|
60
|
-
this.$__query = gql`query ($metaTypes: [String!], $metaIds: [String!], $values: [String!], $keys: [String!], $latest: Boolean, $filter: [MetaFilter!], $queryArgs: QueryArgs, $countBy: String, $atomValues: [String!] ) {
|
|
60
|
+
this.$__query = gql`query ($metaTypes: [String!], $metaIds: [String!], $values: [String!], $keys: [String!], $latest: Boolean, $filter: [MetaFilter!], $queryArgs: QueryArgs, $countBy: String, $atomValues: [String!], $cellSlugs: [String!] ) {
|
|
61
61
|
MetaTypeViaAtom(
|
|
62
62
|
metaTypes: $metaTypes
|
|
63
63
|
metaIds: $metaIds
|
|
64
64
|
atomValues: $atomValues
|
|
65
|
+
cellSlugs: $cellSlugs
|
|
65
66
|
filter: $filter,
|
|
66
67
|
latest: $latest,
|
|
67
68
|
queryArgs: $queryArgs
|
|
@@ -106,6 +107,7 @@ export default class QueryMetaTypeViaAtom extends Query {
|
|
|
106
107
|
* @param {array|null} filter
|
|
107
108
|
* @param {object|null} queryArgs
|
|
108
109
|
* @param {string|null} countBy
|
|
110
|
+
* @param {string|null} cellSlug
|
|
109
111
|
* @return {{}}
|
|
110
112
|
*/
|
|
111
113
|
static createVariables ({
|
|
@@ -119,7 +121,8 @@ export default class QueryMetaTypeViaAtom extends Query {
|
|
|
119
121
|
latest = null,
|
|
120
122
|
filter = null,
|
|
121
123
|
queryArgs = null,
|
|
122
|
-
countBy = null
|
|
124
|
+
countBy = null,
|
|
125
|
+
cellSlug = null
|
|
123
126
|
}) {
|
|
124
127
|
const variables = {}
|
|
125
128
|
|
|
@@ -143,6 +146,10 @@ export default class QueryMetaTypeViaAtom extends Query {
|
|
|
143
146
|
variables.metaIds = typeof metaId === 'string' ? [metaId] : metaId
|
|
144
147
|
}
|
|
145
148
|
|
|
149
|
+
if (cellSlug) {
|
|
150
|
+
variables.cellSlugs = typeof cellSlug === 'string' ? [cellSlug] : cellSlug
|
|
151
|
+
}
|
|
152
|
+
|
|
146
153
|
if (countBy) {
|
|
147
154
|
variables.countBy = countBy
|
|
148
155
|
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/*
|
|
2
|
+
(
|
|
3
|
+
(/(
|
|
4
|
+
(//(
|
|
5
|
+
(///(
|
|
6
|
+
(/////(
|
|
7
|
+
(//////( )
|
|
8
|
+
(////////( (/)
|
|
9
|
+
(////////( (///)
|
|
10
|
+
(//////////( (////)
|
|
11
|
+
(//////////( (//////)
|
|
12
|
+
(////////////( (///////)
|
|
13
|
+
(/////////////( (/////////)
|
|
14
|
+
(//////////////( (///////////)
|
|
15
|
+
(///////////////( (//////////////)
|
|
16
|
+
(////////////////( (///////////////)
|
|
17
|
+
((((((((((((((((((( (((((((((((((((
|
|
18
|
+
((((((((((((((((((( ((((((((((((((
|
|
19
|
+
((((((((((((((((((( ((((((((((((((
|
|
20
|
+
(((((((((((((((((((( (((((((((((((
|
|
21
|
+
(((((((((((((((((((( ((((((((((((
|
|
22
|
+
((((((((((((((((((( ((((((((((((
|
|
23
|
+
((((((((((((((((((( ((((((((((
|
|
24
|
+
((((((((((((((((((/ (((((((((
|
|
25
|
+
(((((((((((((((((( ((((((((
|
|
26
|
+
((((((((((((((((( (((((((
|
|
27
|
+
(((((((((((((((((( (((((
|
|
28
|
+
################# ##
|
|
29
|
+
################ #
|
|
30
|
+
################# ##
|
|
31
|
+
%################ ###
|
|
32
|
+
###############( ####
|
|
33
|
+
############### ####
|
|
34
|
+
############### ######
|
|
35
|
+
%#############( (#######
|
|
36
|
+
%############# #########
|
|
37
|
+
############( ##########
|
|
38
|
+
########### #############
|
|
39
|
+
######### ##############
|
|
40
|
+
%######
|
|
41
|
+
|
|
42
|
+
Powered by Knish.IO: Connecting a Decentralized World
|
|
43
|
+
|
|
44
|
+
Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
45
|
+
|
|
46
|
+
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
|
+
*/
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import ResponseMetaTypeViaMolecule from '../response/ResponseMetaTypeViaMolecule.js'
|
|
50
|
+
import { gql } from '@urql/core'
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Query for retrieving Meta Asset information via Molecule data.
|
|
54
|
+
*
|
|
55
|
+
* Unlike QueryMetaTypeViaAtom, this query does NOT request the redundant
|
|
56
|
+
* instance-level `metas` field. Instead, metadata is extracted client-side
|
|
57
|
+
* from molecule atoms' `metasJson`, eliminating duplicate data transfer.
|
|
58
|
+
*/
|
|
59
|
+
export default class QueryMetaTypeViaMolecule extends Query {
|
|
60
|
+
/**
|
|
61
|
+
* @param {UrqlClientWrapper} graphQLClient
|
|
62
|
+
* @param {KnishIOClient} knishIOClient
|
|
63
|
+
*/
|
|
64
|
+
constructor (graphQLClient, knishIOClient) {
|
|
65
|
+
super(graphQLClient, knishIOClient)
|
|
66
|
+
|
|
67
|
+
this.$__query = gql`query ($metaTypes: [String!], $metaIds: [String!], $values: [String!], $keys: [String!], $latest: Boolean, $filter: [MetaFilter!], $queryArgs: QueryArgs, $countBy: String, $atomValues: [String!], $cellSlugs: [String!] ) {
|
|
68
|
+
MetaTypeViaAtom(
|
|
69
|
+
metaTypes: $metaTypes
|
|
70
|
+
metaIds: $metaIds
|
|
71
|
+
atomValues: $atomValues
|
|
72
|
+
cellSlugs: $cellSlugs
|
|
73
|
+
filter: $filter,
|
|
74
|
+
latest: $latest,
|
|
75
|
+
queryArgs: $queryArgs
|
|
76
|
+
countBy: $countBy
|
|
77
|
+
) {
|
|
78
|
+
metaType,
|
|
79
|
+
instanceCount {
|
|
80
|
+
key,
|
|
81
|
+
value
|
|
82
|
+
},
|
|
83
|
+
instances {
|
|
84
|
+
metaType,
|
|
85
|
+
metaId,
|
|
86
|
+
createdAt,
|
|
87
|
+
metas( values: $values, keys: $keys ) {
|
|
88
|
+
molecularHash,
|
|
89
|
+
position,
|
|
90
|
+
key,
|
|
91
|
+
value,
|
|
92
|
+
createdAt
|
|
93
|
+
},
|
|
94
|
+
molecule {
|
|
95
|
+
molecularHash,
|
|
96
|
+
bundleHash,
|
|
97
|
+
cellSlug,
|
|
98
|
+
status,
|
|
99
|
+
createdAt,
|
|
100
|
+
atoms {
|
|
101
|
+
position,
|
|
102
|
+
walletAddress,
|
|
103
|
+
isotope,
|
|
104
|
+
tokenSlug,
|
|
105
|
+
value,
|
|
106
|
+
batchId,
|
|
107
|
+
metaType,
|
|
108
|
+
metaId,
|
|
109
|
+
index,
|
|
110
|
+
createdAt,
|
|
111
|
+
otsFragment,
|
|
112
|
+
metasJson
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
paginatorInfo {
|
|
117
|
+
currentPage,
|
|
118
|
+
total
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}`
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Builds a GraphQL-friendly variables object based on input fields
|
|
126
|
+
*
|
|
127
|
+
* @param {string|array|null} metaType
|
|
128
|
+
* @param {string|array|null} metaId
|
|
129
|
+
* @param {string|null} key
|
|
130
|
+
* @param {string|null} value
|
|
131
|
+
* @param {array|null} values
|
|
132
|
+
* @param {array|null} keys
|
|
133
|
+
* @param {array|null} atomValues
|
|
134
|
+
* @param {boolean|null} latest
|
|
135
|
+
* @param {array|null} filter
|
|
136
|
+
* @param {object|null} queryArgs
|
|
137
|
+
* @param {string|null} countBy
|
|
138
|
+
* @param {string|null} cellSlug
|
|
139
|
+
* @return {{}}
|
|
140
|
+
*/
|
|
141
|
+
static createVariables ({
|
|
142
|
+
metaType = null,
|
|
143
|
+
metaId = null,
|
|
144
|
+
key = null,
|
|
145
|
+
value = null,
|
|
146
|
+
keys = null,
|
|
147
|
+
values = null,
|
|
148
|
+
atomValues = null,
|
|
149
|
+
latest = null,
|
|
150
|
+
filter = null,
|
|
151
|
+
queryArgs = null,
|
|
152
|
+
countBy = null,
|
|
153
|
+
cellSlug = null
|
|
154
|
+
}) {
|
|
155
|
+
const variables = {}
|
|
156
|
+
|
|
157
|
+
if (atomValues) {
|
|
158
|
+
variables.atomValues = atomValues
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (keys) {
|
|
162
|
+
variables.keys = keys
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (values) {
|
|
166
|
+
variables.values = values
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (metaType) {
|
|
170
|
+
variables.metaTypes = typeof metaType === 'string' ? [metaType] : metaType
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (metaId) {
|
|
174
|
+
variables.metaIds = typeof metaId === 'string' ? [metaId] : metaId
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (cellSlug) {
|
|
178
|
+
variables.cellSlugs = typeof cellSlug === 'string' ? [cellSlug] : cellSlug
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (countBy) {
|
|
182
|
+
variables.countBy = countBy
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (filter) {
|
|
186
|
+
variables.filter = filter
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (key && value) {
|
|
190
|
+
variables.filter = variables.filter || []
|
|
191
|
+
variables.filter.push({
|
|
192
|
+
key,
|
|
193
|
+
value,
|
|
194
|
+
comparison: '='
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
variables.latest = latest === true
|
|
199
|
+
|
|
200
|
+
if (queryArgs) {
|
|
201
|
+
if (typeof queryArgs.limit === 'undefined' || queryArgs.limit === 0) {
|
|
202
|
+
queryArgs.limit = '*'
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
variables.queryArgs = queryArgs
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return variables
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Returns a Response object
|
|
213
|
+
*
|
|
214
|
+
* @param {object} json
|
|
215
|
+
* @return {ResponseMetaTypeViaMolecule}
|
|
216
|
+
*/
|
|
217
|
+
createResponse (json) {
|
|
218
|
+
return new ResponseMetaTypeViaMolecule({
|
|
219
|
+
query: this,
|
|
220
|
+
json
|
|
221
|
+
})
|
|
222
|
+
}
|
|
223
|
+
}
|
package/src/query/QueryPolicy.js
CHANGED
|
@@ -46,8 +46,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
|
-
import Query from './Query'
|
|
50
|
-
import ResponsePolicy from '../response/ResponsePolicy'
|
|
49
|
+
import Query from './Query.js'
|
|
50
|
+
import ResponsePolicy from '../response/ResponsePolicy.js'
|
|
51
51
|
import { gql } from "@urql/core";
|
|
52
52
|
|
|
53
53
|
export default class QueryPolicy extends Query {
|
package/src/query/QueryToken.js
CHANGED
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import Response from '../response/Response'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import Response from '../response/Response.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import ResponseQueryUserActivity from '../response/ResponseQueryUserActivity'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import ResponseQueryUserActivity from '../response/ResponseQueryUserActivity.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import ResponseWalletBundle from '../response/ResponseWalletBundle'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import ResponseWalletBundle from '../response/ResponseWalletBundle.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -45,8 +45,8 @@ Please visit https://github.com/WishKnish/KnishIO-Client-JS for information.
|
|
|
45
45
|
|
|
46
46
|
License: https://github.com/WishKnish/KnishIO-Client-JS/blob/master/LICENSE
|
|
47
47
|
*/
|
|
48
|
-
import Query from './Query'
|
|
49
|
-
import ResponseWalletList from '../response/ResponseWalletList'
|
|
48
|
+
import Query from './Query.js'
|
|
49
|
+
import ResponseWalletList from '../response/ResponseWalletList.js'
|
|
50
50
|
import { gql } from '@urql/core'
|
|
51
51
|
|
|
52
52
|
/**
|