Skip to content

Commit

Permalink
Use const for start dates
Browse files Browse the repository at this point in the history
  • Loading branch information
paullinator committed Mar 30, 2024
1 parent cced53a commit dcdd755
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/partners/banxa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import crypto from 'crypto'
import { Response } from 'node-fetch'

import {
EDGE_APP_START_DATE,
PartnerPlugin,
PluginParams,
PluginResult,
Expand All @@ -22,7 +23,7 @@ import { datelog, retryFetch, smartIsoDateFromTimestamp, snooze } from '../util'

export const asBanxaParams = asObject({
settings: asObject({
latestIsoDate: asOptional(asString, '2018-01-01T00:00:00.000Z')
latestIsoDate: asOptional(asString, EDGE_APP_START_DATE)
}),
apiKeys: asObject({
apiKey: asString,
Expand Down
3 changes: 2 additions & 1 deletion src/partners/letsexchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from 'cleaners'

import {
EDGE_APP_START_DATE,
PartnerPlugin,
PluginParams,
PluginResult,
Expand All @@ -19,7 +20,7 @@ import { datelog, retryFetch, smartIsoDateFromTimestamp } from '../util'

export const asLetsExchangePluginParams = asObject({
settings: asObject({
latestIsoDate: asOptional(asString, '2018-01-01T00:00:00.000Z')
latestIsoDate: asOptional(asString, EDGE_APP_START_DATE)
}),
apiKeys: asObject({
affiliateId: asOptional(asString),
Expand Down
6 changes: 4 additions & 2 deletions src/partners/lifi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {

import {
asStandardPluginParams,
EDGE_APP_START_DATE,
PartnerPlugin,
PluginParams,
PluginResult,
Expand All @@ -18,6 +19,7 @@ import {
} from '../types'
import { datelog, retryFetch, smartIsoDateFromTimestamp, snooze } from '../util'

const PLUGIN_START_DATE = '2023-01-01T00:00:00.000Z'
const asStatuses = asMaybe(asValue('DONE'), 'other')
const asToken = asObject({
// address: asString,
Expand Down Expand Up @@ -86,8 +88,8 @@ export async function queryLifi(
const { apiKey } = apiKeys
let { latestIsoDate } = settings

if (latestIsoDate === '2018-01-01T00:00:00.000Z') {
latestIsoDate = new Date('2023-01-01T00:00:00.000Z').toISOString()
if (latestIsoDate === EDGE_APP_START_DATE) {
latestIsoDate = new Date(PLUGIN_START_DATE).toISOString()
}

let lastCheckedTimestamp = new Date(latestIsoDate).getTime() - QUERY_LOOKBACK
Expand Down
5 changes: 4 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import {
asValue
} from 'cleaners'

/** Earliest date that transactions may show in Edge */
export const EDGE_APP_START_DATE = '2018-01-01T00:00:00.000Z'

export const asPluginParams = asObject({
settings: asMap((raw: any): any => raw),
apiKeys: asMap((raw: any): any => raw)
Expand Down Expand Up @@ -71,7 +74,7 @@ export const asDbCurrencyCodeMappings = asObject({

export const asStandardPluginParams = asObject({
settings: asObject({
latestIsoDate: asOptional(asString, '2018-01-01T00:00:00.000Z')
latestIsoDate: asOptional(asString, EDGE_APP_START_DATE)
}),
apiKeys: asObject({
apiKey: asOptional(asString)
Expand Down

0 comments on commit dcdd755

Please sign in to comment.