From 3bbc73b753329ff3b06aa3eb652c9b5835d80810 Mon Sep 17 00:00:00 2001 From: srikar-methodfi Date: Tue, 25 Aug 2026 16:25:52 -0400 Subject: [PATCH 1/3] remove this phantom report --- src/resources/Report/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/resources/Report/index.ts b/src/resources/Report/index.ts index f83ae8a..9a7da79 100644 --- a/src/resources/Report/index.ts +++ b/src/resources/Report/index.ts @@ -13,7 +13,6 @@ export const ReportTypes = { ach_pull_nightly: 'ach.pull.nightly', ach_reversals_nightly: 'ach.reversals.nightly', entities_created_previous_day: 'entities.created.previous_day', - ach_debit_daily: 'ach.debit.daily', reserve_fbo_balance_created_previous_day: 'reserve_fbo_balance.created.previous_day', } as const; From 49bf0fc49fce9bd7954c9335df13a94a4a5b1481 Mon Sep 17 00:00:00 2001 From: srikar-methodfi Date: Tue, 25 Aug 2026 17:23:28 -0400 Subject: [PATCH 2/3] fix report create type distinction --- src/resources/Report/index.ts | 22 +++++++++++++++++++++- test/resources/Report.tests.ts | 11 ++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/resources/Report/index.ts b/src/resources/Report/index.ts index 9a7da79..dad096f 100644 --- a/src/resources/Report/index.ts +++ b/src/resources/Report/index.ts @@ -13,11 +13,31 @@ export const ReportTypes = { ach_pull_nightly: 'ach.pull.nightly', ach_reversals_nightly: 'ach.reversals.nightly', entities_created_previous_day: 'entities.created.previous_day', + ach_debit_daily: 'ach.debit.daily', reserve_fbo_balance_created_previous_day: 'reserve_fbo_balance.created.previous_day', } as const; export type TReportTypes = typeof ReportTypes[keyof typeof ReportTypes]; +// Types implemented by POST /reports. Some ReportTypes, such as +// ach.debit.daily, are generated internally and are only readable via the API. +export const ReportCreateTypes = { + payments_created_current: ReportTypes.payments_created_current, + payments_created_previous: ReportTypes.payments_created_previous, + payments_updated_current: ReportTypes.payments_updated_current, + payments_updated_previous: ReportTypes.payments_updated_previous, + payments_created_previous_day: ReportTypes.payments_created_previous_day, + payments_failed_previous_day: ReportTypes.payments_failed_previous_day, + ach_pull_upcoming: ReportTypes.ach_pull_upcoming, + ach_pull_previous: ReportTypes.ach_pull_previous, + ach_pull_nightly: ReportTypes.ach_pull_nightly, + ach_reversals_nightly: ReportTypes.ach_reversals_nightly, + entities_created_previous_day: ReportTypes.entities_created_previous_day, + reserve_fbo_balance_created_previous_day: ReportTypes.reserve_fbo_balance_created_previous_day, +} as const; + +export type TReportCreateTypes = typeof ReportCreateTypes[keyof typeof ReportCreateTypes]; + export const ReportStatuses = { processing: 'processing', completed: 'completed', @@ -36,7 +56,7 @@ export interface IReport { }; export interface IReportCreateOpts { - type: TReportTypes; + type: TReportCreateTypes; metadata?: {}; }; diff --git a/test/resources/Report.tests.ts b/test/resources/Report.tests.ts index 1091f75..4017950 100644 --- a/test/resources/Report.tests.ts +++ b/test/resources/Report.tests.ts @@ -1,11 +1,20 @@ import { should } from 'chai'; import { describe } from 'mocha'; import { client } from '../config'; -import type { IReport } from '../../src/resources/Report'; +import { ReportTypes } from '../../src/resources/Report'; +import type { IReport, IReportCreateOpts } from '../../src/resources/Report'; import { IResponse } from '../../src/configuration'; should(); +type Assert = T; +type AchDebitDailyIsReadable = Assert< + typeof ReportTypes.ach_debit_daily extends IReport['type'] ? true : false +>; +type AchDebitDailyIsNotCreatable = Assert< + typeof ReportTypes.ach_debit_daily extends IReportCreateOpts['type'] ? false : true +>; + //TODO: Add tests for each report type describe('Reports - core methods tests', () => { let reports_create_response: IResponse; From 133a9cf66cb112620b06e433e9a9093fe79375a7 Mon Sep 17 00:00:00 2001 From: srikar-methodfi Date: Wed, 26 Aug 2026 13:51:05 -0400 Subject: [PATCH 3/3] lol --- index.ts | 6 +++++- src/resources/Report/index.ts | 25 ++++++------------------- test/resources/Report.tests.ts | 12 +++++++++--- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/index.ts b/index.ts index 589c130..fd9420a 100644 --- a/index.ts +++ b/index.ts @@ -5,5 +5,9 @@ export { AccountTypes } from './src/resources/Account'; export { ElementTypes } from './src/resources/Element'; export { EntityTypes, EntityStatuses } from './src/resources/Entity'; export { PaymentFundStatuses, PaymentStatuses } from './src/resources/Payment'; -export { ReportTypes, ReportStatuses } from './src/resources/Report'; +export { + ReportTypes, + ReportRetrieveTypes, + ReportStatuses, +} from './src/resources/Report'; export { WebhookTypes } from './src/resources/Webhook'; diff --git a/src/resources/Report/index.ts b/src/resources/Report/index.ts index dad096f..b6caf18 100644 --- a/src/resources/Report/index.ts +++ b/src/resources/Report/index.ts @@ -13,30 +13,17 @@ export const ReportTypes = { ach_pull_nightly: 'ach.pull.nightly', ach_reversals_nightly: 'ach.reversals.nightly', entities_created_previous_day: 'entities.created.previous_day', - ach_debit_daily: 'ach.debit.daily', reserve_fbo_balance_created_previous_day: 'reserve_fbo_balance.created.previous_day', } as const; export type TReportTypes = typeof ReportTypes[keyof typeof ReportTypes]; -// Types implemented by POST /reports. Some ReportTypes, such as -// ach.debit.daily, are generated internally and are only readable via the API. -export const ReportCreateTypes = { - payments_created_current: ReportTypes.payments_created_current, - payments_created_previous: ReportTypes.payments_created_previous, - payments_updated_current: ReportTypes.payments_updated_current, - payments_updated_previous: ReportTypes.payments_updated_previous, - payments_created_previous_day: ReportTypes.payments_created_previous_day, - payments_failed_previous_day: ReportTypes.payments_failed_previous_day, - ach_pull_upcoming: ReportTypes.ach_pull_upcoming, - ach_pull_previous: ReportTypes.ach_pull_previous, - ach_pull_nightly: ReportTypes.ach_pull_nightly, - ach_reversals_nightly: ReportTypes.ach_reversals_nightly, - entities_created_previous_day: ReportTypes.entities_created_previous_day, - reserve_fbo_balance_created_previous_day: ReportTypes.reserve_fbo_balance_created_previous_day, +export const ReportRetrieveTypes = { + ...ReportTypes, + ach_debit_daily: 'ach.debit.daily', } as const; -export type TReportCreateTypes = typeof ReportCreateTypes[keyof typeof ReportCreateTypes]; +export type TReportRetrieveTypes = typeof ReportRetrieveTypes[keyof typeof ReportRetrieveTypes]; export const ReportStatuses = { processing: 'processing', @@ -47,7 +34,7 @@ export type TReportStatuses = keyof typeof ReportStatuses; export interface IReport { id: string; - type: TReportTypes; + type: TReportRetrieveTypes; url: string; status: TReportStatuses; metadata: {} | null; @@ -56,7 +43,7 @@ export interface IReport { }; export interface IReportCreateOpts { - type: TReportCreateTypes; + type: TReportTypes; metadata?: {}; }; diff --git a/test/resources/Report.tests.ts b/test/resources/Report.tests.ts index 4017950..9f6a10b 100644 --- a/test/resources/Report.tests.ts +++ b/test/resources/Report.tests.ts @@ -1,18 +1,24 @@ import { should } from 'chai'; import { describe } from 'mocha'; import { client } from '../config'; -import { ReportTypes } from '../../src/resources/Report'; +import { ReportRetrieveTypes, ReportTypes } from '../../src/resources/Report'; import type { IReport, IReportCreateOpts } from '../../src/resources/Report'; import { IResponse } from '../../src/configuration'; should(); type Assert = T; +type CreateTypesAreReadable = Assert< + IReportCreateOpts['type'] extends IReport['type'] ? true : false +>; +type ReportTypesAreCreatable = Assert< + typeof ReportTypes[keyof typeof ReportTypes] extends IReportCreateOpts['type'] ? true : false +>; type AchDebitDailyIsReadable = Assert< - typeof ReportTypes.ach_debit_daily extends IReport['type'] ? true : false + typeof ReportRetrieveTypes.ach_debit_daily extends IReport['type'] ? true : false >; type AchDebitDailyIsNotCreatable = Assert< - typeof ReportTypes.ach_debit_daily extends IReportCreateOpts['type'] ? false : true + typeof ReportRetrieveTypes.ach_debit_daily extends IReportCreateOpts['type'] ? false : true >; //TODO: Add tests for each report type