@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.
- package/README.md +220 -0
- package/dist/app/create-server.d.ts +18 -0
- package/dist/app/create-server.js +80 -0
- package/dist/app/create-server.js.map +1 -0
- package/dist/app/register-tools.d.ts +4 -0
- package/dist/app/register-tools.js +18 -0
- package/dist/app/register-tools.js.map +1 -0
- package/dist/audit/audit-context.d.ts +38 -0
- package/dist/audit/audit-context.js +167 -0
- package/dist/audit/audit-context.js.map +1 -0
- package/dist/audit/audit-sink.d.ts +20 -0
- package/dist/audit/audit-sink.js +6 -0
- package/dist/audit/audit-sink.js.map +1 -0
- package/dist/audit/file-audit-sink.d.ts +6 -0
- package/dist/audit/file-audit-sink.js +18 -0
- package/dist/audit/file-audit-sink.js.map +1 -0
- package/dist/auth/auth-session.d.ts +63 -0
- package/dist/auth/auth-session.js +226 -0
- package/dist/auth/auth-session.js.map +1 -0
- package/dist/auth/credentials.d.ts +6 -0
- package/dist/auth/credentials.js +12 -0
- package/dist/auth/credentials.js.map +1 -0
- package/dist/auth/org-token-provider.d.ts +15 -0
- package/dist/auth/org-token-provider.js +62 -0
- package/dist/auth/org-token-provider.js.map +1 -0
- package/dist/capabilities/capability.d.ts +100 -0
- package/dist/capabilities/capability.js +26 -0
- package/dist/capabilities/capability.js.map +1 -0
- package/dist/capabilities/create-capabilities.d.ts +2 -0
- package/dist/capabilities/create-capabilities.js +37 -0
- package/dist/capabilities/create-capabilities.js.map +1 -0
- package/dist/capabilities/define-capability.d.ts +39 -0
- package/dist/capabilities/define-capability.js +64 -0
- package/dist/capabilities/define-capability.js.map +1 -0
- package/dist/capabilities/definitions/accounting-balances.d.ts +4 -0
- package/dist/capabilities/definitions/accounting-balances.js +98 -0
- package/dist/capabilities/definitions/accounting-balances.js.map +1 -0
- package/dist/capabilities/definitions/accounting-context.d.ts +2 -0
- package/dist/capabilities/definitions/accounting-context.js +17 -0
- package/dist/capabilities/definitions/accounting-context.js.map +1 -0
- package/dist/capabilities/definitions/assets.d.ts +2 -0
- package/dist/capabilities/definitions/assets.js +367 -0
- package/dist/capabilities/definitions/assets.js.map +1 -0
- package/dist/capabilities/definitions/business-documents.d.ts +9 -0
- package/dist/capabilities/definitions/business-documents.js +386 -0
- package/dist/capabilities/definitions/business-documents.js.map +1 -0
- package/dist/capabilities/definitions/dashboard.d.ts +2 -0
- package/dist/capabilities/definitions/dashboard.js +153 -0
- package/dist/capabilities/definitions/dashboard.js.map +1 -0
- package/dist/capabilities/definitions/extended-operation-contracts.d.ts +597 -0
- package/dist/capabilities/definitions/extended-operation-contracts.js +1180 -0
- package/dist/capabilities/definitions/extended-operation-contracts.js.map +1 -0
- package/dist/capabilities/definitions/extended-operations.d.ts +2 -0
- package/dist/capabilities/definitions/extended-operations.js +699 -0
- package/dist/capabilities/definitions/extended-operations.js.map +1 -0
- package/dist/capabilities/definitions/financial-reports.d.ts +2 -0
- package/dist/capabilities/definitions/financial-reports.js +100 -0
- package/dist/capabilities/definitions/financial-reports.js.map +1 -0
- package/dist/capabilities/definitions/fnd-import.d.ts +34 -0
- package/dist/capabilities/definitions/fnd-import.js +282 -0
- package/dist/capabilities/definitions/fnd-import.js.map +1 -0
- package/dist/capabilities/definitions/fund-accounts.d.ts +2 -0
- package/dist/capabilities/definitions/fund-accounts.js +188 -0
- package/dist/capabilities/definitions/fund-accounts.js.map +1 -0
- package/dist/capabilities/definitions/fund-balances.d.ts +2 -0
- package/dist/capabilities/definitions/fund-balances.js +84 -0
- package/dist/capabilities/definitions/fund-balances.js.map +1 -0
- package/dist/capabilities/definitions/journals.d.ts +10 -0
- package/dist/capabilities/definitions/journals.js +224 -0
- package/dist/capabilities/definitions/journals.js.map +1 -0
- package/dist/capabilities/definitions/master-data.d.ts +2 -0
- package/dist/capabilities/definitions/master-data.js +451 -0
- package/dist/capabilities/definitions/master-data.js.map +1 -0
- package/dist/capabilities/definitions/pnl.d.ts +2 -0
- package/dist/capabilities/definitions/pnl.js +139 -0
- package/dist/capabilities/definitions/pnl.js.map +1 -0
- package/dist/capabilities/definitions/reference-data.d.ts +2 -0
- package/dist/capabilities/definitions/reference-data.js +169 -0
- package/dist/capabilities/definitions/reference-data.js.map +1 -0
- package/dist/capabilities/definitions/transaction-drafts.d.ts +2 -0
- package/dist/capabilities/definitions/transaction-drafts.js +157 -0
- package/dist/capabilities/definitions/transaction-drafts.js.map +1 -0
- package/dist/capabilities/definitions/transactions.d.ts +168 -0
- package/dist/capabilities/definitions/transactions.js +79 -0
- package/dist/capabilities/definitions/transactions.js.map +1 -0
- package/dist/capabilities/executor.d.ts +19 -0
- package/dist/capabilities/executor.js +134 -0
- package/dist/capabilities/executor.js.map +1 -0
- package/dist/capabilities/registry.d.ts +7 -0
- package/dist/capabilities/registry.js +51 -0
- package/dist/capabilities/registry.js.map +1 -0
- package/dist/clients/base-client.d.ts +5 -0
- package/dist/clients/base-client.js +13 -0
- package/dist/clients/base-client.js.map +1 -0
- package/dist/clients/http-client.d.ts +29 -0
- package/dist/clients/http-client.js +167 -0
- package/dist/clients/http-client.js.map +1 -0
- package/dist/clients/suite-client.d.ts +5 -0
- package/dist/clients/suite-client.js +5 -0
- package/dist/clients/suite-client.js.map +1 -0
- package/dist/concurrency/lock-manager.d.ts +4 -0
- package/dist/concurrency/lock-manager.js +23 -0
- package/dist/concurrency/lock-manager.js.map +1 -0
- package/dist/config/load-config.d.ts +2 -0
- package/dist/config/load-config.js +18 -0
- package/dist/config/load-config.js.map +1 -0
- package/dist/config/schema.d.ts +24 -0
- package/dist/config/schema.js +85 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/errors/fintax-error.d.ts +24 -0
- package/dist/errors/fintax-error.js +21 -0
- package/dist/errors/fintax-error.js.map +1 -0
- package/dist/errors/normalize-error.d.ts +3 -0
- package/dist/errors/normalize-error.js +67 -0
- package/dist/errors/normalize-error.js.map +1 -0
- package/dist/files/artifact-store.d.ts +17 -0
- package/dist/files/artifact-store.js +74 -0
- package/dist/files/artifact-store.js.map +1 -0
- package/dist/files/input-policy.d.ts +28 -0
- package/dist/files/input-policy.js +109 -0
- package/dist/files/input-policy.js.map +1 -0
- package/dist/files/roots-provider.d.ts +14 -0
- package/dist/files/roots-provider.js +47 -0
- package/dist/files/roots-provider.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/logger.d.ts +3 -0
- package/dist/logging/logger.js +13 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/policies/idempotency.d.ts +32 -0
- package/dist/policies/idempotency.js +155 -0
- package/dist/policies/idempotency.js.map +1 -0
- package/dist/policies/job-reference.d.ts +16 -0
- package/dist/policies/job-reference.js +62 -0
- package/dist/policies/job-reference.js.map +1 -0
- package/dist/policies/operation-plan.d.ts +27 -0
- package/dist/policies/operation-plan.js +99 -0
- package/dist/policies/operation-plan.js.map +1 -0
- package/dist/policies/redaction.d.ts +2 -0
- package/dist/policies/redaction.js +29 -0
- package/dist/policies/redaction.js.map +1 -0
- package/dist/policies/retry.d.ts +8 -0
- package/dist/policies/retry.js +19 -0
- package/dist/policies/retry.js.map +1 -0
- package/dist/responses/tool-response.d.ts +4 -0
- package/dist/responses/tool-response.js +24 -0
- package/dist/responses/tool-response.js.map +1 -0
- package/dist/schemas/common.d.ts +226 -0
- package/dist/schemas/common.js +133 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/domains/accounting-balances.d.ts +497 -0
- package/dist/schemas/domains/accounting-balances.js +226 -0
- package/dist/schemas/domains/accounting-balances.js.map +1 -0
- package/dist/schemas/domains/accounting-context.d.ts +118 -0
- package/dist/schemas/domains/accounting-context.js +54 -0
- package/dist/schemas/domains/accounting-context.js.map +1 -0
- package/dist/schemas/domains/assets.d.ts +2508 -0
- package/dist/schemas/domains/assets.js +960 -0
- package/dist/schemas/domains/assets.js.map +1 -0
- package/dist/schemas/domains/business-documents.d.ts +4406 -0
- package/dist/schemas/domains/business-documents.js +1153 -0
- package/dist/schemas/domains/business-documents.js.map +1 -0
- package/dist/schemas/domains/configuration.d.ts +518 -0
- package/dist/schemas/domains/configuration.js +504 -0
- package/dist/schemas/domains/configuration.js.map +1 -0
- package/dist/schemas/domains/dashboard.d.ts +339 -0
- package/dist/schemas/domains/dashboard.js +211 -0
- package/dist/schemas/domains/dashboard.js.map +1 -0
- package/dist/schemas/domains/extended-operation-results.d.ts +1588 -0
- package/dist/schemas/domains/extended-operation-results.js +275 -0
- package/dist/schemas/domains/extended-operation-results.js.map +1 -0
- package/dist/schemas/domains/extended-operations.d.ts +1061 -0
- package/dist/schemas/domains/extended-operations.js +567 -0
- package/dist/schemas/domains/extended-operations.js.map +1 -0
- package/dist/schemas/domains/extended-query-results.d.ts +1688 -0
- package/dist/schemas/domains/extended-query-results.js +337 -0
- package/dist/schemas/domains/extended-query-results.js.map +1 -0
- package/dist/schemas/domains/financial-reports.d.ts +540 -0
- package/dist/schemas/domains/financial-reports.js +206 -0
- package/dist/schemas/domains/financial-reports.js.map +1 -0
- package/dist/schemas/domains/fnd-import.d.ts +912 -0
- package/dist/schemas/domains/fnd-import.js +396 -0
- package/dist/schemas/domains/fnd-import.js.map +1 -0
- package/dist/schemas/domains/fund-accounts.d.ts +1092 -0
- package/dist/schemas/domains/fund-accounts.js +410 -0
- package/dist/schemas/domains/fund-accounts.js.map +1 -0
- package/dist/schemas/domains/fund-balances.d.ts +476 -0
- package/dist/schemas/domains/fund-balances.js +233 -0
- package/dist/schemas/domains/fund-balances.js.map +1 -0
- package/dist/schemas/domains/journals.d.ts +1619 -0
- package/dist/schemas/domains/journals.js +615 -0
- package/dist/schemas/domains/journals.js.map +1 -0
- package/dist/schemas/domains/master-data.d.ts +2010 -0
- package/dist/schemas/domains/master-data.js +799 -0
- package/dist/schemas/domains/master-data.js.map +1 -0
- package/dist/schemas/domains/pnl.d.ts +837 -0
- package/dist/schemas/domains/pnl.js +469 -0
- package/dist/schemas/domains/pnl.js.map +1 -0
- package/dist/schemas/domains/reference-data.d.ts +227 -0
- package/dist/schemas/domains/reference-data.js +144 -0
- package/dist/schemas/domains/reference-data.js.map +1 -0
- package/dist/schemas/domains/transaction-drafts.d.ts +903 -0
- package/dist/schemas/domains/transaction-drafts.js +242 -0
- package/dist/schemas/domains/transaction-drafts.js.map +1 -0
- package/dist/schemas/domains/transactions.d.ts +910 -0
- package/dist/schemas/domains/transactions.js +266 -0
- package/dist/schemas/domains/transactions.js.map +1 -0
- package/dist/schemas/primitives.d.ts +6 -0
- package/dist/schemas/primitives.js +11 -0
- package/dist/schemas/primitives.js.map +1 -0
- package/dist/schemas/public-input.d.ts +3 -0
- package/dist/schemas/public-input.js +524 -0
- package/dist/schemas/public-input.js.map +1 -0
- package/dist/tools/core-edit/idempotent-write.d.ts +23 -0
- package/dist/tools/core-edit/idempotent-write.js +58 -0
- package/dist/tools/core-edit/idempotent-write.js.map +1 -0
- package/dist/tools/core-edit/save-asset.d.ts +5 -0
- package/dist/tools/core-edit/save-asset.js +334 -0
- package/dist/tools/core-edit/save-asset.js.map +1 -0
- package/dist/tools/core-edit/save-business-document-draft.d.ts +2 -0
- package/dist/tools/core-edit/save-business-document-draft.js +128 -0
- package/dist/tools/core-edit/save-business-document-draft.js.map +1 -0
- package/dist/tools/core-edit/save-fund-account.d.ts +2 -0
- package/dist/tools/core-edit/save-fund-account.js +138 -0
- package/dist/tools/core-edit/save-fund-account.js.map +1 -0
- package/dist/tools/core-edit/save-journal-draft.d.ts +2 -0
- package/dist/tools/core-edit/save-journal-draft.js +122 -0
- package/dist/tools/core-edit/save-journal-draft.js.map +1 -0
- package/dist/tools/core-edit/save-master-data.d.ts +2 -0
- package/dist/tools/core-edit/save-master-data.js +153 -0
- package/dist/tools/core-edit/save-master-data.js.map +1 -0
- package/dist/tools/core-edit/save-transaction-draft.d.ts +2 -0
- package/dist/tools/core-edit/save-transaction-draft.js +128 -0
- package/dist/tools/core-edit/save-transaction-draft.js.map +1 -0
- package/dist/tools/core-read/export-business-documents.d.ts +2 -0
- package/dist/tools/core-read/export-business-documents.js +67 -0
- package/dist/tools/core-read/export-business-documents.js.map +1 -0
- package/dist/tools/core-read/export-journals.d.ts +2 -0
- package/dist/tools/core-read/export-journals.js +56 -0
- package/dist/tools/core-read/export-journals.js.map +1 -0
- package/dist/tools/core-read/export-transactions.d.ts +2 -0
- package/dist/tools/core-read/export-transactions.js +67 -0
- package/dist/tools/core-read/export-transactions.js.map +1 -0
- package/dist/tools/core-read/query-accounting-balances.d.ts +2 -0
- package/dist/tools/core-read/query-accounting-balances.js +135 -0
- package/dist/tools/core-read/query-accounting-balances.js.map +1 -0
- package/dist/tools/core-read/query-accounting-context.d.ts +2 -0
- package/dist/tools/core-read/query-accounting-context.js +76 -0
- package/dist/tools/core-read/query-accounting-context.js.map +1 -0
- package/dist/tools/core-read/query-assets.d.ts +2 -0
- package/dist/tools/core-read/query-assets.js +425 -0
- package/dist/tools/core-read/query-assets.js.map +1 -0
- package/dist/tools/core-read/query-business-documents.d.ts +9 -0
- package/dist/tools/core-read/query-business-documents.js +620 -0
- package/dist/tools/core-read/query-business-documents.js.map +1 -0
- package/dist/tools/core-read/query-dashboard.d.ts +2 -0
- package/dist/tools/core-read/query-dashboard.js +144 -0
- package/dist/tools/core-read/query-dashboard.js.map +1 -0
- package/dist/tools/core-read/query-financial-reports.d.ts +2 -0
- package/dist/tools/core-read/query-financial-reports.js +171 -0
- package/dist/tools/core-read/query-financial-reports.js.map +1 -0
- package/dist/tools/core-read/query-fund-accounts.d.ts +2 -0
- package/dist/tools/core-read/query-fund-accounts.js +140 -0
- package/dist/tools/core-read/query-fund-accounts.js.map +1 -0
- package/dist/tools/core-read/query-fund-balances.d.ts +2 -0
- package/dist/tools/core-read/query-fund-balances.js +150 -0
- package/dist/tools/core-read/query-fund-balances.js.map +1 -0
- package/dist/tools/core-read/query-journals.d.ts +2 -0
- package/dist/tools/core-read/query-journals.js +277 -0
- package/dist/tools/core-read/query-journals.js.map +1 -0
- package/dist/tools/core-read/query-master-data.d.ts +2 -0
- package/dist/tools/core-read/query-master-data.js +363 -0
- package/dist/tools/core-read/query-master-data.js.map +1 -0
- package/dist/tools/core-read/query-pnl.d.ts +2 -0
- package/dist/tools/core-read/query-pnl.js +244 -0
- package/dist/tools/core-read/query-pnl.js.map +1 -0
- package/dist/tools/core-read/query-reference-data.d.ts +2 -0
- package/dist/tools/core-read/query-reference-data.js +293 -0
- package/dist/tools/core-read/query-reference-data.js.map +1 -0
- package/dist/tools/core-read/query-transactions.d.ts +2 -0
- package/dist/tools/core-read/query-transactions.js +58 -0
- package/dist/tools/core-read/query-transactions.js.map +1 -0
- package/dist/tools/create-tools.d.ts +3 -0
- package/dist/tools/create-tools.js +88 -0
- package/dist/tools/create-tools.js.map +1 -0
- package/dist/tools/extended/asset-operation-tools.d.ts +9 -0
- package/dist/tools/extended/asset-operation-tools.js +419 -0
- package/dist/tools/extended/asset-operation-tools.js.map +1 -0
- package/dist/tools/extended/automation-tools.d.ts +7 -0
- package/dist/tools/extended/automation-tools.js +333 -0
- package/dist/tools/extended/automation-tools.js.map +1 -0
- package/dist/tools/extended/configuration-tools.d.ts +14 -0
- package/dist/tools/extended/configuration-tools.js +871 -0
- package/dist/tools/extended/configuration-tools.js.map +1 -0
- package/dist/tools/extended/period-end-tools.d.ts +11 -0
- package/dist/tools/extended/period-end-tools.js +480 -0
- package/dist/tools/extended/period-end-tools.js.map +1 -0
- package/dist/tools/extended/query-output.d.ts +2589 -0
- package/dist/tools/extended/query-output.js +610 -0
- package/dist/tools/extended/query-output.js.map +1 -0
- package/dist/tools/extended/tool-support.d.ts +56 -0
- package/dist/tools/extended/tool-support.js +198 -0
- package/dist/tools/extended/tool-support.js.map +1 -0
- package/dist/tools/extended/workflow-tools.d.ts +10 -0
- package/dist/tools/extended/workflow-tools.js +678 -0
- package/dist/tools/extended/workflow-tools.js.map +1 -0
- package/dist/tools/fnd-import/execute-import.d.ts +2 -0
- package/dist/tools/fnd-import/execute-import.js +201 -0
- package/dist/tools/fnd-import/execute-import.js.map +1 -0
- package/dist/tools/fnd-import/get-import-template.d.ts +2 -0
- package/dist/tools/fnd-import/get-import-template.js +66 -0
- package/dist/tools/fnd-import/get-import-template.js.map +1 -0
- package/dist/tools/fnd-import/get-job-status.d.ts +8 -0
- package/dist/tools/fnd-import/get-job-status.js +201 -0
- package/dist/tools/fnd-import/get-job-status.js.map +1 -0
- package/dist/tools/fnd-import/prepare-import.d.ts +31 -0
- package/dist/tools/fnd-import/prepare-import.js +214 -0
- package/dist/tools/fnd-import/prepare-import.js.map +1 -0
- package/dist/tools/fnd-import/public-import-result.d.ts +18 -0
- package/dist/tools/fnd-import/public-import-result.js +35 -0
- package/dist/tools/fnd-import/public-import-result.js.map +1 -0
- package/dist/tools/tool-definition.d.ts +45 -0
- package/dist/tools/tool-definition.js +11 -0
- package/dist/tools/tool-definition.js.map +1 -0
- package/dist/tools/tool-handler.d.ts +27 -0
- package/dist/tools/tool-handler.js +196 -0
- package/dist/tools/tool-handler.js.map +1 -0
- package/dist/tools/transaction-item.d.ts +225 -0
- package/dist/tools/transaction-item.js +109 -0
- package/dist/tools/transaction-item.js.map +1 -0
- package/dist/transport/draining-transport.d.ts +14 -0
- package/dist/transport/draining-transport.js +36 -0
- package/dist/transport/draining-transport.js.map +1 -0
- package/dist/transport/stdio.d.ts +2 -0
- package/dist/transport/stdio.js +5 -0
- package/dist/transport/stdio.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-transactions.js","sourceRoot":"","sources":["../../../src/tools/core-read/export-transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,+BAA+B,EAAE,MAAM,gDAAgD,CAAC;AACjG,OAAO,EAAE,uBAAuB,EAAE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,EAAE,IAAI;YACR,IAAI,EAAE;gBACJ,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;gBACxC,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,QAAQ,EAAE;oBACR,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,UAAU,EAAE;oBAC1D,SAAS,EAAE,QAAQ,CAAC,QAAQ;oBAC5B,UAAU,EAAE,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC;oBACrC,UAAU,EAAE,QAAQ,CAAC,IAAI;oBACzB,MAAM,EAAE,QAAQ,CAAC,MAAM;oBACvB,UAAU,EAAE,QAAQ,CAAC,SAAS;iBAC/B;aACF;YACD,QAAQ,EAAE,EAAE;YACZ,QAAQ,EAAE,OAAO,CAAC,OAAO;YACzB,WAAW,EAAE;gBACX;oBACE,OAAO,EAAE,OAAO;oBAChB,SAAS,EAAE,OAAO,KAAK,CAAC,gBAAgB,SAAS;iBAClD;gBACD,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE;aACjD;SACF,CAAC;IACJ,CAAC;IACD,SAAS,CAAC,MAAM;QACd,MAAM,MAAM,GAAG,8BAA8B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5D,OAAO,aAAa,MAAM,CAAC,IAAI,CAAC,gBAAgB,uBAAuB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,CAAC;IAC3G,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { accountingBalanceDynamicUpstreamSchema, accountingBalanceTreeUpstreamSchema, queryAccountingBalancesInputSchema, queryAccountingBalancesOutputSchema, } from '../../schemas/domains/accounting-balances.js';
|
|
2
|
+
import { createPublicInputSchema } from '../../schemas/public-input.js';
|
|
3
|
+
function treeNode(item) {
|
|
4
|
+
return {
|
|
5
|
+
coa_code: item.coa_code,
|
|
6
|
+
coa_name: item.coa_name,
|
|
7
|
+
node_type: item.node_type,
|
|
8
|
+
base_currency: item.base_currency,
|
|
9
|
+
base_opening: item.base_opening,
|
|
10
|
+
base_debit: item.base_debit,
|
|
11
|
+
base_credit: item.base_credit,
|
|
12
|
+
base_ending: item.base_ending,
|
|
13
|
+
origin_currency: item.origin_currency,
|
|
14
|
+
origin_opening: item.origin_opening,
|
|
15
|
+
origin_debit: item.origin_debit,
|
|
16
|
+
origin_credit: item.origin_credit,
|
|
17
|
+
origin_ending: item.origin_ending,
|
|
18
|
+
reconcile: item.reconcile,
|
|
19
|
+
children: item.children.map(treeNode),
|
|
20
|
+
self_leaf: item.self_leaf === null ? null : treeNode(item.self_leaf),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function totals(item) {
|
|
24
|
+
return {
|
|
25
|
+
base_currency: item.base_currency,
|
|
26
|
+
base_opening: item.base_opening,
|
|
27
|
+
base_debit: item.base_debit,
|
|
28
|
+
base_credit: item.base_credit,
|
|
29
|
+
base_ending: item.base_ending,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function warnings(requestedBalanceType, effectiveBalanceType, recalculateRequired) {
|
|
33
|
+
const values = [];
|
|
34
|
+
if (requestedBalanceType !== effectiveBalanceType) {
|
|
35
|
+
values.push(`The requested balance type ${requestedBalanceType} was adjusted to the effective type ${effectiveBalanceType}.`);
|
|
36
|
+
}
|
|
37
|
+
if (recalculateRequired) {
|
|
38
|
+
values.push('Accounting balances require recalculation; the current result may not be up to date.');
|
|
39
|
+
}
|
|
40
|
+
return values;
|
|
41
|
+
}
|
|
42
|
+
export const queryAccountingBalancesTool = {
|
|
43
|
+
name: 'query_accounting_balances',
|
|
44
|
+
title: 'Query FinTax Accounting Balances',
|
|
45
|
+
description: 'Query a hierarchical trial balance or dynamic balances expanded by auxiliary dimensions without modifying data. Use trial_balance for the account tree and trial totals, and dynamic_balance to change aggregation granularity using enabled auxiliary dimensions. Use query_journals for journal details. Results are not paginated, amounts remain decimal strings, and the effective balance type is returned.',
|
|
46
|
+
risk: 'R0',
|
|
47
|
+
exposurePack: 'core-read',
|
|
48
|
+
capabilityIds: ['suite.acct.balance.tree', 'suite.acct.dynamic_balance.list'],
|
|
49
|
+
fileAccess: 'none',
|
|
50
|
+
publicInputSchema: createPublicInputSchema(queryAccountingBalancesInputSchema),
|
|
51
|
+
inputSchema: queryAccountingBalancesInputSchema,
|
|
52
|
+
outputSchema: queryAccountingBalancesOutputSchema,
|
|
53
|
+
annotations: {
|
|
54
|
+
readOnlyHint: true,
|
|
55
|
+
destructiveHint: false,
|
|
56
|
+
idempotentHint: true,
|
|
57
|
+
openWorldHint: false,
|
|
58
|
+
},
|
|
59
|
+
async execute(rawInput, context) {
|
|
60
|
+
const input = queryAccountingBalancesInputSchema.parse(rawInput);
|
|
61
|
+
const request = {
|
|
62
|
+
period_from: input.period_from,
|
|
63
|
+
period_to: input.period_to,
|
|
64
|
+
ledger_id: input.ledger_id,
|
|
65
|
+
balance_type: input.balance_type,
|
|
66
|
+
coa_code: input.coa_code,
|
|
67
|
+
base_currency: input.base_currency,
|
|
68
|
+
account_name: input.account_name,
|
|
69
|
+
};
|
|
70
|
+
if (input.view === 'trial_balance') {
|
|
71
|
+
const upstream = accountingBalanceTreeUpstreamSchema.parse(await context.callCapability('suite.acct.balance.tree', request));
|
|
72
|
+
return {
|
|
73
|
+
ok: true,
|
|
74
|
+
data: {
|
|
75
|
+
view: input.view,
|
|
76
|
+
balance_type: upstream.balance_type,
|
|
77
|
+
recalculate_required: upstream.recalculate_required,
|
|
78
|
+
tree: upstream.tree.map(treeNode),
|
|
79
|
+
totals: totals(upstream.totals),
|
|
80
|
+
},
|
|
81
|
+
warnings: warnings(input.balance_type, upstream.balance_type, upstream.recalculate_required),
|
|
82
|
+
trace_id: context.traceId,
|
|
83
|
+
source_refs: [{ service: 'suite', operation: 'acct.balance.tree' }],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const upstream = accountingBalanceDynamicUpstreamSchema.parse(await context.callCapability('suite.acct.dynamic_balance.list', {
|
|
87
|
+
...request,
|
|
88
|
+
dimensions: input.dimensions,
|
|
89
|
+
}));
|
|
90
|
+
return {
|
|
91
|
+
ok: true,
|
|
92
|
+
data: {
|
|
93
|
+
view: input.view,
|
|
94
|
+
balance_type: upstream.balance_type,
|
|
95
|
+
recalculate_required: upstream.recalculate_required,
|
|
96
|
+
applied_dimensions: upstream.applied_dimensions.map((item) => ({
|
|
97
|
+
name: item.name,
|
|
98
|
+
label: item.label,
|
|
99
|
+
})),
|
|
100
|
+
items: upstream.items.map((item) => ({
|
|
101
|
+
coa_code: item.coa_code,
|
|
102
|
+
coa_name: item.coa_name,
|
|
103
|
+
dimensions: item.dimensions.map((dimension) => ({
|
|
104
|
+
name: dimension.name,
|
|
105
|
+
value: dimension.value,
|
|
106
|
+
})),
|
|
107
|
+
base_currency: item.base_currency,
|
|
108
|
+
base_opening: item.base_opening,
|
|
109
|
+
base_debit: item.base_debit,
|
|
110
|
+
base_credit: item.base_credit,
|
|
111
|
+
base_ending: item.base_ending,
|
|
112
|
+
origin_currency: item.origin_currency,
|
|
113
|
+
origin_opening: item.origin_opening,
|
|
114
|
+
origin_debit: item.origin_debit,
|
|
115
|
+
origin_credit: item.origin_credit,
|
|
116
|
+
origin_ending: item.origin_ending,
|
|
117
|
+
})),
|
|
118
|
+
totals: totals(upstream.totals),
|
|
119
|
+
},
|
|
120
|
+
warnings: warnings(input.balance_type, upstream.balance_type, upstream.recalculate_required),
|
|
121
|
+
trace_id: context.traceId,
|
|
122
|
+
source_refs: [
|
|
123
|
+
{ service: 'suite', operation: 'acct.dynamic_balance.list' },
|
|
124
|
+
],
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
summarize(output) {
|
|
128
|
+
const parsed = queryAccountingBalancesOutputSchema.parse(output);
|
|
129
|
+
const count = parsed.data.view === 'trial_balance'
|
|
130
|
+
? parsed.data.tree.length
|
|
131
|
+
: parsed.data.items.length;
|
|
132
|
+
return `Returned ${count} top-level results for ${parsed.data.view}.`;
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=query-accounting-balances.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-accounting-balances.js","sourceRoot":"","sources":["../../../src/tools/core-read/query-accounting-balances.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sCAAsC,EACtC,mCAAmC,EACnC,kCAAkC,EAClC,mCAAmC,GAGpC,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,SAAS,QAAQ,CACf,IAAuC;IAEvC,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;QACrC,SAAS,EAAE,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;KACrE,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CACb,IAAmE;IAEnE,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,YAAY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AE,SAAS,EAAE,2BAA2B,EAAE;aAC7D;SACF,CAAC;IACJ,CAAC;IACD,SAAS,CAAC,MAAM;QACd,MAAM,MAAM,GAAG,mCAAmC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACjE,MAAM,KAAK,GACT,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe;YAClC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM;YACzB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAC/B,OAAO,YAAY,KAAK,0BAA0B,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;IACxE,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { FinTaxError } from '../../errors/fintax-error.js';
|
|
2
|
+
import { accountingContextLedgerUpstreamSchema, queryAccountingContextInputSchema, queryAccountingContextOutputSchema, } from '../../schemas/domains/accounting-context.js';
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
|
+
function optionalString(organization, snakeCase, camelCase) {
|
|
5
|
+
const raw = organization;
|
|
6
|
+
const value = raw[snakeCase] ?? raw[camelCase];
|
|
7
|
+
return typeof value === 'string' ? value : null;
|
|
8
|
+
}
|
|
9
|
+
function optionalBoolean(organization, snakeCase, camelCase) {
|
|
10
|
+
const raw = organization;
|
|
11
|
+
const value = raw[snakeCase] ?? raw[camelCase];
|
|
12
|
+
return typeof value === 'boolean' ? value : null;
|
|
13
|
+
}
|
|
14
|
+
export const queryAccountingContextTool = {
|
|
15
|
+
name: 'query_accounting_context',
|
|
16
|
+
title: 'Query FinTax Organization and Ledger Context',
|
|
17
|
+
description: 'Discover the organizations accessible to the current user and the active ledgers available to the selected organization without modifying data. Call this Tool before balance, report, or export Tools that require org_id or ledger_id. It queries the current login organization by default; to inspect another organization, call it again with an organization ID returned here in context.org_id. It never returns roles, permissions, tokens, or cookies.',
|
|
18
|
+
risk: 'R0',
|
|
19
|
+
exposurePack: 'core-read',
|
|
20
|
+
capabilityIds: ['suite.acct.coa.accessible_ledgers'],
|
|
21
|
+
fileAccess: 'none',
|
|
22
|
+
inputSchema: queryAccountingContextInputSchema,
|
|
23
|
+
outputSchema: queryAccountingContextOutputSchema,
|
|
24
|
+
annotations: {
|
|
25
|
+
readOnlyHint: true,
|
|
26
|
+
destructiveHint: false,
|
|
27
|
+
idempotentHint: true,
|
|
28
|
+
openWorldHint: false,
|
|
29
|
+
},
|
|
30
|
+
async execute(rawInput, context) {
|
|
31
|
+
queryAccountingContextInputSchema.parse(rawInput);
|
|
32
|
+
const identity = await context.getIdentity();
|
|
33
|
+
if (identity.orgId === undefined) {
|
|
34
|
+
throw new FinTaxError('VALIDATION_FAILED', 'The current login session has no available organization context');
|
|
35
|
+
}
|
|
36
|
+
const selectedOrgId = identity.orgId;
|
|
37
|
+
const ledgers = z
|
|
38
|
+
.array(accountingContextLedgerUpstreamSchema)
|
|
39
|
+
.parse(await context.callCapability('suite.acct.coa.accessible_ledgers', {}));
|
|
40
|
+
return {
|
|
41
|
+
ok: true,
|
|
42
|
+
data: {
|
|
43
|
+
selected_org_id: selectedOrgId,
|
|
44
|
+
organizations: identity.orgs.map((organization) => ({
|
|
45
|
+
id: organization.id,
|
|
46
|
+
name: organization.name ?? null,
|
|
47
|
+
timezone_id: optionalString(organization, 'timezone_id', 'timezoneId'),
|
|
48
|
+
parent_id: optionalString(organization, 'parent_id', 'parentId'),
|
|
49
|
+
is_booking_node: optionalBoolean(organization, 'is_booking_node', 'isBookingNode'),
|
|
50
|
+
is_selected: organization.id === selectedOrgId,
|
|
51
|
+
})),
|
|
52
|
+
ledgers: ledgers.map((ledger) => ({
|
|
53
|
+
id: ledger.id,
|
|
54
|
+
org_id: selectedOrgId,
|
|
55
|
+
ledger_code: ledger.ledger_code,
|
|
56
|
+
ledger_name: ledger.ledger_name,
|
|
57
|
+
ledger_type: ledger.ledger_type,
|
|
58
|
+
base_currency: ledger.base_currency,
|
|
59
|
+
})),
|
|
60
|
+
},
|
|
61
|
+
warnings: ledgers.length === 0
|
|
62
|
+
? ['The current organization has no active ledgers.']
|
|
63
|
+
: [],
|
|
64
|
+
trace_id: context.traceId,
|
|
65
|
+
source_refs: [
|
|
66
|
+
{ service: 'base', operation: 'auth.me' },
|
|
67
|
+
{ service: 'suite', operation: 'acct.coa.accessible_ledgers' },
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
summarize(output) {
|
|
72
|
+
const parsed = queryAccountingContextOutputSchema.parse(output);
|
|
73
|
+
return `The current organization has ${parsed.data.ledgers.length} available ledgers; the current identity can access ${parsed.data.organizations.length} organizations.`;
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=query-accounting-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-accounting-context.js","sourceRoot":"","sources":["../../../src/tools/core-read/query-accounting-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EACL,qCAAqC,EACrC,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAI3B,SAAS,cAAc,CACrB,YAAkC,EAClC,SAAiB,EACjB,SAAiB;IAEjB,MAAM,GAAG,GAAG,YAAuC,CAAC;IACpD,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC;AAED,SAAS,eAAe,CACtB,YAAkC,EAClC,SAAiB,EACjB,SAAiB;IAEjB,MAAM,GAAG,GAAG,YAAuC,CAAC;IACpD,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,GAAG,C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+
import { assetAllocationLinesUpstreamSchema, assetCardUpstreamSchema, assetDepreciationDetailsUpstreamSchema, assetFinanceListUpstreamSchema, assetFinanceUpstreamSchema, assetMovementListUpstreamSchema, assetSourceLinesUpstreamSchema, assetWorkbenchListUpstreamSchema, queryAssetsInputSchema, queryAssetsOutputSchema, } from '../../schemas/domains/assets.js';
|
|
2
|
+
import { createPublicInputSchema } from '../../schemas/public-input.js';
|
|
3
|
+
const CAPABILITY_IDS = [
|
|
4
|
+
'suite.fa.workbench.cards.list',
|
|
5
|
+
'suite.fa.workbench.card.detail',
|
|
6
|
+
'suite.fa.workbench.finances.by_card',
|
|
7
|
+
'suite.fa.workbench.finance.detail',
|
|
8
|
+
'suite.fa.workbench.finance.source_lines',
|
|
9
|
+
'suite.fa.workbench.finance.allocation_lines',
|
|
10
|
+
'suite.fa.workbench.finance.depreciation_details',
|
|
11
|
+
'suite.fa.movement_detail.list',
|
|
12
|
+
];
|
|
13
|
+
function nullable(value) {
|
|
14
|
+
return value ?? null;
|
|
15
|
+
}
|
|
16
|
+
function auxiliary(item) {
|
|
17
|
+
return Object.fromEntries(Array.from({ length: 12 }, (_, index) => {
|
|
18
|
+
const key = `attribute${index + 1}`;
|
|
19
|
+
const value = item[key];
|
|
20
|
+
return [key, typeof value === 'string' ? value : null];
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
function workbenchRow(item) {
|
|
24
|
+
return {
|
|
25
|
+
asset_finance_id: item.asset_finance_id,
|
|
26
|
+
card_id: item.card_id,
|
|
27
|
+
asset_no: item.asset_no,
|
|
28
|
+
description: nullable(item.description),
|
|
29
|
+
tag_no: nullable(item.tag_no),
|
|
30
|
+
ledger_id: nullable(item.ledger_id),
|
|
31
|
+
ledger_name: nullable(item.ledger_name),
|
|
32
|
+
category_id: nullable(item.category_id),
|
|
33
|
+
category_name: nullable(item.category_name),
|
|
34
|
+
asset_type: nullable(item.asset_type),
|
|
35
|
+
location: nullable(item.location),
|
|
36
|
+
quantity: item.quantity,
|
|
37
|
+
original_cost: item.original_cost,
|
|
38
|
+
nbv: item.nbv,
|
|
39
|
+
accum_depr: item.accum_depr,
|
|
40
|
+
in_use: item.in_use,
|
|
41
|
+
version: nullable(item.version),
|
|
42
|
+
card_attachment_count: item.card_attachment_count,
|
|
43
|
+
finance_attachment_count: item.finance_attachment_count,
|
|
44
|
+
approval_status: nullable(item.approval_status),
|
|
45
|
+
verification_status: nullable(item.verification_status),
|
|
46
|
+
finance_approval_status: nullable(item.finance_approval_status),
|
|
47
|
+
finance_verification_status: nullable(item.finance_verification_status),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function card(item) {
|
|
51
|
+
return {
|
|
52
|
+
id: item.id,
|
|
53
|
+
asset_no: item.asset_no,
|
|
54
|
+
tag_no: nullable(item.tag_no),
|
|
55
|
+
serial_no: nullable(item.serial_no),
|
|
56
|
+
asset_type: nullable(item.asset_type),
|
|
57
|
+
category_id: nullable(item.category_id),
|
|
58
|
+
category_name: nullable(item.category_name),
|
|
59
|
+
manufacturer: nullable(item.manufacturer),
|
|
60
|
+
asset_name: nullable(item.asset_name),
|
|
61
|
+
in_use: item.in_use,
|
|
62
|
+
description: nullable(item.description),
|
|
63
|
+
asset_key_field: nullable(item.asset_key_field),
|
|
64
|
+
quantity: item.quantity,
|
|
65
|
+
unit: nullable(item.unit),
|
|
66
|
+
location: nullable(item.location),
|
|
67
|
+
version: nullable(item.version),
|
|
68
|
+
approval_status: nullable(item.approval_status),
|
|
69
|
+
verification_status: nullable(item.verification_status),
|
|
70
|
+
approved_by: nullable(item.approved_by),
|
|
71
|
+
approved_at: nullable(item.approved_at),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function finance(item) {
|
|
75
|
+
return {
|
|
76
|
+
id: item.id,
|
|
77
|
+
card_id: item.card_id,
|
|
78
|
+
category_id: nullable(item.category_id),
|
|
79
|
+
category_name: nullable(item.category_name),
|
|
80
|
+
ledger_id: nullable(item.ledger_id),
|
|
81
|
+
ledger_name: nullable(item.ledger_name),
|
|
82
|
+
remark: nullable(item.remark),
|
|
83
|
+
current_cost: item.current_cost,
|
|
84
|
+
original_cost: item.original_cost,
|
|
85
|
+
salvage_type: nullable(item.salvage_type),
|
|
86
|
+
salvage_pct: item.salvage_pct,
|
|
87
|
+
salvage_value: item.salvage_value,
|
|
88
|
+
recoverable_cost: item.recoverable_cost,
|
|
89
|
+
nbv: item.nbv,
|
|
90
|
+
ytd_depr: item.ytd_depr,
|
|
91
|
+
accum_depr: item.accum_depr,
|
|
92
|
+
accum_impair: item.accum_impair,
|
|
93
|
+
accum_retire: item.accum_retire,
|
|
94
|
+
depr_method_id: nullable(item.depr_method_id),
|
|
95
|
+
useful_life_years: nullable(item.useful_life_years),
|
|
96
|
+
months: nullable(item.months),
|
|
97
|
+
depr_flag: item.depr_flag,
|
|
98
|
+
disabled_flag: item.disabled_flag,
|
|
99
|
+
start_date: nullable(item.start_date),
|
|
100
|
+
depr_start_rule: nullable(item.depr_start_rule),
|
|
101
|
+
retire_rule: nullable(item.retire_rule),
|
|
102
|
+
amortize_adjust: nullable(item.amortize_adjust),
|
|
103
|
+
cap_limit: item.cap_limit,
|
|
104
|
+
coa_accounts: {
|
|
105
|
+
asset_cost: nullable(item.asset_cost_coa_code),
|
|
106
|
+
asset_clearing: nullable(item.asset_clearing_coa_code),
|
|
107
|
+
depreciation_expense: nullable(item.depr_expense_coa_code),
|
|
108
|
+
accumulated_depreciation: nullable(item.accum_depr_coa_code),
|
|
109
|
+
additional_expense: nullable(item.addl_expense_coa_code),
|
|
110
|
+
additional_reserve: nullable(item.addl_reserve_coa_code),
|
|
111
|
+
revaluation_reserve: nullable(item.reval_reserve_coa_code),
|
|
112
|
+
cip_cost: nullable(item.cip_cost_coa_code),
|
|
113
|
+
cip_clearing: nullable(item.cip_clearing_coa_code),
|
|
114
|
+
accumulated_impairment: nullable(item.accum_impair_coa_code),
|
|
115
|
+
unplanned_depreciation: nullable(item.unplanned_depr_coa_code),
|
|
116
|
+
writeoff: nullable(item.writeoff_coa_code),
|
|
117
|
+
},
|
|
118
|
+
version: nullable(item.version),
|
|
119
|
+
approval_status: nullable(item.approval_status),
|
|
120
|
+
verification_status: nullable(item.verification_status),
|
|
121
|
+
approved_by: nullable(item.approved_by),
|
|
122
|
+
approved_at: nullable(item.approved_at),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function sourceLine(item) {
|
|
126
|
+
return {
|
|
127
|
+
id: item.id,
|
|
128
|
+
asset_finance_id: item.asset_finance_id,
|
|
129
|
+
line_no: nullable(item.line_no),
|
|
130
|
+
invoice_no: nullable(item.invoice_no),
|
|
131
|
+
invoice_line_no: nullable(item.invoice_line_no),
|
|
132
|
+
party_id: nullable(item.party_id),
|
|
133
|
+
party_name: nullable(item.party_name),
|
|
134
|
+
party_code: nullable(item.party_code),
|
|
135
|
+
description: nullable(item.description),
|
|
136
|
+
line_amount: item.line_amount,
|
|
137
|
+
version: nullable(item.version),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function allocationLine(item) {
|
|
141
|
+
return {
|
|
142
|
+
id: item.id,
|
|
143
|
+
asset_finance_id: item.asset_finance_id,
|
|
144
|
+
line_no: nullable(item.line_no),
|
|
145
|
+
quantity: item.quantity,
|
|
146
|
+
employee_name: nullable(item.employee_name),
|
|
147
|
+
depr_expense_coa_code: nullable(item.depr_expense_coa_code),
|
|
148
|
+
attributes: auxiliary(item),
|
|
149
|
+
description: nullable(item.description),
|
|
150
|
+
reference: nullable(item.reference),
|
|
151
|
+
remark: nullable(item.remark),
|
|
152
|
+
version: nullable(item.version),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function movementEvent(item) {
|
|
156
|
+
return {
|
|
157
|
+
event_id: item.event_id,
|
|
158
|
+
event_no: item.event_no,
|
|
159
|
+
event_time: item.event_time,
|
|
160
|
+
event_type: item.event_type,
|
|
161
|
+
entry_source: item.entry_source,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function movementJournal(item) {
|
|
165
|
+
return {
|
|
166
|
+
journal_id: item.journal_id,
|
|
167
|
+
journal_number: item.journal_number,
|
|
168
|
+
period_name: item.period_name,
|
|
169
|
+
approval_status: item.approval_status,
|
|
170
|
+
ledger_id: item.ledger_id,
|
|
171
|
+
event_id: item.event_id,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function depreciationDetail(item) {
|
|
175
|
+
return {
|
|
176
|
+
id: item.id,
|
|
177
|
+
movement_type: item.movement_type,
|
|
178
|
+
amount: item.amount,
|
|
179
|
+
biz_date: nullable(item.biz_date),
|
|
180
|
+
period_name: nullable(item.period_name),
|
|
181
|
+
fiscal_year: nullable(item.fiscal_year),
|
|
182
|
+
periods_covered: nullable(item.periods_covered),
|
|
183
|
+
alloc_line_id: nullable(item.alloc_line_id),
|
|
184
|
+
quantity: item.quantity,
|
|
185
|
+
coa_code: nullable(item.coa_code),
|
|
186
|
+
attributes: auxiliary(item),
|
|
187
|
+
description: nullable(item.description),
|
|
188
|
+
reference: nullable(item.reference),
|
|
189
|
+
remark: nullable(item.remark),
|
|
190
|
+
events: item.events.map(movementEvent),
|
|
191
|
+
journals: item.journals.map(movementJournal),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function movementRow(item) {
|
|
195
|
+
return {
|
|
196
|
+
id: item.id,
|
|
197
|
+
asset_finance_id: item.asset_finance_id,
|
|
198
|
+
card_id: item.card_id,
|
|
199
|
+
alloc_line_id: item.alloc_line_id,
|
|
200
|
+
asset_no: item.asset_no,
|
|
201
|
+
asset_description: item.asset_description,
|
|
202
|
+
tag_no: item.tag_no,
|
|
203
|
+
ledger_id: item.ledger_id,
|
|
204
|
+
ledger_name: item.ledger_name,
|
|
205
|
+
currency: item.currency,
|
|
206
|
+
movement_type: item.movement_type,
|
|
207
|
+
origin_movement_type: item.origin_movement_type,
|
|
208
|
+
employee_name: item.employee_name,
|
|
209
|
+
coa_code: item.coa_code,
|
|
210
|
+
biz_date: item.biz_date,
|
|
211
|
+
period_name: item.period_name,
|
|
212
|
+
derived_period_name: item.derived_period_name,
|
|
213
|
+
fiscal_year: item.fiscal_year,
|
|
214
|
+
periods_covered: item.periods_covered,
|
|
215
|
+
quantity: item.quantity,
|
|
216
|
+
amount: item.amount,
|
|
217
|
+
is_reversed: item.is_reversed,
|
|
218
|
+
reverse_of_id: item.reverse_of_id,
|
|
219
|
+
remark: item.remark,
|
|
220
|
+
attributes: auxiliary(item.aux),
|
|
221
|
+
events: item.events.map(movementEvent),
|
|
222
|
+
journals: item.journals.map(movementJournal),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
async function financeIncludes(financeId, includes, context) {
|
|
226
|
+
const calls = includes.map(async (include) => {
|
|
227
|
+
if (include === 'source_lines') {
|
|
228
|
+
const upstream = assetSourceLinesUpstreamSchema.parse(await context.callCapability('suite.fa.workbench.finance.source_lines', { finance_id: financeId }));
|
|
229
|
+
return {
|
|
230
|
+
include,
|
|
231
|
+
value: {
|
|
232
|
+
original_cost: upstream.original_cost,
|
|
233
|
+
lines: upstream.lines.map(sourceLine),
|
|
234
|
+
},
|
|
235
|
+
operation: 'fa.workbench.finance.source_lines',
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
if (include === 'allocation_lines') {
|
|
239
|
+
const upstream = assetAllocationLinesUpstreamSchema.parse(await context.callCapability('suite.fa.workbench.finance.allocation_lines', { finance_id: financeId }));
|
|
240
|
+
return {
|
|
241
|
+
include,
|
|
242
|
+
value: {
|
|
243
|
+
total_quantity: upstream.total_quantity,
|
|
244
|
+
lines: upstream.lines.map(allocationLine),
|
|
245
|
+
},
|
|
246
|
+
operation: 'fa.workbench.finance.allocation_lines',
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
const upstream = assetDepreciationDetailsUpstreamSchema.parse(await context.callCapability('suite.fa.workbench.finance.depreciation_details', { finance_id: financeId }));
|
|
250
|
+
return {
|
|
251
|
+
include,
|
|
252
|
+
value: {
|
|
253
|
+
summary: upstream.summary === null
|
|
254
|
+
? null
|
|
255
|
+
: {
|
|
256
|
+
asset_finance_id: upstream.summary.asset_finance_id,
|
|
257
|
+
ledger_id: upstream.summary.ledger_id,
|
|
258
|
+
asset_no: upstream.summary.asset_no,
|
|
259
|
+
tag_no: upstream.summary.tag_no,
|
|
260
|
+
description: upstream.summary.description,
|
|
261
|
+
ledger_name: upstream.summary.ledger_name,
|
|
262
|
+
currency: upstream.summary.currency,
|
|
263
|
+
original_cost: upstream.summary.original_cost,
|
|
264
|
+
recoverable_cost: upstream.summary.recoverable_cost,
|
|
265
|
+
nbv: upstream.summary.nbv,
|
|
266
|
+
ytd_depr: upstream.summary.ytd_depr,
|
|
267
|
+
accum_depr: upstream.summary.accum_depr,
|
|
268
|
+
},
|
|
269
|
+
items: upstream.list.map(depreciationDetail),
|
|
270
|
+
},
|
|
271
|
+
operation: 'fa.workbench.finance.depreciation_details',
|
|
272
|
+
};
|
|
273
|
+
});
|
|
274
|
+
const results = await Promise.allSettled(calls);
|
|
275
|
+
const data = {};
|
|
276
|
+
const warnings = [];
|
|
277
|
+
const operations = [];
|
|
278
|
+
results.forEach((result, index) => {
|
|
279
|
+
const include = includes[index];
|
|
280
|
+
if (include === undefined)
|
|
281
|
+
return;
|
|
282
|
+
if (result.status === 'fulfilled') {
|
|
283
|
+
data[include] = result.value.value;
|
|
284
|
+
operations.push(result.value.operation);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
data[include] = null;
|
|
288
|
+
warnings.push(`Supporting asset financial data ${include} could not be read; the primary financial record was still returned.`);
|
|
289
|
+
});
|
|
290
|
+
return { data, warnings, operations };
|
|
291
|
+
}
|
|
292
|
+
export const queryAssetsTool = {
|
|
293
|
+
name: 'query_assets',
|
|
294
|
+
title: 'Query FinTax Fixed Assets',
|
|
295
|
+
description: 'Query the fixed-asset workspace, asset cards, ledger financial records, or saved value-movement history without modifying data. The finance view returns supporting details only when explicitly requested in include. This Tool does not calculate depreciation, impairment, or asset balances and must not be used to run depreciation, retirement, posting, or cost adjustments.',
|
|
296
|
+
risk: 'R0',
|
|
297
|
+
exposurePack: 'core-read',
|
|
298
|
+
capabilityIds: CAPABILITY_IDS,
|
|
299
|
+
fileAccess: 'none',
|
|
300
|
+
publicInputSchema: createPublicInputSchema(queryAssetsInputSchema),
|
|
301
|
+
inputSchema: queryAssetsInputSchema,
|
|
302
|
+
outputSchema: queryAssetsOutputSchema,
|
|
303
|
+
annotations: {
|
|
304
|
+
readOnlyHint: true,
|
|
305
|
+
destructiveHint: false,
|
|
306
|
+
idempotentHint: true,
|
|
307
|
+
openWorldHint: false,
|
|
308
|
+
},
|
|
309
|
+
async execute(rawInput, context) {
|
|
310
|
+
const input = queryAssetsInputSchema.parse(rawInput);
|
|
311
|
+
if (input.view === 'list') {
|
|
312
|
+
const upstream = assetWorkbenchListUpstreamSchema.parse(await context.callCapability('suite.fa.workbench.cards.list', {
|
|
313
|
+
filters: input.filters,
|
|
314
|
+
page: input.page,
|
|
315
|
+
page_size: input.page_size,
|
|
316
|
+
}));
|
|
317
|
+
const pageSize = upstream.page_size ?? upstream.pageSize ?? input.page_size;
|
|
318
|
+
return {
|
|
319
|
+
ok: true,
|
|
320
|
+
data: { view: input.view, items: upstream.list.map(workbenchRow) },
|
|
321
|
+
page: {
|
|
322
|
+
number: upstream.page,
|
|
323
|
+
size: pageSize,
|
|
324
|
+
total_items: upstream.total,
|
|
325
|
+
has_more: upstream.page * pageSize < upstream.total,
|
|
326
|
+
},
|
|
327
|
+
warnings: [],
|
|
328
|
+
trace_id: context.traceId,
|
|
329
|
+
source_refs: [
|
|
330
|
+
{ service: 'suite', operation: 'fa.workbench.cards.list' },
|
|
331
|
+
],
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
if (input.view === 'detail') {
|
|
335
|
+
const upstreamCard = assetCardUpstreamSchema.parse(await context.callCapability('suite.fa.workbench.card.detail', {
|
|
336
|
+
card_id: input.card_id,
|
|
337
|
+
}));
|
|
338
|
+
let finances = null;
|
|
339
|
+
const warnings = [];
|
|
340
|
+
const sourceRefs = [
|
|
341
|
+
{ service: 'suite', operation: 'fa.workbench.card.detail' },
|
|
342
|
+
];
|
|
343
|
+
try {
|
|
344
|
+
const upstreamFinances = assetFinanceListUpstreamSchema.parse(await context.callCapability('suite.fa.workbench.finances.by_card', {
|
|
345
|
+
card_id: input.card_id,
|
|
346
|
+
}));
|
|
347
|
+
finances = upstreamFinances.list.map(finance);
|
|
348
|
+
sourceRefs.push({
|
|
349
|
+
service: 'suite',
|
|
350
|
+
operation: 'fa.workbench.finances.by_card',
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
catch {
|
|
354
|
+
warnings.push('The asset ledger financial list could not be read; the primary asset card was still returned.');
|
|
355
|
+
}
|
|
356
|
+
return {
|
|
357
|
+
ok: true,
|
|
358
|
+
data: { view: input.view, card: card(upstreamCard), finances },
|
|
359
|
+
warnings,
|
|
360
|
+
trace_id: context.traceId,
|
|
361
|
+
source_refs: sourceRefs,
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
if (input.view === 'finance') {
|
|
365
|
+
const upstream = assetFinanceUpstreamSchema.parse(await context.callCapability('suite.fa.workbench.finance.detail', {
|
|
366
|
+
finance_id: input.finance_id,
|
|
367
|
+
}));
|
|
368
|
+
const included = await financeIncludes(input.finance_id, input.include, context);
|
|
369
|
+
return {
|
|
370
|
+
ok: true,
|
|
371
|
+
data: {
|
|
372
|
+
view: input.view,
|
|
373
|
+
finance: finance(upstream),
|
|
374
|
+
include: input.include,
|
|
375
|
+
...included.data,
|
|
376
|
+
},
|
|
377
|
+
warnings: included.warnings,
|
|
378
|
+
trace_id: context.traceId,
|
|
379
|
+
source_refs: [
|
|
380
|
+
{ service: 'suite', operation: 'fa.workbench.finance.detail' },
|
|
381
|
+
...included.operations.map((operation) => ({
|
|
382
|
+
service: 'suite',
|
|
383
|
+
operation,
|
|
384
|
+
})),
|
|
385
|
+
],
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
const upstream = assetMovementListUpstreamSchema.parse(await context.callCapability('suite.fa.movement_detail.list', {
|
|
389
|
+
filters: input.filters,
|
|
390
|
+
page: input.page,
|
|
391
|
+
page_size: input.page_size,
|
|
392
|
+
}));
|
|
393
|
+
const pageSize = upstream.page_size ?? upstream.pageSize ?? input.page_size;
|
|
394
|
+
return {
|
|
395
|
+
ok: true,
|
|
396
|
+
data: {
|
|
397
|
+
view: input.view,
|
|
398
|
+
items: upstream.list.map(movementRow),
|
|
399
|
+
summary: upstream.summary,
|
|
400
|
+
},
|
|
401
|
+
page: {
|
|
402
|
+
number: upstream.page,
|
|
403
|
+
size: pageSize,
|
|
404
|
+
total_items: upstream.total,
|
|
405
|
+
has_more: upstream.page * pageSize < upstream.total,
|
|
406
|
+
},
|
|
407
|
+
warnings: [],
|
|
408
|
+
trace_id: context.traceId,
|
|
409
|
+
source_refs: [{ service: 'suite', operation: 'fa.movement_detail.list' }],
|
|
410
|
+
};
|
|
411
|
+
},
|
|
412
|
+
summarize(output) {
|
|
413
|
+
const parsed = queryAssetsOutputSchema.parse(output);
|
|
414
|
+
if (parsed.data.view === 'detail') {
|
|
415
|
+
const count = parsed.data.finances?.length;
|
|
416
|
+
return count === undefined
|
|
417
|
+
? 'Returned the asset card; the ledger financial list is unavailable.'
|
|
418
|
+
: `Returned the asset card and ${count} ledger financial records.`;
|
|
419
|
+
}
|
|
420
|
+
if (parsed.data.view === 'finance')
|
|
421
|
+
return 'Returned one asset financial record.';
|
|
422
|
+
return `Returned ${parsed.data.items.length} asset ${parsed.data.view === 'list' ? 'workspace records' : 'movement records'}.`;
|
|
423
|
+
},
|
|
424
|
+
};
|
|
425
|
+
//# sourceMappingURL=query-assets.js.map
|