Skip to content

Commit ddc5dbf

Browse files
Do not update the alias anymore
1 parent ac212c3 commit ddc5dbf

File tree

4 files changed

+4
-77
lines changed

4 files changed

+4
-77
lines changed

packages/app/src/cli/utilities/developer-platform-client/app-management-client.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
DevSessionDeleteOptions,
2626
UserError,
2727
} from '../developer-platform-client.js'
28-
import {getAlias, PartnersSession} from '../../services/context/partner-account-info.js'
28+
import {PartnersSession} from '../../services/context/partner-account-info.js'
2929
import {
3030
MinimalAppIdentifiers,
3131
MinimalOrganizationApp,
@@ -139,10 +139,7 @@ import {
139139
} from '../../api/graphql/app-management/generated/app-logs-subscribe.js'
140140
import {SourceExtension} from '../../api/graphql/app-management/generated/types.js'
141141
import {getPartnersToken} from '@shopify/cli-kit/node/environment'
142-
import {
143-
ensureAuthenticatedAppManagementAndBusinessPlatform,
144-
updateSessionAliasIfEmpty,
145-
} from '@shopify/cli-kit/node/session'
142+
import {ensureAuthenticatedAppManagementAndBusinessPlatform} from '@shopify/cli-kit/node/session'
146143
import {isUnitTest} from '@shopify/cli-kit/node/context/local'
147144
import {AbortError, BugError} from '@shopify/cli-kit/node/error'
148145
import {fetch, shopifyFetch, Response} from '@shopify/cli-kit/node/http'
@@ -317,8 +314,6 @@ export class AppManagementClient implements DeveloperPlatformClient {
317314
userId,
318315
}
319316
}
320-
321-
await updateSessionAliasIfEmpty(userId, getAlias(this._session.accountInfo))
322317
}
323318
return this._session
324319
}

packages/app/src/cli/utilities/developer-platform-client/partners-client.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ import {
1414
AppLogsResponse,
1515
createUnauthorizedHandler,
1616
} from '../developer-platform-client.js'
17-
import {
18-
fetchCurrentAccountInformation,
19-
getAlias,
20-
PartnersSession,
21-
} from '../../../cli/services/context/partner-account-info.js'
17+
import {fetchCurrentAccountInformation, PartnersSession} from '../../../cli/services/context/partner-account-info.js'
2218
import {
2319
MinimalAppIdentifiers,
2420
MinimalOrganizationApp,
@@ -163,7 +159,7 @@ import {isUnitTest} from '@shopify/cli-kit/node/context/local'
163159
import {AbortError} from '@shopify/cli-kit/node/error'
164160
import {generateFetchAppLogUrl, partnersRequest, partnersRequestDoc} from '@shopify/cli-kit/node/api/partners'
165161
import {CacheOptions, GraphQLVariables, UnauthorizedHandler} from '@shopify/cli-kit/node/api/graphql'
166-
import {ensureAuthenticatedPartners, updateSessionAliasIfEmpty} from '@shopify/cli-kit/node/session'
162+
import {ensureAuthenticatedPartners} from '@shopify/cli-kit/node/session'
167163
import {partnersFqdn} from '@shopify/cli-kit/node/context/fqdn'
168164
import {TokenItem} from '@shopify/cli-kit/node/ui'
169165
import {RequestModeInput, Response, shopifyFetch} from '@shopify/cli-kit/node/http'
@@ -243,8 +239,6 @@ export class PartnersClient implements DeveloperPlatformClient {
243239
}
244240
const accountInfo = await fetchCurrentAccountInformation(this, userId)
245241
this._session = {token, businessPlatformToken: '', accountInfo, userId}
246-
247-
await updateSessionAliasIfEmpty(userId, getAlias(accountInfo))
248242
}
249243
return this._session
250244
}

packages/cli-kit/src/public/node/session.test.ts

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
ensureAuthenticatedPartners,
66
ensureAuthenticatedStorefront,
77
ensureAuthenticatedThemes,
8-
updateSessionAliasIfEmpty,
98
} from './session.js'
109

1110
import {getPartnersToken} from './environment.js'
@@ -16,7 +15,6 @@ import {
1615
exchangeCliTokenForAppManagementAccessToken,
1716
exchangeCliTokenForBusinessPlatformAccessToken,
1817
} from '../../private/node/session/exchange.js'
19-
import * as sessionStore from '../../private/node/session/store.js'
2018
import {vi, describe, expect, test} from 'vitest'
2119

2220
const futureDate = new Date(2022, 1, 1, 11)
@@ -273,47 +271,3 @@ describe('ensureAuthenticatedAppManagementAndBusinessPlatform', () => {
273271
expect(ensureAuthenticated).not.toHaveBeenCalled()
274272
})
275273
})
276-
277-
describe('updateSessionAliasIfEmpty', () => {
278-
test('updates alias when current alias is empty', async () => {
279-
// Given
280-
vi.mocked(sessionStore.getSessionAlias).mockResolvedValue(undefined)
281-
282-
// When
283-
await updateSessionAliasIfEmpty('user1', 'New Alias')
284-
285-
// Then
286-
expect(sessionStore.getSessionAlias).toHaveBeenCalledWith('user1')
287-
expect(sessionStore.updateSessionAlias).toHaveBeenCalledWith('user1', 'New Alias')
288-
})
289-
290-
test('does not update alias when current alias exists', async () => {
291-
// Given
292-
vi.mocked(sessionStore.getSessionAlias).mockResolvedValue('Existing Alias')
293-
294-
// When
295-
await updateSessionAliasIfEmpty('user1', 'New Alias')
296-
297-
// Then
298-
expect(sessionStore.getSessionAlias).toHaveBeenCalledWith('user1')
299-
expect(sessionStore.updateSessionAlias).not.toHaveBeenCalled()
300-
})
301-
302-
test('does nothing when alias parameter is undefined', async () => {
303-
// When
304-
await updateSessionAliasIfEmpty('user1', undefined)
305-
306-
// Then
307-
expect(sessionStore.getSessionAlias).not.toHaveBeenCalled()
308-
expect(sessionStore.updateSessionAlias).not.toHaveBeenCalled()
309-
})
310-
311-
test('does nothing when alias parameter is empty string', async () => {
312-
// When
313-
await updateSessionAliasIfEmpty('user1', '')
314-
315-
// Then
316-
expect(sessionStore.getSessionAlias).not.toHaveBeenCalled()
317-
expect(sessionStore.updateSessionAlias).not.toHaveBeenCalled()
318-
})
319-
})

packages/cli-kit/src/public/node/session.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -235,19 +235,3 @@ ${outputToken.json(scopes)}
235235
export function logout(): Promise<void> {
236236
return sessionStore.remove()
237237
}
238-
239-
/**
240-
* Updates the session alias with a more human-readable display name if available.
241-
* Only updates if the current alias is empty.
242-
*
243-
* @param userId - The user ID of the session to update.
244-
* @param alias - The alias to update the session with.
245-
* @returns Promise that resolves when the alias update is complete.
246-
*/
247-
export async function updateSessionAliasIfEmpty(userId: string, alias: string | undefined): Promise<void> {
248-
if (!alias) return
249-
const currentAlias = await sessionStore.getSessionAlias(userId)
250-
if (!currentAlias) {
251-
await sessionStore.updateSessionAlias(userId, alias)
252-
}
253-
}

0 commit comments

Comments
 (0)