@wishknish/knishio-client-ts 0.9.3 → 0.9.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/index.cjs +194 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.iife.js +20557 -4963
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +194 -33
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +4 -1
- package/src/instance/rules/Callback.ts +1 -1
- package/src/libraries/CheckMolecule.ts +194 -4
- package/src/schemas/index.ts +30 -15
- package/src/validation/ValidationService.ts +1 -3
- package/src/validation/schemas.ts +40 -16
package/dist/index.js
CHANGED
|
@@ -3833,6 +3833,14 @@ var Wallet = class _Wallet {
|
|
|
3833
3833
|
};
|
|
3834
3834
|
var hexStringRegex = /^[0-9a-fA-F]+$/;
|
|
3835
3835
|
var base17HashRegex = /^[0-9a-g]+$/;
|
|
3836
|
+
var urlString = (message = "Invalid URL") => z.string().refine((value) => {
|
|
3837
|
+
try {
|
|
3838
|
+
new URL(value);
|
|
3839
|
+
return true;
|
|
3840
|
+
} catch {
|
|
3841
|
+
return false;
|
|
3842
|
+
}
|
|
3843
|
+
}, message);
|
|
3836
3844
|
z.string().regex(hexStringRegex, "Must be a valid hexadecimal string").brand();
|
|
3837
3845
|
var WalletAddressSchema = z.string().regex(hexStringRegex, "Wallet address must be hexadecimal").length(64, "Wallet address must be exactly 64 characters").brand();
|
|
3838
3846
|
var BundleHashSchema = z.string().regex(hexStringRegex, "Bundle hash must be hexadecimal").length(64, "Bundle hash must be exactly 64 characters").brand();
|
|
@@ -3844,7 +3852,7 @@ var MetaIdSchema = z.string().min(1, "Meta ID cannot be empty").brand();
|
|
|
3844
3852
|
var BatchIdSchema = z.string().min(1, "Batch ID cannot be empty").brand();
|
|
3845
3853
|
var CellSlugSchema = z.string().min(1, "Cell slug cannot be empty").max(64, "Cell slug cannot exceed 64 characters").brand();
|
|
3846
3854
|
var AtomIsotopeSchema = z.enum(["C", "V", "U", "T", "M", "I", "R", "B", "F"], {
|
|
3847
|
-
|
|
3855
|
+
error: "Invalid atom isotope. Must be one of: C, V, U, T, M, I, R, B, F"
|
|
3848
3856
|
});
|
|
3849
3857
|
var MetaDataValueSchema = z.union([
|
|
3850
3858
|
z.string(),
|
|
@@ -3857,7 +3865,7 @@ var AtomMetaDataSchema = z.object({
|
|
|
3857
3865
|
value: MetaDataValueSchema
|
|
3858
3866
|
}).strict();
|
|
3859
3867
|
var MetaDataSchema = z.lazy(
|
|
3860
|
-
() => z.record(z.union([
|
|
3868
|
+
() => z.record(z.string(), z.union([
|
|
3861
3869
|
MetaDataValueSchema,
|
|
3862
3870
|
MetaDataSchema,
|
|
3863
3871
|
z.array(MetaDataSchema)
|
|
@@ -3896,7 +3904,7 @@ z.object({
|
|
|
3896
3904
|
version: z.number().int().min(1).optional()
|
|
3897
3905
|
}).strict();
|
|
3898
3906
|
z.object({
|
|
3899
|
-
uri: z.union([
|
|
3907
|
+
uri: z.union([urlString(), z.array(urlString())]).optional(),
|
|
3900
3908
|
cellSlug: z.union([CellSlugSchema, z.string(), z.null()]).optional(),
|
|
3901
3909
|
client: z.unknown().optional(),
|
|
3902
3910
|
socket: z.unknown().optional(),
|
|
@@ -3913,7 +3921,7 @@ z.object({
|
|
|
3913
3921
|
z.object({
|
|
3914
3922
|
cellSlug: z.union([CellSlugSchema, z.string(), z.null()]).optional(),
|
|
3915
3923
|
encrypt: z.boolean().optional(),
|
|
3916
|
-
callback: z.
|
|
3924
|
+
callback: z.custom((value) => typeof value === "function").optional()
|
|
3917
3925
|
}).strict();
|
|
3918
3926
|
z.object({
|
|
3919
3927
|
cellSlug: z.union([CellSlugSchema, z.string(), z.null()]).optional()
|
|
@@ -3922,7 +3930,7 @@ z.object({
|
|
|
3922
3930
|
recipient: z.union([WalletAddressSchema, z.string()]),
|
|
3923
3931
|
amount: z.union([z.number().positive(), z.string().min(1)]),
|
|
3924
3932
|
token: z.union([TokenSlugSchema, z.string()]).optional(),
|
|
3925
|
-
callbackUrl: z.union([
|
|
3933
|
+
callbackUrl: z.union([urlString(), z.null()]).optional(),
|
|
3926
3934
|
metaType: z.union([MetaTypeSchema, z.string(), z.null()]).optional(),
|
|
3927
3935
|
metaId: z.union([MetaIdSchema, z.string(), z.null()]).optional(),
|
|
3928
3936
|
meta: z.union([MetaDataSchema, z.null()]).optional()
|
|
@@ -3963,7 +3971,7 @@ z.object({
|
|
|
3963
3971
|
value: z.union([z.string(), z.null()]).optional(),
|
|
3964
3972
|
latest: z.union([z.boolean(), z.null()]).optional(),
|
|
3965
3973
|
filter: z.union([z.array(MetaFilterSchema), z.null()]).optional(),
|
|
3966
|
-
queryArgs: z.union([z.record(z.unknown()), z.null()]).optional(),
|
|
3974
|
+
queryArgs: z.union([z.record(z.string(), z.unknown()), z.null()]).optional(),
|
|
3967
3975
|
count: z.union([z.number().int().min(1), z.null()]).optional(),
|
|
3968
3976
|
countBy: z.union([z.string(), z.null()]).optional(),
|
|
3969
3977
|
cellSlug: z.union([CellSlugSchema, z.string(), z.null()]).optional()
|
|
@@ -3988,7 +3996,7 @@ z.object({
|
|
|
3988
3996
|
}).strict();
|
|
3989
3997
|
z.object({
|
|
3990
3998
|
query: z.string().min(1, "GraphQL query cannot be empty"),
|
|
3991
|
-
variables: z.record(z.unknown()).optional(),
|
|
3999
|
+
variables: z.record(z.string(), z.unknown()).optional(),
|
|
3992
4000
|
operationName: z.union([z.string(), z.null()]).optional()
|
|
3993
4001
|
}).strict();
|
|
3994
4002
|
var GraphQLErrorSchema = z.object({
|
|
@@ -3998,18 +4006,18 @@ var GraphQLErrorSchema = z.object({
|
|
|
3998
4006
|
column: z.number().int().min(1)
|
|
3999
4007
|
})).optional(),
|
|
4000
4008
|
path: z.array(z.union([z.string(), z.number()])).optional(),
|
|
4001
|
-
extensions: z.record(z.unknown()).optional()
|
|
4009
|
+
extensions: z.record(z.string(), z.unknown()).optional()
|
|
4002
4010
|
}).strict();
|
|
4003
4011
|
z.object({
|
|
4004
4012
|
data: z.unknown().optional(),
|
|
4005
4013
|
errors: z.array(GraphQLErrorSchema).nullable().optional(),
|
|
4006
|
-
extensions: z.record(z.unknown()).optional()
|
|
4014
|
+
extensions: z.record(z.string(), z.unknown()).optional()
|
|
4007
4015
|
}).strict();
|
|
4008
4016
|
z.object({
|
|
4009
4017
|
operationName: z.string().optional(),
|
|
4010
4018
|
query: z.string().optional(),
|
|
4011
|
-
variables: z.record(z.unknown()).optional(),
|
|
4012
|
-
callback: z.
|
|
4019
|
+
variables: z.record(z.string(), z.unknown()).optional(),
|
|
4020
|
+
callback: z.custom((value) => typeof value === "function").optional()
|
|
4013
4021
|
}).strict();
|
|
4014
4022
|
z.object({
|
|
4015
4023
|
valid: z.boolean(),
|
|
@@ -4019,7 +4027,7 @@ z.object({
|
|
|
4019
4027
|
}).strict();
|
|
4020
4028
|
z.object({
|
|
4021
4029
|
operation: z.string().optional(),
|
|
4022
|
-
parameters: z.record(z.unknown()).optional(),
|
|
4030
|
+
parameters: z.record(z.string(), z.unknown()).optional(),
|
|
4023
4031
|
timestamp: z.number().int().min(0).optional(),
|
|
4024
4032
|
stack: z.string().optional()
|
|
4025
4033
|
}).strict();
|
|
@@ -4223,7 +4231,7 @@ var CallbackParamsSchema = z.object({
|
|
|
4223
4231
|
action: z.string().min(1, "Action cannot be empty"),
|
|
4224
4232
|
metaType: z.union([z.string(), z.null()]).optional(),
|
|
4225
4233
|
metaId: z.union([z.string(), z.null()]).optional(),
|
|
4226
|
-
meta: z.union([z.instanceof(Meta2), z.record(z.unknown()), z.null()]).optional(),
|
|
4234
|
+
meta: z.union([z.instanceof(Meta2), z.record(z.string(), z.unknown()), z.null()]).optional(),
|
|
4227
4235
|
address: z.union([z.string(), z.null()]).optional(),
|
|
4228
4236
|
token: z.union([z.string(), z.null()]).optional(),
|
|
4229
4237
|
amount: z.union([z.string(), z.null()]).optional(),
|
|
@@ -4487,7 +4495,7 @@ var CheckMolecule = class _CheckMolecule {
|
|
|
4487
4495
|
* @return True if all validations pass
|
|
4488
4496
|
*/
|
|
4489
4497
|
verify(senderWallet) {
|
|
4490
|
-
return this.molecularHash() && this.ots() && this.batchId() && this.continuId() && this.isotopeM() && this.isotopeT() && this.isotopeC() && this.isotopeU() && this.isotopeI() && this.isotopeR() && this.isotopeV(senderWallet || null);
|
|
4498
|
+
return this.molecularHash() && this.ots() && this.batchId() && this.continuId() && this.isotopeM() && this.isotopeT() && this.isotopeC() && this.isotopeU() && this.isotopeI() && this.isotopeR() && this.isotopeP() && this.isotopeA() && this.isotopeB() && this.isotopeF() && this.isotopeV(senderWallet || null);
|
|
4491
4499
|
}
|
|
4492
4500
|
/**
|
|
4493
4501
|
* Validate ContinuID requirement
|
|
@@ -4675,6 +4683,141 @@ var CheckMolecule = class _CheckMolecule {
|
|
|
4675
4683
|
}
|
|
4676
4684
|
return true;
|
|
4677
4685
|
}
|
|
4686
|
+
/**
|
|
4687
|
+
* Validate isotope P atoms (peering)
|
|
4688
|
+
* @return True if valid
|
|
4689
|
+
* @throws WrongTokenTypeException if the token slug is not USER
|
|
4690
|
+
* @throws MetaMissingException if the required peerHost meta field is absent
|
|
4691
|
+
*/
|
|
4692
|
+
isotopeP() {
|
|
4693
|
+
for (const atom of this.molecule.getIsotopes("P")) {
|
|
4694
|
+
if (atom.token !== "USER") {
|
|
4695
|
+
throw new WrongTokenTypeException(`Check::isotopeP() - "${atom.token}" is not a valid Token slug for "${atom.isotope}" isotope Atoms!`);
|
|
4696
|
+
}
|
|
4697
|
+
const metas = atom.aggregatedMeta();
|
|
4698
|
+
if (!Object.prototype.hasOwnProperty.call(metas, "peerHost") || !metas.peerHost) {
|
|
4699
|
+
throw new MetaMissingException('Check::isotopeP() - Required meta field "peerHost" is missing!');
|
|
4700
|
+
}
|
|
4701
|
+
}
|
|
4702
|
+
return true;
|
|
4703
|
+
}
|
|
4704
|
+
/**
|
|
4705
|
+
* Validate isotope A atoms (append request)
|
|
4706
|
+
* @return True if valid
|
|
4707
|
+
* @throws WrongTokenTypeException if the token slug is not USER
|
|
4708
|
+
* @throws MetaMissingException if metaType, metaId or the action meta field is absent
|
|
4709
|
+
*/
|
|
4710
|
+
isotopeA() {
|
|
4711
|
+
for (const atom of this.molecule.getIsotopes("A")) {
|
|
4712
|
+
if (atom.token !== "USER") {
|
|
4713
|
+
throw new WrongTokenTypeException(`Check::isotopeA() - "${atom.token}" is not a valid Token slug for "${atom.isotope}" isotope Atoms!`);
|
|
4714
|
+
}
|
|
4715
|
+
if (!atom.metaType) {
|
|
4716
|
+
throw new MetaMissingException('Check::isotopeA() - Required field "metaType" is missing!');
|
|
4717
|
+
}
|
|
4718
|
+
if (!atom.metaId) {
|
|
4719
|
+
throw new MetaMissingException('Check::isotopeA() - Required field "metaId" is missing!');
|
|
4720
|
+
}
|
|
4721
|
+
const metas = atom.aggregatedMeta();
|
|
4722
|
+
if (!Object.prototype.hasOwnProperty.call(metas, "action") || !metas.action) {
|
|
4723
|
+
throw new MetaMissingException('Check::isotopeA() - Required meta field "action" is missing!');
|
|
4724
|
+
}
|
|
4725
|
+
}
|
|
4726
|
+
return true;
|
|
4727
|
+
}
|
|
4728
|
+
/**
|
|
4729
|
+
* Validate isotope B atoms (buffer/exchange)
|
|
4730
|
+
*
|
|
4731
|
+
* Buffer molecules are cross-isotope: their V atoms do not balance on their own
|
|
4732
|
+
* because a B atom absorbs the difference. isotopeV() therefore skips its V-only
|
|
4733
|
+
* conservation checks whenever B (or F) atoms are present, and conservation is
|
|
4734
|
+
* enforced here instead over the combined V+B set.
|
|
4735
|
+
*
|
|
4736
|
+
* @return True if valid
|
|
4737
|
+
* @throws MetaMissingException if metaType is not walletBundle, or metaId is absent
|
|
4738
|
+
* @throws TransferMalformedException if a B atom value is not a number
|
|
4739
|
+
* @throws TransferUnbalancedException if V+B atom values do not sum to zero
|
|
4740
|
+
*/
|
|
4741
|
+
isotopeB() {
|
|
4742
|
+
const isotopeB = this.molecule.getIsotopes("B");
|
|
4743
|
+
if (isotopeB.length === 0) {
|
|
4744
|
+
return true;
|
|
4745
|
+
}
|
|
4746
|
+
for (const atom of isotopeB) {
|
|
4747
|
+
if (!atom.metaType || atom.metaType !== "walletBundle") {
|
|
4748
|
+
throw new MetaMissingException('Check::isotopeB() - B-isotope atoms must have metaType "walletBundle"!');
|
|
4749
|
+
}
|
|
4750
|
+
if (!atom.metaId) {
|
|
4751
|
+
throw new MetaMissingException("Check::isotopeB() - B-isotope atoms must have a metaId!");
|
|
4752
|
+
}
|
|
4753
|
+
const value = atom.value !== null ? Number(atom.value) : Number.NaN;
|
|
4754
|
+
if (Number.isNaN(value)) {
|
|
4755
|
+
throw new TransferMalformedException("Check::isotopeB() - B-isotope atom value is not a valid number!");
|
|
4756
|
+
}
|
|
4757
|
+
}
|
|
4758
|
+
const vAtoms = this.molecule.getIsotopes("V");
|
|
4759
|
+
if (vAtoms.length > 0) {
|
|
4760
|
+
let sum = 0;
|
|
4761
|
+
for (const atom of [...vAtoms, ...isotopeB]) {
|
|
4762
|
+
const value = atom.value !== null ? Number(atom.value) : Number.NaN;
|
|
4763
|
+
if (!Number.isNaN(value)) {
|
|
4764
|
+
sum += value;
|
|
4765
|
+
}
|
|
4766
|
+
}
|
|
4767
|
+
if (sum !== 0) {
|
|
4768
|
+
throw new TransferUnbalancedException("Check::isotopeB() - V+B atom values do not balance to zero!");
|
|
4769
|
+
}
|
|
4770
|
+
}
|
|
4771
|
+
return true;
|
|
4772
|
+
}
|
|
4773
|
+
/**
|
|
4774
|
+
* Validate isotope F atoms (fusion/NFT)
|
|
4775
|
+
*
|
|
4776
|
+
* Mirrors isotopeB() and additionally forbids negative values. Must stay paired
|
|
4777
|
+
* with the hasCrossIsotope gate in isotopeV(), which is keyed on B *or* F: without
|
|
4778
|
+
* this check an F-isotope molecule would skip V-only conservation with nothing
|
|
4779
|
+
* validating V+F conservation in its place.
|
|
4780
|
+
*
|
|
4781
|
+
* @return True if valid
|
|
4782
|
+
* @throws MetaMissingException if metaType is not walletBundle, or metaId is absent
|
|
4783
|
+
* @throws TransferMalformedException if an F atom value is not a number, or is negative
|
|
4784
|
+
* @throws TransferUnbalancedException if V+F atom values do not sum to zero
|
|
4785
|
+
*/
|
|
4786
|
+
isotopeF() {
|
|
4787
|
+
const isotopeF = this.molecule.getIsotopes("F");
|
|
4788
|
+
if (isotopeF.length === 0) {
|
|
4789
|
+
return true;
|
|
4790
|
+
}
|
|
4791
|
+
for (const atom of isotopeF) {
|
|
4792
|
+
if (!atom.metaType || atom.metaType !== "walletBundle") {
|
|
4793
|
+
throw new MetaMissingException('Check::isotopeF() - F-isotope atoms must have metaType "walletBundle"!');
|
|
4794
|
+
}
|
|
4795
|
+
if (!atom.metaId) {
|
|
4796
|
+
throw new MetaMissingException("Check::isotopeF() - F-isotope atoms must have a metaId!");
|
|
4797
|
+
}
|
|
4798
|
+
const value = atom.value !== null ? Number(atom.value) : Number.NaN;
|
|
4799
|
+
if (Number.isNaN(value)) {
|
|
4800
|
+
throw new TransferMalformedException("Check::isotopeF() - F-isotope atom value is not a valid number!");
|
|
4801
|
+
}
|
|
4802
|
+
if (value < 0) {
|
|
4803
|
+
throw new TransferMalformedException("Check::isotopeF() - F-isotope atom value must not be negative!");
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
const vAtoms = this.molecule.getIsotopes("V");
|
|
4807
|
+
if (vAtoms.length > 0) {
|
|
4808
|
+
let sum = 0;
|
|
4809
|
+
for (const atom of [...vAtoms, ...isotopeF]) {
|
|
4810
|
+
const value = atom.value !== null ? Number(atom.value) : Number.NaN;
|
|
4811
|
+
if (!Number.isNaN(value)) {
|
|
4812
|
+
sum += value;
|
|
4813
|
+
}
|
|
4814
|
+
}
|
|
4815
|
+
if (sum !== 0) {
|
|
4816
|
+
throw new TransferUnbalancedException("Check::isotopeF() - V+F atom values do not balance to zero!");
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
return true;
|
|
4820
|
+
}
|
|
4678
4821
|
/**
|
|
4679
4822
|
* Validate isotope V atoms (value transfers)
|
|
4680
4823
|
* @param senderWallet - Optional wallet for balance validation
|
|
@@ -4686,11 +4829,12 @@ var CheckMolecule = class _CheckMolecule {
|
|
|
4686
4829
|
if (isotopeV.length === 0) {
|
|
4687
4830
|
return true;
|
|
4688
4831
|
}
|
|
4832
|
+
const hasCrossIsotope = this.molecule.getIsotopes("B").length > 0 || this.molecule.getIsotopes("F").length > 0;
|
|
4689
4833
|
const firstAtom = this.molecule.atoms[0];
|
|
4690
4834
|
if (!firstAtom) {
|
|
4691
4835
|
throw new AtomsMissingException("Check::isotopeV() - Missing first atom");
|
|
4692
4836
|
}
|
|
4693
|
-
if (firstAtom.isotope === "V" && isotopeV.length === 2) {
|
|
4837
|
+
if (!hasCrossIsotope && firstAtom.isotope === "V" && isotopeV.length === 2) {
|
|
4694
4838
|
const endAtom = isotopeV[isotopeV.length - 1];
|
|
4695
4839
|
if (!endAtom) {
|
|
4696
4840
|
throw new AtomsMissingException("Check::isotopeV() - Missing end atom");
|
|
@@ -4702,6 +4846,10 @@ var CheckMolecule = class _CheckMolecule {
|
|
|
4702
4846
|
if (endValue < 0) {
|
|
4703
4847
|
throw new TransferMalformedException();
|
|
4704
4848
|
}
|
|
4849
|
+
const firstValueForPair = firstAtom.value !== null ? Number(firstAtom.value) : 0;
|
|
4850
|
+
if (firstValueForPair + endValue !== 0) {
|
|
4851
|
+
throw new TransferUnbalancedException();
|
|
4852
|
+
}
|
|
4705
4853
|
return true;
|
|
4706
4854
|
}
|
|
4707
4855
|
let sum = 0;
|
|
@@ -4730,7 +4878,7 @@ var CheckMolecule = class _CheckMolecule {
|
|
|
4730
4878
|
sum += value;
|
|
4731
4879
|
}
|
|
4732
4880
|
}
|
|
4733
|
-
if (sum !== 0) {
|
|
4881
|
+
if (!hasCrossIsotope && sum !== 0) {
|
|
4734
4882
|
throw new TransferUnbalancedException();
|
|
4735
4883
|
}
|
|
4736
4884
|
if (senderWallet) {
|
|
@@ -4742,7 +4890,7 @@ var CheckMolecule = class _CheckMolecule {
|
|
|
4742
4890
|
if (remainder < 0) {
|
|
4743
4891
|
throw new TransferBalanceException();
|
|
4744
4892
|
}
|
|
4745
|
-
if (remainder !== sum) {
|
|
4893
|
+
if (!hasCrossIsotope && remainder !== sum) {
|
|
4746
4894
|
throw new TransferRemainderException();
|
|
4747
4895
|
}
|
|
4748
4896
|
} else if (sum !== 0) {
|
|
@@ -6430,6 +6578,14 @@ var Mutation = class extends Query {
|
|
|
6430
6578
|
}
|
|
6431
6579
|
}
|
|
6432
6580
|
};
|
|
6581
|
+
var urlString2 = (message = "Invalid URL") => z.string().refine((value) => {
|
|
6582
|
+
try {
|
|
6583
|
+
new URL(value);
|
|
6584
|
+
return true;
|
|
6585
|
+
} catch {
|
|
6586
|
+
return false;
|
|
6587
|
+
}
|
|
6588
|
+
}, message);
|
|
6433
6589
|
function createBrandedSchema(name, baseSchema = z.string()) {
|
|
6434
6590
|
return baseSchema.brand(name);
|
|
6435
6591
|
}
|
|
@@ -6455,7 +6611,12 @@ var TokenSlugSchema2 = createBrandedSchema(
|
|
|
6455
6611
|
);
|
|
6456
6612
|
var BatchIdSchema2 = createBrandedSchema(
|
|
6457
6613
|
"BatchId",
|
|
6458
|
-
|
|
6614
|
+
// v3's `.uuid()` regex, inlined verbatim. Zod 4's `z.uuid()` additionally enforces the
|
|
6615
|
+
// RFC 9562 version/variant nibbles and would reject batch IDs v3 accepted.
|
|
6616
|
+
z.string().regex(
|
|
6617
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
6618
|
+
"Invalid batch ID format"
|
|
6619
|
+
)
|
|
6459
6620
|
);
|
|
6460
6621
|
var CellSlugSchema2 = createBrandedSchema(
|
|
6461
6622
|
"CellSlug",
|
|
@@ -6499,7 +6660,7 @@ var AtomMetaDataSchema2 = z.object({
|
|
|
6499
6660
|
z.object({
|
|
6500
6661
|
key: z.string(),
|
|
6501
6662
|
value: z.union([z.string(), z.number(), z.boolean(), z.null()])
|
|
6502
|
-
}).
|
|
6663
|
+
}).loose();
|
|
6503
6664
|
var AtomParamsSchema2 = z.object({
|
|
6504
6665
|
position: z.string().optional(),
|
|
6505
6666
|
walletAddress: z.union([WalletAddressSchema2, z.string()]).optional(),
|
|
@@ -6534,8 +6695,8 @@ var MoleculeParamsSchema2 = z.object({
|
|
|
6534
6695
|
}).strict();
|
|
6535
6696
|
var KnishIOClientConfigSchema2 = z.object({
|
|
6536
6697
|
uri: z.union([
|
|
6537
|
-
|
|
6538
|
-
z.array(
|
|
6698
|
+
urlString2("Invalid URI format"),
|
|
6699
|
+
z.array(urlString2("Invalid URI format")).min(1)
|
|
6539
6700
|
]).optional(),
|
|
6540
6701
|
cellSlug: z.union([CellSlugSchema2, z.string()]).optional(),
|
|
6541
6702
|
client: z.unknown().optional(),
|
|
@@ -6548,11 +6709,11 @@ var KnishIOClientConfigSchema2 = z.object({
|
|
|
6548
6709
|
defaultRequestPolicy: z.enum(["cache-first", "cache-only", "network-only", "cache-and-network"]).nullable().optional()
|
|
6549
6710
|
}).strict();
|
|
6550
6711
|
var EnvironmentConfigSchema = z.object({
|
|
6551
|
-
NODE_ENV: z.enum(["development", "production", "test"]).
|
|
6552
|
-
KNISHIO_NODE_URI:
|
|
6712
|
+
NODE_ENV: z.enum(["development", "production", "test"]).optional(),
|
|
6713
|
+
KNISHIO_NODE_URI: urlString2().optional(),
|
|
6553
6714
|
KNISHIO_CELL_SLUG: z.string().optional(),
|
|
6554
|
-
KNISHIO_LOGGING: z.string().transform((val) => val === "true").
|
|
6555
|
-
KNISHIO_SERVER_SDK_VERSION: z.string().transform((val) => parseInt(val, 10)).
|
|
6715
|
+
KNISHIO_LOGGING: z.string().transform((val) => val === "true").optional(),
|
|
6716
|
+
KNISHIO_SERVER_SDK_VERSION: z.string().transform((val) => parseInt(val, 10)).optional()
|
|
6556
6717
|
}).partial();
|
|
6557
6718
|
var TransferParamsSchema2 = z.object({
|
|
6558
6719
|
recipient: z.union([WalletAddressSchema2, z.string()]),
|
|
@@ -6561,7 +6722,7 @@ var TransferParamsSchema2 = z.object({
|
|
|
6561
6722
|
"Amount must be positive"
|
|
6562
6723
|
),
|
|
6563
6724
|
token: z.union([TokenSlugSchema2, z.string()]).optional(),
|
|
6564
|
-
callbackUrl:
|
|
6725
|
+
callbackUrl: urlString2().optional(),
|
|
6565
6726
|
metaType: z.string().optional(),
|
|
6566
6727
|
metaId: z.string().optional(),
|
|
6567
6728
|
meta: MetaDataSchema2.optional()
|
|
@@ -6602,7 +6763,7 @@ var MetaQueryParamsSchema2 = z.object({
|
|
|
6602
6763
|
value: z.string().optional(),
|
|
6603
6764
|
latest: z.boolean().optional(),
|
|
6604
6765
|
filter: z.string().optional(),
|
|
6605
|
-
queryArgs: z.record(z.unknown()).optional(),
|
|
6766
|
+
queryArgs: z.record(z.string(), z.unknown()).optional(),
|
|
6606
6767
|
count: z.number().int().min(0).optional(),
|
|
6607
6768
|
countBy: z.string().optional(),
|
|
6608
6769
|
cellSlug: z.union([CellSlugSchema2, z.string()]).optional()
|
|
@@ -6621,14 +6782,14 @@ var AuthTokenParamsSchema2 = z.object({
|
|
|
6621
6782
|
var AuthParamsSchema2 = z.object({
|
|
6622
6783
|
cellSlug: z.union([CellSlugSchema2, z.string()]).optional(),
|
|
6623
6784
|
encrypt: z.boolean().optional(),
|
|
6624
|
-
callback: z.
|
|
6785
|
+
callback: z.custom((value) => typeof value === "function").optional()
|
|
6625
6786
|
}).strict();
|
|
6626
6787
|
var GuestAuthParamsSchema2 = z.object({
|
|
6627
6788
|
cellSlug: z.union([CellSlugSchema2, z.string()]).optional()
|
|
6628
6789
|
}).strict();
|
|
6629
6790
|
var GraphQLRequestSchema2 = z.object({
|
|
6630
6791
|
query: z.string().min(1),
|
|
6631
|
-
variables: z.record(z.unknown()).optional(),
|
|
6792
|
+
variables: z.record(z.string(), z.unknown()).optional(),
|
|
6632
6793
|
operationName: z.string().optional()
|
|
6633
6794
|
}).strict();
|
|
6634
6795
|
var GraphQLErrorSchema2 = z.object({
|
|
@@ -6638,12 +6799,12 @@ var GraphQLErrorSchema2 = z.object({
|
|
|
6638
6799
|
column: z.number().int()
|
|
6639
6800
|
})).optional(),
|
|
6640
6801
|
path: z.array(z.union([z.string(), z.number()])).optional(),
|
|
6641
|
-
extensions: z.record(z.unknown()).optional()
|
|
6802
|
+
extensions: z.record(z.string(), z.unknown()).optional()
|
|
6642
6803
|
}).strict();
|
|
6643
6804
|
var GraphQLResponseSchema2 = z.object({
|
|
6644
6805
|
data: z.unknown().optional(),
|
|
6645
6806
|
errors: z.array(GraphQLErrorSchema2).optional(),
|
|
6646
|
-
extensions: z.record(z.unknown()).optional()
|
|
6807
|
+
extensions: z.record(z.string(), z.unknown()).optional()
|
|
6647
6808
|
}).strict();
|
|
6648
6809
|
function safeParse(schema, data) {
|
|
6649
6810
|
const result = schema.safeParse(data);
|
|
@@ -6653,7 +6814,7 @@ function safeParse(schema, data) {
|
|
|
6653
6814
|
error: {
|
|
6654
6815
|
issues: result.error.issues,
|
|
6655
6816
|
message: result.error.message,
|
|
6656
|
-
formatted: result.error
|
|
6817
|
+
formatted: z.treeifyError(result.error)
|
|
6657
6818
|
}
|
|
6658
6819
|
};
|
|
6659
6820
|
}
|
|
@@ -11914,7 +12075,7 @@ var PolicyMeta = class _PolicyMeta {
|
|
|
11914
12075
|
|
|
11915
12076
|
// src/index.ts
|
|
11916
12077
|
init_exception();
|
|
11917
|
-
var SDK_VERSION = "
|
|
12078
|
+
var SDK_VERSION = "0.9.5";
|
|
11918
12079
|
var SDK_NAME = "KnishIO-Client-TS";
|
|
11919
12080
|
var COMPATIBLE_SERVER_VERSIONS = [4, 5];
|
|
11920
12081
|
var SDK_INFO = {
|