From 927308aa3bacbd28a29fd55889c14054978acf29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20Rold=C3=A1n?= Date: Tue, 7 Jul 2026 13:54:29 +0200 Subject: [PATCH] Remove unused extension creation surface Assisted-By: devx/782ef931-ac0a-4cc4-bff1-a2511c379664 --- .../src/cli/api/graphql/extension_create.ts | 69 ------------ .../app/src/cli/models/app/app.test-data.ts | 20 ---- packages/app/src/cli/services/context.test.ts | 77 +------------ packages/app/src/cli/services/context.ts | 27 ----- .../context/id-manual-matching.test.ts | 4 +- .../cli/services/context/id-matching.test.ts | 1 - .../context/identifiers-extensions.test.ts | 103 ++---------------- .../cli/services/dev/create-extension.test.ts | 53 --------- .../src/cli/services/dev/create-extension.ts | 44 -------- .../utilities/developer-platform-client.ts | 2 - .../app-management-client.ts | 5 - .../partners-client.ts | 9 -- 12 files changed, 12 insertions(+), 402 deletions(-) delete mode 100644 packages/app/src/cli/api/graphql/extension_create.ts delete mode 100644 packages/app/src/cli/services/dev/create-extension.test.ts delete mode 100644 packages/app/src/cli/services/dev/create-extension.ts diff --git a/packages/app/src/cli/api/graphql/extension_create.ts b/packages/app/src/cli/api/graphql/extension_create.ts deleted file mode 100644 index 5dc701cf80e..00000000000 --- a/packages/app/src/cli/api/graphql/extension_create.ts +++ /dev/null @@ -1,69 +0,0 @@ -import {gql} from 'graphql-request' - -export const ExtensionCreateQuery = gql` - mutation ExtensionCreate( - $apiKey: String! - $type: ExtensionType! - $title: String! - $config: JSON! - $context: String - $handle: String - ) { - extensionCreate( - input: {apiKey: $apiKey, type: $type, title: $title, config: $config, context: $context, handle: $handle} - ) { - extensionRegistration { - id - uuid - type - title - draftVersion { - config - registrationId - lastUserInteractionAt - validationErrors { - field - message - } - } - } - userErrors { - field - message - } - } - } -` - -export interface ExtensionCreateVariables { - apiKey: string - type: string - title: string - config: string - context?: string | null - handle: string -} - -export interface ExtensionCreateSchema { - extensionCreate: { - extensionRegistration: { - id: string - uuid: string - type: string - title: string - draftVersion: { - config: string - registrationId: string - lastUserInteractionAt: string - validationErrors: { - field: string[] - message: string - }[] - } - } - userErrors: { - field: string[] - message: string - }[] - } -} diff --git a/packages/app/src/cli/models/app/app.test-data.ts b/packages/app/src/cli/models/app/app.test-data.ts index 1adb031c62f..01caa634e5b 100644 --- a/packages/app/src/cli/models/app/app.test-data.ts +++ b/packages/app/src/cli/models/app/app.test-data.ts @@ -41,7 +41,6 @@ import { } from '../../utilities/developer-platform-client.js' import {AllAppExtensionRegistrationsQuerySchema} from '../../api/graphql/all_app_extension_registrations.js' import {AppDeploySchema, AppDeployVariables} from '../../api/graphql/app_deploy.js' -import {ExtensionCreateSchema, ExtensionCreateVariables} from '../../api/graphql/extension_create.js' import {ConvertDevToTransferDisabledStoreVariables} from '../../api/graphql/convert_dev_to_transfer_disabled_store.js' import {SendSampleWebhookSchema, SendSampleWebhookVariables} from '../../services/webhook/request-sample.js' import {PublicApiVersionsSchema} from '../../services/webhook/request-api-versions.js' @@ -1212,24 +1211,6 @@ const appVersionsDiffResponse: AppVersionsDiffSchema = { }, } -export const extensionCreateResponse: ExtensionCreateSchema = { - extensionCreate: { - extensionRegistration: { - id: 'extension-id', - uuid: 'extension-uuid', - title: 'my extension', - type: 'other', - draftVersion: { - config: 'config', - registrationId: 'registration-id', - lastUserInteractionAt: '2024-01-01', - validationErrors: [], - }, - }, - userErrors: [], - }, -} - const deployResponse: AppDeploySchema = { appDeploy: { appVersion: { @@ -1356,7 +1337,6 @@ export function testDeveloperPlatformClient(stubs: Partial Promise.resolve(emptyActiveAppVersion), appVersionByTag: (_app: MinimalOrganizationApp, _tag: string) => Promise.resolve(appVersionByTagResponse), appVersionsDiff: (_input: AppVersionsDiffVariables) => Promise.resolve(appVersionsDiffResponse), - createExtension: (_input: ExtensionCreateVariables) => Promise.resolve(extensionCreateResponse), deploy: (_input: AppDeployVariables) => Promise.resolve(deployResponse), release: (_input: {app: MinimalAppIdentifiers; version: AppVersionIdentifiers}) => Promise.resolve(releaseResponse), generateSignedUploadUrl: (_app: MinimalAppIdentifiers) => Promise.resolve(generateSignedUploadUrlResponse), diff --git a/packages/app/src/cli/services/context.test.ts b/packages/app/src/cli/services/context.test.ts index ff236891e6f..07a1205dcc6 100644 --- a/packages/app/src/cli/services/context.test.ts +++ b/packages/app/src/cli/services/context.test.ts @@ -2,25 +2,17 @@ import {fetchOrganizations, fetchOrgFromId} from './dev/fetch.js' import {selectOrCreateApp} from './dev/select-app.js' import {selectStore} from './dev/select-store.js' import {ensureDeploymentIdsPresence} from './context/identifiers.js' -import {appFromIdentifiers, ensureDeployContext, ensureThemeExtensionDevContext} from './context.js' -import {createExtension} from './dev/create-extension.js' +import {appFromIdentifiers, ensureDeployContext} from './context.js' import {CachedAppInfo} from './local-storage.js' import link from './app/config/link.js' import {fetchSpecifications} from './generate/fetch-extension-specifications.js' import {DeployOptions} from './deploy.js' -import { - MinimalAppIdentifiers, - Organization, - OrganizationApp, - OrganizationSource, - OrganizationStore, -} from '../models/organization.js' +import {Organization, OrganizationApp, OrganizationSource, OrganizationStore} from '../models/organization.js' import {getAppIdentifiers} from '../models/app/identifiers.js' import { testDeveloperPlatformClient, testAppWithConfig, testOrganizationApp, - testThemeExtensions, testProject, } from '../models/app/app.test-data.js' import {getAppConfigurationFileName, isWebType} from '../models/app/loader.js' @@ -112,7 +104,6 @@ function buildDeveloperPlatformClient(extras?: Partial) vi.mock('./local-storage.js') vi.mock('./dev/fetch') -vi.mock('./dev/create-extension') vi.mock('./dev/select-app') vi.mock('./dev/select-store') vi.mock('../prompts/dev') @@ -380,70 +371,6 @@ describe('ensureDeployContext', () => { }) }) -describe('ensureThemeExtensionDevContext', () => { - test('fetches theme extension when it exists', async () => { - // Given - const apiKey = 'apiKey' - const extension = await testThemeExtensions() - - const mockedExtensionRegistrations = { - app: { - extensionRegistrations: [ - { - id: 'other ID', - uuid: 'other UUID', - title: 'other extension', - type: 'other', - }, - { - id: 'existing ID', - uuid: 'UUID', - title: 'theme app extension', - type: 'THEME_APP_EXTENSION', - }, - ], - configurationRegistrations: [], - dashboardManagedExtensionRegistrations: [], - }, - } - - const developerPlatformClient: DeveloperPlatformClient = testDeveloperPlatformClient({ - appExtensionRegistrations: (_app: MinimalAppIdentifiers) => Promise.resolve(mockedExtensionRegistrations), - }) - - // When - const got = await ensureThemeExtensionDevContext(extension, apiKey, developerPlatformClient) - - // Then - expect('existing ID').toEqual(got.id) - expect('UUID').toEqual(got.uuid) - expect('theme app extension').toEqual(got.title) - expect('THEME_APP_EXTENSION').toEqual(got.type) - }) - - test('creates theme extension when it does not exist', async () => { - // Given - const apiKey = 'apiKey' - const extension = await testThemeExtensions() - - vi.mocked(createExtension).mockResolvedValue({ - id: 'new ID', - uuid: 'UUID', - title: 'theme app extension', - type: 'THEME_APP_EXTENSION', - }) - - // When - const got = await ensureThemeExtensionDevContext(extension, apiKey, buildDeveloperPlatformClient()) - - // Then - expect('new ID').toEqual(got.id) - expect('UUID').toEqual(got.uuid) - expect('theme app extension').toEqual(got.title) - expect('THEME_APP_EXTENSION').toEqual(got.type) - }) -}) - describe('appFromIdentifiers', () => { test('renders the org name when an app cannot be found and the account is a service account ', async () => { vi.mocked(isServiceAccount).mockReturnValue(true) diff --git a/packages/app/src/cli/services/context.ts b/packages/app/src/cli/services/context.ts index 2032bce875f..17658ea9d66 100644 --- a/packages/app/src/cli/services/context.ts +++ b/packages/app/src/cli/services/context.ts @@ -1,7 +1,6 @@ import {selectOrCreateApp} from './dev/select-app.js' import {fetchOrganizations, fetchOrgFromId} from './dev/fetch.js' import {ensureDeploymentIdsPresence} from './context/identifiers.js' -import {createExtension} from './dev/create-extension.js' import {CachedAppInfo} from './local-storage.js' import {DeployOptions} from './deploy.js' import {formatConfigInfoBody} from './format-config-info-body.js' @@ -10,13 +9,10 @@ import {Identifiers, updateAppIdentifiers, getAppIdentifiers} from '../models/ap import {Organization, OrganizationApp, OrganizationSource, OrganizationStore} from '../models/organization.js' import metadata from '../metadata.js' import {getAppConfigurationFileName} from '../models/app/loader.js' -import {ExtensionInstance} from '../models/extensions/extension-instance.js' -import {ExtensionRegistration} from '../api/graphql/all_app_extension_registrations.js' import { allDeveloperPlatformClients, CreateAppOptions, - DeveloperPlatformClient, selectDeveloperPlatformClient, } from '../utilities/developer-platform-client.js' import {selectOrganizationPrompt} from '@shopify/organizations' @@ -104,29 +100,6 @@ export const appFromIdentifiers = async (options: AppFromIdOptions): Promise { - const remoteSpecifications = await developerPlatformClient.appExtensionRegistrations({ - id: apiKey, - apiKey, - organizationId: '1', - }) - const remoteRegistration = remoteSpecifications.app.extensionRegistrations.find((extension) => { - return extension.type === 'THEME_APP_EXTENSION' - }) - - if (remoteRegistration) { - return remoteRegistration - } - - const registration = await createExtension(apiKey, extension.graphQLType, extension.handle, developerPlatformClient) - - return registration -} - interface EnsureDeployContextResult { identifiers: Identifiers didMigrateExtensionsToDevDash: boolean diff --git a/packages/app/src/cli/services/context/id-manual-matching.test.ts b/packages/app/src/cli/services/context/id-manual-matching.test.ts index 830428e6914..f03fe7bdb14 100644 --- a/packages/app/src/cli/services/context/id-manual-matching.test.ts +++ b/packages/app/src/cli/services/context/id-manual-matching.test.ts @@ -1,6 +1,6 @@ /* eslint-disable @shopify/prefer-module-scope-constants */ import {manualMatchIds, ManualMatchResult} from './id-manual-matching.js' -import {ExtensionRegistration} from '../dev/create-extension.js' +import {RemoteSource} from './identifiers.js' import {testUIExtension} from '../../models/app/app.test-data.js' import {ExtensionInstance} from '../../models/extensions/extension-instance.js' import {describe, expect, vi, test, beforeAll} from 'vitest' @@ -8,7 +8,7 @@ import {renderAutocompletePrompt} from '@shopify/cli-kit/node/ui' vi.mock('@shopify/cli-kit/node/ui') -const REGISTRATION_A: ExtensionRegistration = { +const REGISTRATION_A: RemoteSource = { uuid: 'UUID_A', id: 'A', title: 'A', diff --git a/packages/app/src/cli/services/context/id-matching.test.ts b/packages/app/src/cli/services/context/id-matching.test.ts index 8c73e8d2d5e..f6af6501f79 100644 --- a/packages/app/src/cli/services/context/id-matching.test.ts +++ b/packages/app/src/cli/services/context/id-matching.test.ts @@ -7,7 +7,6 @@ import {describe, expect, vi, test, beforeAll} from 'vitest' import {outputInfo} from '@shopify/cli-kit/node/output' vi.mock('../dev/fetch') -vi.mock('../dev/create-extension') vi.mock('@shopify/cli-kit/node/output') const REGISTRATION_A: RemoteSource = { diff --git a/packages/app/src/cli/services/context/identifiers-extensions.test.ts b/packages/app/src/cli/services/context/identifiers-extensions.test.ts index 3b38367b31e..a41d01e55b0 100644 --- a/packages/app/src/cli/services/context/identifiers-extensions.test.ts +++ b/packages/app/src/cli/services/context/identifiers-extensions.test.ts @@ -25,7 +25,6 @@ import {migrateExtensionsToUIExtension} from '../dev/migrate-to-ui-extension.js' import {OrganizationApp} from '../../models/organization.js' import {ExtensionInstance} from '../../models/extensions/extension-instance.js' import {DeveloperPlatformClient, Flag} from '../../utilities/developer-platform-client.js' -import {ExtensionCreateSchema} from '../../api/graphql/extension_create.js' import appPOSSpec from '../../models/extensions/specifications/app_config_point_of_sale.js' import appWebhookSubscriptionSpec from '../../models/extensions/specifications/app_config_webhook_subscription.js' import {getModulesToMigrate} from '../dev/migrate-app-module.js' @@ -35,14 +34,6 @@ import {beforeEach, describe, expect, vi, test, beforeAll} from 'vitest' import {AbortSilentError} from '@shopify/cli-kit/node/error' import {setPathValue} from '@shopify/cli-kit/common/object' -interface Registration { - uuid: string - id: string - title: string - type: string - contextValue?: string -} - const REGISTRATION_A = { uuid: 'UUID_A', id: 'A', @@ -157,23 +148,6 @@ const options = ( return localApp } -async function createExtensionResult(registration: Registration): Promise { - return { - extensionCreate: { - extensionRegistration: { - ...registration, - draftVersion: { - config: 'config', - registrationId: 'registrationId', - lastUserInteractionAt: '2024-01-01', - validationErrors: [], - }, - }, - userErrors: [], - }, - } -} - vi.mock('@shopify/cli-kit/node/session') vi.mock('./prompts', async () => { @@ -402,9 +376,7 @@ describe('matchmaking returns ok with pending manual matches', () => { EXTENSION_A_2: 'UUID_A_2', } const remoteExtensions = [REGISTRATION_A, REGISTRATION_A_2] - const developerPlatformClient = testDeveloperPlatformClient({ - createExtension: () => createExtensionResult(REGISTRATION_B), - }) + const developerPlatformClient = testDeveloperPlatformClient() // When const got = await deployConfirmed( @@ -476,9 +448,7 @@ describe('matchmaking returns ok with pending manual matches and manual match fa EXTENSION_A: 'UUID_A', } const remoteExtensions = [REGISTRATION_A, REGISTRATION_A_2] - const developerPlatformClient = testDeveloperPlatformClient({ - createExtension: () => createExtensionResult(REGISTRATION_A_3), - }) + const developerPlatformClient = testDeveloperPlatformClient() // When const got = await deployConfirmed( @@ -535,19 +505,7 @@ describe('matchmaking returns ok with pending some pending to create', () => { const extensionsToCreate: LocalSource[] = [EXTENSION_A, EXTENSION_A_2] const validMatches = {} const remoteExtensions = [REGISTRATION_A, REGISTRATION_A_2] - let createExtensionCounter = 0 - const developerPlatformClient = testDeveloperPlatformClient({ - createExtension: async () => { - createExtensionCounter++ - if (createExtensionCounter === 1) { - return createExtensionResult(REGISTRATION_A) - } else if (createExtensionCounter === 2) { - return createExtensionResult(REGISTRATION_A_2) - } else { - throw new Error('createExtension should not be called 3 times') - } - }, - }) + const developerPlatformClient = testDeveloperPlatformClient() // When const got = await deployConfirmed( @@ -561,7 +519,6 @@ describe('matchmaking returns ok with pending some pending to create', () => { ) // Then - expect(developerPlatformClient.createExtension).not.toHaveBeenCalled() expect(got).toEqual({ extensions: {'extension-a': EXTENSION_A.uid, 'extension-a-2': EXTENSION_A_2.uid}, extensionIds: {'extension-a': EXTENSION_A.uid, 'extension-a-2': EXTENSION_A_2.uid}, @@ -614,7 +571,6 @@ describe('matchmaking returns ok with some pending confirmation', () => { }) // Then - expect(developerPlatformClient.createExtension).not.toBeCalled() expect(got).toEqual({ extensions: {'extension-b': 'UUID_B'}, extensionIds: {'extension-b': 'B'}, @@ -656,9 +612,7 @@ describe('matchmaking returns ok with some pending confirmation', () => { const extensionsToCreate: LocalSource[] = [EXTENSION_B] const validMatches = {} const remoteExtensions = [REGISTRATION_B] - const developerPlatformClient = testDeveloperPlatformClient({ - createExtension: () => createExtensionResult(REGISTRATION_B), - }) + const developerPlatformClient = testDeveloperPlatformClient() // When const got = await deployConfirmed(options([EXTENSION_B], [], {developerPlatformClient}), remoteExtensions, [], { @@ -667,7 +621,6 @@ describe('matchmaking returns ok with some pending confirmation', () => { }) // Then - expect(developerPlatformClient.createExtension).not.toHaveBeenCalled() expect(got).toEqual({ extensions: {'extension-b': EXTENSION_B.uid}, extensionIds: {'extension-b': EXTENSION_B.uid}, @@ -722,7 +675,6 @@ describe('matchmaking returns ok with nothing pending', () => { ) // Then - expect(developerPlatformClient.createExtension).not.toBeCalled() expect(got).toEqual({ extensions: {EXTENSION_A: 'UUID_A', EXTENSION_A_2: 'UUID_A_2'}, extensionIds: {EXTENSION_A: 'A', EXTENSION_A_2: 'A_2'}, @@ -784,7 +736,6 @@ describe('includes functions', () => { ) // Then - expect(developerPlatformClient.createExtension).not.toBeCalled() expect(got).toEqual({ extensions: {EXTENSION_A: 'UUID_A', FUNCTION_A: 'FUNCTION_A_UUID'}, extensionIds: {EXTENSION_A: 'A', FUNCTION_A: 'FUNCTION_A'}, @@ -925,7 +876,6 @@ describe('deployConfirmed: handle non existent uuid managed extensions', () => { }) // Then - expect(developerPlatformClient.createExtension).not.toBeCalled() expect(got).toEqual({ extensions: {}, extensionIds: {point_of_sale: 'C_A'}, @@ -948,7 +898,6 @@ describe('deployConfirmed: handle non existent uuid managed extensions', () => { }) // Then - expect(developerPlatformClient.createExtension).not.toHaveBeenCalled() expect(got).toEqual({ extensions: {}, extensionIds: {}, @@ -965,9 +914,7 @@ describe('deployConfirmed: handle non existent uuid managed extensions', () => { title: 'C_A', type: 'app-access', } - const developerPlatformClient = testDeveloperPlatformClient({ - createExtension: () => createExtensionResult(REGISTRATION_CONFIG_A), - }) + const developerPlatformClient = testDeveloperPlatformClient() // When @@ -980,7 +927,6 @@ describe('deployConfirmed: handle non existent uuid managed extensions', () => { }) // Then - expect(developerPlatformClient.createExtension).not.toHaveBeenCalled() expect(got).toEqual({ extensions: {}, extensionIds: {app_access: CONFIG_A.uid}, @@ -991,9 +937,7 @@ describe('deployConfirmed: handle non existent uuid managed extensions', () => { // Given const extensionsToCreate: LocalSource[] = [PAYMENTS_A] const validMatches = {} - const developerPlatformClient = testDeveloperPlatformClient({ - createExtension: () => createExtensionResult(PAYMENTS_REGISTRATION_A), - }) + const developerPlatformClient = testDeveloperPlatformClient() // When const ensureExtensionsIdsOptions = options([], [], {configExtensions: [PAYMENTS_A], developerPlatformClient}) @@ -1004,7 +948,6 @@ describe('deployConfirmed: handle non existent uuid managed extensions', () => { }) // Then - expect(developerPlatformClient.createExtension).not.toHaveBeenCalled() expect(got).toEqual({ extensions: {'payments-extension': PAYMENTS_A.uid}, extensionIds: {'payments-extension': PAYMENTS_A.uid}, @@ -1039,7 +982,6 @@ describe('deployConfirmed: handle existent uuid managed extensions', () => { }) // Then - expect(developerPlatformClient.createExtension).not.toHaveBeenCalled() expect(got).toEqual({ extensions: {}, extensionIds: {point_of_sale: 'C_A'}, @@ -1075,7 +1017,6 @@ describe('deployConfirmed: extensions that should be managed in the TOML', () => }) // Then - expect(developerPlatformClient.createExtension).not.toHaveBeenCalled() expect(got).toEqual({ extensions: {}, extensionIds: {point_of_sale: 'C_A'}, @@ -1140,20 +1081,7 @@ describe('ensureNonUuidManagedExtensionsIds: for extensions managed in the TOML' }).app const appId = 'appId' - let createExtensionCounter = 0 - const developerPlatformClient = testDeveloperPlatformClient({ - createExtension: () => { - createExtensionCounter++ - const registration = { - uuid: `webhook-subscription-${createExtensionCounter}`, - id: createExtensionCounter.toString(), - title: `Webhook Subscription ${createExtensionCounter}`, - type: 'WEBHOOK_SUBSCRIPTION', - contextValue: '', - } - return createExtensionResult(registration) - }, - }) + const developerPlatformClient = testDeveloperPlatformClient() // When @@ -1166,7 +1094,6 @@ describe('ensureNonUuidManagedExtensionsIds: for extensions managed in the TOML' ) // Then - expect(developerPlatformClient.createExtension).not.toHaveBeenCalled() expect(Object.values(extensionsNonUuidManaged)).toEqual(localSources.map((source) => source.uid)) expect(Object.values(extensionsIdsNonUuidManaged)).toEqual(localSources.map((source) => source.uid)) }) @@ -1213,20 +1140,7 @@ describe('ensureNonUuidManagedExtensionsIds: for extensions managed in the TOML' }).app const appId = 'appId' - let createExtensionCounter = 0 - const developerPlatformClient = testDeveloperPlatformClient({ - createExtension: async () => { - createExtensionCounter++ - const registration = { - uuid: `webhook-subscription-${createExtensionCounter}`, - id: createExtensionCounter.toString(), - title: `Webhook Subscription ${createExtensionCounter}`, - type: 'WEBHOOK_SUBSCRIPTION', - contextValue: '', - } - return createExtensionResult(registration) - }, - }) + const developerPlatformClient = testDeveloperPlatformClient() // When const {extensionsNonUuidManaged, extensionsIdsNonUuidManaged} = await ensureNonUuidManagedExtensionsIds( @@ -1238,7 +1152,6 @@ describe('ensureNonUuidManagedExtensionsIds: for extensions managed in the TOML' ) // Then - expect(developerPlatformClient.createExtension).not.toHaveBeenCalled() expect(Object.values(extensionsNonUuidManaged)).toEqual([ 'webhook-subscription-uuid', ...localSources.slice(1).map((source) => source.uid), diff --git a/packages/app/src/cli/services/dev/create-extension.test.ts b/packages/app/src/cli/services/dev/create-extension.test.ts deleted file mode 100644 index 84f3d30b31f..00000000000 --- a/packages/app/src/cli/services/dev/create-extension.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -import {createExtension} from './create-extension.js' -import {extensionCreateResponse, testDeveloperPlatformClient} from '../../models/app/app.test-data.js' -import {describe, expect, test} from 'vitest' - -describe('createExtension', () => { - test('sends request to create extension and returns it', async () => { - // Given - const developerPlatformClient = testDeveloperPlatformClient() - - const variables = { - apiKey: '123', - type: 'CHECKOUT_POST_PURCHASE', - title: 'my-ext', - config: '{}', - context: null, - handle: 'my-ext', - } - - // When - const got = await createExtension('123', 'CHECKOUT_POST_PURCHASE', 'my-ext', developerPlatformClient) - - // Then - expect(got).toEqual(extensionCreateResponse.extensionCreate.extensionRegistration) - expect(developerPlatformClient.createExtension).toHaveBeenCalledWith(variables) - }) - - test('sends request to create extension with context and returns it', async () => { - // Given - const developerPlatformClient = testDeveloperPlatformClient() - - const variables = { - apiKey: '321', - type: 'PAYMENTS_EXTENSION', - title: 'my-ext', - config: '{}', - context: 'offsite.payments.render', - handle: 'my-ext', - } - - // When - const got = await createExtension( - '321', - 'PAYMENTS_EXTENSION', - 'my-ext', - developerPlatformClient, - 'offsite.payments.render', - ) - - // Then - expect(got).toEqual(extensionCreateResponse.extensionCreate.extensionRegistration) - expect(developerPlatformClient.createExtension).toHaveBeenCalledWith(variables) - }) -}) diff --git a/packages/app/src/cli/services/dev/create-extension.ts b/packages/app/src/cli/services/dev/create-extension.ts deleted file mode 100644 index fbedebd1b4f..00000000000 --- a/packages/app/src/cli/services/dev/create-extension.ts +++ /dev/null @@ -1,44 +0,0 @@ -import {ExtensionCreateSchema, ExtensionCreateVariables} from '../../api/graphql/extension_create.js' -import {DeveloperPlatformClient} from '../../utilities/developer-platform-client.js' -import {AbortError} from '@shopify/cli-kit/node/error' - -export interface ExtensionRegistration { - id: string - uuid: string - type: string - title: string - draftVersion?: { - config: string - registrationId: string - lastUserInteractionAt: string - validationErrors: { - field: string[] - message: string - }[] - } -} - -export async function createExtension( - apiKey: string, - graphQLType: string, - handle: string, - developerPlatformClient: DeveloperPlatformClient, - context?: string, -): Promise { - const variables: ExtensionCreateVariables = { - apiKey, - type: graphQLType, - title: handle, - config: JSON.stringify({}), - context: context ?? null, - handle, - } - const result: ExtensionCreateSchema = await developerPlatformClient.createExtension(variables) - - if (result.extensionCreate.userErrors?.length > 0) { - const errors = result.extensionCreate.userErrors.map((error) => error.message).join(', ') - throw new AbortError(errors) - } - - return result.extensionCreate.extensionRegistration -} diff --git a/packages/app/src/cli/utilities/developer-platform-client.ts b/packages/app/src/cli/utilities/developer-platform-client.ts index 05e8edefbb4..4aee0f37f1f 100644 --- a/packages/app/src/cli/utilities/developer-platform-client.ts +++ b/packages/app/src/cli/utilities/developer-platform-client.ts @@ -11,7 +11,6 @@ import { import {AllAppExtensionRegistrationsQuerySchema} from '../api/graphql/all_app_extension_registrations.js' import {AppDeploySchema, AppDeployVariables} from '../api/graphql/app_deploy.js' -import {ExtensionCreateSchema, ExtensionCreateVariables} from '../api/graphql/extension_create.js' import { ConvertDevToTransferDisabledSchema, ConvertDevToTransferDisabledStoreVariables, @@ -257,7 +256,6 @@ export interface DeveloperPlatformClient { appVersionByTag: (app: MinimalOrganizationApp, tag: string) => Promise appVersionsDiff: (app: MinimalOrganizationApp, version: AppVersionIdentifiers) => Promise generateSignedUploadUrl: (app: MinimalAppIdentifiers) => Promise - createExtension: (input: ExtensionCreateVariables) => Promise deploy: (input: AppDeployOptions) => Promise release: (input: {app: MinimalOrganizationApp; version: AppVersionIdentifiers}) => Promise convertToTransferDisabledStore: ( diff --git a/packages/app/src/cli/utilities/developer-platform-client/app-management-client.ts b/packages/app/src/cli/utilities/developer-platform-client/app-management-client.ts index e3e9c353b67..9f1d09b032c 100644 --- a/packages/app/src/cli/utilities/developer-platform-client/app-management-client.ts +++ b/packages/app/src/cli/utilities/developer-platform-client/app-management-client.ts @@ -44,7 +44,6 @@ import { } from '../../api/graphql/all_app_extension_registrations.js' import {AppDeploySchema} from '../../api/graphql/app_deploy.js' import {AppVersionsQuerySchema as AppVersionsQuerySchemaInterface} from '../../api/graphql/get_versions_list.js' -import {ExtensionCreateSchema, ExtensionCreateVariables} from '../../api/graphql/extension_create.js' import { ConvertDevToTransferDisabledSchema, ConvertDevToTransferDisabledStoreVariables, @@ -891,10 +890,6 @@ export class AppManagementClient implements DeveloperPlatformClient { } } - async createExtension(_input: ExtensionCreateVariables): Promise { - throw new BugError('Not implemented: createExtension') - } - async convertToTransferDisabledStore( _input: ConvertDevToTransferDisabledStoreVariables, ): Promise { diff --git a/packages/app/src/cli/utilities/developer-platform-client/partners-client.ts b/packages/app/src/cli/utilities/developer-platform-client/partners-client.ts index cfef1c6e64e..15c7a5952ea 100644 --- a/packages/app/src/cli/utilities/developer-platform-client/partners-client.ts +++ b/packages/app/src/cli/utilities/developer-platform-client/partners-client.ts @@ -39,11 +39,6 @@ import { GenerateSignedUploadUrlSchema, GenerateSignedUploadUrlVariables, } from '../../api/graphql/generate_signed_upload_url.js' -import { - ExtensionCreateQuery, - ExtensionCreateSchema, - ExtensionCreateVariables, -} from '../../api/graphql/extension_create.js' import { ConvertDevToTransferDisabledStoreQuery, ConvertDevToTransferDisabledSchema, @@ -444,10 +439,6 @@ export class PartnersClient implements DeveloperPlatformClient { } } - async createExtension(input: ExtensionCreateVariables): Promise { - return this.request(ExtensionCreateQuery, input) - } - async deploy(deployInput: AppDeployOptions): Promise { const {organizationId, ...deployOptions} = deployInput // Enforce the type