Skip to content

Commit

Permalink
fix: upgrade ucanto in filecoin api
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Oct 24, 2023
1 parent 953537b commit c95fb54
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/filecoin-api/src/aggregator/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export const createServer = (context) =>
codec: context.codec || CAR.inbound,
service: createService(context),
catch: (error) => context.errorReporter.catch(error),
validateAuthorization: (auth) => context.validateAuthorization(auth),
})

/**
Expand Down
1 change: 1 addition & 0 deletions packages/filecoin-api/src/deal-tracker/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const createServer = (context) =>
codec: context.codec || CAR.inbound,
service: createService(context),
catch: (error) => context.errorReporter.catch(error),
validateAuthorization: (auth) => context.validateAuthorization(auth),
})

/**
Expand Down
1 change: 1 addition & 0 deletions packages/filecoin-api/src/dealer/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export const createServer = (context) =>
codec: context.codec || CAR.inbound,
service: createService(context),
catch: (error) => context.errorReporter.catch(error),
validateAuthorization: (auth) => context.validateAuthorization(auth),
})

/**
Expand Down
1 change: 1 addition & 0 deletions packages/filecoin-api/src/storefront/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export const createServer = (context) =>
codec: context.codec || CAR.inbound,
service: createService(context),
catch: (error) => context.errorReporter.catch(error),
validateAuthorization: (auth) => context.validateAuthorization(auth),
})

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/filecoin-api/test/aggregator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as AggregatorEvents from './events/aggregator.js'
import { getStoreImplementations } from './context/store-implementations.js'
import { Queue } from './context/queue.js'
import { getMockService, getConnection } from './context/service.js'
import { validateAuthorization } from './utils.js'

describe('Aggregator', () => {
describe('piece/*', () => {
Expand Down Expand Up @@ -63,6 +64,7 @@ describe('Aggregator', () => {
pieceAcceptQueue,
aggregateOfferQueue,
queuedMessages,
validateAuthorization
}
)
})
Expand Down Expand Up @@ -145,6 +147,7 @@ describe('Aggregator', () => {
minAggregateSize: 2 ** 34,
minUtilizationFactor: 4,
},
validateAuthorization
}
)
})
Expand Down
2 changes: 2 additions & 0 deletions packages/filecoin-api/test/context/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as DealTrackerCaps from '@web3-storage/capabilities/filecoin/deal-track
// eslint-disable-next-line no-unused-vars
import * as API from '../../src/types.js'

import { validateAuthorization } from '../utils.js'
import { mockService } from './mocks.js'

export function getMockService() {
Expand Down Expand Up @@ -220,6 +221,7 @@ export function getConnection(id, service) {
id: id,
service,
codec: CAR.inbound,
validateAuthorization
})
const connection = Client.connect({
id: id,
Expand Down
2 changes: 2 additions & 0 deletions packages/filecoin-api/test/deal-tracker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as Signer from '@ucanto/principal/ed25519'
import * as DealTrackerService from './services/deal-tracker.js'

import { getStoreImplementations } from './context/store-implementations.js'
import { validateAuthorization } from './utils.js'

/**
* @typedef {import('../src/deal-tracker/api.js').DealRecord} DealRecord
Expand Down Expand Up @@ -43,6 +44,7 @@ describe('deal-tracker', () => {
assert.fail(error)
},
},
validateAuthorization
}
)
})
Expand Down
3 changes: 3 additions & 0 deletions packages/filecoin-api/test/dealer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as DealerEvents from './events/dealer.js'

import { getStoreImplementations } from './context/store-implementations.js'
import { getMockService, getConnection } from './context/service.js'
import { validateAuthorization } from './utils.js'

describe('Dealer', () => {
describe('aggregate/*', () => {
Expand Down Expand Up @@ -43,6 +44,7 @@ describe('Dealer', () => {
aggregateStore,
offerStore,
queuedMessages,
validateAuthorization
}
)
})
Expand Down Expand Up @@ -107,6 +109,7 @@ describe('Dealer', () => {
},
},
service,
validateAuthorization
}
)
})
Expand Down
3 changes: 3 additions & 0 deletions packages/filecoin-api/test/storefront.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as StorefrontEvents from './events/storefront.js'
import { getStoreImplementations } from './context/store-implementations.js'
import { Queue } from './context/queue.js'
import { getMockService, getConnection } from './context/service.js'
import { validateAuthorization } from './utils.js'

describe('storefront', () => {
describe('filecoin/*', () => {
Expand Down Expand Up @@ -65,6 +66,7 @@ describe('storefront', () => {
taskStore,
receiptStore,
queuedMessages,
validateAuthorization
}
)
})
Expand Down Expand Up @@ -133,6 +135,7 @@ describe('storefront', () => {
assert.fail(error)
},
},
validateAuthorization
}
)
})
Expand Down
2 changes: 2 additions & 0 deletions packages/filecoin-api/test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ export async function randomAggregate(length, size) {
aggregate: aggregateBuild,
}
}

export const validateAuthorization = () => ({ ok: {} })

0 comments on commit c95fb54

Please sign in to comment.