Skip to content

Do we need direction in existing PUT /v1/graphs ? #805

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

Open
Tracked by #800
prestonzendev opened this issue Apr 10, 2025 · 7 comments
Open
Tracked by #800

Do we need direction in existing PUT /v1/graphs ? #805

prestonzendev opened this issue Apr 10, 2025 · 7 comments

Comments

@prestonzendev
Copy link

No description provided.

@prestonzendev
Copy link
Author

@wilwade Based on the call I had with @aramikm and @p5150j this is something that we are looking to you on feedback / thoughts on.

@JoeCap08055
Copy link
Contributor

direction is included per-connection, there is not a concept of direction for the entire request, I believe

The endpoint accepts an array of connections, and the graph service will convert them into actual graph updates based on whether or not they already exist in the user's graph.

One thing we do appear to be missing in graph-service, however, is a way to remove a connection...

@aramikm
Copy link
Contributor

aramikm commented Apr 10, 2025

But we have a connectionType per connection which already captures that sentiment. I'm skeptical why we might need direction.

Example:

{
  "dsnpId": "2",
  "connections": {
    "data": [
      {
        "privacyType": "private",
        "direction": "connectionTo",
        "connectionType": "follow",
        "dsnpId": "3"
      }
    ]
  },
  "graphKeyPairs": [
    {
      "keyType": "X25519",
      "publicKey": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d",
      "privateKey": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"
    }
  ],
  "webhookUrl": "http://localhost/webhook"
}

@aramikm
Copy link
Contributor

aramikm commented Apr 10, 2025

So it appears that the direction might have been defined to be used for removing a connection but I think we might need a better design for Updating the graph

export enum Direction {
  ConnectionTo = 'connectionTo',
  ConnectionFrom = 'connectionFrom',
  Bidirectional = 'bidirectional',
  Disconnect = 'disconnect',
}

@JoeCap08055
Copy link
Contributor

But we have a connectionType per connection which already captures that sentiment. I'm skeptical why we might need direction.

Ah, I wasn't clear on the context of the question.
direction was copied from reconnection-service, which needs to know whether this is an entry in the user's graph, or if it is an entry in the 'followed' party's graph for purposes of scheduling additional graph updates.

We probably don't need it, then, in graph-service.

@aramikm
Copy link
Contributor

aramikm commented Apr 10, 2025

I think using the same types as what we defined in graph-SDK might be more intuitive

export interface ConnectAction {
  type: "Connect";
  ownerDsnpUserId: string;
  connection: Connection;
  dsnpKeys?: DsnpKeys;
}

export interface DisconnectAction {
  type: "Disconnect";
  ownerDsnpUserId: string;
  connection: Connection;
}

I'll create a new ticket for that

@JoeCap08055
Copy link
Contributor

JoeCap08055 commented Apr 10, 2025

Yes.
I think the issue is that graph-service copied a lot from reconnection-service, which is a different use case. reconnection-service is about syncing state (ie, "here's a list of connections my provider knows; make sure my graph reflects this state"). graph-service is about taking discrete actions (ie, follow/unfollow).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants