Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove exchangeId from submit endpoint paths #182

Closed
wants to merge 1 commit into from

Conversation

diehuxx
Copy link
Contributor

@diehuxx diehuxx commented Feb 21, 2024

Copy link

changeset-bot bot commented Feb 21, 2024

⚠️ No Changeset found

Latest commit: e4b4083

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

TBDocs Report

🛑 Errors: 0
⚠️ Warnings: 12

@tbdex/protocol

  • Project entry file: packages/protocol/src/main.ts

@tbdex/http-client

  • Project entry file: packages/http-client/src/main.ts
📄 File: packages/http-client/src/errors/request-error.ts
⚠️ extractor:ae-missing-release-tag: "RequestErrorParams" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) #L1
⚠️ extractor:ae-undocumented: Missing documentation for "RequestErrorParams". #L1
⚠️ extractor:ae-undocumented: Missing documentation for "recipientDid". #L13
⚠️ extractor:ae-undocumented: Missing documentation for "url". #L14
📄 File: packages/http-client/src/errors/request-token-error.ts
⚠️ extractor:ae-missing-release-tag: "RequestTokenErrorParams" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) #L3
⚠️ extractor:ae-undocumented: Missing documentation for "RequestTokenErrorParams". #L3
📄 File: packages/http-client/src/errors/response-error.ts
⚠️ extractor:ae-missing-release-tag: "ResponseErrorParams" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal) #L3
⚠️ extractor:ae-undocumented: Missing documentation for "ResponseErrorParams". #L3
⚠️ extractor:ae-undocumented: Missing documentation for "statusCode". #L15
⚠️ extractor:ae-undocumented: Missing documentation for "details". #L16
⚠️ extractor:ae-undocumented: Missing documentation for "recipientDid". #L17
⚠️ extractor:ae-undocumented: Missing documentation for "url". #L18

@tbdex/http-server

  • Project entry file: packages/http-server/src/main.ts

TBDocs Report Updated at 2024-02-21T23:57:04Z e4b4083

Copy link

codecov bot commented Feb 21, 2024

Codecov Report

Merging #182 (e4b4083) into main (f4ef4af) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #182   +/-   ##
=======================================
  Coverage   92.52%   92.52%           
=======================================
  Files          37       37           
  Lines        3011     3011           
  Branches      326      326           
=======================================
  Hits         2786     2786           
  Misses        225      225           
Components Coverage Δ
protocol 93.46% <ø> (ø)
http-client 93.63% <100.00%> (ø)
http-server 89.49% <100.00%> (ø)

@@ -77,7 +77,7 @@ describe('client', () => {
expect(e.statusCode).to.exist
expect(e.details).to.exist
expect(e.recipientDid).to.equal(pfiDid.uri)
expect(e.url).to.equal(`https://localhost:9000/exchanges/${rfq.metadata.exchangeId}/rfq`)
expect(e.url).to.equal(`https://localhost:9000/exchanges/rfq`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for creating an exchange, this should be https://localhost:9000/exchanges?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expect(e.url).to.equal(`https://localhost:9000/exchanges/rfq`)
expect(e.url).to.equal(`https://localhost:9000/exchanges`)

@@ -140,22 +140,22 @@ export class TbdexHttpServer {
listen(port: number | string, callback?: () => void) {
const { offeringsApi, exchangesApi, pfiDid } = this

this.api.post('/exchanges/:exchangeId/rfq', (req: Request, res: Response) =>
this.api.post('/exchanges/rfq', (req: Request, res: Response) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.api.post('/exchanges/rfq', (req: Request, res: Response) =>
this.api.post('/exchanges', (req: Request, res: Response) =>

@@ -23,7 +23,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => {
})

it('returns a 400 if no request body is provided', async () => {
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', {
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
const resp = await fetch('http://localhost:8000/exchanges', {

@@ -38,7 +38,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => {
})

it('returns a 400 if request body is not a valid json object', async () => {
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', {
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
const resp = await fetch('http://localhost:8000/exchanges', {

@@ -59,7 +59,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => {
const rfq = await DevTools.createRfq({ sender: aliceDid, receiver: pfiDid })
await rfq.sign(aliceDid)

const resp = await fetch('http://localhost:8000/exchanges/123/rfq', {
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
const resp = await fetch('http://localhost:8000/exchanges', {

@@ -198,7 +198,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => {
})
await rfq.sign(aliceDid)

const resp = await fetch('http://localhost:8000/exchanges/123/rfq', {
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
const resp = await fetch('http://localhost:8000/exchanges', {

@@ -303,7 +303,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => {
})

it('returns a 202 if RFQ is accepted', async () => {
const resp = await fetch('http://localhost:8000/exchanges/123/rfq', {
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
const resp = await fetch('http://localhost:8000/exchanges', {

@@ -318,7 +318,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => {
})
api.onSubmitRfq(callbackSpy)

const resp = await fetch('http://localhost:8000/exchanges/123/rfq', {
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
const resp = await fetch('http://localhost:8000/exchanges', {

@@ -343,7 +343,7 @@ describe('POST /exchanges/:exchangeId/rfq', () => {

const replyTo = 'https://tbdex.io/example'

const resp = await fetch('http://localhost:8000/exchanges/123/rfq', {
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const resp = await fetch('http://localhost:8000/exchanges/rfq', {
const resp = await fetch('http://localhost:8000/exchanges', {

const pfiServiceEndpoint = await TbdexHttpClient.getPfiServiceEndpoint(pfiDid)
const apiRoute = `${pfiServiceEndpoint}/exchanges/${exchangeId}/${kind}`
const apiRoute = `${pfiServiceEndpoint}/exchanges/${kind}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only add ${kind} if not RFQ

@diehuxx diehuxx closed this Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants