@taxdao/fintax-mcp 0.2.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 (341) hide show
  1. package/README.md +220 -0
  2. package/dist/app/create-server.d.ts +18 -0
  3. package/dist/app/create-server.js +80 -0
  4. package/dist/app/create-server.js.map +1 -0
  5. package/dist/app/register-tools.d.ts +4 -0
  6. package/dist/app/register-tools.js +18 -0
  7. package/dist/app/register-tools.js.map +1 -0
  8. package/dist/audit/audit-context.d.ts +38 -0
  9. package/dist/audit/audit-context.js +167 -0
  10. package/dist/audit/audit-context.js.map +1 -0
  11. package/dist/audit/audit-sink.d.ts +20 -0
  12. package/dist/audit/audit-sink.js +6 -0
  13. package/dist/audit/audit-sink.js.map +1 -0
  14. package/dist/audit/file-audit-sink.d.ts +6 -0
  15. package/dist/audit/file-audit-sink.js +18 -0
  16. package/dist/audit/file-audit-sink.js.map +1 -0
  17. package/dist/auth/auth-session.d.ts +63 -0
  18. package/dist/auth/auth-session.js +226 -0
  19. package/dist/auth/auth-session.js.map +1 -0
  20. package/dist/auth/credentials.d.ts +6 -0
  21. package/dist/auth/credentials.js +12 -0
  22. package/dist/auth/credentials.js.map +1 -0
  23. package/dist/auth/org-token-provider.d.ts +15 -0
  24. package/dist/auth/org-token-provider.js +62 -0
  25. package/dist/auth/org-token-provider.js.map +1 -0
  26. package/dist/capabilities/capability.d.ts +100 -0
  27. package/dist/capabilities/capability.js +26 -0
  28. package/dist/capabilities/capability.js.map +1 -0
  29. package/dist/capabilities/create-capabilities.d.ts +2 -0
  30. package/dist/capabilities/create-capabilities.js +37 -0
  31. package/dist/capabilities/create-capabilities.js.map +1 -0
  32. package/dist/capabilities/define-capability.d.ts +39 -0
  33. package/dist/capabilities/define-capability.js +64 -0
  34. package/dist/capabilities/define-capability.js.map +1 -0
  35. package/dist/capabilities/definitions/accounting-balances.d.ts +4 -0
  36. package/dist/capabilities/definitions/accounting-balances.js +98 -0
  37. package/dist/capabilities/definitions/accounting-balances.js.map +1 -0
  38. package/dist/capabilities/definitions/accounting-context.d.ts +2 -0
  39. package/dist/capabilities/definitions/accounting-context.js +17 -0
  40. package/dist/capabilities/definitions/accounting-context.js.map +1 -0
  41. package/dist/capabilities/definitions/assets.d.ts +2 -0
  42. package/dist/capabilities/definitions/assets.js +367 -0
  43. package/dist/capabilities/definitions/assets.js.map +1 -0
  44. package/dist/capabilities/definitions/business-documents.d.ts +9 -0
  45. package/dist/capabilities/definitions/business-documents.js +386 -0
  46. package/dist/capabilities/definitions/business-documents.js.map +1 -0
  47. package/dist/capabilities/definitions/dashboard.d.ts +2 -0
  48. package/dist/capabilities/definitions/dashboard.js +153 -0
  49. package/dist/capabilities/definitions/dashboard.js.map +1 -0
  50. package/dist/capabilities/definitions/extended-operation-contracts.d.ts +597 -0
  51. package/dist/capabilities/definitions/extended-operation-contracts.js +1180 -0
  52. package/dist/capabilities/definitions/extended-operation-contracts.js.map +1 -0
  53. package/dist/capabilities/definitions/extended-operations.d.ts +2 -0
  54. package/dist/capabilities/definitions/extended-operations.js +699 -0
  55. package/dist/capabilities/definitions/extended-operations.js.map +1 -0
  56. package/dist/capabilities/definitions/financial-reports.d.ts +2 -0
  57. package/dist/capabilities/definitions/financial-reports.js +100 -0
  58. package/dist/capabilities/definitions/financial-reports.js.map +1 -0
  59. package/dist/capabilities/definitions/fnd-import.d.ts +34 -0
  60. package/dist/capabilities/definitions/fnd-import.js +282 -0
  61. package/dist/capabilities/definitions/fnd-import.js.map +1 -0
  62. package/dist/capabilities/definitions/fund-accounts.d.ts +2 -0
  63. package/dist/capabilities/definitions/fund-accounts.js +188 -0
  64. package/dist/capabilities/definitions/fund-accounts.js.map +1 -0
  65. package/dist/capabilities/definitions/fund-balances.d.ts +2 -0
  66. package/dist/capabilities/definitions/fund-balances.js +84 -0
  67. package/dist/capabilities/definitions/fund-balances.js.map +1 -0
  68. package/dist/capabilities/definitions/journals.d.ts +10 -0
  69. package/dist/capabilities/definitions/journals.js +224 -0
  70. package/dist/capabilities/definitions/journals.js.map +1 -0
  71. package/dist/capabilities/definitions/master-data.d.ts +2 -0
  72. package/dist/capabilities/definitions/master-data.js +451 -0
  73. package/dist/capabilities/definitions/master-data.js.map +1 -0
  74. package/dist/capabilities/definitions/pnl.d.ts +2 -0
  75. package/dist/capabilities/definitions/pnl.js +139 -0
  76. package/dist/capabilities/definitions/pnl.js.map +1 -0
  77. package/dist/capabilities/definitions/reference-data.d.ts +2 -0
  78. package/dist/capabilities/definitions/reference-data.js +169 -0
  79. package/dist/capabilities/definitions/reference-data.js.map +1 -0
  80. package/dist/capabilities/definitions/transaction-drafts.d.ts +2 -0
  81. package/dist/capabilities/definitions/transaction-drafts.js +157 -0
  82. package/dist/capabilities/definitions/transaction-drafts.js.map +1 -0
  83. package/dist/capabilities/definitions/transactions.d.ts +168 -0
  84. package/dist/capabilities/definitions/transactions.js +79 -0
  85. package/dist/capabilities/definitions/transactions.js.map +1 -0
  86. package/dist/capabilities/executor.d.ts +19 -0
  87. package/dist/capabilities/executor.js +134 -0
  88. package/dist/capabilities/executor.js.map +1 -0
  89. package/dist/capabilities/registry.d.ts +7 -0
  90. package/dist/capabilities/registry.js +51 -0
  91. package/dist/capabilities/registry.js.map +1 -0
  92. package/dist/clients/base-client.d.ts +5 -0
  93. package/dist/clients/base-client.js +13 -0
  94. package/dist/clients/base-client.js.map +1 -0
  95. package/dist/clients/http-client.d.ts +29 -0
  96. package/dist/clients/http-client.js +167 -0
  97. package/dist/clients/http-client.js.map +1 -0
  98. package/dist/clients/suite-client.d.ts +5 -0
  99. package/dist/clients/suite-client.js +5 -0
  100. package/dist/clients/suite-client.js.map +1 -0
  101. package/dist/concurrency/lock-manager.d.ts +4 -0
  102. package/dist/concurrency/lock-manager.js +23 -0
  103. package/dist/concurrency/lock-manager.js.map +1 -0
  104. package/dist/config/load-config.d.ts +2 -0
  105. package/dist/config/load-config.js +18 -0
  106. package/dist/config/load-config.js.map +1 -0
  107. package/dist/config/schema.d.ts +24 -0
  108. package/dist/config/schema.js +85 -0
  109. package/dist/config/schema.js.map +1 -0
  110. package/dist/errors/fintax-error.d.ts +24 -0
  111. package/dist/errors/fintax-error.js +21 -0
  112. package/dist/errors/fintax-error.js.map +1 -0
  113. package/dist/errors/normalize-error.d.ts +3 -0
  114. package/dist/errors/normalize-error.js +67 -0
  115. package/dist/errors/normalize-error.js.map +1 -0
  116. package/dist/files/artifact-store.d.ts +17 -0
  117. package/dist/files/artifact-store.js +74 -0
  118. package/dist/files/artifact-store.js.map +1 -0
  119. package/dist/files/input-policy.d.ts +28 -0
  120. package/dist/files/input-policy.js +109 -0
  121. package/dist/files/input-policy.js.map +1 -0
  122. package/dist/files/roots-provider.d.ts +14 -0
  123. package/dist/files/roots-provider.js +47 -0
  124. package/dist/files/roots-provider.js.map +1 -0
  125. package/dist/index.d.ts +2 -0
  126. package/dist/index.js +49 -0
  127. package/dist/index.js.map +1 -0
  128. package/dist/logging/logger.d.ts +3 -0
  129. package/dist/logging/logger.js +13 -0
  130. package/dist/logging/logger.js.map +1 -0
  131. package/dist/policies/idempotency.d.ts +32 -0
  132. package/dist/policies/idempotency.js +155 -0
  133. package/dist/policies/idempotency.js.map +1 -0
  134. package/dist/policies/job-reference.d.ts +16 -0
  135. package/dist/policies/job-reference.js +62 -0
  136. package/dist/policies/job-reference.js.map +1 -0
  137. package/dist/policies/operation-plan.d.ts +27 -0
  138. package/dist/policies/operation-plan.js +99 -0
  139. package/dist/policies/operation-plan.js.map +1 -0
  140. package/dist/policies/redaction.d.ts +2 -0
  141. package/dist/policies/redaction.js +29 -0
  142. package/dist/policies/redaction.js.map +1 -0
  143. package/dist/policies/retry.d.ts +8 -0
  144. package/dist/policies/retry.js +19 -0
  145. package/dist/policies/retry.js.map +1 -0
  146. package/dist/responses/tool-response.d.ts +4 -0
  147. package/dist/responses/tool-response.js +24 -0
  148. package/dist/responses/tool-response.js.map +1 -0
  149. package/dist/schemas/common.d.ts +226 -0
  150. package/dist/schemas/common.js +133 -0
  151. package/dist/schemas/common.js.map +1 -0
  152. package/dist/schemas/domains/accounting-balances.d.ts +497 -0
  153. package/dist/schemas/domains/accounting-balances.js +226 -0
  154. package/dist/schemas/domains/accounting-balances.js.map +1 -0
  155. package/dist/schemas/domains/accounting-context.d.ts +118 -0
  156. package/dist/schemas/domains/accounting-context.js +54 -0
  157. package/dist/schemas/domains/accounting-context.js.map +1 -0
  158. package/dist/schemas/domains/assets.d.ts +2508 -0
  159. package/dist/schemas/domains/assets.js +960 -0
  160. package/dist/schemas/domains/assets.js.map +1 -0
  161. package/dist/schemas/domains/business-documents.d.ts +4406 -0
  162. package/dist/schemas/domains/business-documents.js +1153 -0
  163. package/dist/schemas/domains/business-documents.js.map +1 -0
  164. package/dist/schemas/domains/configuration.d.ts +518 -0
  165. package/dist/schemas/domains/configuration.js +504 -0
  166. package/dist/schemas/domains/configuration.js.map +1 -0
  167. package/dist/schemas/domains/dashboard.d.ts +339 -0
  168. package/dist/schemas/domains/dashboard.js +211 -0
  169. package/dist/schemas/domains/dashboard.js.map +1 -0
  170. package/dist/schemas/domains/extended-operation-results.d.ts +1588 -0
  171. package/dist/schemas/domains/extended-operation-results.js +275 -0
  172. package/dist/schemas/domains/extended-operation-results.js.map +1 -0
  173. package/dist/schemas/domains/extended-operations.d.ts +1061 -0
  174. package/dist/schemas/domains/extended-operations.js +567 -0
  175. package/dist/schemas/domains/extended-operations.js.map +1 -0
  176. package/dist/schemas/domains/extended-query-results.d.ts +1688 -0
  177. package/dist/schemas/domains/extended-query-results.js +337 -0
  178. package/dist/schemas/domains/extended-query-results.js.map +1 -0
  179. package/dist/schemas/domains/financial-reports.d.ts +540 -0
  180. package/dist/schemas/domains/financial-reports.js +206 -0
  181. package/dist/schemas/domains/financial-reports.js.map +1 -0
  182. package/dist/schemas/domains/fnd-import.d.ts +912 -0
  183. package/dist/schemas/domains/fnd-import.js +396 -0
  184. package/dist/schemas/domains/fnd-import.js.map +1 -0
  185. package/dist/schemas/domains/fund-accounts.d.ts +1092 -0
  186. package/dist/schemas/domains/fund-accounts.js +410 -0
  187. package/dist/schemas/domains/fund-accounts.js.map +1 -0
  188. package/dist/schemas/domains/fund-balances.d.ts +476 -0
  189. package/dist/schemas/domains/fund-balances.js +233 -0
  190. package/dist/schemas/domains/fund-balances.js.map +1 -0
  191. package/dist/schemas/domains/journals.d.ts +1619 -0
  192. package/dist/schemas/domains/journals.js +615 -0
  193. package/dist/schemas/domains/journals.js.map +1 -0
  194. package/dist/schemas/domains/master-data.d.ts +2010 -0
  195. package/dist/schemas/domains/master-data.js +799 -0
  196. package/dist/schemas/domains/master-data.js.map +1 -0
  197. package/dist/schemas/domains/pnl.d.ts +837 -0
  198. package/dist/schemas/domains/pnl.js +469 -0
  199. package/dist/schemas/domains/pnl.js.map +1 -0
  200. package/dist/schemas/domains/reference-data.d.ts +227 -0
  201. package/dist/schemas/domains/reference-data.js +144 -0
  202. package/dist/schemas/domains/reference-data.js.map +1 -0
  203. package/dist/schemas/domains/transaction-drafts.d.ts +903 -0
  204. package/dist/schemas/domains/transaction-drafts.js +242 -0
  205. package/dist/schemas/domains/transaction-drafts.js.map +1 -0
  206. package/dist/schemas/domains/transactions.d.ts +910 -0
  207. package/dist/schemas/domains/transactions.js +266 -0
  208. package/dist/schemas/domains/transactions.js.map +1 -0
  209. package/dist/schemas/primitives.d.ts +6 -0
  210. package/dist/schemas/primitives.js +11 -0
  211. package/dist/schemas/primitives.js.map +1 -0
  212. package/dist/schemas/public-input.d.ts +3 -0
  213. package/dist/schemas/public-input.js +524 -0
  214. package/dist/schemas/public-input.js.map +1 -0
  215. package/dist/tools/core-edit/idempotent-write.d.ts +23 -0
  216. package/dist/tools/core-edit/idempotent-write.js +58 -0
  217. package/dist/tools/core-edit/idempotent-write.js.map +1 -0
  218. package/dist/tools/core-edit/save-asset.d.ts +5 -0
  219. package/dist/tools/core-edit/save-asset.js +334 -0
  220. package/dist/tools/core-edit/save-asset.js.map +1 -0
  221. package/dist/tools/core-edit/save-business-document-draft.d.ts +2 -0
  222. package/dist/tools/core-edit/save-business-document-draft.js +128 -0
  223. package/dist/tools/core-edit/save-business-document-draft.js.map +1 -0
  224. package/dist/tools/core-edit/save-fund-account.d.ts +2 -0
  225. package/dist/tools/core-edit/save-fund-account.js +138 -0
  226. package/dist/tools/core-edit/save-fund-account.js.map +1 -0
  227. package/dist/tools/core-edit/save-journal-draft.d.ts +2 -0
  228. package/dist/tools/core-edit/save-journal-draft.js +122 -0
  229. package/dist/tools/core-edit/save-journal-draft.js.map +1 -0
  230. package/dist/tools/core-edit/save-master-data.d.ts +2 -0
  231. package/dist/tools/core-edit/save-master-data.js +153 -0
  232. package/dist/tools/core-edit/save-master-data.js.map +1 -0
  233. package/dist/tools/core-edit/save-transaction-draft.d.ts +2 -0
  234. package/dist/tools/core-edit/save-transaction-draft.js +128 -0
  235. package/dist/tools/core-edit/save-transaction-draft.js.map +1 -0
  236. package/dist/tools/core-read/export-business-documents.d.ts +2 -0
  237. package/dist/tools/core-read/export-business-documents.js +67 -0
  238. package/dist/tools/core-read/export-business-documents.js.map +1 -0
  239. package/dist/tools/core-read/export-journals.d.ts +2 -0
  240. package/dist/tools/core-read/export-journals.js +56 -0
  241. package/dist/tools/core-read/export-journals.js.map +1 -0
  242. package/dist/tools/core-read/export-transactions.d.ts +2 -0
  243. package/dist/tools/core-read/export-transactions.js +67 -0
  244. package/dist/tools/core-read/export-transactions.js.map +1 -0
  245. package/dist/tools/core-read/query-accounting-balances.d.ts +2 -0
  246. package/dist/tools/core-read/query-accounting-balances.js +135 -0
  247. package/dist/tools/core-read/query-accounting-balances.js.map +1 -0
  248. package/dist/tools/core-read/query-accounting-context.d.ts +2 -0
  249. package/dist/tools/core-read/query-accounting-context.js +76 -0
  250. package/dist/tools/core-read/query-accounting-context.js.map +1 -0
  251. package/dist/tools/core-read/query-assets.d.ts +2 -0
  252. package/dist/tools/core-read/query-assets.js +425 -0
  253. package/dist/tools/core-read/query-assets.js.map +1 -0
  254. package/dist/tools/core-read/query-business-documents.d.ts +9 -0
  255. package/dist/tools/core-read/query-business-documents.js +620 -0
  256. package/dist/tools/core-read/query-business-documents.js.map +1 -0
  257. package/dist/tools/core-read/query-dashboard.d.ts +2 -0
  258. package/dist/tools/core-read/query-dashboard.js +144 -0
  259. package/dist/tools/core-read/query-dashboard.js.map +1 -0
  260. package/dist/tools/core-read/query-financial-reports.d.ts +2 -0
  261. package/dist/tools/core-read/query-financial-reports.js +171 -0
  262. package/dist/tools/core-read/query-financial-reports.js.map +1 -0
  263. package/dist/tools/core-read/query-fund-accounts.d.ts +2 -0
  264. package/dist/tools/core-read/query-fund-accounts.js +140 -0
  265. package/dist/tools/core-read/query-fund-accounts.js.map +1 -0
  266. package/dist/tools/core-read/query-fund-balances.d.ts +2 -0
  267. package/dist/tools/core-read/query-fund-balances.js +150 -0
  268. package/dist/tools/core-read/query-fund-balances.js.map +1 -0
  269. package/dist/tools/core-read/query-journals.d.ts +2 -0
  270. package/dist/tools/core-read/query-journals.js +277 -0
  271. package/dist/tools/core-read/query-journals.js.map +1 -0
  272. package/dist/tools/core-read/query-master-data.d.ts +2 -0
  273. package/dist/tools/core-read/query-master-data.js +363 -0
  274. package/dist/tools/core-read/query-master-data.js.map +1 -0
  275. package/dist/tools/core-read/query-pnl.d.ts +2 -0
  276. package/dist/tools/core-read/query-pnl.js +244 -0
  277. package/dist/tools/core-read/query-pnl.js.map +1 -0
  278. package/dist/tools/core-read/query-reference-data.d.ts +2 -0
  279. package/dist/tools/core-read/query-reference-data.js +293 -0
  280. package/dist/tools/core-read/query-reference-data.js.map +1 -0
  281. package/dist/tools/core-read/query-transactions.d.ts +2 -0
  282. package/dist/tools/core-read/query-transactions.js +58 -0
  283. package/dist/tools/core-read/query-transactions.js.map +1 -0
  284. package/dist/tools/create-tools.d.ts +3 -0
  285. package/dist/tools/create-tools.js +88 -0
  286. package/dist/tools/create-tools.js.map +1 -0
  287. package/dist/tools/extended/asset-operation-tools.d.ts +9 -0
  288. package/dist/tools/extended/asset-operation-tools.js +419 -0
  289. package/dist/tools/extended/asset-operation-tools.js.map +1 -0
  290. package/dist/tools/extended/automation-tools.d.ts +7 -0
  291. package/dist/tools/extended/automation-tools.js +333 -0
  292. package/dist/tools/extended/automation-tools.js.map +1 -0
  293. package/dist/tools/extended/configuration-tools.d.ts +14 -0
  294. package/dist/tools/extended/configuration-tools.js +871 -0
  295. package/dist/tools/extended/configuration-tools.js.map +1 -0
  296. package/dist/tools/extended/period-end-tools.d.ts +11 -0
  297. package/dist/tools/extended/period-end-tools.js +480 -0
  298. package/dist/tools/extended/period-end-tools.js.map +1 -0
  299. package/dist/tools/extended/query-output.d.ts +2589 -0
  300. package/dist/tools/extended/query-output.js +610 -0
  301. package/dist/tools/extended/query-output.js.map +1 -0
  302. package/dist/tools/extended/tool-support.d.ts +56 -0
  303. package/dist/tools/extended/tool-support.js +198 -0
  304. package/dist/tools/extended/tool-support.js.map +1 -0
  305. package/dist/tools/extended/workflow-tools.d.ts +10 -0
  306. package/dist/tools/extended/workflow-tools.js +678 -0
  307. package/dist/tools/extended/workflow-tools.js.map +1 -0
  308. package/dist/tools/fnd-import/execute-import.d.ts +2 -0
  309. package/dist/tools/fnd-import/execute-import.js +201 -0
  310. package/dist/tools/fnd-import/execute-import.js.map +1 -0
  311. package/dist/tools/fnd-import/get-import-template.d.ts +2 -0
  312. package/dist/tools/fnd-import/get-import-template.js +66 -0
  313. package/dist/tools/fnd-import/get-import-template.js.map +1 -0
  314. package/dist/tools/fnd-import/get-job-status.d.ts +8 -0
  315. package/dist/tools/fnd-import/get-job-status.js +201 -0
  316. package/dist/tools/fnd-import/get-job-status.js.map +1 -0
  317. package/dist/tools/fnd-import/prepare-import.d.ts +31 -0
  318. package/dist/tools/fnd-import/prepare-import.js +214 -0
  319. package/dist/tools/fnd-import/prepare-import.js.map +1 -0
  320. package/dist/tools/fnd-import/public-import-result.d.ts +18 -0
  321. package/dist/tools/fnd-import/public-import-result.js +35 -0
  322. package/dist/tools/fnd-import/public-import-result.js.map +1 -0
  323. package/dist/tools/tool-definition.d.ts +45 -0
  324. package/dist/tools/tool-definition.js +11 -0
  325. package/dist/tools/tool-definition.js.map +1 -0
  326. package/dist/tools/tool-handler.d.ts +27 -0
  327. package/dist/tools/tool-handler.js +196 -0
  328. package/dist/tools/tool-handler.js.map +1 -0
  329. package/dist/tools/transaction-item.d.ts +225 -0
  330. package/dist/tools/transaction-item.js +109 -0
  331. package/dist/tools/transaction-item.js.map +1 -0
  332. package/dist/transport/draining-transport.d.ts +14 -0
  333. package/dist/transport/draining-transport.js +36 -0
  334. package/dist/transport/draining-transport.js.map +1 -0
  335. package/dist/transport/stdio.d.ts +2 -0
  336. package/dist/transport/stdio.js +5 -0
  337. package/dist/transport/stdio.js.map +1 -0
  338. package/dist/version.d.ts +2 -0
  339. package/dist/version.js +3 -0
  340. package/dist/version.js.map +1 -0
  341. package/package.json +49 -0
@@ -0,0 +1,1180 @@
1
+ import { z } from 'zod/v4';
2
+ import { dateSchema, upstreamDecimalSchema, uuidSchema, } from '../../schemas/primitives.js';
3
+ const integer = z.number().int();
4
+ const nonNegativeInteger = integer.nonnegative();
5
+ const version = nonNegativeInteger;
6
+ const optionalText = z.string().nullable().optional();
7
+ const optionalUuid = uuidSchema.nullable().optional();
8
+ const optionalTimestamp = z.string().nullable().optional();
9
+ const decimal = upstreamDecimalSchema;
10
+ const optionalDecimal = decimal.nullable().optional();
11
+ const queryValue = z.union([z.string(), z.number(), z.boolean()]).optional();
12
+ const query = z.record(z.string(), queryValue);
13
+ const idRequest = (key) => z.object({ [key]: uuidSchema }).strict();
14
+ const queryRequest = z.object({ query }).strict();
15
+ const bodyRequest = (body) => z.object({ body }).strict();
16
+ const idBodyRequest = (key, body) => z.object({ [key]: uuidSchema, body }).strict();
17
+ const page = (item) => z
18
+ .object({
19
+ total: nonNegativeInteger,
20
+ page: integer.positive(),
21
+ page_size: integer.positive(),
22
+ items: z.array(item),
23
+ })
24
+ .passthrough();
25
+ const submitResult = z
26
+ .object({
27
+ binding_id: uuidSchema,
28
+ instance_id: z.string(),
29
+ approval_status: z.string(),
30
+ current_node_name: optionalText,
31
+ })
32
+ .passthrough();
33
+ const verificationResult = z
34
+ .object({ verification_status: z.string() })
35
+ .passthrough();
36
+ const verifyAndSubmitResponse = z
37
+ .object({
38
+ verified: z.boolean(),
39
+ submitted: z.boolean(),
40
+ failed_at: optionalText,
41
+ error_code: optionalText,
42
+ message: optionalText,
43
+ verify_result: verificationResult.nullable().optional(),
44
+ submit_result: submitResult.nullable().optional(),
45
+ })
46
+ .passthrough();
47
+ const journalVerifyAndSubmitResponse = verifyAndSubmitResponse.extend({
48
+ verify_result: z
49
+ .object({ journal_id: uuidSchema, verification_status: z.string() })
50
+ .passthrough()
51
+ .nullable()
52
+ .optional(),
53
+ });
54
+ const batchSubmitResponse = z
55
+ .object({
56
+ submitted: nonNegativeInteger,
57
+ failed: z.array(z
58
+ .object({
59
+ journal_id: uuidSchema,
60
+ journal_number: optionalText,
61
+ reason: z.string(),
62
+ })
63
+ .passthrough()),
64
+ })
65
+ .passthrough();
66
+ const postItem = z
67
+ .object({
68
+ status: z.enum(['POSTED', 'NO_EVENT', 'NOT_POSTED']),
69
+ reason: optionalText,
70
+ journals: nonNegativeInteger,
71
+ })
72
+ .passthrough();
73
+ const documentPostResponse = z
74
+ .object({
75
+ requested: nonNegativeInteger,
76
+ posted: nonNegativeInteger,
77
+ journals: nonNegativeInteger,
78
+ items: z.array(postItem),
79
+ attachments_copied: nonNegativeInteger,
80
+ attachments_skipped: nonNegativeInteger,
81
+ attachments_failed: nonNegativeInteger,
82
+ })
83
+ .passthrough();
84
+ const offsetCandidate = z
85
+ .object({
86
+ source_type: z.string(),
87
+ source_id: uuidSchema,
88
+ symbol: z.string(),
89
+ quantity: decimal,
90
+ base_amount: optionalDecimal,
91
+ base_currency: optionalText,
92
+ base_rate: optionalDecimal,
93
+ biz_date: optionalTimestamp,
94
+ source_ref: optionalText,
95
+ main_account_name: optionalText,
96
+ sub_account_code: optionalText,
97
+ })
98
+ .passthrough();
99
+ const offsetCandidatesResponse = z
100
+ .object({
101
+ invoice_symbols: z.array(z.string()),
102
+ groups: z.array(z
103
+ .object({ symbol: z.string(), candidates: z.array(offsetCandidate) })
104
+ .passthrough()),
105
+ })
106
+ .passthrough();
107
+ const offsetApplyResponse = z
108
+ .object({
109
+ offset_lines: z.array(z
110
+ .object({
111
+ offset_line_id: uuidSchema,
112
+ source_type: z.string(),
113
+ source_id: uuidSchema,
114
+ quantity: decimal,
115
+ symbol: z.string(),
116
+ base_amount: optionalDecimal,
117
+ })
118
+ .passthrough()),
119
+ diff_lines: z.array(z.object({ offset_line_id: uuidSchema }).passthrough()),
120
+ invoice_remaining: z.array(z.object({ symbol: z.string(), remaining: decimal }).passthrough()),
121
+ offset_date: z.string(),
122
+ gl_date: z.string(),
123
+ })
124
+ .passthrough();
125
+ const offsetBody = z
126
+ .object({
127
+ txnRefs: z.array(z.object({ sourceType: z.string(), sourceId: uuidSchema }).strict()),
128
+ offsetDate: z.string(),
129
+ glDate: z.string(),
130
+ mode: z.literal('APPEND'),
131
+ periodName: z.string().optional(),
132
+ })
133
+ .strict();
134
+ const closingView = z
135
+ .object({
136
+ id: uuidSchema,
137
+ period_name: z.string(),
138
+ org_id: uuidSchema,
139
+ org_name: optionalText,
140
+ ledger_id: uuidSchema,
141
+ ledger_code: optionalText,
142
+ ledger_name: optionalText,
143
+ p_glh_id: optionalUuid,
144
+ closing_status: z.enum(['OPEN', 'CLOSED']),
145
+ revaluation_status: z.string(),
146
+ reconcile_status: z.string(),
147
+ revaluation_by: optionalUuid,
148
+ revaluation_time: optionalTimestamp,
149
+ import_status: z.string(),
150
+ import_by: optionalUuid,
151
+ import_time: optionalTimestamp,
152
+ closing_by: optionalUuid,
153
+ closing_time: optionalTimestamp,
154
+ gll_changed_flag: z.boolean().nullable().optional(),
155
+ version,
156
+ created_at: optionalTimestamp,
157
+ updated_at: optionalTimestamp,
158
+ })
159
+ .passthrough();
160
+ const closeCheckIssue = z
161
+ .object({
162
+ code: z.enum([
163
+ 'PERIOD_ALREADY_CLOSED',
164
+ 'BALANCE_RECALCULATION_REQUIRED',
165
+ 'IMPORT_NOT_COMPLETED',
166
+ 'BALANCE_MISSING',
167
+ ]),
168
+ message: z.string(),
169
+ })
170
+ .passthrough();
171
+ const revaluationIssue = z
172
+ .object({
173
+ code: z.enum([
174
+ 'PERIOD_ALREADY_CLOSED',
175
+ 'BALANCE_RECALCULATION_REQUIRED',
176
+ 'IMPORT_NOT_COMPLETED',
177
+ 'BALANCE_MISSING',
178
+ 'NO_FOREIGN_CURRENCY_BALANCES',
179
+ ]),
180
+ message: z.string(),
181
+ })
182
+ .passthrough();
183
+ const closeCheckResponse = z
184
+ .object({
185
+ closing_status: z.enum(['OPEN', 'CLOSED']),
186
+ check_token: z.string().min(1),
187
+ checked_at: z.string(),
188
+ summary: z
189
+ .object({
190
+ ledger_code: z.string(),
191
+ balance_ok: z.boolean(),
192
+ unposted_journal_count: nonNegativeInteger,
193
+ exception_count: nonNegativeInteger,
194
+ })
195
+ .passthrough(),
196
+ blockers: z.array(closeCheckIssue),
197
+ warnings: z.array(closeCheckIssue),
198
+ })
199
+ .passthrough();
200
+ const revaluationPreviewResponse = z
201
+ .object({
202
+ period_name: z.string(),
203
+ foreign_currency_balance_count: nonNegativeInteger,
204
+ blockers: z.array(revaluationIssue),
205
+ warnings: z.array(revaluationIssue),
206
+ })
207
+ .passthrough();
208
+ const revaluationResponse = z
209
+ .object({
210
+ revaluation_status: z.string(),
211
+ foreign_currency_balance_count: nonNegativeInteger,
212
+ })
213
+ .passthrough();
214
+ const reconcileResponse = z
215
+ .object({
216
+ reconcile_status: z.string(),
217
+ journal_count: nonNegativeInteger,
218
+ balance_count: nonNegativeInteger,
219
+ })
220
+ .passthrough();
221
+ const depreciationRequest = bodyRequest(z.object({ ledger_id: uuidSchema, period_name: z.string() }).strict());
222
+ const depreciationPreviewResponse = z
223
+ .object({
224
+ asset_count: nonNegativeInteger,
225
+ total_depr_amount: decimal,
226
+ lines: z.array(z.object({ asset_no: z.string(), amount: decimal }).passthrough()),
227
+ skipped: z.array(z
228
+ .object({
229
+ finance_id: uuidSchema,
230
+ reason: z.enum([
231
+ 'ASSET_TYPE_CIP',
232
+ 'NOT_IN_EFFECT',
233
+ 'DEPR_FLAG_OFF',
234
+ 'PERIOD_CLOSED',
235
+ ]),
236
+ detail: optionalText,
237
+ })
238
+ .passthrough()),
239
+ locked_orgs: z.array(z
240
+ .object({
241
+ org_id: uuidSchema,
242
+ org_name: z.string(),
243
+ affected_card_count: nonNegativeInteger,
244
+ closed_ledgers: z.array(z
245
+ .object({ ledger_code: z.string(), ledger_name: z.string() })
246
+ .passthrough()),
247
+ })
248
+ .passthrough()),
249
+ })
250
+ .passthrough();
251
+ const depreciationRunResponse = z
252
+ .object({
253
+ asset_count: nonNegativeInteger,
254
+ total_depr_amount: decimal,
255
+ period_name: z.string(),
256
+ })
257
+ .passthrough();
258
+ const costContextResponse = z
259
+ .object({
260
+ asset_finance_id: uuidSchema,
261
+ current_cost: decimal,
262
+ is_cost_posted: z.boolean(),
263
+ will_create_adjust: z.boolean(),
264
+ open_period_name: z.string(),
265
+ version,
266
+ })
267
+ .passthrough();
268
+ const costAdjustResponse = z
269
+ .object({
270
+ adjust_amount: decimal,
271
+ source_detail_id: uuidSchema,
272
+ period_name: z.string(),
273
+ current_cost: decimal,
274
+ accum_depr: decimal,
275
+ nbv: decimal,
276
+ version,
277
+ })
278
+ .passthrough();
279
+ const assetContextResponse = z
280
+ .object({
281
+ finance_id: uuidSchema,
282
+ card_id: uuidSchema,
283
+ asset_no: z.string(),
284
+ ledger_id: uuidSchema,
285
+ total_quantity: decimal,
286
+ existing_qty: decimal,
287
+ current_cost: decimal,
288
+ accum_depr: decimal,
289
+ accum_impair: decimal,
290
+ accum_retire: decimal,
291
+ impair_limit: decimal,
292
+ })
293
+ .passthrough();
294
+ const impairmentResponse = z
295
+ .object({
296
+ depr_detail_id: uuidSchema,
297
+ movement_type: z.literal('IMPAIR'),
298
+ amount: decimal,
299
+ })
300
+ .passthrough();
301
+ const retirementResponse = z
302
+ .object({
303
+ depr_detail_id: uuidSchema,
304
+ movement_type: z.literal('RETIRE'),
305
+ amount: decimal,
306
+ quantity: decimal,
307
+ })
308
+ .passthrough();
309
+ const eventListItem = z
310
+ .object({
311
+ event_id: uuidSchema,
312
+ entry_source: z.string(),
313
+ event_no: z.string(),
314
+ event_time: z.string(),
315
+ event_type: z.string(),
316
+ business_type: optionalText,
317
+ strategy_key: optionalText,
318
+ description: optionalText,
319
+ is_backfill: z.boolean(),
320
+ crypto_count: nonNegativeInteger,
321
+ fiat_count: nonNegativeInteger,
322
+ security_count: nonNegativeInteger,
323
+ derivative_count: nonNegativeInteger,
324
+ ar_count: nonNegativeInteger,
325
+ ap_count: nonNegativeInteger,
326
+ tx_count: nonNegativeInteger,
327
+ })
328
+ .passthrough();
329
+ const eventLine = z
330
+ .object({
331
+ source_key: z.string(),
332
+ source_type: z.string(),
333
+ line_id: uuidSchema,
334
+ flow_type: optionalText,
335
+ system_type: optionalText,
336
+ biz_types: z.array(z
337
+ .object({
338
+ slot: z.string(),
339
+ name: z.string().nullable(),
340
+ value: z.string(),
341
+ })
342
+ .passthrough()),
343
+ attributes: z.array(z
344
+ .object({
345
+ slot: z.string(),
346
+ name: z.string().nullable(),
347
+ value: z.string(),
348
+ })
349
+ .passthrough()),
350
+ from_party: optionalText,
351
+ to_party: optionalText,
352
+ biz_date: optionalTimestamp,
353
+ sub_account_id: optionalUuid,
354
+ main_account_id: optionalUuid,
355
+ main_account_name: optionalText,
356
+ symbol: optionalText,
357
+ quantity: optionalDecimal,
358
+ base_rate: optionalDecimal,
359
+ base_amount: optionalDecimal,
360
+ base_currency: optionalText,
361
+ base_rate_time: optionalTimestamp,
362
+ ledger_id: optionalUuid,
363
+ coa_code: optionalText,
364
+ description: optionalText,
365
+ reference: optionalText,
366
+ version: version.nullable().optional(),
367
+ resolved: z.boolean(),
368
+ })
369
+ .passthrough();
370
+ const eventCheckResponse = z
371
+ .object({
372
+ warn_count: nonNegativeInteger,
373
+ error_count: nonNegativeInteger,
374
+ warn_groups: z.array(z
375
+ .object({
376
+ source_type: z.string(),
377
+ line_id: uuidSchema,
378
+ ledger_id: uuidSchema,
379
+ event_cnt: nonNegativeInteger,
380
+ event_ids: z.array(uuidSchema),
381
+ })
382
+ .passthrough()),
383
+ block_rows: z.array(z
384
+ .object({
385
+ source_type: z.string(),
386
+ line_id: uuidSchema,
387
+ ledger_id: uuidSchema,
388
+ })
389
+ .passthrough()),
390
+ })
391
+ .passthrough();
392
+ export const sourceTypesUpstreamSchema = z
393
+ .object({
394
+ source_types: z.array(z
395
+ .object({ source_type: z.string(), has_enabled_chain: z.boolean() })
396
+ .passthrough()),
397
+ })
398
+ .passthrough();
399
+ const collectResponse = z
400
+ .object({
401
+ result: z
402
+ .object({
403
+ input_tx_count: nonNegativeInteger,
404
+ output_event_count: nonNegativeInteger,
405
+ })
406
+ .passthrough(),
407
+ success_count: nonNegativeInteger,
408
+ failed_count: nonNegativeInteger,
409
+ deleted_event_count: nonNegativeInteger,
410
+ failed: z.array(z.object({ source_id: uuidSchema, reason: z.string() }).passthrough()),
411
+ degraded: z.array(z.object({ source_id: uuidSchema, reason: z.string() }).passthrough()),
412
+ })
413
+ .passthrough();
414
+ const poll = z
415
+ .object({
416
+ run_kind: z.enum(['RUL_LOOP', 'EVENT_COLLECT', 'PNL_CALC']),
417
+ native_status: z.string(),
418
+ running: z.boolean(),
419
+ done: z.boolean(),
420
+ failed: z.boolean(),
421
+ incomplete: z.boolean(),
422
+ terminal: z.boolean(),
423
+ failure_reason: z
424
+ .object({ error_code: z.string(), message: optionalText })
425
+ .passthrough()
426
+ .nullable(),
427
+ })
428
+ .passthrough();
429
+ const autoFlowItem = z
430
+ .object({
431
+ id: uuidSchema,
432
+ org_id: uuidSchema,
433
+ current_step: z.string(),
434
+ loop_status: z.enum(['PENDING', 'RUNNING', 'SUCCESS', 'FAILED', 'BLOCKED']),
435
+ loop_count: nonNegativeInteger,
436
+ loop_start_time: optionalTimestamp,
437
+ loop_end_time: optionalTimestamp,
438
+ event_collect_mode: z.string(),
439
+ fifo_mode: z.string(),
440
+ })
441
+ .passthrough();
442
+ export const autoFlowDetailUpstreamSchema = z
443
+ .object({
444
+ flow: autoFlowItem,
445
+ loop_seq: nonNegativeInteger,
446
+ steps: z.array(z
447
+ .object({
448
+ id: uuidSchema,
449
+ loop_seq: nonNegativeInteger,
450
+ step_code: z.string(),
451
+ step_order: nonNegativeInteger,
452
+ status: z.string(),
453
+ input_count: nonNegativeInteger,
454
+ output_count: nonNegativeInteger,
455
+ error_count: nonNegativeInteger,
456
+ })
457
+ .passthrough()),
458
+ loops: z.array(z
459
+ .object({
460
+ loop_seq: nonNegativeInteger,
461
+ loop_status: z.string(),
462
+ loop_end_time: optionalTimestamp,
463
+ })
464
+ .passthrough()),
465
+ poll,
466
+ })
467
+ .passthrough();
468
+ const autoFlowRunResponse = z
469
+ .object({
470
+ flow_id: uuidSchema,
471
+ loop_seq: nonNegativeInteger,
472
+ loop_status: z.string(),
473
+ current_step: z.string(),
474
+ fifo_covered_until: optionalTimestamp,
475
+ })
476
+ .passthrough();
477
+ export const pnlRunUpstreamSchema = z
478
+ .object({
479
+ id: uuidSchema,
480
+ mode: z.enum(['FULL', 'INCREMENTAL', 'SCOPED']),
481
+ status: z.enum(['RUNNING', 'COMPLETED', 'FAILED']),
482
+ bucket_id: uuidSchema,
483
+ symbol: optionalText,
484
+ from_date: dateSchema,
485
+ to_date: dateSchema,
486
+ lines_processed: nonNegativeInteger,
487
+ ins_created: nonNegativeInteger,
488
+ outs_created: nonNegativeInteger,
489
+ transfers_created: nonNegativeInteger,
490
+ total_realized_gl: optionalDecimal,
491
+ error_message: optionalText,
492
+ started_at: optionalTimestamp,
493
+ completed_at: optionalTimestamp,
494
+ created_at: z.string(),
495
+ poll,
496
+ })
497
+ .passthrough();
498
+ const mappingAttributeDefinition = z
499
+ .object({
500
+ id: uuidSchema,
501
+ source_key: z.string(),
502
+ biz_type_no: integer.min(1).max(4),
503
+ attr_name: z.string(),
504
+ value_source: optionalText,
505
+ version,
506
+ created_at: z.string(),
507
+ updated_at: z.string(),
508
+ })
509
+ .passthrough();
510
+ const mappingAttributeFill = z
511
+ .object({
512
+ id: uuidSchema,
513
+ source_category: z.string(),
514
+ source_code: z.string(),
515
+ line_type: z.string(),
516
+ system_type: z.string(),
517
+ target_field: z.string(),
518
+ source_expr: z.string(),
519
+ note: optionalText,
520
+ is_system: z.boolean(),
521
+ version,
522
+ created_at: z.string(),
523
+ updated_at: z.string(),
524
+ })
525
+ .passthrough();
526
+ const mappingSourceHandler = z
527
+ .object({
528
+ id: uuidSchema,
529
+ source_category: z.string(),
530
+ source_code: z.string(),
531
+ source_table: z.string(),
532
+ target_line_types: z.string(),
533
+ handler_proc: z.string(),
534
+ priority: integer,
535
+ status: z.string(),
536
+ description: optionalText,
537
+ is_system: z.boolean(),
538
+ version,
539
+ created_at: z.string(),
540
+ updated_at: z.string(),
541
+ })
542
+ .passthrough();
543
+ const accountingRule = z
544
+ .object({
545
+ id: uuidSchema,
546
+ ledger_id: uuidSchema,
547
+ rule_code: z.string(),
548
+ rule_name: z.string(),
549
+ rule_description: optionalText,
550
+ priority: integer,
551
+ effective_from: z.string(),
552
+ effective_to: optionalTimestamp,
553
+ match_event_type_op: optionalText,
554
+ match_event_type_vals: z.array(z.string()),
555
+ match_strategy_key_op: optionalText,
556
+ match_strategy_key_vals: z.array(z.string()),
557
+ is_no_booking: z.boolean(),
558
+ is_merge_same_rule_line: z.boolean(),
559
+ is_merge_eligible: z.boolean(),
560
+ is_enabled: z.boolean(),
561
+ version,
562
+ created_at: z.string(),
563
+ updated_at: optionalTimestamp,
564
+ })
565
+ .passthrough();
566
+ const allocationConfigHead = z
567
+ .object({
568
+ id: uuidSchema,
569
+ ledger_id: uuidSchema,
570
+ ledger_name: z.string(),
571
+ coa_code: z.string(),
572
+ coa_name: z.string(),
573
+ attributes: z.array(z.string().nullable()),
574
+ description: optionalText,
575
+ reference: optionalText,
576
+ ratio_total: decimal,
577
+ enabled: z.boolean(),
578
+ line_count: nonNegativeInteger,
579
+ version,
580
+ created_at: z.string(),
581
+ updated_at: z.string(),
582
+ })
583
+ .passthrough();
584
+ const pnlBucket = z
585
+ .object({
586
+ id: uuidSchema,
587
+ org_id: uuidSchema,
588
+ bucket_code: z.string(),
589
+ bucket_name: z.string(),
590
+ cost_method: z.enum(['FIFO', 'LIFO', 'WA']),
591
+ reporting_currency: z.string(),
592
+ treat_crypto_swap_as_disposal: z.boolean(),
593
+ transfer_group: optionalText,
594
+ status: z.enum(['ACTIVE', 'DISABLED']),
595
+ member_count: nonNegativeInteger,
596
+ cost_method_locked: z.boolean(),
597
+ lock_version: version,
598
+ created_at: z.string(),
599
+ updated_at: z.string(),
600
+ })
601
+ .passthrough();
602
+ const generatorParameter = z
603
+ .object({
604
+ id: uuidSchema,
605
+ param_key: z.string(),
606
+ param_name: z.string(),
607
+ value_type: z.enum(['STRING', 'NUMBER', 'DATE', 'BOOLEAN']),
608
+ value: optionalText,
609
+ effective_date: dateSchema.nullable().optional(),
610
+ description: optionalText,
611
+ is_enabled: z.boolean(),
612
+ version,
613
+ created_at: z.string(),
614
+ updated_at: z.string(),
615
+ })
616
+ .passthrough();
617
+ const generatorRule = z
618
+ .object({
619
+ id: uuidSchema,
620
+ code: z.string(),
621
+ name: z.string(),
622
+ generator_type: z.string(),
623
+ formula: z.json(),
624
+ cron_expr: optionalText,
625
+ is_enabled: z.boolean(),
626
+ last_run_at: optionalTimestamp,
627
+ last_status: optionalText,
628
+ last_message: optionalText,
629
+ description: optionalText,
630
+ version,
631
+ created_at: z.string(),
632
+ updated_at: z.string(),
633
+ })
634
+ .passthrough();
635
+ const mappingAttributeDefinitionValues = z
636
+ .object({
637
+ source_key: z.string(),
638
+ biz_type_no: integer.min(1).max(4),
639
+ attr_name: z.string(),
640
+ value_source: z.string().optional(),
641
+ })
642
+ .strict();
643
+ const mappingAttributeDefinitionUpdateValues = z
644
+ .object({
645
+ attr_name: z.string().optional(),
646
+ value_source: z.string().optional(),
647
+ })
648
+ .strict();
649
+ const mappingAttributeFillValues = z
650
+ .object({
651
+ source_category: z.string(),
652
+ source_code: z.string(),
653
+ line_type: z.string(),
654
+ system_type: z.string(),
655
+ target_field: z.string(),
656
+ source_expr: z.string(),
657
+ note: z.string().optional(),
658
+ })
659
+ .strict();
660
+ const mappingAttributeFillUpdateValues = z
661
+ .object({ source_expr: z.string().optional(), note: z.string().optional() })
662
+ .strict();
663
+ const mappingSourceHandlerValues = z
664
+ .object({
665
+ source_category: z.string(),
666
+ source_code: z.string(),
667
+ source_table: z.string(),
668
+ target_line_types: z.string(),
669
+ handler_proc: z.string(),
670
+ priority: integer.optional(),
671
+ status: z.string().optional(),
672
+ description: z.string().optional(),
673
+ })
674
+ .strict();
675
+ const mappingSourceHandlerUpdateValues = mappingSourceHandlerValues.omit({
676
+ source_category: true,
677
+ source_code: true,
678
+ });
679
+ const accountingRuleValues = z
680
+ .object({
681
+ ledger_id: uuidSchema,
682
+ rule_code: z.string(),
683
+ rule_name: z.string(),
684
+ rule_description: z.string().optional(),
685
+ priority: integer.optional(),
686
+ effective_from: z.string(),
687
+ effective_to: z.string().optional(),
688
+ match_event_type_op: z.string().optional(),
689
+ match_event_type_vals: z.array(z.string()).optional(),
690
+ match_strategy_key_op: z.string().optional(),
691
+ match_strategy_key_vals: z.array(z.string()).optional(),
692
+ is_no_booking: z.boolean().optional(),
693
+ is_merge_same_rule_line: z.boolean().optional(),
694
+ is_merge_eligible: z.boolean().optional(),
695
+ is_enabled: z.boolean().optional(),
696
+ remark: z.string().optional(),
697
+ })
698
+ .strict();
699
+ const accountingRuleUpdateValues = accountingRuleValues.omit({
700
+ ledger_id: true,
701
+ rule_code: true,
702
+ });
703
+ const allocationConfigValues = z
704
+ .object({
705
+ ledger_id: uuidSchema,
706
+ coa_code: z.string(),
707
+ attributes: z.array(z.string().nullable()).optional(),
708
+ description: z.string().optional(),
709
+ reference: z.string().optional(),
710
+ enabled: z.boolean().optional(),
711
+ })
712
+ .strict();
713
+ const allocationConfigUpdateValues = z
714
+ .object({
715
+ description: z.string().optional(),
716
+ reference: z.string().optional(),
717
+ enabled: z.boolean().optional(),
718
+ })
719
+ .strict();
720
+ const pnlBucketValues = z
721
+ .object({
722
+ bucket_code: z.string(),
723
+ bucket_name: z.string(),
724
+ cost_method: z.enum(['FIFO', 'LIFO', 'WA']),
725
+ reporting_currency: z.string(),
726
+ treat_crypto_swap_as_disposal: z.boolean().optional(),
727
+ transfer_group: z.string().optional(),
728
+ status: z.enum(['ACTIVE', 'DISABLED']).optional(),
729
+ })
730
+ .strict();
731
+ const generatorParameterValues = z
732
+ .object({
733
+ param_key: z.string(),
734
+ param_name: z.string(),
735
+ value_type: z.enum(['STRING', 'NUMBER', 'DATE', 'BOOLEAN']),
736
+ value: z.string().optional(),
737
+ effective_date: dateSchema.optional(),
738
+ description: z.string().optional(),
739
+ is_enabled: z.boolean().optional(),
740
+ })
741
+ .strict();
742
+ const generatorParameterUpdateValues = generatorParameterValues.omit({
743
+ param_key: true,
744
+ });
745
+ const generatorRuleValues = z
746
+ .object({
747
+ code: z.string(),
748
+ name: z.string(),
749
+ generator_type: z.string(),
750
+ formula: z.json(),
751
+ description: z.string().optional(),
752
+ is_enabled: z.boolean().optional(),
753
+ })
754
+ .strict();
755
+ const generatorRuleUpdateValues = generatorRuleValues.omit({ code: true });
756
+ const allocationLine = z
757
+ .object({
758
+ id: uuidSchema,
759
+ line_no: nonNegativeInteger,
760
+ coa_code: z.string(),
761
+ coa_name: z.string(),
762
+ attributes: z.array(z.string().nullable()),
763
+ biz_types: z.array(z.string().nullable()),
764
+ description: optionalText,
765
+ reference: optionalText,
766
+ ratio: decimal,
767
+ enabled: z.boolean().optional(),
768
+ base_currency: optionalText,
769
+ base_amount: optionalDecimal,
770
+ origin_currency: optionalText,
771
+ origin_amount: optionalDecimal,
772
+ })
773
+ .passthrough();
774
+ const allocationConfigDetail = z
775
+ .object({ head: allocationConfigHead, lines: z.array(allocationLine) })
776
+ .passthrough();
777
+ const crudContracts = {
778
+ map_attr_definition: {
779
+ entity: mappingAttributeDefinition,
780
+ createValues: mappingAttributeDefinitionValues,
781
+ updateValues: mappingAttributeDefinitionUpdateValues,
782
+ },
783
+ map_attribute_fill: {
784
+ entity: mappingAttributeFill,
785
+ createValues: mappingAttributeFillValues,
786
+ updateValues: mappingAttributeFillUpdateValues,
787
+ },
788
+ map_source_handler: {
789
+ entity: mappingSourceHandler,
790
+ createValues: mappingSourceHandlerValues,
791
+ updateValues: mappingSourceHandlerUpdateValues,
792
+ },
793
+ accounting_rule: {
794
+ entity: accountingRule,
795
+ createValues: accountingRuleValues,
796
+ updateValues: accountingRuleUpdateValues,
797
+ createResponse: z.object({ id: uuidSchema }).passthrough(),
798
+ },
799
+ allocation_config: {
800
+ entity: allocationConfigHead,
801
+ createValues: allocationConfigValues,
802
+ updateValues: allocationConfigUpdateValues,
803
+ detailResponse: allocationConfigDetail,
804
+ createResponse: z.object({ id: uuidSchema }).passthrough(),
805
+ },
806
+ pnl_bucket: {
807
+ entity: pnlBucket,
808
+ createValues: pnlBucketValues,
809
+ updateValues: pnlBucketValues,
810
+ },
811
+ generator_parameter: {
812
+ entity: generatorParameter,
813
+ createValues: generatorParameterValues,
814
+ updateValues: generatorParameterUpdateValues,
815
+ },
816
+ generator_rule: {
817
+ entity: generatorRule,
818
+ createValues: generatorRuleValues,
819
+ updateValues: generatorRuleUpdateValues,
820
+ },
821
+ };
822
+ const precheckValues = z
823
+ .object({
824
+ ledger_id: uuidSchema.optional(),
825
+ main_account_id: uuidSchema.optional(),
826
+ sub_account_id: uuidSchema.optional(),
827
+ config_level: z.enum(['MAIN_ACCOUNT', 'SUB_ACCOUNT']).optional(),
828
+ config_scope: z.enum(['MAIN', 'SUB']).optional(),
829
+ is_enabled: z.boolean().optional(),
830
+ effective_from: z.string().optional(),
831
+ effective_to: z.string().optional(),
832
+ match_from_address: z.string().optional(),
833
+ match_to_address: z.string().optional(),
834
+ match_from_party_id: uuidSchema.optional(),
835
+ match_to_party_id: uuidSchema.optional(),
836
+ match_system_type: z.string().optional(),
837
+ match_flow_type: z.string().optional(),
838
+ main_coa_code: z.string().optional(),
839
+ counter_coa_code: z.string().optional(),
840
+ main_description: z.string().optional(),
841
+ main_reference: z.string().optional(),
842
+ counter_description: z.string().optional(),
843
+ counter_reference: z.string().optional(),
844
+ remark: z.string().optional(),
845
+ ...Object.fromEntries(['main', 'counter'].flatMap((side) => Array.from({ length: 12 }, (_, index) => [
846
+ `${side}_attribute${index + 1}`,
847
+ z.string().nullable().optional(),
848
+ ]))),
849
+ })
850
+ .strict();
851
+ const precheckDetail = z
852
+ .object({
853
+ id: uuidSchema,
854
+ ledger_id: uuidSchema,
855
+ org_id: uuidSchema,
856
+ main_account_id: uuidSchema,
857
+ account_code: z.string(),
858
+ sub_account_id: optionalUuid,
859
+ sub_account_code: optionalText,
860
+ config_level: z.enum(['MAIN_ACCOUNT', 'SUB_ACCOUNT']),
861
+ config_scope: z.enum(['MAIN', 'SUB']),
862
+ is_enabled: z.boolean(),
863
+ effective_from: optionalTimestamp,
864
+ effective_to: optionalTimestamp,
865
+ match_from_address: optionalText,
866
+ match_to_address: optionalText,
867
+ match_from_party_id: optionalUuid,
868
+ match_to_party_id: optionalUuid,
869
+ match_system_type: optionalText,
870
+ match_flow_type: optionalText,
871
+ main_coa_code: optionalText,
872
+ main_coa_name: optionalText,
873
+ counter_coa_code: optionalText,
874
+ counter_coa_name: optionalText,
875
+ is_ready: z.boolean(),
876
+ ready_status: z.string(),
877
+ ready_reason: optionalText,
878
+ remark: optionalText,
879
+ ...Object.fromEntries(['main', 'counter'].flatMap((side) => Array.from({ length: 12 }, (_, index) => [
880
+ `${side}_attribute${index + 1}`,
881
+ z.string().nullable().optional(),
882
+ ]))),
883
+ version,
884
+ })
885
+ .passthrough();
886
+ const precheckTreeRow = z
887
+ .object({
888
+ id: uuidSchema,
889
+ config_scope: z.enum(['MAIN', 'SUB']),
890
+ ready_status: z.string(),
891
+ is_ready: z.boolean(),
892
+ ready_reason: optionalText,
893
+ is_enabled: z.boolean(),
894
+ effective_from: optionalTimestamp,
895
+ effective_to: optionalTimestamp,
896
+ main_coa_code: optionalText,
897
+ main_coa_name: optionalText,
898
+ counter_coa_code: optionalText,
899
+ sub_account_id: optionalUuid,
900
+ sub_account_code: optionalText,
901
+ sub_account_name: optionalText,
902
+ version,
903
+ })
904
+ .passthrough();
905
+ const precheckTree = z.array(z
906
+ .object({
907
+ main_account_id: uuidSchema,
908
+ account_code: z.string(),
909
+ account_name: z.string(),
910
+ source_platform: optionalText,
911
+ config_level: z.string(),
912
+ main_row: precheckTreeRow.nullable(),
913
+ children: z.array(precheckTreeRow),
914
+ })
915
+ .passthrough());
916
+ const allocationResultHead = z
917
+ .object({
918
+ id: uuidSchema,
919
+ ledger_id: uuidSchema,
920
+ ledger_name: z.string(),
921
+ journal_id: uuidSchema,
922
+ journal_number: z.string(),
923
+ period_name: z.string(),
924
+ gl_date: dateSchema,
925
+ coa_code: z.string(),
926
+ coa_name: z.string(),
927
+ attributes: z.array(z.string().nullable()),
928
+ description: optionalText,
929
+ reference: optionalText,
930
+ gen_mode: z.string(),
931
+ status: z.string(),
932
+ line_count: nonNegativeInteger,
933
+ base_currency: z.string(),
934
+ net_base_amount: decimal,
935
+ version,
936
+ created_at: z.string(),
937
+ })
938
+ .passthrough();
939
+ const allocationResultDetail = z
940
+ .object({
941
+ head: allocationResultHead,
942
+ lines: z.array(allocationLine),
943
+ })
944
+ .passthrough();
945
+ const allocationSummary = z
946
+ .object({
947
+ rows: z.array(z
948
+ .object({
949
+ coa_code: z.string(),
950
+ coa_name: z.string(),
951
+ att_combo: z.string(),
952
+ total_base_amount: decimal,
953
+ line_count: nonNegativeInteger,
954
+ })
955
+ .passthrough()),
956
+ grand_total: decimal,
957
+ })
958
+ .passthrough();
959
+ export const extendedQueryResponseSchemas = {
960
+ 'suite.acct.closing.list': page(closingView),
961
+ 'suite.acct.closing.detail': closingView,
962
+ 'suite.rul.events.list': page(eventListItem),
963
+ 'suite.rul.events.lines': z.array(eventLine),
964
+ 'suite.rul.events.check': eventCheckResponse,
965
+ 'suite.config.map_attr_definition.list': page(mappingAttributeDefinition),
966
+ 'suite.config.map_attr_definition.detail': mappingAttributeDefinition,
967
+ 'suite.config.map_attribute_fill.list': page(mappingAttributeFill),
968
+ 'suite.config.map_attribute_fill.detail': mappingAttributeFill,
969
+ 'suite.config.map_source_handler.list': page(mappingSourceHandler),
970
+ 'suite.config.map_source_handler.detail': mappingSourceHandler,
971
+ 'suite.config.accounting_rule.list': page(accountingRule),
972
+ 'suite.config.accounting_rule.detail': accountingRule,
973
+ 'suite.config.precheck_rule.tree': precheckTree,
974
+ 'suite.config.precheck_rule.detail': precheckDetail,
975
+ 'suite.config.allocation_config.list': page(allocationConfigHead),
976
+ 'suite.config.allocation_config.detail': allocationConfigDetail,
977
+ 'suite.aloc.detail.list': page(allocationResultHead),
978
+ 'suite.aloc.detail.detail': allocationResultDetail,
979
+ 'suite.aloc.detail.summary': allocationSummary,
980
+ };
981
+ export function parseExtendedQueryResponse(capabilityId, response) {
982
+ return extendedQueryResponseSchemas[capabilityId].parse(response);
983
+ }
984
+ const allocationPreview = z
985
+ .object({
986
+ journal_number: z.string(),
987
+ hit: z.boolean(),
988
+ lines: z.array(z
989
+ .object({
990
+ src_line_no: nonNegativeInteger,
991
+ coa_code: z.string(),
992
+ net_base: decimal,
993
+ expanded: z.array(z
994
+ .object({
995
+ ratio: decimal,
996
+ coa_code: z.string(),
997
+ base_amount: decimal,
998
+ })
999
+ .passthrough()),
1000
+ })
1001
+ .passthrough()),
1002
+ })
1003
+ .passthrough();
1004
+ const allocationGenerate = z
1005
+ .object({
1006
+ hit: z.boolean(),
1007
+ head_ids: z.array(uuidSchema),
1008
+ already_exists_count: nonNegativeInteger,
1009
+ line_count: nonNegativeInteger,
1010
+ total_base_amount: decimal,
1011
+ })
1012
+ .passthrough();
1013
+ const allocationLinesRequest = z
1014
+ .object({
1015
+ object_id: uuidSchema,
1016
+ version,
1017
+ lines: z
1018
+ .array(z.object({ line_no: integer.positive(), ratio: decimal }).passthrough())
1019
+ .min(1),
1020
+ })
1021
+ .strict();
1022
+ const allocationLinesResponse = z
1023
+ .object({
1024
+ cfg_head_id: uuidSchema,
1025
+ version,
1026
+ ratio_total: decimal,
1027
+ line_count: nonNegativeInteger,
1028
+ })
1029
+ .passthrough();
1030
+ const pnlMemberResponse = z
1031
+ .object({
1032
+ id: uuidSchema,
1033
+ bucket_id: uuidSchema,
1034
+ sub_account_id: uuidSchema,
1035
+ joined_at: dateSchema,
1036
+ active: z.boolean(),
1037
+ lock_version: version,
1038
+ })
1039
+ .passthrough();
1040
+ const generatorRunResponse = z
1041
+ .object({
1042
+ success: z.boolean(),
1043
+ created_count: nonNegativeInteger,
1044
+ status: z.string(),
1045
+ message: optionalText,
1046
+ })
1047
+ .passthrough();
1048
+ const contracts = new Map();
1049
+ function register(ids, request, response) {
1050
+ for (const id of typeof ids === 'string' ? [ids] : ids) {
1051
+ if (contracts.has(id))
1052
+ throw new Error(`Duplicate extended capability contract: ${id}`);
1053
+ contracts.set(id, {
1054
+ request,
1055
+ response,
1056
+ });
1057
+ }
1058
+ }
1059
+ register('suite.acct.journal.verify_submit', z.object({ journal_id: uuidSchema, version }).strict(), journalVerifyAndSubmitResponse);
1060
+ register('suite.acct.journal.batch_submit', z.object({ journal_ids: z.array(uuidSchema).min(2) }).strict(), batchSubmitResponse);
1061
+ for (const document of ['ap.payable', 'ar.receivable']) {
1062
+ register(`suite.${document}.verify_submit`, z.object({ document_id: uuidSchema, version }).strict(), verifyAndSubmitResponse);
1063
+ register(`suite.${document}.post`, idRequest('document_id'), documentPostResponse);
1064
+ register([
1065
+ `suite.${document}.offset_candidates`,
1066
+ `suite.${document}.internal_offset_candidates`,
1067
+ ], idRequest('document_id'), offsetCandidatesResponse);
1068
+ register(`suite.${document}.offset_apply`, idBodyRequest('document_id', offsetBody), offsetApplyResponse);
1069
+ }
1070
+ register('suite.acct.closing.list', queryRequest, extendedQueryResponseSchemas['suite.acct.closing.list']);
1071
+ register('suite.acct.closing.detail', idRequest('closing_id'), extendedQueryResponseSchemas['suite.acct.closing.detail']);
1072
+ register('suite.acct.closing.revaluation_preview', z.object({ closing_id: uuidSchema, version }).strict(), revaluationPreviewResponse);
1073
+ register('suite.acct.closing.revaluation_confirm', z.object({ closing_id: uuidSchema, version }).strict(), revaluationResponse);
1074
+ register('suite.acct.closing.close_check', z.object({ closing_id: uuidSchema, version }).strict(), closeCheckResponse);
1075
+ register('suite.acct.closing.close_book', z
1076
+ .object({
1077
+ closing_id: uuidSchema,
1078
+ version,
1079
+ check_token: z.string().min(1),
1080
+ close_reason: z.string().optional(),
1081
+ })
1082
+ .strict(), closingView);
1083
+ register('suite.acct.closing.reconcile', z
1084
+ .object({ closing_id: uuidSchema, version, note: z.string().optional() })
1085
+ .strict(), reconcileResponse);
1086
+ register('suite.acct.closing.reverse', z.object({ closing_id: uuidSchema, version, reason: z.string() }).strict(), closingView);
1087
+ register('suite.fa.depreciation.preview', depreciationRequest, depreciationPreviewResponse);
1088
+ register('suite.fa.depreciation.run', depreciationRequest, depreciationRunResponse);
1089
+ register('suite.fa.cost_adjust.context', idRequest('finance_id'), costContextResponse);
1090
+ register('suite.fa.cost_adjust.submit', idBodyRequest('finance_id', z
1091
+ .object({ new_cost: decimal, version, remark: z.string().optional() })
1092
+ .strict()), costAdjustResponse);
1093
+ register('suite.fa.impair_retire.context', idRequest('finance_id'), assetContextResponse);
1094
+ register('suite.fa.impair.submit', idBodyRequest('finance_id', z
1095
+ .object({
1096
+ biz_date: dateSchema,
1097
+ this_amount: decimal,
1098
+ remark: z.string().optional(),
1099
+ })
1100
+ .strict()), impairmentResponse);
1101
+ register('suite.fa.retire.submit', idBodyRequest('finance_id', z
1102
+ .object({
1103
+ biz_date: dateSchema,
1104
+ retire_qty: decimal,
1105
+ this_amount: decimal.optional(),
1106
+ remark: z.string().optional(),
1107
+ })
1108
+ .strict()), retirementResponse);
1109
+ register('suite.rul.events.list', queryRequest, extendedQueryResponseSchemas['suite.rul.events.list']);
1110
+ register('suite.rul.events.lines', idRequest('event_id'), extendedQueryResponseSchemas['suite.rul.events.lines']);
1111
+ register('suite.rul.events.check', queryRequest, extendedQueryResponseSchemas['suite.rul.events.check']);
1112
+ register('suite.rul.events.source_types', z.object({}).strict(), sourceTypesUpstreamSchema);
1113
+ register('suite.rul.events.collect_by_ids', bodyRequest(z
1114
+ .object({
1115
+ org_id: uuidSchema,
1116
+ source_type: z.string(),
1117
+ source_ids: z.array(uuidSchema).min(1).max(1000),
1118
+ strategy_keys: z.array(z.string()).min(1).optional(),
1119
+ })
1120
+ .strict()), collectResponse);
1121
+ register('suite.rul.auto_flow.detail', z
1122
+ .object({ flow_id: uuidSchema, loop_seq: nonNegativeInteger.optional() })
1123
+ .strict(), autoFlowDetailUpstreamSchema);
1124
+ register('suite.rul.auto_flow.run', idRequest('flow_id'), autoFlowRunResponse);
1125
+ for (const [key, contract] of Object.entries(crudContracts)) {
1126
+ const listCapabilityId = `suite.config.${key}.list`;
1127
+ const detailCapabilityId = `suite.config.${key}.detail`;
1128
+ register(listCapabilityId, queryRequest, listCapabilityId in extendedQueryResponseSchemas
1129
+ ? extendedQueryResponseSchemas[listCapabilityId]
1130
+ : page(contract.entity));
1131
+ register(detailCapabilityId, idRequest('object_id'), detailCapabilityId in extendedQueryResponseSchemas
1132
+ ? extendedQueryResponseSchemas[detailCapabilityId]
1133
+ : (contract.detailResponse ?? contract.entity));
1134
+ register(`suite.config.${key}.create`, z.object({ values: contract.createValues }).strict(), contract.createResponse ?? contract.entity);
1135
+ register(`suite.config.${key}.update`, z
1136
+ .object({ object_id: uuidSchema, version, values: contract.updateValues })
1137
+ .strict(), contract.updateResponse ?? contract.entity);
1138
+ }
1139
+ register('suite.config.precheck_rule.tree', queryRequest, extendedQueryResponseSchemas['suite.config.precheck_rule.tree']);
1140
+ register('suite.config.precheck_rule.detail', idRequest('object_id'), extendedQueryResponseSchemas['suite.config.precheck_rule.detail']);
1141
+ register('suite.config.precheck_rule.create', z.object({ values: precheckValues }).strict(), z.object({ id: uuidSchema, ready_status: z.string() }).passthrough());
1142
+ register('suite.config.precheck_rule.update', z.object({ object_id: uuidSchema, version, values: precheckValues }).strict(), precheckDetail);
1143
+ register('suite.aloc.detail.list', queryRequest, extendedQueryResponseSchemas['suite.aloc.detail.list']);
1144
+ register('suite.aloc.detail.detail', idRequest('object_id'), extendedQueryResponseSchemas['suite.aloc.detail.detail']);
1145
+ register('suite.aloc.detail.summary', queryRequest, extendedQueryResponseSchemas['suite.aloc.detail.summary']);
1146
+ register('suite.config.allocation_config.lines', allocationLinesRequest, allocationLinesResponse);
1147
+ register('suite.aloc.generate.preview', idRequest('journal_id'), allocationPreview);
1148
+ register('suite.aloc.generate.execute', idRequest('journal_id'), allocationGenerate);
1149
+ register('suite.pnl.calculation.run', bodyRequest(z
1150
+ .object({
1151
+ mode: z.enum(['FULL', 'INCREMENTAL', 'SCOPED']),
1152
+ bucket_id: uuidSchema,
1153
+ symbol: z.string().optional(),
1154
+ from_date: dateSchema,
1155
+ to_date: dateSchema,
1156
+ })
1157
+ .strict()), pnlRunUpstreamSchema);
1158
+ register('suite.pnl.calculation.status', idRequest('run_id'), pnlRunUpstreamSchema);
1159
+ register('suite.config.pnl_bucket.member_add', z
1160
+ .object({
1161
+ bucket_id: uuidSchema,
1162
+ values: z
1163
+ .object({ sub_account_id: uuidSchema, joined_at: dateSchema })
1164
+ .strict(),
1165
+ })
1166
+ .strict(), pnlMemberResponse);
1167
+ register('suite.pgen.rule.run', z
1168
+ .object({ rule_id: uuidSchema, business_date: dateSchema.optional() })
1169
+ .strict(), generatorRunResponse);
1170
+ export function getExtendedOperationContract(capabilityId) {
1171
+ const contract = contracts.get(capabilityId);
1172
+ if (contract === undefined) {
1173
+ throw new Error(`Missing extended capability contract: ${capabilityId}`);
1174
+ }
1175
+ return contract;
1176
+ }
1177
+ export function extendedOperationContractIds() {
1178
+ return [...contracts.keys()].sort();
1179
+ }
1180
+ //# sourceMappingURL=extended-operation-contracts.js.map