Skip to content

Commit 1a4ff9c

Browse files
authored
Merge pull request #5244 from Shopify/01-21-rename_partnersurls_to_applicationurls
Rename PartnersURLs to ApplicationURLs
2 parents 1cdb37e + 546e633 commit 1a4ff9c

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

packages/app/src/cli/services/dev.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
22
FrontendURLOptions,
3-
PartnersURLs,
3+
ApplicationURLs,
44
generateFrontendURL,
5-
generatePartnersURLs,
5+
generateApplicationURLs,
66
getURLs,
77
shouldOrPromptUpdateURLs,
88
startTunnelPlugin,
@@ -249,7 +249,7 @@ async function handleUpdatingOfPartnerUrls(
249249
commandSpecifiedToUpdate: boolean,
250250
network: {
251251
proxyUrl: string
252-
currentUrls: PartnersURLs
252+
currentUrls: ApplicationURLs
253253
},
254254
localApp: AppLinkedInterface,
255255
cachedUpdateURLs: boolean | undefined,
@@ -261,7 +261,7 @@ async function handleUpdatingOfPartnerUrls(
261261
let shouldUpdateURLs = false
262262
if (frontendConfig ?? backendConfig) {
263263
if (commandSpecifiedToUpdate) {
264-
const newURLs = generatePartnersURLs(
264+
const newURLs = generateApplicationURLs(
265265
network.proxyUrl,
266266
webs.map(({configuration}) => configuration.auth_callback_path).find((path) => path),
267267
localApp.configuration.app_proxy,

packages/app/src/cli/services/dev/processes/setup-dev-processes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {OrganizationApp} from '../../../models/organization.js'
1515
import {DevOptions} from '../../dev.js'
1616
import {getProxyingWebServer} from '../../../utilities/app/http-reverse-proxy.js'
1717
import {buildAppURLForWeb} from '../../../utilities/app/app-url.js'
18-
import {PartnersURLs} from '../urls.js'
18+
import {ApplicationURLs} from '../urls.js'
1919
import {DeveloperPlatformClient} from '../../../utilities/developer-platform-client.js'
2020
import {AppEventWatcher} from '../app-events/app-event-watcher.js'
2121
import {reloadApp} from '../../../models/app/loader.js'
@@ -46,7 +46,7 @@ interface DevNetworkOptions {
4646
proxyUrl: string
4747
frontendPort: number
4848
backendPort: number
49-
currentUrls: PartnersURLs
49+
currentUrls: ApplicationURLs
5050
}
5151

5252
export interface DevConfig {

packages/app/src/cli/services/dev/urls.test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import {
22
updateURLs,
33
shouldOrPromptUpdateURLs,
44
generateFrontendURL,
5-
generatePartnersURLs,
6-
PartnersURLs,
7-
validatePartnersURLs,
5+
generateApplicationURLs,
6+
ApplicationURLs,
7+
validateApplicationURLs,
88
FrontendURLOptions,
99
} from './urls.js'
1010
import {
@@ -557,7 +557,7 @@ describe('generatePartnersURLs', () => {
557557
test('Returns the default values without an override', () => {
558558
const applicationUrl = 'http://my-base-url'
559559

560-
const got = generatePartnersURLs(applicationUrl)
560+
const got = generateApplicationURLs(applicationUrl)
561561

562562
expect(got).toMatchObject({
563563
applicationUrl,
@@ -573,7 +573,7 @@ describe('generatePartnersURLs', () => {
573573
const applicationUrl = 'http://my-base-url'
574574
const overridePath = '/my/custom/path'
575575

576-
const got = generatePartnersURLs(applicationUrl, overridePath)
576+
const got = generateApplicationURLs(applicationUrl, overridePath)
577577

578578
expect(got).toMatchObject({
579579
applicationUrl,
@@ -585,7 +585,7 @@ describe('generatePartnersURLs', () => {
585585
const applicationUrl = 'http://my-base-url'
586586
const overridePath = ['/my/custom/path1', '/my/custom/path2']
587587

588-
const got = generatePartnersURLs(applicationUrl, overridePath)
588+
const got = generateApplicationURLs(applicationUrl, overridePath)
589589

590590
expect(got).toMatchObject({
591591
applicationUrl,
@@ -596,7 +596,7 @@ describe('generatePartnersURLs', () => {
596596
test('Returns app proxy section when receiving proxy fields', () => {
597597
const applicationUrl = 'http://my-base-url'
598598

599-
const got = generatePartnersURLs(applicationUrl, [], {
599+
const got = generateApplicationURLs(applicationUrl, [], {
600600
url: applicationUrl,
601601
subpath: 'subpath',
602602
prefix: 'prefix',
@@ -621,7 +621,7 @@ describe('generatePartnersURLs', () => {
621621
const applicationUrl = 'http://my-base-url'
622622
const proxyUrl = 'http://old-base-url/subpath'
623623

624-
const got = generatePartnersURLs(applicationUrl, [], {
624+
const got = generateApplicationURLs(applicationUrl, [], {
625625
url: proxyUrl,
626626
subpath: 'subpath',
627627
prefix: 'prefix',
@@ -648,47 +648,47 @@ describe('validatePartnersURLs', () => {
648648
// Given
649649
const applicationUrl = 'http://example.com'
650650
const redirectUrlWhitelist = ['http://example.com/callback1', 'http://example.com/callback2']
651-
const urls: PartnersURLs = {
651+
const urls: ApplicationURLs = {
652652
applicationUrl,
653653
redirectUrlWhitelist,
654654
appProxy: {proxyUrl: applicationUrl, proxySubPath: '', proxySubPathPrefix: ''},
655655
}
656656

657657
// When/Then
658-
validatePartnersURLs(urls)
658+
validateApplicationURLs(urls)
659659
})
660660

661661
test('it raises an error when the application URL is not valid', () => {
662662
// Given
663663
const applicationUrl = 'wrong'
664664
const redirectUrlWhitelist = ['http://example.com/callback1', 'http://example.com/callback2']
665-
const urls: PartnersURLs = {applicationUrl, redirectUrlWhitelist}
665+
const urls: ApplicationURLs = {applicationUrl, redirectUrlWhitelist}
666666

667667
// When/Then
668-
expect(() => validatePartnersURLs(urls)).toThrow(/Invalid application URL/)
668+
expect(() => validateApplicationURLs(urls)).toThrow(/Invalid application URL/)
669669
})
670670

671671
test('it raises an error when the redirection URLs are not valid', () => {
672672
// Given
673673
const applicationUrl = 'http://example.com'
674674
const redirectUrlWhitelist = ['http://example.com/callback1', 'wrong']
675-
const urls: PartnersURLs = {applicationUrl, redirectUrlWhitelist}
675+
const urls: ApplicationURLs = {applicationUrl, redirectUrlWhitelist}
676676

677677
// When/Then
678-
expect(() => validatePartnersURLs(urls)).toThrow(/Invalid redirection URLs/)
678+
expect(() => validateApplicationURLs(urls)).toThrow(/Invalid redirection URLs/)
679679
})
680680

681681
test('it raises an error when the app proxy URL is not valid', () => {
682682
// Given
683683
const applicationUrl = 'http://example.com'
684684
const redirectUrlWhitelist = ['http://example.com/callback1', 'http://example.com/callback2']
685-
const urls: PartnersURLs = {
685+
const urls: ApplicationURLs = {
686686
applicationUrl,
687687
redirectUrlWhitelist,
688688
appProxy: {proxyUrl: 'wrong', proxySubPath: '', proxySubPathPrefix: ''},
689689
}
690690

691691
// When/Then
692-
expect(() => validatePartnersURLs(urls)).toThrow(/Invalid app proxy URL/)
692+
expect(() => validateApplicationURLs(urls)).toThrow(/Invalid app proxy URL/)
693693
})
694694
})

packages/app/src/cli/services/dev/urls.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface AppProxy {
2222
proxySubPathPrefix: string
2323
}
2424

25-
export interface PartnersURLs {
25+
export interface ApplicationURLs {
2626
applicationUrl: string
2727
redirectUrlWhitelist: string[]
2828
appProxy?: AppProxy
@@ -138,11 +138,11 @@ async function pollTunnelURL(tunnelClient: TunnelClient): Promise<string> {
138138
})
139139
}
140140

141-
export function generatePartnersURLs(
141+
export function generateApplicationURLs(
142142
baseURL: string,
143143
authCallbackPath?: string | string[],
144144
proxyFields?: CurrentAppConfiguration['app_proxy'],
145-
): PartnersURLs {
145+
): ApplicationURLs {
146146
let redirectUrlWhitelist: string[]
147147
if (authCallbackPath && authCallbackPath.length > 0) {
148148
const authCallbackPaths = Array.isArray(authCallbackPath) ? authCallbackPath : [authCallbackPath]
@@ -185,7 +185,7 @@ function replaceHost(oldUrl: string, newUrl: string): string {
185185
}
186186

187187
export async function updateURLs(
188-
urls: PartnersURLs,
188+
urls: ApplicationURLs,
189189
apiKey: string,
190190
developerPlatformClient: DeveloperPlatformClient,
191191
localApp?: AppConfigurationInterface,
@@ -218,8 +218,8 @@ export async function updateURLs(
218218
}
219219
}
220220

221-
export async function getURLs(remoteAppConfig?: AppConfigurationUsedByCli): Promise<PartnersURLs> {
222-
const result: PartnersURLs = {
221+
export async function getURLs(remoteAppConfig?: AppConfigurationUsedByCli): Promise<ApplicationURLs> {
222+
const result: ApplicationURLs = {
223223
applicationUrl: remoteAppConfig?.application_url ?? '',
224224
redirectUrlWhitelist: remoteAppConfig?.auth?.redirect_urls ?? [],
225225
}
@@ -234,7 +234,7 @@ export async function getURLs(remoteAppConfig?: AppConfigurationUsedByCli): Prom
234234
}
235235

236236
interface ShouldOrPromptUpdateURLsOptions {
237-
currentURLs: PartnersURLs
237+
currentURLs: ApplicationURLs
238238
appDirectory: string
239239
cachedUpdateURLs?: boolean
240240
newApp?: boolean
@@ -269,7 +269,7 @@ export async function shouldOrPromptUpdateURLs(options: ShouldOrPromptUpdateURLs
269269
return shouldUpdateURLs
270270
}
271271

272-
export function validatePartnersURLs(urls: PartnersURLs): void {
272+
export function validateApplicationURLs(urls: ApplicationURLs): void {
273273
if (!isValidURL(urls.applicationUrl))
274274
throw new AbortError(`Invalid application URL: ${urls.applicationUrl}`, 'Valid format: "https://example.com"')
275275

0 commit comments

Comments
 (0)