@wishknish/knishio-client-ts 0.9.4 → 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 CHANGED
@@ -3839,6 +3839,14 @@ var Wallet = class _Wallet {
3839
3839
  };
3840
3840
  var hexStringRegex = /^[0-9a-fA-F]+$/;
3841
3841
  var base17HashRegex = /^[0-9a-g]+$/;
3842
+ var urlString = (message = "Invalid URL") => zod.z.string().refine((value) => {
3843
+ try {
3844
+ new URL(value);
3845
+ return true;
3846
+ } catch {
3847
+ return false;
3848
+ }
3849
+ }, message);
3842
3850
  zod.z.string().regex(hexStringRegex, "Must be a valid hexadecimal string").brand();
3843
3851
  var WalletAddressSchema = zod.z.string().regex(hexStringRegex, "Wallet address must be hexadecimal").length(64, "Wallet address must be exactly 64 characters").brand();
3844
3852
  var BundleHashSchema = zod.z.string().regex(hexStringRegex, "Bundle hash must be hexadecimal").length(64, "Bundle hash must be exactly 64 characters").brand();
@@ -3850,7 +3858,7 @@ var MetaIdSchema = zod.z.string().min(1, "Meta ID cannot be empty").brand();
3850
3858
  var BatchIdSchema = zod.z.string().min(1, "Batch ID cannot be empty").brand();
3851
3859
  var CellSlugSchema = zod.z.string().min(1, "Cell slug cannot be empty").max(64, "Cell slug cannot exceed 64 characters").brand();
3852
3860
  var AtomIsotopeSchema = zod.z.enum(["C", "V", "U", "T", "M", "I", "R", "B", "F"], {
3853
- errorMap: () => ({ message: "Invalid atom isotope. Must be one of: C, V, U, T, M, I, R, B, F" })
3861
+ error: "Invalid atom isotope. Must be one of: C, V, U, T, M, I, R, B, F"
3854
3862
  });
3855
3863
  var MetaDataValueSchema = zod.z.union([
3856
3864
  zod.z.string(),
@@ -3863,7 +3871,7 @@ var AtomMetaDataSchema = zod.z.object({
3863
3871
  value: MetaDataValueSchema
3864
3872
  }).strict();
3865
3873
  var MetaDataSchema = zod.z.lazy(
3866
- () => zod.z.record(zod.z.union([
3874
+ () => zod.z.record(zod.z.string(), zod.z.union([
3867
3875
  MetaDataValueSchema,
3868
3876
  MetaDataSchema,
3869
3877
  zod.z.array(MetaDataSchema)
@@ -3902,7 +3910,7 @@ zod.z.object({
3902
3910
  version: zod.z.number().int().min(1).optional()
3903
3911
  }).strict();
3904
3912
  zod.z.object({
3905
- uri: zod.z.union([zod.z.string().url(), zod.z.array(zod.z.string().url())]).optional(),
3913
+ uri: zod.z.union([urlString(), zod.z.array(urlString())]).optional(),
3906
3914
  cellSlug: zod.z.union([CellSlugSchema, zod.z.string(), zod.z.null()]).optional(),
3907
3915
  client: zod.z.unknown().optional(),
3908
3916
  socket: zod.z.unknown().optional(),
@@ -3919,7 +3927,7 @@ zod.z.object({
3919
3927
  zod.z.object({
3920
3928
  cellSlug: zod.z.union([CellSlugSchema, zod.z.string(), zod.z.null()]).optional(),
3921
3929
  encrypt: zod.z.boolean().optional(),
3922
- callback: zod.z.function().args(zod.z.unknown()).returns(zod.z.void()).optional()
3930
+ callback: zod.z.custom((value) => typeof value === "function").optional()
3923
3931
  }).strict();
3924
3932
  zod.z.object({
3925
3933
  cellSlug: zod.z.union([CellSlugSchema, zod.z.string(), zod.z.null()]).optional()
@@ -3928,7 +3936,7 @@ zod.z.object({
3928
3936
  recipient: zod.z.union([WalletAddressSchema, zod.z.string()]),
3929
3937
  amount: zod.z.union([zod.z.number().positive(), zod.z.string().min(1)]),
3930
3938
  token: zod.z.union([TokenSlugSchema, zod.z.string()]).optional(),
3931
- callbackUrl: zod.z.union([zod.z.string().url(), zod.z.null()]).optional(),
3939
+ callbackUrl: zod.z.union([urlString(), zod.z.null()]).optional(),
3932
3940
  metaType: zod.z.union([MetaTypeSchema, zod.z.string(), zod.z.null()]).optional(),
3933
3941
  metaId: zod.z.union([MetaIdSchema, zod.z.string(), zod.z.null()]).optional(),
3934
3942
  meta: zod.z.union([MetaDataSchema, zod.z.null()]).optional()
@@ -3969,7 +3977,7 @@ zod.z.object({
3969
3977
  value: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
3970
3978
  latest: zod.z.union([zod.z.boolean(), zod.z.null()]).optional(),
3971
3979
  filter: zod.z.union([zod.z.array(MetaFilterSchema), zod.z.null()]).optional(),
3972
- queryArgs: zod.z.union([zod.z.record(zod.z.unknown()), zod.z.null()]).optional(),
3980
+ queryArgs: zod.z.union([zod.z.record(zod.z.string(), zod.z.unknown()), zod.z.null()]).optional(),
3973
3981
  count: zod.z.union([zod.z.number().int().min(1), zod.z.null()]).optional(),
3974
3982
  countBy: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
3975
3983
  cellSlug: zod.z.union([CellSlugSchema, zod.z.string(), zod.z.null()]).optional()
@@ -3994,7 +4002,7 @@ zod.z.object({
3994
4002
  }).strict();
3995
4003
  zod.z.object({
3996
4004
  query: zod.z.string().min(1, "GraphQL query cannot be empty"),
3997
- variables: zod.z.record(zod.z.unknown()).optional(),
4005
+ variables: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
3998
4006
  operationName: zod.z.union([zod.z.string(), zod.z.null()]).optional()
3999
4007
  }).strict();
4000
4008
  var GraphQLErrorSchema = zod.z.object({
@@ -4004,18 +4012,18 @@ var GraphQLErrorSchema = zod.z.object({
4004
4012
  column: zod.z.number().int().min(1)
4005
4013
  })).optional(),
4006
4014
  path: zod.z.array(zod.z.union([zod.z.string(), zod.z.number()])).optional(),
4007
- extensions: zod.z.record(zod.z.unknown()).optional()
4015
+ extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
4008
4016
  }).strict();
4009
4017
  zod.z.object({
4010
4018
  data: zod.z.unknown().optional(),
4011
4019
  errors: zod.z.array(GraphQLErrorSchema).nullable().optional(),
4012
- extensions: zod.z.record(zod.z.unknown()).optional()
4020
+ extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
4013
4021
  }).strict();
4014
4022
  zod.z.object({
4015
4023
  operationName: zod.z.string().optional(),
4016
4024
  query: zod.z.string().optional(),
4017
- variables: zod.z.record(zod.z.unknown()).optional(),
4018
- callback: zod.z.function().args(zod.z.unknown()).returns(zod.z.void()).optional()
4025
+ variables: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
4026
+ callback: zod.z.custom((value) => typeof value === "function").optional()
4019
4027
  }).strict();
4020
4028
  zod.z.object({
4021
4029
  valid: zod.z.boolean(),
@@ -4025,7 +4033,7 @@ zod.z.object({
4025
4033
  }).strict();
4026
4034
  zod.z.object({
4027
4035
  operation: zod.z.string().optional(),
4028
- parameters: zod.z.record(zod.z.unknown()).optional(),
4036
+ parameters: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
4029
4037
  timestamp: zod.z.number().int().min(0).optional(),
4030
4038
  stack: zod.z.string().optional()
4031
4039
  }).strict();
@@ -4229,7 +4237,7 @@ var CallbackParamsSchema = zod.z.object({
4229
4237
  action: zod.z.string().min(1, "Action cannot be empty"),
4230
4238
  metaType: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
4231
4239
  metaId: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
4232
- meta: zod.z.union([zod.z.instanceof(Meta2), zod.z.record(zod.z.unknown()), zod.z.null()]).optional(),
4240
+ meta: zod.z.union([zod.z.instanceof(Meta2), zod.z.record(zod.z.string(), zod.z.unknown()), zod.z.null()]).optional(),
4233
4241
  address: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
4234
4242
  token: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
4235
4243
  amount: zod.z.union([zod.z.string(), zod.z.null()]).optional(),
@@ -6576,6 +6584,14 @@ var Mutation = class extends Query {
6576
6584
  }
6577
6585
  }
6578
6586
  };
6587
+ var urlString2 = (message = "Invalid URL") => zod.z.string().refine((value) => {
6588
+ try {
6589
+ new URL(value);
6590
+ return true;
6591
+ } catch {
6592
+ return false;
6593
+ }
6594
+ }, message);
6579
6595
  function createBrandedSchema(name, baseSchema = zod.z.string()) {
6580
6596
  return baseSchema.brand(name);
6581
6597
  }
@@ -6601,7 +6617,12 @@ var TokenSlugSchema2 = createBrandedSchema(
6601
6617
  );
6602
6618
  var BatchIdSchema2 = createBrandedSchema(
6603
6619
  "BatchId",
6604
- zod.z.string().uuid("Invalid batch ID format")
6620
+ // v3's `.uuid()` regex, inlined verbatim. Zod 4's `z.uuid()` additionally enforces the
6621
+ // RFC 9562 version/variant nibbles and would reject batch IDs v3 accepted.
6622
+ zod.z.string().regex(
6623
+ /^[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}$/,
6624
+ "Invalid batch ID format"
6625
+ )
6605
6626
  );
6606
6627
  var CellSlugSchema2 = createBrandedSchema(
6607
6628
  "CellSlug",
@@ -6645,7 +6666,7 @@ var AtomMetaDataSchema2 = zod.z.object({
6645
6666
  zod.z.object({
6646
6667
  key: zod.z.string(),
6647
6668
  value: zod.z.union([zod.z.string(), zod.z.number(), zod.z.boolean(), zod.z.null()])
6648
- }).passthrough();
6669
+ }).loose();
6649
6670
  var AtomParamsSchema2 = zod.z.object({
6650
6671
  position: zod.z.string().optional(),
6651
6672
  walletAddress: zod.z.union([WalletAddressSchema2, zod.z.string()]).optional(),
@@ -6680,8 +6701,8 @@ var MoleculeParamsSchema2 = zod.z.object({
6680
6701
  }).strict();
6681
6702
  var KnishIOClientConfigSchema2 = zod.z.object({
6682
6703
  uri: zod.z.union([
6683
- zod.z.string().url("Invalid URI format"),
6684
- zod.z.array(zod.z.string().url("Invalid URI format")).min(1)
6704
+ urlString2("Invalid URI format"),
6705
+ zod.z.array(urlString2("Invalid URI format")).min(1)
6685
6706
  ]).optional(),
6686
6707
  cellSlug: zod.z.union([CellSlugSchema2, zod.z.string()]).optional(),
6687
6708
  client: zod.z.unknown().optional(),
@@ -6694,11 +6715,11 @@ var KnishIOClientConfigSchema2 = zod.z.object({
6694
6715
  defaultRequestPolicy: zod.z.enum(["cache-first", "cache-only", "network-only", "cache-and-network"]).nullable().optional()
6695
6716
  }).strict();
6696
6717
  var EnvironmentConfigSchema = zod.z.object({
6697
- NODE_ENV: zod.z.enum(["development", "production", "test"]).default("development"),
6698
- KNISHIO_NODE_URI: zod.z.string().url().optional(),
6718
+ NODE_ENV: zod.z.enum(["development", "production", "test"]).optional(),
6719
+ KNISHIO_NODE_URI: urlString2().optional(),
6699
6720
  KNISHIO_CELL_SLUG: zod.z.string().optional(),
6700
- KNISHIO_LOGGING: zod.z.string().transform((val) => val === "true").default("false"),
6701
- KNISHIO_SERVER_SDK_VERSION: zod.z.string().transform((val) => parseInt(val, 10)).default("4")
6721
+ KNISHIO_LOGGING: zod.z.string().transform((val) => val === "true").optional(),
6722
+ KNISHIO_SERVER_SDK_VERSION: zod.z.string().transform((val) => parseInt(val, 10)).optional()
6702
6723
  }).partial();
6703
6724
  var TransferParamsSchema2 = zod.z.object({
6704
6725
  recipient: zod.z.union([WalletAddressSchema2, zod.z.string()]),
@@ -6707,7 +6728,7 @@ var TransferParamsSchema2 = zod.z.object({
6707
6728
  "Amount must be positive"
6708
6729
  ),
6709
6730
  token: zod.z.union([TokenSlugSchema2, zod.z.string()]).optional(),
6710
- callbackUrl: zod.z.string().url().optional(),
6731
+ callbackUrl: urlString2().optional(),
6711
6732
  metaType: zod.z.string().optional(),
6712
6733
  metaId: zod.z.string().optional(),
6713
6734
  meta: MetaDataSchema2.optional()
@@ -6748,7 +6769,7 @@ var MetaQueryParamsSchema2 = zod.z.object({
6748
6769
  value: zod.z.string().optional(),
6749
6770
  latest: zod.z.boolean().optional(),
6750
6771
  filter: zod.z.string().optional(),
6751
- queryArgs: zod.z.record(zod.z.unknown()).optional(),
6772
+ queryArgs: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
6752
6773
  count: zod.z.number().int().min(0).optional(),
6753
6774
  countBy: zod.z.string().optional(),
6754
6775
  cellSlug: zod.z.union([CellSlugSchema2, zod.z.string()]).optional()
@@ -6767,14 +6788,14 @@ var AuthTokenParamsSchema2 = zod.z.object({
6767
6788
  var AuthParamsSchema2 = zod.z.object({
6768
6789
  cellSlug: zod.z.union([CellSlugSchema2, zod.z.string()]).optional(),
6769
6790
  encrypt: zod.z.boolean().optional(),
6770
- callback: zod.z.function().optional()
6791
+ callback: zod.z.custom((value) => typeof value === "function").optional()
6771
6792
  }).strict();
6772
6793
  var GuestAuthParamsSchema2 = zod.z.object({
6773
6794
  cellSlug: zod.z.union([CellSlugSchema2, zod.z.string()]).optional()
6774
6795
  }).strict();
6775
6796
  var GraphQLRequestSchema2 = zod.z.object({
6776
6797
  query: zod.z.string().min(1),
6777
- variables: zod.z.record(zod.z.unknown()).optional(),
6798
+ variables: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
6778
6799
  operationName: zod.z.string().optional()
6779
6800
  }).strict();
6780
6801
  var GraphQLErrorSchema2 = zod.z.object({
@@ -6784,12 +6805,12 @@ var GraphQLErrorSchema2 = zod.z.object({
6784
6805
  column: zod.z.number().int()
6785
6806
  })).optional(),
6786
6807
  path: zod.z.array(zod.z.union([zod.z.string(), zod.z.number()])).optional(),
6787
- extensions: zod.z.record(zod.z.unknown()).optional()
6808
+ extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
6788
6809
  }).strict();
6789
6810
  var GraphQLResponseSchema2 = zod.z.object({
6790
6811
  data: zod.z.unknown().optional(),
6791
6812
  errors: zod.z.array(GraphQLErrorSchema2).optional(),
6792
- extensions: zod.z.record(zod.z.unknown()).optional()
6813
+ extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
6793
6814
  }).strict();
6794
6815
  function safeParse(schema, data) {
6795
6816
  const result = schema.safeParse(data);
@@ -6799,7 +6820,7 @@ function safeParse(schema, data) {
6799
6820
  error: {
6800
6821
  issues: result.error.issues,
6801
6822
  message: result.error.message,
6802
- formatted: result.error.format()
6823
+ formatted: zod.z.treeifyError(result.error)
6803
6824
  }
6804
6825
  };
6805
6826
  }
@@ -12060,7 +12081,7 @@ var PolicyMeta = class _PolicyMeta {
12060
12081
 
12061
12082
  // src/index.ts
12062
12083
  init_exception();
12063
- var SDK_VERSION = "1.0.0";
12084
+ var SDK_VERSION = "0.9.5";
12064
12085
  var SDK_NAME = "KnishIO-Client-TS";
12065
12086
  var COMPATIBLE_SERVER_VERSIONS = [4, 5];
12066
12087
  var SDK_INFO = {