Skip to content

Commit

Permalink
Merge pull request #69 from accruteam/feature/ACR-1530-latest-acct-pr…
Browse files Browse the repository at this point in the history
…ovider-overdue-and-status

feature/ACR-1530-latest-acct-provider-overdue-and-status
  • Loading branch information
aaronkplatt authored Oct 17, 2024
2 parents 56012d1 + 1f659e7 commit e7e7736
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 49 deletions.
5 changes: 0 additions & 5 deletions .changeset/eleven-bottles-attack.md

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# accru-client

## 0.0.50

### Patch Changes

- 5082fff: add subscriptions

## 0.0.49

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Accru Co.",
"description": "Client SDK for Accru API",
"license": "MIT",
"version": "0.0.49",
"version": "0.0.50",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"repository": {
Expand Down
24 changes: 12 additions & 12 deletions src/api/gql/gql.ts

Large diffs are not rendered by default.

77 changes: 55 additions & 22 deletions src/api/gql/graphql.ts

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions src/api/gql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ type Mutation {
adminClearCache: DateTime!
adminOrganizationAcctProviderSynchronize(acct_provider: ACCT_PROVIDER!, force_pull: Boolean, organization_id: String!, pull: Boolean!, push: Boolean!): DateTime!
adminOrganizationAcctProviderSynchronizeAll(acct_provider: ACCT_PROVIDER, force_pull: Boolean, pull: Boolean!, push: Boolean!): Int!
adminOrganizationArchive(organization_id: String!): Organization!
adminOrganizationBillProcess(organization_bill_id: String, organization_id: String!): Int!
adminOrganizationBillTransactionProcess(organization_bill_transaction_id: String, organization_id: String!): Int!
adminOrganizationCouponCreate(data: OrganizationCouponCreateSchema!): OrganizationCoupon!
Expand Down Expand Up @@ -856,6 +857,7 @@ type OrganizationBill {
is_overdue: Boolean
last_sync_at: DateTime
latest_acct_provider_balance: BigInt
latest_acct_provider_status: BILL_STATUS
number: String!
organization: Organization!
organization_acct_provider_conn_bills: [OrganizationAcctProviderConnBill!]!
Expand Down Expand Up @@ -1074,7 +1076,7 @@ type OrganizationCustomer {
email: String!
has_sync_errors: Boolean
id: ID!
invoice_summary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, customer_name: String, due_end_date: DateTime, due_start_date: DateTime, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: INVOICE_STATUS, take: Int): OrganizationInvoiceSummary!
invoice_summary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, customer_name: String, due_end_date: DateTime, due_start_date: DateTime, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, latest_acct_provider_is_overdue: Boolean, latest_acct_provider_status: INVOICE_STATUS, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: INVOICE_STATUS, take: Int): OrganizationInvoiceSummary!
is_active: Boolean!
language: String
last_sync_at: DateTime
Expand Down Expand Up @@ -1203,6 +1205,7 @@ type OrganizationCustomerStatementInvoiceLineData {
id: ID!
invoice_date: DateTime!
latest_acct_provider_balance: BigInt
latest_acct_provider_status: INVOICE_STATUS
number: String!
organization_acct_provider_conn_invoices: [OrganizationAcctProviderConnInvoice!]!
organization_customer_id: String!
Expand Down Expand Up @@ -1341,6 +1344,7 @@ type OrganizationInvoice {
is_overdue: Boolean
last_sync_at: DateTime
latest_acct_provider_balance: BigInt
latest_acct_provider_status: INVOICE_STATUS
number: String!
organization: Organization!
organization_acct_provider_conn_invoices: [OrganizationAcctProviderConnInvoice!]!
Expand Down Expand Up @@ -1883,7 +1887,7 @@ type OrganizationVendor {
address_state: String
address_zip_code: String
balance: BigInt
bill_summary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, due_end_date: DateTime, due_start_date: DateTime, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: BILL_STATUS, take: Int): OrganizationBillSummary!
bill_summary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, due_end_date: DateTime, due_start_date: DateTime, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, latest_acct_provider_is_overdue: Boolean, latest_acct_provider_status: BILL_STATUS, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: BILL_STATUS, take: Int): OrganizationBillSummary!
conn_locked_data_at: DateTime
connection: OrganizationConnection
contacts: [OrganizationVendorContact!]!
Expand Down Expand Up @@ -1993,15 +1997,15 @@ type Query {
adminUsers(after: ConnectionCursor, before: ConnectionCursor, email: String, first: Int, first_name: String, id: String, include_archived: Boolean, last: Int, last_name: String, phone_number: String, skip: Int, sorting: [SortingFieldSchema!], take: Int): UserPaginationConnection!
session: Session!
unauthorizedUserOrganizationUserInvite(code: String!, email: String!, organization_id: String!, organization_invite_id: String!): UnauthorizedUserOrganizationUserInviteResponse!
unconnectedCustomerOrganizationInvoiceSummary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, customer_name: String, due_end_date: DateTime, due_start_date: DateTime, email: String!, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, organization_id: String, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: INVOICE_STATUS, take: Int, token: String!, unique_code: String!): OrganizationInvoiceSummary!
unconnectedCustomerOrganizationInvoiceSummary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, customer_name: String, due_end_date: DateTime, due_start_date: DateTime, email: String!, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, latest_acct_provider_is_overdue: Boolean, latest_acct_provider_status: INVOICE_STATUS, organization_id: String, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: INVOICE_STATUS, take: Int, token: String!, unique_code: String!): OrganizationInvoiceSummary!
unconnectedCustomerOrganizationProject(email: String!, organization_id: String, organization_project_id: String!, token: String!, unique_code: String!): OrganizationProject!
unconnectedCustomerOrganizationProjects(after: ConnectionCursor, before: ConnectionCursor, canceled: Boolean, completed: Boolean, email: String!, ended: Boolean, first: Int, last: Int, name: String, organization_id: String, skip: Int, sorting: [SortingFieldSchema!], started: Boolean, take: Int, token: String!, unique_code: String!): OrganizationProjectPaginationConnection!
unconnectedCustomerOrganizationStatement(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, due_end_date: DateTime, due_start_date: DateTime, email: String!, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, organization_id: String, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, take: Int, token: String!, type: STATEMENT_LINE_TYPE, unique_code: String!): OrganizationCustomerStatement!
unconnectedCustomerOrganizationStatementLine(email: String!, organization_customer_statement_line_id: Int, organization_id: String, organization_invoice_id: String, organization_invoice_transaction_id: String, token: String!, unique_code: String!): OrganizationCustomerStatementLineData!
user: User!
userCustomerOrganization(organization_id: String!, organization_vendor_id: String!): OrganizationConnection!
userCustomerOrganizationInvoice(organization_id: String!, organization_invoice_id: String!, organization_vendor_id: String!): OrganizationInvoice!
userCustomerOrganizationInvoiceSummary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, customer_name: String, due_end_date: DateTime, due_start_date: DateTime, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, organization_id: String!, organization_vendor_id: String!, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: INVOICE_STATUS, take: Int): OrganizationInvoiceSummary!
userCustomerOrganizationInvoiceSummary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, customer_name: String, due_end_date: DateTime, due_start_date: DateTime, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, latest_acct_provider_is_overdue: Boolean, latest_acct_provider_status: INVOICE_STATUS, organization_id: String!, organization_vendor_id: String!, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: INVOICE_STATUS, take: Int): OrganizationInvoiceSummary!
userCustomerOrganizationInvoices(after: ConnectionCursor, before: ConnectionCursor, first: Int, last: Int, organization_id: String!, organization_vendor_id: String!, skip: Int, sorting: [SortingFieldSchema!], take: Int): OrganizationInvoicePaginationConnection!
userCustomerOrganizationProject(organization_id: String!, organization_project_id: String!, organization_vendor_id: String!): OrganizationProject!
userCustomerOrganizationProjects(after: ConnectionCursor, before: ConnectionCursor, canceled: Boolean, completed: Boolean, ended: Boolean, first: Int, last: Int, name: String, organization_id: String!, organization_vendor_id: String!, skip: Int, sorting: [SortingFieldSchema!], started: Boolean, take: Int): OrganizationProjectPaginationConnection!
Expand All @@ -2014,10 +2018,10 @@ type Query {
userOrganizationAcctProviderSynchronizations(after: ConnectionCursor, before: ConnectionCursor, failed: Boolean, finished: Boolean, first: Int, last: Int, organization_acct_provider_conn_id: String, organization_id: String!, skip: Int, sorting: [SortingFieldSchema!], succeeded: Boolean, take: Int): OrganizationAcctProviderConnSynchronizationPaginationConnection!
userOrganizationAcctProviders(after: ConnectionCursor, before: ConnectionCursor, first: Int, last: Int, organization_id: String!, skip: Int, sorting: [SortingFieldSchema!], take: Int): OrganizationAcctProviderConnPaginationConnection!
userOrganizationBill(organization_bill_id: String!, organization_id: String!): OrganizationBill!
userOrganizationBillSummary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, due_end_date: DateTime, due_start_date: DateTime, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, organization_id: String!, organization_vendor_id: String, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: BILL_STATUS, take: Int): OrganizationBillSummary!
userOrganizationBillSummary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, due_end_date: DateTime, due_start_date: DateTime, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, latest_acct_provider_is_overdue: Boolean, latest_acct_provider_status: BILL_STATUS, organization_id: String!, organization_vendor_id: String, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: BILL_STATUS, take: Int): OrganizationBillSummary!
userOrganizationBillTransaction(organization_bill_transaction_id: String!, organization_id: String!): OrganizationBillTransaction!
userOrganizationBillTransactions(after: ConnectionCursor, before: ConnectionCursor, first: Int, last: Int, organization_id: String!, organization_payment_method_id: String, organization_vendor_id: String, skip: Int, take: Int): [OrganizationBillTransaction!]!
userOrganizationBills(after: ConnectionCursor, before: ConnectionCursor, first: Int, is_overdue: Boolean, last: Int, number: String, organization_id: String!, organization_project_id: String, organization_vendor_id: String, skip: Int, sorting: [SortingFieldSchema!], status: BILL_STATUS, take: Int, unique_code: String): OrganizationBillPaginationConnection!
userOrganizationBills(after: ConnectionCursor, before: ConnectionCursor, first: Int, is_overdue: Boolean, last: Int, latest_acct_provider_is_overdue: Boolean, latest_acct_provider_status: BILL_STATUS, number: String, organization_id: String!, organization_project_id: String, organization_vendor_id: String, skip: Int, sorting: [SortingFieldSchema!], status: BILL_STATUS, take: Int, unique_code: String): OrganizationBillPaginationConnection!
userOrganizationCollaborator(organization_id: String!, organization_user_id: String!): OrganizationUser!
userOrganizationCollaborators(organization_id: String!): [OrganizationUser!]!
userOrganizationConnection(organization_connection_id: String!, organization_id: String!): OrganizationConnection!
Expand All @@ -2031,10 +2035,10 @@ type Query {
userOrganizationInviteCollaborator(organization_id: String!, organization_invite_id: String!): OrganizationInvite!
userOrganizationInviteCollaborators(accepted: Boolean, after: ConnectionCursor, before: ConnectionCursor, canceled: Boolean, expired: Boolean, first: Int, last: Int, organization_id: String!, rejected: Boolean, skip: Int, sorting: [SortingFieldSchema!], take: Int): OrganizationInvitePaginationConnection!
userOrganizationInvoice(organization_id: String!, organization_invoice_id: String!): OrganizationInvoice!
userOrganizationInvoiceSummary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, customer_name: String, due_end_date: DateTime, due_start_date: DateTime, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, organization_customer_id: String, organization_id: String!, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: INVOICE_STATUS, take: Int): OrganizationInvoiceSummary!
userOrganizationInvoiceSummary(after: ConnectionCursor, before: ConnectionCursor, currency: CURRENCY, customer_name: String, due_end_date: DateTime, due_start_date: DateTime, end_date: DateTime, first: Int, is_overdue: Boolean, last: Int, latest_acct_provider_is_overdue: Boolean, latest_acct_provider_status: INVOICE_STATUS, organization_customer_id: String, organization_id: String!, skip: Int, sorting: [SortingFieldSchema!], start_date: DateTime, status: INVOICE_STATUS, take: Int): OrganizationInvoiceSummary!
userOrganizationInvoiceTransaction(organization_id: String!, organization_invoice_transaction_id: String!): OrganizationInvoiceTransaction!
userOrganizationInvoiceTransactions(after: ConnectionCursor, before: ConnectionCursor, first: Int, last: Int, organization_customer_id: String, organization_id: String!, organization_receiving_method_id: String, skip: Int, take: Int): [OrganizationInvoiceTransaction!]!
userOrganizationInvoices(after: ConnectionCursor, before: ConnectionCursor, customer_name: String, first: Int, is_overdue: Boolean, last: Int, number: String, organization_customer_id: String, organization_id: String!, organization_project_id: String, skip: Int, sorting: [SortingFieldSchema!], status: INVOICE_STATUS, take: Int, unique_code: String): OrganizationInvoicePaginationConnection!
userOrganizationInvoices(after: ConnectionCursor, before: ConnectionCursor, customer_name: String, first: Int, is_overdue: Boolean, last: Int, latest_acct_provider_is_overdue: Boolean, latest_acct_provider_status: INVOICE_STATUS, number: String, organization_customer_id: String, organization_id: String!, organization_project_id: String, skip: Int, sorting: [SortingFieldSchema!], status: INVOICE_STATUS, take: Int, unique_code: String): OrganizationInvoicePaginationConnection!
userOrganizationPaymentMethod(organization_id: String!, organization_payment_method_id: String!): OrganizationPaymentMethod!
userOrganizationPaymentMethods(after: ConnectionCursor, before: ConnectionCursor, first: Int, last: Int, organization_id: String!, skip: Int, take: Int): [OrganizationPaymentMethod!]!
userOrganizationProject(organization_id: String!, organization_project_id: String!): OrganizationProject!
Expand Down
2 changes: 1 addition & 1 deletion src/api/gql/schema.graphql.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/services/bills/bills.queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const BILL_QUERY_FRAGMENT = gql(`
has_sync_errors
last_sync_at
latest_acct_provider_balance
latest_acct_provider_status
status
is_overdue
Expand Down Expand Up @@ -168,8 +169,13 @@ export const BILLS_GET_SUMMARY_QUERY = gql(`
$currency: CURRENCY
$startDate: DateTime
$endDate: DateTime
$status: BILL_STATUS
$isOverdue: Boolean
$latestAcctProviderStatus: BILL_STATUS
$latestAcctProviderIsOverdue: Boolean
$after: ConnectionCursor
$first: Int
$before: ConnectionCursor
Expand All @@ -185,9 +191,13 @@ export const BILLS_GET_SUMMARY_QUERY = gql(`
currency: $currency
start_date: $startDate
end_date: $endDate
status: $status
is_overdue: $isOverdue
latest_acct_provider_status: $latestAcctProviderStatus
latest_acct_provider_is_overdue: $latestAcctProviderIsOverdue
after: $after
first: $first
Expand Down
21 changes: 21 additions & 0 deletions src/services/invoices/invoices.queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const INVOICE_QUERY_FRAGMENT = gql(`
has_sync_errors
last_sync_at
latest_acct_provider_balance
latest_acct_provider_status
status
is_overdue
Expand Down Expand Up @@ -170,8 +171,13 @@ export const INVOICES_GET_SUMMARY_QUERY = gql(`
$currency: CURRENCY
$startDate: DateTime
$endDate: DateTime
$status: INVOICE_STATUS
$isOverdue: Boolean
$latestAcctProviderStatus: INVOICE_STATUS
$latestAcctProviderIsOverdue: Boolean
$customerName: String
$after: ConnectionCursor
$first: Int
Expand All @@ -188,8 +194,13 @@ export const INVOICES_GET_SUMMARY_QUERY = gql(`
currency: $currency
start_date: $startDate
end_date: $endDate
status: $status
is_overdue: $isOverdue
latest_acct_provider_status: $latestAcctProviderStatus
latest_acct_provider_is_overdue: $latestAcctProviderIsOverdue
customer_name: $customerName
after: $after
Expand Down Expand Up @@ -295,8 +306,13 @@ export const GET_AS_UNCONNECTED_CUSTOMER_INVOICE_SUMMARY_QUERY = gql(`
$currency: CURRENCY
$startDate: DateTime
$endDate: DateTime
$status: INVOICE_STATUS
$isOverdue: Boolean
$latestAcctProviderStatus: INVOICE_STATUS
$latestAcctProviderIsOverdue: Boolean
$customerName: String
$after: ConnectionCursor
$first: Int
Expand All @@ -314,8 +330,13 @@ export const GET_AS_UNCONNECTED_CUSTOMER_INVOICE_SUMMARY_QUERY = gql(`
currency: $currency
start_date: $startDate
end_date: $endDate
status: $status
is_overdue: $isOverdue
latest_acct_provider_status: $latestAcctProviderStatus
latest_acct_provider_is_overdue: $latestAcctProviderIsOverdue
customer_name: $customerName
after: $after
Expand Down
10 changes: 10 additions & 0 deletions src/services/statements/statements.queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,13 @@ export const GET_AS_CUSTOMER_INVOICE_SUMMARY_QUERY = gql(`
$currency: CURRENCY
$startDate: DateTime
$endDate: DateTime
$status: INVOICE_STATUS
$isOverdue: Boolean
$latestAcctProviderStatus: INVOICE_STATUS
$latestAcctProviderIsOverdue: Boolean
$customerName: String
$after: ConnectionCursor
$first: Int
Expand All @@ -373,8 +378,13 @@ export const GET_AS_CUSTOMER_INVOICE_SUMMARY_QUERY = gql(`
currency: $currency
start_date: $startDate
end_date: $endDate
status: $status
is_overdue: $isOverdue
latest_acct_provider_status: $latestAcctProviderStatus
latest_acct_provider_is_overdue: $latestAcctProviderIsOverdue
customer_name: $customerName
after: $after
Expand Down
19 changes: 19 additions & 0 deletions tests/instance.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { AccruClient } from "src";
import { describe, expect, it, vi } from "vitest";

describe("Instance test", () => {
it("should call getAuthToken on each request", async () => {
const getAuthToken = vi.fn(async () => "token");

const client = new AccruClient({
baseUrl: "http://localhost:3000",
getAuthToken,
})

await client.users.getCurrent().catch(() => null)
await client.users.getCurrent().catch(() => null)
await client.users.getCurrent().catch(() => null)

expect(getAuthToken).toHaveBeenCalledTimes(3)
})
})

0 comments on commit e7e7736

Please sign in to comment.