Skip to content

Commit e123eb9

Browse files
isaacroldanClaude Code
andcommitted
feat: fetch experience field from API instead of hardcoding it
Co-authored-by: Claude Code <claude-code@anthropic.com>
1 parent 2028775 commit e123eb9

File tree

12 files changed

+120
-43
lines changed

12 files changed

+120
-43
lines changed

packages/app/src/cli/api/graphql/app-management/generated/active-app-release-from-api-key.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ export type ActiveAppReleaseFromApiKeyQuery = {
2424
handle: string
2525
config: JsonMapType
2626
target?: string | null
27-
specification: {identifier: string; externalIdentifier: string; name: string; managementExperience: string}
27+
specification: {
28+
identifier: string
29+
externalIdentifier: string
30+
name: string
31+
experience: string
32+
managementExperience: string
33+
}
2834
}[]
2935
}
3036
}
@@ -91,6 +97,7 @@ export const ActiveAppReleaseFromApiKey = {
9197
{kind: 'Field', name: {kind: 'Name', value: 'identifier'}},
9298
{kind: 'Field', name: {kind: 'Name', value: 'externalIdentifier'}},
9399
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
100+
{kind: 'Field', name: {kind: 'Name', value: 'experience'}},
94101
{kind: 'Field', name: {kind: 'Name', value: 'managementExperience'}},
95102
],
96103
},

packages/app/src/cli/api/graphql/app-management/generated/active-app-release.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ export type ActiveAppReleaseQuery = {
2424
handle: string
2525
config: JsonMapType
2626
target?: string | null
27-
specification: {identifier: string; externalIdentifier: string; name: string; managementExperience: string}
27+
specification: {
28+
identifier: string
29+
externalIdentifier: string
30+
name: string
31+
experience: string
32+
managementExperience: string
33+
}
2834
}[]
2935
}
3036
}
@@ -46,7 +52,13 @@ export type AppVersionInfoFragment = {
4652
handle: string
4753
config: JsonMapType
4854
target?: string | null
49-
specification: {identifier: string; externalIdentifier: string; name: string; managementExperience: string}
55+
specification: {
56+
identifier: string
57+
externalIdentifier: string
58+
name: string
59+
experience: string
60+
managementExperience: string
61+
}
5062
}[]
5163
}
5264
}
@@ -58,7 +70,13 @@ export type ReleasedAppModuleFragment = {
5870
handle: string
5971
config: JsonMapType
6072
target?: string | null
61-
specification: {identifier: string; externalIdentifier: string; name: string; managementExperience: string}
73+
specification: {
74+
identifier: string
75+
externalIdentifier: string
76+
name: string
77+
experience: string
78+
managementExperience: string
79+
}
6280
}
6381

6482
export const ReleasedAppModuleFragmentDoc = {
@@ -85,6 +103,7 @@ export const ReleasedAppModuleFragmentDoc = {
85103
{kind: 'Field', name: {kind: 'Name', value: 'identifier'}},
86104
{kind: 'Field', name: {kind: 'Name', value: 'externalIdentifier'}},
87105
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
106+
{kind: 'Field', name: {kind: 'Name', value: 'experience'}},
88107
{kind: 'Field', name: {kind: 'Name', value: 'managementExperience'}},
89108
],
90109
},
@@ -186,6 +205,7 @@ export const AppVersionInfoFragmentDoc = {
186205
{kind: 'Field', name: {kind: 'Name', value: 'identifier'}},
187206
{kind: 'Field', name: {kind: 'Name', value: 'externalIdentifier'}},
188207
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
208+
{kind: 'Field', name: {kind: 'Name', value: 'experience'}},
189209
{kind: 'Field', name: {kind: 'Name', value: 'managementExperience'}},
190210
],
191211
},
@@ -254,6 +274,7 @@ export const ActiveAppRelease = {
254274
{kind: 'Field', name: {kind: 'Name', value: 'identifier'}},
255275
{kind: 'Field', name: {kind: 'Name', value: 'externalIdentifier'}},
256276
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
277+
{kind: 'Field', name: {kind: 'Name', value: 'experience'}},
257278
{kind: 'Field', name: {kind: 'Name', value: 'managementExperience'}},
258279
],
259280
},

packages/app/src/cli/api/graphql/app-management/generated/app-version-by-id.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ export type AppVersionByIdQuery = {
1818
handle: string
1919
config: JsonMapType
2020
target?: string | null
21-
specification: {identifier: string; externalIdentifier: string; name: string; managementExperience: string}
21+
specification: {
22+
identifier: string
23+
externalIdentifier: string
24+
name: string
25+
experience: string
26+
managementExperience: string
27+
}
2228
}[]
2329
}
2430
}
@@ -32,7 +38,13 @@ export type VersionInfoFragment = {
3238
handle: string
3339
config: JsonMapType
3440
target?: string | null
35-
specification: {identifier: string; externalIdentifier: string; name: string; managementExperience: string}
41+
specification: {
42+
identifier: string
43+
externalIdentifier: string
44+
name: string
45+
experience: string
46+
managementExperience: string
47+
}
3648
}[]
3749
}
3850

@@ -90,6 +102,7 @@ export const VersionInfoFragmentDoc = {
90102
{kind: 'Field', name: {kind: 'Name', value: 'identifier'}},
91103
{kind: 'Field', name: {kind: 'Name', value: 'externalIdentifier'}},
92104
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
105+
{kind: 'Field', name: {kind: 'Name', value: 'experience'}},
93106
{kind: 'Field', name: {kind: 'Name', value: 'managementExperience'}},
94107
],
95108
},
@@ -158,6 +171,7 @@ export const AppVersionById = {
158171
{kind: 'Field', name: {kind: 'Name', value: 'identifier'}},
159172
{kind: 'Field', name: {kind: 'Name', value: 'externalIdentifier'}},
160173
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
174+
{kind: 'Field', name: {kind: 'Name', value: 'experience'}},
161175
{kind: 'Field', name: {kind: 'Name', value: 'managementExperience'}},
162176
],
163177
},

packages/app/src/cli/api/graphql/app-management/generated/app-version-by-tag.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ export type AppVersionByTagQuery = {
1818
handle: string
1919
config: JsonMapType
2020
target?: string | null
21-
specification: {identifier: string; externalIdentifier: string; name: string; managementExperience: string}
21+
specification: {
22+
identifier: string
23+
externalIdentifier: string
24+
name: string
25+
experience: string
26+
managementExperience: string
27+
}
2228
}[]
2329
}
2430
}
@@ -82,6 +88,7 @@ export const AppVersionByTag = {
8288
{kind: 'Field', name: {kind: 'Name', value: 'identifier'}},
8389
{kind: 'Field', name: {kind: 'Name', value: 'externalIdentifier'}},
8490
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
91+
{kind: 'Field', name: {kind: 'Name', value: 'experience'}},
8592
{kind: 'Field', name: {kind: 'Name', value: 'managementExperience'}},
8693
],
8794
},

packages/app/src/cli/api/graphql/app-management/generated/create-app-version.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ export type CreateAppVersionMutation = {
2020
handle: string
2121
config: JsonMapType
2222
target?: string | null
23-
specification: {identifier: string; externalIdentifier: string; name: string; managementExperience: string}
23+
specification: {
24+
identifier: string
25+
externalIdentifier: string
26+
name: string
27+
experience: string
28+
managementExperience: string
29+
}
2430
}[]
2531
metadata: {versionTag?: string | null; message?: string | null}
2632
} | null
@@ -161,6 +167,7 @@ export const CreateAppVersion = {
161167
{kind: 'Field', name: {kind: 'Name', value: 'identifier'}},
162168
{kind: 'Field', name: {kind: 'Name', value: 'externalIdentifier'}},
163169
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
170+
{kind: 'Field', name: {kind: 'Name', value: 'experience'}},
164171
{kind: 'Field', name: {kind: 'Name', value: 'managementExperience'}},
165172
],
166173
},

packages/app/src/cli/api/graphql/app-management/generated/specifications.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type FetchSpecificationsQuery = {
1212
name: string
1313
identifier: string
1414
externalIdentifier: string
15+
experience: string
1516
features: string[]
1617
uidStrategy:
1718
| {__typename: 'UidStrategiesClientProvided'; appModuleLimit: number; isClientProvided: boolean}
@@ -54,6 +55,7 @@ export const FetchSpecifications = {
5455
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
5556
{kind: 'Field', name: {kind: 'Name', value: 'identifier'}},
5657
{kind: 'Field', name: {kind: 'Name', value: 'externalIdentifier'}},
58+
{kind: 'Field', name: {kind: 'Name', value: 'experience'}},
5759
{kind: 'Field', name: {kind: 'Name', value: 'features'}},
5860
{
5961
kind: 'Field',

packages/app/src/cli/api/graphql/app-management/queries/active-app-release.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ fragment ReleasedAppModule on AppModule {
3737
identifier
3838
externalIdentifier
3939
name
40+
experience
4041
managementExperience
4142
}
4243
}

packages/app/src/cli/api/graphql/app-management/queries/specifications.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ query fetchSpecifications($organizationId: ID!) {
33
name
44
identifier
55
externalIdentifier
6+
experience
67
features
78
uidStrategy {
89
__typename

packages/app/src/cli/models/extensions/extension-instance.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ import {BaseConfigType, MAX_EXTENSION_HANDLE_LENGTH, MAX_UID_LENGTH} from './sch
22
import {FunctionConfigType} from './specifications/function.js'
33
import {ExtensionFeature, ExtensionSpecification} from './specification.js'
44
import {SingleWebhookSubscriptionType} from './specifications/app_config_webhook_schemas/webhooks_schema.js'
5-
import {AppHomeSpecIdentifier} from './specifications/app_config_app_home.js'
6-
import {AppAccessSpecIdentifier} from './specifications/app_config_app_access.js'
7-
import {AppProxySpecIdentifier} from './specifications/app_config_app_proxy.js'
8-
import {BrandingSpecIdentifier} from './specifications/app_config_branding.js'
9-
import {PosSpecIdentifier} from './specifications/app_config_point_of_sale.js'
10-
import {PrivacyComplianceWebhooksSpecIdentifier} from './specifications/app_config_privacy_compliance_webhooks.js'
11-
import {WebhooksSpecIdentifier} from './specifications/app_config_webhook.js'
12-
import {WebhookSubscriptionSpecIdentifier} from './specifications/app_config_webhook_subscription.js'
13-
import {EventsSpecIdentifier} from './specifications/app_config_events.js'
145
import {
156
ExtensionBuildOptions,
167
buildFunctionExtension,
@@ -34,23 +25,6 @@ import {outputDebug} from '@shopify/cli-kit/node/output'
3425
import {extractJSImports, extractImportPathsRecursively} from '@shopify/cli-kit/node/import-extractor'
3526
import {uniq} from '@shopify/cli-kit/common/array'
3627

37-
// DEPRECATED. We should get the experience from the specification instead of hardcoding it based on the identifier.
38-
// This is a temporary solution to avoid breaking changes while we update the API and the specifications query.
39-
export const CONFIG_EXTENSION_IDS: string[] = [
40-
AppAccessSpecIdentifier,
41-
AppHomeSpecIdentifier,
42-
AppProxySpecIdentifier,
43-
BrandingSpecIdentifier,
44-
PosSpecIdentifier,
45-
PrivacyComplianceWebhooksSpecIdentifier,
46-
WebhookSubscriptionSpecIdentifier,
47-
WebhooksSpecIdentifier,
48-
EventsSpecIdentifier,
49-
// Hardcoded identifiers that don't exist locally.
50-
'data',
51-
'admin',
52-
]
53-
5428
/**
5529
* Class that represents an instance of a local extension
5630
* Before creating this class we've validated that:

packages/app/src/cli/services/generate/fetch-extension-specifications.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,16 @@ export async function fetchSpecifications({
4343
// has been using so far. This is a workaround to keep the CLI working until the API is updated.
4444
if (spec.identifier === 'theme_app_extension') spec.identifier = 'theme'
4545
if (spec.identifier === 'subscription_management') spec.identifier = 'product_subscription'
46+
4647
newSpec.registrationLimit = spec.options.registrationLimit
4748
newSpec.surface = spec.features?.argo?.surface
4849

4950
// Hardcoded value for the post purchase extension because the value is wrong in the API
5051
if (spec.identifier === 'checkout_post_purchase') newSpec.surface = 'post_purchase'
5152

53+
// Hardcoded value for the webhook_subscription extension because the value is wrong in the API
54+
if (spec.identifier === 'webhook_subscription') spec.experience = 'configuration'
55+
5256
return newSpec
5357
})
5458

0 commit comments

Comments
 (0)