@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,1153 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { artifactMetadataSchema, contextSchema, paginatedSuccessEnvelopeSchema, viewPageSuccessEnvelopeSchema, successEnvelopeSchema, } from '../common.js';
|
|
3
|
+
import { dateSchema, dateTimeSchema, decimalStringSchema, upstreamDecimalSchema, uuidSchema, } from '../primitives.js';
|
|
4
|
+
export const businessDocumentTypeSchema = z.enum(['payable', 'receivable']);
|
|
5
|
+
export const businessDocumentSubtypeSchema = z.enum([
|
|
6
|
+
'STANDARD',
|
|
7
|
+
'CREDIT',
|
|
8
|
+
'PREPAYMENT',
|
|
9
|
+
'ACCRUED',
|
|
10
|
+
'SURCHARGE',
|
|
11
|
+
'STANDARD_APPLY_ACCRUED',
|
|
12
|
+
'OFFSET',
|
|
13
|
+
]);
|
|
14
|
+
export const businessDocumentReadSubtypeSchema = z.string().min(1);
|
|
15
|
+
const knownBusinessDocumentReadSubtypes = new Set([
|
|
16
|
+
...businessDocumentSubtypeSchema.options,
|
|
17
|
+
'REVERSAL',
|
|
18
|
+
'PAYMENT',
|
|
19
|
+
]);
|
|
20
|
+
export function isKnownBusinessDocumentReadSubtype(value) {
|
|
21
|
+
return knownBusinessDocumentReadSubtypes.has(value);
|
|
22
|
+
}
|
|
23
|
+
export const businessDocumentVerificationStatusSchema = z
|
|
24
|
+
.enum(['D', 'V', 'F'])
|
|
25
|
+
.describe('Upstream verification status code. Pass D, V, or F exactly as returned by the service.');
|
|
26
|
+
export const payablePostingStatusSchema = z
|
|
27
|
+
.enum(['N', 'C'])
|
|
28
|
+
.describe('Upstream payable posting status code. Pass N or C exactly as returned by the service.');
|
|
29
|
+
export const businessDocumentApprovalStatusSchema = z.enum([
|
|
30
|
+
'NONE',
|
|
31
|
+
'PENDING',
|
|
32
|
+
'APPROVED',
|
|
33
|
+
'REJECTED',
|
|
34
|
+
'WITHDRAWN',
|
|
35
|
+
]);
|
|
36
|
+
const commonListFilterFields = {
|
|
37
|
+
search: z.string().min(1).optional(),
|
|
38
|
+
symbol: z.string().min(1).max(32).optional(),
|
|
39
|
+
amount_from: decimalStringSchema.optional(),
|
|
40
|
+
amount_to: decimalStringSchema.optional(),
|
|
41
|
+
biz_date_from: dateSchema.optional(),
|
|
42
|
+
biz_date_to: dateSchema.optional(),
|
|
43
|
+
gl_date_from: dateSchema.optional(),
|
|
44
|
+
gl_date_to: dateSchema.optional(),
|
|
45
|
+
created_by: z.uuid().optional(),
|
|
46
|
+
verification_status: businessDocumentVerificationStatusSchema.optional(),
|
|
47
|
+
approval_status: businessDocumentApprovalStatusSchema.optional(),
|
|
48
|
+
journal_number_from: z.string().min(1).optional(),
|
|
49
|
+
journal_number_to: z.string().min(1).optional(),
|
|
50
|
+
};
|
|
51
|
+
export const payableBusinessDocumentSortSchema = z
|
|
52
|
+
.object({
|
|
53
|
+
field: z.enum([
|
|
54
|
+
'created_at',
|
|
55
|
+
'ap_no',
|
|
56
|
+
'biz_date',
|
|
57
|
+
'amount_total',
|
|
58
|
+
'verification_status',
|
|
59
|
+
'ap_type',
|
|
60
|
+
]),
|
|
61
|
+
direction: z.enum(['asc', 'desc']).default('desc'),
|
|
62
|
+
})
|
|
63
|
+
.strict();
|
|
64
|
+
export const receivableBusinessDocumentSortSchema = z
|
|
65
|
+
.object({
|
|
66
|
+
field: z.enum([
|
|
67
|
+
'created_at',
|
|
68
|
+
'ar_no',
|
|
69
|
+
'biz_date',
|
|
70
|
+
'gl_date',
|
|
71
|
+
'amount_total',
|
|
72
|
+
'verification_status',
|
|
73
|
+
'approval_status',
|
|
74
|
+
'posting_status',
|
|
75
|
+
'ar_type',
|
|
76
|
+
'period_name',
|
|
77
|
+
]),
|
|
78
|
+
direction: z.enum(['asc', 'desc']).default('desc'),
|
|
79
|
+
})
|
|
80
|
+
.strict();
|
|
81
|
+
function validateListDateRanges(filters, context) {
|
|
82
|
+
if (filters.biz_date_from !== undefined &&
|
|
83
|
+
filters.biz_date_to !== undefined &&
|
|
84
|
+
filters.biz_date_from > filters.biz_date_to) {
|
|
85
|
+
context.addIssue({
|
|
86
|
+
code: 'custom',
|
|
87
|
+
path: ['biz_date_to'],
|
|
88
|
+
message: 'biz_date_to must not be earlier than biz_date_from',
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (filters.gl_date_from !== undefined &&
|
|
92
|
+
filters.gl_date_to !== undefined &&
|
|
93
|
+
filters.gl_date_from > filters.gl_date_to) {
|
|
94
|
+
context.addIssue({
|
|
95
|
+
code: 'custom',
|
|
96
|
+
path: ['gl_date_to'],
|
|
97
|
+
message: 'gl_date_to must not be earlier than gl_date_from',
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export const payableBusinessDocumentFiltersSchema = z
|
|
102
|
+
.object({
|
|
103
|
+
...commonListFilterFields,
|
|
104
|
+
from_party_id: z.uuid().optional(),
|
|
105
|
+
ap_no: z.string().min(1).optional(),
|
|
106
|
+
posting_status: payablePostingStatusSchema.optional(),
|
|
107
|
+
ap_type: businessDocumentSubtypeSchema.optional(),
|
|
108
|
+
})
|
|
109
|
+
.strict()
|
|
110
|
+
.superRefine(validateListDateRanges);
|
|
111
|
+
export const receivableBusinessDocumentFiltersSchema = z
|
|
112
|
+
.object({
|
|
113
|
+
...commonListFilterFields,
|
|
114
|
+
to_party_id: z.uuid().optional(),
|
|
115
|
+
ar_no: z.string().min(1).optional(),
|
|
116
|
+
posting_status: z.enum(['POSTED', 'UNPOSTED']).optional(),
|
|
117
|
+
ar_type: businessDocumentSubtypeSchema.optional(),
|
|
118
|
+
})
|
|
119
|
+
.strict()
|
|
120
|
+
.superRefine(validateListDateRanges);
|
|
121
|
+
const listPagingFields = {
|
|
122
|
+
page: z.number().int().positive().default(1),
|
|
123
|
+
page_size: z.number().int().min(1).max(100).default(20),
|
|
124
|
+
context: contextSchema.optional(),
|
|
125
|
+
};
|
|
126
|
+
const documentReadFields = {
|
|
127
|
+
document_id: z.uuid(),
|
|
128
|
+
context: contextSchema.optional(),
|
|
129
|
+
};
|
|
130
|
+
export const queryBusinessDocumentsInputSchema = z.union([
|
|
131
|
+
z
|
|
132
|
+
.object({
|
|
133
|
+
document_type: z.literal('payable'),
|
|
134
|
+
view: z.literal('list'),
|
|
135
|
+
filters: payableBusinessDocumentFiltersSchema.default({}),
|
|
136
|
+
sort: payableBusinessDocumentSortSchema.optional(),
|
|
137
|
+
...listPagingFields,
|
|
138
|
+
})
|
|
139
|
+
.strict()
|
|
140
|
+
.describe('Payable lists support sorting the complete result set by allowlisted sort fields.'),
|
|
141
|
+
z
|
|
142
|
+
.object({
|
|
143
|
+
document_type: z.literal('receivable'),
|
|
144
|
+
view: z.literal('list'),
|
|
145
|
+
filters: receivableBusinessDocumentFiltersSchema.default({}),
|
|
146
|
+
sort: receivableBusinessDocumentSortSchema.optional(),
|
|
147
|
+
...listPagingFields,
|
|
148
|
+
})
|
|
149
|
+
.strict()
|
|
150
|
+
.describe('Receivable lists support sorting the complete result set by allowlisted sort fields.'),
|
|
151
|
+
z
|
|
152
|
+
.object({
|
|
153
|
+
document_type: z.literal('payable'),
|
|
154
|
+
view: z.literal('detail'),
|
|
155
|
+
...documentReadFields,
|
|
156
|
+
})
|
|
157
|
+
.strict(),
|
|
158
|
+
z
|
|
159
|
+
.object({
|
|
160
|
+
document_type: z.literal('receivable'),
|
|
161
|
+
view: z.literal('detail'),
|
|
162
|
+
...documentReadFields,
|
|
163
|
+
})
|
|
164
|
+
.strict(),
|
|
165
|
+
z
|
|
166
|
+
.object({
|
|
167
|
+
document_type: z.literal('payable'),
|
|
168
|
+
view: z.literal('offsets'),
|
|
169
|
+
...documentReadFields,
|
|
170
|
+
})
|
|
171
|
+
.strict(),
|
|
172
|
+
z
|
|
173
|
+
.object({
|
|
174
|
+
document_type: z.literal('receivable'),
|
|
175
|
+
view: z.literal('offsets'),
|
|
176
|
+
...documentReadFields,
|
|
177
|
+
})
|
|
178
|
+
.strict(),
|
|
179
|
+
z
|
|
180
|
+
.object({
|
|
181
|
+
document_type: z.literal('payable'),
|
|
182
|
+
view: z.literal('offset_document_lines'),
|
|
183
|
+
offset_document_id: z.uuid(),
|
|
184
|
+
...documentReadFields,
|
|
185
|
+
})
|
|
186
|
+
.strict(),
|
|
187
|
+
z
|
|
188
|
+
.object({
|
|
189
|
+
document_type: z.literal('receivable'),
|
|
190
|
+
view: z.literal('offset_document_lines'),
|
|
191
|
+
offset_document_id: z.uuid(),
|
|
192
|
+
...documentReadFields,
|
|
193
|
+
})
|
|
194
|
+
.strict(),
|
|
195
|
+
]);
|
|
196
|
+
export const queryPayableDocumentsInputSchema = z
|
|
197
|
+
.object({
|
|
198
|
+
filters: payableBusinessDocumentFiltersSchema.default({}),
|
|
199
|
+
sort: payableBusinessDocumentSortSchema.optional(),
|
|
200
|
+
...listPagingFields,
|
|
201
|
+
})
|
|
202
|
+
.strict()
|
|
203
|
+
.describe('List payable documents. Filters and paging apply only to this list Tool.');
|
|
204
|
+
export const queryReceivableDocumentsInputSchema = z
|
|
205
|
+
.object({
|
|
206
|
+
filters: receivableBusinessDocumentFiltersSchema.default({}),
|
|
207
|
+
sort: receivableBusinessDocumentSortSchema.optional(),
|
|
208
|
+
...listPagingFields,
|
|
209
|
+
})
|
|
210
|
+
.strict()
|
|
211
|
+
.describe('List receivable documents. Filters and paging apply only to this list Tool.');
|
|
212
|
+
export const getPayableDocumentInputSchema = z
|
|
213
|
+
.object(documentReadFields)
|
|
214
|
+
.strict()
|
|
215
|
+
.describe('Read one payable document by document_id.');
|
|
216
|
+
export const getReceivableDocumentInputSchema = z
|
|
217
|
+
.object(documentReadFields)
|
|
218
|
+
.strict()
|
|
219
|
+
.describe('Read one receivable document by document_id.');
|
|
220
|
+
export const queryPayableOffsetsInputSchema = z
|
|
221
|
+
.object(documentReadFields)
|
|
222
|
+
.strict()
|
|
223
|
+
.describe('Read completed offsets for one payable document.');
|
|
224
|
+
export const queryReceivableOffsetsInputSchema = z
|
|
225
|
+
.object(documentReadFields)
|
|
226
|
+
.strict()
|
|
227
|
+
.describe('Read completed offsets for one receivable document.');
|
|
228
|
+
export const queryPayableOffsetLinesInputSchema = z
|
|
229
|
+
.object({
|
|
230
|
+
offset_document_id: z.uuid(),
|
|
231
|
+
...documentReadFields,
|
|
232
|
+
})
|
|
233
|
+
.strict()
|
|
234
|
+
.describe('Read lines for one payable offset document.');
|
|
235
|
+
export const queryReceivableOffsetLinesInputSchema = z
|
|
236
|
+
.object({
|
|
237
|
+
offset_document_id: z.uuid(),
|
|
238
|
+
...documentReadFields,
|
|
239
|
+
})
|
|
240
|
+
.strict()
|
|
241
|
+
.describe('Read lines for one receivable offset document.');
|
|
242
|
+
const nullableUpstreamDecimalSchema = upstreamDecimalSchema.nullable();
|
|
243
|
+
const nullableDecimalSchema = decimalStringSchema.nullable();
|
|
244
|
+
const nullableStringSchema = z.string().nullable();
|
|
245
|
+
const nullableUuidSchema = z.uuid().nullable();
|
|
246
|
+
const nullableDateSchema = dateSchema.nullable();
|
|
247
|
+
const nullableDateTimeSchema = dateTimeSchema.nullable();
|
|
248
|
+
const journalDigestUpstreamSchema = z
|
|
249
|
+
.object({
|
|
250
|
+
journal_id: z.uuid(),
|
|
251
|
+
journal_number: nullableStringSchema,
|
|
252
|
+
event_id: nullableUuidSchema,
|
|
253
|
+
approval_status: nullableStringSchema,
|
|
254
|
+
org_id: nullableUuidSchema,
|
|
255
|
+
org_name: nullableStringSchema,
|
|
256
|
+
ledger_id: nullableUuidSchema,
|
|
257
|
+
period_name: nullableStringSchema,
|
|
258
|
+
})
|
|
259
|
+
.passthrough();
|
|
260
|
+
const journalDigestSchema = z
|
|
261
|
+
.object({
|
|
262
|
+
journal_id: z.uuid(),
|
|
263
|
+
journal_number: nullableStringSchema,
|
|
264
|
+
event_id: nullableUuidSchema,
|
|
265
|
+
approval_status: nullableStringSchema,
|
|
266
|
+
org_id: nullableUuidSchema,
|
|
267
|
+
org_name: nullableStringSchema,
|
|
268
|
+
ledger_id: nullableUuidSchema,
|
|
269
|
+
period_name: nullableStringSchema,
|
|
270
|
+
})
|
|
271
|
+
.strict();
|
|
272
|
+
const payableSummaryUpstreamSchema = z
|
|
273
|
+
.object({
|
|
274
|
+
invoice_amount: nullableUpstreamDecimalSchema,
|
|
275
|
+
tax_amount: nullableUpstreamDecimalSchema,
|
|
276
|
+
base_amount: nullableUpstreamDecimalSchema,
|
|
277
|
+
remaining_amount: nullableUpstreamDecimalSchema,
|
|
278
|
+
base_currency: nullableStringSchema,
|
|
279
|
+
})
|
|
280
|
+
.passthrough();
|
|
281
|
+
const payableSummarySchema = z
|
|
282
|
+
.object({
|
|
283
|
+
invoice_amount: nullableDecimalSchema,
|
|
284
|
+
tax_amount: nullableDecimalSchema,
|
|
285
|
+
base_amount: nullableDecimalSchema,
|
|
286
|
+
remaining_amount: nullableDecimalSchema,
|
|
287
|
+
base_currency: nullableStringSchema,
|
|
288
|
+
})
|
|
289
|
+
.strict();
|
|
290
|
+
const receivableSummaryUpstreamSchema = z
|
|
291
|
+
.object({
|
|
292
|
+
receivable_amount: nullableUpstreamDecimalSchema,
|
|
293
|
+
income_amount: nullableUpstreamDecimalSchema,
|
|
294
|
+
tax_amount: nullableUpstreamDecimalSchema,
|
|
295
|
+
received_amount: nullableUpstreamDecimalSchema,
|
|
296
|
+
net_amount: nullableUpstreamDecimalSchema,
|
|
297
|
+
due_balance: nullableUpstreamDecimalSchema,
|
|
298
|
+
base_currency: nullableStringSchema,
|
|
299
|
+
})
|
|
300
|
+
.passthrough();
|
|
301
|
+
const receivableSummarySchema = z
|
|
302
|
+
.object({
|
|
303
|
+
receivable_amount: nullableDecimalSchema,
|
|
304
|
+
income_amount: nullableDecimalSchema,
|
|
305
|
+
tax_amount: nullableDecimalSchema,
|
|
306
|
+
received_amount: nullableDecimalSchema,
|
|
307
|
+
net_amount: nullableDecimalSchema,
|
|
308
|
+
due_balance: nullableDecimalSchema,
|
|
309
|
+
base_currency: nullableStringSchema,
|
|
310
|
+
})
|
|
311
|
+
.strict();
|
|
312
|
+
export const payableBusinessDocumentListItemUpstreamSchema = z
|
|
313
|
+
.object({
|
|
314
|
+
id: z.uuid(),
|
|
315
|
+
ap_no: z.string(),
|
|
316
|
+
ap_type: businessDocumentReadSubtypeSchema,
|
|
317
|
+
from_party_id: nullableUuidSchema,
|
|
318
|
+
from_party_name: nullableStringSchema,
|
|
319
|
+
verification_status: businessDocumentVerificationStatusSchema,
|
|
320
|
+
posting_status: payablePostingStatusSchema,
|
|
321
|
+
create_approval_status: nullableStringSchema,
|
|
322
|
+
journal_numbers: z.array(z.string()),
|
|
323
|
+
journals: z.array(journalDigestUpstreamSchema),
|
|
324
|
+
biz_date: nullableDateSchema,
|
|
325
|
+
gl_date: nullableDateSchema,
|
|
326
|
+
period_name: z.string(),
|
|
327
|
+
currency: nullableStringSchema,
|
|
328
|
+
amount_total: nullableUpstreamDecimalSchema,
|
|
329
|
+
created_by: nullableUuidSchema,
|
|
330
|
+
created_at: nullableDateTimeSchema,
|
|
331
|
+
version: z.number().int(),
|
|
332
|
+
cancelled_at: nullableDateTimeSchema,
|
|
333
|
+
attachment_count: z.number().int().nonnegative(),
|
|
334
|
+
pending_offsets: z.number().int().nonnegative(),
|
|
335
|
+
offset_count: z.number().int().nonnegative(),
|
|
336
|
+
parent_id: nullableUuidSchema,
|
|
337
|
+
})
|
|
338
|
+
.passthrough();
|
|
339
|
+
export const receivableBusinessDocumentListItemUpstreamSchema = z
|
|
340
|
+
.object({
|
|
341
|
+
id: z.uuid(),
|
|
342
|
+
org_id: z.uuid(),
|
|
343
|
+
ar_no: z.string(),
|
|
344
|
+
ar_type: businessDocumentReadSubtypeSchema,
|
|
345
|
+
to_party_id: nullableUuidSchema,
|
|
346
|
+
to_party_name: nullableStringSchema,
|
|
347
|
+
verification_status: businessDocumentVerificationStatusSchema,
|
|
348
|
+
approval_status: businessDocumentApprovalStatusSchema,
|
|
349
|
+
posting_status: z.enum(['POSTED', 'UNPOSTED']),
|
|
350
|
+
journal_numbers: z.array(z.string()),
|
|
351
|
+
journals: z.array(journalDigestUpstreamSchema),
|
|
352
|
+
biz_date: nullableDateSchema,
|
|
353
|
+
gl_date: nullableDateSchema,
|
|
354
|
+
period_name: z.string(),
|
|
355
|
+
currency: nullableStringSchema,
|
|
356
|
+
amount_total: nullableUpstreamDecimalSchema,
|
|
357
|
+
created_by: nullableUuidSchema,
|
|
358
|
+
created_at: nullableDateTimeSchema,
|
|
359
|
+
version: z.number().int(),
|
|
360
|
+
summary: receivableSummaryUpstreamSchema,
|
|
361
|
+
attachment_count: z.number().int().nonnegative(),
|
|
362
|
+
offset_count: z.number().int().nonnegative(),
|
|
363
|
+
pending_offsets: z.number().int().nonnegative(),
|
|
364
|
+
cancelled_at: nullableDateTimeSchema,
|
|
365
|
+
parent_id: nullableUuidSchema,
|
|
366
|
+
})
|
|
367
|
+
.passthrough();
|
|
368
|
+
export const payableBusinessDocumentPageUpstreamSchema = z
|
|
369
|
+
.object({
|
|
370
|
+
records: z.array(payableBusinessDocumentListItemUpstreamSchema),
|
|
371
|
+
total: z.number().int().nonnegative(),
|
|
372
|
+
page: z.number().int().positive(),
|
|
373
|
+
page_size: z.number().int().positive(),
|
|
374
|
+
offsets: z.array(payableBusinessDocumentListItemUpstreamSchema),
|
|
375
|
+
})
|
|
376
|
+
.passthrough();
|
|
377
|
+
export const receivableBusinessDocumentPageUpstreamSchema = z
|
|
378
|
+
.object({
|
|
379
|
+
records: z.array(receivableBusinessDocumentListItemUpstreamSchema),
|
|
380
|
+
total: z.number().int().nonnegative(),
|
|
381
|
+
page: z.number().int().positive(),
|
|
382
|
+
page_size: z.number().int().positive(),
|
|
383
|
+
offsets: z.array(receivableBusinessDocumentListItemUpstreamSchema),
|
|
384
|
+
})
|
|
385
|
+
.passthrough();
|
|
386
|
+
const payableBusinessDocumentListItemSchema = z
|
|
387
|
+
.object({
|
|
388
|
+
id: z.uuid(),
|
|
389
|
+
ap_no: z.string(),
|
|
390
|
+
ap_type: businessDocumentReadSubtypeSchema,
|
|
391
|
+
from_party_id: nullableUuidSchema,
|
|
392
|
+
from_party_name: nullableStringSchema,
|
|
393
|
+
verification_status: businessDocumentVerificationStatusSchema,
|
|
394
|
+
posting_status: payablePostingStatusSchema,
|
|
395
|
+
create_approval_status: nullableStringSchema,
|
|
396
|
+
journal_numbers: z.array(z.string()),
|
|
397
|
+
journals: z.array(journalDigestSchema),
|
|
398
|
+
biz_date: nullableDateSchema,
|
|
399
|
+
gl_date: nullableDateSchema,
|
|
400
|
+
period_name: z.string(),
|
|
401
|
+
currency: nullableStringSchema,
|
|
402
|
+
amount_total: nullableDecimalSchema,
|
|
403
|
+
created_by: nullableUuidSchema,
|
|
404
|
+
created_at: nullableDateTimeSchema,
|
|
405
|
+
version: z.number().int(),
|
|
406
|
+
cancelled_at: nullableDateTimeSchema,
|
|
407
|
+
attachment_count: z.number().int().nonnegative(),
|
|
408
|
+
pending_offsets: z.number().int().nonnegative(),
|
|
409
|
+
offset_count: z.number().int().nonnegative(),
|
|
410
|
+
parent_id: nullableUuidSchema,
|
|
411
|
+
})
|
|
412
|
+
.strict();
|
|
413
|
+
const receivableBusinessDocumentListItemSchema = z
|
|
414
|
+
.object({
|
|
415
|
+
id: z.uuid(),
|
|
416
|
+
org_id: z.uuid(),
|
|
417
|
+
ar_no: z.string(),
|
|
418
|
+
ar_type: businessDocumentReadSubtypeSchema,
|
|
419
|
+
to_party_id: nullableUuidSchema,
|
|
420
|
+
to_party_name: nullableStringSchema,
|
|
421
|
+
verification_status: businessDocumentVerificationStatusSchema,
|
|
422
|
+
approval_status: businessDocumentApprovalStatusSchema,
|
|
423
|
+
posting_status: z.enum(['POSTED', 'UNPOSTED']),
|
|
424
|
+
journal_numbers: z.array(z.string()),
|
|
425
|
+
journals: z.array(journalDigestSchema),
|
|
426
|
+
biz_date: nullableDateSchema,
|
|
427
|
+
gl_date: nullableDateSchema,
|
|
428
|
+
period_name: z.string(),
|
|
429
|
+
currency: nullableStringSchema,
|
|
430
|
+
amount_total: nullableDecimalSchema,
|
|
431
|
+
created_by: nullableUuidSchema,
|
|
432
|
+
created_at: nullableDateTimeSchema,
|
|
433
|
+
version: z.number().int(),
|
|
434
|
+
summary: receivableSummarySchema,
|
|
435
|
+
attachment_count: z.number().int().nonnegative(),
|
|
436
|
+
offset_count: z.number().int().nonnegative(),
|
|
437
|
+
pending_offsets: z.number().int().nonnegative(),
|
|
438
|
+
cancelled_at: nullableDateTimeSchema,
|
|
439
|
+
parent_id: nullableUuidSchema,
|
|
440
|
+
})
|
|
441
|
+
.strict();
|
|
442
|
+
const offsetDocumentRefUpstreamSchema = z
|
|
443
|
+
.object({
|
|
444
|
+
id: z.uuid(),
|
|
445
|
+
approval_status: z.string(),
|
|
446
|
+
version: z.number().int(),
|
|
447
|
+
biz_date: nullableDateSchema,
|
|
448
|
+
period_name: z.string(),
|
|
449
|
+
})
|
|
450
|
+
.passthrough();
|
|
451
|
+
const payableOffsetDocumentRefUpstreamSchema = offsetDocumentRefUpstreamSchema.extend({
|
|
452
|
+
ap_no: z.string(),
|
|
453
|
+
});
|
|
454
|
+
const receivableOffsetDocumentRefUpstreamSchema = offsetDocumentRefUpstreamSchema.extend({ ar_no: z.string() });
|
|
455
|
+
const offsetDocumentRefSchema = z
|
|
456
|
+
.object({
|
|
457
|
+
id: z.uuid(),
|
|
458
|
+
document_no: z.string(),
|
|
459
|
+
approval_status: z.string(),
|
|
460
|
+
version: z.number().int(),
|
|
461
|
+
biz_date: nullableDateSchema,
|
|
462
|
+
period_name: z.string(),
|
|
463
|
+
})
|
|
464
|
+
.strict();
|
|
465
|
+
const attributeUpstreamFields = {
|
|
466
|
+
attribute1: nullableStringSchema.optional(),
|
|
467
|
+
attribute2: nullableStringSchema.optional(),
|
|
468
|
+
attribute3: nullableStringSchema.optional(),
|
|
469
|
+
attribute4: nullableStringSchema.optional(),
|
|
470
|
+
attribute5: nullableStringSchema.optional(),
|
|
471
|
+
attribute6: nullableStringSchema.optional(),
|
|
472
|
+
attribute7: nullableStringSchema.optional(),
|
|
473
|
+
attribute8: nullableStringSchema.optional(),
|
|
474
|
+
attribute9: nullableStringSchema.optional(),
|
|
475
|
+
attribute10: nullableStringSchema.optional(),
|
|
476
|
+
attribute11: nullableStringSchema.optional(),
|
|
477
|
+
attribute12: nullableStringSchema.optional(),
|
|
478
|
+
};
|
|
479
|
+
export const businessDocumentAttributesSchema = z
|
|
480
|
+
.object({
|
|
481
|
+
attribute1: nullableStringSchema,
|
|
482
|
+
attribute2: nullableStringSchema,
|
|
483
|
+
attribute3: nullableStringSchema,
|
|
484
|
+
attribute4: nullableStringSchema,
|
|
485
|
+
attribute5: nullableStringSchema,
|
|
486
|
+
attribute6: nullableStringSchema,
|
|
487
|
+
attribute7: nullableStringSchema,
|
|
488
|
+
attribute8: nullableStringSchema,
|
|
489
|
+
attribute9: nullableStringSchema,
|
|
490
|
+
attribute10: nullableStringSchema,
|
|
491
|
+
attribute11: nullableStringSchema,
|
|
492
|
+
attribute12: nullableStringSchema,
|
|
493
|
+
})
|
|
494
|
+
.strict();
|
|
495
|
+
const commonLineUpstreamFields = {
|
|
496
|
+
id: nullableUuidSchema,
|
|
497
|
+
line_no: z.number().int(),
|
|
498
|
+
system_type: z.string(),
|
|
499
|
+
p_id: nullableUuidSchema,
|
|
500
|
+
is_offset: z.boolean(),
|
|
501
|
+
offset_type: nullableStringSchema,
|
|
502
|
+
offset_id: nullableUuidSchema,
|
|
503
|
+
offset_source_no: nullableStringSchema,
|
|
504
|
+
symbol: z.string(),
|
|
505
|
+
quantity: nullableUpstreamDecimalSchema,
|
|
506
|
+
base_rate: nullableUpstreamDecimalSchema,
|
|
507
|
+
base_amount: nullableUpstreamDecimalSchema,
|
|
508
|
+
base_currency: nullableStringSchema,
|
|
509
|
+
base_rate_time: nullableDateTimeSchema,
|
|
510
|
+
biz_type1: nullableStringSchema,
|
|
511
|
+
biz_type2: nullableStringSchema,
|
|
512
|
+
biz_type3: nullableStringSchema,
|
|
513
|
+
biz_type4: nullableStringSchema,
|
|
514
|
+
ledger_id: nullableUuidSchema,
|
|
515
|
+
coa_code: nullableStringSchema,
|
|
516
|
+
coa_name: nullableStringSchema,
|
|
517
|
+
description: nullableStringSchema,
|
|
518
|
+
reference: nullableStringSchema,
|
|
519
|
+
...attributeUpstreamFields,
|
|
520
|
+
tax_code: nullableStringSchema,
|
|
521
|
+
tax_rate: nullableUpstreamDecimalSchema,
|
|
522
|
+
ratio: nullableUpstreamDecimalSchema,
|
|
523
|
+
offset_h_id: nullableUuidSchema,
|
|
524
|
+
version: z.number().int().nullable(),
|
|
525
|
+
};
|
|
526
|
+
export const payableBusinessDocumentLineUpstreamSchema = z
|
|
527
|
+
.object({
|
|
528
|
+
...commonLineUpstreamFields,
|
|
529
|
+
offset_no: nullableStringSchema,
|
|
530
|
+
offset_approval_status: nullableStringSchema,
|
|
531
|
+
})
|
|
532
|
+
.passthrough();
|
|
533
|
+
export const receivableBusinessDocumentLineUpstreamSchema = z
|
|
534
|
+
.object(commonLineUpstreamFields)
|
|
535
|
+
.passthrough();
|
|
536
|
+
const commonLineOutputFields = {
|
|
537
|
+
id: nullableUuidSchema,
|
|
538
|
+
line_no: z.number().int(),
|
|
539
|
+
system_type: z.string(),
|
|
540
|
+
p_id: nullableUuidSchema,
|
|
541
|
+
is_offset: z.boolean(),
|
|
542
|
+
offset_type: nullableStringSchema,
|
|
543
|
+
offset_id: nullableUuidSchema,
|
|
544
|
+
offset_source_no: nullableStringSchema,
|
|
545
|
+
symbol: z.string(),
|
|
546
|
+
quantity: nullableDecimalSchema,
|
|
547
|
+
base_rate: nullableDecimalSchema,
|
|
548
|
+
base_amount: nullableDecimalSchema,
|
|
549
|
+
base_currency: nullableStringSchema,
|
|
550
|
+
base_rate_time: nullableDateTimeSchema,
|
|
551
|
+
biz_type1: nullableStringSchema,
|
|
552
|
+
biz_type2: nullableStringSchema,
|
|
553
|
+
biz_type3: nullableStringSchema,
|
|
554
|
+
biz_type4: nullableStringSchema,
|
|
555
|
+
ledger_id: nullableUuidSchema,
|
|
556
|
+
coa_code: nullableStringSchema,
|
|
557
|
+
coa_name: nullableStringSchema,
|
|
558
|
+
description: nullableStringSchema,
|
|
559
|
+
reference: nullableStringSchema,
|
|
560
|
+
attributes: businessDocumentAttributesSchema,
|
|
561
|
+
tax_code: nullableStringSchema,
|
|
562
|
+
tax_rate: nullableDecimalSchema,
|
|
563
|
+
ratio: nullableDecimalSchema,
|
|
564
|
+
offset_h_id: nullableUuidSchema,
|
|
565
|
+
version: z.number().int().nullable(),
|
|
566
|
+
};
|
|
567
|
+
const payableBusinessDocumentLineSchema = z
|
|
568
|
+
.object({
|
|
569
|
+
...commonLineOutputFields,
|
|
570
|
+
offset_no: nullableStringSchema,
|
|
571
|
+
offset_approval_status: nullableStringSchema,
|
|
572
|
+
})
|
|
573
|
+
.strict();
|
|
574
|
+
const receivableBusinessDocumentLineSchema = z
|
|
575
|
+
.object(commonLineOutputFields)
|
|
576
|
+
.strict();
|
|
577
|
+
export const payableBusinessDocumentDetailUpstreamSchema = z
|
|
578
|
+
.object({
|
|
579
|
+
id: z.uuid(),
|
|
580
|
+
org_id: z.uuid(),
|
|
581
|
+
ap_type: businessDocumentReadSubtypeSchema,
|
|
582
|
+
parent_id: nullableUuidSchema,
|
|
583
|
+
from_party_id: nullableUuidSchema,
|
|
584
|
+
from_party_name: nullableStringSchema,
|
|
585
|
+
ap_no: z.string(),
|
|
586
|
+
source: z.string(),
|
|
587
|
+
source_no: nullableStringSchema,
|
|
588
|
+
biz_date: nullableDateSchema,
|
|
589
|
+
period_name: z.string(),
|
|
590
|
+
verification_status: businessDocumentVerificationStatusSchema,
|
|
591
|
+
verify_error: nullableStringSchema,
|
|
592
|
+
ledger_id: z.uuid(),
|
|
593
|
+
coa_code: nullableStringSchema,
|
|
594
|
+
coa_name: nullableStringSchema,
|
|
595
|
+
description: nullableStringSchema,
|
|
596
|
+
reference: nullableStringSchema,
|
|
597
|
+
invoice_no: nullableStringSchema,
|
|
598
|
+
usage_qty: nullableUpstreamDecimalSchema,
|
|
599
|
+
usage_unit: nullableStringSchema,
|
|
600
|
+
unit_price: nullableUpstreamDecimalSchema,
|
|
601
|
+
...attributeUpstreamFields,
|
|
602
|
+
to_party_id: nullableUuidSchema,
|
|
603
|
+
to_party_name: nullableStringSchema,
|
|
604
|
+
to_party_address_id: nullableUuidSchema,
|
|
605
|
+
to_party_payment_method: nullableStringSchema,
|
|
606
|
+
to_party_payment_terms: nullableStringSchema,
|
|
607
|
+
to_party_payment_term_date: nullableDateTimeSchema,
|
|
608
|
+
to_party_payee_account_no: nullableStringSchema,
|
|
609
|
+
to_party_payee_account_name: nullableStringSchema,
|
|
610
|
+
to_party_swift_code: nullableStringSchema,
|
|
611
|
+
to_party_iban: nullableStringSchema,
|
|
612
|
+
to_party_branch: nullableStringSchema,
|
|
613
|
+
to_party_channel: nullableStringSchema,
|
|
614
|
+
version: z.number().int(),
|
|
615
|
+
created_at: nullableDateTimeSchema,
|
|
616
|
+
updated_at: nullableDateTimeSchema,
|
|
617
|
+
summary: payableSummaryUpstreamSchema,
|
|
618
|
+
has_pending_offset_approval: z.boolean(),
|
|
619
|
+
offset_docs: z.array(payableOffsetDocumentRefUpstreamSchema),
|
|
620
|
+
active_offset_doc_id: nullableUuidSchema,
|
|
621
|
+
submittable_offsets: z.number().int().nonnegative(),
|
|
622
|
+
lines: z.array(payableBusinessDocumentLineUpstreamSchema),
|
|
623
|
+
})
|
|
624
|
+
.passthrough();
|
|
625
|
+
export const receivableBusinessDocumentDetailUpstreamSchema = z
|
|
626
|
+
.object({
|
|
627
|
+
id: z.uuid(),
|
|
628
|
+
org_id: z.uuid(),
|
|
629
|
+
ar_type: businessDocumentReadSubtypeSchema,
|
|
630
|
+
to_party_id: nullableUuidSchema,
|
|
631
|
+
to_party_name: nullableStringSchema,
|
|
632
|
+
ar_no: z.string(),
|
|
633
|
+
source: z.string(),
|
|
634
|
+
source_no: nullableStringSchema,
|
|
635
|
+
biz_date: nullableDateSchema,
|
|
636
|
+
period_name: z.string(),
|
|
637
|
+
verification_status: businessDocumentVerificationStatusSchema,
|
|
638
|
+
verify_error: nullableStringSchema,
|
|
639
|
+
approval_status: businessDocumentApprovalStatusSchema,
|
|
640
|
+
ledger_id: z.uuid(),
|
|
641
|
+
coa_code: nullableStringSchema,
|
|
642
|
+
coa_name: nullableStringSchema,
|
|
643
|
+
description: nullableStringSchema,
|
|
644
|
+
reference: nullableStringSchema,
|
|
645
|
+
invoice_no: nullableStringSchema,
|
|
646
|
+
usage_qty: nullableUpstreamDecimalSchema,
|
|
647
|
+
usage_unit: nullableStringSchema,
|
|
648
|
+
unit_price: nullableUpstreamDecimalSchema,
|
|
649
|
+
...attributeUpstreamFields,
|
|
650
|
+
from_party_address_id: nullableUuidSchema,
|
|
651
|
+
from_party_id: nullableUuidSchema,
|
|
652
|
+
from_party_name: nullableStringSchema,
|
|
653
|
+
from_party_collection_method: nullableStringSchema,
|
|
654
|
+
from_party_collection_terms: nullableStringSchema,
|
|
655
|
+
from_party_collection_term_date: nullableDateTimeSchema,
|
|
656
|
+
from_party_payer_account_no: nullableStringSchema,
|
|
657
|
+
from_party_payer_account_name: nullableStringSchema,
|
|
658
|
+
from_party_swift_code: nullableStringSchema,
|
|
659
|
+
from_party_iban: nullableStringSchema,
|
|
660
|
+
from_party_branch: nullableStringSchema,
|
|
661
|
+
from_party_channel: nullableStringSchema,
|
|
662
|
+
version: z.number().int(),
|
|
663
|
+
created_at: nullableDateTimeSchema,
|
|
664
|
+
updated_at: nullableDateTimeSchema,
|
|
665
|
+
parent_id: nullableUuidSchema,
|
|
666
|
+
parent_ar_no: nullableStringSchema,
|
|
667
|
+
parent_incl_tax_basis: nullableUpstreamDecimalSchema,
|
|
668
|
+
parent_state_valid: z.boolean().nullable(),
|
|
669
|
+
has_pending_offset_approval: z.boolean(),
|
|
670
|
+
submittable_offsets: z.number().int().nonnegative(),
|
|
671
|
+
offset_docs: z.array(receivableOffsetDocumentRefUpstreamSchema),
|
|
672
|
+
active_offset_doc_id: nullableUuidSchema,
|
|
673
|
+
summary: receivableSummaryUpstreamSchema,
|
|
674
|
+
lines: z.array(receivableBusinessDocumentLineUpstreamSchema),
|
|
675
|
+
})
|
|
676
|
+
.passthrough();
|
|
677
|
+
const payableBusinessDocumentDetailSchema = z
|
|
678
|
+
.object({
|
|
679
|
+
id: z.uuid(),
|
|
680
|
+
org_id: z.uuid(),
|
|
681
|
+
ap_type: businessDocumentReadSubtypeSchema,
|
|
682
|
+
parent_id: nullableUuidSchema,
|
|
683
|
+
from_party_id: nullableUuidSchema,
|
|
684
|
+
from_party_name: nullableStringSchema,
|
|
685
|
+
ap_no: z.string(),
|
|
686
|
+
source: z.string(),
|
|
687
|
+
source_no: nullableStringSchema,
|
|
688
|
+
biz_date: nullableDateSchema,
|
|
689
|
+
period_name: z.string(),
|
|
690
|
+
verification_status: businessDocumentVerificationStatusSchema,
|
|
691
|
+
verify_error: nullableStringSchema,
|
|
692
|
+
ledger_id: z.uuid(),
|
|
693
|
+
coa_code: nullableStringSchema,
|
|
694
|
+
coa_name: nullableStringSchema,
|
|
695
|
+
description: nullableStringSchema,
|
|
696
|
+
reference: nullableStringSchema,
|
|
697
|
+
invoice_no: nullableStringSchema,
|
|
698
|
+
usage_qty: nullableDecimalSchema,
|
|
699
|
+
usage_unit: nullableStringSchema,
|
|
700
|
+
unit_price: nullableDecimalSchema,
|
|
701
|
+
attributes: businessDocumentAttributesSchema,
|
|
702
|
+
to_party_id: nullableUuidSchema,
|
|
703
|
+
to_party_name: nullableStringSchema,
|
|
704
|
+
to_party_address_id: nullableUuidSchema,
|
|
705
|
+
to_party_payment_method: nullableStringSchema,
|
|
706
|
+
to_party_payment_terms: nullableStringSchema,
|
|
707
|
+
to_party_payment_term_date: nullableDateTimeSchema,
|
|
708
|
+
to_party_payee_account_no: nullableStringSchema,
|
|
709
|
+
to_party_payee_account_name: nullableStringSchema,
|
|
710
|
+
to_party_swift_code: nullableStringSchema,
|
|
711
|
+
to_party_iban: nullableStringSchema,
|
|
712
|
+
to_party_branch: nullableStringSchema,
|
|
713
|
+
to_party_channel: nullableStringSchema,
|
|
714
|
+
version: z.number().int(),
|
|
715
|
+
created_at: nullableDateTimeSchema,
|
|
716
|
+
updated_at: nullableDateTimeSchema,
|
|
717
|
+
summary: payableSummarySchema,
|
|
718
|
+
has_pending_offset_approval: z.boolean(),
|
|
719
|
+
offset_docs: z.array(offsetDocumentRefSchema),
|
|
720
|
+
active_offset_doc_id: nullableUuidSchema,
|
|
721
|
+
submittable_offsets: z.number().int().nonnegative(),
|
|
722
|
+
lines: z.array(payableBusinessDocumentLineSchema),
|
|
723
|
+
})
|
|
724
|
+
.strict();
|
|
725
|
+
const receivableBusinessDocumentDetailSchema = z
|
|
726
|
+
.object({
|
|
727
|
+
id: z.uuid(),
|
|
728
|
+
org_id: z.uuid(),
|
|
729
|
+
ar_type: businessDocumentReadSubtypeSchema,
|
|
730
|
+
to_party_id: nullableUuidSchema,
|
|
731
|
+
to_party_name: nullableStringSchema,
|
|
732
|
+
ar_no: z.string(),
|
|
733
|
+
source: z.string(),
|
|
734
|
+
source_no: nullableStringSchema,
|
|
735
|
+
biz_date: nullableDateSchema,
|
|
736
|
+
period_name: z.string(),
|
|
737
|
+
verification_status: businessDocumentVerificationStatusSchema,
|
|
738
|
+
verify_error: nullableStringSchema,
|
|
739
|
+
approval_status: businessDocumentApprovalStatusSchema,
|
|
740
|
+
ledger_id: z.uuid(),
|
|
741
|
+
coa_code: nullableStringSchema,
|
|
742
|
+
coa_name: nullableStringSchema,
|
|
743
|
+
description: nullableStringSchema,
|
|
744
|
+
reference: nullableStringSchema,
|
|
745
|
+
invoice_no: nullableStringSchema,
|
|
746
|
+
usage_qty: nullableDecimalSchema,
|
|
747
|
+
usage_unit: nullableStringSchema,
|
|
748
|
+
unit_price: nullableDecimalSchema,
|
|
749
|
+
attributes: businessDocumentAttributesSchema,
|
|
750
|
+
from_party_address_id: nullableUuidSchema,
|
|
751
|
+
from_party_id: nullableUuidSchema,
|
|
752
|
+
from_party_name: nullableStringSchema,
|
|
753
|
+
from_party_collection_method: nullableStringSchema,
|
|
754
|
+
from_party_collection_terms: nullableStringSchema,
|
|
755
|
+
from_party_collection_term_date: nullableDateTimeSchema,
|
|
756
|
+
from_party_payer_account_no: nullableStringSchema,
|
|
757
|
+
from_party_payer_account_name: nullableStringSchema,
|
|
758
|
+
from_party_swift_code: nullableStringSchema,
|
|
759
|
+
from_party_iban: nullableStringSchema,
|
|
760
|
+
from_party_branch: nullableStringSchema,
|
|
761
|
+
from_party_channel: nullableStringSchema,
|
|
762
|
+
version: z.number().int(),
|
|
763
|
+
created_at: nullableDateTimeSchema,
|
|
764
|
+
updated_at: nullableDateTimeSchema,
|
|
765
|
+
parent_id: nullableUuidSchema,
|
|
766
|
+
parent_ar_no: nullableStringSchema,
|
|
767
|
+
parent_incl_tax_basis: nullableDecimalSchema,
|
|
768
|
+
parent_state_valid: z.boolean().nullable(),
|
|
769
|
+
has_pending_offset_approval: z.boolean(),
|
|
770
|
+
submittable_offsets: z.number().int().nonnegative(),
|
|
771
|
+
offset_docs: z.array(offsetDocumentRefSchema),
|
|
772
|
+
active_offset_doc_id: nullableUuidSchema,
|
|
773
|
+
summary: receivableSummarySchema,
|
|
774
|
+
lines: z.array(receivableBusinessDocumentLineSchema),
|
|
775
|
+
})
|
|
776
|
+
.strict();
|
|
777
|
+
export const businessDocumentOffsetUpstreamSchema = z
|
|
778
|
+
.object({
|
|
779
|
+
offset_h_id: z.uuid(),
|
|
780
|
+
offset_no: nullableStringSchema,
|
|
781
|
+
approval_status: z.string(),
|
|
782
|
+
amount: nullableUpstreamDecimalSchema,
|
|
783
|
+
base_currency: nullableStringSchema,
|
|
784
|
+
line_count: z.number().int().nonnegative(),
|
|
785
|
+
created_at: nullableDateTimeSchema,
|
|
786
|
+
version: z.number().int().nullable(),
|
|
787
|
+
kind: z.enum(['DOC', 'TXN']),
|
|
788
|
+
cancellable: z.boolean(),
|
|
789
|
+
cancel_blocked_reason: nullableStringSchema,
|
|
790
|
+
})
|
|
791
|
+
.passthrough();
|
|
792
|
+
const businessDocumentOffsetSchema = z
|
|
793
|
+
.object({
|
|
794
|
+
offset_h_id: z.uuid(),
|
|
795
|
+
offset_no: nullableStringSchema,
|
|
796
|
+
approval_status: z.string(),
|
|
797
|
+
amount: nullableDecimalSchema,
|
|
798
|
+
base_currency: nullableStringSchema,
|
|
799
|
+
line_count: z.number().int().nonnegative(),
|
|
800
|
+
created_at: nullableDateTimeSchema,
|
|
801
|
+
version: z.number().int().nullable(),
|
|
802
|
+
kind: z.enum(['DOC', 'TXN']),
|
|
803
|
+
cancellable: z.boolean(),
|
|
804
|
+
cancel_blocked_reason: nullableStringSchema,
|
|
805
|
+
})
|
|
806
|
+
.strict();
|
|
807
|
+
export const businessDocumentOffsetLineUpstreamSchema = z
|
|
808
|
+
.object({
|
|
809
|
+
line_no: z.number().int().nullable(),
|
|
810
|
+
system_type: nullableStringSchema,
|
|
811
|
+
offset_type: nullableStringSchema,
|
|
812
|
+
source_ref: nullableStringSchema,
|
|
813
|
+
source_date: nullableDateTimeSchema,
|
|
814
|
+
symbol: nullableStringSchema,
|
|
815
|
+
quantity: nullableUpstreamDecimalSchema,
|
|
816
|
+
base_rate: nullableUpstreamDecimalSchema,
|
|
817
|
+
base_amount: nullableUpstreamDecimalSchema,
|
|
818
|
+
base_currency: nullableStringSchema,
|
|
819
|
+
})
|
|
820
|
+
.passthrough();
|
|
821
|
+
const businessDocumentOffsetLineSchema = z
|
|
822
|
+
.object({
|
|
823
|
+
line_no: z.number().int().nullable(),
|
|
824
|
+
system_type: nullableStringSchema,
|
|
825
|
+
offset_type: nullableStringSchema,
|
|
826
|
+
source_ref: nullableStringSchema,
|
|
827
|
+
source_date: nullableDateTimeSchema,
|
|
828
|
+
symbol: nullableStringSchema,
|
|
829
|
+
quantity: nullableDecimalSchema,
|
|
830
|
+
base_rate: nullableDecimalSchema,
|
|
831
|
+
base_amount: nullableDecimalSchema,
|
|
832
|
+
base_currency: nullableStringSchema,
|
|
833
|
+
})
|
|
834
|
+
.strict();
|
|
835
|
+
const payableDocumentsListOutputSchema = z
|
|
836
|
+
.object({
|
|
837
|
+
document_type: z.literal('payable'),
|
|
838
|
+
view: z.literal('list'),
|
|
839
|
+
records: z.array(payableBusinessDocumentListItemSchema),
|
|
840
|
+
offsets: z.array(payableBusinessDocumentListItemSchema),
|
|
841
|
+
})
|
|
842
|
+
.strict();
|
|
843
|
+
const receivableDocumentsListOutputSchema = z
|
|
844
|
+
.object({
|
|
845
|
+
document_type: z.literal('receivable'),
|
|
846
|
+
view: z.literal('list'),
|
|
847
|
+
records: z.array(receivableBusinessDocumentListItemSchema),
|
|
848
|
+
offsets: z.array(receivableBusinessDocumentListItemSchema),
|
|
849
|
+
})
|
|
850
|
+
.strict();
|
|
851
|
+
const payableDocumentDetailOutputSchema = z
|
|
852
|
+
.object({
|
|
853
|
+
document_type: z.literal('payable'),
|
|
854
|
+
view: z.literal('detail'),
|
|
855
|
+
document: payableBusinessDocumentDetailSchema,
|
|
856
|
+
})
|
|
857
|
+
.strict();
|
|
858
|
+
const receivableDocumentDetailOutputSchema = z
|
|
859
|
+
.object({
|
|
860
|
+
document_type: z.literal('receivable'),
|
|
861
|
+
view: z.literal('detail'),
|
|
862
|
+
document: receivableBusinessDocumentDetailSchema,
|
|
863
|
+
})
|
|
864
|
+
.strict();
|
|
865
|
+
const payableOffsetsOutputSchema = z
|
|
866
|
+
.object({
|
|
867
|
+
document_type: z.literal('payable'),
|
|
868
|
+
view: z.literal('offsets'),
|
|
869
|
+
document_id: z.uuid(),
|
|
870
|
+
items: z.array(businessDocumentOffsetSchema),
|
|
871
|
+
})
|
|
872
|
+
.strict();
|
|
873
|
+
const receivableOffsetsOutputSchema = z
|
|
874
|
+
.object({
|
|
875
|
+
document_type: z.literal('receivable'),
|
|
876
|
+
view: z.literal('offsets'),
|
|
877
|
+
document_id: z.uuid(),
|
|
878
|
+
items: z.array(businessDocumentOffsetSchema),
|
|
879
|
+
})
|
|
880
|
+
.strict();
|
|
881
|
+
const payableOffsetLinesOutputSchema = z
|
|
882
|
+
.object({
|
|
883
|
+
document_type: z.literal('payable'),
|
|
884
|
+
view: z.literal('offset_document_lines'),
|
|
885
|
+
document_id: z.uuid(),
|
|
886
|
+
offset_document_id: z.uuid(),
|
|
887
|
+
items: z.array(businessDocumentOffsetLineSchema),
|
|
888
|
+
})
|
|
889
|
+
.strict();
|
|
890
|
+
const receivableOffsetLinesOutputSchema = z
|
|
891
|
+
.object({
|
|
892
|
+
document_type: z.literal('receivable'),
|
|
893
|
+
view: z.literal('offset_document_lines'),
|
|
894
|
+
document_id: z.uuid(),
|
|
895
|
+
offset_document_id: z.uuid(),
|
|
896
|
+
items: z.array(businessDocumentOffsetLineSchema),
|
|
897
|
+
})
|
|
898
|
+
.strict();
|
|
899
|
+
/** Internal adapter response retaining the legacy discriminators for routing. */
|
|
900
|
+
export const businessDocumentQueryAdapterOutputSchema = viewPageSuccessEnvelopeSchema(z.union([
|
|
901
|
+
payableDocumentsListOutputSchema,
|
|
902
|
+
receivableDocumentsListOutputSchema,
|
|
903
|
+
payableDocumentDetailOutputSchema,
|
|
904
|
+
receivableDocumentDetailOutputSchema,
|
|
905
|
+
payableOffsetsOutputSchema,
|
|
906
|
+
receivableOffsetsOutputSchema,
|
|
907
|
+
payableOffsetLinesOutputSchema,
|
|
908
|
+
receivableOffsetLinesOutputSchema,
|
|
909
|
+
]), ['list']);
|
|
910
|
+
const payableDocumentsListPublicOutputSchema = z
|
|
911
|
+
.object({
|
|
912
|
+
records: z.array(payableBusinessDocumentListItemSchema),
|
|
913
|
+
offsets: z.array(payableBusinessDocumentListItemSchema),
|
|
914
|
+
})
|
|
915
|
+
.strict();
|
|
916
|
+
const receivableDocumentsListPublicOutputSchema = z
|
|
917
|
+
.object({
|
|
918
|
+
records: z.array(receivableBusinessDocumentListItemSchema),
|
|
919
|
+
offsets: z.array(receivableBusinessDocumentListItemSchema),
|
|
920
|
+
})
|
|
921
|
+
.strict();
|
|
922
|
+
const payableDocumentDetailPublicOutputSchema = z
|
|
923
|
+
.object({ document: payableBusinessDocumentDetailSchema })
|
|
924
|
+
.strict();
|
|
925
|
+
const receivableDocumentDetailPublicOutputSchema = z
|
|
926
|
+
.object({ document: receivableBusinessDocumentDetailSchema })
|
|
927
|
+
.strict();
|
|
928
|
+
const payableOffsetsPublicOutputSchema = z
|
|
929
|
+
.object({
|
|
930
|
+
document_id: z.uuid(),
|
|
931
|
+
items: z.array(businessDocumentOffsetSchema),
|
|
932
|
+
})
|
|
933
|
+
.strict();
|
|
934
|
+
const receivableOffsetsPublicOutputSchema = z
|
|
935
|
+
.object({
|
|
936
|
+
document_id: z.uuid(),
|
|
937
|
+
items: z.array(businessDocumentOffsetSchema),
|
|
938
|
+
})
|
|
939
|
+
.strict();
|
|
940
|
+
const payableOffsetLinesPublicOutputSchema = z
|
|
941
|
+
.object({
|
|
942
|
+
document_id: z.uuid(),
|
|
943
|
+
offset_document_id: z.uuid(),
|
|
944
|
+
items: z.array(businessDocumentOffsetLineSchema),
|
|
945
|
+
})
|
|
946
|
+
.strict();
|
|
947
|
+
const receivableOffsetLinesPublicOutputSchema = z
|
|
948
|
+
.object({
|
|
949
|
+
document_id: z.uuid(),
|
|
950
|
+
offset_document_id: z.uuid(),
|
|
951
|
+
items: z.array(businessDocumentOffsetLineSchema),
|
|
952
|
+
})
|
|
953
|
+
.strict();
|
|
954
|
+
export const queryPayableDocumentsOutputSchema = paginatedSuccessEnvelopeSchema(payableDocumentsListPublicOutputSchema);
|
|
955
|
+
export const queryReceivableDocumentsOutputSchema = paginatedSuccessEnvelopeSchema(receivableDocumentsListPublicOutputSchema);
|
|
956
|
+
export const getPayableDocumentOutputSchema = successEnvelopeSchema(payableDocumentDetailPublicOutputSchema);
|
|
957
|
+
export const getReceivableDocumentOutputSchema = successEnvelopeSchema(receivableDocumentDetailPublicOutputSchema);
|
|
958
|
+
export const queryPayableOffsetsOutputSchema = successEnvelopeSchema(payableOffsetsPublicOutputSchema);
|
|
959
|
+
export const queryReceivableOffsetsOutputSchema = successEnvelopeSchema(receivableOffsetsPublicOutputSchema);
|
|
960
|
+
export const queryPayableOffsetLinesOutputSchema = successEnvelopeSchema(payableOffsetLinesPublicOutputSchema);
|
|
961
|
+
export const queryReceivableOffsetLinesOutputSchema = successEnvelopeSchema(receivableOffsetLinesPublicOutputSchema);
|
|
962
|
+
export const businessDocumentExportFormatSchema = z.enum(['xlsx', 'csv']);
|
|
963
|
+
export const exportBusinessDocumentsInputSchema = z.union([
|
|
964
|
+
z
|
|
965
|
+
.object({
|
|
966
|
+
document_type: z.literal('payable'),
|
|
967
|
+
filters: payableBusinessDocumentFiltersSchema.default({}),
|
|
968
|
+
sort: payableBusinessDocumentSortSchema.optional(),
|
|
969
|
+
format: businessDocumentExportFormatSchema.default('xlsx'),
|
|
970
|
+
context: contextSchema.optional(),
|
|
971
|
+
})
|
|
972
|
+
.strict(),
|
|
973
|
+
z
|
|
974
|
+
.object({
|
|
975
|
+
document_type: z.literal('receivable'),
|
|
976
|
+
filters: receivableBusinessDocumentFiltersSchema.default({}),
|
|
977
|
+
sort: receivableBusinessDocumentSortSchema.optional(),
|
|
978
|
+
format: businessDocumentExportFormatSchema.default('xlsx'),
|
|
979
|
+
context: contextSchema.optional(),
|
|
980
|
+
})
|
|
981
|
+
.strict(),
|
|
982
|
+
]);
|
|
983
|
+
export const exportBusinessDocumentsOutputSchema = successEnvelopeSchema(z
|
|
984
|
+
.object({
|
|
985
|
+
document_type: businessDocumentTypeSchema,
|
|
986
|
+
format: businessDocumentExportFormatSchema,
|
|
987
|
+
artifact: artifactMetadataSchema,
|
|
988
|
+
})
|
|
989
|
+
.strict());
|
|
990
|
+
const draftSubtypeSchema = z.enum([
|
|
991
|
+
'STANDARD',
|
|
992
|
+
'CREDIT',
|
|
993
|
+
'PREPAYMENT',
|
|
994
|
+
'ACCRUED',
|
|
995
|
+
'SURCHARGE',
|
|
996
|
+
'STANDARD_APPLY_ACCRUED',
|
|
997
|
+
]);
|
|
998
|
+
const optionalText = (max) => z.string().max(max).optional();
|
|
999
|
+
const attributeValuesSchema = z
|
|
1000
|
+
.array(z.string().max(255).nullable())
|
|
1001
|
+
.max(12)
|
|
1002
|
+
.optional();
|
|
1003
|
+
export const businessDocumentDraftLineSchema = z
|
|
1004
|
+
.object({
|
|
1005
|
+
id: uuidSchema.optional(),
|
|
1006
|
+
line_no: z.number().int().positive().optional(),
|
|
1007
|
+
system_type: optionalText(32),
|
|
1008
|
+
party_id: uuidSchema.optional(),
|
|
1009
|
+
is_offset: z.boolean().optional(),
|
|
1010
|
+
offset_type: optionalText(32),
|
|
1011
|
+
offset_id: uuidSchema.optional(),
|
|
1012
|
+
symbol: optionalText(32),
|
|
1013
|
+
quantity: decimalStringSchema.optional(),
|
|
1014
|
+
base_rate: decimalStringSchema.optional(),
|
|
1015
|
+
base_currency: optionalText(8),
|
|
1016
|
+
base_rate_time: dateTimeSchema.optional(),
|
|
1017
|
+
business_types: z.array(z.string().max(64).nullable()).max(4).optional(),
|
|
1018
|
+
ledger_id: uuidSchema.optional(),
|
|
1019
|
+
coa_code: optionalText(50),
|
|
1020
|
+
description: optionalText(512),
|
|
1021
|
+
reference: optionalText(256),
|
|
1022
|
+
attributes: attributeValuesSchema,
|
|
1023
|
+
tax_code: optionalText(64),
|
|
1024
|
+
tax_rate: decimalStringSchema.optional(),
|
|
1025
|
+
ratio: decimalStringSchema.optional(),
|
|
1026
|
+
version: z.number().int().nonnegative().optional(),
|
|
1027
|
+
})
|
|
1028
|
+
.strict()
|
|
1029
|
+
.superRefine((value, context) => {
|
|
1030
|
+
if ((value.offset_type === undefined) !== (value.offset_id === undefined)) {
|
|
1031
|
+
context.addIssue({
|
|
1032
|
+
code: 'custom',
|
|
1033
|
+
path: ['offset_id'],
|
|
1034
|
+
message: 'offset_type and offset_id must be provided or omitted together',
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
});
|
|
1038
|
+
const commonDraftHeadShape = {
|
|
1039
|
+
subtype: draftSubtypeSchema,
|
|
1040
|
+
parent_id: uuidSchema.optional(),
|
|
1041
|
+
source_no: optionalText(50),
|
|
1042
|
+
biz_date: dateSchema.optional(),
|
|
1043
|
+
period_name: z.string().min(1).max(16),
|
|
1044
|
+
ledger_id: uuidSchema,
|
|
1045
|
+
coa_code: optionalText(50),
|
|
1046
|
+
description: optionalText(512),
|
|
1047
|
+
reference: optionalText(256),
|
|
1048
|
+
invoice_no: optionalText(100),
|
|
1049
|
+
usage_qty: decimalStringSchema.optional(),
|
|
1050
|
+
usage_unit: optionalText(32),
|
|
1051
|
+
unit_price: decimalStringSchema.optional(),
|
|
1052
|
+
attributes: attributeValuesSchema,
|
|
1053
|
+
lines: z.array(businessDocumentDraftLineSchema).max(500).default([]),
|
|
1054
|
+
};
|
|
1055
|
+
export const payableDraftValuesSchema = z
|
|
1056
|
+
.object({
|
|
1057
|
+
...commonDraftHeadShape,
|
|
1058
|
+
from_party_id: uuidSchema.optional(),
|
|
1059
|
+
document_no: optionalText(50),
|
|
1060
|
+
to_party_id: uuidSchema.optional(),
|
|
1061
|
+
to_party_address_id: uuidSchema.optional(),
|
|
1062
|
+
to_party_payment_method: optionalText(64),
|
|
1063
|
+
to_party_payment_terms: optionalText(128),
|
|
1064
|
+
to_party_payment_term_date: dateTimeSchema.optional(),
|
|
1065
|
+
to_party_payee_account_no: optionalText(128),
|
|
1066
|
+
to_party_payee_account_name: optionalText(200),
|
|
1067
|
+
to_party_swift_code: optionalText(64),
|
|
1068
|
+
})
|
|
1069
|
+
.strict();
|
|
1070
|
+
export const receivableDraftValuesSchema = z
|
|
1071
|
+
.object({
|
|
1072
|
+
...commonDraftHeadShape,
|
|
1073
|
+
to_party_id: uuidSchema.optional(),
|
|
1074
|
+
document_no: optionalText(50),
|
|
1075
|
+
from_party_id: uuidSchema.optional(),
|
|
1076
|
+
from_party_address_id: uuidSchema.optional(),
|
|
1077
|
+
from_party_collection_method: optionalText(64),
|
|
1078
|
+
from_party_collection_terms: optionalText(128),
|
|
1079
|
+
from_party_collection_term_date: dateTimeSchema.optional(),
|
|
1080
|
+
from_party_payer_account_no: optionalText(128),
|
|
1081
|
+
from_party_payer_account_name: optionalText(200),
|
|
1082
|
+
from_party_swift_code: optionalText(64),
|
|
1083
|
+
})
|
|
1084
|
+
.strict();
|
|
1085
|
+
export const payableCreateValuesSchema = payableDraftValuesSchema.extend({
|
|
1086
|
+
attachment_file_ids: z.array(uuidSchema).max(10).optional(),
|
|
1087
|
+
});
|
|
1088
|
+
export const receivableCreateValuesSchema = receivableDraftValuesSchema.extend({
|
|
1089
|
+
attachment_file_ids: z.array(uuidSchema).max(10).optional(),
|
|
1090
|
+
});
|
|
1091
|
+
const writeContextSchema = z.object({ org_id: uuidSchema }).strict();
|
|
1092
|
+
export const saveBusinessDocumentDraftInputSchema = z.discriminatedUnion('document_type', [
|
|
1093
|
+
z
|
|
1094
|
+
.object({
|
|
1095
|
+
document_type: z.literal('payable'),
|
|
1096
|
+
context: writeContextSchema,
|
|
1097
|
+
idempotency_key: uuidSchema,
|
|
1098
|
+
mutation: z.discriminatedUnion('operation', [
|
|
1099
|
+
z
|
|
1100
|
+
.object({
|
|
1101
|
+
operation: z.literal('create'),
|
|
1102
|
+
values: payableCreateValuesSchema,
|
|
1103
|
+
})
|
|
1104
|
+
.strict(),
|
|
1105
|
+
z
|
|
1106
|
+
.object({
|
|
1107
|
+
operation: z.literal('update'),
|
|
1108
|
+
document_id: uuidSchema,
|
|
1109
|
+
version: z.number().int().nonnegative(),
|
|
1110
|
+
values: payableDraftValuesSchema,
|
|
1111
|
+
})
|
|
1112
|
+
.strict(),
|
|
1113
|
+
]),
|
|
1114
|
+
})
|
|
1115
|
+
.strict(),
|
|
1116
|
+
z
|
|
1117
|
+
.object({
|
|
1118
|
+
document_type: z.literal('receivable'),
|
|
1119
|
+
context: writeContextSchema,
|
|
1120
|
+
idempotency_key: uuidSchema,
|
|
1121
|
+
mutation: z.discriminatedUnion('operation', [
|
|
1122
|
+
z
|
|
1123
|
+
.object({
|
|
1124
|
+
operation: z.literal('create'),
|
|
1125
|
+
values: receivableCreateValuesSchema,
|
|
1126
|
+
})
|
|
1127
|
+
.strict(),
|
|
1128
|
+
z
|
|
1129
|
+
.object({
|
|
1130
|
+
operation: z.literal('update'),
|
|
1131
|
+
document_id: uuidSchema,
|
|
1132
|
+
version: z.number().int().nonnegative(),
|
|
1133
|
+
values: receivableDraftValuesSchema,
|
|
1134
|
+
})
|
|
1135
|
+
.strict(),
|
|
1136
|
+
]),
|
|
1137
|
+
})
|
|
1138
|
+
.strict(),
|
|
1139
|
+
]);
|
|
1140
|
+
export const saveBusinessDocumentDraftOutputSchema = successEnvelopeSchema(z
|
|
1141
|
+
.object({
|
|
1142
|
+
operation: z.enum(['created', 'updated']),
|
|
1143
|
+
document_type: businessDocumentTypeSchema,
|
|
1144
|
+
document: z
|
|
1145
|
+
.object({
|
|
1146
|
+
id: uuidSchema,
|
|
1147
|
+
document_no: z.string().nullable(),
|
|
1148
|
+
version: z.number().int().nonnegative().nullable(),
|
|
1149
|
+
})
|
|
1150
|
+
.strict(),
|
|
1151
|
+
})
|
|
1152
|
+
.strict());
|
|
1153
|
+
//# sourceMappingURL=business-documents.js.map
|