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

NOISSUE - Add channel role management #130

Merged
merged 3 commits into from
Jan 27, 2025

Conversation

ianmuchyri
Copy link
Contributor

@ianmuchyri ianmuchyri commented Jan 24, 2025

What does this do?

Add channel role management

Which issue(s) does this PR fix/relate to?

noissue
Put here Resolves #XXX to auto-close the issue that your PR fixes (if such)

List any changes that modify/break current functionality

none

Have you included tests for your changes?

yes

Did you document any new/modified functionality?

yes

Notes

To test this pr you need to be running this absmach/supermq#2663

Copy link

changeset-bot bot commented Jan 24, 2025

🦋 Changeset detected

Latest commit: 13239d5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@absmach/magistrala-sdk Patch

Not sure what this means? Click here to learn what changesets are.

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

@ianmuchyri ianmuchyri force-pushed the noissue-addchannelroles branch from f0b043c to 33e58b2 Compare January 24, 2025 08:37
Copy link
Contributor

@Musilah Musilah left a comment

Choose a reason for hiding this comment

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

Lets update the package.json dependecies:

image

@ianmuchyri
Copy link
Contributor Author

Lets update the package.json dependecies:

image

These are your local node_modules. The package-lock.json is already up to date

Copy link
Contributor

@Musilah Musilah left a comment

Choose a reason for hiding this comment

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

Should channel lists show the status?

channels: [
    {
      id: '35fb56fc-20b8-42be-bb97-c5958d0dd6f0',
      name: 'F2F',
      domain_id: 'e69ccf2e-e04a-4952-b3d2-d2591a8b04c3',
      created_at: '2025-01-24T09:57:41.87119Z',
      updated_at: '0001-01-01T00:00:00Z'
    },
    {
      id: '2d42a7de-bf95-4922-9429-2474ce672b0b',
      name: 'Gone Girl',
      domain_id: 'e69ccf2e-e04a-4952-b3d2-d2591a8b04c3',
      created_at: '2025-01-24T09:57:41.871197Z',
      updated_at: '0001-01-01T00:00:00Z'
    }
  ]

@Musilah
Copy link
Contributor

Musilah commented Jan 24, 2025

Should channel lists show the status?

channels: [
    {
      id: '35fb56fc-20b8-42be-bb97-c5958d0dd6f0',
      name: 'F2F',
      domain_id: 'e69ccf2e-e04a-4952-b3d2-d2591a8b04c3',
      created_at: '2025-01-24T09:57:41.87119Z',
      updated_at: '0001-01-01T00:00:00Z'
    },
    {
      id: '2d42a7de-bf95-4922-9429-2474ce672b0b',
      name: 'Gone Girl',
      domain_id: 'e69ccf2e-e04a-4952-b3d2-d2591a8b04c3',
      created_at: '2025-01-24T09:57:41.871197Z',
      updated_at: '0001-01-01T00:00:00Z'
    }
  ]

These are freshly created channels

@ianmuchyri
Copy link
Contributor Author

Should channel lists show the status?

channels: [
    {
      id: '35fb56fc-20b8-42be-bb97-c5958d0dd6f0',
      name: 'F2F',
      domain_id: 'e69ccf2e-e04a-4952-b3d2-d2591a8b04c3',
      created_at: '2025-01-24T09:57:41.87119Z',
      updated_at: '0001-01-01T00:00:00Z'
    },
    {
      id: '2d42a7de-bf95-4922-9429-2474ce672b0b',
      name: 'Gone Girl',
      domain_id: 'e69ccf2e-e04a-4952-b3d2-d2591a8b04c3',
      created_at: '2025-01-24T09:57:41.871197Z',
      updated_at: '0001-01-01T00:00:00Z'
    }
  ]

These are freshly created channels

This is an issue with supermq and not the sdk.

Copy link
Contributor

@Musilah Musilah left a comment

Choose a reason for hiding this comment

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

I am unable to connect a Client with more than one connectionType

   * @param {string[]}connectionTypes - Connection types can be publish, subscribe or both publish and subscribe

Running this example leads to this error: { status: 422, error: 'failed to create entity' }

mySdk.channels
  .ConnectClient(
    [clientId, clientIdSnooze],
    channelId,
    ["publish", "subscribe"],
    domainId,
    token
  )
  .then((response: any) => {
    console.log("response: ", response);
  })
  .catch((error) => {
    console.error(error);
  });

@ianmuchyri
Copy link
Contributor Author

I am unable to connect a Client with more than one connectionType

   * @param {string[]}connectionTypes - Connection types can be publish, subscribe or both publish and subscribe

Running this example leads to this error: { status: 422, error: 'failed to create entity' }

mySdk.channels
  .ConnectClient(
    [clientId, clientIdSnooze],
    channelId,
    ["publish", "subscribe"],
    domainId,
    token
  )
  .then((response: any) => {
    console.log("response: ", response);
  })
  .catch((error) => {
    console.error(error);
  });

You have to be running the latest supermq. That issue was fixed yesterday.

Copy link
Contributor

@dborovcanin dborovcanin left a comment

Choose a reason for hiding this comment

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

Please rebase.

@ianmuchyri ianmuchyri force-pushed the noissue-addchannelroles branch from 33e58b2 to b1085e1 Compare January 26, 2025 19:20
@ianmuchyri
Copy link
Contributor Author

Please rebase.

I have rebased

Copy link
Contributor

@Musilah Musilah left a comment

Choose a reason for hiding this comment

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

I cannot add role actions to channels:

mySdk.channels
  .AddChannelRoleActions(
    channelId,
    domainId,
    "channel_gj0q7lEbwNeMrhNzbh7rRc6x",
    ["read", "write"],
    token
  )
  .then((response) => {
    console.log("response: ", response);
  })
  .catch((error) => {
    console.error(error);
  });

leads to a malformed entity error

src/channels.ts Outdated Show resolved Hide resolved
src/channels.ts Outdated Show resolved Hide resolved
src/channels.ts Outdated Show resolved Hide resolved
src/channels.ts Outdated Show resolved Hide resolved
src/channels.ts Outdated Show resolved Hide resolved
@ianmuchyri
Copy link
Contributor Author

I cannot add role actions to channels:

mySdk.channels
  .AddChannelRoleActions(
    channelId,
    domainId,
    "channel_gj0q7lEbwNeMrhNzbh7rRc6x",
    ["read", "write"],
    token
  )
  .then((response) => {
    console.log("response: ", response);
  })
  .catch((error) => {
    console.error(error);
  });

leads to a malformed entity error

We don't have the write action
image

Signed-off-by: ianmuchyri <[email protected]>
@dborovcanin dborovcanin merged commit 188e93e into absmach:main Jan 27, 2025
1 check passed
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.

3 participants