From 5d6bc958b9ca906278b8b106fff23277df6ea533 Mon Sep 17 00:00:00 2001 From: Giuliana Rigaud <62848434+giurigaud@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:14:07 -0300 Subject: [PATCH 1/8] Fix/duplicate orgs - KI-986868: Duplicated organizations (#156) --- CHANGELOG.md | 3 +++ node/resolvers/Queries/Users.ts | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d8f3c1..15e14bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed +- Add sort to searchDocumentsWithPaginationInfo at getAllUsers + ## [1.44.3] - 2024-08-22 ### Fixed diff --git a/node/resolvers/Queries/Users.ts b/node/resolvers/Queries/Users.ts index b0385a9..5880505 100644 --- a/node/resolvers/Queries/Users.ts +++ b/node/resolvers/Queries/Users.ts @@ -78,6 +78,7 @@ export const getAllUsers = async ({ pageSize: PAGINATION.pageSize, }, schema: config.version, + sort: 'id asc', ...(where ? { where } : {}), }) From 38cded50d401e64193c42511f853814098a249ed Mon Sep 17 00:00:00 2001 From: enzomerca <131273915+enzomerca@users.noreply.github.com> Date: Tue, 3 Sep 2024 14:14:11 +0000 Subject: [PATCH 2/8] Release v1.44.4 --- CHANGELOG.md | 2 ++ manifest.json | 2 +- node/package.json | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15e14bb..04280cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.44.4] - 2024-09-03 + ### Fixed - Add sort to searchDocumentsWithPaginationInfo at getAllUsers diff --git a/manifest.json b/manifest.json index e426777..1e86cf8 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "storefront-permissions", "vendor": "vtex", - "version": "1.44.3", + "version": "1.44.4", "title": "Storefront Permissions", "description": "Manage User's permissions on apps that relates to this app", "mustUpdateAt": "2022-08-28", diff --git a/node/package.json b/node/package.json index e0fcaac..4cd4863 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "vtex.checkout-ui-custom", - "version": "1.44.3", + "version": "1.44.4", "dependencies": { "@vtex/api": "6.47.0", "atob": "^2.1.2", From 1a6c6066755c738a61f7381efc4939ff491023e1 Mon Sep 17 00:00:00 2001 From: Matheus-Aguilar <43484640+Matheus-Aguilar@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:43:45 -0300 Subject: [PATCH 3/8] fix: provide app token on calls to b2b-organizations-graphql (#158) --- CHANGELOG.md | 3 +++ node/clients/index.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04280cb..25abe8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed +- Provide app token on calls to b2b-organizations-graphql app + ## [1.44.4] - 2024-09-03 ### Fixed diff --git a/node/clients/index.ts b/node/clients/index.ts index a3ebe4b..85c4e68 100644 --- a/node/clients/index.ts +++ b/node/clients/index.ts @@ -12,7 +12,7 @@ import { Schema } from './schema' import VtexId from './vtexId' export const getTokenToHeader = (ctx: IOContext) => { - const adminToken = ctx.adminUserAuthToken ?? ctx.authToken + const adminToken = ctx.authToken const userToken = ctx.storeUserAuthToken const { sessionToken, account } = ctx From 036d95427da9f7352ae54be573c22895979f002d Mon Sep 17 00:00:00 2001 From: Matheus-Aguilar <43484640+Matheus-Aguilar@users.noreply.github.com> Date: Wed, 4 Sep 2024 18:43:48 +0000 Subject: [PATCH 4/8] Release v1.44.5 --- CHANGELOG.md | 2 ++ manifest.json | 2 +- node/package.json | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25abe8a..64492ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.44.5] - 2024-09-04 + ### Fixed - Provide app token on calls to b2b-organizations-graphql app diff --git a/manifest.json b/manifest.json index 1e86cf8..9d945c6 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "storefront-permissions", "vendor": "vtex", - "version": "1.44.4", + "version": "1.44.5", "title": "Storefront Permissions", "description": "Manage User's permissions on apps that relates to this app", "mustUpdateAt": "2022-08-28", diff --git a/node/package.json b/node/package.json index 4cd4863..ebc4194 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "vtex.checkout-ui-custom", - "version": "1.44.4", + "version": "1.44.5", "dependencies": { "@vtex/api": "6.47.0", "atob": "^2.1.2", From a66e488ad7d1041e7137cafcfc6eb0063a1ae6ff Mon Sep 17 00:00:00 2001 From: Enzo Mercanti <131273915+enzomerca@users.noreply.github.com> Date: Thu, 5 Sep 2024 13:41:56 -0300 Subject: [PATCH 5/8] fix: add await to requests to properly handle login with inactive orgs (#159) --- CHANGELOG.md | 3 +++ node/resolvers/Routes/index.ts | 3 +-- node/yarn.lock | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64492ab..3d19d04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed +- Add await to requests to properly handle inactive organizations on login + ## [1.44.5] - 2024-09-04 ### Fixed diff --git a/node/resolvers/Routes/index.ts b/node/resolvers/Routes/index.ts index ba55ea3..35dab2d 100644 --- a/node/resolvers/Routes/index.ts +++ b/node/resolvers/Routes/index.ts @@ -293,8 +293,7 @@ export const Routes = { if (organizationList) { organization = (await getOrganization(organizationList.id))?.data ?.getOrganizationById - - setActiveUserByOrganization( + await setActiveUserByOrganization( null, { costId: organizationList.costId, diff --git a/node/yarn.lock b/node/yarn.lock index 1a57dcf..cf3246e 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -1428,7 +1428,7 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= -"stats-lite@github:vtex/node-stats-lite#dist": +stats-lite@vtex/node-stats-lite#dist: version "2.2.0" resolved "https://codeload.github.com/vtex/node-stats-lite/tar.gz/1b0d39cc41ef7aaecfd541191f877887a2044797" dependencies: From 451223dd9748e899c2308184fe22da52c295017e Mon Sep 17 00:00:00 2001 From: enzomerca <131273915+enzomerca@users.noreply.github.com> Date: Thu, 5 Sep 2024 16:42:00 +0000 Subject: [PATCH 6/8] Release v1.44.6 --- CHANGELOG.md | 2 ++ manifest.json | 2 +- node/package.json | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d19d04..6d09776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.44.6] - 2024-09-05 + ### Fixed - Add await to requests to properly handle inactive organizations on login diff --git a/manifest.json b/manifest.json index 9d945c6..d84361e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "storefront-permissions", "vendor": "vtex", - "version": "1.44.5", + "version": "1.44.6", "title": "Storefront Permissions", "description": "Manage User's permissions on apps that relates to this app", "mustUpdateAt": "2022-08-28", diff --git a/node/package.json b/node/package.json index ebc4194..7f93c3d 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "vtex.checkout-ui-custom", - "version": "1.44.5", + "version": "1.44.6", "dependencies": { "@vtex/api": "6.47.0", "atob": "^2.1.2", From 10d48ce4d4bf1cf48079111ae329c50ff6543971 Mon Sep 17 00:00:00 2001 From: Enzo Mercanti <131273915+enzomerca@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:32:47 -0300 Subject: [PATCH 7/8] fix: remove unnecessary b2b_users storage on vbase (#161) --- CHANGELOG.md | 3 +++ node/resolvers/Mutations/Users.ts | 30 ++++++------------------------ 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d09776..8c2c9ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed +- Remove unnecessary b2b_users storage on vbase + ## [1.44.6] - 2024-09-05 ### Fixed diff --git a/node/resolvers/Mutations/Users.ts b/node/resolvers/Mutations/Users.ts index 3115834..2323237 100644 --- a/node/resolvers/Mutations/Users.ts +++ b/node/resolvers/Mutations/Users.ts @@ -116,7 +116,7 @@ const updateUserFields = async ({ masterdata, fields, id }: any) => { return DocumentId } -const createPermission = async ({ masterdata, vbase, params }: any) => { +const createPermission = async ({ masterdata, params }: any) => { const { roleId, canImpersonate, @@ -129,7 +129,7 @@ const createPermission = async ({ masterdata, vbase, params }: any) => { id, } = params - const { DocumentId } = await masterdata + await masterdata .createOrUpdateEntireDocument({ dataEntity: config.name, fields: { @@ -157,25 +157,11 @@ const createPermission = async ({ masterdata, vbase, params }: any) => { throw error }) - - if (DocumentId) { - await vbase.saveJSON('b2b_users', email, { - canImpersonate, - clId, - costId, - email, - id: DocumentId, - name, - orgId, - roleId, - userId, - }) - } } export const addUser = async (_: any, params: any, ctx: Context) => { const { - clients: { masterdata, lm, vbase }, + clients: { masterdata, lm }, vtex: { logger }, } = ctx @@ -221,7 +207,6 @@ export const addUser = async (_: any, params: any, ctx: Context) => { ...params, clId: cId, }, - vbase, }) return { status: 'success', message: '', id: cId } @@ -237,7 +222,7 @@ export const addUser = async (_: any, params: any, ctx: Context) => { export const updateUser = async (_: any, params: any, ctx: Context) => { const { - clients: { masterdata, lm, vbase }, + clients: { masterdata, lm }, vtex: { logger }, } = ctx @@ -251,7 +236,6 @@ export const updateUser = async (_: any, params: any, ctx: Context) => { lm, masterdata, params, - vbase, }) return { status: 'success', message: '', id: params.clId } @@ -323,15 +307,13 @@ export const deleteUserProfile = async (_: any, params: any, ctx: Context) => { export const deleteUser = async (_: any, params: any, ctx: Context) => { const { - clients: { masterdata, vbase }, + clients: { masterdata }, vtex: { logger }, } = ctx - const { id, email } = params + const { id } = params try { - await vbase.deleteFile('b2b_users', email).catch(() => null) - await masterdata.deleteDocument({ dataEntity: config.name, id, From 9f587208e999b292d6fab04ff7ff993e758fe366 Mon Sep 17 00:00:00 2001 From: enzomerca <131273915+enzomerca@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:32:51 +0000 Subject: [PATCH 8/8] Release v1.44.7 --- CHANGELOG.md | 2 ++ manifest.json | 2 +- node/package.json | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c2c9ba..60762ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.44.7] - 2024-09-25 + ### Fixed - Remove unnecessary b2b_users storage on vbase diff --git a/manifest.json b/manifest.json index d84361e..948f22c 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "storefront-permissions", "vendor": "vtex", - "version": "1.44.6", + "version": "1.44.7", "title": "Storefront Permissions", "description": "Manage User's permissions on apps that relates to this app", "mustUpdateAt": "2022-08-28", diff --git a/node/package.json b/node/package.json index 7f93c3d..4884491 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "vtex.checkout-ui-custom", - "version": "1.44.6", + "version": "1.44.7", "dependencies": { "@vtex/api": "6.47.0", "atob": "^2.1.2",