@prismatic-io/components-expensify 0.0.1 → 0.1.1

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/dist/index.js CHANGED
@@ -241,4 +241,4 @@ let t=Om(),n=km(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Sym
241
241
  <#assign expenseNumber = expenseNumber + 1>
242
242
  </#list>
243
243
  <#assign reportNumber = reportNumber + 1>
244
- </#list>`}),ag=(0,$.input)({label:`Approved After`,type:`string`,required:!1,comments:`Filters out all reports approved before, or on, the given date. Only applies to reports that have been approved. yyyy-mm-dd formatted date.`,placeholder:`Enter approval date (yyyy-mm-dd)`,example:`2016-01-01`,clean:rh}),og=(0,$.input)({label:`Mark as Exported Label Filter`,type:`string`,required:!1,comments:`Filters out reports that have already been exported with this label.`,placeholder:`Enter export label`,example:`Expensify Export`,clean:rh}),sg=(0,$.input)({label:`Report ID List`,type:`string`,collection:`valuelist`,required:!1,comments:`The IDs of the reports to get information for.`,placeholder:`Enter report ID`,example:`R006AseGxMka`,clean:ah}),cg={connectionInput:ch,type:{...lh,default:Rm.REPORT,comments:`Specifies to the job that it has to create a report.`},employeeEmail:uh,report:Zh,expenses:Xh,policyId:dh},lg={connectionInput:ch,fileName:Gh,fileSystem:Kh},ug=(0,$.structuredObjectInput)({label:`Additional Fields`,required:!1,comments:`Additional optional fields: includes File Basename, Include Full Page Receipts PDF, Limit, and Test.`,inputs:{fileBasename:ng,includeFullPageReceiptsPdf:rg,limit:Jh,test:Yh}}),dg={connectionInput:ch,fileExtension:tg,startDate:{...$h,required:!1,clean:rh},endDate:{...eg,required:!1},approvedAfter:ag,markAsExportedFilter:og,policyIDList:{...ph,required:!1},reportIdList:sg,additionalFields:ug,status:{...qh,label:`Report State`,comments:`The report state to filter on. Only reports in this state are exported.`,required:!1,clean:rh},employeeEmail:{...uh,required:!1,clean:rh},onFinish:{...mh,example:JSON.stringify([{actionName:`markAsExported`,label:`Expensify Export`},{actionName:`email`,recipients:`manager@domain.com,finances@domain.com`,message:`Report is ready.`}],null,2)},templateName:ig},fg={connectionInput:ch,type:{...lh,default:Rm.REPORT_STATUS,comments:`Specifies to the job that it has to update the status of a list of reports.`},status:qh,filters:Qh},pg={connection:ch,showNewRecords:(0,$.input)({label:`Show New Records`,type:`boolean`,required:!0,default:`true`,comments:`When true, newly created records are included in trigger results.`,clean:$.util.types.toBool})},mg={type:`object`,properties:{responseCode:{type:`number`},responseMessage:{type:`string`}},required:[`responseCode`]},hg={type:`object`,properties:{reason:{type:`string`},reportID:{type:`string`}}},gg={type:`object`,additionalProperties:{type:`array`,items:{type:`string`,format:`email`}}},_g={type:`object`,properties:{...mg.properties,domainCardList:{type:`array`,items:{type:`object`,properties:{bank:{type:`string`},cardID:{type:`number`},cardName:{type:`string`},cardNumber:{type:`string`},created:{type:`string`},email:{type:`string`},externalEmployeeID:{type:`string`},lastImport:{type:`string`},lastImportResult:{type:`number`},reimbursable:{type:`boolean`},scrapeMinDate:{type:`string`}}}}},required:[`responseCode`]},vg={type:`object`,properties:{...mg.properties,"dry-run":{type:`boolean`},updatedEmployeesCount:{type:`number`},diff:{type:`object`,properties:{diffToAdd:gg,diffToRemove:gg}},securityGroupEmployeesMap:gg,skippedEmployees:{type:`array`,items:{type:`object`,properties:{email:{type:`string`},reason:{type:`string`}}}}},required:[`responseCode`]},yg={type:`object`,properties:{...mg.properties,transactionList:{type:`array`,items:{type:`object`,properties:{transactionID:{type:`string`},amount:{type:`number`},merchant:{type:`string`},created:{type:`string`},currency:{type:`string`}}}}},required:[`responseCode`]},bg={type:`object`,properties:{id:{type:`string`},name:{type:`string`},type:{type:`string`},role:{type:`string`},owner:{type:`string`,format:`email`},outputCurrency:{type:`string`}}},xg={type:`object`,properties:{categories:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},enabled:{type:`boolean`},areCommentsRequired:{type:`boolean`}}}},reportFields:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},type:{type:`string`},values:{type:`array`,items:{type:`string`}}}}},tags:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},enabled:{type:`boolean`},glCode:{type:`string`},tags:{type:`array`}}}},tax:{type:`object`,properties:{name:{type:`string`},default:{type:`string`},rates:{type:`array`,items:{type:`object`,properties:{rateID:{type:`string`},name:{type:`string`},rate:{type:`number`}}}}}},employees:{type:`array`,items:{type:`object`,properties:{email:{type:`string`,format:`email`},role:{type:`string`},submitsTo:{type:`string`,format:`email`},employeeID:{type:`string`}},additionalProperties:!0}}},required:[],additionalProperties:!0},Sg={type:`object`,properties:{...mg.properties,policyList:{type:`array`,items:bg}},required:[`responseCode`]},Cg={type:`object`,properties:{...mg.properties,policyInfo:{type:`object`,additionalProperties:xg}},required:[`responseCode`]},wg={type:`object`,properties:{...mg.properties,policyID:{type:`string`},policyName:{type:`string`}},required:[`responseCode`]},Tg={type:`object`,properties:{...mg.properties},required:[`responseCode`]},Eg={type:`object`,properties:{...mg.properties,reportID:{type:`string`},reportName:{type:`string`}},required:[`responseCode`]},Dg={type:`object`,properties:{...mg.properties,reportIDs:{type:`array`,items:{type:`string`}},skippedReports:{type:`array`,items:hg},failedReports:{type:`array`,items:hg}},required:[`responseCode`]},Og={type:[`string`,`object`],properties:{...mg.properties},required:[`responseCode`]};var kg={listCards:(0,$.action)({display:{description:`Gets the list of credit cards that are assigned at the domain level.`,label:`List Cards`},inputs:hh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:_g}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,domain:r})=>{let i=Um(t,e.debug.enabled),a=sh({inputSettings:{type:n,domain:r}},t),{data:o}=await i.post(``,a);return{data:o}},examplePerform:async()=>Wm,examplePayload:Wm})},Ag={updateEmployee:(0,$.action)({display:{description:`Add, update or remove policy members.`,label:`Update Employee`},inputs:Ch,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:vg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,provisioningOptions:r,onFinish:i,employees:a})=>{let o=Um(t,e.debug.enabled),s=sh({type:Lm.UPDATE,inputSettings:{type:n,entity:Bm.ENTITY},dataSource:Bm.DATA_SOURCE,"dry-run":r.dryRun,onFinish:i,setEmployeePrimaryPolicy:r.setEmployeePrimaryPolicy,shouldFixApprovalChains:r.shouldFixApprovalChains,employees:a},t),{data:c}=await o.post(``,s);return{data:c}},examplePerform:async()=>qm,examplePayload:qm})},jg={createExpenseRule:(0,$.action)({display:{description:`Create expense rules for a given employee on a given policy.`,label:`Create Expense Rule`},inputs:Eh,performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,employeeEmail:r,actions:i,policyId:a})=>{let o=Um(t,e.debug.enabled),s=sh({type:Lm.CREATE,inputSettings:{type:n,employeeEmail:r,actions:i,policyID:a}},t),{data:c}=await o.post(``,s);return{data:c}}}),updateExpenseRule:(0,$.action)({display:{description:`Update a preexisting expense rule for a given employee on a given policy.`,label:`Update Expense Rules`},inputs:Dh,performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,employeeEmail:r,actions:i,policyId:a,ruleId:o})=>{let s=Um(t,e.debug.enabled),c=sh({type:Lm.UPDATE,inputSettings:{type:n,employeeEmail:r,actions:i,policyID:a,ruleID:o}},t),{data:l}=await s.post(``,c);return{data:l}}})},Mg={createExpense:(0,$.action)({display:{description:`Create expenses in a user’s account.`,label:`Create Expense`},inputs:kh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:yg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,employeeEmail:r,transactionList:i})=>{let a=Um(t,e.debug.enabled),o=sh({type:Lm.CREATE,inputSettings:{type:n,employeeEmail:r,transactionList:i}},t),{data:s}=await a.post(``,o);return{data:s}},examplePerform:async()=>Jm,examplePayload:Jm})},Ng={rawRequest:(0,$.action)({display:{label:`Raw Request`,description:`Send a raw HTTP request to the Expensify API.`},inputs:Mh,performSafety:`notAllowed`,perform:async(e,{connectionInput:t,...n})=>{Vm(t);let{data:r}=n,i=sh(typeof r==`string`?r.trim()?JSON.parse(r):{}:r??{},t),{data:a}=await(0,Nm.sendRawRequest)(Im,{...n,data:i,debugRequest:e.debug.enabled},{Accept:`application/json`});return{data:a}}})};const Pg=(0,$.action)({display:{description:`Creates a policy.`,label:`Create Policy`},inputs:Vh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:wg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,policyName:r,plan:i})=>{let a=Um(t,e.debug.enabled),o=sh({type:Lm.CREATE,inputSettings:{type:n,policyName:r,plan:i}},t),{data:s}=await a.post(``,o);return{data:s}},examplePerform:async()=>Zm,examplePayload:Zm});var Fg={getPolicy:(0,$.action)({display:{description:`Gets specific information about listed policies.`,label:`Get Policy`},inputs:Hh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Cg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,fields:n,policyIDList:r,type:i,userEmail:a})=>{let o=Um(t,e.debug.enabled),s=sh({inputSettings:{type:i,fields:n,policyIDList:r,userEmail:a}},t),{data:c}=await o.post(``,s);return{data:c}},examplePerform:async()=>Ym,examplePayload:Ym}),listPolicies:(0,$.action)({display:{description:`Gets a list of policies with some relevant information about them.`,label:`List Policies`},inputs:Uh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Sg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,adminOnly:n,type:r,userEmail:i})=>{let a=Um(t,e.debug.enabled),o=sh({inputSettings:{type:r,adminOnly:n,userEmail:i}},t),{data:s}=await a.post(``,o);return{data:s}},examplePerform:async()=>Xm,examplePayload:Xm}),createPolicy:Pg,updatePolicy:(0,$.action)({display:{description:`Manage categories, tags and report fields on a policy.`,label:`Update Policy`},inputs:Wh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Tg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,categories:r,policyIDList:i,policyId:a,reportFields:o,tags:s})=>{let c=Um(t,e.debug.enabled),l=sh({type:Lm.UPDATE,inputSettings:{type:n,policyID:a,policyIDList:i},categories:r,tags:s,reportFields:o},t),{data:u}=await c.post(``,l);return{data:u}},examplePerform:async()=>Qm,examplePayload:Qm})};const Ig=(0,$.action)({display:{description:`Creates a report, with transactions, in a user’s account.`,label:`Create Report`},inputs:cg,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Eg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,employeeEmail:r,expenses:i,policyId:a,report:o})=>{let s=Um(t,e.debug.enabled),c=sh({type:Lm.CREATE,inputSettings:{type:n,employeeEmail:r,expenses:i,policyID:a,report:o}},t),{data:l}=await s.post(``,c);return{data:l}},examplePerform:async()=>$m,examplePayload:$m}),Lg=(0,$.action)({display:{description:`Download reports that were generated with the Report Exporter job.`,label:`Download Report`},inputs:lg,performSafety:`safe`,perform:async(e,{connectionInput:t,fileName:n,fileSystem:r})=>{let i=Um(t,e.debug.enabled),a=sh({type:Lm.DOWNLOAD,fileName:n,fileSystem:r},t),{data:o}=await i.post(``,a);return{data:o}}}),Rg=(0,$.action)({display:{description:`Export expense or report data in a configurable format for analysis or insertion into an accounting package.`,label:`Export Report`},inputs:dg,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Og}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,status:n,employeeEmail:r,fileExtension:i,additionalFields:a,onFinish:o,templateName:s,approvedAfter:c,endDate:l,markAsExportedFilter:u,policyIDList:d,reportIdList:f,startDate:p})=>{let m=Um(t,e.debug.enabled),h=sh({type:Lm.FILE,onReceive:{immediateResponse:[`returnRandomFileName`]},inputSettings:{type:Rm.COMBINED_REPORT_DATA,filters:{startDate:p,endDate:l,approvedAfter:c,markAsExportedFilter:u,policyIDList:d?.join(`,`),reportIDList:f?.join(`,`)},reportState:n,limit:a.limit,employeeEmail:r},outputSettings:{fileExtension:i,fileBasename:a.fileBasename,includeFullPageReceiptsPdf:a.includeFullPageReceiptsPdf},test:a.test,onFinish:o},t);h.append(zm.TEMPLATE,s);let{data:g}=await m.post(``,h);return{data:g}},examplePerform:async()=>th,examplePayload:th});var zg={createReport:Ig,updateReportStatus:(0,$.action)({display:{description:`Update the status of a report.`,label:`Update Report Status`},inputs:fg,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Dg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,filters:r,status:i})=>{let a=Um(t,e.debug.enabled),o=sh({type:Lm.UPDATE,inputSettings:{type:n,filters:r,status:i}},t),{data:s}=await a.post(``,o);return{data:s}},examplePerform:async()=>eh,examplePayload:eh}),downloadReport:Lg,exportReport:Rg},Bg={...jg,...Fg,...zg,...Mg,...kg,...Ag,...Ng};const Vg=(0,$.dataSource)({display:{label:`List Cards`,description:`Returns all Cards.`},inputs:gh,perform:async(e,{connectionInput:t,domain:n,type:r})=>{let i=Um(t,!1),a=sh({inputSettings:{type:r,domain:n}},t),{data:o}=await i.post(``,a);if(o?.domainCardList?.length>0){let{domainCardList:e}=o;return{result:e.map(({cardName:e,cardID:t})=>({label:e,key:t}))}}return{result:[]}},dataSourceType:`picklist`,examplePayload:Km});var Hg={listPolicies:(0,$.dataSource)({display:{label:`List Policies`,description:`Returns all Policies.`},inputs:_h,perform:async(e,{connectionInput:t,type:n})=>{let r=Um(t,!1),i=sh({inputSettings:{type:n,adminOnly:!1}},t),{data:a}=await r.post(``,i);if(a?.policyList?.length>0){let{policyList:e}=a;return{result:e.map(({name:e,id:t})=>({label:e,key:t}))}}return{result:[]}},dataSourceType:`picklist`,examplePayload:Gm}),listCards:Vg},Ug={pollChangesTrigger:(0,$.pollingTrigger)({display:{label:`New Policies`,description:`Checks for new policies in Expensify on a configured schedule.`},inputs:pg,perform:async(e,t,{connection:n,showNewRecords:r})=>{let i=Um(n,e.debug.enabled),a=sh({inputSettings:{type:Rm.POLICY_LIST}},n),{data:o}=await i.post(``,a),s=o.policyList??[],c=e.polling.getState(),l=s.map(e=>e.id);if(c?.knownIds===void 0)return e.polling.setState({knownIds:l}),{payload:{...t,body:{data:{created:[],updated:[]}}},polledNoChanges:!0};let u=new Set(c.knownIds),d=s.filter(e=>!u.has(e.id));e.polling.setState({knownIds:l});let f=r?d:[];return e.debug.enabled&&e.logger.debug(`Polled policies: ${s.length} total, ${f.length} new`),{payload:{...t,body:{data:{created:f,updated:[]}}},polledNoChanges:f.length===0}},examplePayload:nh})},Wg=(0,$.component)({key:`Expensify`,public:!0,documentationUrl:`https://prismatic.io/docs/components/Expensify/`,display:{label:`Expensify`,description:`Expensify provides an industry leading expense management system. Use the Expensify component to programmatically download expense report data for analysis or insertion into an accounting package, provision accounts for new hires, and much more.`,iconPath:`icon.png`,category:`Application Connectors`},actions:Bg,triggers:Ug,connections:Fm,dataSources:Hg,hooks:{error:Nm.handleErrors}});exports.default=Wg;
244
+ </#list>`}),ag=(0,$.input)({label:`Approved After`,type:`string`,required:!1,comments:`Filters out all reports approved before, or on, the given date. Only applies to reports that have been approved. yyyy-mm-dd formatted date.`,placeholder:`Enter approval date (yyyy-mm-dd)`,example:`2016-01-01`,clean:rh}),og=(0,$.input)({label:`Mark as Exported Label Filter`,type:`string`,required:!1,comments:`Filters out reports that have already been exported with this label.`,placeholder:`Enter export label`,example:`Expensify Export`,clean:rh}),sg=(0,$.input)({label:`Report ID List`,type:`string`,collection:`valuelist`,required:!1,comments:`The IDs of the reports to get information for.`,placeholder:`Enter report ID`,example:`R006AseGxMka`,clean:ah}),cg={connectionInput:ch,type:{...lh,default:Rm.REPORT,comments:`Specifies to the job that it has to create a report.`},employeeEmail:uh,report:Zh,expenses:Xh,policyId:dh},lg={connectionInput:ch,fileName:Gh,fileSystem:Kh},ug=(0,$.structuredObjectInput)({label:`Additional Fields`,required:!1,comments:`Additional optional fields: includes File Basename, Include Full Page Receipts PDF, Limit, and Test.`,inputs:{fileBasename:ng,includeFullPageReceiptsPdf:rg,limit:Jh,test:Yh}}),dg={connectionInput:ch,fileExtension:tg,startDate:{...$h,required:!1,clean:rh},endDate:{...eg,required:!1},approvedAfter:ag,markAsExportedFilter:og,policyIDList:{...ph,required:!1},reportIdList:sg,additionalFields:ug,status:{...qh,label:`Report State`,comments:`The report state to filter on. Only reports in this state are exported.`,required:!1,clean:rh},employeeEmail:{...uh,required:!1,clean:rh},onFinish:{...mh,example:JSON.stringify([{actionName:`markAsExported`,label:`Expensify Export`},{actionName:`email`,recipients:`manager@domain.com,finances@domain.com`,message:`Report is ready.`}],null,2)},templateName:ig},fg={connectionInput:ch,type:{...lh,default:Rm.REPORT_STATUS,comments:`Specifies to the job that it has to update the status of a list of reports.`},status:qh,filters:Qh},pg={connection:ch,showNewRecords:(0,$.input)({label:`Show New Records`,type:`boolean`,required:!0,default:`true`,comments:`When true, newly created records are included in trigger results.`,clean:$.util.types.toBool})},mg={type:`object`,properties:{responseCode:{type:`number`},responseMessage:{type:`string`}},required:[`responseCode`]},hg={type:`object`,properties:{reason:{type:`string`},reportID:{type:`string`}}},gg={type:`object`,additionalProperties:{type:`array`,items:{type:`string`,format:`email`}}},_g={type:`object`,properties:{...mg.properties,domainCardList:{type:`array`,items:{type:`object`,properties:{bank:{type:`string`},cardID:{type:`number`},cardName:{type:`string`},cardNumber:{type:`string`},created:{type:`string`},email:{type:`string`},externalEmployeeID:{type:`string`},lastImport:{type:`string`},lastImportResult:{type:`number`},reimbursable:{type:`boolean`},scrapeMinDate:{type:`string`}}}}},required:[`responseCode`]},vg={type:`object`,properties:{...mg.properties,"dry-run":{type:`boolean`},updatedEmployeesCount:{type:`number`},diff:{type:`object`,properties:{diffToAdd:gg,diffToRemove:gg}},securityGroupEmployeesMap:gg,skippedEmployees:{type:`array`,items:{type:`object`,properties:{email:{type:`string`},reason:{type:`string`}}}}},required:[`responseCode`]},yg={type:`object`,properties:{...mg.properties,transactionList:{type:`array`,items:{type:`object`,properties:{transactionID:{type:`string`},amount:{type:`number`},merchant:{type:`string`},created:{type:`string`},currency:{type:`string`}}}}},required:[`responseCode`]},bg={type:`object`,properties:{id:{type:`string`},name:{type:`string`},type:{type:`string`},role:{type:`string`},owner:{type:`string`,format:`email`},outputCurrency:{type:`string`}}},xg={type:`object`,properties:{categories:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},enabled:{type:`boolean`},areCommentsRequired:{type:`boolean`}}}},reportFields:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},type:{type:`string`},values:{type:`array`,items:{type:`string`}}}}},tags:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},enabled:{type:`boolean`},glCode:{type:`string`},tags:{type:`array`}}}},tax:{type:`object`,properties:{name:{type:`string`},default:{type:`string`},rates:{type:`array`,items:{type:`object`,properties:{rateID:{type:`string`},name:{type:`string`},rate:{type:`number`}}}}}},employees:{type:`array`,items:{type:`object`,properties:{email:{type:`string`,format:`email`},role:{type:`string`},submitsTo:{type:`string`,format:`email`},employeeID:{type:`string`}},additionalProperties:!0}}},required:[],additionalProperties:!0},Sg={type:`object`,properties:{...mg.properties,policyList:{type:`array`,items:bg}},required:[`responseCode`]},Cg={type:`object`,properties:{...mg.properties,policyInfo:{type:`object`,additionalProperties:xg}},required:[`responseCode`]},wg={type:`object`,properties:{...mg.properties,policyID:{type:`string`},policyName:{type:`string`}},required:[`responseCode`]},Tg={type:`object`,properties:{...mg.properties},required:[`responseCode`]},Eg={type:`object`,properties:{...mg.properties,reportID:{type:`string`},reportName:{type:`string`}},required:[`responseCode`]},Dg={type:`object`,properties:{...mg.properties,reportIDs:{type:`array`,items:{type:`string`}},skippedReports:{type:`array`,items:hg},failedReports:{type:`array`,items:hg}},required:[`responseCode`]},Og={type:[`string`,`object`],properties:{...mg.properties},required:[`responseCode`]};var kg={listCards:(0,$.action)({display:{description:`Gets the list of credit cards that are assigned at the domain level.`,label:`List Cards`},inputs:hh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:_g}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,domain:r})=>{let i=Um(t,e.debug.enabled),a=sh({inputSettings:{type:n,domain:r}},t),{data:o}=await i.post(``,a);return{data:o}},examplePerform:async()=>Wm,examplePayload:Wm})},Ag={updateEmployee:(0,$.action)({display:{description:`Add, update or remove policy members.`,label:`Update Employee`},inputs:Ch,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:vg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,provisioningOptions:r,onFinish:i,employees:a})=>{let o=Um(t,e.debug.enabled),s=sh({type:Lm.UPDATE,inputSettings:{type:n,entity:Bm.ENTITY},dataSource:Bm.DATA_SOURCE,"dry-run":r.dryRun,onFinish:i,setEmployeePrimaryPolicy:r.setEmployeePrimaryPolicy,shouldFixApprovalChains:r.shouldFixApprovalChains,employees:a},t),{data:c}=await o.post(``,s);return{data:c}},examplePerform:async()=>qm,examplePayload:qm})},jg={createExpenseRule:(0,$.action)({display:{description:`Create expense rules for a given employee on a given policy.`,label:`Create Expense Rule`},inputs:Eh,performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,employeeEmail:r,actions:i,policyId:a})=>{let o=Um(t,e.debug.enabled),s=sh({type:Lm.CREATE,inputSettings:{type:n,employeeEmail:r,actions:i,policyID:a}},t),{data:c}=await o.post(``,s);return{data:c}}}),updateExpenseRule:(0,$.action)({display:{description:`Update a preexisting expense rule for a given employee on a given policy.`,label:`Update Expense Rules`},inputs:Dh,performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,employeeEmail:r,actions:i,policyId:a,ruleId:o})=>{let s=Um(t,e.debug.enabled),c=sh({type:Lm.UPDATE,inputSettings:{type:n,employeeEmail:r,actions:i,policyID:a,ruleID:o}},t),{data:l}=await s.post(``,c);return{data:l}}})},Mg={createExpense:(0,$.action)({display:{description:`Create expenses in a user’s account.`,label:`Create Expense`},inputs:kh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:yg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,employeeEmail:r,transactionList:i})=>{let a=Um(t,e.debug.enabled),o=sh({type:Lm.CREATE,inputSettings:{type:n,employeeEmail:r,transactionList:i}},t),{data:s}=await a.post(``,o);return{data:s}},examplePerform:async()=>Jm,examplePayload:Jm})},Ng={rawRequest:(0,$.action)({display:{label:`Raw Request`,description:`Send a raw HTTP request to the Expensify API.`},inputs:Mh,performSafety:`notAllowed`,perform:async(e,{connectionInput:t,...n})=>{Vm(t);let{data:r}=n,i=sh(typeof r==`string`?r.trim()?JSON.parse(r):{}:r??{},t),{data:a}=await(0,Nm.sendRawRequest)(Im,{...n,data:i,debugRequest:e.debug.enabled},{Accept:`application/json`});return{data:a}}})};const Pg=(0,$.action)({display:{description:`Creates a policy.`,label:`Create Policy`},inputs:Vh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:wg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,policyName:r,plan:i})=>{let a=Um(t,e.debug.enabled),o=sh({type:Lm.CREATE,inputSettings:{type:n,policyName:r,plan:i}},t),{data:s}=await a.post(``,o);return{data:s}},examplePerform:async()=>Zm,examplePayload:Zm});var Fg={getPolicy:(0,$.action)({display:{description:`Gets specific information about listed policies.`,label:`Get Policy`},inputs:Hh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Cg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,fields:n,policyIDList:r,type:i,userEmail:a})=>{let o=Um(t,e.debug.enabled),s=sh({inputSettings:{type:i,fields:n,policyIDList:r,userEmail:a}},t),{data:c}=await o.post(``,s);return{data:c}},examplePerform:async()=>Ym,examplePayload:Ym}),listPolicies:(0,$.action)({display:{description:`Gets a list of policies with some relevant information about them.`,label:`List Policies`},inputs:Uh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Sg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,adminOnly:n,type:r,userEmail:i})=>{let a=Um(t,e.debug.enabled),o=sh({inputSettings:{type:r,adminOnly:n,userEmail:i}},t),{data:s}=await a.post(``,o);return{data:s}},examplePerform:async()=>Xm,examplePayload:Xm}),createPolicy:Pg,updatePolicy:(0,$.action)({display:{description:`Manage categories, tags and report fields on a policy.`,label:`Update Policy`},inputs:Wh,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Tg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,categories:r,policyIDList:i,policyId:a,reportFields:o,tags:s})=>{let c=Um(t,e.debug.enabled),l=sh({type:Lm.UPDATE,inputSettings:{type:n,policyID:a,policyIDList:i},categories:r,tags:s,reportFields:o},t),{data:u}=await c.post(``,l);return{data:u}},examplePerform:async()=>Qm,examplePayload:Qm})};const Ig=(0,$.action)({display:{description:`Creates a report, with transactions, in a user’s account.`,label:`Create Report`},inputs:cg,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Eg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,employeeEmail:r,expenses:i,policyId:a,report:o})=>{let s=Um(t,e.debug.enabled),c=sh({type:Lm.CREATE,inputSettings:{type:n,employeeEmail:r,expenses:i,policyID:a,report:o}},t),{data:l}=await s.post(``,c);return{data:l}},examplePerform:async()=>$m,examplePayload:$m}),Lg=(0,$.action)({display:{description:`Download reports that were generated with the Report Exporter job.`,label:`Download Report`},inputs:lg,performSafety:`safe`,perform:async(e,{connectionInput:t,fileName:n,fileSystem:r})=>{let i=Um(t,e.debug.enabled),a=sh({type:Lm.DOWNLOAD,fileName:n,fileSystem:r},t),{data:o}=await i.post(``,a);return{data:o}}}),Rg=(0,$.action)({display:{description:`Export expense or report data in a configurable format for analysis or insertion into an accounting package.`,label:`Export Report`},inputs:dg,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Og}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,status:n,employeeEmail:r,fileExtension:i,additionalFields:a,onFinish:o,templateName:s,approvedAfter:c,endDate:l,markAsExportedFilter:u,policyIDList:d,reportIdList:f,startDate:p})=>{let m=Um(t,e.debug.enabled),h=sh({type:Lm.FILE,onReceive:{immediateResponse:[`returnRandomFileName`]},inputSettings:{type:Rm.COMBINED_REPORT_DATA,filters:{startDate:p,endDate:l,approvedAfter:c,markAsExportedFilter:u,policyIDList:d?.join(`,`),reportIDList:f?.join(`,`)},reportState:n,limit:a.limit,employeeEmail:r},outputSettings:{fileExtension:i,fileBasename:a.fileBasename,includeFullPageReceiptsPdf:a.includeFullPageReceiptsPdf},test:a.test,onFinish:o},t);h.append(zm.TEMPLATE,s);let{data:g}=await m.post(``,h);return{data:g}},examplePerform:async()=>th,examplePayload:th});var zg={createReport:Ig,updateReportStatus:(0,$.action)({display:{description:`Update the status of a report.`,label:`Update Report Status`},inputs:fg,outputSchema:(0,$.outputSchema)({type:`actionOutput`,schema:Dg}),performSafety:`notAllowed`,perform:async(e,{connectionInput:t,type:n,filters:r,status:i})=>{let a=Um(t,e.debug.enabled),o=sh({type:Lm.UPDATE,inputSettings:{type:n,filters:r,status:i}},t),{data:s}=await a.post(``,o);return{data:s}},examplePerform:async()=>eh,examplePayload:eh}),downloadReport:Lg,exportReport:Rg},Bg={...jg,...Fg,...zg,...Mg,...kg,...Ag,...Ng};const Vg=(0,$.dataSource)({display:{label:`List Cards`,description:`Returns all Cards.`},inputs:gh,perform:async(e,{connectionInput:t,domain:n,type:r})=>{let i=Um(t,!1),a=sh({inputSettings:{type:r,domain:n}},t),{data:o}=await i.post(``,a);if(o?.domainCardList?.length>0){let{domainCardList:e}=o;return{result:e.map(({cardName:e,cardID:t})=>({label:e,key:t}))}}return{result:[]}},dataSourceType:`picklist`,examplePayload:Km});var Hg={listPolicies:(0,$.dataSource)({display:{label:`List Policies`,description:`Returns all Policies.`},inputs:_h,perform:async(e,{connectionInput:t,type:n})=>{let r=Um(t,!1),i=sh({inputSettings:{type:n,adminOnly:!1}},t),{data:a}=await r.post(``,i);if(a?.policyList?.length>0){let{policyList:e}=a;return{result:e.map(({name:e,id:t})=>({label:e,key:t}))}}return{result:[]}},dataSourceType:`picklist`,examplePayload:Gm}),listCards:Vg},Ug={pollChangesTrigger:(0,$.pollingTrigger)({display:{label:`New Policies`,description:`Checks for new policies in Expensify on a configured schedule.`},inputs:pg,perform:async(e,t,{connection:n,showNewRecords:r})=>{let i=Um(n,e.debug.enabled),a=sh({inputSettings:{type:Rm.POLICY_LIST}},n),{data:o}=await i.post(``,a),s=o.policyList??[],c=e.polling.getState(),l=s.map(e=>e.id);if(c?.knownIds===void 0)return e.polling.setState({knownIds:l}),{payload:{...t,body:{data:{created:[],updated:[]}}},polledNoChanges:!0};let u=new Set(c.knownIds),d=s.filter(e=>!u.has(e.id));e.polling.setState({knownIds:l});let f=r?d:[];return e.debug.enabled&&e.logger.debug(`Polled policies: ${s.length} total, ${f.length} new`),{payload:{...t,body:{data:{created:f,updated:[]}}},polledNoChanges:f.length===0}},examplePayload:nh})},Wg=(0,$.component)({key:`Expensify`,public:!0,documentationUrl:`https://prismatic.io/docs/components/Expensify/`,display:{label:`Expensify`,description:`Manage Expensify reports, expenses, policies, expense rules, and employees, and export report data.`,iconPath:`icon.png`,category:`Application Connectors`},actions:Bg,triggers:Ug,connections:Fm,dataSources:Hg,hooks:{error:Nm.handleErrors}});exports.default=Wg;
@@ -2062,7 +2062,7 @@ var src_default = (0, _prismatic_io_spectral.component)({
2062
2062
  documentationUrl: "https://prismatic.io/docs/components/Expensify/",
2063
2063
  display: {
2064
2064
  label: "Expensify",
2065
- description: "Expensify provides an industry leading expense management system. Use the Expensify component to programmatically download expense report data for analysis or insertion into an accounting package, provision accounts for new hires, and much more.",
2065
+ description: "Manage Expensify reports, expenses, policies, expense rules, and employees, and export report data.",
2066
2066
  iconPath: "icon.png",
2067
2067
  category: "Application Connectors"
2068
2068
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/components-expensify",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "main": "./npm-dist/index.cjs",
5
5
  "types": "./npm-dist/index.d.cts",
6
6
  "exports": {