@wishknish/knishio-client-ts 0.7.0

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.
Files changed (141) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +425 -0
  3. package/dist/index.cjs +9961 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.iife.js +32241 -0
  6. package/dist/index.iife.js.map +1 -0
  7. package/dist/index.js +9853 -0
  8. package/dist/index.js.map +1 -0
  9. package/package.json +113 -0
  10. package/src/AuthToken.ts +214 -0
  11. package/src/KnishIOClient.ts +2020 -0
  12. package/src/constants.ts +398 -0
  13. package/src/core/Atom.ts +646 -0
  14. package/src/core/AtomMeta.ts +278 -0
  15. package/src/core/Meta.ts +428 -0
  16. package/src/core/Molecule.ts +825 -0
  17. package/src/core/PolicyMeta.ts +130 -0
  18. package/src/core/TokenUnit.ts +148 -0
  19. package/src/core/Wallet.ts +467 -0
  20. package/src/exception/AtomIndexException.ts +97 -0
  21. package/src/exception/AtomsMissingException.ts +109 -0
  22. package/src/exception/AuthorizationRejectedException.ts +63 -0
  23. package/src/exception/BalanceInsufficientException.ts +58 -0
  24. package/src/exception/BaseException.ts +275 -0
  25. package/src/exception/BatchIdException.ts +58 -0
  26. package/src/exception/CodeException.ts +119 -0
  27. package/src/exception/DecryptionKeyException.ts +65 -0
  28. package/src/exception/InvalidResponseException.ts +112 -0
  29. package/src/exception/MetaMissingException.ts +58 -0
  30. package/src/exception/MolecularHashMismatchException.ts +115 -0
  31. package/src/exception/MolecularHashMissingException.ts +58 -0
  32. package/src/exception/NegativeAmountException.ts +58 -0
  33. package/src/exception/PolicyInvalidException.ts +58 -0
  34. package/src/exception/SignatureMalformedException.ts +58 -0
  35. package/src/exception/SignatureMismatchException.ts +98 -0
  36. package/src/exception/StackableUnitAmountException.ts +65 -0
  37. package/src/exception/StackableUnitDecimalsException.ts +65 -0
  38. package/src/exception/TransferBalanceException.ts +98 -0
  39. package/src/exception/TransferMalformedException.ts +58 -0
  40. package/src/exception/TransferMismatchedException.ts +58 -0
  41. package/src/exception/TransferRemainderException.ts +58 -0
  42. package/src/exception/TransferToSelfException.ts +58 -0
  43. package/src/exception/TransferUnbalancedException.ts +58 -0
  44. package/src/exception/UnauthenticatedException.ts +147 -0
  45. package/src/exception/WalletCredentialException.ts +108 -0
  46. package/src/exception/WalletShadowException.ts +65 -0
  47. package/src/exception/WrongTokenTypeException.ts +58 -0
  48. package/src/exception/index.ts +272 -0
  49. package/src/index.ts +512 -0
  50. package/src/instance/rules/Callback.ts +257 -0
  51. package/src/instance/rules/Condition.ts +96 -0
  52. package/src/instance/rules/Meta.ts +163 -0
  53. package/src/instance/rules/Rule.ts +29 -0
  54. package/src/instance/rules/exception/RuleArgumentException.ts +65 -0
  55. package/src/libraries/CheckMolecule.ts +581 -0
  56. package/src/libraries/Decimal.ts +94 -0
  57. package/src/libraries/Dot.ts +202 -0
  58. package/src/libraries/GraphQLClient.ts +276 -0
  59. package/src/libraries/Hex.ts +155 -0
  60. package/src/libraries/UrqlClientWrapper.ts +336 -0
  61. package/src/libraries/array.ts +91 -0
  62. package/src/libraries/crypto.ts +816 -0
  63. package/src/libraries/strings.ts +458 -0
  64. package/src/mutation/Mutation.ts +103 -0
  65. package/src/mutation/MutationActiveSession.ts +108 -0
  66. package/src/mutation/MutationClaimShadowWallet.ts +91 -0
  67. package/src/mutation/MutationCreateIdentifier.ts +86 -0
  68. package/src/mutation/MutationCreateMeta.ts +92 -0
  69. package/src/mutation/MutationCreateRule.ts +90 -0
  70. package/src/mutation/MutationCreateToken.ts +92 -0
  71. package/src/mutation/MutationCreateWallet.ts +78 -0
  72. package/src/mutation/MutationDepositBufferToken.ts +72 -0
  73. package/src/mutation/MutationLinkIdentifier.ts +87 -0
  74. package/src/mutation/MutationProposeMolecule.ts +147 -0
  75. package/src/mutation/MutationRequestAuthorization.ts +77 -0
  76. package/src/mutation/MutationRequestAuthorizationGuest.ts +85 -0
  77. package/src/mutation/MutationRequestTokens.ts +98 -0
  78. package/src/mutation/MutationTransferTokens.ts +87 -0
  79. package/src/mutation/MutationWithdrawBufferToken.ts +73 -0
  80. package/src/query/Query.ts +187 -0
  81. package/src/query/QueryActiveSession.ts +89 -0
  82. package/src/query/QueryAtom.ts +275 -0
  83. package/src/query/QueryBalance.ts +102 -0
  84. package/src/query/QueryBatch.ts +145 -0
  85. package/src/query/QueryBatchHistory.ts +86 -0
  86. package/src/query/QueryContinuId.ts +91 -0
  87. package/src/query/QueryMetaType.ts +177 -0
  88. package/src/query/QueryMetaTypeViaAtom.ts +199 -0
  89. package/src/query/QueryPolicy.ts +91 -0
  90. package/src/query/QueryToken.ts +90 -0
  91. package/src/query/QueryUserActivity.ts +153 -0
  92. package/src/query/QueryWalletBundle.ts +92 -0
  93. package/src/query/QueryWalletList.ts +106 -0
  94. package/src/response/EnhancedResponse.ts +345 -0
  95. package/src/response/Response.ts +254 -0
  96. package/src/response/ResponseActiveSession.ts +72 -0
  97. package/src/response/ResponseAtom.ts +132 -0
  98. package/src/response/ResponseAuthorizationGuest.ts +119 -0
  99. package/src/response/ResponseBalance.ts +153 -0
  100. package/src/response/ResponseClaimShadowWallet.ts +56 -0
  101. package/src/response/ResponseContinuId.ts +101 -0
  102. package/src/response/ResponseCreateIdentifier.ts +56 -0
  103. package/src/response/ResponseCreateMeta.ts +58 -0
  104. package/src/response/ResponseCreateRule.ts +56 -0
  105. package/src/response/ResponseCreateToken.ts +58 -0
  106. package/src/response/ResponseCreateWallet.ts +58 -0
  107. package/src/response/ResponseLinkIdentifier.ts +87 -0
  108. package/src/response/ResponseMetaBatch.ts +72 -0
  109. package/src/response/ResponseMetaType.ts +108 -0
  110. package/src/response/ResponseMetaTypeViaAtom.ts +108 -0
  111. package/src/response/ResponsePolicy.ts +90 -0
  112. package/src/response/ResponseProposeMolecule.ts +155 -0
  113. package/src/response/ResponseQueryActiveSession.ts +105 -0
  114. package/src/response/ResponseQueryUserActivity.ts +89 -0
  115. package/src/response/ResponseRequestAuthorization.ts +100 -0
  116. package/src/response/ResponseRequestAuthorizationGuest.ts +133 -0
  117. package/src/response/ResponseRequestTokens.ts +58 -0
  118. package/src/response/ResponseTransferTokens.ts +72 -0
  119. package/src/response/ResponseWalletBundle.ts +95 -0
  120. package/src/response/ResponseWalletList.ts +165 -0
  121. package/src/schemas/index.ts +457 -0
  122. package/src/subscribe/ActiveSessionSubscribe.ts +72 -0
  123. package/src/subscribe/ActiveWalletSubscribe.ts +99 -0
  124. package/src/subscribe/CreateMoleculeSubscribe.ts +106 -0
  125. package/src/subscribe/Subscribe.ts +182 -0
  126. package/src/subscribe/WalletStatusSubscribe.ts +70 -0
  127. package/src/subscribe/index.ts +59 -0
  128. package/src/types/assertions.ts +722 -0
  129. package/src/types/client.ts +567 -0
  130. package/src/types/crypto.ts +541 -0
  131. package/src/types/graphql.ts +630 -0
  132. package/src/types/guards.ts +659 -0
  133. package/src/types/index.ts +614 -0
  134. package/src/types/response.ts +133 -0
  135. package/src/types/template-literals.ts +382 -0
  136. package/src/validation/UNIVERSAL_CONFIGURATION_INTERFACES.ts +580 -0
  137. package/src/validation/ValidationService.ts +607 -0
  138. package/src/validation/schemas.ts +447 -0
  139. package/src/versions/HashAtom.ts +170 -0
  140. package/src/versions/Version4.ts +120 -0
  141. package/src/versions/index.ts +80 -0
@@ -0,0 +1,567 @@
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-TS for information.
45
+
46
+ License: https://github.com/WishKnish/KnishIO-Client-TS/blob/master/LICENSE
47
+ */
48
+
49
+ /**
50
+ * KnishIO Client-specific type definitions
51
+ */
52
+
53
+ import type {
54
+ WalletAddress,
55
+ BundleHash,
56
+ TokenSlug,
57
+ MetaType,
58
+ MetaId,
59
+ CellSlug,
60
+ MetaData,
61
+ BaseResponse
62
+ } from './index'
63
+
64
+ // =============================================================================
65
+ // CLIENT INITIALIZATION TYPES
66
+ // =============================================================================
67
+
68
+ export interface KnishIOClientOptions {
69
+ uri?: string | string[]
70
+ cellSlug?: CellSlug | string | null
71
+ client?: unknown | null
72
+ socket?: unknown | null
73
+ serverSdkVersion?: number
74
+ logging?: boolean
75
+ }
76
+
77
+ export interface ClientInitializationResult {
78
+ success: boolean
79
+ uri: string
80
+ cellSlug: CellSlug | null
81
+ serverVersion: number
82
+ }
83
+
84
+ // =============================================================================
85
+ // WALLET OPERATION TYPES
86
+ // =============================================================================
87
+
88
+ export interface CreateWalletOptions {
89
+ token?: TokenSlug | string
90
+ cellSlug?: CellSlug | string | null
91
+ }
92
+
93
+ export interface ClaimShadowOptions {
94
+ token: TokenSlug | string
95
+ bundleHash?: BundleHash | string | null
96
+ }
97
+
98
+ export interface ClaimShadowsOptions {
99
+ tokens: Array<TokenSlug | string>
100
+ bundleHashes?: Array<BundleHash | string> | null
101
+ }
102
+
103
+ // =============================================================================
104
+ // TOKEN OPERATION TYPES
105
+ // =============================================================================
106
+
107
+ export interface CreateTokenOptions {
108
+ token: TokenSlug | string
109
+ amount?: number | string
110
+ fungible?: boolean
111
+ splittable?: number | null
112
+ position?: string | null
113
+ supplyToken?: TokenSlug | string | null
114
+ metaType?: MetaType | string | null
115
+ metaId?: MetaId | string | null
116
+ meta?: MetaData | null
117
+ callbackUrl?: string | null
118
+ }
119
+
120
+ export interface TransferTokenOptions {
121
+ recipient: WalletAddress | string
122
+ amount: number | string
123
+ token?: TokenSlug | string
124
+ remainder?: boolean
125
+ metaType?: MetaType | string | null
126
+ metaId?: MetaId | string | null
127
+ meta?: MetaData | null
128
+ callbackUrl?: string | null
129
+ }
130
+
131
+ export interface RequestTokensOptions {
132
+ to: WalletAddress | string
133
+ amount: number | string
134
+ token?: TokenSlug | string
135
+ metaType?: MetaType | string | null
136
+ metaId?: MetaId | string | null
137
+ meta?: MetaData | null
138
+ }
139
+
140
+ export interface BurnTokensOptions {
141
+ token: TokenSlug | string
142
+ amount: number | string
143
+ callbackUrl?: string | null
144
+ }
145
+
146
+ export interface ReplenishTokenOptions {
147
+ token: TokenSlug | string
148
+ amount: number | string
149
+ callbackUrl?: string | null
150
+ }
151
+
152
+ export interface FuseTokenOptions {
153
+ targetToken: TokenSlug | string
154
+ tokens: Record<TokenSlug | string, number>
155
+ callbackUrl?: string | null
156
+ }
157
+
158
+ // =============================================================================
159
+ // BUFFER TOKEN OPERATION TYPES
160
+ // =============================================================================
161
+
162
+ export interface DepositBufferOptions {
163
+ token: TokenSlug | string
164
+ amount: number | string
165
+ targetWallet?: WalletAddress | string | null
166
+ callbackUrl?: string | null
167
+ }
168
+
169
+ export interface WithdrawBufferOptions {
170
+ token: TokenSlug | string
171
+ amount: number | string
172
+ sourceWallet?: WalletAddress | string | null
173
+ callbackUrl?: string | null
174
+ }
175
+
176
+ // =============================================================================
177
+ // META OPERATION TYPES
178
+ // =============================================================================
179
+
180
+ export interface CreateMetaOptions {
181
+ metaType: MetaType | string
182
+ metaId: MetaId | string
183
+ meta: MetaData
184
+ callbackUrl?: string | null
185
+ }
186
+
187
+ export interface CreateIdentifierOptions {
188
+ type: string
189
+ contact: string
190
+ code?: string | null
191
+ callbackUrl?: string | null
192
+ }
193
+
194
+ export interface CreateRuleOptions {
195
+ metaType: MetaType | string
196
+ metaId: MetaId | string
197
+ policy: Record<string, unknown>
198
+ callbackUrl?: string | null
199
+ }
200
+
201
+ export interface CreatePolicyOptions {
202
+ policy: Record<string, unknown>
203
+ callbackUrl?: string | null
204
+ }
205
+
206
+ // =============================================================================
207
+ // QUERY OPERATION TYPES
208
+ // =============================================================================
209
+
210
+ export interface BalanceQueryOptions {
211
+ address?: WalletAddress | string | null
212
+ bundleHash?: BundleHash | string | null
213
+ token?: TokenSlug | string | null
214
+ type?: 'token' | 'user' | null
215
+ unspent?: boolean | null
216
+ }
217
+
218
+ export interface WalletQueryOptions {
219
+ bundleHash?: BundleHash | string | null
220
+ tokenSlug?: TokenSlug | string | null
221
+ unspent?: boolean | null
222
+ limit?: number | null
223
+ offset?: number | null
224
+ }
225
+
226
+ export interface BundleQueryOptions {
227
+ bundleHashes: Array<BundleHash | string>
228
+ }
229
+
230
+ export interface ContinuIdOptions {
231
+ bundle: BundleHash | string
232
+ }
233
+
234
+ export interface MetaQueryOptions {
235
+ metaType: MetaType | string
236
+ metaId?: MetaId | string | null
237
+ key?: string | null
238
+ value?: string | null
239
+ latest?: boolean | null
240
+ filter?: string | null
241
+ queryArgs?: Record<string, unknown> | null
242
+ count?: number | null
243
+ countBy?: string | null
244
+ cellSlug?: CellSlug | string | null
245
+ }
246
+
247
+ export interface BatchQueryOptions {
248
+ batchId: string
249
+ }
250
+
251
+ export interface BatchHistoryOptions {
252
+ batchId: string
253
+ }
254
+
255
+ export interface AtomQueryOptions {
256
+ position?: string | null
257
+ isotope?: string | null
258
+ token?: TokenSlug | string | null
259
+ metaType?: MetaType | string | null
260
+ metaId?: MetaId | string | null
261
+ limit?: number | null
262
+ offset?: number | null
263
+ }
264
+
265
+ export interface ActiveSessionOptions {
266
+ bundleHash?: BundleHash | string | null
267
+ metaType?: MetaType | string | null
268
+ metaId?: MetaId | string | null
269
+ }
270
+
271
+ export interface UserActivityOptions {
272
+ bundleHash?: BundleHash | string | null
273
+ metaType?: MetaType | string | null
274
+ metaId?: MetaId | string | null
275
+ dateFrom?: string | null
276
+ dateTo?: string | null
277
+ limit?: number | null
278
+ offset?: number | null
279
+ }
280
+
281
+ export interface PolicyQueryOptions {
282
+ metaType?: MetaType | string | null
283
+ metaId?: MetaId | string | null
284
+ }
285
+
286
+ // =============================================================================
287
+ // SESSION & AUTHENTICATION TYPES
288
+ // =============================================================================
289
+
290
+ export interface ActiveSessionResult {
291
+ sessionId: string
292
+ bundleHash: BundleHash
293
+ expiresAt: number
294
+ status: 'active' | 'expired' | 'inactive'
295
+ }
296
+
297
+ export interface ProfileAuthOptions {
298
+ profile: Record<string, unknown>
299
+ cellSlug?: CellSlug | string | null
300
+ }
301
+
302
+ // =============================================================================
303
+ // SUBSCRIPTION OPERATION TYPES
304
+ // =============================================================================
305
+
306
+ export interface SubscribeOptions {
307
+ operationName?: string
308
+ variables?: Record<string, unknown>
309
+ callback?: (data: unknown) => void
310
+ }
311
+
312
+ export interface WalletStatusSubscribeOptions extends SubscribeOptions {
313
+ bundleHash: BundleHash | string
314
+ }
315
+
316
+ export interface ActiveWalletSubscribeOptions extends SubscribeOptions {
317
+ bundleHash: BundleHash | string
318
+ token?: TokenSlug | string | null
319
+ }
320
+
321
+ export interface ActiveSessionSubscribeOptions extends SubscribeOptions {
322
+ bundleHash: BundleHash | string
323
+ }
324
+
325
+ // =============================================================================
326
+ // MOLECULE CREATION TYPES
327
+ // =============================================================================
328
+
329
+ export interface CreateMoleculeOptions {
330
+ cellSlug?: CellSlug | string | null
331
+ sourceWallet?: unknown | null
332
+ remainderWallet?: unknown | null
333
+ }
334
+
335
+ export interface MoleculeMutationOptions {
336
+ mutationClass: unknown
337
+ variables?: Record<string, unknown>
338
+ fillMolecule?: boolean
339
+ }
340
+
341
+ // =============================================================================
342
+ // RESPONSE TYPES FOR SPECIFIC OPERATIONS
343
+ // =============================================================================
344
+
345
+ export interface ResponseCreateWallet extends BaseResponse<{
346
+ address: WalletAddress
347
+ bundle: BundleHash
348
+ token: TokenSlug
349
+ createdAt: string
350
+ }> {}
351
+
352
+ export interface ResponseCreateToken extends BaseResponse<{
353
+ token: TokenSlug
354
+ amount: string
355
+ fungible: boolean
356
+ molecularHash: string
357
+ createdAt: string
358
+ }> {}
359
+
360
+ export interface ResponseTransferTokens extends BaseResponse<{
361
+ molecularHash: string
362
+ amount: string
363
+ recipient: WalletAddress
364
+ remainder?: string | null
365
+ createdAt: string
366
+ }> {}
367
+
368
+ export interface ResponseRequestTokens extends BaseResponse<{
369
+ molecularHash: string
370
+ amount: string
371
+ token: TokenSlug
372
+ createdAt: string
373
+ }> {}
374
+
375
+ export interface ResponseBalance extends BaseResponse<{
376
+ address: WalletAddress
377
+ position: string
378
+ amount: string
379
+ characters: string | null
380
+ token: TokenSlug
381
+ }> {}
382
+
383
+ export interface ResponseWalletList extends BaseResponse<{
384
+ wallets: Array<{
385
+ address: WalletAddress
386
+ token: TokenSlug
387
+ balance: string
388
+ position: string
389
+ createdAt: string
390
+ }>
391
+ }> {}
392
+
393
+ export interface ResponseWalletBundle extends BaseResponse<{
394
+ bundleHash: BundleHash
395
+ wallets: Array<{
396
+ address: WalletAddress
397
+ token: TokenSlug
398
+ balance: string
399
+ }>
400
+ }> {}
401
+
402
+ export interface ResponseContinuId extends BaseResponse<{
403
+ bundle: BundleHash
404
+ position: string
405
+ createdAt: string
406
+ }> {}
407
+
408
+ export interface ResponseCreateMeta extends BaseResponse<{
409
+ metaType: MetaType
410
+ metaId: MetaId
411
+ meta: MetaData
412
+ molecularHash: string
413
+ createdAt: string
414
+ }> {}
415
+
416
+ export interface ResponseCreateIdentifier extends BaseResponse<{
417
+ type: string
418
+ contact: string
419
+ molecularHash: string
420
+ createdAt: string
421
+ }> {}
422
+
423
+ export interface ResponseCreateRule extends BaseResponse<{
424
+ metaType: MetaType
425
+ metaId: MetaId
426
+ policy: Record<string, unknown>
427
+ molecularHash: string
428
+ createdAt: string
429
+ }> {}
430
+
431
+ export interface ResponseClaimShadowWallet extends BaseResponse<{
432
+ address: WalletAddress
433
+ token: TokenSlug
434
+ molecularHash: string
435
+ createdAt: string
436
+ }> {}
437
+
438
+ export interface ResponseRequestAuthorization extends BaseResponse<{
439
+ authToken: string
440
+ expiresAt: number
441
+ pubkey: string
442
+ encrypt: boolean
443
+ }> {}
444
+
445
+ export interface ResponseRequestAuthorizationGuest extends BaseResponse<{
446
+ authToken: string
447
+ expiresAt: number
448
+ }> {}
449
+
450
+ export interface ResponseMetaType extends BaseResponse<{
451
+ metaType: MetaType
452
+ instances: Array<{
453
+ metaId: MetaId
454
+ meta: MetaData
455
+ createdAt: string
456
+ }>
457
+ }> {}
458
+
459
+ export interface ResponseAtom extends BaseResponse<{
460
+ atoms: Array<{
461
+ position: string
462
+ walletAddress: WalletAddress
463
+ isotope: string
464
+ token: TokenSlug
465
+ value: string | null
466
+ metaType: MetaType | null
467
+ metaId: MetaId | null
468
+ createdAt: string
469
+ }>
470
+ }> {}
471
+
472
+ export interface ResponseQueryActiveSession extends BaseResponse<{
473
+ sessionId: string
474
+ bundleHash: BundleHash
475
+ status: string
476
+ createdAt: string
477
+ expiresAt: string
478
+ }> {}
479
+
480
+ export interface ResponseQueryUserActivity extends BaseResponse<{
481
+ activities: Array<{
482
+ type: string
483
+ description: string
484
+ data: Record<string, unknown>
485
+ createdAt: string
486
+ }>
487
+ }> {}
488
+
489
+ export interface ResponsePolicy extends BaseResponse<{
490
+ policy: Record<string, unknown>
491
+ metaType: MetaType | null
492
+ metaId: MetaId | null
493
+ createdAt: string
494
+ }> {}
495
+
496
+ export interface ResponseActiveSession extends BaseResponse<ActiveSessionResult> {}
497
+
498
+ // =============================================================================
499
+ // DEVICE FINGERPRINTING TYPES
500
+ // =============================================================================
501
+
502
+ export interface FingerprintData {
503
+ userAgent: string
504
+ language: string
505
+ platform: string
506
+ timezone: string
507
+ screen: {
508
+ width: number
509
+ height: number
510
+ colorDepth: number
511
+ }
512
+ canvas?: string
513
+ webgl?: string
514
+ fonts?: string[]
515
+ plugins?: string[]
516
+ }
517
+
518
+ // =============================================================================
519
+ // CONFIGURATION & UTILITY TYPES
520
+ // =============================================================================
521
+
522
+ export interface LogLevel {
523
+ level: 'debug' | 'info' | 'warn' | 'error'
524
+ message: string
525
+ timestamp: number
526
+ context?: Record<string, unknown>
527
+ }
528
+
529
+ export interface ConnectionStatus {
530
+ connected: boolean
531
+ uri: string
532
+ latency?: number
533
+ lastCheck: number
534
+ }
535
+
536
+ export interface ServerVersion {
537
+ version: string
538
+ compatible: boolean
539
+ features: string[]
540
+ }
541
+
542
+ // =============================================================================
543
+ // BUILDER PATTERN TYPES
544
+ // =============================================================================
545
+
546
+ export interface KnishIOClientBuilder {
547
+ withUri(uri: string | string[]): this
548
+ withCellSlug(cellSlug: CellSlug | string): this
549
+ withLogging(enabled: boolean): this
550
+ withServerVersion(version: number): this
551
+ build(): Promise<unknown> // Will be the actual client instance
552
+ }
553
+
554
+ // =============================================================================
555
+ // ERROR CONTEXT TYPES
556
+ // =============================================================================
557
+
558
+ export interface ClientErrorContext {
559
+ operation: string
560
+ parameters: Record<string, unknown>
561
+ uri?: string
562
+ cellSlug?: CellSlug | string | null
563
+ timestamp: number
564
+ stack?: string
565
+ }
566
+
567
+ // All types are already exported at their definitions above