@sentio/sdk 3.8.0-rc.3 → 3.9.0-rc.11

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 (237) hide show
  1. package/lib/aptos/aptos-processor.d.ts +3 -3
  2. package/lib/aptos/aptos-processor.d.ts.map +1 -1
  3. package/lib/aptos/aptos-processor.js.map +1 -1
  4. package/lib/aptos/builtin/0x1.d.ts +897 -0
  5. package/lib/aptos/builtin/0x1.d.ts.map +1 -1
  6. package/lib/aptos/builtin/0x1.js +1322 -91
  7. package/lib/aptos/builtin/0x1.js.map +1 -1
  8. package/lib/aptos/builtin/0x3.js +1 -1
  9. package/lib/aptos/builtin/0x3.js.map +1 -1
  10. package/lib/aptos/builtin/0x4.d.ts +4 -4
  11. package/lib/aptos/builtin/0x4.d.ts.map +1 -1
  12. package/lib/aptos/builtin/0x4.js +16 -16
  13. package/lib/aptos/builtin/0x4.js.map +1 -1
  14. package/lib/core/normalization.d.ts.map +1 -1
  15. package/lib/core/normalization.js +1 -1
  16. package/lib/core/normalization.js.map +1 -1
  17. package/lib/core/partition-handler-manager.d.ts.map +1 -1
  18. package/lib/core/partition-handler-manager.js +1 -1
  19. package/lib/core/partition-handler-manager.js.map +1 -1
  20. package/lib/eth/base-processor-template.d.ts.map +1 -1
  21. package/lib/eth/base-processor-template.js +2 -0
  22. package/lib/eth/base-processor-template.js.map +1 -1
  23. package/lib/eth/base-processor.d.ts +2 -2
  24. package/lib/eth/base-processor.d.ts.map +1 -1
  25. package/lib/eth/base-processor.js.map +1 -1
  26. package/lib/eth/eth.d.ts +1 -1
  27. package/lib/eth/eth.d.ts.map +1 -1
  28. package/lib/eth/eth.js +6 -5
  29. package/lib/eth/eth.js.map +1 -1
  30. package/lib/fuel/fuel-processor-template.d.ts.map +1 -1
  31. package/lib/fuel/fuel-processor-template.js +2 -0
  32. package/lib/fuel/fuel-processor-template.js.map +1 -1
  33. package/lib/fuel/transaction.js +8 -3
  34. package/lib/fuel/transaction.js.map +1 -1
  35. package/lib/iota/builtin/0x2.d.ts +95 -0
  36. package/lib/iota/builtin/0x2.d.ts.map +1 -1
  37. package/lib/iota/builtin/0x2.js +586 -1
  38. package/lib/iota/builtin/0x2.js.map +1 -1
  39. package/lib/iota/iota-processor.d.ts +2 -2
  40. package/lib/iota/iota-processor.d.ts.map +1 -1
  41. package/lib/iota/iota-processor.js +2 -2
  42. package/lib/iota/iota-processor.js.map +1 -1
  43. package/lib/solana/builtin/index.d.ts +1 -0
  44. package/lib/solana/builtin/index.d.ts.map +1 -1
  45. package/lib/solana/builtin/index.js +1 -0
  46. package/lib/solana/builtin/index.js.map +1 -1
  47. package/lib/solana/builtin/spl-token-2022-processor.d.ts +46 -0
  48. package/lib/solana/builtin/spl-token-2022-processor.d.ts.map +1 -0
  49. package/lib/solana/builtin/spl-token-2022-processor.js +132 -0
  50. package/lib/solana/builtin/spl-token-2022-processor.js.map +1 -0
  51. package/lib/solana/builtin/spl-token-processor.d.ts +30 -30
  52. package/lib/solana/builtin/spl-token-processor.d.ts.map +1 -1
  53. package/lib/solana/builtin/types.d.ts +1699 -81
  54. package/lib/solana/builtin/types.d.ts.map +1 -1
  55. package/lib/solana/builtin/types.js +520 -72
  56. package/lib/solana/builtin/types.js.map +1 -1
  57. package/lib/solana/codegen/codegen.d.ts +1 -1
  58. package/lib/solana/codegen/codegen.d.ts.map +1 -1
  59. package/lib/solana/codegen/codegen.js +4 -4
  60. package/lib/solana/codegen/codegen.js.map +1 -1
  61. package/lib/solana/index.d.ts +1 -1
  62. package/lib/solana/index.js +1 -1
  63. package/lib/solana/solana-context.d.ts +1 -1
  64. package/lib/solana/solana-context.d.ts.map +1 -1
  65. package/lib/solana/solana-processor.d.ts +4 -4
  66. package/lib/solana/solana-processor.d.ts.map +1 -1
  67. package/lib/solana/solana-processor.js.map +1 -1
  68. package/lib/solana/solana-rpc-types.d.ts +75 -0
  69. package/lib/solana/solana-rpc-types.d.ts.map +1 -0
  70. package/lib/solana/solana-rpc-types.js +2 -0
  71. package/lib/solana/solana-rpc-types.js.map +1 -0
  72. package/lib/store/codegen.js +2 -2
  73. package/lib/store/codegen.js.map +1 -1
  74. package/lib/store/decorators.d.ts.map +1 -1
  75. package/lib/store/decorators.js +1 -1
  76. package/lib/store/decorators.js.map +1 -1
  77. package/lib/store/store.js.map +1 -1
  78. package/lib/sui/builtin/0x1.d.ts +382 -270
  79. package/lib/sui/builtin/0x1.d.ts.map +1 -1
  80. package/lib/sui/builtin/0x1.js +2571 -805
  81. package/lib/sui/builtin/0x1.js.map +1 -1
  82. package/lib/sui/builtin/0x2.d.ts +1013 -730
  83. package/lib/sui/builtin/0x2.d.ts.map +1 -1
  84. package/lib/sui/builtin/0x2.js +7419 -2616
  85. package/lib/sui/builtin/0x2.js.map +1 -1
  86. package/lib/sui/builtin/0x3.d.ts +297 -297
  87. package/lib/sui/builtin/0x3.d.ts.map +1 -1
  88. package/lib/sui/builtin/0x3.js +2364 -904
  89. package/lib/sui/builtin/0x3.js.map +1 -1
  90. package/lib/sui/codegen/codegen.d.ts.map +1 -1
  91. package/lib/sui/codegen/codegen.js.map +1 -1
  92. package/lib/sui/context.d.ts +10 -9
  93. package/lib/sui/context.d.ts.map +1 -1
  94. package/lib/sui/context.js.map +1 -1
  95. package/lib/sui/ext/coin.d.ts.map +1 -1
  96. package/lib/sui/ext/coin.js +1 -1
  97. package/lib/sui/ext/coin.js.map +1 -1
  98. package/lib/sui/ext/move-dex.d.ts +3 -3
  99. package/lib/sui/ext/move-dex.d.ts.map +1 -1
  100. package/lib/sui/models.d.ts +5 -4
  101. package/lib/sui/models.d.ts.map +1 -1
  102. package/lib/sui/move-coder.d.ts.map +1 -1
  103. package/lib/sui/move-coder.js +1 -0
  104. package/lib/sui/move-coder.js.map +1 -1
  105. package/lib/sui/network.d.ts +2 -2
  106. package/lib/sui/network.d.ts.map +1 -1
  107. package/lib/sui/network.js +8 -8
  108. package/lib/sui/network.js.map +1 -1
  109. package/lib/sui/sui-object-processor-template.d.ts +6 -5
  110. package/lib/sui/sui-object-processor-template.d.ts.map +1 -1
  111. package/lib/sui/sui-object-processor-template.js.map +1 -1
  112. package/lib/sui/sui-object-processor.d.ts +15 -13
  113. package/lib/sui/sui-object-processor.d.ts.map +1 -1
  114. package/lib/sui/sui-object-processor.js +4 -2
  115. package/lib/sui/sui-object-processor.js.map +1 -1
  116. package/lib/sui/sui-processor.d.ts +8 -6
  117. package/lib/sui/sui-processor.d.ts.map +1 -1
  118. package/lib/sui/sui-processor.js +8 -12
  119. package/lib/sui/sui-processor.js.map +1 -1
  120. package/lib/sui/utils.d.ts +3 -2
  121. package/lib/sui/utils.d.ts.map +1 -1
  122. package/lib/sui/utils.js +9 -9
  123. package/lib/sui/utils.js.map +1 -1
  124. package/lib/testing/memory-database.d.ts.map +1 -1
  125. package/lib/testing/memory-database.js +4 -1
  126. package/lib/testing/memory-database.js.map +1 -1
  127. package/lib/testing/sui-facet.d.ts +5 -5
  128. package/lib/testing/sui-facet.d.ts.map +1 -1
  129. package/lib/testing/sui-facet.js +5 -5
  130. package/lib/testing/sui-facet.js.map +1 -1
  131. package/lib/utils/block.d.ts +1 -1
  132. package/lib/utils/block.d.ts.map +1 -1
  133. package/lib/utils/call.js +1 -1
  134. package/lib/utils/call.js.map +1 -1
  135. package/lib/utils/dex-price.js +1 -1
  136. package/lib/utils/dex-price.js.map +1 -1
  137. package/package.json +29 -22
  138. package/src/aptos/abis/0x1.json +8161 -2996
  139. package/src/aptos/abis/0x3.json +140 -75
  140. package/src/aptos/abis/0x4.json +75 -52
  141. package/src/aptos/aptos-processor.ts +9 -9
  142. package/src/aptos/builtin/0x1.ts +2577 -58
  143. package/src/aptos/builtin/0x3.ts +1 -1
  144. package/src/aptos/builtin/0x4.ts +18 -19
  145. package/src/core/normalization.ts +3 -1
  146. package/src/core/partition-handler-manager.ts +4 -1
  147. package/src/eth/base-processor-template.ts +5 -1
  148. package/src/eth/base-processor.ts +11 -11
  149. package/src/eth/eth.ts +7 -6
  150. package/src/fuel/fuel-processor-template.ts +3 -1
  151. package/src/fuel/transaction.ts +5 -5
  152. package/src/iota/abis/0x2.json +464 -4
  153. package/src/iota/builtin/0x2.ts +911 -77
  154. package/src/iota/iota-processor.ts +10 -10
  155. package/src/solana/builtin/index.ts +2 -1
  156. package/src/solana/builtin/spl-token-2022-processor.ts +324 -0
  157. package/src/solana/builtin/spl-token-processor.ts +30 -30
  158. package/src/solana/builtin/types.ts +659 -144
  159. package/src/solana/codegen/codegen.ts +8 -8
  160. package/src/solana/index.ts +1 -1
  161. package/src/solana/solana-context.ts +1 -1
  162. package/src/solana/solana-plugin.ts +1 -1
  163. package/src/solana/solana-processor.ts +11 -7
  164. package/src/solana/solana-rpc-types.ts +73 -0
  165. package/src/store/codegen.ts +2 -2
  166. package/src/store/decorators.ts +3 -1
  167. package/src/store/store.ts +1 -1
  168. package/src/sui/abis/0x1.json +8996 -5745
  169. package/src/sui/abis/0x2.json +38135 -28859
  170. package/src/sui/abis/0x3.json +14723 -10726
  171. package/src/sui/builtin/0x1.ts +4071 -1897
  172. package/src/sui/builtin/0x2.ts +14397 -7968
  173. package/src/sui/builtin/0x3.ts +3780 -2021
  174. package/src/sui/codegen/codegen.ts +4 -5
  175. package/src/sui/context.ts +15 -16
  176. package/src/sui/ext/coin.ts +4 -2
  177. package/src/sui/ext/move-dex.ts +5 -5
  178. package/src/sui/models.ts +5 -4
  179. package/src/sui/move-coder.ts +1 -0
  180. package/src/sui/network.ts +10 -9
  181. package/src/sui/sui-object-processor-template.ts +7 -6
  182. package/src/sui/sui-object-processor.ts +29 -21
  183. package/src/sui/sui-processor.ts +33 -36
  184. package/src/sui/utils.ts +14 -17
  185. package/src/testing/memory-database.ts +4 -1
  186. package/src/testing/sui-facet.ts +13 -13
  187. package/src/utils/block.ts +1 -1
  188. package/src/utils/call.ts +2 -2
  189. package/src/utils/dex-price.ts +1 -1
  190. package/lib/aptos/codegen/types.test.d.ts +0 -2
  191. package/lib/aptos/codegen/types.test.d.ts.map +0 -1
  192. package/lib/aptos/codegen/types.test.js.map +0 -1
  193. package/lib/aptos/ext/coin-event.test.d.ts +0 -2
  194. package/lib/aptos/ext/coin-event.test.d.ts.map +0 -1
  195. package/lib/aptos/ext/coin-event.test.js.map +0 -1
  196. package/lib/aptos/ext/coin.test.d.ts +0 -2
  197. package/lib/aptos/ext/coin.test.d.ts.map +0 -1
  198. package/lib/aptos/ext/coin.test.js.map +0 -1
  199. package/lib/core/database-schema.test.d.ts +0 -2
  200. package/lib/core/database-schema.test.d.ts.map +0 -1
  201. package/lib/core/database-schema.test.js.map +0 -1
  202. package/lib/core/event-logger.test.d.ts +0 -2
  203. package/lib/core/event-logger.test.d.ts.map +0 -1
  204. package/lib/core/event-logger.test.js.map +0 -1
  205. package/lib/core/normalization.test.d.ts +0 -2
  206. package/lib/core/normalization.test.d.ts.map +0 -1
  207. package/lib/core/normalization.test.js.map +0 -1
  208. package/lib/core/numberish.test.d.ts +0 -2
  209. package/lib/core/numberish.test.d.ts.map +0 -1
  210. package/lib/core/numberish.test.js.map +0 -1
  211. package/lib/eth/base-processor.test.d.ts +0 -2
  212. package/lib/eth/base-processor.test.d.ts.map +0 -1
  213. package/lib/eth/base-processor.test.js.map +0 -1
  214. package/lib/eth/eth.test.d.ts +0 -2
  215. package/lib/eth/eth.test.d.ts.map +0 -1
  216. package/lib/eth/eth.test.js.map +0 -1
  217. package/lib/eth/generic-processor.test.d.ts +0 -2
  218. package/lib/eth/generic-processor.test.d.ts.map +0 -1
  219. package/lib/eth/generic-processor.test.js.map +0 -1
  220. package/lib/eth/provider.test.d.ts +0 -2
  221. package/lib/eth/provider.test.d.ts.map +0 -1
  222. package/lib/eth/provider.test.js.map +0 -1
  223. package/lib/store/convert.test.d.ts +0 -2
  224. package/lib/store/convert.test.d.ts.map +0 -1
  225. package/lib/store/convert.test.js.map +0 -1
  226. package/lib/utils/block.test.d.ts +0 -2
  227. package/lib/utils/block.test.d.ts.map +0 -1
  228. package/lib/utils/block.test.js.map +0 -1
  229. package/lib/utils/dex-price.test.d.ts +0 -2
  230. package/lib/utils/dex-price.test.d.ts.map +0 -1
  231. package/lib/utils/dex-price.test.js.map +0 -1
  232. package/lib/utils/erc20.test.d.ts +0 -2
  233. package/lib/utils/erc20.test.d.ts.map +0 -1
  234. package/lib/utils/erc20.test.js.map +0 -1
  235. package/lib/utils/price.test.d.ts +0 -2
  236. package/lib/utils/price.test.d.ts.map +0 -1
  237. package/lib/utils/price.test.js.map +0 -1
@@ -1,23 +1,23 @@
1
1
  import path from 'path'
2
2
  import fs from 'fs'
3
3
  import chalk from 'chalk'
4
- import { Idl } from '@coral-xyz/anchor'
5
4
  import {
5
+ Idl,
6
+ IdlDefinedFields,
6
7
  IdlField,
7
8
  IdlInstruction,
8
- IdlType,
9
9
  IdlInstructionAccountItem,
10
- IdlDefinedFields,
10
+ IdlType,
11
11
  IdlTypeDef
12
- } from '@coral-xyz/anchor/dist/esm/idl.js'
12
+ } from '@anchor-lang/core'
13
13
  import { recursiveCodegen } from '../../core/codegen.js'
14
14
 
15
- export function codegen(abisDir: string, targetPath = path.join('src', 'types', 'solana'), genExample = false) {
15
+ export async function codegen(abisDir: string, targetPath = path.join('src', 'types', 'solana'), genExample = false) {
16
16
  if (!fs.existsSync(abisDir)) {
17
17
  return
18
18
  }
19
19
 
20
- const numFiles = recursiveCodegen(abisDir, targetPath, codegenInternal)
20
+ const numFiles = await recursiveCodegen(abisDir, targetPath, codegenInternal)
21
21
 
22
22
  console.log(chalk.green(`Generated ${numFiles} for Solana`))
23
23
  }
@@ -49,7 +49,7 @@ function codeGenSolanaIdlProcessor(idlObj: Idl): string {
49
49
  return `import { BorshInstructionCoder, Instruction, Idl } from '@sentio/sdk/solana'
50
50
  import { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from "@sentio/sdk/solana"
51
51
  import { ${idlName}_idl } from "./${idlName}.js"
52
- import { PublicKey } from '@solana/web3.js'
52
+ import type { Address } from '@solana/kit'
53
53
 
54
54
  ${idlObj.types?.map((def) => codeGenType(def)).join('')}
55
55
 
@@ -180,7 +180,7 @@ function mapType(tpe: IdlType): string {
180
180
  }
181
181
  switch (tpe) {
182
182
  case 'pubkey':
183
- return 'PublicKey'
183
+ return 'Address'
184
184
  case 'bool':
185
185
  return 'boolean'
186
186
  case 'string':
@@ -3,4 +3,4 @@ export * from './solana-context.js'
3
3
  export * from './solana-processor.js'
4
4
  export * from './solana-options.js'
5
5
 
6
- export { BorshInstructionCoder, type Instruction, type Idl } from '@coral-xyz/anchor'
6
+ export { BorshInstructionCoder, type Instruction, type Idl } from '@anchor-lang/core'
@@ -1,6 +1,6 @@
1
1
  import { normalizeLabels, Labels, BaseContext, RecordMetaData } from '../index.js'
2
2
  import { SolanaChainId } from '@sentio/chain'
3
- import { TransactionResponse } from '@solana/web3.js'
3
+ import type { TransactionResponse } from './solana-rpc-types.js'
4
4
 
5
5
  export class SolanaContext extends BaseContext {
6
6
  network: SolanaChainId
@@ -12,7 +12,7 @@ import {
12
12
  import { ServerError, Status } from 'nice-grpc'
13
13
 
14
14
  import { SolanaProcessorState } from './solana-processor.js'
15
- import { Instruction as SolInstruction } from '@coral-xyz/anchor'
15
+ import { Instruction as SolInstruction } from '@anchor-lang/core'
16
16
 
17
17
  export class SolanaPlugin extends Plugin {
18
18
  name: string = 'SolanaPlugin'
@@ -1,13 +1,13 @@
1
1
  import { Data_SolBlock, Data_SolInstruction, HandleInterval, ProcessResult } from '@sentio/protos'
2
2
  import { SolanaContext } from './solana-context.js'
3
- import { Instruction } from '@coral-xyz/anchor'
3
+ import { Instruction } from '@anchor-lang/core'
4
4
  import { SolanaBindOptions, SolanaFetchConfig } from './solana-options.js'
5
5
  import { ListStateStorage } from '@sentio/runtime'
6
6
  import { ALL_ADDRESS, Labels, PromiseOrVoid } from '../core/index.js'
7
7
  import { SolanaChainId } from '@sentio/chain'
8
8
  import { HandlerOptions } from '../core/handler-options.js'
9
9
  import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
10
- import { TransactionResponse, BlockResponse } from '@solana/web3.js'
10
+ import type { TransactionResponse, BlockResponse } from './solana-rpc-types.js'
11
11
 
12
12
  type IndexConfigure = {
13
13
  startSlot: bigint
@@ -18,7 +18,11 @@ export interface InstructionCoder {
18
18
  decode(ix: Buffer | string, encoding?: 'hex' | 'base58'): Instruction | null
19
19
  }
20
20
 
21
- export type SolanaInstructionHandler = (instruction: Instruction, ctx: SolanaContext, accounts?: string[]) => void
21
+ export type SolanaInstructionHandler<T extends Instruction = Instruction> = (
22
+ instruction: T,
23
+ ctx: SolanaContext,
24
+ accounts: string[]
25
+ ) => void
22
26
 
23
27
  export interface InstructionHandlerEntry {
24
28
  handler: SolanaInstructionHandler
@@ -79,12 +83,12 @@ export class SolanaBaseProcessor {
79
83
  SolanaProcessorState.INSTANCE.addValue(this)
80
84
  }
81
85
 
82
- public onInstruction(
86
+ public onInstruction<T extends Instruction = Instruction>(
83
87
  instructionName: string,
84
- handler: SolanaInstructionHandler,
85
- handlerOptions?: HandlerOptions<SolanaFetchConfig, Instruction>
88
+ handler: SolanaInstructionHandler<T>,
89
+ handlerOptions?: HandlerOptions<SolanaFetchConfig, T>
86
90
  ) {
87
- this.instructionHandlerMap.set(instructionName, { handler, handlerOptions })
91
+ this.instructionHandlerMap.set(instructionName, { handler, handlerOptions } as InstructionHandlerEntry)
88
92
  return this
89
93
  }
90
94
 
@@ -0,0 +1,73 @@
1
+ import type { Address, Signature, Blockhash } from '@solana/kit'
2
+
3
+ export type TransactionVersion = 'legacy' | number
4
+
5
+ export interface TransactionMessageHeader {
6
+ numRequiredSignatures: number
7
+ numReadonlySignedAccounts: number
8
+ numReadonlyUnsignedAccounts: number
9
+ }
10
+
11
+ export interface CompiledInstruction {
12
+ programIdIndex: number
13
+ accounts: number[]
14
+ data: string
15
+ }
16
+
17
+ export interface TransactionMessage {
18
+ accountKeys: Address[]
19
+ header: TransactionMessageHeader
20
+ instructions: CompiledInstruction[]
21
+ recentBlockhash: Blockhash
22
+ }
23
+
24
+ export interface TokenBalance {
25
+ accountIndex: number
26
+ mint: string
27
+ owner?: string
28
+ programId?: string
29
+ uiTokenAmount: {
30
+ amount: string
31
+ decimals: number
32
+ uiAmount: number | null
33
+ uiAmountString: string
34
+ }
35
+ }
36
+
37
+ export interface ConfirmedTransactionMeta {
38
+ err: unknown
39
+ fee: number
40
+ innerInstructions?: Array<{ index: number; instructions: CompiledInstruction[] }> | null
41
+ logMessages?: string[] | null
42
+ preBalances: number[]
43
+ postBalances: number[]
44
+ preTokenBalances?: TokenBalance[] | null
45
+ postTokenBalances?: TokenBalance[] | null
46
+ rewards?: unknown[] | null
47
+ loadedAddresses?: { writable: Address[]; readonly: Address[] }
48
+ }
49
+
50
+ export interface TransactionResponse {
51
+ slot: number
52
+ blockTime?: number | null
53
+ transaction: {
54
+ message: TransactionMessage
55
+ signatures: Signature[]
56
+ }
57
+ meta: ConfirmedTransactionMeta | null
58
+ version?: TransactionVersion
59
+ }
60
+
61
+ export interface BlockResponse {
62
+ blockhash: Blockhash
63
+ previousBlockhash: Blockhash
64
+ parentSlot: number
65
+ blockHeight?: number | null
66
+ blockTime?: number | null
67
+ transactions: Array<{
68
+ transaction: { message: TransactionMessage; signatures: Signature[] }
69
+ meta: ConfirmedTransactionMeta | null
70
+ version?: TransactionVersion
71
+ }>
72
+ rewards?: unknown[]
73
+ }
@@ -210,7 +210,7 @@ async function codegenInternal(schema: GraphQLSchema, source: string, target: st
210
210
  })
211
211
  fields.push({
212
212
  name: f.name + 'ID' + (isMany ? 's' : ''),
213
- type: isMany ? `Array<ID | undefined>` : `ID`,
213
+ type: isMany ? `Array<ID>` : `ID`,
214
214
  annotations: []
215
215
  })
216
216
  if (isMany) {
@@ -317,7 +317,7 @@ export class ${c.name} ${c.parent ? `extends ${c.parent}` : ''} ${c.interfaces.l
317
317
  ${c.fields
318
318
  .map((f) => `${f.annotations.map((a) => `\n\t${a}`).join('')}\n\t${f.name}${f.optional ? '?' : ''}: ${f.type}`)
319
319
  .join('\n')}
320
- ${isEntity ? `constructor(data: ${c.name}ConstructorInput) {super()}` : ''}
320
+ ${isEntity ? `constructor(data: Partial<${c.name}ConstructorInput>) {super()}` : ''}
321
321
  ${(c.methods ?? []).map(genMethod).join('\n')}
322
322
 
323
323
  ${
@@ -25,7 +25,9 @@ function handleError(entity: string, key: string, fn: () => any) {
25
25
  try {
26
26
  return fn()
27
27
  } catch (e) {
28
- throw new Error(`Get property "${key}" from Entity "${entity}" failed: ${e.message}`)
28
+ throw new Error(
29
+ `Get property "${key}" from Entity "${entity}" failed: ${e instanceof Error ? e.message : String(e)}`
30
+ )
29
31
  }
30
32
  }
31
33
 
@@ -96,7 +96,7 @@ export class Store {
96
96
  entity: [] as string[],
97
97
  id: [] as string[]
98
98
  }
99
- const entityName = getEntityName(entity)
99
+ const entityName = getEntityName(entity as EntityClass<T> | T)
100
100
  if (id) {
101
101
  if (Array.isArray(id)) {
102
102
  for (const i of id) {