jaz-clio 5.52.1 → 5.52.3
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/assets/skills/api/SKILL.md +2 -2
- package/assets/skills/api/references/full-api-surface.md +1 -1
- package/assets/skills/api/references/search-enums.md +1 -1
- package/assets/skills/api/references/search-reference.md +1 -1
- package/assets/skills/cli/SKILL.md +1 -1
- package/assets/skills/conversion/SKILL.md +1 -1
- package/assets/skills/jaz-kit/SKILL.md +1 -1
- package/assets/skills/jaz-pseudo-sql/SKILL.md +1 -1
- package/assets/skills/jobs/SKILL.md +1 -1
- package/assets/skills/transaction-recipes/SKILL.md +1 -1
- package/cli.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jaz-api
|
|
3
|
-
version: 5.52.
|
|
3
|
+
version: 5.52.3
|
|
4
4
|
description: >-
|
|
5
5
|
Use this skill whenever you call, debug, or review code that touches the Jaz
|
|
6
6
|
REST API. Covers field names, response shapes, 159 production gotchas, error
|
|
@@ -185,7 +185,7 @@ The rest of this skill — field names, gotchas, error catalog, dependency order
|
|
|
185
185
|
51. **Filter operator reference** — An operator the target type does not declare is now rejected with a 400 naming it, not ignored, so use the exact set. String: `eq`, `neq`, `contains`, `notContains`, `in` (array, max 100), `likeIn` (array, max 100), `reg` (substring array, max 100 — a term match despite the name, not a regex), `startWith`, `notStartWith`, `endWith`, `notEndWith`, `isNull`, `isBlank`, `isNotBlank` (each takes the **string** `"true"`/`"false"`, not a bool). Numeric: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `in`, `inRange`/`notInRange` (exactly 2 values, low then high). Date (YYYY-MM-DD): `eq`, `gt`, `gte`, `lt`, `lte`, `between`/`notBetween` (exactly 2 values), `isNull`, `isNotNull`. DateTime (RFC3339): `eq`, `gt`, `gte`, `lt`, `lte`, `between`, converted to epoch ms internally. Boolean: `eq`. JSON: `jsonIn`, `jsonNotIn`. Logical: `and`/`or` objects everywhere; `andGroup`/`orGroup` arrays on invoices, bills, journals, cashflow transactions, payments, batch payments and the order family (orders, quotes, requests, line items) — **not** on credit notes. `not` exists only on contacts, items, tags, custom fields, tax profiles and nano classifiers; it is **not** available on invoices, bills or journals.
|
|
186
186
|
52. **Date format asymmetry (CRITICAL)** — Request dates: `YYYY-MM-DD` strings (all create/update and DateExpression filters). Request datetimes: RFC3339 strings (DateTimeExpression filters for `createdAt`, `updatedAt`, `approvedAt`, `submittedAt`). **ALL response dates**: `int64` epoch milliseconds — including `valueDate`, `createdAt`, `updatedAt`, `approvedAt`, `submittedAt`, `matchDate`. Convert: `new Date(epochMs).toISOString().slice(0,10)`. **Timezone convention**: ALL business dates (`valueDate`, `dueDate`, `startDate`, `endDate`, etc.) are in the **organization's timezone** — never UTC. The epoch ms stored in the DB represents the org-local date (no timezone conversion is ever needed). Only audit timestamps (`createdAt`, `updatedAt`, `action_at`) are UTC.
|
|
187
187
|
53. **Field aliases on create endpoints** — Middleware transparently maps: `issueDate`/`date` → `valueDate` (invoices, bills, credit notes, journals). `name` → `tagName` (tags) or `internalName` (items). `paymentDate` → `valueDate`, `bankAccountResourceId` → `accountResourceId` (payments). `paymentAmount` → `refundAmount`, `paymentMethod` → `refundMethod` (credit note refunds). `accountType` → `classificationType`, `currencyCode` → `currency` (CoA). Canonical names always work; aliases are convenience only.
|
|
188
|
-
54. **All search/list responses are flat** — every search and list endpoint returns `{ totalElements, totalPages, data: [...] }` directly (no outer `data` wrapper). Access the array via `response.data`, pagination via `response.totalElements`. **
|
|
188
|
+
54. **All search/list responses are flat** — every search and list endpoint returns `{ totalElements, totalPages, data: [...] }` directly (no outer `data` wrapper). Access the array via `response.data`, pagination via `response.totalElements`. **Four exceptions**: (a) `GET /bank-accounts` returns a plain array `[{...}]` (see Rule 18), (b) `GET /invoices/:id` returns a flat object `{...}` (no `data` wrapper) — unlike `GET /bills/:id`, `GET /contacts/:id`, `GET /journals/:id` which wrap in `{ data: {...} }`. Normalize the invoice GET response before use. (c) **The empty-result envelope on the scheduled-\* handlers changes shape**: when the upstream search block comes back null, eight handlers short-circuit to `{ "data": [], "pagination": { "total": 0 } }` — no `totalElements`, no `totalPages`, and a third pagination key name. The SAME endpoint returns the normal flat envelope the moment one row exists. Affected: list AND attachment-list on scheduled invoices, scheduled bills, scheduled journals, scheduled subscriptions. **Never read `totalElements` on a scheduled-\* response without falling back to `pagination.total`** — `response.totalElements ?? response.pagination?.total ?? 0` — and count rows off `data.length`, which is correct in both shapes. (d) **`GET /organization-report-template` returns its rows under `reportTemplates`, not `data`, and carries no counts** — measured 2026-09-06 against an org holding 12 templates, where `data` was `[]` and `totalElements` `0`. The `list_organization_report_templates` tool normalizes it, so read `.data` as usual; the raw endpoint does not. Its own `/search` sibling IS conventional. The endpoint also ignores `limit`/`offset` entirely (probed at 1, 3 and 100 — 12 rows every time), so it returns everything in one response.
|
|
189
189
|
55. **Scheduled endpoints support date aliases** — `txnDateAliases` middleware (mapping `issueDate`/`date` → `valueDate`) now applies to all scheduled create/update endpoints: `POST/PUT /scheduled/invoices`, `POST/PUT /scheduled/bills`, `POST/PUT /scheduled/journals`, `POST/PUT /scheduled/subscriptions`.
|
|
190
190
|
56. **Kebab-case URL aliases** — `capsuleTypes` endpoints also accept kebab-case paths: `/capsule-types` (list, search, CRUD). `moveTransactionCapsules` also accepts `/move-transaction-capsules`. Both camelCase and kebab-case work identically.
|
|
191
191
|
|
|
@@ -642,7 +642,7 @@ All 28 `POST /*/search` endpoints accept this filter structure in the POST body:
|
|
|
642
642
|
|
|
643
643
|
### Pagination
|
|
644
644
|
|
|
645
|
-
See `endpoints.md` § "Pagination (All List Endpoints)" for the full spec (limit/offset semantics, defaults, constraints, sort requirement, examples). Key points: `offset` is a 0-indexed page number (not row-skip), default limit=100, max 1000, sort required on POST /search when offset is present. Exception: `organization-report-template
|
|
645
|
+
See `endpoints.md` § "Pagination (All List Endpoints)" for the full spec (limit/offset semantics, defaults, constraints, sort requirement, examples). Key points: `offset` is a 0-indexed page number (not row-skip), default limit=100, max 1000, sort required on POST /search when offset is present. Exception: `GET organization-report-template` returns rows under a `reportTemplates` key with no counts (its /search is conventional); the tools normalize it to the standard envelope.
|
|
646
646
|
|
|
647
647
|
### Date Format Asymmetry (CRITICAL)
|
|
648
648
|
|
|
@@ -548,7 +548,7 @@ All search endpoints return:
|
|
|
548
548
|
}
|
|
549
549
|
```
|
|
550
550
|
|
|
551
|
-
**Exception**: `
|
|
551
|
+
**Exception**: `GET /organization-report-template` returns its rows under a `reportTemplates` key, not `data` (measured 2026-09-06). Its `/search` sibling is conventional. The tools normalize the list — read `.data` on both.
|
|
552
552
|
|
|
553
553
|
---
|
|
554
554
|
|
|
@@ -28,7 +28,7 @@ All search endpoints share this identical structure:
|
|
|
28
28
|
|
|
29
29
|
**Response shape**: `{ totalElements, totalPages, data: [...] }` — all search/list endpoints return this flat structure directly (no outer `data` wrapper).
|
|
30
30
|
|
|
31
|
-
> **Exception**: `POST /organization-report-template/search` returns a
|
|
31
|
+
> **Exception**: the two halves of this family answer differently upstream. `POST /organization-report-template/search` returns a normal `{data, totalElements}` envelope; `GET /organization-report-template` returns its rows under a **`reportTemplates`** key with no counts. Measured 2026-09-06 — an earlier note here said both returned a plain array, and neither does. The tools normalize the list, so you always read `.data`.
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
package/cli.mjs
CHANGED
|
@@ -439,7 +439,7 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
|
|
|
439
439
|
`)?`"${t.replace(/"/g,'""')}"`:t}function XMe(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}function KHt(t,e){let r=e.map(i=>e2(i.header)).join(","),n=t.map(i=>e.map(o=>{let s=ezt(i,o.key);if(s==null||s==="")return"";let a=o.format?XHt(o.format(s)):XMe(s);return e2(a)}).join(","));return[r,...n].join(`
|
|
440
440
|
`)}function ezt(t,e){let r=e.split("."),n=t;for(let i of r){if(n==null||typeof n!="object")return;n=n[i]}return n}function et(t,e,r,n){let i=Xp(r),o=t.totalElements??t.data.length;switch(i){case"json":console.log(uK({...t,totalElements:o},r));break;case"csv":console.log(KHt(t.data,e));break;case"yaml":console.log((0,cK.stringify)({totalElements:o,totalPages:t.totalPages,truncated:t.truncated,...t.stats?{stats:t.stats}:{},data:t.data}).trimEnd());break;case"table":{console.log(R(`${n} (${t.data.length} of ${o}):
|
|
441
441
|
`));let{items:s,overflow:a}=lK(t.data);if(s.length===0){console.log(" No results found.");return}console.log(gg(s,e)),a>0&&console.log(H(`
|
|
442
|
-
... and ${a.toLocaleString()} more (use --format json for full output)`));break}}}function bS(t,e){switch(Xp(e)){case"json":console.log(JSON.stringify(t,null,2));break;case"csv":{let n=Object.keys(t);console.log(n.map(e2).join(",")),console.log(n.map(i=>e2(XMe(t[i]))).join(","));break}case"yaml":console.log((0,cK.stringify)(t).trimEnd());break;case"table":console.log(WMe(t));break}}var cK,yg,dr=X(()=>{"use strict";Oe();sp();cK=sn(GMe(),1);aK();ln();ZMe();yg=class extends No{constructor(e){super(e),this.name="CliValidationError"}}});var tPe={};So(tPe,{displaySlice:()=>lK,paginatedFetch:()=>ot,paginatedJson:()=>uK});async function ot(t,e,r){let n=r.defaultLimit??100;if(t.all&&t.offset!==void 0)throw new Error("--all and --offset cannot be used together");if(t.all){let d=(t.format?.toLowerCase()??(t.json?"json":"table"))==="table"?iQe(r.label):void 0,f=t.maxRows??ePe,p=await Pp((y,C)=>e({limit:C,offset:y}),{pageSize:t.limit??200,maxItems:f,onProgress:d?(y,C)=>d.update(y,C):void 0});d?.clear();let{truncated:h}=p,{data:m}=p;m.length>f&&(m=m.slice(0,f),h=!0),h&&!Ml(t)&&console.error(ke(`Warning: dataset has ${p.totalElements.toLocaleString()} items \u2014 showing ${m.length.toLocaleString()} (max-rows: ${f.toLocaleString()})`));let A=t.limit??n,g=Math.ceil(p.totalElements/A);return{data:m,totalElements:p.totalElements,totalPages:g,truncated:h}}let i=t.limit??n,o=await e({limit:i,offset:t.offset??0}),s=o.data??[],a=(o.totalElements??0)>s.length;return{data:s,totalElements:o.totalElements??0,totalPages:o.totalPages??0,truncated:a}}function lK(t,e=tzt){return t.length<=e?{items:t,overflow:0}:{items:t.slice(0,e),overflow:t.length-e}}function uK(t,e){let{totalElements:r,totalPages:n,truncated:i,data:o,stats:s}=t,a=s?{stats:s}:{};if(i){let c=e.maxRows??ePe;return JSON.stringify({totalElements:r,totalPages:n,truncated:i,_meta:{fetchedRows:o.length,maxRows:c},...a,data:o},null,2)}return JSON.stringify({totalElements:r,totalPages:n,truncated:i,...a,data:o},null,2)}var ePe,tzt,ln=X(()=>{"use strict";Oe();HM();oQe();dr();ePe=1e3,tzt=500});async function rzt(){if(!dK){let[t,e,r,n]=await Promise.all([Promise.resolve().then(()=>(ft(),sPe)),Promise.resolve().then(()=>(ln(),tPe)),Promise.resolve().then(()=>(dr(),KMe)),Promise.resolve().then(()=>(_t(),awe))]);dK=t.apiAction,rPe=e.paginatedFetch,nPe=r.outputList,fK=n.parsePositiveInt,iPe=n.parseNonNegativeInt}}function Ye(t){let e=t.commandName??"search",r=t.positionalArg?` <${t.positionalArg}>`:"",n=t.parent.command(`${e}${r}`).description(`Search ${t.label.replace("Searching ","")}`);n.allowExcessArguments(!1);let i=new Map,o=lZ(t.fields);for(let[a,c,u,d]of o){let f=new Pt(a,c),p=t.fields[d];u&&p?.op!=="multi"&&f.choices(u),n.addOption(f);let h=nzt(a);h!==d&&i.set(h,d)}if(t.defaults.supportsQuery&&n.option("--query <expression>",'Jaz search expression (e.g. "status:unpaid AND $500+", "customer:acme AND date:-30d"). Merged with --filter; --filter fields win on conflict.'),n.option("--filter <json>","Raw API filter JSON (merged with flags; flags win on conflict)").addOption(new Pt("--sort <field>","Sort field name")).addOption(new Pt("--order <direction>","Sort direction").choices(["ASC","DESC"])).option("--limit <n>",`Max results (default ${t.defaults.defaultLimit})`).option("--offset <n>","Page number offset (0-indexed)").option("--all","Fetch all pages").option("--max-rows <n>","Max rows for --all (default 1000)").option("--format <type>","Output format: table, json, csv, yaml").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON"),t.defaults.supportsView&&n.addOption(new Pt("--view <tier>","Payload tier: 'lean' = summary rows; 'full' (default) = complete records").choices(["lean","full"])),t.pathParam&&t.pathParam!==t.positionalArg){let a=t.pathParam.replace(/([A-Z])/g,"-$1").toLowerCase();n.requiredOption(`--${a} <id>`,t.pathParamDescription??`${t.pathParam} (required)`)}let s=async(...a)=>{let c=t.positionalArg?a[0]:void 0,u=t.positionalArg?a[1]:a[0];c&&t.positionalArg&&(u[t.positionalArg]=c),await rzt(),await dK(async d=>{t.preProcess&&await t.preProcess(d,u),typeof u.limit=="string"&&(u.limit=fK(u.limit)),typeof u.offset=="string"&&(u.offset=iPe(u.offset)),typeof u.maxRows=="string"&&(u.maxRows=fK(u.maxRows));let f={...u};for(let[v,x]of i)f[v]!==void 0&&(f[x]=f[v]);let p;if(typeof u.filter=="string")try{p=JSON.parse(u.filter)}catch{throw new Error(`Invalid --filter JSON: ${u.filter}`)}let h=t.baseFilter?p?{...t.baseFilter,...p}:t.baseFilter:p,m=OD(f,t.fields,h),A;if(c&&t.positionalFilter){let v=t.positionalFilter(c);A=m?{...v,...m}:v}else A=m;let g={sortBy:[u.sort??t.defaults.sortBy],order:u.order??t.defaults.sortOrder},y=t.defaults.supportsQuery?u.query:void 0,C=t.defaults.supportsView?u.view:void 0,E=t.pathParam?({limit:v,offset:x})=>t.fetcher(d,u[t.pathParam],{filter:A,sort:g,limit:v,offset:x,query:y,view:C}):({limit:v,offset:x})=>t.fetcher(d,{filter:A,sort:g,limit:v,offset:x,query:y,view:C}),I=await rPe(u,E,{label:t.label,defaultLimit:t.defaults.defaultLimit});nPe(I,t.columns,u,t.label.replace("Searching ",""))})(u)};return n.action(s),n}function nzt(t){return t.replace(/^--/,"").split(/[\s<]/)[0].replace(/-([a-z])/g,(r,n)=>n.toUpperCase())}var dK,rPe,nPe,fK,iPe,oPe=X(()=>{"use strict";is();uZ();YM()});var LC,MC,CS,IS,aPe=X(()=>{"use strict";ca();LC={reference:{path:"reference",op:"contains",type:"string",description:"Invoice reference number"},status:{path:"status",op:"multi",type:"string",description:"Status (comma-separated for OR)",enum:xFe},contactName:{path:"contact.name",op:"contains",type:"string",description:"Contact/customer name"},contactId:{path:"contactResourceId",op:"eq",type:"string",description:"Contact resourceId"},tag:{path:"tags",op:"eq",type:"string",description:"Tag name",cliFlag:"--tag <name>"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code (e.g., SGD, USD)"},approvalStatus:{path:"approvalStatus",op:"multi",type:"string",description:"Approval status",enum:$M},startDate:{path:"valueDate",op:"gte",type:"string",description:"On/after (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On/before (YYYY-MM-DD)",cliFlag:"--to <date>"},dueDateFrom:{path:"dueDate",op:"gte",type:"string",description:"Due date from (YYYY-MM-DD)"},dueDateTo:{path:"dueDate",op:"lte",type:"string",description:"Due date to (YYYY-MM-DD)"},minAmount:{path:"totalAmount",op:"gte",type:"number",description:"Minimum total amount"},maxAmount:{path:"totalAmount",op:"lte",type:"number",description:"Maximum total amount"}},MC={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0},CS=LC,IS=MC});var cPe,vS,wS,PC,_S,Kp,eh,lPe=X(()=>{"use strict";ca();cPe={reference:{path:"reference",op:"contains",type:"string",description:"Order reference number"},contactName:{path:"contact.name",op:"contains",type:"string",description:"Contact (customer/supplier) name"},contactId:{path:"contactResourceId",op:"eq",type:"string",description:"Contact resourceId"},tag:{path:"tags",op:"eq",type:"string",description:"Tag name",cliFlag:"--tag <name>"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code (e.g., SGD, USD)"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On/after (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On/before (YYYY-MM-DD)",cliFlag:"--to <date>"},dueDateFrom:{path:"dueDate",op:"gte",type:"string",description:"Due date from (YYYY-MM-DD)"},dueDateTo:{path:"dueDate",op:"lte",type:"string",description:"Due date to (YYYY-MM-DD)"},minAmount:{path:"totalAmount",op:"gte",type:"number",description:"Minimum total amount"},maxAmount:{path:"totalAmount",op:"lte",type:"number",description:"Maximum total amount"}},vS={status:{path:"status",op:"multi",type:"string",description:"Status (comma-separated for OR)",enum:HFe},...cPe},wS={status:{path:"status",op:"multi",type:"string",description:"Status (comma-separated for OR)",enum:zFe},...cPe},PC={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0},_S=PC,Kp={name:{path:"name",op:"contains",type:"string",description:"Line item text/description"},reference:{path:"reference",op:"contains",type:"string",description:"Parent order reference"},orderId:{path:"btResourceId",op:"eq",type:"string",description:"Parent order resourceId"},contactName:{path:"contactName",op:"contains",type:"string",description:"Contact (customer/supplier) name"},contactId:{path:"contactResourceId",op:"eq",type:"string",description:"Contact resourceId"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code (e.g., SGD, USD)"},status:{path:"status",op:"eq",type:"string",description:"Line item status"},account:{path:"organizationAccountName",op:"contains",type:"string",description:"Chart-of-account name on the line"},taxProfile:{path:"taxProfileName",op:"contains",type:"string",description:"Tax profile name on the line"},isOpen:{path:"isOpen",op:"boolean",type:"boolean",description:"Only open (unfulfilled) lines"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On/after (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On/before (YYYY-MM-DD)",cliFlag:"--to <date>"},minAmount:{path:"totalItemAmount",op:"gte",type:"number",description:"Minimum line amount"},maxAmount:{path:"totalItemAmount",op:"lte",type:"number",description:"Maximum line amount"}},eh={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,supportsQuery:!0}});var th,UC,DS,uPe=X(()=>{"use strict";ca();th={reference:{path:"reference",op:"contains",type:"string",description:"Credit note reference"},status:{path:"status",op:"multi",type:"string",description:"Status (comma-separated for OR)",enum:TFe},contactName:{path:"contact.name",op:"contains",type:"string",description:"Contact name"},contactId:{path:"contactResourceId",op:"eq",type:"string",description:"Contact resourceId"},tag:{path:"tags",op:"eq",type:"string",description:"Tag name",cliFlag:"--tag <name>"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code"},approvalStatus:{path:"approvalStatus",op:"multi",type:"string",description:"Approval status",enum:$M},startDate:{path:"valueDate",op:"gte",type:"string",description:"On or after this date (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On or before this date (YYYY-MM-DD)",cliFlag:"--to <date>"}},UC={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0},DS=UC});var SS,RS,dPe=X(()=>{"use strict";ca();SS={reference:{path:"reference",op:"contains",type:"string",description:"Journal reference"},status:{path:"status",op:"multi",type:"string",description:"Status",enum:BFe},type:{path:"type",op:"multi",type:"string",description:"Journal type",enum:kFe},templateType:{path:"templateType",op:"multi",type:"string",description:"Template type",enum:NFe},tag:{path:"tags",op:"eq",type:"string",description:"Tag name",cliFlag:"--tag <name>"},contactName:{path:"contact.name",op:"contains",type:"string",description:"Contact name"},internalNotes:{path:"internalNotes",op:"contains",type:"string",description:"Search internal notes"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On or after this date (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On or before this date (YYYY-MM-DD)",cliFlag:"--to <date>"}},RS={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0}});var xS,TS,fPe=X(()=>{"use strict";ca();xS={name:{path:"name",op:"contains",type:"string",description:"Contact name"},email:{path:"email",op:"contains",type:"string",description:"Email address"},status:{path:"status",op:"multi",type:"string",description:"Status",enum:UM},isCustomer:{path:"customer",op:"boolean",type:"boolean",description:"Filter to customers only",cliFlag:"--customer"},isSupplier:{path:"supplier",op:"boolean",type:"boolean",description:"Filter to suppliers only",cliFlag:"--supplier"},taxId:{path:"taxId",op:"contains",type:"string",description:"Tax ID"}},TS={sortBy:"name",sortOrder:"ASC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0}});var sf,af,pK,BS,kS,pPe=X(()=>{"use strict";ca();sf={type:{path:"businessTransactionType",op:"multi",type:"string",description:"Transaction type",enum:qM},direction:{path:"direction",op:"eq",type:"string",description:"Direction (PAYIN or PAYOUT)",enum:sZ},status:{path:"businessTransactionStatus",op:"multi",type:"string",description:"Status",enum:PFe},reference:{path:"businessTransactionReference",op:"contains",type:"string",description:"Reference",cliFlag:"--ref <reference>"},accountId:{path:"organizationAccountResourceId",op:"eq",type:"string",description:"Bank account resourceId",cliFlag:"--account <id>"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On or after this date (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On or before this date (YYYY-MM-DD)",cliFlag:"--to <date>"},businessTransactionType:{path:"businessTransactionType",op:"multi",type:"string",description:"(alias for type)"}},af={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,supportsQuery:!0},pK={magicSort:{type:"object",description:"Rank by match quality to a bank entry: {bankStatementEntryResourceId, magicSort:true}."},transactionType:{type:"string",enum:[...MFe],description:"Scope. Default ALL_CASHFLOWS."}},BS={type:{path:"businessTransactionType",op:"multi",type:"string",description:"Transaction type (SALE, PURCHASE, etc.)",enum:qM},direction:{path:"direction",op:"eq",type:"string",description:"Direction",enum:sZ},reference:{path:"businessTransactionReference",op:"contains",type:"string",description:"Reference",cliFlag:"--ref <reference>"},accountId:{path:"organizationAccountResourceId",op:"eq",type:"string",description:"Account resourceId",cliFlag:"--account <id>"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On or after this date (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On or before this date (YYYY-MM-DD)",cliFlag:"--to <date>"},businessTransactionType:{path:"businessTransactionType",op:"multi",type:"string",description:"(alias for type)",enum:qM},fromDate:{path:"valueDate",op:"gte",type:"string",description:"(alias for startDate)"},toDate:{path:"valueDate",op:"lte",type:"string",description:"(alias for endDate)"},accountResourceId:{path:"organizationAccountResourceId",op:"eq",type:"string",description:"(alias for accountId)"}},kS={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20}});var NS,OS,hPe=X(()=>{"use strict";ca();NS={status:{path:"status",op:"multi",type:"string",description:"Status",enum:LFe},description:{path:"description",op:"contains",type:"string",description:"Description"},payer:{path:"extContactName",op:"contains",type:"string",description:"Payer/payee name"},reference:{path:"extReference",op:"contains",type:"string",description:"Bank reference",cliFlag:"--ref <reference>"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On or after this date (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On or before this date (YYYY-MM-DD)",cliFlag:"--to <date>"},minAmount:{path:"netAmount",op:"gte",type:"number",description:"Minimum net amount"},maxAmount:{path:"netAmount",op:"lte",type:"number",description:"Maximum net amount"}},OS={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,supportsQuery:!0}});var FS,QS,mPe=X(()=>{"use strict";ca();FS={status:{path:"status",op:"multi",type:"string",description:"Status",enum:OFe},itemCategory:{path:"itemCategory",op:"eq",type:"string",description:"Category",enum:QFe},appliesToSale:{path:"appliesToSale",op:"boolean",type:"boolean",description:"Filter to sale items only",cliFlag:"--sale"},appliesToPurchase:{path:"appliesToPurchase",op:"boolean",type:"boolean",description:"Filter to purchase items only",cliFlag:"--purchase"}},QS={sortBy:"internalName",sortOrder:"ASC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0}});var LS,MS,APe=X(()=>{"use strict";ca();LS={name:{path:"name",op:"contains",type:"string",description:"Asset name"},reference:{path:"reference",op:"contains",type:"string",description:"Reference",cliFlag:"--ref <reference>"},status:{path:"status",op:"multi",type:"string",description:"Status",enum:UFe},category:{path:"category",op:"eq",type:"string",description:"Category",enum:$Fe},tag:{path:"tags",op:"eq",type:"string",description:"Tag name",cliFlag:"--tag <name>"},typeName:{path:"typeName",op:"contains",type:"string",description:"Asset type name"},startDate:{path:"purchaseDate",op:"gte",type:"string",description:"Purchase date from (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"purchaseDate",op:"lte",type:"string",description:"Purchase date to (YYYY-MM-DD)",cliFlag:"--to <date>"},minAmount:{path:"purchaseAmount",op:"gte",type:"number",description:"Minimum purchase amount"},maxAmount:{path:"purchaseAmount",op:"lte",type:"number",description:"Maximum purchase amount"}},MS={sortBy:"name",sortOrder:"ASC",defaultLimit:20,supportsQuery:!0}});var PS,US,gPe=X(()=>{"use strict";ca();PS={type:{path:"businessTransactionType",op:"eq",type:"string",description:"Transaction type (SALE, PURCHASE, JOURNAL_MANUAL)"},status:{path:"status",op:"multi",type:"string",description:"Scheduler status",enum:qFe},subscriptionStatus:{path:"subscriptionStatus",op:"multi",type:"string",description:"Subscription status",enum:jFe},schedulerType:{path:"schedulerType",op:"eq",type:"string",description:"Scheduler type"},interval:{path:"interval",op:"eq",type:"string",description:"Interval",enum:YFe},contactName:{path:"contact.name",op:"contains",type:"string",description:"Contact name"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code"}},US={sortBy:"nextScheduleDate",sortOrder:"ASC",defaultLimit:20,supportsQuery:!0}});var $S,qS,yPe=X(()=>{"use strict";ca();$S={id:{path:"resourceId",op:"eq",type:"string",description:"Job ID (the jobId returned from bulk operations)",cliFlag:"--id"},status:{path:"status",op:"multi",type:"string",description:"Job status",enum:ZFe},type:{path:"jobType",op:"eq",type:"string",description:"Job type (e.g. UPSERT_CONTACTS, UPSERT_ITEMS, PROCESS_BANK_STATEMENT_FILES)",cliFlag:"--type"},fileName:{path:"fileName",op:"contains",type:"string",description:"File name (file-based jobs only)",cliFlag:"--file-name"},from:{path:"createdAt",op:"gte",type:"string",description:"On/after (ISO date)",cliFlag:"--from"},to:{path:"createdAt",op:"lte",type:"string",description:"On/before (ISO date)",cliFlag:"--to"}},qS={sortBy:"createdAt",sortOrder:"DESC",defaultLimit:20}});var jS,YS,EPe=X(()=>{"use strict";jS={name:{path:"name",op:"plain",type:"string",description:"Purchase item name"},reference:{path:"reference",op:"plain",type:"string",description:"Reference name"},currencyCode:{path:"currencyCode",op:"plain",type:"string",description:"Currency code (ISO 4217)"}},YS={sortBy:"name",sortOrder:"ASC",defaultLimit:20}});var HS,zS,hK,mK,bPe=X(()=>{"use strict";HS={catalogName:{path:"catalogName",op:"contains",type:"string",description:"Catalog name"},description:{path:"description",op:"contains",type:"string",description:"Catalog item description"},status:{path:"status",op:"multi",type:"string",description:"Record status (e.g. ACTIVE, INACTIVE)"},contactGroupResourceId:{path:"contactGroupResourceId",op:"eq",type:"string",description:"Contact group resourceId"}},zS={sortBy:"catalogName",sortOrder:"ASC",defaultLimit:20,supportsQuery:!0},hK={reportType:{path:"reportType",op:"plain",type:"string",description:"Report type"},reportCategory:{path:"reportCategory",op:"eq",type:"string",description:"Report category"},isDefault:{path:"isDefault",op:"boolean",type:"boolean",description:"Only default templates",cliFlag:"--default"}},mK={sortBy:"reportType",sortOrder:"ASC",defaultLimit:20}});async function t2(t,e){return t.search("/api/v1/claims/search",e)}async function r2(t,e){return t.get(`/api/v1/claims/${e}`)}async function n2(t,e){return t.post("/api/v1/claims",e)}async function i2(t,e,r){return t.put(`/api/v1/claims/${e}`,r)}async function o2(t,e){return t.delete(`/api/v1/claims/${e}`)}async function s2(t,e,r){return t.delete(`/api/v1/claims/${e}/attachments/${r}`)}async function a2(t,e){return t.post(`/api/v1/claims/${e}/submit`,{})}async function c2(t,e){return t.post(`/api/v1/claims/${e}/approve`,{})}async function l2(t,e,r){return t.post(`/api/v1/claims/${e}/reject`,{rejectionReason:r})}async function u2(t,e,r){return t.post(`/api/v1/claims/${e}/cancel`,{cancellationReason:r})}async function d2(t,e){return t.post(`/api/v1/claims/${e}/unpost`,{})}function GS(t){Ot(t,"resourceIds",500,"claims")}async function f2(t,e){return GS(e),t.post("/api/v1/claims/bulk/submit",{resourceIds:e})}async function p2(t,e){return GS(e),t.post("/api/v1/claims/bulk/approve",{resourceIds:e})}async function h2(t,e){return GS(e),t.post("/api/v1/claims/bulk/delete",{resourceIds:e})}async function m2(t,e,r){return GS(e),t.post("/api/v1/claims/bulk/reject",{resourceIds:e,rejectionReason:r})}async function A2(t,e,r){return GS(e),t.post("/api/v1/claims/bulk/cancel",{resourceIds:e,cancellationReason:r})}async function g2(t){let e=await t.get("/api/v1/claims/tracking-tags");return Array.isArray(e)?e:e?.data??[]}async function y2(t){let e=await t.get("/api/v1/claims/custom-field-values");return Array.isArray(e)?e:e?.data??[]}var CPe,E2=X(()=>{"use strict";En();CPe=["DRAFT","SUBMITTED","APPROVED","CONVERTED","REJECTED","CANCELLED"]});var JS,VS,izt,ozt,WS,ZS,XS,KS,eR,tR,rR,nR,IPe=X(()=>{"use strict";f_();m_();E2();JS={status:{path:"status",op:"multi",type:"string",description:"Status (comma-separated for OR)",enum:CPe},employeeResourceId:{path:"employeeResourceId",op:"eq",type:"string",description:"Employee resourceId"},contactResourceId:{path:"contactResourceId",op:"eq",type:"string",description:"Vendor contact resourceId"},claimProfileResourceId:{path:"claimProfileResourceId",op:"eq",type:"string",description:"Claim profile resourceId"},approverUserResourceId:{path:"approverUserResourceId",op:"eq",type:"string",description:"Approver user resourceId"},reference:{path:"reference",op:"contains",type:"string",description:"Claim reference"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code (ISO 4217)"},startDate:{path:"valueDate",op:"gte",type:"string",description:"Value date on/after (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"Value date on/before (YYYY-MM-DD)",cliFlag:"--to <date>"},createdFrom:{path:"createdAt",op:"gte",type:"string",description:"Created on/after (YYYY-MM-DD)"},createdTo:{path:"createdAt",op:"lte",type:"string",description:"Created on/before (YYYY-MM-DD)"},minAmount:{path:"totalAmount",op:"gte",type:"number",description:"Minimum total amount"},maxAmount:{path:"totalAmount",op:"lte",type:"number",description:"Maximum total amount"}},VS={sortBy:"createdAt",sortOrder:"DESC",defaultLimit:20},izt=["RECORDED","COMPLETED","CANCELLED","IN_PROGRESS","ACTION_NEEDED"],ozt=["DIRECT_ENTRY","DISBURSEMENT","REIMBURSEMENT_PAYOUT","ADVANCE"],WS={employeeResourceId:{path:"employeeResourceId",op:"eq",type:"string",description:"Employee resourceId"},employeeName:{path:"employeeName",op:"contains",type:"string",description:"Employee name"},reference:{path:"reference",op:"contains",type:"string",description:"Payout reference"},payoutStatus:{path:"payoutStatus",op:"multi",type:"string",description:"Payout status (comma-separated)",enum:izt},payoutType:{path:"payoutType",op:"multi",type:"string",description:"Payout type (comma-separated): DIRECT_ENTRY (books-only DCE), DISBURSEMENT (gateway direct-debit-backed), REIMBURSEMENT_PAYOUT, ADVANCE",enum:ozt}},ZS={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20},XS={name:{path:"name",op:"contains",type:"string",description:"Claim type name"},isDefault:{path:"isDefault",op:"boolean",type:"boolean",description:"Org default claim type"},expenseAccountResourceId:{path:"expenseAccountResourceId",op:"eq",type:"string",description:"Default expense account resourceId"},taxProfileResourceId:{path:"taxProfileResourceId",op:"eq",type:"string",description:"Default tax profile resourceId"}},KS={sortBy:"name",sortOrder:"ASC",defaultLimit:100},eR={name:{path:"name",op:"contains",type:"string",description:"Claim profile name"},approverUserResourceId:{path:"approverUserResourceId",op:"eq",type:"string",description:"Default approver user resourceId"},isDefault:{path:"isDefault",op:"boolean",type:"boolean",description:"Org default profile"},minClaimAmount:{path:"minClaimAmount",op:"gte",type:"number",description:"Minimum claim total (>=)"},maxClaimAmount:{path:"maxClaimAmount",op:"lte",type:"number",description:"Maximum claim total (<=)"},maxPerPeriodAmount:{path:"maxPerPeriodAmount",op:"lte",type:"number",description:"Per-period spend cap (<=)"},perPeriod:{path:"perPeriod",op:"eq",type:"string",description:"Per-period window",enum:u_},employeeBalanceAccountResourceId:{path:"employeeBalanceAccountResourceId",op:"eq",type:"string",description:"Employee balance (liability) account resourceId"}},tR={sortBy:"name",sortOrder:"ASC",defaultLimit:100},rR={name:{path:"name",op:"contains",type:"string",description:"Posting rule name"},outerAxis:{path:"outerAxis",op:"eq",type:"string",description:"Outer grouping axis",enum:p_},innerAxis:{path:"innerAxis",op:"eq",type:"string",description:"Inner line-aggregation axis",enum:h_},defaultBankAccountResourceId:{path:"defaultBankAccountResourceId",op:"eq",type:"string",description:"Default reimbursement bank account resourceId"},defaultIncludeReimbursementPayout:{path:"defaultIncludeReimbursementPayout",op:"boolean",type:"boolean",description:"Creates reimbursement DCE by default"},isDefault:{path:"isDefault",op:"boolean",type:"boolean",description:"Org default rule"}},nR={sortBy:"name",sortOrder:"ASC",defaultLimit:100}});var iR,oR,sR,aR,vPe=X(()=>{"use strict";A_();iR={name:{path:"name",op:"contains",type:"string",description:"Employee name"},email:{path:"email",op:"contains",type:"string",description:"Work email"},phone:{path:"phone",op:"contains",type:"string",description:"Phone"},userResourceId:{path:"userResourceId",op:"eq",type:"string",description:"Bound login user resourceId"},managerEmployeeResourceId:{path:"managerEmployeeResourceId",op:"eq",type:"string",description:"Manager employee resourceId"},claimProfileResourceId:{path:"claimProfileResourceId",op:"eq",type:"string",description:"Claim profile resourceId"},currency:{path:"currency",op:"eq",type:"string",description:"Balance currency (ISO 4217)"},active:{path:"active",op:"boolean",type:"boolean",description:"Active employees only"},createdFrom:{path:"createdAt",op:"gte",type:"string",description:"Created on/after (YYYY-MM-DD)"},createdTo:{path:"createdAt",op:"lte",type:"string",description:"Created on/before (YYYY-MM-DD)"}},oR={sortBy:"name",sortOrder:"ASC",defaultLimit:50},sR={name:{path:"name",op:"contains",type:"string",description:"Employee name"},email:{path:"email",op:"contains",type:"string",description:"Work email"},phone:{path:"phone",op:"contains",type:"string",description:"Phone"},currency:{path:"currency",op:"eq",type:"string",description:"Balance currency (ISO 4217)"},employmentType:{path:"employmentType",op:"eq",type:"string",description:"Employment type",enum:xA},active:{path:"active",op:"boolean",type:"boolean",description:"Active employees only"}},aR={sortBy:"name",sortOrder:"ASC",defaultLimit:50}});var cR,lR,uR,dR,fR,pR,hR,mR,AR,gR,yR,ER,bR,CR,AK,IR,vR,wR,_R,wPe=X(()=>{"use strict";ca();cR={name:{path:"name",op:"contains",type:"string",description:"Account name"},code:{path:"code",op:"contains",type:"string",description:"Account code"},status:{path:"status",op:"multi",type:"string",description:"Status",enum:FFe},accountClass:{path:"accountClass",op:"eq",type:"string",description:"Account class",enum:GFe},accountType:{path:"accountType",op:"eq",type:"string",description:"Account type",enum:jM},controlFlag:{path:"controlFlag",op:"boolean",type:"boolean",description:"Control flag (system accounts)"}},lR={sortBy:"code",sortOrder:"ASC",defaultLimit:100,supportsQuery:!1},uR={query:{path:"tagName",op:"contains",type:"string",description:"Tag name"}},dR={sortBy:"tagName",sortOrder:"ASC",defaultLimit:100},fR={name:{path:"name",op:"contains",type:"string",description:"Tax profile name",cliFlag:"--name <name>"},taxTypeCode:{path:"taxTypeCode",op:"contains",type:"string",description:"Tax type code"},appliesToSale:{path:"appliesToSale",op:"boolean",type:"boolean",description:"Filter to sale profiles"},appliesToPurchase:{path:"appliesToPurchase",op:"boolean",type:"boolean",description:"Filter to purchase profiles"},appliesToSaleCreditNote:{path:"appliesToSaleCreditNote",op:"boolean",type:"boolean",description:"Filter to sale CN profiles"},appliesToPurchaseCreditNote:{path:"appliesToPurchaseCreditNote",op:"boolean",type:"boolean",description:"Filter to purchase CN profiles"}},pR={sortBy:"name",sortOrder:"ASC",defaultLimit:100,supportsQuery:!0},hR={title:{path:"title",op:"contains",type:"string",description:"Capsule title"},status:{path:"status",op:"multi",type:"string",description:"Status",enum:WFe}},mR={sortBy:"title",sortOrder:"ASC",defaultLimit:20,supportsQuery:!0},AR={query:{path:"customFieldName",op:"contains",type:"string",description:"Custom field name",cliFlag:"--name <name>"},datatypeCode:{path:"datatypeCode",op:"eq",type:"string",description:"Data type",enum:JFe,cliFlag:"--type <type>"},customFieldName:{path:"customFieldName",op:"contains",type:"string",description:"(alias for query)"}},gR={sortBy:"customFieldName",sortOrder:"ASC",defaultLimit:100},yR={query:{path:"name",op:"contains",type:"string",description:"Group name"}},ER={sortBy:"name",sortOrder:"ASC",defaultLimit:100},bR={firstName:{path:"user.firstName",op:"contains",type:"string",description:"User first name"},lastName:{path:"user.lastName",op:"contains",type:"string",description:"User last name"},email:{path:"user.email",op:"contains",type:"string",description:"Email"},userType:{path:"userType",op:"eq",type:"string",description:"Access tier",enum:VFe},status:{path:"status",op:"multi",type:"string",description:"Status",enum:UM}},CR={sortBy:"user.FirstName",sortOrder:"ASC",defaultLimit:50},AK=t=>({or:{user:{firstName:{contains:t}},or:{user:{lastName:{contains:t}}}}}),IR={query:{path:"name",op:"contains",type:"string",description:"Rule name"},account:{path:"appliesToReconciliationAccount",op:"eq",type:"string",description:"Bank account resourceId",cliFlag:"--account <id>"}},vR={sortBy:"name",sortOrder:"ASC",defaultLimit:100},wR={query:{path:"type",op:"contains",type:"string",description:"Classifier type"}},_R={sortBy:"type",sortOrder:"ASC",defaultLimit:100}});var fr=X(()=>{"use strict";ca();YM();uZ();oPe();aPe();lPe();uPe();dPe();fPe();pPe();hPe();mPe();APe();gPe();yPe();EPe();bPe();IPe();vPe();wPe()});async function _Pe(t,e){return t.list("/api/v1/modules",e)}async function DPe(t,e){return t.get(`/api/v1/modules/${encodeURIComponent(e)}`)}var SPe=X(()=>{"use strict"});async function b2(t,e){return t.list("/api/v1/purchase-items",e)}async function C2(t,e){return t.get(`/api/v1/purchase-items/${encodeURIComponent(e)}`)}async function I2(t,e){return t.search("/api/v1/purchase-items/search",e)}var gK=X(()=>{"use strict"});async function v2(t,e){return t.list("/api/v1/invoices",e)}async function Po(t,e){let r=await t.get(`/api/v1/invoices/${e}`);return"data"in r&&typeof r.data=="object"?r:{data:r}}async function $C(t,e){return t.search("/api/v1/invoices/search",e)}async function Eg(t,e){return t.post("/api/v1/invoices",{...e,currency:Sr(e.currency),taxCurrency:Sr(e.taxCurrency),saveAsDraft:e.saveAsDraft??!0})}async function w2(t,e,r){let n=r.lineItems?{...r,lineItems:r.lineItems.map(fp)}:r,i=await bc(n,()=>Po(t,e));return t.put(`/api/v1/invoices/${e}`,i)}async function _2(t,e,r){return t.delete(`/api/v1/invoices/${e}`,r)}async function DR(t,e,r){return t.post(`/api/v1/invoices/${e}/payments`,{...r,currency:Sr(r.currency),saveAsDraft:r.saveAsDraft??!0})}async function SR(t,e){return t.post("/api/v1/scheduled/invoices",{...e,invoice:{...e.invoice,currency:Sr(e.invoice?.currency)}})}async function D2(t,e,r){return t.post(`/api/v1/invoices/${e}/credits`,{credits:r})}async function RR(t,e,r){let n=await bc({...r,resourceId:e,saveAsDraft:!1},()=>Po(t,e));return t.put(`/api/v1/invoices/${e}`,n)}async function S2(t,e){return t.get(`/api/v1/invoices/${e}/download`)}async function R2(t,e){let r=await t.get(`/api/v1/invoices/${e}/payments`);return{data:Array.isArray(r)?r:r.data??[]}}async function x2(t,e){let r=await t.get(`/api/v1/invoices/${e}/credits`);return{data:Array.isArray(r)?r:r.data??[]}}async function T2(t,e,r){await t.delete(`/api/v1/invoices/${e}/credits/${r}`)}async function B2(t,e){return ho(t,"/api/v1/invoices/bulk-upsert","invoices",e)}async function k2(t,e){return ho(t,"/api/v1/invoices/line-items/bulk-upsert","invoices",cp(e))}var bg=X(()=>{"use strict";Zw();DA();En();hr()});async function RPe(t,e,r){return t.list(`/api/v1/${Pl[e]}`,r)}async function cf(t,e,r){return t.get(`/api/v1/${Pl[e]}/${r}`)}async function N2(t,e,r){return t.search(`/api/v1/${Pl[e]}/search`,r)}async function O2(t,e,r){return t.search(`/api/v1/${Pl[e]}/line-items/search`,r)}async function xR(t,e){return t.post("/api/v1/sale-quotes",{...e,saveAsDraft:e.saveAsDraft??!0})}async function TR(t,e){return t.post("/api/v1/sale-orders",e)}async function F2(t,e,r,n){return t.post(`/api/v1/${Pl[e]}/${r}/convert-to-invoice`,n)}async function Q2(t,e,r,n){return t.put(`/api/v1/${Pl[e]}/${r}`,n)}async function L2(t,e,r){await t.delete(`/api/v1/${Pl[e]}/${r}`)}async function M2(t,e,r,n){return t.post(`/api/v1/${Pl[e]}/${r}/void`,n?{internalNotes:n}:{})}async function P2(t,e){return t.post(`/api/v1/sale-quotes/${e}/accept`,{})}async function U2(t,e){return t.post(`/api/v1/sale-orders/${e}/confirm`,{})}async function xPe(t,e,r,n){return t.post(`/api/v1/${Pl[e]}/${r}/fast-fix`,{attributes:n})}async function TPe(t,e,r,n){return t.post(`/api/v1/${Pl[e]}/bulk-void`,{resourceIds:r,...n?{internalNotes:n}:{}})}async function BPe(t,e){return t.post("/api/v1/sale-quotes/bulk-accept",{resourceIds:e})}async function kPe(t,e){return t.post("/api/v1/sale-orders/bulk-confirm",{resourceIds:e})}async function NPe(t,e,r){return t.post(`/api/v1/${Pl[e]}/bulk-delete`,{resourceIds:r})}async function OPe(t,e){return t.post("/api/v1/sale-orders/line-items/bulk-upsert",{saleOrders:e})}var Pl,yK=X(()=>{"use strict";Pl={SALE_QUOTE:"sale-quotes",SALE_ORDER:"sale-orders"}});async function FPe(t,e,r){return t.list(`/api/v1/${Ul[e]}`,r)}async function lf(t,e,r){return t.get(`/api/v1/${Ul[e]}/${r}`)}async function $2(t,e,r){return t.search(`/api/v1/${Ul[e]}/search`,r)}async function q2(t,e,r){return t.search(`/api/v1/${Ul[e]}/line-items/search`,r)}async function BR(t,e){return t.post("/api/v1/purchase-requests",{...e,saveAsDraft:e.saveAsDraft??!0})}async function kR(t,e){return t.post("/api/v1/purchase-orders",{...e,saveAsDraft:e.saveAsDraft??!0})}async function j2(t,e,r,n){return t.post(`/api/v1/${Ul[e]}/${r}/convert-to-bill`,n)}async function Y2(t,e,r,n){return t.put(`/api/v1/${Ul[e]}/${r}`,n)}async function H2(t,e,r){await t.delete(`/api/v1/${Ul[e]}/${r}`)}async function z2(t,e,r,n){return t.post(`/api/v1/${Ul[e]}/${r}/void`,n?{internalNotes:n}:{})}async function G2(t,e){return t.post(`/api/v1/purchase-requests/${e}/accept`,{})}async function J2(t,e){return t.post(`/api/v1/purchase-orders/${e}/confirm`,{})}async function QPe(t,e,r,n){return t.post(`/api/v1/${Ul[e]}/${r}/fast-fix`,{attributes:n})}async function LPe(t,e,r,n){return t.post(`/api/v1/${Ul[e]}/bulk-void`,{resourceIds:r,...n?{internalNotes:n}:{}})}async function MPe(t,e){return t.post("/api/v1/purchase-requests/bulk-accept",{resourceIds:e})}async function PPe(t,e){return t.post("/api/v1/purchase-orders/bulk-confirm",{resourceIds:e})}async function UPe(t,e,r){return t.post(`/api/v1/${Ul[e]}/bulk-delete`,{resourceIds:r})}async function $Pe(t,e){return t.post("/api/v1/purchase-orders/line-items/bulk-upsert",{purchaseOrders:e})}var Ul,EK=X(()=>{"use strict";Ul={PURCHASE_REQUEST:"purchase-requests",PURCHASE_ORDER:"purchase-orders"}});async function V2(t,e){return t.list("/api/v1/journals",e)}async function NR(t,e){return t.search("/api/v1/journals/search",e)}async function Cg(t,e){return t.post("/api/v1/journals",{...e,currency:Sr(e.currency),taxCurrency:Sr(e.taxCurrency),saveAsDraft:e.saveAsDraft??!0})}async function W2(t,e,r){return t.delete(`/api/v1/journals/${e}`,r)}async function $l(t,e){return t.get(`/api/v1/journals/${e}`)}async function qC(t,e,r){return t.put(`/api/v1/journals/${e}`,{...r,currency:Sr(r.currency),taxCurrency:Sr(r.taxCurrency)})}async function qPe(t,e,r){return t.put(`/api/v1/journals/${e}`,{...r,resourceId:e,saveAsDraft:!1})}async function OR(t,e){return t.post("/api/v1/scheduled/journals",e)}async function Z2(t,e){return ho(t,"/api/v1/journals/bulk-upsert","journals",e)}async function jPe(t,e){return ls(e,"resourceId","Pass the journal resourceId."),t.get(`/api/v1/journals/${encodeURIComponent(e)}/download`)}var Ig=X(()=>{"use strict";En();hr()});async function X2(t,e){return t.post("/api/v1/generate-reports/trial-balance",e)}async function K2(t,e){return t.post("/api/v1/generate-reports/balance-sheet",e)}async function eU(t,e){return t.post("/api/v1/generate-reports/profit-and-loss",e)}async function tU(t,e){return t.post("/api/v1/generate-reports/cashflow",e)}async function rU(t,e){return t.post("/api/v1/generate-reports/ar-summary-report",e)}async function nU(t,e){return t.post("/api/v1/generate-reports/ap-summary-report",e)}function jC(t,e){let{root:r,rows:n}=szt[e],i=t.data?.[r]??{},o=Array.isArray(i[n])?i[n]:[],s={current:0,lessThanOneMonth:0,oneMonth:0,twoMonths:0,threeMonths:0,older:0,total:0};for(let u of o)s.current+=u.currentIso??0,s.lessThanOneMonth+=u.lessThanOneMonthIso??0,s.oneMonth+=u.oneMonthIso??0,s.twoMonths+=u.twoMonthsIso??0,s.threeMonths+=u.threeMonthsIso??0,s.older+=u.olderIso??0,s.total+=u.balanceIso??0;let a=u=>Math.round(u*100)/100,c=i.startDate;return{reportType:e==="receivables"?"AGED_RECEIVABLES":"AGED_PAYABLES",organizationName:i.organizationName,asAt:typeof c=="number"?new Date(c).toISOString().slice(0,10):void 0,currencyCode:i.currencyCode,currencySymbol:i.currencySymbol,buckets:{current:a(s.current),lessThanOneMonth:a(s.lessThanOneMonth),oneMonth:a(s.oneMonth),twoMonths:a(s.twoMonths),threeMonths:a(s.threeMonths),older:a(s.older)},totalOutstanding:a(s.total),contactCount:o.length}}async function iU(t,e){return t.post("/api/v1/generate-reports/cash-balance",e)}async function oU(t,e){return t.post("/api/v1/generate-reports/general-ledger",e)}async function sU(t,e){return t.post("/api/v1/generate-reports/vat-ledger",e)}async function aU(t,e){return t.post("/api/v1/generate-reports/equity-movement",e)}async function cU(t,e){return t.post("/api/v1/generate-reports/bank-balance-summary",e)}async function lU(t,e){return t.post("/api/v1/generate-reports/bank-reconciliation-summary",e)}async function uU(t,e){return t.post("/api/v1/generate-reports/bank-reconciliation-details",e)}async function dU(t,e){return t.post("/api/v1/generate-reports/fixed-assets-summary",e)}async function fU(t,e){return t.post("/api/v1/generate-reports/fixed-assets-recon-summary",e)}async function pU(t,e){return t.post("/api/v1/generate-reports/ar-report",e)}async function hU(t){return t.get("/api/v1/ledger/highlights")}var szt,bK=X(()=>{"use strict";szt={receivables:{root:"generateAgedReceivablesReportGroupByContact",rows:"customerSummary"},payables:{root:"generateAgedPayablesReportGroupByContact",rows:"supplierSummary"}}});async function mU(t,e){return t.list("/api/v1/catalogs",e)}async function AU(t,e){return t.get(`/api/v1/catalogs/${encodeURIComponent(e)}`)}async function gU(t,e){return t.search("/api/v1/catalogs/search",e)}async function yU(t,e){return t.post("/api/v1/catalogs",e)}async function EU(t,e,r){return t.put(`/api/v1/catalogs/${encodeURIComponent(e)}`,r)}async function bU(t,e){await t.delete(`/api/v1/catalogs/${encodeURIComponent(e)}`)}var CK=X(()=>{"use strict"});async function YPe(t,e){return t.list("/api/v1/organization-report-template",e)}async function HPe(t,e){return t.get(`/api/v1/organization-report-template/${encodeURIComponent(e)}`)}async function zPe(t,e){return t.search("/api/v1/organization-report-template/search",e)}var GPe=X(()=>{"use strict"});async function CU(t,e){return t.list("/api/v1/customer-credit-notes",e)}async function za(t,e){return t.get(`/api/v1/customer-credit-notes/${e}`)}async function FR(t,e){return t.search("/api/v1/customer-credit-notes/search",e)}async function QR(t,e){return t.post("/api/v1/customer-credit-notes",{...e,currency:Sr(e.currency),taxCurrency:Sr(e.taxCurrency),saveAsDraft:e.saveAsDraft??!0})}async function IU(t,e,r){let n=r.lineItems?{...r,lineItems:r.lineItems.map(fp)}:r,i=await bc(n,()=>za(t,e));return t.put(`/api/v1/customer-credit-notes/${e}`,i)}async function LR(t,e,r){let n=await bc({...r,resourceId:e,saveAsDraft:!1},()=>za(t,e));return t.put(`/api/v1/customer-credit-notes/${e}`,n)}async function vU(t,e,r){return t.delete(`/api/v1/customer-credit-notes/${e}`,r)}async function MR(t,e,r){return t.post(`/api/v1/customer-credit-notes/${e}/refunds`,{...r,currency:Sr(r.currency),saveAsDraft:r.saveAsDraft??!0})}async function wU(t,e){return t.get(`/api/v1/customer-credit-notes/${e}/refunds`)}async function _U(t,e){return t.get(`/api/v1/customer-credit-notes/${e}/download`)}async function DU(t,e){return ho(t,"/api/v1/customer-credit-notes/bulk-upsert","customerCreditNotes",cp(e))}var SU=X(()=>{"use strict";Zw();DA();En();hr()});async function RU(t,e){return t.list("/api/v1/supplier-credit-notes",e)}async function Ga(t,e){return t.get(`/api/v1/supplier-credit-notes/${e}`)}async function PR(t,e){return t.search("/api/v1/supplier-credit-notes/search",e)}async function UR(t,e){return t.post("/api/v1/supplier-credit-notes",{...e,currency:Sr(e.currency),taxCurrency:Sr(e.taxCurrency),saveAsDraft:e.saveAsDraft??!0})}async function xU(t,e,r){let n=r.lineItems?{...r,lineItems:r.lineItems.map(fp)}:r,i=await bc(n,()=>Ga(t,e));return t.put(`/api/v1/supplier-credit-notes/${e}`,i)}async function $R(t,e,r){let n=await bc({...r,resourceId:e,saveAsDraft:!1},()=>Ga(t,e));return t.put(`/api/v1/supplier-credit-notes/${e}`,n)}async function TU(t,e,r){return t.delete(`/api/v1/supplier-credit-notes/${e}`,r)}async function BU(t,e){return t.get(`/api/v1/supplier-credit-notes/${e}/download`)}async function qR(t,e,r){return t.post(`/api/v1/supplier-credit-notes/${e}/refunds`,{...r,currency:Sr(r.currency),saveAsDraft:r.saveAsDraft??!0})}async function kU(t,e){return t.get(`/api/v1/supplier-credit-notes/${e}/refunds`)}async function NU(t,e){return ho(t,"/api/v1/supplier-credit-notes/bulk-upsert","supplierCreditNotes",cp(e))}var OU=X(()=>{"use strict";Zw();DA();En();hr()});async function jR(t){return t.get("/api/v1/organization/currencies")}async function FU(t,e){return t.post("/api/v1/organization/currencies",{currencies:e})}async function QU(t,e,r){return t.list(`/api/v1/organization/currencies/${e}/rates`,r)}function JPe(t){X9(t.rate,"rate");let e=Z9(t.rateDirection);return{...t,rateDirection:e}}async function LU(t,e,r){return t.post(`/api/v1/organization/currencies/${e}/rates`,JPe(r))}async function MU(t,e,r,n){return t.put(`/api/v1/organization/currencies/${e}/rates/${r}`,JPe(n))}async function PU(t,e){return t.post("/api/v1/organization/currencies/rates/bulk-upsert",{rates:e})}var UU=X(()=>{"use strict";hr()});var VPe=b((IK,vK)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof vK=="object"&&typeof IK<"u"?vK.exports=e():t.Papa=e()})(IK,function t(){"use strict";var e=(function(){return typeof self<"u"?self:typeof window<"u"?window:typeof e<"u"?e:{}})();function r(){var D=e.URL||e.webkitURL||null,B=t.toString();return a.BLOB_URL||(a.BLOB_URL=D.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",B,")();"],{type:"text/javascript"})))}var n=!e.document&&!!e.postMessage,i=e.IS_PAPA_WORKER||!1,o={},s=0,a={};if(a.parse=u,a.unparse=d,a.RECORD_SEP="",a.UNIT_SEP="",a.BYTE_ORDER_MARK="\uFEFF",a.BAD_DELIMITERS=["\r",`
|
|
442
|
+
... and ${a.toLocaleString()} more (use --format json for full output)`));break}}}function bS(t,e){switch(Xp(e)){case"json":console.log(JSON.stringify(t,null,2));break;case"csv":{let n=Object.keys(t);console.log(n.map(e2).join(",")),console.log(n.map(i=>e2(XMe(t[i]))).join(","));break}case"yaml":console.log((0,cK.stringify)(t).trimEnd());break;case"table":console.log(WMe(t));break}}var cK,yg,dr=X(()=>{"use strict";Oe();sp();cK=sn(GMe(),1);aK();ln();ZMe();yg=class extends No{constructor(e){super(e),this.name="CliValidationError"}}});var tPe={};So(tPe,{displaySlice:()=>lK,paginatedFetch:()=>ot,paginatedJson:()=>uK});async function ot(t,e,r){let n=r.defaultLimit??100;if(t.all&&t.offset!==void 0)throw new Error("--all and --offset cannot be used together");if(t.all){let d=(t.format?.toLowerCase()??(t.json?"json":"table"))==="table"?iQe(r.label):void 0,f=t.maxRows??ePe,p=await Pp((y,C)=>e({limit:C,offset:y}),{pageSize:t.limit??200,maxItems:f,onProgress:d?(y,C)=>d.update(y,C):void 0});d?.clear();let{truncated:h}=p,{data:m}=p;m.length>f&&(m=m.slice(0,f),h=!0),h&&!Ml(t)&&console.error(ke(`Warning: dataset has ${p.totalElements.toLocaleString()} items \u2014 showing ${m.length.toLocaleString()} (max-rows: ${f.toLocaleString()})`));let A=t.limit??n,g=Math.ceil(p.totalElements/A);return{data:m,totalElements:p.totalElements,totalPages:g,truncated:h}}let i=t.limit??n,o=await e({limit:i,offset:t.offset??0}),s=o.data??[],a=(o.totalElements??0)>s.length;return{data:s,totalElements:o.totalElements??0,totalPages:o.totalPages??0,truncated:a}}function lK(t,e=tzt){return t.length<=e?{items:t,overflow:0}:{items:t.slice(0,e),overflow:t.length-e}}function uK(t,e){let{totalElements:r,totalPages:n,truncated:i,data:o,stats:s}=t,a=s?{stats:s}:{};if(i){let c=e.maxRows??ePe;return JSON.stringify({totalElements:r,totalPages:n,truncated:i,_meta:{fetchedRows:o.length,maxRows:c},...a,data:o},null,2)}return JSON.stringify({totalElements:r,totalPages:n,truncated:i,...a,data:o},null,2)}var ePe,tzt,ln=X(()=>{"use strict";Oe();HM();oQe();dr();ePe=1e3,tzt=500});async function rzt(){if(!dK){let[t,e,r,n]=await Promise.all([Promise.resolve().then(()=>(ft(),sPe)),Promise.resolve().then(()=>(ln(),tPe)),Promise.resolve().then(()=>(dr(),KMe)),Promise.resolve().then(()=>(_t(),awe))]);dK=t.apiAction,rPe=e.paginatedFetch,nPe=r.outputList,fK=n.parsePositiveInt,iPe=n.parseNonNegativeInt}}function Ye(t){let e=t.commandName??"search",r=t.positionalArg?` <${t.positionalArg}>`:"",n=t.parent.command(`${e}${r}`).description(`Search ${t.label.replace("Searching ","")}`);n.allowExcessArguments(!1);let i=new Map,o=lZ(t.fields);for(let[a,c,u,d]of o){let f=new Pt(a,c),p=t.fields[d];u&&p?.op!=="multi"&&f.choices(u),n.addOption(f);let h=nzt(a);h!==d&&i.set(h,d)}if(t.defaults.supportsQuery&&n.option("--query <expression>",'Jaz search expression (e.g. "status:unpaid AND $500+", "customer:acme AND date:-30d"). Merged with --filter; --filter fields win on conflict.'),n.option("--filter <json>","Raw API filter JSON (merged with flags; flags win on conflict)").addOption(new Pt("--sort <field>","Sort field name")).addOption(new Pt("--order <direction>","Sort direction").choices(["ASC","DESC"])).option("--limit <n>",`Max results (default ${t.defaults.defaultLimit})`).option("--offset <n>","Page number offset (0-indexed)").option("--all","Fetch all pages").option("--max-rows <n>","Max rows for --all (default 1000)").option("--format <type>","Output format: table, json, csv, yaml").option("--api-key <key>","API key (overrides stored/env)").option("--json","Output as JSON"),t.defaults.supportsView&&n.addOption(new Pt("--view <tier>","Payload tier: 'lean' = summary rows; 'full' (default) = complete records").choices(["lean","full"])),t.pathParam&&t.pathParam!==t.positionalArg){let a=t.pathParam.replace(/([A-Z])/g,"-$1").toLowerCase();n.requiredOption(`--${a} <id>`,t.pathParamDescription??`${t.pathParam} (required)`)}let s=async(...a)=>{let c=t.positionalArg?a[0]:void 0,u=t.positionalArg?a[1]:a[0];c&&t.positionalArg&&(u[t.positionalArg]=c),await rzt(),await dK(async d=>{t.preProcess&&await t.preProcess(d,u),typeof u.limit=="string"&&(u.limit=fK(u.limit)),typeof u.offset=="string"&&(u.offset=iPe(u.offset)),typeof u.maxRows=="string"&&(u.maxRows=fK(u.maxRows));let f={...u};for(let[v,x]of i)f[v]!==void 0&&(f[x]=f[v]);let p;if(typeof u.filter=="string")try{p=JSON.parse(u.filter)}catch{throw new Error(`Invalid --filter JSON: ${u.filter}`)}let h=t.baseFilter?p?{...t.baseFilter,...p}:t.baseFilter:p,m=OD(f,t.fields,h),A;if(c&&t.positionalFilter){let v=t.positionalFilter(c);A=m?{...v,...m}:v}else A=m;let g={sortBy:[u.sort??t.defaults.sortBy],order:u.order??t.defaults.sortOrder},y=t.defaults.supportsQuery?u.query:void 0,C=t.defaults.supportsView?u.view:void 0,E=t.pathParam?({limit:v,offset:x})=>t.fetcher(d,u[t.pathParam],{filter:A,sort:g,limit:v,offset:x,query:y,view:C}):({limit:v,offset:x})=>t.fetcher(d,{filter:A,sort:g,limit:v,offset:x,query:y,view:C}),I=await rPe(u,E,{label:t.label,defaultLimit:t.defaults.defaultLimit});nPe(I,t.columns,u,t.label.replace("Searching ",""))})(u)};return n.action(s),n}function nzt(t){return t.replace(/^--/,"").split(/[\s<]/)[0].replace(/-([a-z])/g,(r,n)=>n.toUpperCase())}var dK,rPe,nPe,fK,iPe,oPe=X(()=>{"use strict";is();uZ();YM()});var LC,MC,CS,IS,aPe=X(()=>{"use strict";ca();LC={reference:{path:"reference",op:"contains",type:"string",description:"Invoice reference number"},status:{path:"status",op:"multi",type:"string",description:"Status (comma-separated for OR)",enum:xFe},contactName:{path:"contact.name",op:"contains",type:"string",description:"Contact/customer name"},contactId:{path:"contactResourceId",op:"eq",type:"string",description:"Contact resourceId"},tag:{path:"tags",op:"eq",type:"string",description:"Tag name",cliFlag:"--tag <name>"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code (e.g., SGD, USD)"},approvalStatus:{path:"approvalStatus",op:"multi",type:"string",description:"Approval status",enum:$M},startDate:{path:"valueDate",op:"gte",type:"string",description:"On/after (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On/before (YYYY-MM-DD)",cliFlag:"--to <date>"},dueDateFrom:{path:"dueDate",op:"gte",type:"string",description:"Due date from (YYYY-MM-DD)"},dueDateTo:{path:"dueDate",op:"lte",type:"string",description:"Due date to (YYYY-MM-DD)"},minAmount:{path:"totalAmount",op:"gte",type:"number",description:"Minimum total amount"},maxAmount:{path:"totalAmount",op:"lte",type:"number",description:"Maximum total amount"}},MC={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0},CS=LC,IS=MC});var cPe,vS,wS,PC,_S,Kp,eh,lPe=X(()=>{"use strict";ca();cPe={reference:{path:"reference",op:"contains",type:"string",description:"Order reference number"},contactName:{path:"contact.name",op:"contains",type:"string",description:"Contact (customer/supplier) name"},contactId:{path:"contactResourceId",op:"eq",type:"string",description:"Contact resourceId"},tag:{path:"tags",op:"eq",type:"string",description:"Tag name",cliFlag:"--tag <name>"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code (e.g., SGD, USD)"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On/after (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On/before (YYYY-MM-DD)",cliFlag:"--to <date>"},dueDateFrom:{path:"dueDate",op:"gte",type:"string",description:"Due date from (YYYY-MM-DD)"},dueDateTo:{path:"dueDate",op:"lte",type:"string",description:"Due date to (YYYY-MM-DD)"},minAmount:{path:"totalAmount",op:"gte",type:"number",description:"Minimum total amount"},maxAmount:{path:"totalAmount",op:"lte",type:"number",description:"Maximum total amount"}},vS={status:{path:"status",op:"multi",type:"string",description:"Status (comma-separated for OR)",enum:HFe},...cPe},wS={status:{path:"status",op:"multi",type:"string",description:"Status (comma-separated for OR)",enum:zFe},...cPe},PC={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0},_S=PC,Kp={name:{path:"name",op:"contains",type:"string",description:"Line item text/description"},reference:{path:"reference",op:"contains",type:"string",description:"Parent order reference"},orderId:{path:"btResourceId",op:"eq",type:"string",description:"Parent order resourceId"},contactName:{path:"contactName",op:"contains",type:"string",description:"Contact (customer/supplier) name"},contactId:{path:"contactResourceId",op:"eq",type:"string",description:"Contact resourceId"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code (e.g., SGD, USD)"},status:{path:"status",op:"eq",type:"string",description:"Line item status"},account:{path:"organizationAccountName",op:"contains",type:"string",description:"Chart-of-account name on the line"},taxProfile:{path:"taxProfileName",op:"contains",type:"string",description:"Tax profile name on the line"},isOpen:{path:"isOpen",op:"boolean",type:"boolean",description:"Only open (unfulfilled) lines"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On/after (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On/before (YYYY-MM-DD)",cliFlag:"--to <date>"},minAmount:{path:"totalItemAmount",op:"gte",type:"number",description:"Minimum line amount"},maxAmount:{path:"totalItemAmount",op:"lte",type:"number",description:"Maximum line amount"}},eh={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,supportsQuery:!0}});var th,UC,DS,uPe=X(()=>{"use strict";ca();th={reference:{path:"reference",op:"contains",type:"string",description:"Credit note reference"},status:{path:"status",op:"multi",type:"string",description:"Status (comma-separated for OR)",enum:TFe},contactName:{path:"contact.name",op:"contains",type:"string",description:"Contact name"},contactId:{path:"contactResourceId",op:"eq",type:"string",description:"Contact resourceId"},tag:{path:"tags",op:"eq",type:"string",description:"Tag name",cliFlag:"--tag <name>"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code"},approvalStatus:{path:"approvalStatus",op:"multi",type:"string",description:"Approval status",enum:$M},startDate:{path:"valueDate",op:"gte",type:"string",description:"On or after this date (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On or before this date (YYYY-MM-DD)",cliFlag:"--to <date>"}},UC={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0},DS=UC});var SS,RS,dPe=X(()=>{"use strict";ca();SS={reference:{path:"reference",op:"contains",type:"string",description:"Journal reference"},status:{path:"status",op:"multi",type:"string",description:"Status",enum:BFe},type:{path:"type",op:"multi",type:"string",description:"Journal type",enum:kFe},templateType:{path:"templateType",op:"multi",type:"string",description:"Template type",enum:NFe},tag:{path:"tags",op:"eq",type:"string",description:"Tag name",cliFlag:"--tag <name>"},contactName:{path:"contact.name",op:"contains",type:"string",description:"Contact name"},internalNotes:{path:"internalNotes",op:"contains",type:"string",description:"Search internal notes"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On or after this date (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On or before this date (YYYY-MM-DD)",cliFlag:"--to <date>"}},RS={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0}});var xS,TS,fPe=X(()=>{"use strict";ca();xS={name:{path:"name",op:"contains",type:"string",description:"Contact name"},email:{path:"email",op:"contains",type:"string",description:"Email address"},status:{path:"status",op:"multi",type:"string",description:"Status",enum:UM},isCustomer:{path:"customer",op:"boolean",type:"boolean",description:"Filter to customers only",cliFlag:"--customer"},isSupplier:{path:"supplier",op:"boolean",type:"boolean",description:"Filter to suppliers only",cliFlag:"--supplier"},taxId:{path:"taxId",op:"contains",type:"string",description:"Tax ID"}},TS={sortBy:"name",sortOrder:"ASC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0}});var sf,af,pK,BS,kS,pPe=X(()=>{"use strict";ca();sf={type:{path:"businessTransactionType",op:"multi",type:"string",description:"Transaction type",enum:qM},direction:{path:"direction",op:"eq",type:"string",description:"Direction (PAYIN or PAYOUT)",enum:sZ},status:{path:"businessTransactionStatus",op:"multi",type:"string",description:"Status",enum:PFe},reference:{path:"businessTransactionReference",op:"contains",type:"string",description:"Reference",cliFlag:"--ref <reference>"},accountId:{path:"organizationAccountResourceId",op:"eq",type:"string",description:"Bank account resourceId",cliFlag:"--account <id>"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On or after this date (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On or before this date (YYYY-MM-DD)",cliFlag:"--to <date>"},businessTransactionType:{path:"businessTransactionType",op:"multi",type:"string",description:"(alias for type)"}},af={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,supportsQuery:!0},pK={magicSort:{type:"object",description:"Rank by match quality to a bank entry: {bankStatementEntryResourceId, magicSort:true}."},transactionType:{type:"string",enum:[...MFe],description:"Scope. Default ALL_CASHFLOWS."}},BS={type:{path:"businessTransactionType",op:"multi",type:"string",description:"Transaction type (SALE, PURCHASE, etc.)",enum:qM},direction:{path:"direction",op:"eq",type:"string",description:"Direction",enum:sZ},reference:{path:"businessTransactionReference",op:"contains",type:"string",description:"Reference",cliFlag:"--ref <reference>"},accountId:{path:"organizationAccountResourceId",op:"eq",type:"string",description:"Account resourceId",cliFlag:"--account <id>"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On or after this date (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On or before this date (YYYY-MM-DD)",cliFlag:"--to <date>"},businessTransactionType:{path:"businessTransactionType",op:"multi",type:"string",description:"(alias for type)",enum:qM},fromDate:{path:"valueDate",op:"gte",type:"string",description:"(alias for startDate)"},toDate:{path:"valueDate",op:"lte",type:"string",description:"(alias for endDate)"},accountResourceId:{path:"organizationAccountResourceId",op:"eq",type:"string",description:"(alias for accountId)"}},kS={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20}});var NS,OS,hPe=X(()=>{"use strict";ca();NS={status:{path:"status",op:"multi",type:"string",description:"Status",enum:LFe},description:{path:"description",op:"contains",type:"string",description:"Description"},payer:{path:"extContactName",op:"contains",type:"string",description:"Payer/payee name"},reference:{path:"extReference",op:"contains",type:"string",description:"Bank reference",cliFlag:"--ref <reference>"},startDate:{path:"valueDate",op:"gte",type:"string",description:"On or after this date (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"On or before this date (YYYY-MM-DD)",cliFlag:"--to <date>"},minAmount:{path:"netAmount",op:"gte",type:"number",description:"Minimum net amount"},maxAmount:{path:"netAmount",op:"lte",type:"number",description:"Maximum net amount"}},OS={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20,supportsQuery:!0}});var FS,QS,mPe=X(()=>{"use strict";ca();FS={status:{path:"status",op:"multi",type:"string",description:"Status",enum:OFe},itemCategory:{path:"itemCategory",op:"eq",type:"string",description:"Category",enum:QFe},appliesToSale:{path:"appliesToSale",op:"boolean",type:"boolean",description:"Filter to sale items only",cliFlag:"--sale"},appliesToPurchase:{path:"appliesToPurchase",op:"boolean",type:"boolean",description:"Filter to purchase items only",cliFlag:"--purchase"}},QS={sortBy:"internalName",sortOrder:"ASC",defaultLimit:20,leanDefaultLimit:50,supportsQuery:!0,supportsView:!0}});var LS,MS,APe=X(()=>{"use strict";ca();LS={name:{path:"name",op:"contains",type:"string",description:"Asset name"},reference:{path:"reference",op:"contains",type:"string",description:"Reference",cliFlag:"--ref <reference>"},status:{path:"status",op:"multi",type:"string",description:"Status",enum:UFe},category:{path:"category",op:"eq",type:"string",description:"Category",enum:$Fe},tag:{path:"tags",op:"eq",type:"string",description:"Tag name",cliFlag:"--tag <name>"},typeName:{path:"typeName",op:"contains",type:"string",description:"Asset type name"},startDate:{path:"purchaseDate",op:"gte",type:"string",description:"Purchase date from (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"purchaseDate",op:"lte",type:"string",description:"Purchase date to (YYYY-MM-DD)",cliFlag:"--to <date>"},minAmount:{path:"purchaseAmount",op:"gte",type:"number",description:"Minimum purchase amount"},maxAmount:{path:"purchaseAmount",op:"lte",type:"number",description:"Maximum purchase amount"}},MS={sortBy:"name",sortOrder:"ASC",defaultLimit:20,supportsQuery:!0}});var PS,US,gPe=X(()=>{"use strict";ca();PS={type:{path:"businessTransactionType",op:"eq",type:"string",description:"Transaction type (SALE, PURCHASE, JOURNAL_MANUAL)"},status:{path:"status",op:"multi",type:"string",description:"Scheduler status",enum:qFe},subscriptionStatus:{path:"subscriptionStatus",op:"multi",type:"string",description:"Subscription status",enum:jFe},schedulerType:{path:"schedulerType",op:"eq",type:"string",description:"Scheduler type"},interval:{path:"interval",op:"eq",type:"string",description:"Interval",enum:YFe},contactName:{path:"contact.name",op:"contains",type:"string",description:"Contact name"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code"}},US={sortBy:"nextScheduleDate",sortOrder:"ASC",defaultLimit:20,supportsQuery:!0}});var $S,qS,yPe=X(()=>{"use strict";ca();$S={id:{path:"resourceId",op:"eq",type:"string",description:"Job ID (the jobId returned from bulk operations)",cliFlag:"--id"},status:{path:"status",op:"multi",type:"string",description:"Job status",enum:ZFe},type:{path:"jobType",op:"eq",type:"string",description:"Job type (e.g. UPSERT_CONTACTS, UPSERT_ITEMS, PROCESS_BANK_STATEMENT_FILES)",cliFlag:"--type"},fileName:{path:"fileName",op:"contains",type:"string",description:"File name (file-based jobs only)",cliFlag:"--file-name"},from:{path:"createdAt",op:"gte",type:"string",description:"On/after (ISO date)",cliFlag:"--from"},to:{path:"createdAt",op:"lte",type:"string",description:"On/before (ISO date)",cliFlag:"--to"}},qS={sortBy:"createdAt",sortOrder:"DESC",defaultLimit:20}});var jS,YS,EPe=X(()=>{"use strict";jS={name:{path:"name",op:"plain",type:"string",description:"Purchase item name"},reference:{path:"reference",op:"plain",type:"string",description:"Reference name"},currencyCode:{path:"currencyCode",op:"plain",type:"string",description:"Currency code (ISO 4217)"}},YS={sortBy:"name",sortOrder:"ASC",defaultLimit:20}});var HS,zS,hK,mK,bPe=X(()=>{"use strict";HS={catalogName:{path:"catalogName",op:"contains",type:"string",description:"Catalog name"},description:{path:"description",op:"contains",type:"string",description:"Catalog item description"},status:{path:"status",op:"multi",type:"string",description:"Record status (e.g. ACTIVE, INACTIVE)"},contactGroupResourceId:{path:"contactGroupResourceId",op:"eq",type:"string",description:"Contact group resourceId"}},zS={sortBy:"catalogName",sortOrder:"ASC",defaultLimit:20,supportsQuery:!0},hK={reportType:{path:"reportType",op:"plain",type:"string",description:"Report type"},reportCategory:{path:"reportCategory",op:"eq",type:"string",description:"Report category"},isDefault:{path:"isDefault",op:"boolean",type:"boolean",description:"Only default templates",cliFlag:"--default"}},mK={sortBy:"reportType",sortOrder:"ASC",defaultLimit:20}});async function t2(t,e){return t.search("/api/v1/claims/search",e)}async function r2(t,e){return t.get(`/api/v1/claims/${e}`)}async function n2(t,e){return t.post("/api/v1/claims",e)}async function i2(t,e,r){return t.put(`/api/v1/claims/${e}`,r)}async function o2(t,e){return t.delete(`/api/v1/claims/${e}`)}async function s2(t,e,r){return t.delete(`/api/v1/claims/${e}/attachments/${r}`)}async function a2(t,e){return t.post(`/api/v1/claims/${e}/submit`,{})}async function c2(t,e){return t.post(`/api/v1/claims/${e}/approve`,{})}async function l2(t,e,r){return t.post(`/api/v1/claims/${e}/reject`,{rejectionReason:r})}async function u2(t,e,r){return t.post(`/api/v1/claims/${e}/cancel`,{cancellationReason:r})}async function d2(t,e){return t.post(`/api/v1/claims/${e}/unpost`,{})}function GS(t){Ot(t,"resourceIds",500,"claims")}async function f2(t,e){return GS(e),t.post("/api/v1/claims/bulk/submit",{resourceIds:e})}async function p2(t,e){return GS(e),t.post("/api/v1/claims/bulk/approve",{resourceIds:e})}async function h2(t,e){return GS(e),t.post("/api/v1/claims/bulk/delete",{resourceIds:e})}async function m2(t,e,r){return GS(e),t.post("/api/v1/claims/bulk/reject",{resourceIds:e,rejectionReason:r})}async function A2(t,e,r){return GS(e),t.post("/api/v1/claims/bulk/cancel",{resourceIds:e,cancellationReason:r})}async function g2(t){let e=await t.get("/api/v1/claims/tracking-tags");return Array.isArray(e)?e:e?.data??[]}async function y2(t){let e=await t.get("/api/v1/claims/custom-field-values");return Array.isArray(e)?e:e?.data??[]}var CPe,E2=X(()=>{"use strict";En();CPe=["DRAFT","SUBMITTED","APPROVED","CONVERTED","REJECTED","CANCELLED"]});var JS,VS,izt,ozt,WS,ZS,XS,KS,eR,tR,rR,nR,IPe=X(()=>{"use strict";f_();m_();E2();JS={status:{path:"status",op:"multi",type:"string",description:"Status (comma-separated for OR)",enum:CPe},employeeResourceId:{path:"employeeResourceId",op:"eq",type:"string",description:"Employee resourceId"},contactResourceId:{path:"contactResourceId",op:"eq",type:"string",description:"Vendor contact resourceId"},claimProfileResourceId:{path:"claimProfileResourceId",op:"eq",type:"string",description:"Claim profile resourceId"},approverUserResourceId:{path:"approverUserResourceId",op:"eq",type:"string",description:"Approver user resourceId"},reference:{path:"reference",op:"contains",type:"string",description:"Claim reference"},currencyCode:{path:"currencyCode",op:"eq",type:"string",description:"Currency code (ISO 4217)"},startDate:{path:"valueDate",op:"gte",type:"string",description:"Value date on/after (YYYY-MM-DD)",cliFlag:"--from <date>"},endDate:{path:"valueDate",op:"lte",type:"string",description:"Value date on/before (YYYY-MM-DD)",cliFlag:"--to <date>"},createdFrom:{path:"createdAt",op:"gte",type:"string",description:"Created on/after (YYYY-MM-DD)"},createdTo:{path:"createdAt",op:"lte",type:"string",description:"Created on/before (YYYY-MM-DD)"},minAmount:{path:"totalAmount",op:"gte",type:"number",description:"Minimum total amount"},maxAmount:{path:"totalAmount",op:"lte",type:"number",description:"Maximum total amount"}},VS={sortBy:"createdAt",sortOrder:"DESC",defaultLimit:20},izt=["RECORDED","COMPLETED","CANCELLED","IN_PROGRESS","ACTION_NEEDED"],ozt=["DIRECT_ENTRY","DISBURSEMENT","REIMBURSEMENT_PAYOUT","ADVANCE"],WS={employeeResourceId:{path:"employeeResourceId",op:"eq",type:"string",description:"Employee resourceId"},employeeName:{path:"employeeName",op:"contains",type:"string",description:"Employee name"},reference:{path:"reference",op:"contains",type:"string",description:"Payout reference"},payoutStatus:{path:"payoutStatus",op:"multi",type:"string",description:"Payout status (comma-separated)",enum:izt},payoutType:{path:"payoutType",op:"multi",type:"string",description:"Payout type (comma-separated): DIRECT_ENTRY (books-only DCE), DISBURSEMENT (gateway direct-debit-backed), REIMBURSEMENT_PAYOUT, ADVANCE",enum:ozt}},ZS={sortBy:"valueDate",sortOrder:"DESC",defaultLimit:20},XS={name:{path:"name",op:"contains",type:"string",description:"Claim type name"},isDefault:{path:"isDefault",op:"boolean",type:"boolean",description:"Org default claim type"},expenseAccountResourceId:{path:"expenseAccountResourceId",op:"eq",type:"string",description:"Default expense account resourceId"},taxProfileResourceId:{path:"taxProfileResourceId",op:"eq",type:"string",description:"Default tax profile resourceId"}},KS={sortBy:"name",sortOrder:"ASC",defaultLimit:100},eR={name:{path:"name",op:"contains",type:"string",description:"Claim profile name"},approverUserResourceId:{path:"approverUserResourceId",op:"eq",type:"string",description:"Default approver user resourceId"},isDefault:{path:"isDefault",op:"boolean",type:"boolean",description:"Org default profile"},minClaimAmount:{path:"minClaimAmount",op:"gte",type:"number",description:"Minimum claim total (>=)"},maxClaimAmount:{path:"maxClaimAmount",op:"lte",type:"number",description:"Maximum claim total (<=)"},maxPerPeriodAmount:{path:"maxPerPeriodAmount",op:"lte",type:"number",description:"Per-period spend cap (<=)"},perPeriod:{path:"perPeriod",op:"eq",type:"string",description:"Per-period window",enum:u_},employeeBalanceAccountResourceId:{path:"employeeBalanceAccountResourceId",op:"eq",type:"string",description:"Employee balance (liability) account resourceId"}},tR={sortBy:"name",sortOrder:"ASC",defaultLimit:100},rR={name:{path:"name",op:"contains",type:"string",description:"Posting rule name"},outerAxis:{path:"outerAxis",op:"eq",type:"string",description:"Outer grouping axis",enum:p_},innerAxis:{path:"innerAxis",op:"eq",type:"string",description:"Inner line-aggregation axis",enum:h_},defaultBankAccountResourceId:{path:"defaultBankAccountResourceId",op:"eq",type:"string",description:"Default reimbursement bank account resourceId"},defaultIncludeReimbursementPayout:{path:"defaultIncludeReimbursementPayout",op:"boolean",type:"boolean",description:"Creates reimbursement DCE by default"},isDefault:{path:"isDefault",op:"boolean",type:"boolean",description:"Org default rule"}},nR={sortBy:"name",sortOrder:"ASC",defaultLimit:100}});var iR,oR,sR,aR,vPe=X(()=>{"use strict";A_();iR={name:{path:"name",op:"contains",type:"string",description:"Employee name"},email:{path:"email",op:"contains",type:"string",description:"Work email"},phone:{path:"phone",op:"contains",type:"string",description:"Phone"},userResourceId:{path:"userResourceId",op:"eq",type:"string",description:"Bound login user resourceId"},managerEmployeeResourceId:{path:"managerEmployeeResourceId",op:"eq",type:"string",description:"Manager employee resourceId"},claimProfileResourceId:{path:"claimProfileResourceId",op:"eq",type:"string",description:"Claim profile resourceId"},currency:{path:"currency",op:"eq",type:"string",description:"Balance currency (ISO 4217)"},active:{path:"active",op:"boolean",type:"boolean",description:"Active employees only"},createdFrom:{path:"createdAt",op:"gte",type:"string",description:"Created on/after (YYYY-MM-DD)"},createdTo:{path:"createdAt",op:"lte",type:"string",description:"Created on/before (YYYY-MM-DD)"}},oR={sortBy:"name",sortOrder:"ASC",defaultLimit:50},sR={name:{path:"name",op:"contains",type:"string",description:"Employee name"},email:{path:"email",op:"contains",type:"string",description:"Work email"},phone:{path:"phone",op:"contains",type:"string",description:"Phone"},currency:{path:"currency",op:"eq",type:"string",description:"Balance currency (ISO 4217)"},employmentType:{path:"employmentType",op:"eq",type:"string",description:"Employment type",enum:xA},active:{path:"active",op:"boolean",type:"boolean",description:"Active employees only"}},aR={sortBy:"name",sortOrder:"ASC",defaultLimit:50}});var cR,lR,uR,dR,fR,pR,hR,mR,AR,gR,yR,ER,bR,CR,AK,IR,vR,wR,_R,wPe=X(()=>{"use strict";ca();cR={name:{path:"name",op:"contains",type:"string",description:"Account name"},code:{path:"code",op:"contains",type:"string",description:"Account code"},status:{path:"status",op:"multi",type:"string",description:"Status",enum:FFe},accountClass:{path:"accountClass",op:"eq",type:"string",description:"Account class",enum:GFe},accountType:{path:"accountType",op:"eq",type:"string",description:"Account type",enum:jM},controlFlag:{path:"controlFlag",op:"boolean",type:"boolean",description:"Control flag (system accounts)"}},lR={sortBy:"code",sortOrder:"ASC",defaultLimit:100,supportsQuery:!1},uR={query:{path:"tagName",op:"contains",type:"string",description:"Tag name"}},dR={sortBy:"tagName",sortOrder:"ASC",defaultLimit:100},fR={name:{path:"name",op:"contains",type:"string",description:"Tax profile name",cliFlag:"--name <name>"},taxTypeCode:{path:"taxTypeCode",op:"contains",type:"string",description:"Tax type code"},appliesToSale:{path:"appliesToSale",op:"boolean",type:"boolean",description:"Filter to sale profiles"},appliesToPurchase:{path:"appliesToPurchase",op:"boolean",type:"boolean",description:"Filter to purchase profiles"},appliesToSaleCreditNote:{path:"appliesToSaleCreditNote",op:"boolean",type:"boolean",description:"Filter to sale CN profiles"},appliesToPurchaseCreditNote:{path:"appliesToPurchaseCreditNote",op:"boolean",type:"boolean",description:"Filter to purchase CN profiles"}},pR={sortBy:"name",sortOrder:"ASC",defaultLimit:100,supportsQuery:!0},hR={title:{path:"title",op:"contains",type:"string",description:"Capsule title"},status:{path:"status",op:"multi",type:"string",description:"Status",enum:WFe}},mR={sortBy:"title",sortOrder:"ASC",defaultLimit:20,supportsQuery:!0},AR={query:{path:"customFieldName",op:"contains",type:"string",description:"Custom field name",cliFlag:"--name <name>"},datatypeCode:{path:"datatypeCode",op:"eq",type:"string",description:"Data type",enum:JFe,cliFlag:"--type <type>"},customFieldName:{path:"customFieldName",op:"contains",type:"string",description:"(alias for query)"}},gR={sortBy:"customFieldName",sortOrder:"ASC",defaultLimit:100},yR={query:{path:"name",op:"contains",type:"string",description:"Group name"}},ER={sortBy:"name",sortOrder:"ASC",defaultLimit:100},bR={firstName:{path:"user.firstName",op:"contains",type:"string",description:"User first name"},lastName:{path:"user.lastName",op:"contains",type:"string",description:"User last name"},email:{path:"user.email",op:"contains",type:"string",description:"Email"},userType:{path:"userType",op:"eq",type:"string",description:"Access tier",enum:VFe},status:{path:"status",op:"multi",type:"string",description:"Status",enum:UM}},CR={sortBy:"user.FirstName",sortOrder:"ASC",defaultLimit:50},AK=t=>({or:{user:{firstName:{contains:t}},or:{user:{lastName:{contains:t}}}}}),IR={query:{path:"name",op:"contains",type:"string",description:"Rule name"},account:{path:"appliesToReconciliationAccount",op:"eq",type:"string",description:"Bank account resourceId",cliFlag:"--account <id>"}},vR={sortBy:"name",sortOrder:"ASC",defaultLimit:100},wR={query:{path:"type",op:"contains",type:"string",description:"Classifier type"}},_R={sortBy:"type",sortOrder:"ASC",defaultLimit:100}});var fr=X(()=>{"use strict";ca();YM();uZ();oPe();aPe();lPe();uPe();dPe();fPe();pPe();hPe();mPe();APe();gPe();yPe();EPe();bPe();IPe();vPe();wPe()});async function _Pe(t,e){return t.list("/api/v1/modules",e)}async function DPe(t,e){return t.get(`/api/v1/modules/${encodeURIComponent(e)}`)}var SPe=X(()=>{"use strict"});async function b2(t,e){return t.list("/api/v1/purchase-items",e)}async function C2(t,e){return t.get(`/api/v1/purchase-items/${encodeURIComponent(e)}`)}async function I2(t,e){return t.search("/api/v1/purchase-items/search",e)}var gK=X(()=>{"use strict"});async function v2(t,e){return t.list("/api/v1/invoices",e)}async function Po(t,e){let r=await t.get(`/api/v1/invoices/${e}`);return"data"in r&&typeof r.data=="object"?r:{data:r}}async function $C(t,e){return t.search("/api/v1/invoices/search",e)}async function Eg(t,e){return t.post("/api/v1/invoices",{...e,currency:Sr(e.currency),taxCurrency:Sr(e.taxCurrency),saveAsDraft:e.saveAsDraft??!0})}async function w2(t,e,r){let n=r.lineItems?{...r,lineItems:r.lineItems.map(fp)}:r,i=await bc(n,()=>Po(t,e));return t.put(`/api/v1/invoices/${e}`,i)}async function _2(t,e,r){return t.delete(`/api/v1/invoices/${e}`,r)}async function DR(t,e,r){return t.post(`/api/v1/invoices/${e}/payments`,{...r,currency:Sr(r.currency),saveAsDraft:r.saveAsDraft??!0})}async function SR(t,e){return t.post("/api/v1/scheduled/invoices",{...e,invoice:{...e.invoice,currency:Sr(e.invoice?.currency)}})}async function D2(t,e,r){return t.post(`/api/v1/invoices/${e}/credits`,{credits:r})}async function RR(t,e,r){let n=await bc({...r,resourceId:e,saveAsDraft:!1},()=>Po(t,e));return t.put(`/api/v1/invoices/${e}`,n)}async function S2(t,e){return t.get(`/api/v1/invoices/${e}/download`)}async function R2(t,e){let r=await t.get(`/api/v1/invoices/${e}/payments`);return{data:Array.isArray(r)?r:r.data??[]}}async function x2(t,e){let r=await t.get(`/api/v1/invoices/${e}/credits`);return{data:Array.isArray(r)?r:r.data??[]}}async function T2(t,e,r){await t.delete(`/api/v1/invoices/${e}/credits/${r}`)}async function B2(t,e){return ho(t,"/api/v1/invoices/bulk-upsert","invoices",e)}async function k2(t,e){return ho(t,"/api/v1/invoices/line-items/bulk-upsert","invoices",cp(e))}var bg=X(()=>{"use strict";Zw();DA();En();hr()});async function RPe(t,e,r){return t.list(`/api/v1/${Pl[e]}`,r)}async function cf(t,e,r){return t.get(`/api/v1/${Pl[e]}/${r}`)}async function N2(t,e,r){return t.search(`/api/v1/${Pl[e]}/search`,r)}async function O2(t,e,r){return t.search(`/api/v1/${Pl[e]}/line-items/search`,r)}async function xR(t,e){return t.post("/api/v1/sale-quotes",{...e,saveAsDraft:e.saveAsDraft??!0})}async function TR(t,e){return t.post("/api/v1/sale-orders",e)}async function F2(t,e,r,n){return t.post(`/api/v1/${Pl[e]}/${r}/convert-to-invoice`,n)}async function Q2(t,e,r,n){return t.put(`/api/v1/${Pl[e]}/${r}`,n)}async function L2(t,e,r){await t.delete(`/api/v1/${Pl[e]}/${r}`)}async function M2(t,e,r,n){return t.post(`/api/v1/${Pl[e]}/${r}/void`,n?{internalNotes:n}:{})}async function P2(t,e){return t.post(`/api/v1/sale-quotes/${e}/accept`,{})}async function U2(t,e){return t.post(`/api/v1/sale-orders/${e}/confirm`,{})}async function xPe(t,e,r,n){return t.post(`/api/v1/${Pl[e]}/${r}/fast-fix`,{attributes:n})}async function TPe(t,e,r,n){return t.post(`/api/v1/${Pl[e]}/bulk-void`,{resourceIds:r,...n?{internalNotes:n}:{}})}async function BPe(t,e){return t.post("/api/v1/sale-quotes/bulk-accept",{resourceIds:e})}async function kPe(t,e){return t.post("/api/v1/sale-orders/bulk-confirm",{resourceIds:e})}async function NPe(t,e,r){return t.post(`/api/v1/${Pl[e]}/bulk-delete`,{resourceIds:r})}async function OPe(t,e){return t.post("/api/v1/sale-orders/line-items/bulk-upsert",{saleOrders:e})}var Pl,yK=X(()=>{"use strict";Pl={SALE_QUOTE:"sale-quotes",SALE_ORDER:"sale-orders"}});async function FPe(t,e,r){return t.list(`/api/v1/${Ul[e]}`,r)}async function lf(t,e,r){return t.get(`/api/v1/${Ul[e]}/${r}`)}async function $2(t,e,r){return t.search(`/api/v1/${Ul[e]}/search`,r)}async function q2(t,e,r){return t.search(`/api/v1/${Ul[e]}/line-items/search`,r)}async function BR(t,e){return t.post("/api/v1/purchase-requests",{...e,saveAsDraft:e.saveAsDraft??!0})}async function kR(t,e){return t.post("/api/v1/purchase-orders",{...e,saveAsDraft:e.saveAsDraft??!0})}async function j2(t,e,r,n){return t.post(`/api/v1/${Ul[e]}/${r}/convert-to-bill`,n)}async function Y2(t,e,r,n){return t.put(`/api/v1/${Ul[e]}/${r}`,n)}async function H2(t,e,r){await t.delete(`/api/v1/${Ul[e]}/${r}`)}async function z2(t,e,r,n){return t.post(`/api/v1/${Ul[e]}/${r}/void`,n?{internalNotes:n}:{})}async function G2(t,e){return t.post(`/api/v1/purchase-requests/${e}/accept`,{})}async function J2(t,e){return t.post(`/api/v1/purchase-orders/${e}/confirm`,{})}async function QPe(t,e,r,n){return t.post(`/api/v1/${Ul[e]}/${r}/fast-fix`,{attributes:n})}async function LPe(t,e,r,n){return t.post(`/api/v1/${Ul[e]}/bulk-void`,{resourceIds:r,...n?{internalNotes:n}:{}})}async function MPe(t,e){return t.post("/api/v1/purchase-requests/bulk-accept",{resourceIds:e})}async function PPe(t,e){return t.post("/api/v1/purchase-orders/bulk-confirm",{resourceIds:e})}async function UPe(t,e,r){return t.post(`/api/v1/${Ul[e]}/bulk-delete`,{resourceIds:r})}async function $Pe(t,e){return t.post("/api/v1/purchase-orders/line-items/bulk-upsert",{purchaseOrders:e})}var Ul,EK=X(()=>{"use strict";Ul={PURCHASE_REQUEST:"purchase-requests",PURCHASE_ORDER:"purchase-orders"}});async function V2(t,e){return t.list("/api/v1/journals",e)}async function NR(t,e){return t.search("/api/v1/journals/search",e)}async function Cg(t,e){return t.post("/api/v1/journals",{...e,currency:Sr(e.currency),taxCurrency:Sr(e.taxCurrency),saveAsDraft:e.saveAsDraft??!0})}async function W2(t,e,r){return t.delete(`/api/v1/journals/${e}`,r)}async function $l(t,e){return t.get(`/api/v1/journals/${e}`)}async function qC(t,e,r){return t.put(`/api/v1/journals/${e}`,{...r,currency:Sr(r.currency),taxCurrency:Sr(r.taxCurrency)})}async function qPe(t,e,r){return t.put(`/api/v1/journals/${e}`,{...r,resourceId:e,saveAsDraft:!1})}async function OR(t,e){return t.post("/api/v1/scheduled/journals",e)}async function Z2(t,e){return ho(t,"/api/v1/journals/bulk-upsert","journals",e)}async function jPe(t,e){return ls(e,"resourceId","Pass the journal resourceId."),t.get(`/api/v1/journals/${encodeURIComponent(e)}/download`)}var Ig=X(()=>{"use strict";En();hr()});async function X2(t,e){return t.post("/api/v1/generate-reports/trial-balance",e)}async function K2(t,e){return t.post("/api/v1/generate-reports/balance-sheet",e)}async function eU(t,e){return t.post("/api/v1/generate-reports/profit-and-loss",e)}async function tU(t,e){return t.post("/api/v1/generate-reports/cashflow",e)}async function rU(t,e){return t.post("/api/v1/generate-reports/ar-summary-report",e)}async function nU(t,e){return t.post("/api/v1/generate-reports/ap-summary-report",e)}function jC(t,e){let{root:r,rows:n}=szt[e],i=t.data?.[r]??{},o=Array.isArray(i[n])?i[n]:[],s={current:0,lessThanOneMonth:0,oneMonth:0,twoMonths:0,threeMonths:0,older:0,total:0};for(let u of o)s.current+=u.currentIso??0,s.lessThanOneMonth+=u.lessThanOneMonthIso??0,s.oneMonth+=u.oneMonthIso??0,s.twoMonths+=u.twoMonthsIso??0,s.threeMonths+=u.threeMonthsIso??0,s.older+=u.olderIso??0,s.total+=u.balanceIso??0;let a=u=>Math.round(u*100)/100,c=i.startDate;return{reportType:e==="receivables"?"AGED_RECEIVABLES":"AGED_PAYABLES",organizationName:i.organizationName,asAt:typeof c=="number"?new Date(c).toISOString().slice(0,10):void 0,currencyCode:i.currencyCode,currencySymbol:i.currencySymbol,buckets:{current:a(s.current),lessThanOneMonth:a(s.lessThanOneMonth),oneMonth:a(s.oneMonth),twoMonths:a(s.twoMonths),threeMonths:a(s.threeMonths),older:a(s.older)},totalOutstanding:a(s.total),contactCount:o.length}}async function iU(t,e){return t.post("/api/v1/generate-reports/cash-balance",e)}async function oU(t,e){return t.post("/api/v1/generate-reports/general-ledger",e)}async function sU(t,e){return t.post("/api/v1/generate-reports/vat-ledger",e)}async function aU(t,e){return t.post("/api/v1/generate-reports/equity-movement",e)}async function cU(t,e){return t.post("/api/v1/generate-reports/bank-balance-summary",e)}async function lU(t,e){return t.post("/api/v1/generate-reports/bank-reconciliation-summary",e)}async function uU(t,e){return t.post("/api/v1/generate-reports/bank-reconciliation-details",e)}async function dU(t,e){return t.post("/api/v1/generate-reports/fixed-assets-summary",e)}async function fU(t,e){return t.post("/api/v1/generate-reports/fixed-assets-recon-summary",e)}async function pU(t,e){return t.post("/api/v1/generate-reports/ar-report",e)}async function hU(t){return t.get("/api/v1/ledger/highlights")}var szt,bK=X(()=>{"use strict";szt={receivables:{root:"generateAgedReceivablesReportGroupByContact",rows:"customerSummary"},payables:{root:"generateAgedPayablesReportGroupByContact",rows:"supplierSummary"}}});async function mU(t,e){return t.list("/api/v1/catalogs",e)}async function AU(t,e){return t.get(`/api/v1/catalogs/${encodeURIComponent(e)}`)}async function gU(t,e){return t.search("/api/v1/catalogs/search",e)}async function yU(t,e){return t.post("/api/v1/catalogs",e)}async function EU(t,e,r){return t.put(`/api/v1/catalogs/${encodeURIComponent(e)}`,r)}async function bU(t,e){await t.delete(`/api/v1/catalogs/${encodeURIComponent(e)}`)}var CK=X(()=>{"use strict"});async function YPe(t,e){let r=await t.list("/api/v1/organization-report-template",e),{reportTemplates:n,...i}=r;return Array.isArray(n)&&n.length>0&&(!r.data||r.data.length===0)?{...i,data:n,totalElements:n.length,totalPages:1}:r}async function HPe(t,e){return t.get(`/api/v1/organization-report-template/${encodeURIComponent(e)}`)}async function zPe(t,e){return t.search("/api/v1/organization-report-template/search",e)}var GPe=X(()=>{"use strict"});async function CU(t,e){return t.list("/api/v1/customer-credit-notes",e)}async function za(t,e){return t.get(`/api/v1/customer-credit-notes/${e}`)}async function FR(t,e){return t.search("/api/v1/customer-credit-notes/search",e)}async function QR(t,e){return t.post("/api/v1/customer-credit-notes",{...e,currency:Sr(e.currency),taxCurrency:Sr(e.taxCurrency),saveAsDraft:e.saveAsDraft??!0})}async function IU(t,e,r){let n=r.lineItems?{...r,lineItems:r.lineItems.map(fp)}:r,i=await bc(n,()=>za(t,e));return t.put(`/api/v1/customer-credit-notes/${e}`,i)}async function LR(t,e,r){let n=await bc({...r,resourceId:e,saveAsDraft:!1},()=>za(t,e));return t.put(`/api/v1/customer-credit-notes/${e}`,n)}async function vU(t,e,r){return t.delete(`/api/v1/customer-credit-notes/${e}`,r)}async function MR(t,e,r){return t.post(`/api/v1/customer-credit-notes/${e}/refunds`,{...r,currency:Sr(r.currency),saveAsDraft:r.saveAsDraft??!0})}async function wU(t,e){return t.get(`/api/v1/customer-credit-notes/${e}/refunds`)}async function _U(t,e){return t.get(`/api/v1/customer-credit-notes/${e}/download`)}async function DU(t,e){return ho(t,"/api/v1/customer-credit-notes/bulk-upsert","customerCreditNotes",cp(e))}var SU=X(()=>{"use strict";Zw();DA();En();hr()});async function RU(t,e){return t.list("/api/v1/supplier-credit-notes",e)}async function Ga(t,e){return t.get(`/api/v1/supplier-credit-notes/${e}`)}async function PR(t,e){return t.search("/api/v1/supplier-credit-notes/search",e)}async function UR(t,e){return t.post("/api/v1/supplier-credit-notes",{...e,currency:Sr(e.currency),taxCurrency:Sr(e.taxCurrency),saveAsDraft:e.saveAsDraft??!0})}async function xU(t,e,r){let n=r.lineItems?{...r,lineItems:r.lineItems.map(fp)}:r,i=await bc(n,()=>Ga(t,e));return t.put(`/api/v1/supplier-credit-notes/${e}`,i)}async function $R(t,e,r){let n=await bc({...r,resourceId:e,saveAsDraft:!1},()=>Ga(t,e));return t.put(`/api/v1/supplier-credit-notes/${e}`,n)}async function TU(t,e,r){return t.delete(`/api/v1/supplier-credit-notes/${e}`,r)}async function BU(t,e){return t.get(`/api/v1/supplier-credit-notes/${e}/download`)}async function qR(t,e,r){return t.post(`/api/v1/supplier-credit-notes/${e}/refunds`,{...r,currency:Sr(r.currency),saveAsDraft:r.saveAsDraft??!0})}async function kU(t,e){return t.get(`/api/v1/supplier-credit-notes/${e}/refunds`)}async function NU(t,e){return ho(t,"/api/v1/supplier-credit-notes/bulk-upsert","supplierCreditNotes",cp(e))}var OU=X(()=>{"use strict";Zw();DA();En();hr()});async function jR(t){return t.get("/api/v1/organization/currencies")}async function FU(t,e){return t.post("/api/v1/organization/currencies",{currencies:e})}async function QU(t,e,r){return t.list(`/api/v1/organization/currencies/${e}/rates`,r)}function JPe(t){X9(t.rate,"rate");let e=Z9(t.rateDirection);return{...t,rateDirection:e}}async function LU(t,e,r){return t.post(`/api/v1/organization/currencies/${e}/rates`,JPe(r))}async function MU(t,e,r,n){return t.put(`/api/v1/organization/currencies/${e}/rates/${r}`,JPe(n))}async function PU(t,e){return t.post("/api/v1/organization/currencies/rates/bulk-upsert",{rates:e})}var UU=X(()=>{"use strict";hr()});var VPe=b((IK,vK)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof vK=="object"&&typeof IK<"u"?vK.exports=e():t.Papa=e()})(IK,function t(){"use strict";var e=(function(){return typeof self<"u"?self:typeof window<"u"?window:typeof e<"u"?e:{}})();function r(){var D=e.URL||e.webkitURL||null,B=t.toString();return a.BLOB_URL||(a.BLOB_URL=D.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",B,")();"],{type:"text/javascript"})))}var n=!e.document&&!!e.postMessage,i=e.IS_PAPA_WORKER||!1,o={},s=0,a={};if(a.parse=u,a.unparse=d,a.RECORD_SEP="",a.UNIT_SEP="",a.BYTE_ORDER_MARK="\uFEFF",a.BAD_DELIMITERS=["\r",`
|
|
443
443
|
`,'"',a.BYTE_ORDER_MARK],a.WORKERS_SUPPORTED=!n&&!!e.Worker,a.NODE_STREAM_INPUT=1,a.LocalChunkSize=1024*1024*10,a.RemoteChunkSize=1024*1024*5,a.DefaultDelimiter=",",a.Parser=E,a.ParserHandle=y,a.NetworkStreamer=p,a.FileStreamer=h,a.StringStreamer=m,a.ReadableStreamStreamer=A,typeof PAPA_BROWSER_CONTEXT>"u"&&(a.DuplexStreamStreamer=g),e.jQuery){var c=e.jQuery;c.fn.parse=function(D){var B=D.config||{},L=[];return this.each(function(J){var W=c(this).prop("tagName").toUpperCase()==="INPUT"&&c(this).attr("type").toLowerCase()==="file"&&e.FileReader;if(!W||!this.files||this.files.length===0)return!0;for(var oe=0;oe<this.files.length;oe++)L.push({file:this.files[oe],inputElem:this,instanceConfig:c.extend({},B)})}),V(),this;function V(){if(L.length===0){j(D.complete)&&D.complete();return}var J=L[0];if(j(D.before)){var W=D.before(J.file,J.inputElem);if(typeof W=="object")if(W.action==="abort"){k("AbortError",J.file,J.inputElem,W.reason);return}else if(W.action==="skip"){U();return}else typeof W.config=="object"&&(J.instanceConfig=c.extend(J.instanceConfig,W.config));else if(W==="skip"){U();return}}var oe=J.instanceConfig.complete;J.instanceConfig.complete=function(me){j(oe)&&oe(me,J.file,J.inputElem),U()},a.parse(J.file,J.instanceConfig)}function k(J,W,oe,me){j(D.error)&&D.error({name:J},W,oe,me)}function U(){L.splice(0,1),V()}}}i&&(e.onmessage=O);function u(D,B){B=B||{};var L=B.dynamicTyping||!1;if(j(L)&&(B.dynamicTypingFunction=L,L={}),B.dynamicTyping=L,B.transform=j(B.transform)?B.transform:!1,B.worker&&a.WORKERS_SUPPORTED){var V=I();V.userStep=B.step,V.userChunk=B.chunk,V.userComplete=B.complete,V.userError=B.error,B.step=j(B.step),B.chunk=j(B.chunk),B.complete=j(B.complete),B.error=j(B.error),delete B.worker,V.postMessage({input:D,config:B,workerId:V.id});return}var k=null;if(D===a.NODE_STREAM_INPUT&&typeof PAPA_BROWSER_CONTEXT>"u")return k=new g(B),k.getStream();return typeof D=="string"?(D=U(D),B.download?k=new p(B):k=new m(B)):D.readable===!0&&j(D.read)&&j(D.on)?k=new A(B):(e.File&&D instanceof File||D instanceof Object)&&(k=new h(B)),k.stream(D);function U(J){return J.charCodeAt(0)===65279?J.slice(1):J}}function d(D,B){var L=!1,V=!0,k=",",U=`\r
|
|
444
444
|
`,J='"',W=J+J,oe=!1,me=null,Re=!1;pt();var we=new RegExp(C(J),"g");if(typeof D=="string"&&(D=JSON.parse(D)),Array.isArray(D)){if(!D.length||Array.isArray(D[0]))return xe(null,D,oe);if(typeof D[0]=="object")return xe(me||Object.keys(D[0]),D,oe)}else if(typeof D=="object")return typeof D.data=="string"&&(D.data=JSON.parse(D.data)),Array.isArray(D.data)&&(D.fields||(D.fields=D.meta&&D.meta.fields||me),D.fields||(D.fields=Array.isArray(D.data[0])?D.fields:typeof D.data[0]=="object"?Object.keys(D.data[0]):[]),!Array.isArray(D.data[0])&&typeof D.data[0]!="object"&&(D.data=[D.data])),xe(D.fields||[],D.data||[],oe);throw new Error("Unable to serialize unrecognized input");function pt(){if(typeof B=="object"){if(typeof B.delimiter=="string"&&!a.BAD_DELIMITERS.filter(function(le){return B.delimiter.indexOf(le)!==-1}).length&&(k=B.delimiter),(typeof B.quotes=="boolean"||typeof B.quotes=="function"||Array.isArray(B.quotes))&&(L=B.quotes),(typeof B.skipEmptyLines=="boolean"||typeof B.skipEmptyLines=="string")&&(oe=B.skipEmptyLines),typeof B.newline=="string"&&(U=B.newline),typeof B.quoteChar=="string"&&(J=B.quoteChar),typeof B.header=="boolean"&&(V=B.header),Array.isArray(B.columns)){if(B.columns.length===0)throw new Error("Option columns is empty");me=B.columns}B.escapeChar!==void 0&&(W=B.escapeChar+J),B.escapeFormulae instanceof RegExp?Re=B.escapeFormulae:typeof B.escapeFormulae=="boolean"&&B.escapeFormulae&&(Re=/^[=+\-@\t\r].*$/)}}function xe(le,Ie,Ne){var He="";typeof le=="string"&&(le=JSON.parse(le)),typeof Ie=="string"&&(Ie=JSON.parse(Ie));var Lt=Array.isArray(le)&&le.length>0,Tt=!Array.isArray(Ie[0]);if(Lt&&V){for(var sr=0;sr<le.length;sr++)sr>0&&(He+=k),He+=Me(le[sr],sr);Ie.length>0&&(He+=U)}for(var Je=0;Je<Ie.length;Je++){var $e=Lt?le.length:Ie[Je].length,Et=!1,Pe=Lt?Object.keys(Ie[Je]).length===0:Ie[Je].length===0;if(Ne&&!Lt&&(Et=Ne==="greedy"?Ie[Je].join("").trim()==="":Ie[Je].length===1&&Ie[Je][0].length===0),Ne==="greedy"&&Lt){for(var Xe=[],tt=0;tt<$e;tt++){var Ke=Tt?le[tt]:tt;Xe.push(Ie[Je][Ke])}Et=Xe.join("").trim()===""}if(!Et){for(var ae=0;ae<$e;ae++){ae>0&&!Pe&&(He+=k);var K=Lt&&Tt?le[ae]:ae;He+=Me(Ie[Je][K],ae)}Je<Ie.length-1&&(!Ne||$e>0&&!Pe)&&(He+=U)}}return He}function Me(le,Ie){if(typeof le>"u"||le===null)return"";if(le.constructor===Date)return JSON.stringify(le).slice(1,25);var Ne=!1;Re&&typeof le=="string"&&Re.test(le)&&(le="'"+le,Ne=!0);var He=le.toString().replace(we,W);return Ne=Ne||L===!0||typeof L=="function"&&L(le,Ie)||Array.isArray(L)&&L[Ie]||fe(He,a.BAD_DELIMITERS)||He.indexOf(k)>-1||He.charAt(0)===" "||He.charAt(He.length-1)===" ",Ne?J+He+J:He}function fe(le,Ie){for(var Ne=0;Ne<Ie.length;Ne++)if(le.indexOf(Ie[Ne])>-1)return!0;return!1}}function f(D){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},B.call(this,D),this.parseChunk=function(L,V){let k=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&k>0){let Re=this._config.newline;if(!Re){let pt=this._config.quoteChar||'"';Re=this._handle.guessLineEndings(L,pt)}L=[...L.split(Re).slice(k)].join(Re)}if(this.isFirstChunk&&j(this._config.beforeFirstChunk)){var U=this._config.beforeFirstChunk(L);U!==void 0&&(L=U)}this.isFirstChunk=!1,this._halted=!1;var J=this._partialLine+L;this._partialLine="";var W=this._handle.parse(J,this._baseIndex,!this._finished);if(this._handle.paused()||this._handle.aborted()){this._halted=!0;return}var oe=W.meta.cursor;this._finished||(this._partialLine=J.substring(oe-this._baseIndex),this._baseIndex=oe),W&&W.data&&(this._rowCount+=W.data.length);var me=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(i)e.postMessage({results:W,workerId:a.WORKER_ID,finished:me});else if(j(this._config.chunk)&&!V){if(this._config.chunk(W,this._handle),this._handle.paused()||this._handle.aborted()){this._halted=!0;return}W=void 0,this._completeResults=void 0}return!this._config.step&&!this._config.chunk&&(this._completeResults.data=this._completeResults.data.concat(W.data),this._completeResults.errors=this._completeResults.errors.concat(W.errors),this._completeResults.meta=W.meta),!this._completed&&me&&j(this._config.complete)&&(!W||!W.meta.aborted)&&(this._config.complete(this._completeResults,this._input),this._completed=!0),!me&&(!W||!W.meta.paused)&&this._nextChunk(),W},this._sendError=function(L){j(this._config.error)?this._config.error(L):i&&this._config.error&&e.postMessage({workerId:a.WORKER_ID,error:L,finished:!1})};function B(L){var V=N(L);V.chunkSize=parseInt(V.chunkSize),!L.step&&!L.chunk&&(V.chunkSize=null),this._handle=new y(V),this._handle.streamer=this,this._config=V}}function p(D){D=D||{},D.chunkSize||(D.chunkSize=a.RemoteChunkSize),f.call(this,D);var B;n?this._nextChunk=function(){this._readChunk(),this._chunkLoaded()}:this._nextChunk=function(){this._readChunk()},this.stream=function(V){this._input=V,this._nextChunk()},this._readChunk=function(){if(this._finished){this._chunkLoaded();return}if(B=new XMLHttpRequest,this._config.withCredentials&&(B.withCredentials=this._config.withCredentials),n||(B.onload=z(this._chunkLoaded,this),B.onerror=z(this._chunkError,this)),B.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var V=this._config.downloadRequestHeaders;for(var k in V)B.setRequestHeader(k,V[k])}if(this._config.chunkSize){var U=this._start+this._config.chunkSize-1;B.setRequestHeader("Range","bytes="+this._start+"-"+U)}try{B.send(this._config.downloadRequestBody)}catch(J){this._chunkError(J.message)}n&&B.status===0&&this._chunkError()},this._chunkLoaded=function(){if(B.readyState===4){if(B.status<200||B.status>=400){this._chunkError();return}this._start+=this._config.chunkSize?this._config.chunkSize:B.responseText.length,this._finished=!this._config.chunkSize||this._start>=L(B),this.parseChunk(B.responseText)}},this._chunkError=function(V){var k=B.statusText||V;this._sendError(new Error(k))};function L(V){var k=V.getResponseHeader("Content-Range");return k===null?-1:parseInt(k.substring(k.lastIndexOf("/")+1))}}p.prototype=Object.create(f.prototype),p.prototype.constructor=p;function h(D){D=D||{},D.chunkSize||(D.chunkSize=a.LocalChunkSize),f.call(this,D);var B,L,V=typeof FileReader<"u";this.stream=function(k){this._input=k,L=k.slice||k.webkitSlice||k.mozSlice,V?(B=new FileReader,B.onload=z(this._chunkLoaded,this),B.onerror=z(this._chunkError,this)):B=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){!this._finished&&(!this._config.preview||this._rowCount<this._config.preview)&&this._readChunk()},this._readChunk=function(){var k=this._input;if(this._config.chunkSize){var U=Math.min(this._start+this._config.chunkSize,this._input.size);k=L.call(k,this._start,U)}var J=B.readAsText(k,this._config.encoding);V||this._chunkLoaded({target:{result:J}})},this._chunkLoaded=function(k){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(k.target.result)},this._chunkError=function(){this._sendError(B.error)}}h.prototype=Object.create(f.prototype),h.prototype.constructor=h;function m(D){D=D||{},f.call(this,D);var B;this.stream=function(L){return B=L,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var L=this._config.chunkSize,V;return L?(V=B.substring(0,L),B=B.substring(L)):(V=B,B=""),this._finished=!B,this.parseChunk(V)}}}m.prototype=Object.create(m.prototype),m.prototype.constructor=m;function A(D){D=D||{},f.call(this,D);var B=[],L=!0,V=!1;this.pause=function(){f.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){f.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(k){this._input=k,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){V&&B.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),B.length?this.parseChunk(B.shift()):L=!0},this._streamData=z(function(k){try{B.push(typeof k=="string"?k:k.toString(this._config.encoding)),L&&(L=!1,this._checkIsFinished(),this.parseChunk(B.shift()))}catch(U){this._streamError(U)}},this),this._streamError=z(function(k){this._streamCleanUp(),this._sendError(k)},this),this._streamEnd=z(function(){this._streamCleanUp(),V=!0,this._streamData("")},this),this._streamCleanUp=z(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}A.prototype=Object.create(f.prototype),A.prototype.constructor=A;function g(D){var B=P("stream").Duplex,L=N(D),V=!0,k=!1,U=[],J=null;this._onCsvData=function(W){var oe=W.data;!J.push(oe)&&!this._handle.paused()&&this._handle.pause()},this._onCsvComplete=function(){J.push(null)},L.step=z(this._onCsvData,this),L.complete=z(this._onCsvComplete,this),f.call(this,L),this._nextChunk=function(){k&&U.length===1&&(this._finished=!0),U.length?U.shift()():V=!0},this._addToParseQueue=function(W,oe){U.push(z(function(){if(this.parseChunk(typeof W=="string"?W:W.toString(L.encoding)),j(oe))return oe()},this)),V&&(V=!1,this._nextChunk())},this._onRead=function(){this._handle.paused()&&this._handle.resume()},this._onWrite=function(W,oe,me){this._addToParseQueue(W,me)},this._onWriteComplete=function(){k=!0,this._addToParseQueue("")},this.getStream=function(){return J},J=new B({readableObjectMode:!0,decodeStrings:!1,read:z(this._onRead,this),write:z(this._onWrite,this)}),J.once("finish",z(this._onWriteComplete,this))}typeof PAPA_BROWSER_CONTEXT>"u"&&(g.prototype=Object.create(f.prototype),g.prototype.constructor=g);function y(D){var B=Math.pow(2,53),L=-B,V=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,k=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,U=this,J=0,W=0,oe,me,Re=!1,we=!1,pt,xe=[],Me={data:[],errors:[],meta:{}};if(j(D.step)){var fe=D.step;D.step=function(Pe){if(Me=Pe,He())Ne();else{if(Ne(),Me.data.length===0)return;J+=Pe.data.length,D.preview&&J>D.preview?me.abort():(Me.data=Me.data[0],fe(Me,U))}}}this.parse=function(Pe,Xe,tt){var Ke=D.quoteChar||'"';if(D.newline||(D.newline=this.guessLineEndings(Pe,Ke)),pt=!1,D.delimiter)j(D.delimiter)&&(D.delimiter=D.delimiter(Pe),Me.meta.delimiter=D.delimiter);else{var ae=$e(Pe,D.newline,D.skipEmptyLines,D.comments,D.delimitersToGuess);ae.successful?D.delimiter=ae.bestDelimiter:(pt=!0,D.delimiter=a.DefaultDelimiter),Me.meta.delimiter=D.delimiter}var K=N(D);return D.preview&&D.header&&K.preview++,oe=Pe,me=new E(K),Me=me.parse(oe,Xe,tt),Ne(),Re?{meta:{paused:!0}}:Me||{meta:{paused:!1}}},this.paused=function(){return Re},this.pause=function(){Re=!0,me.abort(),oe=j(D.chunk)?"":oe.substring(me.getCharIndex())},this.resume=function(){U.streamer._halted?(Re=!1,U.streamer.parseChunk(oe,!0)):setTimeout(U.resume,3)},this.aborted=function(){return we},this.abort=function(){we=!0,me.abort(),Me.meta.aborted=!0,j(D.complete)&&D.complete(Me),oe=""},this.guessLineEndings=function(Pe,Xe){Pe=Pe.substring(0,1024*1024);var tt=new RegExp(C(Xe)+"([^]*?)"+C(Xe),"gm");Pe=Pe.replace(tt,"");var Ke=Pe.split("\r"),ae=Pe.split(`
|
|
445
445
|
`),K=ae.length>1&&ae[0].length<Ke[0].length;if(Ke.length===1||K)return`
|
|
@@ -681,7 +681,7 @@ Call with { operation, arguments${o?`, ${nu}`:""}${a.length?", file":""}${t?", o
|
|
|
681
681
|
`+r.map(u0).join(`
|
|
682
682
|
`)+(t?`
|
|
683
683
|
|
|
684
|
-
Multiple organizations are accessible: pass org_id (from list_organizations) to target one. Confirm the organization with the user before any create/update/delete.`:""),u={operation:{type:"string",enum:n,description:`The ${e.name} operation to run.`},arguments:{type:"object",description:"Parameters for the chosen operation (see the operation list above). Validated by the Jaz API.",additionalProperties:!0}};return o&&(u[nu]={type:"string",description:Hot}),a.length&&(u.file={type:"object",description:`A file from the conversation, when the client supports passing one. Accepted by: ${a.join(", ")}. The content is fetched server-side \u2014 leave source arguments out of \`arguments\`.`,properties:{download_url:{type:"string",description:"URL the file content can be fetched from (may be temporary)."},file_id:{type:"string",description:"Host-side file identifier."},mime_type:{type:"string"},file_name:{type:"string"}},required:["download_url"]}),t&&(u.org_id={type:"string",description:"The organization (resourceId from list_organizations) to run this operation against. Required when more than one organization is accessible."}),{name:e.name,description:c,inputSchema:{type:"object",properties:u,required:["operation"],additionalProperties:!1},...a.length?{_meta:{"openai/fileParams":["file"]}}:{},annotations:{title:`${e.title??Cwr(e.name)} \xB7 ${r.length} operation${r.length===1?"":"s"}`,readOnlyHint:i,destructiveHint:!i&&s,idempotentHint:i,openWorldHint:!1}}})}function Jot(t){return Iwr.has(t)}function Zfe(t,e){let r=xi.find(o=>o.name===t);if(!r)return{error:`Unknown namespace: ${t}.`};let n=Got(r.groups),i=n.find(o=>o.name===e||o.aliases?.includes(e));return i?{tool:i}:{error:`Unknown operation "${e}" for the ${t} tool.`,operations:n.map(o=>o.name)}}var Iwr,nk=X(()=>{"use strict";ud();dd();l0();O3();Iwr=new Set(xi.map(t=>t.name))});var Vot={};So(Vot,{loadAgentSuiteContent:()=>Rwr});import{readFileSync as vwr}from"node:fs";import{dirname as wwr,join as _wr}from"node:path";import{fileURLToPath as Dwr}from"node:url";function Rwr(){return Xfe||(Xfe=JSON.parse(vwr(_wr(Swr,"agent-suite-content.json"),"utf8"))),Xfe}var Swr,Xfe,Wot=X(()=>{"use strict";Swr=wwr(Dwr(import.meta.url)),Xfe=null});var Zot={};So(Zot,{buildCapabilityMap:()=>Twr});async function xwr(){try{let{loadAgentSuiteContent:t}=await Promise.resolve().then(()=>(Wot(),Vot)),e=t().counts;return{cli_command_groups:e.commands,api_rules:e.apiRules,skills:e.skills,ifrs_recipes:e.recipes,calculators:e.calculators,job_playbooks:e.jobs}}catch{return}}async function Twr(t={}){if(t.query&&t.query.trim())return B3(t.query);if(t.namespace){let r=xi.find(i=>i.name===t.namespace);if(!r)return{error:`Unknown namespace "${t.namespace}".`,namespaces:xi.map(i=>i.name),hint:"Call with no arguments for the full map, or pass `query` to rank operations by keyword."};let n=a0(r.groups);return{namespace:r.name,description:r.description,operations:n.length,operation_list:n.map(u0),hint:"Call the namespace tool with { operation, arguments }, or execute_tool with the operation name on a meta-tool surface."}}let e=Wy(t.surface,t.multiOrg);return{...e,map:t.full?tk().map(r=>({...r,operation_list:a0(xi.find(n=>n.name===r.namespace).groups).map(u0)})):e.map,beyond_mcp:await xwr()}}var Xot=X(()=>{"use strict";ud();nk();l0();R3()});import{randomUUID as Bwr}from"node:crypto";function ust(t,e,r){return{type:"object",description:`The ${t.toLowerCase()} to create. Required.`,properties:{reference:{type:"string",description:`${t} reference`},contactResourceId:{type:"string",description:`${e} UUID`},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},dueDate:{type:"string",description:"YYYY-MM-DD. Defaults to value date."},taxInclusion:{type:"boolean"},isTaxVATApplicable:{type:"boolean"},lineItems:{type:"array",description:`${t} line items (max 500)`,items:{type:"object",properties:{name:{type:"string",description:"Line description"},quantity:{type:"number"},unit:{type:"string"},unitPrice:{type:"number"},organizationAccountResourceId:{type:"string",description:`${r} account UUID`},itemResourceId:{type:"string"},taxProfileResourceId:{type:"string"}},required:["name"]}},recordedPayment:{type:"object",description:"Optional. The matching payment record \u2014 auto-built from the bank entry if omitted.",properties:{reference:{type:"string"},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},organizationAccountResourceId:{type:"string"},paymentAmount:{type:"number"},transactionAmount:{type:"number"},paymentMethod:f0,adjustment:p0}},capsuleResourceId:{type:"string"}},required:["reference","lineItems"]}}function wst(t){let e=t.limit,r=t.offset;return{limit:e,offset:r,sortBy:void 0,sortOrder:void 0}}function Ar(t,e,r,n,i,o){let s={...cpe};return o?.leanView&&(s.view={type:"string",enum:["lean","full"],description:"Payload tier: 'lean' (default) = summary row (id + key scalars); 'full' = whole entity per row (heavier). List lean, then drill in with get_*."}),{name:t,description:e,params:s,required:[],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:5e4,...i?{searchHint:i}:{},execute:async(a,c)=>{let{limit:u,offset:d}=wst(c),f=o?.leanView?c.view==="full"?"full":"lean":void 0;return FD((h,m)=>n(a.client,h,m,f),u,d,f==="lean"?50:20)}}}function Ti(t,e,r,n,i,o){return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:2e4,...i?{searchHint:i}:{},execute:async(s,a)=>n(s.client,a.resourceId)}}function _st(t,e,r,n){return{[e]:!0,...oZ(t),[r]:n}}function sk(t){return`Deletes a DRAFT ${t}; VOIDs an active one and KEEPS it. force: true hard-deletes either.`}function Xr(t,e,r,n,i,o){let s=o?.verb??"deleted";return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"},...o?.voidable?Mwr:{}},required:["resourceId"],group:r,readOnly:!1,isDestructive:!0,...i?{searchHint:i}:{},execute:async(a,c)=>{let u=c.resourceId;ls(u,"resourceId",`Nothing was deleted. Source a real resourceId from a search_* or list_* result before calling ${t}.`);let d=c.force,f=await n(a.client,u,{force:d,internalNotes:c.internalNotes});return o?.voidable?Oc(f,u,d):_st(f,s,"resourceId",u)}}}function ak(t,e,r,n){return{name:t,description:`Download ${/^[aeiou]/i.test(e)?"an":"a"} ${e} as PDF. Returns { fileUrl } (may be pending/empty if the document is not yet rendered).`,params:{resourceId:{type:"string",description:`${e[0].toUpperCase()}${e.slice(1)} resourceId`}},required:["resourceId"],group:r,readOnly:!0,searchHint:`download ${e} as PDF document file`,isConcurrencySafe:!0,execute:async(i,o)=>n(i.client,o.resourceId)}}function ape(t,e,r,n,i){return{name:t,description:e,params:{resourceId:{type:"string",description:"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!1,...i?.destructive?{isDestructive:!0}:{},...i?.searchHint?{searchHint:i.searchHint}:{},execute:async(o,s)=>n(o.client,s.resourceId)}}function mst(t){if(typeof t!="string"||/^\d{4}-\d{2}-\d{2}$/.test(t))return t;let e=/^(\d{4}-\d{2}-\d{2})T/.exec(t);return e?e[1]:t}function Ywr(t){return Array.isArray(t)?t.map(e=>{let r={};for(let[n,i]of Object.entries(e)){if(i==null)continue;let o=tZ.get(n);if(o)r[o]=i;else if(n==="taxProfile"&&typeof i=="object"&&i!==null){let s=i.resourceId;s&&(r.taxProfileResourceId=s)}else if(n==="discount"&&typeof i=="object"&&i!==null){let s=i.rateValue;s&&Number(s)!==0&&(r.discount=i)}else jwr.has(n)&&(r[n]=i)}return r}):t}async function ck(t,e,r,n){let s=(await(e==="invoice"?Po:e==="bill"?Oo:e==="customer_credit_note"?za:Ga)(t,r)).data,a=qwr[e],c={};for(let[p,h]of Object.entries(s))a.has(p)&&h!==null&&h!==void 0&&(c[p]=h);c.valueDate&&(c.valueDate=mst(c.valueDate)),c.dueDate&&(c.dueDate=mst(c.dueDate)),c.lineItems&&(c.lineItems=Ywr(c.lineItems));for(let[p,h]of Object.entries(n))h!==void 0&&(c[p]=h);let u=e==="invoice"?il:e==="bill"?Ea:ao,{missingFields:d,ready:f}=Js(c,u);if(!f)throw new Error(`Cannot finalize: missing ${d.join(", ")}. Use search_accounts (filter by accountType) and search_contacts to resolve, then pass the missing fields to this tool.`);return c}async function Ast(t,e,r,n){if((await t(e,r)).data.status==="DRAFT")throw new Error(`Cannot pay a DRAFT ${n}. Finalize it first with finalize_${n}.`)}function P3(t,e,r){if(!(typeof t=="string"&&e.includes(t)))return{error:`Unknown documentType ${JSON.stringify(t)}.`,status:422,hint:`Use one of: ${e.join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}}}function Est(t,e,r){let n=yst[t];if(!n)return{error:`Unknown documentType "${t}".`,status:422,hint:`Valid document types: ${Object.keys(yst).join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}};if(!n.includes(e)){let i=n.includes("ACCEPT")?"ACCEPT":"CONFIRM";return{error:`Action "${e}" is not valid for ${t}. Valid actions: ${n.join(", ")}.`,status:422,hint:`${t} advances its lifecycle with ${i}, not ${e}.`,repair:{tool:r,arguments:{documentType:t,action:i},reason:`${t} is advanced with ${i}.`}}}}async function bst(t,e,r,n,i,o,s){let a;try{a=(await e(t,r)).data?.status}catch{return}if(a==="DRAFT"||a==="VOID"){let c=a==="DRAFT"?`A DRAFT ${n} can't be linked or accepted \u2014 issue it by creating the ${n} with saveAsDraft:false (status ${s}), then link the order to that one.`:`A VOID ${n} can't be used \u2014 create a fresh ${n} (saveAsDraft:false) and link to it.`;return{error:`Cannot create an order linked to a ${a} ${n} (${r}).`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. ${c}`,repair:{tool:o,arguments:{documentType:i,saveAsDraft:!1},reason:c}}}}async function Cst(t,e,r,n,i,o){let s;try{s=(await e(t,r)).data?.status}catch{return}if(s==="VOID")return{error:`Cannot convert a VOID ${n} (${r}) into a ${i}.`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. Convert a non-VOID ${n}.`,repair:{tool:o,arguments:{},reason:`The source ${n} is VOID.`}}}async function Ist(t,e,r,n,i){let o;try{o=(await e(t,r,n)).data?.status}catch{return}if(o&&o!=="DRAFT")return{error:`Cannot DELETE a ${o} ${r} \u2014 delete is only allowed on DRAFT records.`,status:422,hint:"Use action VOID to cancel a non-draft quote/request/order.",repair:{tool:i,arguments:{documentType:r,resourceId:n,action:"VOID"},reason:`${r} is ${o}; void it instead of deleting.`}}}var kwr,Kfe,rc,vo,iu,wo,fd,ui,pd,Q3,Xy,Kot,Nwr,est,tst,epe,tpe,d0,ik,Owr,Fwr,rpe,rst,nst,npe,cpe,ou,ipe,ist,ost,sst,ast,Qi,cst,ok,Qwr,ope,L3,ba,lst,vst,hd,f0,p0,Lwr,Mwr,dst,fst,pst,Pwr,Uwr,spe,hst,$wr,qwr,jwr,lk,uk,M3,gst,yst,jf,U3=X(()=>{"use strict";BM();EC();rZ();CFe();SFe();sg();kD();ka();fr();hr();vA();Fu();XE();SPe();gK();dp();bg();Ld();yK();EK();Ig();bK();Lp();t1();y1();o_();CK();GPe();SU();OU();UU();hit();a_();w1();f_();uz();m_();E2();Ez();Jde();Vde();Oz();Wde();ofe();lfe();Git();Lp();PB();ffe();pfe();Jz();sot();Cfe();Ife();vfe();lot();Sfe();Rm();Rfe();xD();xfe();Tfe();A_();H7();fot();yot();bot();cZ();Cot();Nfe();N8();Ofe();Ffe();Qfe();Lfe();Mfe();Pfe();Ufe();$fe();dp();bg();qfe();Ig();Oot();Ld();SU();OU();Ig();N8();En();Yfe();zfe();fr();Jfe();$ot();kwr=jM.join(" | "),Kfe=["PURCHASE","SALE","JOURNAL_MANUAL","JOURNAL_CASHFLOW","JOURNAL_DIRECT_CASH_IN","JOURNAL_DIRECT_CASH_OUT","JOURNAL_CASH_TRANSFER"],rc={type:"string",description:"Resource ID of the record"},vo={type:"string",description:"Transaction date (YYYY-MM-DD)"},iu={type:"string",description:"Due date (YYYY-MM-DD)"},wo={type:"string",description:"Reference number"},fd={type:"boolean",description:"Use the org's own next number instead of `reference`."},ui={type:"string",description:"Notes or memo text"},pd={type:"string",description:"Tag name for categorization"},Q3={type:"boolean",description:"Save as draft (default true). Set false to finalize immediately."},Xy={type:"boolean",description:"Return full entity (default: minimal {resourceId} only). Saves a follow-up get_* round trip."},Kot={recipe:{type:"string",enum:[...zy],description:"Recipe type"},amount:{type:"number",description:"Amount (for amortization, accrued-expense, dividend, ecl, provision, fx-reval)"},principal:{type:"number",description:"Principal (for loan, fixed-deposit)"},startDate:{type:"string",description:"Start date YYYY-MM-DD (REQUIRED for blueprint generation \u2014 default to today if user does not specify)"},currency:{type:"string",description:"Currency code (e.g. SGD, USD)"},periods:{type:"number",description:"Number of periods (for amortization, accrued-expense, leave-accrual)"},frequency:{type:"string",enum:["monthly","quarterly","annual"],description:"Frequency (for depreciation, amortization, accrued-expense)"},annualRate:{type:"number",description:"Annual interest/discount rate %"},termMonths:{type:"number"},monthlyPayment:{type:"number",description:"Monthly lease payment (for lease)"},usefulLifeMonths:{type:"number",description:"Asset useful life in months (hire purchase)"},cost:{type:"number",description:"Asset cost"},salvageValue:{type:"number"},usefulLifeYears:{type:"number"},method:{type:"string",enum:["sl","ddb","150db"],description:"Depreciation method"},acquisitionDate:{type:"string",description:"Acquisition date YYYY-MM-DD"},disposalDate:{type:"string",description:"Disposal date YYYY-MM-DD"},proceeds:{type:"number",description:"Disposal proceeds"},bookRate:{type:"number",description:"Original booking rate. Declare which way it reads via rateDirection (REQUIRED for fx-reval)."},closingRate:{type:"number",description:"Period-end closing rate. Same direction as bookRate."},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:"REQUIRED for fx-reval. FUNCTIONAL_TO_SOURCE = 1 base unit = N foreign, what list_currency_rates returns. SOURCE_TO_FUNCTIONAL = 1 foreign unit = N base, the everyday quote."},position:{type:"string",enum:["ASSET","LIABILITY"],description:"Balance-sheet side: ASSET (receivable/deposit, default) or LIABILITY (payable/provision). A rising base value is a gain on an asset and a loss on a liability."},baseCurrency:{type:"string",description:"Base (functional) currency"},buckets:{type:"array",items:{type:"object",properties:{name:{type:"string"},balance:{type:"number"},rate:{type:"number"}},required:["name","balance","rate"]},description:"ECL aging buckets"},existingProvision:{type:"number",description:"Existing ECL provision balance"},compounding:{type:"string",enum:["none","monthly","quarterly","annually"]},employees:{type:"number"},daysPerYear:{type:"number",description:"Leave days per employee per year"},dailyRate:{type:"number",description:"Average daily rate"},declarationDate:{type:"string",description:"Board resolution date YYYY-MM-DD"},paymentDate:{type:"string",description:"Settlement date YYYY-MM-DD"},withholdingRate:{type:"number",description:"Withholding tax rate %"}},Nwr={type:"boolean",description:"Retry-only: set true after the duplicate guard surfaced a candidate and the user confirmed this is a separate document. Never on a first attempt."},est={type:"string",enum:[...aZ],description:"CUSTOM (default) = free text; ALL_* = a picklist of that population. Datatype is derived, not chosen."},tst={type:"object",properties:{address:{type:"string",description:"Street address \u2014 sent as addressLine1"},city:{type:"string"},state:{type:"string"},postalCode:{type:"string"},country:{type:"string"}},required:["address","country"]},epe={type:"string",description:"Contact resourceId (customer or supplier)"},tpe={type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID)"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Draft entity type"}},required:["btResourceId","btType"]}},d0={type:"string",description:"Chart-of-accounts account the line posts to (revenue on a sale, expense on a purchase)"},ik={type:"string",description:"Account the payment posts to. For paymentMethod BANK_TRANSFER/CASH/CHEQUE this MUST be a bank or cash account. Any other method accepts any org account \u2014 that is how a deposit drawdown works (paymentMethod OTHER + the deposit account)."},Owr={type:"number",description:"Payment amount (in bank currency)"},Fwr={type:"string",description:"Period start date (YYYY-MM-DD)"},rpe={type:"string",description:"Period end date (YYYY-MM-DD)"},rst={type:"string",enum:["full","aggregate"],description:`Output detail (default 'full'). 'aggregate' returns a compact aging-bucket summary (current, <1 month, 1/2/3 months, older + total outstanding + contact count). Prefer 'aggregate' for a general or unqualified report request (e.g. "show me my aged receivables", "my AR report") \u2014 it's the at-a-glance overview a chat user expects and it won't truncate on large orgs. Use 'full' only when the user explicitly asks for the per-contact (customer/supplier) breakdown for deeper analysis.`},nst={type:"string",description:"Currency code (e.g. SGD, USD)"},npe={type:"string",description:"Display name"},cpe={limit:{type:"number",description:"Max results per page (\u22641000)."},offset:{type:"number",description:"Page offset (0-indexed). Use with limit to paginate."}},ou={type:"object",required:["sourceCurrency"],properties:{sourceCurrency:{type:"string",description:"Foreign currency code (ISO 4217)."},exchangeRate:{type:"number",description:'Base\u2192source: N where 1 org-base unit = N sourceCurrency. Invert ONLY if your quote reads "1 source = X base" (send 1/X), or declare rateDirection and skip the arithmetic. Omit for the org/platform rate.'},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:"How exchangeRate reads. SOURCE_TO_FUNCTIONAL accepts a bank quote verbatim. Default FUNCTIONAL_TO_SOURCE."}}},ipe={type:"string",enum:[...tf],description:"Entity type to export"},ist={type:"string",description:'Structured search query using dashboard syntax (e.g., "status:unpaid $500+ date:this month"). Mutually exclusive with filter \u2014 pass one or the other, never both.'},ost={type:"object",description:'Raw JSON filter object (e.g., {"status":{"in":["UNPAID"]}}). Mutually exclusive with query \u2014 pass one or the other, never both.'},sst={type:"array",items:{type:"object",properties:{path:{type:"string",description:"Column path from get_export_columns (e.g., s.reference)"},header:{type:"string",description:"Column header label in the export file"},type:{type:"string",enum:["STRING","NUMBER","CURRENCY","DATE","BOOLEAN"],description:"Column data type (optional)"}},required:["path","header"]},description:"Custom column definitions. Omit to use default columns. Use get_export_columns to discover available paths."},ast={type:"object",properties:{field:{type:"string",description:"Column path to sort by (e.g., s.total_amount)"},direction:{type:"string",enum:["ASC","DESC"],description:"Sort direction"}},required:["field"],description:"Sort results by a column path."},Qi={type:"array",items:{type:"object",properties:{customFieldName:{type:"string"},actualValue:{type:"string"}}},description:'Custom field values: [{ customFieldName: "PO Number", actualValue: "PO-123" }]'},cst={type:"array",description:"Full replacement line-item set \u2014 non-empty REPLACES all lines, [] clears, omit = no change. claimTypeResourceId + name + unitPrice + quantity are required at submit time.",items:{type:"object",properties:{resourceId:{type:"string",description:"Existing line resourceId (omit to add a new line)"},claimTypeResourceId:{type:"string",description:"Claim type resourceId"},name:{type:"string",description:"Line name"},description:{type:"string",description:"Line description"},unitPrice:{type:"number",description:"Unit price"},quantity:{type:"number",description:"Quantity"},currency:{type:"string",description:"Line currency (ISO 4217; falls back to header)"},itemSubTotal:{type:"number",description:"Line subtotal (unitPrice \xD7 quantity)"}}}},ok={type:"array",items:{type:"string"},description:"Claim resourceIds (1-500)"},Qwr={type:"array",items:{type:"object",required:["resourceId","type","selectedClasses","printable"],properties:{resourceId:{type:"string",description:"Capsule type resourceId"},type:{type:"string",enum:["invoice","bill"],description:"Resource type"},selectedClasses:{type:"array",items:{type:"object",required:["className"],properties:{className:{type:"string"},resourceId:rc}}},printable:{type:"boolean",description:"Show on printed documents."}}},description:"Nano classifier config for line items. Each entry links a capsule type with selected classes."},ope={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Account resourceId"},type:{type:"string",enum:["DEBIT","CREDIT"],description:"Debit or credit"},amount:{type:"number",description:"Amount"},description:{type:"string",description:"Line description"}},required:["accountResourceId","type","amount"]},description:"Journal entries (debit/credit lines with accountResourceId, type, amount)"},L3={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Offset account resourceId"},amount:{type:"number",description:"Amount (positive; direction comes from the endpoint)"},description:{type:"string",description:"Line description"},taxProfileResourceId:{type:"string",description:"Tax profile resourceId"}},required:["accountResourceId","amount"]},description:"Offset lines. No `type` \u2014 cash-in credits these and cash-out debits them, decided by the endpoint."},ba={type:"array",items:{type:"object",properties:{name:{type:"string",description:"Line item description/name"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:d0,taxProfileResourceId:{type:"string"},classifierConfig:Qwr},required:["name","quantity","unitPrice"]},description:"Line items \u2014 include accountResourceId on each line when finalizing (saveAsDraft: false)"},lst={type:"array",items:{type:"object",properties:{itemName:{type:"string",description:"Display name of the catalog item"},itemResourceId:{type:"string",description:"Underlying item resourceId (from search_items)"},price:{type:"number",description:"Default unit price (0-1e9)"},unit:{type:"string",description:"Unit of measure"},quantityDefault:{type:"number",description:"Default quantity when added to a document (0-100)"},discountDefault:{type:"number",description:"Default discount % when added to a document (0-100)"},uiIndex:{type:"number",description:"Display position in the catalog (integer, min 0)"},classifiers:{type:"array",items:{type:"object"},description:"Classifier assignments. Same shape as classifierConfig on invoice/bill line items."}},required:["itemName","itemResourceId","price"]},description:"Catalog item rows. itemName, itemResourceId and price are required on every row."},vst={type:"array",items:{type:"object",properties:{slotKey:{type:"string",description:"Slot from get_capsule_recipe templateSlots[]."},template:{type:"string",description:"Text with {{vars}} for that slot; empty string clears a nullable slot. Max 2000."}},required:["slotKey"]},description:"Optional. Customize recipe-generated text via published slots (see get_capsule_recipe)."},hd={type:"object",description:"Optional IFRS recipe trigger. Mutex with capsuleResourceId. Silent-null on failure \u2014 preview_capsule_recipe first. Rule 143.",properties:{recipeName:{type:"string",enum:["LOAN_AMORTIZATION","ACCRUAL_REVERSAL","PREPAID_AMORTIZATION","DEFERRED_REVENUE","IFRS16_LEASE"],description:"Must match mutation's allowedBaseTransactionTypes (see list_capsule_recipes)."},recipeVersion:{type:"number",description:"Optional version pin."},inputs:{type:"object",description:"Schema at versions[0].inputSchema. Single-currency; *AccountResourceId x-accountClass-locked."},templateOverrides:vst},required:["recipeName","inputs"]},f0={type:"string",enum:[...XFe],description:"Payment method (default BANK_TRANSFER)"},p0={type:"object",description:"Cash-leg adjustment (overpayment/rounding). Bank leg only, never AR/AP. Not with DEBT_WRITE_OFF/CLEARING_SETTLEMENT/INTER_COMPANY/WITHHOLDING_TAX_CERTIFICATE. See rule 160.",properties:{adjustmentValue:{type:"number",description:"Signed, non-zero, max 2dp"},adjustmentAccountResourceId:{type:"string",description:"Non-controlled account, not bank/cash"},adjustmentDescription:{type:"string",description:"Optional"}},required:["adjustmentValue","adjustmentAccountResourceId"]},Lwr={...p0,description:"Adding or changing an adjustment applies here. REMOVING does not: 0 is rejected and null reads as omitted, so both leave the stored value unchanged. To remove one, delete the payment and record it again. A change is rejected if the payment is reconciled or lock-dated, and amount, account and description are all compared, so resend all three unchanged if you are not editing it. See rule 160."};Mwr={force:{type:"boolean",description:iZ.force},internalNotes:{type:"string",description:iZ.internalNotes}};dst={type:"string",description:"Document family",enum:[...Vy]},fst={type:"string",description:"Document family",enum:[...o0]},pst={type:"string",description:"Why it is sent back. Opens a thread; the only record of the reason."},Pwr=[{name:"approve_documents",description:"Approve one document awaiting approval. Posts its ledger entries and makes it live. One-shot, and the refusal channel differs by entity: invoices/bills THROW 422; credit notes return 200 with isSuccess:false and a STALE approvalStatus of APPROVED. Check isSuccess and catch the throw \u2014 approvalStatus alone cannot tell refusal from success.",params:{entity:dst,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"approvals",readOnly:!1,searchHint:"approve pending invoice bill credit note post ledger",execute:async(t,e)=>c3(t.client,e.entity,e.resourceId)},{name:"bulk_approve_documents",description:"Approve up to 100 documents awaiting approval. Async \u2014 returns a jobId; poll search_background_jobs. Each approval posts a ledger.",params:{entity:dst,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-100)"}},required:["entity","resourceIds"],group:"approvals",readOnly:!1,searchHint:"bulk approve many pending documents at once",execute:async(t,e)=>l3(t.client,e.entity,e.resourceIds)},{name:"request_document_changes",description:"Send one document back for changes instead of approving it. Also covers orders, quotes, requests and claims.",params:{entity:fst,resourceId:{type:"string",description:"Document resourceId"},message:pst},required:["entity","resourceId","message"],group:"approvals",readOnly:!1,searchHint:"request changes reject send back document for revision",execute:async(t,e)=>u3(t.client,e.entity,e.resourceId,e.message)},{name:"bulk_request_document_changes",description:"Send up to 500 documents back for changes with one message. Async \u2014 returns a jobId; poll search_background_jobs.",params:{entity:fst,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-500)"},message:pst},required:["entity","resourceIds","message"],group:"approvals",readOnly:!1,searchHint:"bulk request changes send back many documents",execute:async(t,e)=>d3(t.client,e.entity,e.resourceIds,e.message)}],Uwr=["journals","purchases","sales","purchase-credit-notes","sale-credit-notes"],spe={type:"string",description:"Document family",enum:Uwr},hst={type:"string",description:"Version id from get_document_version_history"},$wr=[{name:"get_document_version_history",description:"The stored versions of a document, newest first. Not paginated. Use before restoring to pick a version id.",params:{entity:spe,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"versions",readOnly:!0,searchHint:"list document version history revisions audit trail",isConcurrencySafe:!0,execute:async(t,e)=>Tot(t.client,e.entity,e.resourceId)},{name:"get_document_version",description:"Read one stored version of a document. An unknown resourceId/version pair returns 422.",params:{entity:spe,resourceId:{type:"string",description:"Document resourceId"},version:hst},required:["entity","resourceId","version"],group:"versions",readOnly:!0,searchHint:"get read one document version snapshot",isConcurrencySafe:!0,execute:async(t,e)=>Bot(t.client,e.entity,e.resourceId,e.version)},{name:"rollback_document_version",description:"Restore a document to a stored version. REPLACES current state \u2014 read the version first with get_document_version. `CREATED` is NOT a restorable version and is refused: upstream DELETES the document for it and still answers 200.",params:{entity:spe,resourceId:{type:"string",description:"Document resourceId"},version:hst},required:["entity","resourceId","version"],group:"versions",readOnly:!1,searchHint:"restore rollback document to previous version undo changes",isDestructive:!0,execute:async(t,e)=>kot(t.client,e.entity,e.resourceId,e.version)},{name:"get_currency_effective_rate",description:"The organization effective rate for a currency on a date: its own custom rate when set, else the platform daily rate. Defaults to today.",params:{currencyCode:{type:"string",description:"ISO 4217 code, e.g. USD (not a resourceId)"},date:{type:"string",description:"YYYY-MM-DD (optional, defaults to today)"}},required:["currencyCode"],group:"currencies",readOnly:!0,searchHint:"currency effective exchange rate for a date custom or platform",isConcurrencySafe:!0,execute:async(t,e)=>Not(t.client,e.currencyCode,e.date)}];qwr={invoice:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","notes","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId","customerPaymentProfileResourceId"]),bill:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId"]),customer_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"]),supplier_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"])};jwr=new Set(["name","quantity","unitPrice","unit","accountResourceId","taxProfileResourceId","description","classifierConfig","itemResourceId","discount"]);lk={type:"string",enum:["SALE_QUOTE","SALE_ORDER"],description:"Which sales document: SALE_QUOTE (estimate) or SALE_ORDER."},uk={type:"string",enum:["PURCHASE_REQUEST","PURCHASE_ORDER"],description:"Which purchase document: PURCHASE_REQUEST (requisition) or PURCHASE_ORDER."},M3={type:"number",description:"Payment terms in days (one of 0, 7, 15, 30, 45, 60)."},gst={type:"string",enum:["ACCEPT","CONFIRM","VOID","DELETE"],description:"Lifecycle action. ACCEPT=quote/request only; CONFIRM=order only; VOID=any non-draft; DELETE=draft only."},yst={SALE_QUOTE:["ACCEPT","VOID","DELETE"],SALE_ORDER:["CONFIRM","VOID","DELETE"],PURCHASE_REQUEST:["ACCEPT","VOID","DELETE"],PURCHASE_ORDER:["CONFIRM","VOID","DELETE"]};jf=[{name:"get_next_reference",description:"Next document number in the org's own series. Same number the web app prefills. Reading does NOT reserve it \u2014 two callers reading at once get the same value. Date embedded is always today. Never invent a reference; use this.",params:{type:{type:"string",description:"Document family whose next number is wanted.",enum:[...W7]}},required:["type"],group:"organization",readOnly:!0,noCache:!0,searchHint:"next reference number document numbering series auto reference",isConcurrencySafe:!0,maxResultSizeChars:5e3,execute:async(t,e)=>Z7(t.client,e.type)},{name:"get_organization",description:"Get organization details: name, base currency, country, and financial year end.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"get organization details currency country fiscal year",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>Na(t.client)},{name:"get_my_context",description:"Resolve the CALLER's own context \u2014 identity, the employee bound to their login (if any), and per-module access (moduleRoles). Use to route a receipt (bill if PURCHASES access, expense claim if EMPLOYEE_CLAIMS access). A service api-key usually has no bound employee. Magic claim drafts auto-bind the uploader server-side \u2014 no need to read employee.resourceId to bind one.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"who am i my employee my permissions module roles what can i do self caller capabilities bills claims",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>X0e(t.client)},Ar("list_accounts","List chart of accounts. Returns account name, code, type, class, status. Paginated \u2014 response includes totalElements. Use limit/offset to page.","accounts",(t,e,r)=>Md(t,{limit:r,offset:e}),"list chart of accounts with code type class status"),Zt({name:"search_accounts",description:'Search chart of accounts. For OR (name or code), use filter: {"or":{"name":{"contains":"X"},"code":{"contains":"X"}}}.',group:"accounts",fields:cR,defaults:lR,fetcher:ZE,searchHint:"find accounts chart of accounts CoA by name code type class status OR search"}),{name:"create_account",description:"Create a new chart of accounts entry. Auto-checks for duplicates by name \u2014 returns existing account if found. Code must be unique. Account class is inferred from accountType.",params:{name:{type:"string",description:"Account name"},code:{type:"string",description:"Account code (unique)"},accountType:{type:"string",description:`Exact API string: ${kwr}. COGS = "Direct Costs". Common variants normalized client-side. "interest expense"/"interest income" is NOT auto-classified \u2014 ask, do not infer: Finance/Financing, Investing or Operating by main business activity.`},currencyCode:{type:"string",description:'Currency code (e.g., "SGD")'},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."}},required:["name","code","accountType"],group:"accounts",readOnly:!1,searchHint:"create new chart of accounts entry with type code lock date",execute:async(t,e)=>{let r=e.name,n=await H1(t.client,r);if(n)return{_guard:"duplicate_skipped",message:`Account "${r}" already exists.`,existing:n};let i=KE(e.accountType);return r_(t.client,{code:e.code,name:r,accountType:i,currencyCode:e.currencyCode,lockDate:e.lockDate})}},{name:"update_account",description:"Update a chart of accounts entry \u2014 rename, re-code, set its period lock date, or remove an existing lock date. Setting lockDate (YYYY-MM-DD) is how an individual ledger account is locked for a period: it blocks recording or editing any transaction on that account dated on or before the lock date. Pass clearLockDate to remove (unlock) an existing lock.",params:{resourceId:{type:"string",description:"Account resourceId"},name:{type:"string",description:"New account name"},code:{type:"string",description:"New account code"},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."},clearLockDate:{type:"boolean",description:"Set true to remove an existing period lock date (unlock the period). Use when the user asks to remove, delete, clear, lift, or unset the lock. Do not also pass lockDate."}},required:["resourceId"],group:"accounts",readOnly:!1,searchHint:"update rename chart of accounts entry name code lock date unlock remove clear lock",execute:async(t,e)=>{let r=e.resourceId,n=(await r1(t.client,r)).data,o=Object.fromEntries(["name","code","classificationType","taxProfileResourceId","currency","description"].filter(a=>n[a]!==void 0&&n[a]!==null).map(a=>[a,n[a]]));!o.classificationType&&n.accountType&&(o.classificationType=n.accountType);let s=e.clearLockDate===!0;if(s&&e.lockDate!==void 0)throw new Error("clearLockDate and lockDate are mutually exclusive \u2014 pass one or the other.");return!s&&typeof n.accountLockDate=="string"&&n.accountLockDate&&(o.lockDate=n.accountLockDate.slice(0,10)),e.name!==void 0&&(o.name=e.name),e.code!==void 0&&(o.code=e.code),!s&&e.lockDate!==void 0&&(o.lockDate=e.lockDate),Nwe(t.client,r,o)}},{name:"bulk_upsert_chart_of_accounts",description:`Bulk create/update CoA entries (max 500). SYNC: returns { resourceIds, failedRows: [{rowIndex, columnName, columnValue, errorCode, errorMessage}], failedCount } \u2014 no jobId polling. PARTIAL_SUCCESS: failed rows surface in failedRows[]; others still succeed.
|
|
684
|
+
Multiple organizations are accessible: pass org_id (from list_organizations) to target one. Confirm the organization with the user before any create/update/delete.`:""),u={operation:{type:"string",enum:n,description:`The ${e.name} operation to run.`},arguments:{type:"object",description:"Parameters for the chosen operation (see the operation list above). Validated by the Jaz API.",additionalProperties:!0}};return o&&(u[nu]={type:"string",description:Hot}),a.length&&(u.file={type:"object",description:`A file from the conversation, when the client supports passing one. Accepted by: ${a.join(", ")}. The content is fetched server-side \u2014 leave source arguments out of \`arguments\`.`,properties:{download_url:{type:"string",description:"URL the file content can be fetched from (may be temporary)."},file_id:{type:"string",description:"Host-side file identifier."},mime_type:{type:"string"},file_name:{type:"string"}},required:["download_url"]}),t&&(u.org_id={type:"string",description:"The organization (resourceId from list_organizations) to run this operation against. Required when more than one organization is accessible."}),{name:e.name,description:c,inputSchema:{type:"object",properties:u,required:["operation"],additionalProperties:!1},...a.length?{_meta:{"openai/fileParams":["file"]}}:{},annotations:{title:`${e.title??Cwr(e.name)} \xB7 ${r.length} operation${r.length===1?"":"s"}`,readOnlyHint:i,destructiveHint:!i&&s,idempotentHint:i,openWorldHint:!1}}})}function Jot(t){return Iwr.has(t)}function Zfe(t,e){let r=xi.find(o=>o.name===t);if(!r)return{error:`Unknown namespace: ${t}.`};let n=Got(r.groups),i=n.find(o=>o.name===e||o.aliases?.includes(e));return i?{tool:i}:{error:`Unknown operation "${e}" for the ${t} tool.`,operations:n.map(o=>o.name)}}var Iwr,nk=X(()=>{"use strict";ud();dd();l0();O3();Iwr=new Set(xi.map(t=>t.name))});var Vot={};So(Vot,{loadAgentSuiteContent:()=>Rwr});import{readFileSync as vwr}from"node:fs";import{dirname as wwr,join as _wr}from"node:path";import{fileURLToPath as Dwr}from"node:url";function Rwr(){return Xfe||(Xfe=JSON.parse(vwr(_wr(Swr,"agent-suite-content.json"),"utf8"))),Xfe}var Swr,Xfe,Wot=X(()=>{"use strict";Swr=wwr(Dwr(import.meta.url)),Xfe=null});var Zot={};So(Zot,{buildCapabilityMap:()=>Twr});async function xwr(){try{let{loadAgentSuiteContent:t}=await Promise.resolve().then(()=>(Wot(),Vot)),e=t().counts;return{cli_command_groups:e.commands,api_rules:e.apiRules,skills:e.skills,ifrs_recipes:e.recipes,calculators:e.calculators,job_playbooks:e.jobs}}catch{return}}async function Twr(t={}){if(t.query&&t.query.trim())return B3(t.query);if(t.namespace){let r=xi.find(i=>i.name===t.namespace);if(!r)return{error:`Unknown namespace "${t.namespace}".`,namespaces:xi.map(i=>i.name),hint:"Call with no arguments for the full map, or pass `query` to rank operations by keyword."};let n=a0(r.groups);return{namespace:r.name,description:r.description,operations:n.length,operation_list:n.map(u0),hint:"Call the namespace tool with { operation, arguments }, or execute_tool with the operation name on a meta-tool surface."}}let e=Wy(t.surface,t.multiOrg);return{...e,map:t.full?tk().map(r=>({...r,operation_list:a0(xi.find(n=>n.name===r.namespace).groups).map(u0)})):e.map,beyond_mcp:await xwr()}}var Xot=X(()=>{"use strict";ud();nk();l0();R3()});import{randomUUID as Bwr}from"node:crypto";function ust(t,e,r){return{type:"object",description:`The ${t.toLowerCase()} to create. Required.`,properties:{reference:{type:"string",description:`${t} reference`},contactResourceId:{type:"string",description:`${e} UUID`},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},dueDate:{type:"string",description:"YYYY-MM-DD. Defaults to value date."},taxInclusion:{type:"boolean"},isTaxVATApplicable:{type:"boolean"},lineItems:{type:"array",description:`${t} line items (max 500)`,items:{type:"object",properties:{name:{type:"string",description:"Line description"},quantity:{type:"number"},unit:{type:"string"},unitPrice:{type:"number"},organizationAccountResourceId:{type:"string",description:`${r} account UUID`},itemResourceId:{type:"string"},taxProfileResourceId:{type:"string"}},required:["name"]}},recordedPayment:{type:"object",description:"Optional. The matching payment record \u2014 auto-built from the bank entry if omitted.",properties:{reference:{type:"string"},valueDate:{type:"string",description:"YYYY-MM-DD. Defaults to bank entry value date."},organizationAccountResourceId:{type:"string"},paymentAmount:{type:"number"},transactionAmount:{type:"number"},paymentMethod:f0,adjustment:p0}},capsuleResourceId:{type:"string"}},required:["reference","lineItems"]}}function wst(t){let e=t.limit,r=t.offset;return{limit:e,offset:r,sortBy:void 0,sortOrder:void 0}}function Ar(t,e,r,n,i,o){let s={...cpe};return o?.leanView&&(s.view={type:"string",enum:["lean","full"],description:"Payload tier: 'lean' (default) = summary row (id + key scalars); 'full' = whole entity per row (heavier). List lean, then drill in with get_*."}),{name:t,description:e,params:s,required:[],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:5e4,...i?{searchHint:i}:{},execute:async(a,c)=>{let{limit:u,offset:d}=wst(c),f=o?.leanView?c.view==="full"?"full":"lean":void 0;return FD((h,m)=>n(a.client,h,m,f),u,d,f==="lean"?50:20)}}}function Ti(t,e,r,n,i,o){return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:2e4,...i?{searchHint:i}:{},execute:async(s,a)=>n(s.client,a.resourceId)}}function _st(t,e,r,n){return{[e]:!0,...oZ(t),[r]:n}}function sk(t){return`Deletes a DRAFT ${t}; VOIDs an active one and KEEPS it. force: true hard-deletes either.`}function Xr(t,e,r,n,i,o){let s=o?.verb??"deleted";return{name:t,description:e,params:{resourceId:{type:"string",description:o?.paramDescription??"Resource ID (UUID)"},...o?.voidable?Mwr:{}},required:["resourceId"],group:r,readOnly:!1,isDestructive:!0,...i?{searchHint:i}:{},execute:async(a,c)=>{let u=c.resourceId;ls(u,"resourceId",`Nothing was deleted. Source a real resourceId from a search_* or list_* result before calling ${t}.`);let d=c.force,f=await n(a.client,u,{force:d,internalNotes:c.internalNotes});return o?.voidable?Oc(f,u,d):_st(f,s,"resourceId",u)}}}function ak(t,e,r,n){return{name:t,description:`Download ${/^[aeiou]/i.test(e)?"an":"a"} ${e} as PDF. Returns { fileUrl } (may be pending/empty if the document is not yet rendered).`,params:{resourceId:{type:"string",description:`${e[0].toUpperCase()}${e.slice(1)} resourceId`}},required:["resourceId"],group:r,readOnly:!0,searchHint:`download ${e} as PDF document file`,isConcurrencySafe:!0,execute:async(i,o)=>n(i.client,o.resourceId)}}function ape(t,e,r,n,i){return{name:t,description:e,params:{resourceId:{type:"string",description:"Resource ID (UUID)"}},required:["resourceId"],group:r,readOnly:!1,...i?.destructive?{isDestructive:!0}:{},...i?.searchHint?{searchHint:i.searchHint}:{},execute:async(o,s)=>n(o.client,s.resourceId)}}function mst(t){if(typeof t!="string"||/^\d{4}-\d{2}-\d{2}$/.test(t))return t;let e=/^(\d{4}-\d{2}-\d{2})T/.exec(t);return e?e[1]:t}function Ywr(t){return Array.isArray(t)?t.map(e=>{let r={};for(let[n,i]of Object.entries(e)){if(i==null)continue;let o=tZ.get(n);if(o)r[o]=i;else if(n==="taxProfile"&&typeof i=="object"&&i!==null){let s=i.resourceId;s&&(r.taxProfileResourceId=s)}else if(n==="discount"&&typeof i=="object"&&i!==null){let s=i.rateValue;s&&Number(s)!==0&&(r.discount=i)}else jwr.has(n)&&(r[n]=i)}return r}):t}async function ck(t,e,r,n){let s=(await(e==="invoice"?Po:e==="bill"?Oo:e==="customer_credit_note"?za:Ga)(t,r)).data,a=qwr[e],c={};for(let[p,h]of Object.entries(s))a.has(p)&&h!==null&&h!==void 0&&(c[p]=h);c.valueDate&&(c.valueDate=mst(c.valueDate)),c.dueDate&&(c.dueDate=mst(c.dueDate)),c.lineItems&&(c.lineItems=Ywr(c.lineItems));for(let[p,h]of Object.entries(n))h!==void 0&&(c[p]=h);let u=e==="invoice"?il:e==="bill"?Ea:ao,{missingFields:d,ready:f}=Js(c,u);if(!f)throw new Error(`Cannot finalize: missing ${d.join(", ")}. Use search_accounts (filter by accountType) and search_contacts to resolve, then pass the missing fields to this tool.`);return c}async function Ast(t,e,r,n){if((await t(e,r)).data.status==="DRAFT")throw new Error(`Cannot pay a DRAFT ${n}. Finalize it first with finalize_${n}.`)}function P3(t,e,r){if(!(typeof t=="string"&&e.includes(t)))return{error:`Unknown documentType ${JSON.stringify(t)}.`,status:422,hint:`Use one of: ${e.join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}}}function Est(t,e,r){let n=yst[t];if(!n)return{error:`Unknown documentType "${t}".`,status:422,hint:`Valid document types: ${Object.keys(yst).join(", ")}.`,repair:{tool:r,arguments:{},reason:"Pass a supported documentType."}};if(!n.includes(e)){let i=n.includes("ACCEPT")?"ACCEPT":"CONFIRM";return{error:`Action "${e}" is not valid for ${t}. Valid actions: ${n.join(", ")}.`,status:422,hint:`${t} advances its lifecycle with ${i}, not ${e}.`,repair:{tool:r,arguments:{documentType:t,action:i},reason:`${t} is advanced with ${i}.`}}}}async function bst(t,e,r,n,i,o,s){let a;try{a=(await e(t,r)).data?.status}catch{return}if(a==="DRAFT"||a==="VOID"){let c=a==="DRAFT"?`A DRAFT ${n} can't be linked or accepted \u2014 issue it by creating the ${n} with saveAsDraft:false (status ${s}), then link the order to that one.`:`A VOID ${n} can't be used \u2014 create a fresh ${n} (saveAsDraft:false) and link to it.`;return{error:`Cannot create an order linked to a ${a} ${n} (${r}).`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. ${c}`,repair:{tool:o,arguments:{documentType:i,saveAsDraft:!1},reason:c}}}}async function Cst(t,e,r,n,i,o){let s;try{s=(await e(t,r)).data?.status}catch{return}if(s==="VOID")return{error:`Cannot convert a VOID ${n} (${r}) into a ${i}.`,status:422,hint:`Pre-flight guard \u2014 request never hit the API. Convert a non-VOID ${n}.`,repair:{tool:o,arguments:{},reason:`The source ${n} is VOID.`}}}async function Ist(t,e,r,n,i){let o;try{o=(await e(t,r,n)).data?.status}catch{return}if(o&&o!=="DRAFT")return{error:`Cannot DELETE a ${o} ${r} \u2014 delete is only allowed on DRAFT records.`,status:422,hint:"Use action VOID to cancel a non-draft quote/request/order.",repair:{tool:i,arguments:{documentType:r,resourceId:n,action:"VOID"},reason:`${r} is ${o}; void it instead of deleting.`}}}var kwr,Kfe,rc,vo,iu,wo,fd,ui,pd,Q3,Xy,Kot,Nwr,est,tst,epe,tpe,d0,ik,Owr,Fwr,rpe,rst,nst,npe,cpe,ou,ipe,ist,ost,sst,ast,Qi,cst,ok,Qwr,ope,L3,ba,lst,vst,hd,f0,p0,Lwr,Mwr,dst,fst,pst,Pwr,Uwr,spe,hst,$wr,qwr,jwr,lk,uk,M3,gst,yst,jf,U3=X(()=>{"use strict";BM();EC();rZ();CFe();SFe();sg();kD();ka();fr();hr();vA();Fu();XE();SPe();gK();dp();bg();Ld();yK();EK();Ig();bK();Lp();t1();y1();o_();CK();GPe();SU();OU();UU();hit();a_();w1();f_();uz();m_();E2();Ez();Jde();Vde();Oz();Wde();ofe();lfe();Git();Lp();PB();ffe();pfe();Jz();sot();Cfe();Ife();vfe();lot();Sfe();Rm();Rfe();xD();xfe();Tfe();A_();H7();fot();yot();bot();cZ();Cot();Nfe();N8();Ofe();Ffe();Qfe();Lfe();Mfe();Pfe();Ufe();$fe();dp();bg();qfe();Ig();Oot();Ld();SU();OU();Ig();N8();En();Yfe();zfe();fr();Jfe();$ot();kwr=jM.join(" | "),Kfe=["PURCHASE","SALE","JOURNAL_MANUAL","JOURNAL_CASHFLOW","JOURNAL_DIRECT_CASH_IN","JOURNAL_DIRECT_CASH_OUT","JOURNAL_CASH_TRANSFER"],rc={type:"string",description:"Resource ID of the record"},vo={type:"string",description:"Transaction date (YYYY-MM-DD)"},iu={type:"string",description:"Due date (YYYY-MM-DD)"},wo={type:"string",description:"Reference number"},fd={type:"boolean",description:"Use the org's own next number instead of `reference`."},ui={type:"string",description:"Notes or memo text"},pd={type:"string",description:"Tag name for categorization"},Q3={type:"boolean",description:"Save as draft (default true). Set false to finalize immediately."},Xy={type:"boolean",description:"Return full entity (default: minimal {resourceId} only). Saves a follow-up get_* round trip."},Kot={recipe:{type:"string",enum:[...zy],description:"Recipe type"},amount:{type:"number",description:"Amount (for amortization, accrued-expense, dividend, ecl, provision, fx-reval)"},principal:{type:"number",description:"Principal (for loan, fixed-deposit)"},startDate:{type:"string",description:"Start date YYYY-MM-DD (REQUIRED for blueprint generation \u2014 default to today if user does not specify)"},currency:{type:"string",description:"Currency code (e.g. SGD, USD)"},periods:{type:"number",description:"Number of periods (for amortization, accrued-expense, leave-accrual)"},frequency:{type:"string",enum:["monthly","quarterly","annual"],description:"Frequency (for depreciation, amortization, accrued-expense)"},annualRate:{type:"number",description:"Annual interest/discount rate %"},termMonths:{type:"number"},monthlyPayment:{type:"number",description:"Monthly lease payment (for lease)"},usefulLifeMonths:{type:"number",description:"Asset useful life in months (hire purchase)"},cost:{type:"number",description:"Asset cost"},salvageValue:{type:"number"},usefulLifeYears:{type:"number"},method:{type:"string",enum:["sl","ddb","150db"],description:"Depreciation method"},acquisitionDate:{type:"string",description:"Acquisition date YYYY-MM-DD"},disposalDate:{type:"string",description:"Disposal date YYYY-MM-DD"},proceeds:{type:"number",description:"Disposal proceeds"},bookRate:{type:"number",description:"Original booking rate. Declare which way it reads via rateDirection (REQUIRED for fx-reval)."},closingRate:{type:"number",description:"Period-end closing rate. Same direction as bookRate."},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:"REQUIRED for fx-reval. FUNCTIONAL_TO_SOURCE = 1 base unit = N foreign, what list_currency_rates returns. SOURCE_TO_FUNCTIONAL = 1 foreign unit = N base, the everyday quote."},position:{type:"string",enum:["ASSET","LIABILITY"],description:"Balance-sheet side: ASSET (receivable/deposit, default) or LIABILITY (payable/provision). A rising base value is a gain on an asset and a loss on a liability."},baseCurrency:{type:"string",description:"Base (functional) currency"},buckets:{type:"array",items:{type:"object",properties:{name:{type:"string"},balance:{type:"number"},rate:{type:"number"}},required:["name","balance","rate"]},description:"ECL aging buckets"},existingProvision:{type:"number",description:"Existing ECL provision balance"},compounding:{type:"string",enum:["none","monthly","quarterly","annually"]},employees:{type:"number"},daysPerYear:{type:"number",description:"Leave days per employee per year"},dailyRate:{type:"number",description:"Average daily rate"},declarationDate:{type:"string",description:"Board resolution date YYYY-MM-DD"},paymentDate:{type:"string",description:"Settlement date YYYY-MM-DD"},withholdingRate:{type:"number",description:"Withholding tax rate %"}},Nwr={type:"boolean",description:"Retry-only: set true after the duplicate guard surfaced a candidate and the user confirmed this is a separate document. Never on a first attempt."},est={type:"string",enum:[...aZ],description:"CUSTOM (default) = free text; ALL_* = a picklist of that population. Datatype is derived, not chosen."},tst={type:"object",properties:{address:{type:"string",description:"Street address \u2014 sent as addressLine1"},city:{type:"string"},state:{type:"string"},postalCode:{type:"string"},country:{type:"string"}},required:["address","country"]},epe={type:"string",description:"Contact resourceId (customer or supplier)"},tpe={type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID)"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Draft entity type"}},required:["btResourceId","btType"]}},d0={type:"string",description:"Chart-of-accounts account the line posts to (revenue on a sale, expense on a purchase)"},ik={type:"string",description:"Account the payment posts to. For paymentMethod BANK_TRANSFER/CASH/CHEQUE this MUST be a bank or cash account. Any other method accepts any org account \u2014 that is how a deposit drawdown works (paymentMethod OTHER + the deposit account)."},Owr={type:"number",description:"Payment amount (in bank currency)"},Fwr={type:"string",description:"Period start date (YYYY-MM-DD)"},rpe={type:"string",description:"Period end date (YYYY-MM-DD)"},rst={type:"string",enum:["full","aggregate"],description:`Output detail (default 'full'). 'aggregate' returns a compact aging-bucket summary (current, <1 month, 1/2/3 months, older + total outstanding + contact count). Prefer 'aggregate' for a general or unqualified report request (e.g. "show me my aged receivables", "my AR report") \u2014 it's the at-a-glance overview a chat user expects and it won't truncate on large orgs. Use 'full' only when the user explicitly asks for the per-contact (customer/supplier) breakdown for deeper analysis.`},nst={type:"string",description:"Currency code (e.g. SGD, USD)"},npe={type:"string",description:"Display name"},cpe={limit:{type:"number",description:"Max results per page (\u22641000)."},offset:{type:"number",description:"Page offset (0-indexed). Use with limit to paginate."}},ou={type:"object",required:["sourceCurrency"],properties:{sourceCurrency:{type:"string",description:"Foreign currency code (ISO 4217)."},exchangeRate:{type:"number",description:'Base\u2192source: N where 1 org-base unit = N sourceCurrency. Invert ONLY if your quote reads "1 source = X base" (send 1/X), or declare rateDirection and skip the arithmetic. Omit for the org/platform rate.'},rateDirection:{type:"string",enum:["FUNCTIONAL_TO_SOURCE","SOURCE_TO_FUNCTIONAL"],description:"How exchangeRate reads. SOURCE_TO_FUNCTIONAL accepts a bank quote verbatim. Default FUNCTIONAL_TO_SOURCE."}}},ipe={type:"string",enum:[...tf],description:"Entity type to export"},ist={type:"string",description:'Structured search query using dashboard syntax (e.g., "status:unpaid $500+ date:this month"). Mutually exclusive with filter \u2014 pass one or the other, never both.'},ost={type:"object",description:'Raw JSON filter object (e.g., {"status":{"in":["UNPAID"]}}). Mutually exclusive with query \u2014 pass one or the other, never both.'},sst={type:"array",items:{type:"object",properties:{path:{type:"string",description:"Column path from get_export_columns (e.g., s.reference)"},header:{type:"string",description:"Column header label in the export file"},type:{type:"string",enum:["STRING","NUMBER","CURRENCY","DATE","BOOLEAN"],description:"Column data type (optional)"}},required:["path","header"]},description:"Custom column definitions. Omit to use default columns. Use get_export_columns to discover available paths."},ast={type:"object",properties:{field:{type:"string",description:"Column path to sort by (e.g., s.total_amount)"},direction:{type:"string",enum:["ASC","DESC"],description:"Sort direction"}},required:["field"],description:"Sort results by a column path."},Qi={type:"array",items:{type:"object",properties:{customFieldName:{type:"string"},actualValue:{type:"string"}}},description:'Custom field values: [{ customFieldName: "PO Number", actualValue: "PO-123" }]'},cst={type:"array",description:"Full replacement line-item set \u2014 non-empty REPLACES all lines, [] clears, omit = no change. claimTypeResourceId + name + unitPrice + quantity are required at submit time.",items:{type:"object",properties:{resourceId:{type:"string",description:"Existing line resourceId (omit to add a new line)"},claimTypeResourceId:{type:"string",description:"Claim type resourceId"},name:{type:"string",description:"Line name"},description:{type:"string",description:"Line description"},unitPrice:{type:"number",description:"Unit price"},quantity:{type:"number",description:"Quantity"},currency:{type:"string",description:"Line currency (ISO 4217; falls back to header)"},itemSubTotal:{type:"number",description:"Line subtotal (unitPrice \xD7 quantity)"}}}},ok={type:"array",items:{type:"string"},description:"Claim resourceIds (1-500)"},Qwr={type:"array",items:{type:"object",required:["resourceId","type","selectedClasses","printable"],properties:{resourceId:{type:"string",description:"Capsule type resourceId"},type:{type:"string",enum:["invoice","bill"],description:"Resource type"},selectedClasses:{type:"array",items:{type:"object",required:["className"],properties:{className:{type:"string"},resourceId:rc}}},printable:{type:"boolean",description:"Show on printed documents."}}},description:"Nano classifier config for line items. Each entry links a capsule type with selected classes."},ope={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Account resourceId"},type:{type:"string",enum:["DEBIT","CREDIT"],description:"Debit or credit"},amount:{type:"number",description:"Amount"},description:{type:"string",description:"Line description"}},required:["accountResourceId","type","amount"]},description:"Journal entries (debit/credit lines with accountResourceId, type, amount)"},L3={type:"array",items:{type:"object",properties:{accountResourceId:{type:"string",description:"Offset account resourceId"},amount:{type:"number",description:"Amount (positive; direction comes from the endpoint)"},description:{type:"string",description:"Line description"},taxProfileResourceId:{type:"string",description:"Tax profile resourceId"}},required:["accountResourceId","amount"]},description:"Offset lines. No `type` \u2014 cash-in credits these and cash-out debits them, decided by the endpoint."},ba={type:"array",items:{type:"object",properties:{name:{type:"string",description:"Line item description/name"},quantity:{type:"number"},unitPrice:{type:"number"},accountResourceId:d0,taxProfileResourceId:{type:"string"},classifierConfig:Qwr},required:["name","quantity","unitPrice"]},description:"Line items \u2014 include accountResourceId on each line when finalizing (saveAsDraft: false)"},lst={type:"array",items:{type:"object",properties:{itemName:{type:"string",description:"Display name of the catalog item"},itemResourceId:{type:"string",description:"Underlying item resourceId (from search_items)"},price:{type:"number",description:"Default unit price (0-1e9)"},unit:{type:"string",description:"Unit of measure"},quantityDefault:{type:"number",description:"Default quantity when added to a document (0-100)"},discountDefault:{type:"number",description:"Default discount % when added to a document (0-100)"},uiIndex:{type:"number",description:"Display position in the catalog (integer, min 0)"},classifiers:{type:"array",items:{type:"object"},description:"Classifier assignments. Same shape as classifierConfig on invoice/bill line items."}},required:["itemName","itemResourceId","price"]},description:"Catalog item rows. itemName, itemResourceId and price are required on every row."},vst={type:"array",items:{type:"object",properties:{slotKey:{type:"string",description:"Slot from get_capsule_recipe templateSlots[]."},template:{type:"string",description:"Text with {{vars}} for that slot; empty string clears a nullable slot. Max 2000."}},required:["slotKey"]},description:"Optional. Customize recipe-generated text via published slots (see get_capsule_recipe)."},hd={type:"object",description:"Optional IFRS recipe trigger. Mutex with capsuleResourceId. Silent-null on failure \u2014 preview_capsule_recipe first. Rule 143.",properties:{recipeName:{type:"string",enum:["LOAN_AMORTIZATION","ACCRUAL_REVERSAL","PREPAID_AMORTIZATION","DEFERRED_REVENUE","IFRS16_LEASE"],description:"Must match mutation's allowedBaseTransactionTypes (see list_capsule_recipes)."},recipeVersion:{type:"number",description:"Optional version pin."},inputs:{type:"object",description:"Schema at versions[0].inputSchema. Single-currency; *AccountResourceId x-accountClass-locked."},templateOverrides:vst},required:["recipeName","inputs"]},f0={type:"string",enum:[...XFe],description:"Payment method (default BANK_TRANSFER)"},p0={type:"object",description:"Cash-leg adjustment (overpayment/rounding). Bank leg only, never AR/AP. Not with DEBT_WRITE_OFF/CLEARING_SETTLEMENT/INTER_COMPANY/WITHHOLDING_TAX_CERTIFICATE. See rule 160.",properties:{adjustmentValue:{type:"number",description:"Signed, non-zero, max 2dp"},adjustmentAccountResourceId:{type:"string",description:"Non-controlled account, not bank/cash"},adjustmentDescription:{type:"string",description:"Optional"}},required:["adjustmentValue","adjustmentAccountResourceId"]},Lwr={...p0,description:"Adding or changing an adjustment applies here. REMOVING does not: 0 is rejected and null reads as omitted, so both leave the stored value unchanged. To remove one, delete the payment and record it again. A change is rejected if the payment is reconciled or lock-dated, and amount, account and description are all compared, so resend all three unchanged if you are not editing it. See rule 160."};Mwr={force:{type:"boolean",description:iZ.force},internalNotes:{type:"string",description:iZ.internalNotes}};dst={type:"string",description:"Document family",enum:[...Vy]},fst={type:"string",description:"Document family",enum:[...o0]},pst={type:"string",description:"Why it is sent back. Opens a thread; the only record of the reason."},Pwr=[{name:"approve_documents",description:"Approve one document awaiting approval. Posts its ledger entries and makes it live. One-shot, and the refusal channel differs by entity: invoices/bills THROW 422; credit notes return 200 with isSuccess:false and a STALE approvalStatus of APPROVED. Check isSuccess and catch the throw \u2014 approvalStatus alone cannot tell refusal from success.",params:{entity:dst,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"approvals",readOnly:!1,searchHint:"approve pending invoice bill credit note post ledger",execute:async(t,e)=>c3(t.client,e.entity,e.resourceId)},{name:"bulk_approve_documents",description:"Approve up to 100 documents awaiting approval. Async \u2014 returns a jobId; poll search_background_jobs. Each approval posts a ledger.",params:{entity:dst,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-100)"}},required:["entity","resourceIds"],group:"approvals",readOnly:!1,searchHint:"bulk approve many pending documents at once",execute:async(t,e)=>l3(t.client,e.entity,e.resourceIds)},{name:"request_document_changes",description:"Send one document back for changes instead of approving it. Also covers orders, quotes, requests and claims.",params:{entity:fst,resourceId:{type:"string",description:"Document resourceId"},message:pst},required:["entity","resourceId","message"],group:"approvals",readOnly:!1,searchHint:"request changes reject send back document for revision",execute:async(t,e)=>u3(t.client,e.entity,e.resourceId,e.message)},{name:"bulk_request_document_changes",description:"Send up to 500 documents back for changes with one message. Async \u2014 returns a jobId; poll search_background_jobs.",params:{entity:fst,resourceIds:{type:"array",items:{type:"string"},description:"resourceIds (1-500)"},message:pst},required:["entity","resourceIds","message"],group:"approvals",readOnly:!1,searchHint:"bulk request changes send back many documents",execute:async(t,e)=>d3(t.client,e.entity,e.resourceIds,e.message)}],Uwr=["journals","purchases","sales","purchase-credit-notes","sale-credit-notes"],spe={type:"string",description:"Document family",enum:Uwr},hst={type:"string",description:"Version id from get_document_version_history"},$wr=[{name:"get_document_version_history",description:"The stored versions of a document, OLDEST first (last entry = current). Not paginated. Use before restoring to pick a version id.",params:{entity:spe,resourceId:{type:"string",description:"Document resourceId"}},required:["entity","resourceId"],group:"versions",readOnly:!0,searchHint:"list document version history revisions audit trail",isConcurrencySafe:!0,execute:async(t,e)=>Tot(t.client,e.entity,e.resourceId)},{name:"get_document_version",description:"Read one stored version of a document. An unknown resourceId/version pair returns 422.",params:{entity:spe,resourceId:{type:"string",description:"Document resourceId"},version:hst},required:["entity","resourceId","version"],group:"versions",readOnly:!0,searchHint:"get read one document version snapshot",isConcurrencySafe:!0,execute:async(t,e)=>Bot(t.client,e.entity,e.resourceId,e.version)},{name:"rollback_document_version",description:"Restore a document to a stored version. REPLACES current state \u2014 read the version first with get_document_version. `CREATED` is NOT a restorable version and is refused: upstream DELETES the document for it and still answers 200.",params:{entity:spe,resourceId:{type:"string",description:"Document resourceId"},version:hst},required:["entity","resourceId","version"],group:"versions",readOnly:!1,searchHint:"restore rollback document to previous version undo changes",isDestructive:!0,execute:async(t,e)=>kot(t.client,e.entity,e.resourceId,e.version)},{name:"get_currency_effective_rate",description:"The organization effective rate for a currency on a date: its own custom rate when set, else the platform daily rate. Defaults to today.",params:{currencyCode:{type:"string",description:"ISO 4217 code, e.g. USD (not a resourceId)"},date:{type:"string",description:"YYYY-MM-DD (optional, defaults to today)"}},required:["currencyCode"],group:"currencies",readOnly:!0,searchHint:"currency effective exchange rate for a date custom or platform",isConcurrencySafe:!0,execute:async(t,e)=>Not(t.client,e.currencyCode,e.date)}];qwr={invoice:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","notes","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId","customerPaymentProfileResourceId"]),bill:new Set(["reference","valueDate","dueDate","contactResourceId","lineItems","invoiceNotes","internalNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","terms","currency","customFields","capsuleResourceId","capsuleRecipe","taxProfileResourceId"]),customer_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"]),supplier_credit_note:new Set(["reference","valueDate","contactResourceId","lineItems","invoiceNotes","tag","tags","isTaxVatApplicable","isTaxVATApplicable","taxInclusion","currency","customFields","capsuleResourceId","taxProfileResourceId"])};jwr=new Set(["name","quantity","unitPrice","unit","accountResourceId","taxProfileResourceId","description","classifierConfig","itemResourceId","discount"]);lk={type:"string",enum:["SALE_QUOTE","SALE_ORDER"],description:"Which sales document: SALE_QUOTE (estimate) or SALE_ORDER."},uk={type:"string",enum:["PURCHASE_REQUEST","PURCHASE_ORDER"],description:"Which purchase document: PURCHASE_REQUEST (requisition) or PURCHASE_ORDER."},M3={type:"number",description:"Payment terms in days (one of 0, 7, 15, 30, 45, 60)."},gst={type:"string",enum:["ACCEPT","CONFIRM","VOID","DELETE"],description:"Lifecycle action. ACCEPT=quote/request only; CONFIRM=order only; VOID=any non-draft; DELETE=draft only."},yst={SALE_QUOTE:["ACCEPT","VOID","DELETE"],SALE_ORDER:["CONFIRM","VOID","DELETE"],PURCHASE_REQUEST:["ACCEPT","VOID","DELETE"],PURCHASE_ORDER:["CONFIRM","VOID","DELETE"]};jf=[{name:"get_next_reference",description:"Next document number in the org's own series. Same number the web app prefills. Reading does NOT reserve it \u2014 two callers reading at once get the same value. Date embedded is always today. Never invent a reference; use this.",params:{type:{type:"string",description:"Document family whose next number is wanted.",enum:[...W7]}},required:["type"],group:"organization",readOnly:!0,noCache:!0,searchHint:"next reference number document numbering series auto reference",isConcurrencySafe:!0,maxResultSizeChars:5e3,execute:async(t,e)=>Z7(t.client,e.type)},{name:"get_organization",description:"Get organization details: name, base currency, country, and financial year end.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"get organization details currency country fiscal year",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>Na(t.client)},{name:"get_my_context",description:"Resolve the CALLER's own context \u2014 identity, the employee bound to their login (if any), and per-module access (moduleRoles). Use to route a receipt (bill if PURCHASES access, expense claim if EMPLOYEE_CLAIMS access). A service api-key usually has no bound employee. Magic claim drafts auto-bind the uploader server-side \u2014 no need to read employee.resourceId to bind one.",params:{},required:[],group:"organization",readOnly:!0,searchHint:"who am i my employee my permissions module roles what can i do self caller capabilities bills claims",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async t=>X0e(t.client)},Ar("list_accounts","List chart of accounts. Returns account name, code, type, class, status. Paginated \u2014 response includes totalElements. Use limit/offset to page.","accounts",(t,e,r)=>Md(t,{limit:r,offset:e}),"list chart of accounts with code type class status"),Zt({name:"search_accounts",description:'Search chart of accounts. For OR (name or code), use filter: {"or":{"name":{"contains":"X"},"code":{"contains":"X"}}}.',group:"accounts",fields:cR,defaults:lR,fetcher:ZE,searchHint:"find accounts chart of accounts CoA by name code type class status OR search"}),{name:"create_account",description:"Create a new chart of accounts entry. Auto-checks for duplicates by name \u2014 returns existing account if found. Code must be unique. Account class is inferred from accountType.",params:{name:{type:"string",description:"Account name"},code:{type:"string",description:"Account code (unique)"},accountType:{type:"string",description:`Exact API string: ${kwr}. COGS = "Direct Costs". Common variants normalized client-side. "interest expense"/"interest income" is NOT auto-classified \u2014 ask, do not infer: Finance/Financing, Investing or Operating by main business activity.`},currencyCode:{type:"string",description:'Currency code (e.g., "SGD")'},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."}},required:["name","code","accountType"],group:"accounts",readOnly:!1,searchHint:"create new chart of accounts entry with type code lock date",execute:async(t,e)=>{let r=e.name,n=await H1(t.client,r);if(n)return{_guard:"duplicate_skipped",message:`Account "${r}" already exists.`,existing:n};let i=KE(e.accountType);return r_(t.client,{code:e.code,name:r,accountType:i,currencyCode:e.currencyCode,lockDate:e.lockDate})}},{name:"update_account",description:"Update a chart of accounts entry \u2014 rename, re-code, set its period lock date, or remove an existing lock date. Setting lockDate (YYYY-MM-DD) is how an individual ledger account is locked for a period: it blocks recording or editing any transaction on that account dated on or before the lock date. Pass clearLockDate to remove (unlock) an existing lock.",params:{resourceId:{type:"string",description:"Account resourceId"},name:{type:"string",description:"New account name"},code:{type:"string",description:"New account code"},lockDate:{type:"string",description:"Period lock date (YYYY-MM-DD, org timezone). Blocks recording or modifying any GL transaction on this account on or before this date."},clearLockDate:{type:"boolean",description:"Set true to remove an existing period lock date (unlock the period). Use when the user asks to remove, delete, clear, lift, or unset the lock. Do not also pass lockDate."}},required:["resourceId"],group:"accounts",readOnly:!1,searchHint:"update rename chart of accounts entry name code lock date unlock remove clear lock",execute:async(t,e)=>{let r=e.resourceId,n=(await r1(t.client,r)).data,o=Object.fromEntries(["name","code","classificationType","taxProfileResourceId","currency","description"].filter(a=>n[a]!==void 0&&n[a]!==null).map(a=>[a,n[a]]));!o.classificationType&&n.accountType&&(o.classificationType=n.accountType);let s=e.clearLockDate===!0;if(s&&e.lockDate!==void 0)throw new Error("clearLockDate and lockDate are mutually exclusive \u2014 pass one or the other.");return!s&&typeof n.accountLockDate=="string"&&n.accountLockDate&&(o.lockDate=n.accountLockDate.slice(0,10)),e.name!==void 0&&(o.name=e.name),e.code!==void 0&&(o.code=e.code),!s&&e.lockDate!==void 0&&(o.lockDate=e.lockDate),Nwe(t.client,r,o)}},{name:"bulk_upsert_chart_of_accounts",description:`Bulk create/update CoA entries (max 500). SYNC: returns { resourceIds, failedRows: [{rowIndex, columnName, columnValue, errorCode, errorMessage}], failedCount } \u2014 no jobId polling. PARTIAL_SUCCESS: failed rows surface in failedRows[]; others still succeed.
|
|
685
685
|
|
|
686
686
|
resourceId per row \u2192 update; omit \u2192 create. Note: dedup is by NAME (not code) \u2014 duplicate name surfaces ORGANIZATION_CHART_OF_ACCOUNT_DUPLICATED per row. Accepts all 23 accountType values (see create_account); common variants normalized via normalizeAccountType.
|
|
687
687
|
|