jaz-clio 5.20.27 → 5.20.29
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 +1 -1
- package/assets/skills/cli/SKILL.md +1 -1
- package/assets/skills/conversion/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
package/cli.mjs
CHANGED
|
@@ -805,7 +805,7 @@ Fields per record:
|
|
|
805
805
|
- transactionDate (required): YYYY-MM-DD
|
|
806
806
|
- description, payerOrPayee, reference: optional strings
|
|
807
807
|
|
|
808
|
-
Returns {data: {errors: []}} on success. accountResourceId must be a bank-type CoA account (find via list_bank_accounts).`,params:{accountResourceId:{type:"string",description:"Bank account resourceId (from list_bank_accounts)"},records:{type:"array",items:{type:"object",properties:{amount:{type:"number",description:"Positive = cash-in, negative = cash-out"},transactionDate:{type:"string",description:"Date (YYYY-MM-DD)"},description:{type:"string",description:"Description"},payerOrPayee:{type:"string",description:"Payer or payee name"},reference:{type:"string",description:"Reference"}},required:["amount","transactionDate"]},description:"Array of 1-100 bank records"}},required:["accountResourceId","records"],group:"bank",readOnly:!1,searchHint:"add manual bank transaction records entries",execute:async(t,e)=>sO(t.client,e.accountResourceId,e.records)},{name:"create_bt_from_attachment",description:"Create a business transaction (invoice/bill/credit note) from a file, a URL, or raw HTML (e.g. an email body) using AI extraction. Processing is async. When the host conversation provides a file with the call, omit all source arguments \u2014 the file is used automatically.",params:{businessTransactionType:{type:"string",enum:["INVOICE","BILL","CUSTOMER_CREDIT_NOTE","SUPPLIER_CREDIT_NOTE"],description:"Type of transaction to create"},sourceUrl:{type:"string",description:"URL of the source file"},attachmentId:{type:"string",description:'Attachment ID, or "email-body"'},html:{type:"string",description:"Raw HTML (e.g. email body) \u2014 rendered to PDF then extracted."}},required:["businessTransactionType"],group:"magic",readOnly:!1,acceptsHostFile:!0,searchHint:"create transaction from attachment URL or email HTML AI extraction",execute:async(t,e)=>{if(e.attachmentId==="email-body"){let i=t.html_blob;if(!i)throw new Error('attachmentId "email-body" requires an inbound email body \u2014 none available on this run.');let s=Buffer.byteLength(i,"utf8");if(s>5*1024*1024)throw new Error(`Email body exceeds Clio's 5MB HTML cap (${s} bytes).`);return ol(t.client,{businessTransactionType:e.businessTransactionType,html:i})}let r=[e.sourceUrl,e.attachmentId,e.html].filter(Boolean);if(r.length===0&&t.file_blob)return ol(t.client,{businessTransactionType:e.businessTransactionType,sourceFile:t.file_blob.data,sourceFileName:t.file_blob.fileName});if(r.length!==1)throw new Error("Provide exactly one of sourceUrl, attachmentId, or html.");let n=e.sourceUrl;if(n&&n.includes("api.telegram.org/file/")){let i=await fetch(n,{signal:AbortSignal.timeout(15e3)});if(!i.ok)throw new Error(`Failed to download Telegram file: ${i.status}`);let s=i.headers.get("content-type")??"application/octet-stream",o=await i.arrayBuffer(),a=new Uint8Array(o.slice(0,8)),u=(a[0]===37&&a[1]===80&&a[2]===68&&a[3]===70?"application/pdf":a[0]===255&&a[1]===216?"image/jpeg":a[0]===137&&a[1]===80&&a[2]===78&&a[3]===71?"image/png":a[0]===80&&a[1]===75?"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":null)??s,f=new Blob([o],{type:u}),d=decodeURIComponent(n.split("/").pop()??"file"),h={"application/pdf":".pdf","image/jpeg":".jpg","image/png":".png"}[u];return h&&!d.endsWith(h)&&(d=d.replace(/\.[^.]+$/,"")+h),ol(t.client,{businessTransactionType:e.businessTransactionType,sourceFile:f,sourceFileName:d,sourceUrl:n})}return ol(t.client,{businessTransactionType:e.businessTransactionType,sourceUrl:n,attachmentId:e.attachmentId,html:e.html})}},{name:"get_magic_workflow_status",description:"Get the current status of specific magic workflow(s) by resourceId(s). Returns workflow details including status, document type, and results.",params:{workflowIds:{type:"array",items:{type:"string"},description:"One or more workflow resourceIds to check"}},required:["workflowIds"],group:"magic",readOnly:!0,searchHint:"check AI extraction workflow status progress",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(t,e)=>{let r=e.workflowIds;if(r.length===0)throw new Error("workflowIds must be non-empty");return Jw(t.client,{filter:{resourceId:{in:r}},limit:r.length})}},{name:"wait_for_magic_workflows",description:"Poll magic extraction workflow(s) until each reaches a terminal state \u2014 transaction created (a draft is ready), OCR succeeded/failed, or errored \u2014 or until the wait budget elapses. Use after create_bt_from_attachment / extract_documents to know when drafts are ready. Returns each workflow's current status plus the still-pending ids; if any are still pending after the budget, call again to keep waiting. Batched into one request per poll.",params:{workflowIds:{type:"array",items:{type:"string"},description:"One or more magic workflow resourceIds to wait on."},maxWaitSeconds:{type:"number",description:"Maximum seconds to wait before returning current status (default 120). Returns immediately once all workflows are terminal."},pollIntervalSeconds:{type:"number",description:"Seconds between polls (default 5)."}},required:["workflowIds"],group:"magic",readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:2e4,searchHint:"wait for AI extraction workflows to finish poll until done",execute:async(t,e)=>{let r=e.workflowIds;if(!Array.isArray(r))throw new Error("workflowIds must be an array");if(r.length===0)return{allTerminal:!0,pending:[],timedOut:!1,workflows:[]};let n=(a,c,u)=>Math.min(u,Math.max(c,a)),i=n(typeof e.maxWaitSeconds=="number"?e.maxWaitSeconds:120,1,600),s=n(typeof e.pollIntervalSeconds=="number"?e.pollIntervalSeconds:5,2,60),o=await zJ(t.client,r,{timeout:i*1e3,interval:s*1e3});return{allTerminal:o.pending.length===0,pending:o.pending,timedOut:o.timedOut,workflows:o.workflows}}},{name:"classify_documents",description:'Sort a ZIP or share link of MIXED accounting documents: classifies each file into invoice / bill / customer credit note / supplier credit note / bank statement by its FOLDER NAME within the source (e.g. files under an "invoices/" folder become invoices), WITHOUT creating anything. Files in unrecognized folders come back as needs-review. Returns a manifest (per-file type + confidence + counts) plus a collectionId; review it, then call extract_documents with that collectionId to create the drafts. Source must be an https URL: a direct .zip/file link (e.g. an uploaded attachment) or a Dropbox / Google Drive / OneDrive share link. (Local folder paths are CLI-only.)',params:{source:{type:"string",description:"An https URL: a direct .zip/file link (R2/S3/CDN/uploaded attachment) or a Dropbox/Drive/OneDrive share link."},type:{type:"string",enum:["INVOICE","BILL","CUSTOMER_CREDIT_NOTE","SUPPLIER_CREDIT_NOTE","BANK_STATEMENT"],description:"Optional: force every file to this type instead of auto-classifying by folder."}},required:["source"],group:"magic",readOnly:!1,searchHint:"classify a folder zip or drive link of mixed documents before extraction auto-sort",maxResultSizeChars:2e4,execute:async(t,e)=>{let r=e.source;if(!/^https:\/\//i.test(r))throw new Error("classify_documents only accepts an https URL (a direct file/zip link or a Dropbox/Drive/OneDrive share). Local folder paths are CLI-only.");let n=await nO({source:r,type:e.type});return{collectionId:Det(n,t.client.scopeKey),...vet(n)}}},{name:"extract_documents",description:"Create draft transactions from a classified document collection (see classify_documents). Uploads each file to the right AI-extraction endpoint \u2014 invoices/bills/credit notes via business-transaction extraction, bank statements via statement import \u2014 de-duplicates identical files, and returns the workflow ids to poll with wait_for_magic_workflows. Processing is async; drafts appear once the workflows reach a terminal state. Pass the collectionId from classify_documents.",params:{collectionId:{type:"string",description:"The collectionId returned by classify_documents."},documentTypes:{type:"array",items:{type:"string",enum:["INVOICE","BILL","CUSTOMER_CREDIT_NOTE","SUPPLIER_CREDIT_NOTE","BANK_STATEMENT"]},description:"Optional: only extract these document types (default: every uploadable file in the collection)."},bankAccountId:{type:"string",description:"Bank account resourceId for bank-statement imports \u2014 required if the collection contains bank statements."}},required:["collectionId"],group:"magic",readOnly:!1,searchHint:"extract create drafts from a classified document collection invoices bills credit notes",maxResultSizeChars:2e4,execute:async(t,e)=>{let r=t.client.scopeKey,n=e.collectionId,i=Bet(n,r);if(!i)throw new Error(`Collection "${n}" not found or expired \u2014 re-run classify_documents.`);let s=Array.isArray(e.documentTypes)&&e.documentTypes.length>0?e.documentTypes:void 0,o=e.bankAccountId,a=await Tet({plan:i,client:t.client,bankAccountId:o,documentTypes:s});return Ret(n,r),a}},{name:"get_attachments",description:"Get attachments for a business transaction (invoice, bill, journal, credit note, or order document).",params:{transactionType:{type:"string",enum:["invoices","bills","journals","scheduled_journals","customer-credit-notes","supplier-credit-notes","sale-quotes","sale-orders","purchase-requests","purchase-orders"],description:"Transaction type (incl. order documents: sale-quotes, sale-orders, purchase-requests, purchase-orders)"},transactionId:{type:"string",description:"Transaction resourceId"}},required:["transactionType","transactionId"],group:"attachments",readOnly:!0,searchHint:"list attachments files on a transaction",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(t,e)=>ni(t.client,e.transactionType,e.transactionId)},{name:"add_attachment",description:"Add an attachment to a business transaction. Provide sourceUrl (downloads and uploads as file) or attachmentId (links existing); a file provided by the host conversation is used when neither is given. Order documents (sale-quotes, sale-orders, purchase-requests, purchase-orders) support file/sourceUrl upload ONLY \u2014 attachmentId link-by-id is rejected for them.",params:{transactionType:{type:"string",enum:["invoices","bills","journals","scheduled_journals","customer-credit-notes","supplier-credit-notes","sale-quotes","sale-orders","purchase-requests","purchase-orders"],description:"Transaction type (incl. order documents: sale-quotes, sale-orders, purchase-requests, purchase-orders)"},transactionId:{type:"string",description:"Transaction resourceId"},attachmentId:{type:"string",description:"Attachment ID to link (alternative to sourceUrl)"},sourceUrl:{type:"string",description:"Source file URL \u2014 downloaded and uploaded as multipart file"}},required:["transactionType","transactionId"],group:"attachments",readOnly:!1,acceptsHostFile:!0,searchHint:"upload attach file to a transaction",execute:async(t,e)=>{if(!e.attachmentId&&!e.sourceUrl&&!t.file_blob)throw new Error("Provide attachmentId or sourceUrl \u2014 one is required.");let r=e.transactionType;if(e.attachmentId&&Gj.includes(r))return{error:`link-by-id (attachmentId) is not supported for order documents (${r}).`,status:422,hint:"Order documents accept file uploads only \u2014 pass sourceUrl instead of attachmentId.",repair:{tool:"add_attachment",arguments:{transactionType:r,transactionId:e.transactionId},reason:"Use sourceUrl for order-document attachments."}};let n,i;if(e.sourceUrl){let s=await fetch(e.sourceUrl);if(!s.ok)throw new Error(`Failed to download ${e.sourceUrl}: ${s.status}`);let o=await s.arrayBuffer(),a=s.headers.get("content-type")??"application/octet-stream";n=new Blob([o],{type:a});try{i=new URL(e.sourceUrl).pathname.split("/").pop()||"attachment"}catch{i="attachment"}}else!e.attachmentId&&t.file_blob&&(n=t.file_blob.data,i=t.file_blob.fileName);return Vj(t.client,{businessTransactionType:e.transactionType,businessTransactionResourceId:e.transactionId,file:n,fileName:i,attachmentId:e.attachmentId})}},{name:"delete_attachment",description:"Delete an attachment from a business transaction (invoice, bill, journal, credit note, or order document).",params:{transactionType:{type:"string",enum:["invoices","bills","journals","scheduled_journals","customer-credit-notes","supplier-credit-notes","sale-quotes","sale-orders","purchase-requests","purchase-orders"],description:"Transaction type (incl. order documents: sale-quotes, sale-orders, purchase-requests, purchase-orders)"},transactionId:{type:"string",description:"Transaction resourceId"},attachmentResourceId:{type:"string",description:"Attachment resourceId (from get_attachments response)"}},required:["transactionType","transactionId","attachmentResourceId"],group:"attachments",readOnly:!1,searchHint:"delete remove attachment file from transaction",isDestructive:!0,execute:async(t,e)=>Jj(t.client,e.transactionType,e.transactionId,e.attachmentResourceId)},{name:"read_spreadsheet_rows",description:"Parse rows from a CSV/Excel URL. Returns rows as JSON objects keyed by header (max 500/call, paginatable via offset/limit). Excel response includes availableSheets[] \u2014 re-call with sheetIndex if the first sheet is Instructions. Use BEFORE bulk_upsert_* when the user attaches a tabular file.",params:{sourceUrl:{type:"string",description:"URL of the CSV or Excel attachment."},offset:{type:"number",description:"0-based row offset. Default 0."},limit:{type:"number",description:"Rows to return (1-500). Default 200."},kind:{type:"string",description:"csv | excel. Auto-detected from URL/Content-Type if omitted.",enum:["csv","excel"]},sheetIndex:{type:"number",description:"Excel only: 0-based sheet index. Default 0. Response lists availableSheets[]."}},required:["sourceUrl"],group:"attachments",readOnly:!0,searchHint:"read parse csv excel xlsx file content rows columns from attachment url for bulk import upload spreadsheet",isConcurrencySafe:!0,maxResultSizeChars:6e4,execute:async(t,e)=>qXe({sourceUrl:e.sourceUrl,offset:e.offset,limit:e.limit,kind:e.kind,sheetIndex:e.sheetIndex})},{name:"validate_invoice_draft",description:"Check if an invoice draft is ready to finalize. Returns missing fields, structured validation report, and ready status. Use before finalize_invoice to prevent errors.",params:{resourceId:{type:"string",description:"Invoice resourceId"}},required:["resourceId"],group:"drafts",readOnly:!0,searchHint:"validate invoice draft readiness for finalization",isConcurrencySafe:!0,execute:async(t,e)=>{let r=e.resourceId,n=await vo(t.client,r),i=await ni(t.client,"invoices",r);return _s(n.data,xc,i.data.length)}},{name:"validate_bill_draft",description:"Check if a bill draft is ready to finalize. Returns missing fields, structured validation report, and ready status. Use before finalize_bill to prevent errors.",params:{resourceId:{type:"string",description:"Bill resourceId"}},required:["resourceId"],group:"drafts",readOnly:!0,searchHint:"validate bill draft readiness for finalization",isConcurrencySafe:!0,execute:async(t,e)=>{let r=e.resourceId,n=await Eo(t.client,r),i=await ni(t.client,"bills",r);return _s(n.data,ra,i.data.length)}},{name:"validate_journal_draft",description:"Check if a journal draft is ready to finalize. Returns missing fields (accounts, amounts, date), structured validation, and ready status.",params:{resourceId:{type:"string",description:"Journal resourceId"}},required:["resourceId"],group:"drafts",readOnly:!0,searchHint:"validate journal draft readiness for posting",isConcurrencySafe:!0,execute:async(t,e)=>{let r=await mu(t.client,e.resourceId);return _s(r.data,xu,0,"journalEntries")}},{name:"validate_credit_note_draft",description:"Check if a credit note draft (customer or supplier) is ready to finalize. Returns missing fields, structured validation, and ready status.",params:{resourceId:{type:"string",description:"Credit note resourceId"},type:{type:"string",enum:["customer","supplier"],description:'Credit note type: "customer" or "supplier"'}},required:["resourceId","type"],group:"drafts",readOnly:!0,searchHint:"validate credit note draft readiness for finalization",isConcurrencySafe:!0,execute:async(t,e)=>{let r=e.resourceId,n=e.type,i=n==="customer"?await Au(t.client,r):await gu(t.client,r),s=n==="customer"?"customer-credit-notes":"supplier-credit-notes",o=await ni(t.client,s,r);return _s(i.data,Vi,o.data.length)}},kr("list_bank_rules","List bank reconciliation rules (action shortcuts). Shows rule name, action type, and target bank account.","bank_rules",(t,e,r)=>Wj(t,{limit:r,offset:e}),"list automatic bank reconciliation rules"),Ds("get_bank_rule","Get full bank rule details including configuration (allocation percentages, accounts, tax settings).","bank_rules",(t,e)=>nx(t,e),"get bank rule details conditions actions"),Qr({name:"search_bank_rules",description:"Search bank rules.",group:"bank_rules",fields:PD,defaults:$D,fetcher:Zj,searchHint:"find bank rules auto-reconciliation matching criteria by name"}),{name:"create_bank_rule",description:`Bank reconciliation rule \u2014 auto-matches bank records. Use directly on request; don't just list existing.
|
|
808
|
+
Returns {data: {errors: []}} on success. accountResourceId must be a bank-type CoA account (find via list_bank_accounts).`,params:{accountResourceId:{type:"string",description:"Bank account resourceId (from list_bank_accounts)"},records:{type:"array",items:{type:"object",properties:{amount:{type:"number",description:"Positive = cash-in, negative = cash-out"},transactionDate:{type:"string",description:"Date (YYYY-MM-DD)"},description:{type:"string",description:"Description"},payerOrPayee:{type:"string",description:"Payer or payee name"},reference:{type:"string",description:"Reference"}},required:["amount","transactionDate"]},description:"Array of 1-100 bank records"}},required:["accountResourceId","records"],group:"bank",readOnly:!1,searchHint:"add manual bank transaction records entries",execute:async(t,e)=>sO(t.client,e.accountResourceId,e.records)},{name:"create_bt_from_attachment",description:"Create a business transaction (invoice/bill/credit note) from a SINGLE file, a URL, or raw HTML (e.g. an email body) using AI extraction. Processing is async. When the host conversation provides a file with the call, omit all source arguments \u2014 the file is used automatically. For a FOLDER, a .zip, a Dropbox/Drive/OneDrive folder share link, or several/mixed documents at once, use classify_documents (then extract_documents) instead \u2014 do not call this per-file.",params:{businessTransactionType:{type:"string",enum:["INVOICE","BILL","CUSTOMER_CREDIT_NOTE","SUPPLIER_CREDIT_NOTE"],description:"Type of transaction to create"},sourceUrl:{type:"string",description:"URL of the source file"},attachmentId:{type:"string",description:'Attachment ID, or "email-body"'},html:{type:"string",description:"Raw HTML (e.g. email body) \u2014 rendered to PDF then extracted."}},required:["businessTransactionType"],group:"magic",readOnly:!1,acceptsHostFile:!0,searchHint:"create transaction from attachment URL or email HTML AI extraction",execute:async(t,e)=>{if(e.attachmentId==="email-body"){let i=t.html_blob;if(!i)throw new Error('attachmentId "email-body" requires an inbound email body \u2014 none available on this run.');let s=Buffer.byteLength(i,"utf8");if(s>5*1024*1024)throw new Error(`Email body exceeds Clio's 5MB HTML cap (${s} bytes).`);return ol(t.client,{businessTransactionType:e.businessTransactionType,html:i})}let r=[e.sourceUrl,e.attachmentId,e.html].filter(Boolean);if(r.length===0&&t.file_blob)return ol(t.client,{businessTransactionType:e.businessTransactionType,sourceFile:t.file_blob.data,sourceFileName:t.file_blob.fileName});if(r.length!==1)throw new Error("Provide exactly one of sourceUrl, attachmentId, or html.");let n=e.sourceUrl;if(n&&n.includes("api.telegram.org/file/")){let i=await fetch(n,{signal:AbortSignal.timeout(15e3)});if(!i.ok)throw new Error(`Failed to download Telegram file: ${i.status}`);let s=i.headers.get("content-type")??"application/octet-stream",o=await i.arrayBuffer(),a=new Uint8Array(o.slice(0,8)),u=(a[0]===37&&a[1]===80&&a[2]===68&&a[3]===70?"application/pdf":a[0]===255&&a[1]===216?"image/jpeg":a[0]===137&&a[1]===80&&a[2]===78&&a[3]===71?"image/png":a[0]===80&&a[1]===75?"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":null)??s,f=new Blob([o],{type:u}),d=decodeURIComponent(n.split("/").pop()??"file"),h={"application/pdf":".pdf","image/jpeg":".jpg","image/png":".png"}[u];return h&&!d.endsWith(h)&&(d=d.replace(/\.[^.]+$/,"")+h),ol(t.client,{businessTransactionType:e.businessTransactionType,sourceFile:f,sourceFileName:d,sourceUrl:n})}return ol(t.client,{businessTransactionType:e.businessTransactionType,sourceUrl:n,attachmentId:e.attachmentId,html:e.html})}},{name:"get_magic_workflow_status",description:"Get the current status of specific magic workflow(s) by resourceId(s). Returns workflow details including status, document type, and results.",params:{workflowIds:{type:"array",items:{type:"string"},description:"One or more workflow resourceIds to check"}},required:["workflowIds"],group:"magic",readOnly:!0,searchHint:"check AI extraction workflow status progress",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(t,e)=>{let r=e.workflowIds;if(r.length===0)throw new Error("workflowIds must be non-empty");return Jw(t.client,{filter:{resourceId:{in:r}},limit:r.length})}},{name:"wait_for_magic_workflows",description:"Poll magic extraction workflow(s) until each reaches a terminal state \u2014 transaction created (a draft is ready), OCR succeeded/failed, or errored \u2014 or until the wait budget elapses. Use after create_bt_from_attachment / extract_documents to know when drafts are ready. Returns each workflow's current status plus the still-pending ids; if any are still pending after the budget, call again to keep waiting. Batched into one request per poll.",params:{workflowIds:{type:"array",items:{type:"string"},description:"One or more magic workflow resourceIds to wait on."},maxWaitSeconds:{type:"number",description:"Maximum seconds to wait before returning current status (default 120). Returns immediately once all workflows are terminal."},pollIntervalSeconds:{type:"number",description:"Seconds between polls (default 5)."}},required:["workflowIds"],group:"magic",readOnly:!0,isConcurrencySafe:!0,maxResultSizeChars:2e4,searchHint:"wait for AI extraction workflows to finish poll until done",execute:async(t,e)=>{let r=e.workflowIds;if(!Array.isArray(r))throw new Error("workflowIds must be an array");if(r.length===0)return{allTerminal:!0,pending:[],timedOut:!1,workflows:[]};let n=(a,c,u)=>Math.min(u,Math.max(c,a)),i=n(typeof e.maxWaitSeconds=="number"?e.maxWaitSeconds:120,1,600),s=n(typeof e.pollIntervalSeconds=="number"?e.pollIntervalSeconds:5,2,60),o=await zJ(t.client,r,{timeout:i*1e3,interval:s*1e3});return{allTerminal:o.pending.length===0,pending:o.pending,timedOut:o.timedOut,workflows:o.workflows}}},{name:"classify_documents",description:'Use this when the user points at a FOLDER, a .zip, a Dropbox / Google Drive / OneDrive folder share link, or a pile/batch of mixed documents ("create docs from this Dropbox folder link", "here is a folder of invoices and bills"). Sort a ZIP or share link of MIXED accounting documents: classifies each file into invoice / bill / customer credit note / supplier credit note / bank statement by its FOLDER NAME within the source (e.g. files under an "invoices/" folder become invoices), WITHOUT creating anything. Files in unrecognized folders come back as needs-review. Returns a manifest (per-file type + confidence + counts) plus a collectionId; review it, then call extract_documents with that collectionId to create the drafts. Source must be an https URL: a direct .zip/file link (e.g. an uploaded attachment) or a Dropbox / Google Drive / OneDrive share link. (Local folder paths are CLI-only.)',params:{source:{type:"string",description:"An https URL: a direct .zip/file link (R2/S3/CDN/uploaded attachment) or a Dropbox/Drive/OneDrive share link."},type:{type:"string",enum:["INVOICE","BILL","CUSTOMER_CREDIT_NOTE","SUPPLIER_CREDIT_NOTE","BANK_STATEMENT"],description:"Optional: force every file to this type instead of auto-classifying by folder."}},required:["source"],group:"magic",readOnly:!1,searchHint:"classify auto-sort a Dropbox Google Drive OneDrive folder share link or zip or a pile batch of mixed invoices bills documents create docs from a folder link before extraction",maxResultSizeChars:2e4,execute:async(t,e)=>{let r=e.source;if(!/^https:\/\//i.test(r))throw new Error("classify_documents only accepts an https URL (a direct file/zip link or a Dropbox/Drive/OneDrive share). Local folder paths are CLI-only.");let n=await nO({source:r,type:e.type});return{collectionId:Det(n,t.client.scopeKey),...vet(n)}}},{name:"extract_documents",description:"Create draft transactions from a classified document collection (see classify_documents). Uploads each file to the right AI-extraction endpoint \u2014 invoices/bills/credit notes via business-transaction extraction, bank statements via statement import \u2014 de-duplicates identical files, and returns the workflow ids to poll with wait_for_magic_workflows. Processing is async; drafts appear once the workflows reach a terminal state. Pass the collectionId from classify_documents.",params:{collectionId:{type:"string",description:"The collectionId returned by classify_documents."},documentTypes:{type:"array",items:{type:"string",enum:["INVOICE","BILL","CUSTOMER_CREDIT_NOTE","SUPPLIER_CREDIT_NOTE","BANK_STATEMENT"]},description:"Optional: only extract these document types (default: every uploadable file in the collection)."},bankAccountId:{type:"string",description:"Bank account resourceId for bank-statement imports \u2014 required if the collection contains bank statements."}},required:["collectionId"],group:"magic",readOnly:!1,searchHint:"extract create drafts from a classified document collection invoices bills credit notes",maxResultSizeChars:2e4,execute:async(t,e)=>{let r=t.client.scopeKey,n=e.collectionId,i=Bet(n,r);if(!i)throw new Error(`Collection "${n}" not found or expired \u2014 re-run classify_documents.`);let s=Array.isArray(e.documentTypes)&&e.documentTypes.length>0?e.documentTypes:void 0,o=e.bankAccountId,a=await Tet({plan:i,client:t.client,bankAccountId:o,documentTypes:s});return a.failed===0&&Ret(n,r),a}},{name:"get_attachments",description:"Get attachments for a business transaction (invoice, bill, journal, credit note, or order document).",params:{transactionType:{type:"string",enum:["invoices","bills","journals","scheduled_journals","customer-credit-notes","supplier-credit-notes","sale-quotes","sale-orders","purchase-requests","purchase-orders"],description:"Transaction type (incl. order documents: sale-quotes, sale-orders, purchase-requests, purchase-orders)"},transactionId:{type:"string",description:"Transaction resourceId"}},required:["transactionType","transactionId"],group:"attachments",readOnly:!0,searchHint:"list attachments files on a transaction",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(t,e)=>ni(t.client,e.transactionType,e.transactionId)},{name:"add_attachment",description:"Add an attachment to a business transaction. Provide sourceUrl (downloads and uploads as file) or attachmentId (links existing); a file provided by the host conversation is used when neither is given. Order documents (sale-quotes, sale-orders, purchase-requests, purchase-orders) support file/sourceUrl upload ONLY \u2014 attachmentId link-by-id is rejected for them.",params:{transactionType:{type:"string",enum:["invoices","bills","journals","scheduled_journals","customer-credit-notes","supplier-credit-notes","sale-quotes","sale-orders","purchase-requests","purchase-orders"],description:"Transaction type (incl. order documents: sale-quotes, sale-orders, purchase-requests, purchase-orders)"},transactionId:{type:"string",description:"Transaction resourceId"},attachmentId:{type:"string",description:"Attachment ID to link (alternative to sourceUrl)"},sourceUrl:{type:"string",description:"Source file URL \u2014 downloaded and uploaded as multipart file"}},required:["transactionType","transactionId"],group:"attachments",readOnly:!1,acceptsHostFile:!0,searchHint:"upload attach file to a transaction",execute:async(t,e)=>{if(!e.attachmentId&&!e.sourceUrl&&!t.file_blob)throw new Error("Provide attachmentId or sourceUrl \u2014 one is required.");let r=e.transactionType;if(e.attachmentId&&Gj.includes(r))return{error:`link-by-id (attachmentId) is not supported for order documents (${r}).`,status:422,hint:"Order documents accept file uploads only \u2014 pass sourceUrl instead of attachmentId.",repair:{tool:"add_attachment",arguments:{transactionType:r,transactionId:e.transactionId},reason:"Use sourceUrl for order-document attachments."}};let n,i;if(e.sourceUrl){let s=await fetch(e.sourceUrl);if(!s.ok)throw new Error(`Failed to download ${e.sourceUrl}: ${s.status}`);let o=await s.arrayBuffer(),a=s.headers.get("content-type")??"application/octet-stream";n=new Blob([o],{type:a});try{i=new URL(e.sourceUrl).pathname.split("/").pop()||"attachment"}catch{i="attachment"}}else!e.attachmentId&&t.file_blob&&(n=t.file_blob.data,i=t.file_blob.fileName);return Vj(t.client,{businessTransactionType:e.transactionType,businessTransactionResourceId:e.transactionId,file:n,fileName:i,attachmentId:e.attachmentId})}},{name:"delete_attachment",description:"Delete an attachment from a business transaction (invoice, bill, journal, credit note, or order document).",params:{transactionType:{type:"string",enum:["invoices","bills","journals","scheduled_journals","customer-credit-notes","supplier-credit-notes","sale-quotes","sale-orders","purchase-requests","purchase-orders"],description:"Transaction type (incl. order documents: sale-quotes, sale-orders, purchase-requests, purchase-orders)"},transactionId:{type:"string",description:"Transaction resourceId"},attachmentResourceId:{type:"string",description:"Attachment resourceId (from get_attachments response)"}},required:["transactionType","transactionId","attachmentResourceId"],group:"attachments",readOnly:!1,searchHint:"delete remove attachment file from transaction",isDestructive:!0,execute:async(t,e)=>Jj(t.client,e.transactionType,e.transactionId,e.attachmentResourceId)},{name:"read_spreadsheet_rows",description:"Parse rows from a CSV/Excel URL. Returns rows as JSON objects keyed by header (max 500/call, paginatable via offset/limit). Excel response includes availableSheets[] \u2014 re-call with sheetIndex if the first sheet is Instructions. Use BEFORE bulk_upsert_* when the user attaches a tabular file.",params:{sourceUrl:{type:"string",description:"URL of the CSV or Excel attachment."},offset:{type:"number",description:"0-based row offset. Default 0."},limit:{type:"number",description:"Rows to return (1-500). Default 200."},kind:{type:"string",description:"csv | excel. Auto-detected from URL/Content-Type if omitted.",enum:["csv","excel"]},sheetIndex:{type:"number",description:"Excel only: 0-based sheet index. Default 0. Response lists availableSheets[]."}},required:["sourceUrl"],group:"attachments",readOnly:!0,searchHint:"read parse csv excel xlsx file content rows columns from attachment url for bulk import upload spreadsheet",isConcurrencySafe:!0,maxResultSizeChars:6e4,execute:async(t,e)=>qXe({sourceUrl:e.sourceUrl,offset:e.offset,limit:e.limit,kind:e.kind,sheetIndex:e.sheetIndex})},{name:"validate_invoice_draft",description:"Check if an invoice draft is ready to finalize. Returns missing fields, structured validation report, and ready status. Use before finalize_invoice to prevent errors.",params:{resourceId:{type:"string",description:"Invoice resourceId"}},required:["resourceId"],group:"drafts",readOnly:!0,searchHint:"validate invoice draft readiness for finalization",isConcurrencySafe:!0,execute:async(t,e)=>{let r=e.resourceId,n=await vo(t.client,r),i=await ni(t.client,"invoices",r);return _s(n.data,xc,i.data.length)}},{name:"validate_bill_draft",description:"Check if a bill draft is ready to finalize. Returns missing fields, structured validation report, and ready status. Use before finalize_bill to prevent errors.",params:{resourceId:{type:"string",description:"Bill resourceId"}},required:["resourceId"],group:"drafts",readOnly:!0,searchHint:"validate bill draft readiness for finalization",isConcurrencySafe:!0,execute:async(t,e)=>{let r=e.resourceId,n=await Eo(t.client,r),i=await ni(t.client,"bills",r);return _s(n.data,ra,i.data.length)}},{name:"validate_journal_draft",description:"Check if a journal draft is ready to finalize. Returns missing fields (accounts, amounts, date), structured validation, and ready status.",params:{resourceId:{type:"string",description:"Journal resourceId"}},required:["resourceId"],group:"drafts",readOnly:!0,searchHint:"validate journal draft readiness for posting",isConcurrencySafe:!0,execute:async(t,e)=>{let r=await mu(t.client,e.resourceId);return _s(r.data,xu,0,"journalEntries")}},{name:"validate_credit_note_draft",description:"Check if a credit note draft (customer or supplier) is ready to finalize. Returns missing fields, structured validation, and ready status.",params:{resourceId:{type:"string",description:"Credit note resourceId"},type:{type:"string",enum:["customer","supplier"],description:'Credit note type: "customer" or "supplier"'}},required:["resourceId","type"],group:"drafts",readOnly:!0,searchHint:"validate credit note draft readiness for finalization",isConcurrencySafe:!0,execute:async(t,e)=>{let r=e.resourceId,n=e.type,i=n==="customer"?await Au(t.client,r):await gu(t.client,r),s=n==="customer"?"customer-credit-notes":"supplier-credit-notes",o=await ni(t.client,s,r);return _s(i.data,Vi,o.data.length)}},kr("list_bank_rules","List bank reconciliation rules (action shortcuts). Shows rule name, action type, and target bank account.","bank_rules",(t,e,r)=>Wj(t,{limit:r,offset:e}),"list automatic bank reconciliation rules"),Ds("get_bank_rule","Get full bank rule details including configuration (allocation percentages, accounts, tax settings).","bank_rules",(t,e)=>nx(t,e),"get bank rule details conditions actions"),Qr({name:"search_bank_rules",description:"Search bank rules.",group:"bank_rules",fields:PD,defaults:$D,fetcher:Zj,searchHint:"find bank rules auto-reconciliation matching criteria by name"}),{name:"create_bank_rule",description:`Bank reconciliation rule \u2014 auto-matches bank records. Use directly on request; don't just list existing.
|
|
809
809
|
|
|
810
810
|
Required: name, appliesToReconciliationAccount (bank account UUID, no "ResourceId" suffix), configuration.
|
|
811
811
|
|
|
@@ -864,7 +864,7 @@ btType enum: SALE = invoice, PURCHASE = bill, SALE_CREDIT_NOTE = customer CN, PU
|
|
|
864
864
|
|
|
865
865
|
Each result carries contactSignals (Mid-7: cadence, outliers, severity, divergences from contact's modal pattern; null if no contact / no history) and breakdown (Balance-panel payload: line items + subtotal/tax/total/balance/exchange rate). Top-level contactSignalsMeta.unavailable=true \u2192 freshness layer offline for whole batch.
|
|
866
866
|
|
|
867
|
-
USE THIS to score a specific draft against contact history. For stand-alone "what does this contact normally look like?" without a draft \u2192 use get_contact_signals.`,params:{items:{type:"array",description:"Draft business transaction references (max 500). Mix any btType freely.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!0,isConcurrencySafe:!0,searchHint:"validate drafts eligibility check before convert promote",execute:async(t,e)=>(ov(e.items),$Y(t.client,e.items))},{name:"convert_drafts_to_active",description:`BULK promote \u2014 finalize up to 500 draft business transactions to ACTIVE in ONE call, mixing any combination of invoices, bills, and credit notes (no per-type tools needed). ${Tu} NOT idempotent: a second call on already-promoted drafts returns 422. Filter the draft list by status: DRAFT before submitting. Pair with validate_drafts for a pre-flight check on large batches.`,params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"convert drafts to active promote finalize bulk",execute:async(t,e)=>(ov(e.items),UY(t.client,e.items))},{name:"submit_drafts_for_approval",description:`BULK submit \u2014 route up to 500 draft business transactions into the approval workflow in ONE call, mixing any combination of invoices, bills, and credit notes. ${Tu} NOT idempotent on drafts that already have an in-flight approval request.`,params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"submit drafts for approval workflow review bulk",execute:async(t,e)=>(ov(e.items),qY(t.client,e.items))},{name:"search_help_center",description:'Search the Jaz help center for how-to articles, feature guides, and accounting concepts. Use this for "how do I..." or "what is..." questions about Jaz: bank reconciliation, GST/VAT filing, multi-currency, fixed assets, custom fields, integrations, and so on. Returns top matching articles with title, section, content, and source URL.',params:{query:{type:"string",description:'Natural-language question or keywords (e.g. "how do I reconcile a bank statement", "set up GST", "multi-currency invoice").'},limit:{type:"number",description:"Maximum number of articles to return (default 3, max 10)."},section:{type:"string",description:'Optional: restrict to a single help-center section slug (e.g. "bank-reconciliations", "invoices").'}},required:["query"],group:"help_center",readOnly:!0,searchHint:"help center docs how to guide article search question",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(t,e)=>{let r=String(e.query??"").trim();if(!r)return{error:"Query is required.",hint:"Pass a natural-language question or keywords."};let n=typeof e.limit=="number"&&!Number.isNaN(e.limit)?e.limit:3,i=Math.max(1,Math.min(10,Math.floor(n))),s=typeof e.section=="string"?e.section:void 0;try{let o=ZR();if(s&&!o.sections.some(u=>u.slug===s))return{error:`Unknown section: "${s}".`,available:o.sections.map(u=>u.slug),hint:"Omit the section parameter to search every section, or pick a slug from the available list."};let a=KR(),c=await XR(o,a,r,{mode:"hybrid",limit:i,section:s});return c.length===0?{results:[],hint:"No matching articles. Try broader keywords or rephrase the question."}:{results:c.map(u=>{let f=(cce(u.article)??u.article.snippet).slice(0,1500);return{title:u.article.title,section:u.section.name,sectionSlug:u.section.slug,content:f,url:u.article.sourceUrl,score:Math.round(u.score*1e3)/1e3,scoreKind:u.scoreKind,matchedTerms:u.matchedTerms}}),totalArticles:o.articleCount,searchedSections:s?[s]:void 0}}catch(o){return{error:"Help center search failed.",detail:o instanceof Error?o.message:String(o),hint:"The bundled help-center index may be missing or corrupt."}}}},{name:"present_questions",description:`Present the user with a bounded multiple-choice question (or a short sequence of them) as an interactive pick-list, instead of asking in prose. Use as your FINAL action when the user must choose among a KNOWN, finite set of options you ALREADY have from context (a prior search/list result, org defaults, or your own knowledge) to continue (e.g. "which bank account?", "which of these duplicate bills?"). Give 2-4 options per question \u2014 curate to the most likely, never dump a long list \u2014 and at most 4 questions; set multiSelect per question when more than one may apply. List the options and stop \u2014 the user's pick arrives as their next message and starts a new turn. Ask several questions at once when more than one thing is unspecified. Prose-ask only when there's no bounded set to offer (a free-text name or amount), to confirm destructive actions, or instead of fetching data just to populate options. Terminal: do not call further tools or re-list the options in text afterward.`,params:{questions:{type:"array",description:"Questions to ask, each rendered as one page of the pick-list (at most 4). Provide one unless you genuinely have several distinct choices to collect in sequence.",items:{type:"object",properties:{header:{type:"string",description:'Optional short eyebrow label categorizing the question (1-2 words, e.g. "Account", "Period").'},question:{type:"string",description:'The question, shown as the card title (e.g. "Which bank account should I inspect?").'},options:{type:"array",description:"2-4 concrete choices (hard cap \u2014 curate to the most likely; the user can still type a different answer if none fit).",items:{type:"object",properties:{label:{type:"string",description:"The choice shown on the row and relayed verbatim as the user's answer when picked \u2014 keep it self-contained and unambiguous."},description:{type:"string",description:'Optional one-line detail under the label (e.g. "554 unreconciled records").'}},required:["label"]}},multiSelect:{type:"boolean",description:"Set true to let the user select multiple options for this question; omit or false for a single pick."}},required:["question","options"]}}},required:["questions"],group:"interaction",alwaysLoaded:!0,interactive:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"present questions options choices pick select ask user interactive widget",maxResultSizeChars:2e4,execute:async(t,e)=>{let n=(Array.isArray(e?.questions)?e.questions:[]).filter(s=>typeof s=="object"&&s!==null).map(s=>{let o=(Array.isArray(s.options)?s.options:[]).filter(c=>typeof c=="object"&&c!==null).map(c=>{let u=String(c.label??"").trim();return c.description?{label:u,description:String(c.description)}:{label:u}}).filter(c=>c.label),a=String(s.question??"").trim();return{...s.header?{header:String(s.header)}:{},question:a,options:o,multiSelect:!!s.multiSelect}}).filter(s=>s.question&&s.options.length>=2);if(n.length===0)return{error:"present_questions needs at least one question with non-empty question text and \u22652 labeled options (a single-option pick-list is not a choice).",hint:"Provide questions: [{ question, options: [{ label }, { label }] }]. For open-ended input, ask in prose instead."};if(n.length>4)return{error:`present_questions renders at most 4 questions (got ${n.length}).`,hint:"Ask the 4 most important now; collect the rest on a later turn."};let i=n.find(s=>s.options.length>4);return i?{error:`Each question may offer at most 4 options ("${i.question}" has ${i.options.length}).`,hint:"Curate to the 4 most likely choices \u2014 the user can still type a different answer if none fit."}:{questions:n}}},{name:"find_dashboard_destinations",description:'Discover valid destinations for get_dashboard_url. Returns dashboard screens and record/modal types as { key, label, kind }. Filter with `query` (substring over key + label, e.g. "invoice", "report", "settings"), `resource` (e.g. "sales", "purchases"), or `kind` ("screen" | "modal"). Results are capped; narrow the filter if `truncated` is true. Call this first when you are unsure of the exact destination key.',params:{query:{type:"string",description:'Case-insensitive substring to match against destination keys and labels (e.g. "invoice", "p&l", "bank").'},resource:{type:"string",description:'Restrict to one resource namespace, e.g. "sales", "purchases", "reports", "settings".'},kind:{type:"string",description:'Restrict to "screen" (list/report pages) or "modal" (record view/create/edit).',enum:["screen","modal"]}},required:[],group:"navigation",alwaysLoaded:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"list dashboard destinations find screens modals navigation keys catalog",maxResultSizeChars:16e3,execute:async(t,e)=>{let r=e.kind==="screen"||e.kind==="modal"?e.kind:void 0,n=o1e({query:typeof e.query=="string"?e.query:void 0,resource:typeof e.resource=="string"?e.resource:void 0,kind:r});return n.truncated?{...n,hint:`Showing ${n.results.length} of ${n.total} matches. Narrow with a more specific query, resource, or kind.`}:n.results.length===0?{...n,hint:'No matches. Destinations are named by product area, not task wording \u2014 retry with a broader or synonym term (e.g. "billing" not "card", "sales" not "invoice payment", "settings", "reports", "bank") before concluding the destination does not exist.'}:n}},{name:"get_dashboard_url",description:'Build a deep link to a dashboard screen or record so you can hand the user a URL ("here is the page: <url>"). `destination` is a key from find_dashboard_destinations \u2014 a screen (e.g. "sales.transactions.active-sales", "reports.profit-and-loss") or a record modal (e.g. "sales.modal.view-sale", "sales.modal.new-sale", "settings.modal.user_management"). For a record-specific modal (view/edit/duplicate a particular record) pass `resourceId` (the Jaz resourceId of that record); omit it for screens and for create/"new" modals. The link opens in the user\'s current org. Returns { url, kind, label }. Never write dashboard URLs or destination keys from memory \u2014 always resolve them through these tools.',params:{destination:{type:"string",description:'Destination key from find_dashboard_destinations, e.g. "reports.profit-and-loss" or "sales.modal.view-sale".'},resourceId:{type:"string",description:"Jaz resourceId of the record to focus \u2014 only for record modals (view/edit a specific record). Omit for screens and create modals."}},required:["destination"],group:"navigation",alwaysLoaded:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"dashboard url deep link navigate go to open screen record modal page share shareable",execute:async(t,e)=>{let{dashboardUrl:r}=e1e(t.platform??"jaz");try{return s1e(typeof e.destination=="string"?e.destination:"",typeof e.resourceId=="string"&&e.resourceId?e.resourceId:void 0,{dashboardUrl:r,orgResourceId:t.org?.resourceId})}catch(n){return{error:n instanceof Error?n.message:String(n)}}}}]});function kst(t,e=5){let r=t.trim().toLowerCase();if(!r)return[];let n=r.split(/[\s_-]+/).filter(s=>s.length>=2&&!U0r.has(s));return n.length===0?[]:Qc.map(s=>{let o=0,a=s.name.toLowerCase(),c=s.description.toLowerCase();(a===r||a===r.replace(/\s+/g,"_"))&&(o+=5),a.includes(r)&&(o+=3),c.includes(r)&&(o+=1);for(let u of n)a.includes(u)&&(o+=2),c.includes(u)&&(o+=1);return{ns:s,score:o}}).filter(s=>s.score>0).sort((s,o)=>o.score-s.score).slice(0,e).map(s=>s.ns)}var Qc,U0r,jx=re(()=>{"use strict";Qc=[{name:"invoices",description:"Sales invoices (INV/SI). Create, search, get, update, delete, pay, finalize, apply credits, download PDF. Also: receivables, AR, AR aging, billing, overdue invoices, dunning, recurring invoices. To create from an uploaded invoice file/PDF/image, use the document_ai namespace (AI extraction), not manual entry.",groups:["invoices"]},{name:"customer_credit_notes",description:"Customer credit notes (CN). Create, search, update, delete, finalize, refund, download PDF. Also: sales returns, customer CN.",groups:["customer_credit_notes"]},{name:"bills",description:"Purchase bills (PO/PI). Create, search, get, update, delete, pay, finalize, apply credits. Also: payables, AP, vendor invoices, supplier bills. To create from an uploaded bill/invoice file/PDF/image, use the document_ai namespace (AI extraction), not manual entry.",groups:["bills"]},{name:"supplier_credit_notes",description:"Supplier credit notes. Create, search, update, delete, finalize, refund. Also: purchase returns, debit notes, supplier CN.",groups:["supplier_credit_notes"]},{name:"sale_orders",description:"Sales order documents: Sale Quotes (estimates/quotations) and Sale Orders. Create, get, search, update, and transition (accept a quote, confirm an order, void, delete). A Sale Order links to its quote via saleQuoteResourceId; the quote must be accepted first. Tracks fulfillment via orderState. Pipeline: quote \u2192 order \u2192 invoice (raise the invoice separately).",groups:["sale_orders"]},{name:"purchase_orders",description:"Purchase order documents: Purchase Requests (requisitions) and Purchase Orders (POs). Create, get, search, update, and transition (accept a request, confirm an order, void, delete). A Purchase Order links to its request via purchaseRequestResourceId; the request must be accepted first. Tracks fulfillment via orderState. Pipeline: request \u2192 order \u2192 bill (raise the bill separately).",groups:["purchase_orders"]},{name:"journals",description:"Journal entries (JE). Create, search, update, delete manual journals. Also: adjusting entries, accruals, reclassifications, corrections.",groups:["journals"]},{name:"cash_entries",description:"Cash-in receipts and cash-out disbursements for external cash movements. WHEN TO USE: money received from customers/external \u2192 cash-in. Money paid to suppliers/external \u2192 cash-out. For internal account-to-account transfers, use cash_transfers namespace.",groups:["cash_entries"]},{name:"cash_transfers",description:"Cash transfers between your own bank/cash accounts and cashflow transaction search. WHEN TO USE: moving funds between own accounts (main bank \u2192 petty cash, USD \u2192 SGD). For external receipts/payments, use cash_entries namespace.",groups:["cash_transfers"]},{name:"bank_accounts",description:"Bank accounts, bank statement imports (CSV/OFX), bank records search, auto-reconciliation. For unreconciled queries: ALWAYS search bank records with status UNRECONCILED after listing accounts. Also: bank feeds, bank balance.",groups:["bank"]},{name:"bank_rules",description:"Bank reconciliation rules (action shortcuts). Create, search, update, delete bank rules. Configure auto-matching rules for bank records.",groups:["bank_rules"]},{name:"reconciliations",description:"Apply a reconciliation decision to a bank statement entry \u2014 write side. Match bank records to EXISTING open bills/invoices/payments (reconcile_with_payments \u2014 the primary path, creates the payment for you), or to journals, cash entries, or transfers, or CREATE new bills/invoices (invoice_receipt/bill_receipt). Distinct from bank_accounts/bank_rules (which configure auto-reconciliation) and view_auto_reconciliation (which queries suggestions). Eleven endpoints: quick_reconcile + apply_bank_rule + magic_match (bulk), and direct_cash_entry / cash_journal / manual_journal / cash_transfer / invoice_receipt / bill_receipt / with_payments / learned_prediction (per-entry). Match-to-existing is preferred over create-new to avoid duplicates. Most fields prefill from the bank entry when omitted; FX is resolved server-side.",groups:["reconciliations"]},{name:"financial_reports",description:"Core financial statements: trial balance (TB), balance sheet (BS/B/S), profit & loss (PnL/P&L/income statement), cash flow, general ledger (GL), cash balance/position, equity movement, VAT/GST ledger. Also: how profitable, what is the balance. XLSX/PDF file exports of any of these statements are produced via download_export (lives in operational_reports namespace \u2014 switch there or call by name).",groups:["financial_reports"]},{name:"operational_reports",description:"Aging and operational reports: aged receivables (AR aging), aged payables (AP aging), AR report, bank balance summary, bank reconciliation reports, fixed asset (FA) summary, FA reconciliation. Data exports (CSV/Excel/XLSX). Anomaly detection and audit analysis: anomalous invoices, anomalous bills, cashflow anomalies, GL journal audit, exchange rate audit, receivables customer risk, cash expense health. Also: overdue analysis, how much owed, suspicious transactions, audit trail.",groups:["operational_reports","exports"]},{name:"pseudo_sql",description:"Pseudo-SQL ad-hoc read-only queries against the curated reporting schema (custom select, custom report, query data, run sql). Includes live schema introspection (get_pseudo_sql_schema) + sync preview (\u2264100 rows) + async CSV export. Use when search_* / download_export canonical reports don't cover the question.",groups:["pseudo_sql"]},{name:"contacts",description:"Contacts (customers/suppliers/vendors), contact groups, customer segmentation. Create, search, get, update, delete contacts. Bulk upsert contacts from CSV / spreadsheet imports \u2014 async, returns jobId, poll background_jobs. List/create contact groups.",groups:["contacts","contact_groups"]},{name:"items_and_inventory",description:"Products, services, inventory items. Create, search, get, update, delete items. Check inventory balance. List/search purchase-side catalog items. Also: SKU, catalog, stock.",groups:["items","inventory","purchase_items"]},{name:"catalogs",description:"Catalogs \u2014 named groupings of products/services, optionally scoped to contact groups. Create, search, get, update, delete catalogs.",groups:["catalogs"]},{name:"tags_and_custom_fields",description:"Tags for categorizing transactions. Custom fields for adding metadata (text, date, dropdown). Create, search, delete tags and custom fields.",groups:["tags","custom_fields"]},{name:"nano_classifiers",description:"Nano classifiers (tracking categories/dimensions). List, search, create, update, delete classifiers and their classes. Used for line-item tagging and dimensional reporting. Also: tracking categories, cost centers, departments, projects.",groups:["nano_classifiers"]},{name:"chart_of_accounts",description:"Chart of accounts (COA/GL accounts). Create, search, update accounts \u2014 including setting or removing an account's period lock date (lock / unlock a period, lock date: block recording or editing transactions on the account dated on or before a date). Bookmarks (favorites/shortcuts). Also: ledger codes, account types.",groups:["accounts","bookmarks"]},{name:"currencies",description:"Currencies, exchange rates (FX/forex). List/add org currencies. Set, update, import currency rates. Also: multi-currency, FX rates.",groups:["currencies"]},{name:"tax_profiles",description:"Tax profiles (GST/VAT/sales tax), withholding tax codes (WHT/ATC). Search, create, update tax profiles. List WHT codes.",groups:["tax_profiles"]},{name:"capsules_and_recipes",description:"Capsules (transaction groupings/capsule types). Financial recipes: amortization, depreciation, deferred revenue, IFRS 16 leases, hire purchase, fixed deposits, FX revaluation, loan schedules, ECL/expected credit loss, IAS 37 provisions, asset disposal. Two recipe execution paths: offline (plan_recipe + execute_recipe \u2014 client-side calculators, no API key) and server-side (list/get/preview/resume/rollback_capsule_recipe \u2014 produce real capsule entities via Jaz API). Plus capsuleRecipe payload on trigger mutations (create_bill, create_journal, create_cash_in, etc.) to create and trigger a recipe in one shot, with optional templateOverrides to customize the generated text (Customize Recipe). Keywords: calculate, provision, schedule, expected credit loss, revaluation, amortize, rollback recipe, customize template overrides slots.",groups:["capsules","recipes","capsule_recipes"]},{name:"scheduled_transactions",description:"Scheduled/recurring invoices, bills, journals. Create scheduled invoices/bills/journals, search scheduled transactions. Also: recurring, auto-generate.",groups:["schedulers"]},{name:"subscriptions",description:"Subscriptions (recurring billing/payment plans). Create, update, cancel, search subscriptions. Also: recurring charges, subscription schedules.",groups:["subscriptions"]},{name:"organization",description:"Organization info (name, currency, country, fiscal year). User management: invite, update, remove, search org users. Bulk invite. List enabled modules (org features/capabilities). List/search saved report templates.",groups:["organization","org_users","modules","report_templates"]},{name:"document_ai",description:"File attachments, spreadsheets, and document AI. Read and parse rows from attached spreadsheets \u2014 CSV, Excel, XLSX. Scan an invoice / bill / receipt PDF or image to create a draft bill or invoice via AI extraction (create_bt_from_attachment, with the file or a sourceUrl). Upload and list attachments; track extraction workflows.",groups:["attachments","magic"]},{name:"fixed_assets",description:"Fixed assets (PP&E/property, plant, equipment). Search, create, update, discard, sell, transfer, undo disposal. Also: depreciation, asset register.",groups:["fixed_assets"]},{name:"payments_and_search",description:"Payment records: get, update, delete individual payments. List payments/credits on invoices and bills. Reverse credit applications. Cashflow transaction search. Universal cross-entity search. Also: payment run, batch payment, payment matching, void payment, payment history, credit note applications.",groups:["payments","cashflow","search"]},{name:"quick_fix",description:"Quick Fix: bulk-update multiple transactions or line items in one call. Change dates, contacts, tags, accounts, tax profiles, custom fields across many invoices/bills/journals/credit-notes/cash-entries/schedulers at once. Also: batch update, mass edit.",groups:["quick_fix"]},{name:"export_records",description:"Export records to XLSX. List available columns, preview export scope (row count + sample), generate export file with pre-signed download URL. Supports any entity type: invoices, bills, contacts, items, journals, bank records, cashflow, fixed assets, etc. Pass query (structured search syntax) or filter (JSON), never both.",groups:["export_records"]},{name:"background_jobs",description:"Background job tracking. Poll any async operation by jobId (contacts bulk-upsert, items bulk-upsert, bank import, magic file processing, etc.). Filter by resourceId field to look up a specific job. Poll until status is SUCCESS, FAILED, or PARTIAL_SUCCESS.",groups:["background_jobs"]},{name:"drafts",description:"Draft business transactions \u2014 both local payload validation (invoices, bills, journals, credit notes) AND BULK-FRIENDLY server-side lifecycle: validate_drafts (sync eligibility check), convert_drafts_to_active (async promote to ACTIVE), submit_drafts_for_approval (async route to approval). The lifecycle tools are GENERIC and BULK \u2014 one call accepts up to 500 items mixing any combination of {btResourceId, btType: SALE|PURCHASE|SALE_CREDIT_NOTE|PURCHASE_CREDIT_NOTE}. No need for per-entity tools when promoting/submitting drafts at scale. NOT idempotent on already-promoted drafts.",groups:["drafts"]},{name:"help_center",description:"Search the Jaz help center for how-to articles, feature guides, accounting concepts, and troubleshooting. Returns top matches with title, section, snippet, and source URL. Works without an API key.",groups:["help_center"]},{name:"navigation",description:"Dashboard navigation deep links. Build a URL to any dashboard screen or record for the user \u2014 including the view link for a record just created or updated (a reply reporting on a record carries its link, and dashboard URLs always come from these tools, never written from memory). Also: open, go to, take me to, link, deep link, share a link, url, navigate, show me the page/screen, where can I see \u2014 for invoices, bills, reports, settings, or a specific transaction.",groups:["navigation"]}],U0r=new Set(["a","an","and","are","at","be","by","can","do","does","for","how","i","in","is","it","me","my","of","on","or","our","please","that","the","this","to","us","we","what","when","where","which","with","you","your"])});function q0r(){if(!$8){$8=new Map;for(let t of kc)$8.set(t.name,t)}return $8}function oy(t){return q0r().get(t)}function Yx(){return ple||(ple=kc.filter(t=>!t.disabled)),ple}function Y0r(){return hle||(hle=Yx().filter(t=>!t.interactive)),hle}function Nst(t){return t!==void 0&&j0r.has(t)?Yx():Y0r()}function $h(t){return Yx().filter(e=>e.group===t)}var $8,ple,j0r,hle,Av=re(()=>{"use strict";cv();$8=null,ple=null;j0r=new Set(["chat"]),hle=null});function U8(t){let e={type:t.type};if(t.description&&(e.description=t.description),t.enum&&(e.enum=t.enum),t.type==="array"&&t.items&&(e.items=U8(t.items)),t.type==="object"&&t.properties){let r={};for(let[n,i]of Object.entries(t.properties))r[n]=U8(i);e.properties=r,t.required?.length&&(e.required=t.required)}return e}function sd(t,e){let r={};for(let[n,i]of Object.entries(t))r[n]=U8(i);return{type:"object",properties:r,...e.length>0?{required:e}:{}}}function ay(t){return{name:t.name,description:t.description,input_schema:sd(t.params,t.required),...t.searchHint?{searchHint:t.searchHint}:{}}}var zx=re(()=>{"use strict"});function Hx(t){if(typeof t!="string")return t.isDestructive??!1;let e=t;return e.startsWith("delete_")||e.startsWith("pay_")||e.startsWith("finalize_")||e.includes("refund")||e==="remove_org_user"}function q8(t){return{readOnlyHint:t.readOnly,destructiveHint:!t.readOnly&&Hx(t),idempotentHint:t.readOnly,openWorldHint:t.openWorld??!1}}function Fst(t){if(!t.trim())return{namespaces:Qc.map(i=>{let s=i.groups.flatMap(o=>$h(o));return{name:i.name,description:i.description,toolCount:s.length,tools:s.map(o=>o.name)}}),hint:"Call describe_tools with specific tool names to get full schemas before executing."};let e=kst(t,5);if(e.length===0)return{matches:[],hint:`No tools match "${t}". Try broader terms or call search_tools with empty query to see all namespaces.`};let n=t.toLowerCase().split(/\s+/).filter(Boolean);return{matches:e.map(i=>{let s=i.groups.flatMap(u=>$h(u)),o=s.map(u=>`${u.name} ${u.searchHint??""} ${u.description}`.toLowerCase()),a=new Map(n.map(u=>{let f=o.filter(d=>d.includes(u)).length;return[u,Math.log((s.length+1)/(f+1))]})),c=s.map((u,f)=>{let d=o[f],p=n.reduce((h,m)=>d.includes(m)?h+(a.get(m)??0):h,0);return{tool:u,score:p}}).sort((u,f)=>f.score-u.score);return{namespace:i.name,description:i.description,tools:c.map(u=>({name:u.tool.name,description:u.tool.description.split(`
|
|
867
|
+
USE THIS to score a specific draft against contact history. For stand-alone "what does this contact normally look like?" without a draft \u2192 use get_contact_signals.`,params:{items:{type:"array",description:"Draft business transaction references (max 500). Mix any btType freely.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!0,isConcurrencySafe:!0,searchHint:"validate drafts eligibility check before convert promote",execute:async(t,e)=>(ov(e.items),$Y(t.client,e.items))},{name:"convert_drafts_to_active",description:`BULK promote \u2014 finalize up to 500 draft business transactions to ACTIVE in ONE call, mixing any combination of invoices, bills, and credit notes (no per-type tools needed). ${Tu} NOT idempotent: a second call on already-promoted drafts returns 422. Filter the draft list by status: DRAFT before submitting. Pair with validate_drafts for a pre-flight check on large batches.`,params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"convert drafts to active promote finalize bulk",execute:async(t,e)=>(ov(e.items),UY(t.client,e.items))},{name:"submit_drafts_for_approval",description:`BULK submit \u2014 route up to 500 draft business transactions into the approval workflow in ONE call, mixing any combination of invoices, bills, and credit notes. ${Tu} NOT idempotent on drafts that already have an in-flight approval request.`,params:{items:{type:"array",description:"Draft BT references (max 500). Mix any btType.",items:{type:"object",properties:{btResourceId:{type:"string",description:"Draft BT resource ID (UUID) \u2014 required"},btType:{type:"string",enum:["SALE","PURCHASE","SALE_CREDIT_NOTE","PURCHASE_CREDIT_NOTE"],description:"Required"}}}}},required:["items"],group:"drafts",readOnly:!1,searchHint:"submit drafts for approval workflow review bulk",execute:async(t,e)=>(ov(e.items),qY(t.client,e.items))},{name:"search_help_center",description:'Search the Jaz help center for how-to articles, feature guides, and accounting concepts. Use this for "how do I..." or "what is..." questions about Jaz: bank reconciliation, GST/VAT filing, multi-currency, fixed assets, custom fields, integrations, and so on. Returns top matching articles with title, section, content, and source URL.',params:{query:{type:"string",description:'Natural-language question or keywords (e.g. "how do I reconcile a bank statement", "set up GST", "multi-currency invoice").'},limit:{type:"number",description:"Maximum number of articles to return (default 3, max 10)."},section:{type:"string",description:'Optional: restrict to a single help-center section slug (e.g. "bank-reconciliations", "invoices").'}},required:["query"],group:"help_center",readOnly:!0,searchHint:"help center docs how to guide article search question",isConcurrencySafe:!0,maxResultSizeChars:2e4,execute:async(t,e)=>{let r=String(e.query??"").trim();if(!r)return{error:"Query is required.",hint:"Pass a natural-language question or keywords."};let n=typeof e.limit=="number"&&!Number.isNaN(e.limit)?e.limit:3,i=Math.max(1,Math.min(10,Math.floor(n))),s=typeof e.section=="string"?e.section:void 0;try{let o=ZR();if(s&&!o.sections.some(u=>u.slug===s))return{error:`Unknown section: "${s}".`,available:o.sections.map(u=>u.slug),hint:"Omit the section parameter to search every section, or pick a slug from the available list."};let a=KR(),c=await XR(o,a,r,{mode:"hybrid",limit:i,section:s});return c.length===0?{results:[],hint:"No matching articles. Try broader keywords or rephrase the question."}:{results:c.map(u=>{let f=(cce(u.article)??u.article.snippet).slice(0,1500);return{title:u.article.title,section:u.section.name,sectionSlug:u.section.slug,content:f,url:u.article.sourceUrl,score:Math.round(u.score*1e3)/1e3,scoreKind:u.scoreKind,matchedTerms:u.matchedTerms}}),totalArticles:o.articleCount,searchedSections:s?[s]:void 0}}catch(o){return{error:"Help center search failed.",detail:o instanceof Error?o.message:String(o),hint:"The bundled help-center index may be missing or corrupt."}}}},{name:"present_questions",description:`Present the user with a bounded multiple-choice question (or a short sequence of them) as an interactive pick-list, instead of asking in prose. Use as your FINAL action when the user must choose among a KNOWN, finite set of options you ALREADY have from context (a prior search/list result, org defaults, or your own knowledge) to continue (e.g. "which bank account?", "which of these duplicate bills?"). Give 2-4 options per question \u2014 curate to the most likely, never dump a long list \u2014 and at most 4 questions; set multiSelect per question when more than one may apply. List the options and stop \u2014 the user's pick arrives as their next message and starts a new turn. Ask several questions at once when more than one thing is unspecified. Prose-ask only when there's no bounded set to offer (a free-text name or amount), to confirm destructive actions, or instead of fetching data just to populate options. Terminal: do not call further tools or re-list the options in text afterward.`,params:{questions:{type:"array",description:"Questions to ask, each rendered as one page of the pick-list (at most 4). Provide one unless you genuinely have several distinct choices to collect in sequence.",items:{type:"object",properties:{header:{type:"string",description:'Optional short eyebrow label categorizing the question (1-2 words, e.g. "Account", "Period").'},question:{type:"string",description:'The question, shown as the card title (e.g. "Which bank account should I inspect?").'},options:{type:"array",description:"2-4 concrete choices (hard cap \u2014 curate to the most likely; the user can still type a different answer if none fit).",items:{type:"object",properties:{label:{type:"string",description:"The choice shown on the row and relayed verbatim as the user's answer when picked \u2014 keep it self-contained and unambiguous."},description:{type:"string",description:'Optional one-line detail under the label (e.g. "554 unreconciled records").'}},required:["label"]}},multiSelect:{type:"boolean",description:"Set true to let the user select multiple options for this question; omit or false for a single pick."}},required:["question","options"]}}},required:["questions"],group:"interaction",alwaysLoaded:!0,interactive:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"present questions options choices pick select ask user interactive widget",maxResultSizeChars:2e4,execute:async(t,e)=>{let n=(Array.isArray(e?.questions)?e.questions:[]).filter(s=>typeof s=="object"&&s!==null).map(s=>{let o=(Array.isArray(s.options)?s.options:[]).filter(c=>typeof c=="object"&&c!==null).map(c=>{let u=String(c.label??"").trim();return c.description?{label:u,description:String(c.description)}:{label:u}}).filter(c=>c.label),a=String(s.question??"").trim();return{...s.header?{header:String(s.header)}:{},question:a,options:o,multiSelect:!!s.multiSelect}}).filter(s=>s.question&&s.options.length>=2);if(n.length===0)return{error:"present_questions needs at least one question with non-empty question text and \u22652 labeled options (a single-option pick-list is not a choice).",hint:"Provide questions: [{ question, options: [{ label }, { label }] }]. For open-ended input, ask in prose instead."};if(n.length>4)return{error:`present_questions renders at most 4 questions (got ${n.length}).`,hint:"Ask the 4 most important now; collect the rest on a later turn."};let i=n.find(s=>s.options.length>4);return i?{error:`Each question may offer at most 4 options ("${i.question}" has ${i.options.length}).`,hint:"Curate to the 4 most likely choices \u2014 the user can still type a different answer if none fit."}:{questions:n}}},{name:"find_dashboard_destinations",description:'Discover valid destinations for get_dashboard_url. Returns dashboard screens and record/modal types as { key, label, kind }. Filter with `query` (substring over key + label, e.g. "invoice", "report", "settings"), `resource` (e.g. "sales", "purchases"), or `kind` ("screen" | "modal"). Results are capped; narrow the filter if `truncated` is true. Call this first when you are unsure of the exact destination key.',params:{query:{type:"string",description:'Case-insensitive substring to match against destination keys and labels (e.g. "invoice", "p&l", "bank").'},resource:{type:"string",description:'Restrict to one resource namespace, e.g. "sales", "purchases", "reports", "settings".'},kind:{type:"string",description:'Restrict to "screen" (list/report pages) or "modal" (record view/create/edit).',enum:["screen","modal"]}},required:[],group:"navigation",alwaysLoaded:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"list dashboard destinations find screens modals navigation keys catalog",maxResultSizeChars:16e3,execute:async(t,e)=>{let r=e.kind==="screen"||e.kind==="modal"?e.kind:void 0,n=o1e({query:typeof e.query=="string"?e.query:void 0,resource:typeof e.resource=="string"?e.resource:void 0,kind:r});return n.truncated?{...n,hint:`Showing ${n.results.length} of ${n.total} matches. Narrow with a more specific query, resource, or kind.`}:n.results.length===0?{...n,hint:'No matches. Destinations are named by product area, not task wording \u2014 retry with a broader or synonym term (e.g. "billing" not "card", "sales" not "invoice payment", "settings", "reports", "bank") before concluding the destination does not exist.'}:n}},{name:"get_dashboard_url",description:'Build a deep link to a dashboard screen or record so you can hand the user a URL ("here is the page: <url>"). `destination` is a key from find_dashboard_destinations \u2014 a screen (e.g. "sales.transactions.active-sales", "reports.profit-and-loss") or a record modal (e.g. "sales.modal.view-sale", "sales.modal.new-sale", "settings.modal.user_management"). For a record-specific modal (view/edit/duplicate a particular record) pass `resourceId` (the Jaz resourceId of that record); omit it for screens and for create/"new" modals. The link opens in the user\'s current org. Returns { url, kind, label }. Never write dashboard URLs or destination keys from memory \u2014 always resolve them through these tools.',params:{destination:{type:"string",description:'Destination key from find_dashboard_destinations, e.g. "reports.profit-and-loss" or "sales.modal.view-sale".'},resourceId:{type:"string",description:"Jaz resourceId of the record to focus \u2014 only for record modals (view/edit a specific record). Omit for screens and create modals."}},required:["destination"],group:"navigation",alwaysLoaded:!0,readOnly:!0,isConcurrencySafe:!0,searchHint:"dashboard url deep link navigate go to open screen record modal page share shareable",execute:async(t,e)=>{let{dashboardUrl:r}=e1e(t.platform??"jaz");try{return s1e(typeof e.destination=="string"?e.destination:"",typeof e.resourceId=="string"&&e.resourceId?e.resourceId:void 0,{dashboardUrl:r,orgResourceId:t.org?.resourceId})}catch(n){return{error:n instanceof Error?n.message:String(n)}}}}]});function kst(t,e=5){let r=t.trim().toLowerCase();if(!r)return[];let n=r.split(/[\s_-]+/).filter(s=>s.length>=2&&!U0r.has(s));return n.length===0?[]:Qc.map(s=>{let o=0,a=s.name.toLowerCase(),c=s.description.toLowerCase();(a===r||a===r.replace(/\s+/g,"_"))&&(o+=5),a.includes(r)&&(o+=3),c.includes(r)&&(o+=1);for(let u of n)a.includes(u)&&(o+=2),c.includes(u)&&(o+=1);return{ns:s,score:o}}).filter(s=>s.score>0).sort((s,o)=>o.score-s.score).slice(0,e).map(s=>s.ns)}var Qc,U0r,jx=re(()=>{"use strict";Qc=[{name:"invoices",description:"Sales invoices (INV/SI). Create, search, get, update, delete, pay, finalize, apply credits, download PDF. Also: receivables, AR, AR aging, billing, overdue invoices, dunning, recurring invoices. To create from an uploaded invoice file/PDF/image, use the document_ai namespace (AI extraction), not manual entry.",groups:["invoices"]},{name:"customer_credit_notes",description:"Customer credit notes (CN). Create, search, update, delete, finalize, refund, download PDF. Also: sales returns, customer CN.",groups:["customer_credit_notes"]},{name:"bills",description:"Purchase bills (PO/PI). Create, search, get, update, delete, pay, finalize, apply credits. Also: payables, AP, vendor invoices, supplier bills. To create from an uploaded bill/invoice file/PDF/image, use the document_ai namespace (AI extraction), not manual entry.",groups:["bills"]},{name:"supplier_credit_notes",description:"Supplier credit notes. Create, search, update, delete, finalize, refund. Also: purchase returns, debit notes, supplier CN.",groups:["supplier_credit_notes"]},{name:"sale_orders",description:"Sales order documents: Sale Quotes (estimates/quotations) and Sale Orders. Create, get, search, update, and transition (accept a quote, confirm an order, void, delete). A Sale Order links to its quote via saleQuoteResourceId; the quote must be accepted first. Tracks fulfillment via orderState. Pipeline: quote \u2192 order \u2192 invoice (raise the invoice separately).",groups:["sale_orders"]},{name:"purchase_orders",description:"Purchase order documents: Purchase Requests (requisitions) and Purchase Orders (POs). Create, get, search, update, and transition (accept a request, confirm an order, void, delete). A Purchase Order links to its request via purchaseRequestResourceId; the request must be accepted first. Tracks fulfillment via orderState. Pipeline: request \u2192 order \u2192 bill (raise the bill separately).",groups:["purchase_orders"]},{name:"journals",description:"Journal entries (JE). Create, search, update, delete manual journals. Also: adjusting entries, accruals, reclassifications, corrections.",groups:["journals"]},{name:"cash_entries",description:"Cash-in receipts and cash-out disbursements for external cash movements. WHEN TO USE: money received from customers/external \u2192 cash-in. Money paid to suppliers/external \u2192 cash-out. For internal account-to-account transfers, use cash_transfers namespace.",groups:["cash_entries"]},{name:"cash_transfers",description:"Cash transfers between your own bank/cash accounts and cashflow transaction search. WHEN TO USE: moving funds between own accounts (main bank \u2192 petty cash, USD \u2192 SGD). For external receipts/payments, use cash_entries namespace.",groups:["cash_transfers"]},{name:"bank_accounts",description:"Bank accounts, bank statement imports (CSV/OFX), bank records search, auto-reconciliation. For unreconciled queries: ALWAYS search bank records with status UNRECONCILED after listing accounts. Also: bank feeds, bank balance.",groups:["bank"]},{name:"bank_rules",description:"Bank reconciliation rules (action shortcuts). Create, search, update, delete bank rules. Configure auto-matching rules for bank records.",groups:["bank_rules"]},{name:"reconciliations",description:"Apply a reconciliation decision to a bank statement entry \u2014 write side. Match bank records to EXISTING open bills/invoices/payments (reconcile_with_payments \u2014 the primary path, creates the payment for you), or to journals, cash entries, or transfers, or CREATE new bills/invoices (invoice_receipt/bill_receipt). Distinct from bank_accounts/bank_rules (which configure auto-reconciliation) and view_auto_reconciliation (which queries suggestions). Eleven endpoints: quick_reconcile + apply_bank_rule + magic_match (bulk), and direct_cash_entry / cash_journal / manual_journal / cash_transfer / invoice_receipt / bill_receipt / with_payments / learned_prediction (per-entry). Match-to-existing is preferred over create-new to avoid duplicates. Most fields prefill from the bank entry when omitted; FX is resolved server-side.",groups:["reconciliations"]},{name:"financial_reports",description:"Core financial statements: trial balance (TB), balance sheet (BS/B/S), profit & loss (PnL/P&L/income statement), cash flow, general ledger (GL), cash balance/position, equity movement, VAT/GST ledger. Also: how profitable, what is the balance. XLSX/PDF file exports of any of these statements are produced via download_export (lives in operational_reports namespace \u2014 switch there or call by name).",groups:["financial_reports"]},{name:"operational_reports",description:"Aging and operational reports: aged receivables (AR aging), aged payables (AP aging), AR report, bank balance summary, bank reconciliation reports, fixed asset (FA) summary, FA reconciliation. Data exports (CSV/Excel/XLSX). Anomaly detection and audit analysis: anomalous invoices, anomalous bills, cashflow anomalies, GL journal audit, exchange rate audit, receivables customer risk, cash expense health. Also: overdue analysis, how much owed, suspicious transactions, audit trail.",groups:["operational_reports","exports"]},{name:"pseudo_sql",description:"Pseudo-SQL ad-hoc read-only queries against the curated reporting schema (custom select, custom report, query data, run sql). Includes live schema introspection (get_pseudo_sql_schema) + sync preview (\u2264100 rows) + async CSV export. Use when search_* / download_export canonical reports don't cover the question.",groups:["pseudo_sql"]},{name:"contacts",description:"Contacts (customers/suppliers/vendors), contact groups, customer segmentation. Create, search, get, update, delete contacts. Bulk upsert contacts from CSV / spreadsheet imports \u2014 async, returns jobId, poll background_jobs. List/create contact groups.",groups:["contacts","contact_groups"]},{name:"items_and_inventory",description:"Products, services, inventory items. Create, search, get, update, delete items. Check inventory balance. List/search purchase-side catalog items. Also: SKU, catalog, stock.",groups:["items","inventory","purchase_items"]},{name:"catalogs",description:"Catalogs \u2014 named groupings of products/services, optionally scoped to contact groups. Create, search, get, update, delete catalogs.",groups:["catalogs"]},{name:"tags_and_custom_fields",description:"Tags for categorizing transactions. Custom fields for adding metadata (text, date, dropdown). Create, search, delete tags and custom fields.",groups:["tags","custom_fields"]},{name:"nano_classifiers",description:"Nano classifiers (tracking categories/dimensions). List, search, create, update, delete classifiers and their classes. Used for line-item tagging and dimensional reporting. Also: tracking categories, cost centers, departments, projects.",groups:["nano_classifiers"]},{name:"chart_of_accounts",description:"Chart of accounts (COA/GL accounts). Create, search, update accounts \u2014 including setting or removing an account's period lock date (lock / unlock a period, lock date: block recording or editing transactions on the account dated on or before a date). Bookmarks (favorites/shortcuts). Also: ledger codes, account types.",groups:["accounts","bookmarks"]},{name:"currencies",description:"Currencies, exchange rates (FX/forex). List/add org currencies. Set, update, import currency rates. Also: multi-currency, FX rates.",groups:["currencies"]},{name:"tax_profiles",description:"Tax profiles (GST/VAT/sales tax), withholding tax codes (WHT/ATC). Search, create, update tax profiles. List WHT codes.",groups:["tax_profiles"]},{name:"capsules_and_recipes",description:"Capsules (transaction groupings/capsule types). Financial recipes: amortization, depreciation, deferred revenue, IFRS 16 leases, hire purchase, fixed deposits, FX revaluation, loan schedules, ECL/expected credit loss, IAS 37 provisions, asset disposal. Two recipe execution paths: offline (plan_recipe + execute_recipe \u2014 client-side calculators, no API key) and server-side (list/get/preview/resume/rollback_capsule_recipe \u2014 produce real capsule entities via Jaz API). Plus capsuleRecipe payload on trigger mutations (create_bill, create_journal, create_cash_in, etc.) to create and trigger a recipe in one shot, with optional templateOverrides to customize the generated text (Customize Recipe). Keywords: calculate, provision, schedule, expected credit loss, revaluation, amortize, rollback recipe, customize template overrides slots.",groups:["capsules","recipes","capsule_recipes"]},{name:"scheduled_transactions",description:"Scheduled/recurring invoices, bills, journals. Create scheduled invoices/bills/journals, search scheduled transactions. Also: recurring, auto-generate.",groups:["schedulers"]},{name:"subscriptions",description:"Subscriptions (recurring billing/payment plans). Create, update, cancel, search subscriptions. Also: recurring charges, subscription schedules.",groups:["subscriptions"]},{name:"organization",description:"Organization info (name, currency, country, fiscal year). User management: invite, update, remove, search org users. Bulk invite. List enabled modules (org features/capabilities). List/search saved report templates.",groups:["organization","org_users","modules","report_templates"]},{name:"document_ai",description:'File attachments, spreadsheets, and document AI. Read and parse rows from attached spreadsheets \u2014 CSV, Excel, XLSX. Scan a single invoice / bill / receipt PDF or image to create a draft bill or invoice via AI extraction (create_bt_from_attachment, with the file or a sourceUrl). Auto-sort a whole FOLDER, a .zip, or a Dropbox / Google Drive / OneDrive folder share link of mixed paperwork \u2014 "create docs from this Dropbox folder link", a pile/batch of invoices and bills \u2014 into invoices, bills, credit notes, and bank statements with classify_documents, then create the drafts with extract_documents. Upload and list attachments; track extraction workflows.',groups:["attachments","magic"]},{name:"fixed_assets",description:"Fixed assets (PP&E/property, plant, equipment). Search, create, update, discard, sell, transfer, undo disposal. Also: depreciation, asset register.",groups:["fixed_assets"]},{name:"payments_and_search",description:"Payment records: get, update, delete individual payments. List payments/credits on invoices and bills. Reverse credit applications. Cashflow transaction search. Universal cross-entity search. Also: payment run, batch payment, payment matching, void payment, payment history, credit note applications.",groups:["payments","cashflow","search"]},{name:"quick_fix",description:"Quick Fix: bulk-update multiple transactions or line items in one call. Change dates, contacts, tags, accounts, tax profiles, custom fields across many invoices/bills/journals/credit-notes/cash-entries/schedulers at once. Also: batch update, mass edit.",groups:["quick_fix"]},{name:"export_records",description:"Export records to XLSX. List available columns, preview export scope (row count + sample), generate export file with pre-signed download URL. Supports any entity type: invoices, bills, contacts, items, journals, bank records, cashflow, fixed assets, etc. Pass query (structured search syntax) or filter (JSON), never both.",groups:["export_records"]},{name:"background_jobs",description:"Background job tracking. Poll any async operation by jobId (contacts bulk-upsert, items bulk-upsert, bank import, magic file processing, etc.). Filter by resourceId field to look up a specific job. Poll until status is SUCCESS, FAILED, or PARTIAL_SUCCESS.",groups:["background_jobs"]},{name:"drafts",description:"Draft business transactions \u2014 both local payload validation (invoices, bills, journals, credit notes) AND BULK-FRIENDLY server-side lifecycle: validate_drafts (sync eligibility check), convert_drafts_to_active (async promote to ACTIVE), submit_drafts_for_approval (async route to approval). The lifecycle tools are GENERIC and BULK \u2014 one call accepts up to 500 items mixing any combination of {btResourceId, btType: SALE|PURCHASE|SALE_CREDIT_NOTE|PURCHASE_CREDIT_NOTE}. No need for per-entity tools when promoting/submitting drafts at scale. NOT idempotent on already-promoted drafts.",groups:["drafts"]},{name:"help_center",description:"Search the Jaz help center for how-to articles, feature guides, accounting concepts, and troubleshooting. Returns top matches with title, section, snippet, and source URL. Works without an API key.",groups:["help_center"]},{name:"navigation",description:"Dashboard navigation deep links. Build a URL to any dashboard screen or record for the user \u2014 including the view link for a record just created or updated (a reply reporting on a record carries its link, and dashboard URLs always come from these tools, never written from memory). Also: open, go to, take me to, link, deep link, share a link, url, navigate, show me the page/screen, where can I see \u2014 for invoices, bills, reports, settings, or a specific transaction.",groups:["navigation"]}],U0r=new Set(["a","an","and","are","at","be","by","can","do","does","for","how","i","in","is","it","me","my","of","on","or","our","please","that","the","this","to","us","we","what","when","where","which","with","you","your"])});function q0r(){if(!$8){$8=new Map;for(let t of kc)$8.set(t.name,t)}return $8}function oy(t){return q0r().get(t)}function Yx(){return ple||(ple=kc.filter(t=>!t.disabled)),ple}function Y0r(){return hle||(hle=Yx().filter(t=>!t.interactive)),hle}function Nst(t){return t!==void 0&&j0r.has(t)?Yx():Y0r()}function $h(t){return Yx().filter(e=>e.group===t)}var $8,ple,j0r,hle,Av=re(()=>{"use strict";cv();$8=null,ple=null;j0r=new Set(["chat"]),hle=null});function U8(t){let e={type:t.type};if(t.description&&(e.description=t.description),t.enum&&(e.enum=t.enum),t.type==="array"&&t.items&&(e.items=U8(t.items)),t.type==="object"&&t.properties){let r={};for(let[n,i]of Object.entries(t.properties))r[n]=U8(i);e.properties=r,t.required?.length&&(e.required=t.required)}return e}function sd(t,e){let r={};for(let[n,i]of Object.entries(t))r[n]=U8(i);return{type:"object",properties:r,...e.length>0?{required:e}:{}}}function ay(t){return{name:t.name,description:t.description,input_schema:sd(t.params,t.required),...t.searchHint?{searchHint:t.searchHint}:{}}}var zx=re(()=>{"use strict"});function Hx(t){if(typeof t!="string")return t.isDestructive??!1;let e=t;return e.startsWith("delete_")||e.startsWith("pay_")||e.startsWith("finalize_")||e.includes("refund")||e==="remove_org_user"}function q8(t){return{readOnlyHint:t.readOnly,destructiveHint:!t.readOnly&&Hx(t),idempotentHint:t.readOnly,openWorldHint:t.openWorld??!1}}function Fst(t){if(!t.trim())return{namespaces:Qc.map(i=>{let s=i.groups.flatMap(o=>$h(o));return{name:i.name,description:i.description,toolCount:s.length,tools:s.map(o=>o.name)}}),hint:"Call describe_tools with specific tool names to get full schemas before executing."};let e=kst(t,5);if(e.length===0)return{matches:[],hint:`No tools match "${t}". Try broader terms or call search_tools with empty query to see all namespaces.`};let n=t.toLowerCase().split(/\s+/).filter(Boolean);return{matches:e.map(i=>{let s=i.groups.flatMap(u=>$h(u)),o=s.map(u=>`${u.name} ${u.searchHint??""} ${u.description}`.toLowerCase()),a=new Map(n.map(u=>{let f=o.filter(d=>d.includes(u)).length;return[u,Math.log((s.length+1)/(f+1))]})),c=s.map((u,f)=>{let d=o[f],p=n.reduce((h,m)=>d.includes(m)?h+(a.get(m)??0):h,0);return{tool:u,score:p}}).sort((u,f)=>f.score-u.score);return{namespace:i.name,description:i.description,tools:c.map(u=>({name:u.tool.name,description:u.tool.description.split(`
|
|
868
868
|
`)[0],...u.tool.searchHint?{searchHint:u.tool.searchHint}:{}}))}}),hint:"Call describe_tools with the tool names you need, then execute_tool to run them."}}function Ost(t){if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))return{error:"Invalid `tools` parameter. Expected string[]."};if(t.length===0)return{error:"Provide at least one tool name. Use search_tools first to discover tool names."};let e=[],r=[];for(let n of t){let i=oy(n);if(!i){r.push(n);continue}e.push({...ay(i),readOnly:i.readOnly,isDestructive:i.isDestructive??!1,isConcurrencySafe:i.isConcurrencySafe??!1,destructiveHint:!i.readOnly&&Hx(i),group:i.group})}return{tools:e,...r.length>0?{notFound:r,hint:`Tools not found: ${r.join(", ")}. Use search_tools to find correct names.`}:{}}}var z0r,H0r,G0r,Uh,od,Gx=re(()=>{"use strict";jx();Av();zx();z0r={name:"search_tools",description:"Search for available Jaz accounting tools by keyword. Returns matching tool namespaces with tool names and descriptions. Call with empty query to list all namespaces. ALWAYS call this first to discover what tools are available.",inputSchema:sd({query:{type:"string",description:'Search keyword (e.g. "invoice", "bank recon", "depreciation"). Empty string lists all namespaces.'}},[])};H0r={name:"describe_tools",description:"Get full JSON Schema (parameters, types, required fields) for specific tools. Call this after search_tools to get the exact input format before calling execute_tool.",inputSchema:sd({tools:{type:"array",items:{type:"string"},description:'Tool names to describe (e.g. ["create_invoice", "search_contacts"])'}},["tools"])},G0r={name:"execute_tool",description:"Execute a Jaz accounting tool. Call describe_tools first to get the required parameters. Pass the tool name and its arguments.",inputSchema:sd({tool:{type:"string",description:'Tool name (e.g. "create_invoice")'},arguments:{type:"object",description:"Tool arguments (see describe_tools for schema)"},org_id:{type:"string",description:"Organization ID (UUID). Required in multi-org mode (PAT or multiple API keys). Call list_organizations to get available IDs."}},["tool"])},Uh={name:"list_organizations",description:"List organizations available to the current authentication. Returns org names and resource IDs for use as org_id in execute_tool calls.",inputSchema:sd({},[])},od=[z0r,H0r,G0r]});var Zx=b(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.regexpCode=Dr.getEsmExportName=Dr.getProperty=Dr.safeStringify=Dr.stringify=Dr.strConcat=Dr.addCodeArg=Dr.str=Dr._=Dr.nil=Dr._Code=Dr.Name=Dr.IDENTIFIER=Dr._CodeOrName=void 0;var Jx=class{};Dr._CodeOrName=Jx;Dr.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var cy=class extends Jx{constructor(e){if(super(),!Dr.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};Dr.Name=cy;var Lc=class extends Jx{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof cy&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Dr._Code=Lc;Dr.nil=new Lc("");function Pst(t,...e){let r=[t[0]],n=0;for(;n<e.length;)yle(r,e[n]),r.push(t[++n]);return new Lc(r)}Dr._=Pst;var gle=new Lc("+");function $st(t,...e){let r=[Wx(t[0])],n=0;for(;n<e.length;)r.push(gle),yle(r,e[n]),r.push(gle,Wx(t[++n]));return eCr(r),new Lc(r)}Dr.str=$st;function yle(t,e){e instanceof Lc?t.push(...e._items):e instanceof cy?t.push(e):t.push(nCr(e))}Dr.addCodeArg=yle;function eCr(t){let e=1;for(;e<t.length-1;){if(t[e]===gle){let r=tCr(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function tCr(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof cy||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof cy))return`"${t}${e.slice(1)}`}function rCr(t,e){return e.emptyStr()?t:t.emptyStr()?e:$st`${t}${e}`}Dr.strConcat=rCr;function nCr(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Wx(Array.isArray(t)?t.join(","):t)}function iCr(t){return new Lc(Wx(t))}Dr.stringify=iCr;function Wx(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Dr.safeStringify=Wx;function sCr(t){return typeof t=="string"&&Dr.IDENTIFIER.test(t)?new Lc(`.${t}`):Pst`[${t}]`}Dr.getProperty=sCr;function oCr(t){if(typeof t=="string"&&Dr.IDENTIFIER.test(t))return new Lc(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Dr.getEsmExportName=oCr;function aCr(t){return new Lc(t.toString())}Dr.regexpCode=aCr});var Cle=b(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});oa.ValueScope=oa.ValueScopeName=oa.Scope=oa.varKinds=oa.UsedValueState=void 0;var sa=Zx(),Ele=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},z8;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(z8||(oa.UsedValueState=z8={}));oa.varKinds={const:new sa.Name("const"),let:new sa.Name("let"),var:new sa.Name("var")};var H8=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof sa.Name?e:this.name(e)}name(e){return new sa.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};oa.Scope=H8;var G8=class extends sa.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,sa._)`.${new sa.Name(r)}[${n}]`}};oa.ValueScopeName=G8;var cCr=(0,sa._)`\n`,ble=class extends H8{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?cCr:sa.nil}}get(){return this._scope}name(e){return new G8(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let f=a.get(o);if(f)return f}else a=this._values[s]=new Map;a.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,i.setValue(r,{property:s,itemIndex:u}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,sa._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=sa.nil;for(let o in e){let a=e[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,z8.Started);let f=r(u);if(f){let d=this.opts.es5?oa.varKinds.var:oa.varKinds.const;s=(0,sa._)`${s}${d} ${u} = ${f};${this.opts._n}`}else if(f=i?.(u))s=(0,sa._)`${s}${f}${this.opts._n}`;else throw new Ele(u);c.set(u,z8.Completed)})}return s}};oa.ValueScope=ble});var $t=b(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.or=jt.and=jt.not=jt.CodeGen=jt.operators=jt.varKinds=jt.ValueScopeName=jt.ValueScope=jt.Scope=jt.Name=jt.regexpCode=jt.stringify=jt.getProperty=jt.nil=jt.strConcat=jt.str=jt._=void 0;var ur=Zx(),Fu=Cle(),Yh=Zx();Object.defineProperty(jt,"_",{enumerable:!0,get:function(){return Yh._}});Object.defineProperty(jt,"str",{enumerable:!0,get:function(){return Yh.str}});Object.defineProperty(jt,"strConcat",{enumerable:!0,get:function(){return Yh.strConcat}});Object.defineProperty(jt,"nil",{enumerable:!0,get:function(){return Yh.nil}});Object.defineProperty(jt,"getProperty",{enumerable:!0,get:function(){return Yh.getProperty}});Object.defineProperty(jt,"stringify",{enumerable:!0,get:function(){return Yh.stringify}});Object.defineProperty(jt,"regexpCode",{enumerable:!0,get:function(){return Yh.regexpCode}});Object.defineProperty(jt,"Name",{enumerable:!0,get:function(){return Yh.Name}});var Z8=Cle();Object.defineProperty(jt,"Scope",{enumerable:!0,get:function(){return Z8.Scope}});Object.defineProperty(jt,"ValueScope",{enumerable:!0,get:function(){return Z8.ValueScope}});Object.defineProperty(jt,"ValueScopeName",{enumerable:!0,get:function(){return Z8.ValueScopeName}});Object.defineProperty(jt,"varKinds",{enumerable:!0,get:function(){return Z8.varKinds}});jt.operators={GT:new ur._Code(">"),GTE:new ur._Code(">="),LT:new ur._Code("<"),LTE:new ur._Code("<="),EQ:new ur._Code("==="),NEQ:new ur._Code("!=="),NOT:new ur._Code("!"),OR:new ur._Code("||"),AND:new ur._Code("&&"),ADD:new ur._Code("+")};var cd=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},vle=class extends cd{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Fu.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Ev(this.rhs,e,r)),this}get names(){return this.rhs instanceof ur._CodeOrName?this.rhs.names:{}}},V8=class extends cd{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ur.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Ev(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ur.Name?{}:{...this.lhs.names};return W8(e,this.rhs)}},Ile=class extends V8{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},wle=class extends cd{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},_le=class extends cd{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Dle=class extends cd{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Sle=class extends cd{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Ev(this.code,e,r),this}get names(){return this.code instanceof ur._CodeOrName?this.code.names:{}}},Kx=class extends cd{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(uCr(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>fy(e,r.names),{})}},ud=class extends Kx{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Ble=class extends Kx{},yv=class extends ud{};yv.kind="else";var uy=class t extends ud{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new yv(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Ust(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Ev(this.condition,e,r),this}get names(){let e=super.names;return W8(e,this.condition),this.else&&fy(e,this.else.names),e}};uy.kind="if";var ly=class extends ud{};ly.kind="for";var Rle=class extends ly{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Ev(this.iteration,e,r),this}get names(){return fy(super.names,this.iteration.names)}},xle=class extends ly{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Fu.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=W8(super.names,this.from);return W8(e,this.to)}},J8=class extends ly{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Ev(this.iterable,e,r),this}get names(){return fy(super.names,this.iterable.names)}},Xx=class extends ud{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Xx.kind="func";var eT=class extends Kx{render(e){return"return "+super.render(e)}};eT.kind="return";var Tle=class extends ud{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&fy(e,this.catch.names),this.finally&&fy(e,this.finally.names),e}},tT=class extends ud{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};tT.kind="catch";var rT=class extends ud{render(e){return"finally"+super.render(e)}};rT.kind="finally";var kle=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
869
869
|
`:""},this._extScope=e,this._scope=new Fu.Scope({parent:e}),this._nodes=[new Ble]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new vle(e,s,n)),s}const(e,r,n){return this._def(Fu.varKinds.const,e,r,n)}let(e,r,n){return this._def(Fu.varKinds.let,e,r,n)}var(e,r,n){return this._def(Fu.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new V8(e,r,n))}add(e,r){return this._leafNode(new Ile(e,jt.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ur.nil&&this._leafNode(new Sle(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,ur.addCodeArg)(r,i));return r.push("}"),new ur._Code(r)}if(e,r,n){if(this._blockNode(new uy(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new uy(e))}else(){return this._elseNode(new yv)}endIf(){return this._endBlockNode(uy,yv)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Rle(e),r)}forRange(e,r,n,i,s=this.opts.es5?Fu.varKinds.var:Fu.varKinds.let){let o=this._scope.toName(e);return this._for(new xle(s,o,r,n),()=>i(o))}forOf(e,r,n,i=Fu.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof ur.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ur._)`${o}.length`,a=>{this.var(s,(0,ur._)`${o}[${a}]`),n(s)})}return this._for(new J8("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?Fu.varKinds.var:Fu.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ur._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new J8("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(ly)}label(e){return this._leafNode(new wle(e))}break(e){return this._leafNode(new _le(e))}return(e){let r=new eT;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(eT)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new Tle;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new tT(s),r(s)}return n&&(this._currNode=i.finally=new rT,this.code(n)),this._endBlockNode(tT,rT)}throw(e){return this._leafNode(new Dle(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ur.nil,n,i){return this._blockNode(new Xx(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Xx)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof uy))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};jt.CodeGen=kle;function fy(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function W8(t,e){return e instanceof ur._CodeOrName?fy(t,e.names):t}function Ev(t,e,r){if(t instanceof ur.Name)return n(t);if(!i(t))return t;return new ur._Code(t._items.reduce((s,o)=>(o instanceof ur.Name&&(o=n(o)),o instanceof ur._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof ur._Code&&s._items.some(o=>o instanceof ur.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function uCr(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Ust(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ur._)`!${Nle(t)}`}jt.not=Ust;var lCr=qst(jt.operators.AND);function fCr(...t){return t.reduce(lCr)}jt.and=fCr;var dCr=qst(jt.operators.OR);function pCr(...t){return t.reduce(dCr)}jt.or=pCr;function qst(t){return(e,r)=>e===ur.nil?r:r===ur.nil?e:(0,ur._)`${Nle(e)} ${t} ${Nle(r)}`}function Nle(t){return t instanceof ur.Name?t:(0,ur._)`(${t})`}});var mr=b(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.checkStrictMode=Xt.getErrorPath=Xt.Type=Xt.useFunc=Xt.setEvaluated=Xt.evaluatedPropsToName=Xt.mergeEvaluated=Xt.eachItem=Xt.unescapeJsonPointer=Xt.escapeJsonPointer=Xt.escapeFragment=Xt.unescapeFragment=Xt.schemaRefOrVal=Xt.schemaHasRulesButRef=Xt.schemaHasRules=Xt.checkUnknownRules=Xt.alwaysValidSchema=Xt.toHash=void 0;var un=$t(),hCr=Zx();function mCr(t){let e={};for(let r of t)e[r]=!0;return e}Xt.toHash=mCr;function ACr(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(zst(t,e),!Hst(e,t.self.RULES.all))}Xt.alwaysValidSchema=ACr;function zst(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let s in e)i[s]||Jst(t,`unknown keyword: "${s}"`)}Xt.checkUnknownRules=zst;function Hst(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Xt.schemaHasRules=Hst;function gCr(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Xt.schemaHasRulesButRef=gCr;function yCr({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,un._)`${r}`}return(0,un._)`${t}${e}${(0,un.getProperty)(n)}`}Xt.schemaRefOrVal=yCr;function ECr(t){return Gst(decodeURIComponent(t))}Xt.unescapeFragment=ECr;function bCr(t){return encodeURIComponent(Ole(t))}Xt.escapeFragment=bCr;function Ole(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Xt.escapeJsonPointer=Ole;function Gst(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Xt.unescapeJsonPointer=Gst;function CCr(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Xt.eachItem=CCr;function jst({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof un.Name?(s instanceof un.Name?t(i,s,o):e(i,s,o),o):s instanceof un.Name?(e(i,o,s),s):r(s,o);return a===un.Name&&!(c instanceof un.Name)?n(i,c):c}}Xt.mergeEvaluated={props:jst({mergeNames:(t,e,r)=>t.if((0,un._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,un._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,un._)`${r} || {}`).code((0,un._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,un._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,un._)`${r} || {}`),Qle(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Vst}),items:jst({mergeNames:(t,e,r)=>t.if((0,un._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,un._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,un._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,un._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Vst(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,un._)`{}`);return e!==void 0&&Qle(t,r,e),r}Xt.evaluatedPropsToName=Vst;function Qle(t,e,r){Object.keys(r).forEach(n=>t.assign((0,un._)`${e}${(0,un.getProperty)(n)}`,!0))}Xt.setEvaluated=Qle;var Yst={};function vCr(t,e){return t.scopeValue("func",{ref:e,code:Yst[e.code]||(Yst[e.code]=new hCr._Code(e.code))})}Xt.useFunc=vCr;var Fle;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Fle||(Xt.Type=Fle={}));function ICr(t,e,r){if(t instanceof un.Name){let n=e===Fle.Num;return r?n?(0,un._)`"[" + ${t} + "]"`:(0,un._)`"['" + ${t} + "']"`:n?(0,un._)`"/" + ${t}`:(0,un._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,un.getProperty)(t).toString():"/"+Ole(t)}Xt.getErrorPath=ICr;function Jst(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Xt.checkStrictMode=Jst});var ld=b(Lle=>{"use strict";Object.defineProperty(Lle,"__esModule",{value:!0});var no=$t(),wCr={data:new no.Name("data"),valCxt:new no.Name("valCxt"),instancePath:new no.Name("instancePath"),parentData:new no.Name("parentData"),parentDataProperty:new no.Name("parentDataProperty"),rootData:new no.Name("rootData"),dynamicAnchors:new no.Name("dynamicAnchors"),vErrors:new no.Name("vErrors"),errors:new no.Name("errors"),this:new no.Name("this"),self:new no.Name("self"),scope:new no.Name("scope"),json:new no.Name("json"),jsonPos:new no.Name("jsonPos"),jsonLen:new no.Name("jsonLen"),jsonPart:new no.Name("jsonPart")};Lle.default=wCr});var nT=b(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.extendErrors=io.resetErrorsCount=io.reportExtraError=io.reportError=io.keyword$DataError=io.keywordError=void 0;var Ar=$t(),K8=mr(),ko=ld();io.keywordError={message:({keyword:t})=>(0,Ar.str)`must pass "${t}" keyword validation`};io.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Ar.str)`"${t}" keyword must be ${e} ($data)`:(0,Ar.str)`"${t}" keyword is invalid ($data)`};function _Cr(t,e=io.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,c=Kst(t,e,r);n??(o||a)?Wst(s,c):Zst(i,(0,Ar._)`[${c}]`)}io.reportError=_Cr;function DCr(t,e=io.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,a=Kst(t,e,r);Wst(i,a),s||o||Zst(n,ko.default.vErrors)}io.reportExtraError=DCr;function SCr(t,e){t.assign(ko.default.errors,e),t.if((0,Ar._)`${ko.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Ar._)`${ko.default.vErrors}.length`,e),()=>t.assign(ko.default.vErrors,null)))}io.resetErrorsCount=SCr;function BCr({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,ko.default.errors,a=>{t.const(o,(0,Ar._)`${ko.default.vErrors}[${a}]`),t.if((0,Ar._)`${o}.instancePath === undefined`,()=>t.assign((0,Ar._)`${o}.instancePath`,(0,Ar.strConcat)(ko.default.instancePath,s.errorPath))),t.assign((0,Ar._)`${o}.schemaPath`,(0,Ar.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,Ar._)`${o}.schema`,r),t.assign((0,Ar._)`${o}.data`,n))})}io.extendErrors=BCr;function Wst(t,e){let r=t.const("err",e);t.if((0,Ar._)`${ko.default.vErrors} === null`,()=>t.assign(ko.default.vErrors,(0,Ar._)`[${r}]`),(0,Ar._)`${ko.default.vErrors}.push(${r})`),t.code((0,Ar._)`${ko.default.errors}++`)}function Zst(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,Ar._)`new ${t.ValidationError}(${e})`):(r.assign((0,Ar._)`${n}.errors`,e),r.return(!1))}var dy={keyword:new Ar.Name("keyword"),schemaPath:new Ar.Name("schemaPath"),params:new Ar.Name("params"),propertyName:new Ar.Name("propertyName"),message:new Ar.Name("message"),schema:new Ar.Name("schema"),parentSchema:new Ar.Name("parentSchema")};function Kst(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Ar._)`{}`:RCr(t,e,r)}function RCr(t,e,r={}){let{gen:n,it:i}=t,s=[xCr(i,r),TCr(t,r)];return kCr(t,e,s),n.object(...s)}function xCr({errorPath:t},{instancePath:e}){let r=e?(0,Ar.str)`${t}${(0,K8.getErrorPath)(e,K8.Type.Str)}`:t;return[ko.default.instancePath,(0,Ar.strConcat)(ko.default.instancePath,r)]}function TCr({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,Ar.str)`${e}/${t}`;return r&&(i=(0,Ar.str)`${i}${(0,K8.getErrorPath)(r,K8.Type.Str)}`),[dy.schemaPath,i]}function kCr(t,{params:e,message:r},n){let{keyword:i,data:s,schemaValue:o,it:a}=t,{opts:c,propertyName:u,topSchemaRef:f,schemaPath:d}=a;n.push([dy.keyword,i],[dy.params,typeof e=="function"?e(t):e||(0,Ar._)`{}`]),c.messages&&n.push([dy.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([dy.schema,o],[dy.parentSchema,(0,Ar._)`${f}${d}`],[ko.default.data,s]),u&&n.push([dy.propertyName,u])}});var eot=b(bv=>{"use strict";Object.defineProperty(bv,"__esModule",{value:!0});bv.boolOrEmptySchema=bv.topBoolOrEmptySchema=void 0;var NCr=nT(),FCr=$t(),OCr=ld(),QCr={message:"boolean schema is false"};function LCr(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Xst(t,!1):typeof r=="object"&&r.$async===!0?e.return(OCr.default.data):(e.assign((0,FCr._)`${n}.errors`,null),e.return(!0))}bv.topBoolOrEmptySchema=LCr;function MCr(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Xst(t)):r.var(e,!0)}bv.boolOrEmptySchema=MCr;function Xst(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,NCr.reportError)(i,QCr,void 0,e)}});var Mle=b(Cv=>{"use strict";Object.defineProperty(Cv,"__esModule",{value:!0});Cv.getRules=Cv.isJSONType=void 0;var PCr=["string","number","integer","boolean","null","object","array"],$Cr=new Set(PCr);function UCr(t){return typeof t=="string"&&$Cr.has(t)}Cv.isJSONType=UCr;function qCr(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Cv.getRules=qCr});var Ple=b(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.shouldUseRule=zh.shouldUseGroup=zh.schemaHasRulesForType=void 0;function jCr({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&tot(t,n)}zh.schemaHasRulesForType=jCr;function tot(t,e){return e.rules.some(r=>rot(t,r))}zh.shouldUseGroup=tot;function rot(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}zh.shouldUseRule=rot});var iT=b(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});so.reportTypeError=so.checkDataTypes=so.checkDataType=so.coerceAndCheckDataType=so.getJSONTypes=so.getSchemaTypes=so.DataType=void 0;var YCr=Mle(),zCr=Ple(),HCr=nT(),Lt=$t(),not=mr(),vv;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(vv||(so.DataType=vv={}));function GCr(t){let e=iot(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}so.getSchemaTypes=GCr;function iot(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(YCr.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}so.getJSONTypes=iot;function VCr(t,e){let{gen:r,data:n,opts:i}=t,s=JCr(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,zCr.schemaHasRulesForType)(t,e[0]));if(o){let a=Ule(e,n,i.strictNumbers,vv.Wrong);r.if(a,()=>{s.length?WCr(t,e,s):qle(t)})}return o}so.coerceAndCheckDataType=VCr;var sot=new Set(["string","number","integer","boolean","null"]);function JCr(t,e){return e?t.filter(r=>sot.has(r)||e==="array"&&r==="array"):[]}function WCr(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,Lt._)`typeof ${i}`),a=n.let("coerced",(0,Lt._)`undefined`);s.coerceTypes==="array"&&n.if((0,Lt._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,Lt._)`${i}[0]`).assign(o,(0,Lt._)`typeof ${i}`).if(Ule(e,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,Lt._)`${a} !== undefined`);for(let u of r)(sot.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),qle(t),n.endIf(),n.if((0,Lt._)`${a} !== undefined`,()=>{n.assign(i,a),ZCr(t,a)});function c(u){switch(u){case"string":n.elseIf((0,Lt._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,Lt._)`"" + ${i}`).elseIf((0,Lt._)`${i} === null`).assign(a,(0,Lt._)`""`);return;case"number":n.elseIf((0,Lt._)`${o} == "boolean" || ${i} === null
|
|
870
870
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,Lt._)`+${i}`);return;case"integer":n.elseIf((0,Lt._)`${o} === "boolean" || ${i} === null
|