Skip to content

Commit b939690

Browse files
committed
Merge branch 'main' into 08-27-fix_url_generation_for_release_message
2 parents defc01a + 13b28bc commit b939690

File tree

15 files changed

+101
-21
lines changed

15 files changed

+101
-21
lines changed

.changeset/dull-cycles-brush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/theme': patch
3+
---
4+
5+
No longer raise password errors when users use custom app passwords on `shopify theme pull/push` commands

.changeset/flat-schools-dance.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/cli-kit': patch
3+
---
4+
5+
Remove redundant calls to normalizeStoreFqdn in requests

.changeset/wild-moles-help.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/app': patch
3+
---
4+
5+
Fix deeplink URL after a deploy

packages/app/src/cli/api/graphql/business-platform-organizations/generated/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export type Scalars = {
4848
OrganizationID: {input: any; output: any}
4949
/** The ID for a OrganizationUser. */
5050
OrganizationUserID: {input: any; output: any}
51+
/** The ID for a PersonAlias. */
52+
PersonAliasID: {input: any; output: any}
5153
/** The ID for a Person. */
5254
PersonID: {input: any; output: any}
5355
/** The ID for a Principal. */

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,11 +1230,12 @@ async function appDeepLink({
12301230
id,
12311231
organizationId,
12321232
}: Pick<MinimalAppIdentifiers, 'id' | 'organizationId'>): Promise<string> {
1233-
return `https://${await developerDashboardFqdn()}/dashboard/${organizationId}/apps/${numberFromGid(id)}`
1233+
const orgId = numberFromGid(organizationId).toString()
1234+
return `https://${await developerDashboardFqdn()}/dashboard/${orgId}/apps/${numberFromGid(id)}`
12341235
}
12351236

12361237
export async function versionDeepLink(organizationId: string, appId: string, versionId: string): Promise<string> {
1237-
const appLink = await appDeepLink({organizationId: numberFromGid(organizationId).toString(), id: appId})
1238+
const appLink = await appDeepLink({organizationId, id: appId})
12381239
return `${appLink}/versions/${numberFromGid(versionId)}`
12391240
}
12401241

packages/cli-kit/src/public/node/api/admin.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const mockedResult = {
2828
}
2929

3030
const token = 'token'
31-
const Session: AdminSession = {token, storeFqdn: 'store'}
31+
const Session: AdminSession = {token, storeFqdn: 'store.myshopify.com'}
3232

3333
describe('admin-graphql-api', () => {
3434
test('calls the graphql client twice: get api version and then execute the request', async () => {
@@ -83,7 +83,7 @@ describe('admin-graphql-api', () => {
8383
api: 'Admin',
8484
addedHeaders: {
8585
'X-Shopify-Access-Token': 'shptka_token',
86-
'X-Shopify-Shop': 'store',
86+
'X-Shopify-Shop': 'store.myshopify.com',
8787
},
8888
url: `https://${defaultThemeKitAccessDomain}/cli/admin/api/2022-01/graphql.json`,
8989
token: themeAccessToken,
@@ -131,7 +131,7 @@ describe('admin-rest-api', () => {
131131
await admin.restRequest('GET', '/themes', Session)
132132

133133
// Then
134-
expect(spyFetch).toHaveBeenLastCalledWith('https://store/admin/api/unstable/themes.json', {
134+
expect(spyFetch).toHaveBeenLastCalledWith('https://store.myshopify.com/admin/api/unstable/themes.json', {
135135
headers,
136136
method: 'GET',
137137
})
@@ -164,7 +164,7 @@ describe('admin-rest-api', () => {
164164
headers: {
165165
'Content-Type': 'application/json',
166166
'X-Shopify-Access-Token': 'shptka_token',
167-
'X-Shopify-Shop': 'store',
167+
'X-Shopify-Shop': 'store.myshopify.com',
168168
},
169169
method: 'GET',
170170
},

packages/cli-kit/src/public/node/api/admin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from '../../../private/node/api/rest.js'
1717
import {RequestModeInput, shopifyFetch} from '../http.js'
1818
import {PublicApiVersions} from '../../../cli/api/graphql/admin/generated/public_api_versions.js'
19-
import {normalizeStoreFqdn} from '../context/fqdn.js'
19+
2020
import {themeKitAccessDomain} from '../../../private/node/constants.js'
2121
import {serviceEnvironment} from '../../../private/node/context/service.js'
2222
import {DevServerCore} from '../vendor/dev_server/index.js'
@@ -36,7 +36,7 @@ const LatestApiVersionByFQDN = new Map<string, string>()
3636
export async function adminRequest<T>(query: string, session: AdminSession, variables?: GraphQLVariables): Promise<T> {
3737
const api = 'Admin'
3838
const version = await fetchLatestSupportedApiVersion(session)
39-
let storeDomain = await normalizeStoreFqdn(session.storeFqdn)
39+
let storeDomain = session.storeFqdn
4040
const addedHeaders = themeAccessHeaders(session)
4141

4242
if (serviceEnvironment() === 'local') {
@@ -78,7 +78,7 @@ export async function adminRequestDoc<TResult, TVariables extends Variables>(
7878
if (!apiVersion) {
7979
apiVersion = await fetchLatestSupportedApiVersion(session, preferredBehaviour)
8080
}
81-
let storeDomain = await normalizeStoreFqdn(session.storeFqdn)
81+
let storeDomain = session.storeFqdn
8282
const addedHeaders = themeAccessHeaders(session)
8383

8484
if (serviceEnvironment() === 'local') {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ describe('ensureAuthenticatedTheme', () => {
173173

174174
test('returns the password when is provided and custom_app_token', async () => {
175175
// When
176-
const got = await ensureAuthenticatedThemes('mystore', 'password')
176+
const got = await ensureAuthenticatedThemes('mystore.myshopify.com', 'password')
177177

178178
// Then
179179
expect(got).toEqual({token: 'password', storeFqdn: 'mystore.myshopify.com'})
@@ -183,7 +183,7 @@ describe('ensureAuthenticatedTheme', () => {
183183

184184
test('returns the password when is provided and theme_access_token', async () => {
185185
// When
186-
const got = await ensureAuthenticatedThemes('mystore', 'shptka_password')
186+
const got = await ensureAuthenticatedThemes('mystore.myshopify.com', 'shptka_password')
187187

188188
// Then
189189
expect(got).toEqual({token: 'shptka_password', storeFqdn: 'mystore.myshopify.com'})

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {normalizeStoreFqdn} from './context/fqdn.js'
21
import {BugError} from './error.js'
32
import {getPartnersToken} from './environment.js'
43
import {nonRandomUUID} from './crypto.js'
@@ -190,7 +189,7 @@ export async function ensureAuthenticatedThemes(
190189
${outputToken.json(scopes)}
191190
`)
192191
if (password) {
193-
const session = {token: password, storeFqdn: await normalizeStoreFqdn(store)}
192+
const session = {token: password, storeFqdn: store}
194193
const authMethod = isThemeAccessSession(session) ? 'theme_access_token' : 'custom_app_token'
195194
setLastSeenAuthMethod(authMethod)
196195
setLastSeenUserIdAfterAuth(nonRandomUUID(password))

packages/theme/src/cli/commands/theme/console.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {themeFlags} from '../../flags.js'
22
import ThemeCommand from '../../utilities/theme-command.js'
33
import {ensureThemeStore} from '../../utilities/theme-store.js'
44
import {ensureReplEnv, initializeRepl} from '../../services/console.js'
5+
import {validateThemePassword} from '../../services/flags-validation.js'
56
import {globalFlags} from '@shopify/cli-kit/node/cli'
67
import {ensureAuthenticatedThemes} from '@shopify/cli-kit/node/session'
78
import {Flags} from '@oclif/core'
@@ -33,6 +34,9 @@ export default class Console extends ThemeCommand {
3334

3435
async run() {
3536
const {flags} = await this.parse(Console)
37+
38+
validateThemePassword(flags.password)
39+
3640
const store = ensureThemeStore(flags)
3741
const {url, password: themeAccessPassword} = flags
3842

0 commit comments

Comments
 (0)