-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update mutation variables for AppVersionCreate #5451
base: main
Are you sure you want to change the base?
Conversation
Coverage report
Test suite run success2069 tests passing in 923 suites. Report generated by 🧪jest coverage report action from 8d20719 |
89e0622
to
f712bad
Compare
mutation CreateAppVersion($appId: ID!, $appSource: AppSourceInput!, $name: String!, $metadata: VersionMetadataInput) { | ||
appVersionCreate(appId: $appId, appSource: $appSource, name: $name, metadata: $metadata) { | ||
mutation CreateAppVersion($appId: ID!, $version: AppVersionInput!, $metadata: VersionMetadataInput) { | ||
appVersionCreate(appId: $appId, version: $version, metadata: $metadata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled name
as well, on the theory that we're either going to pull name from the branding module (short-term), or update the manifest format to include it longer-term.
f712bad
to
0c61cd7
Compare
We detected some changes at packages/*/src and there are no updates in the .changeset. |
0c61cd7
to
8d20719
Compare
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationspackages/cli-kit/dist/private/node/session/identity-token-validation.d.tsexport declare function validateIdentityToken(token: string): Promise<boolean>;
Existing type declarationspackages/cli-kit/dist/private/node/conf-store.d.ts@@ -3,14 +3,16 @@ interface CacheValue<T> {
value: T;
timestamp: number;
}
+export type IntrospectionUrlKey = ;
export type PackageVersionKey = ;
export type NotificationsKey = ;
export type NotificationKey = ;
export type GraphQLRequestKey = ;
type MostRecentOccurrenceKey = ;
type RateLimitKey = ;
-type ExportedKey = PackageVersionKey | NotificationsKey | NotificationKey | GraphQLRequestKey;
+type ExportedKey = IntrospectionUrlKey | PackageVersionKey | NotificationsKey | NotificationKey | GraphQLRequestKey;
interface Cache {
+ [introspectionUrlKey: IntrospectionUrlKey]: CacheValue<string>;
[packageVersionKey: PackageVersionKey]: CacheValue<string>;
[notifications: NotificationsKey]: CacheValue<string>;
[notification: NotificationKey]: CacheValue<string>;
@@ -57,13 +59,12 @@ export declare function cacheStore(key: ExportedKey, value: string, config?: Loc
*/
export declare function cacheRetrieve(key: ExportedKey, config?: LocalStorage<ConfSchema>): CacheValue<string> | undefined;
export declare function cacheClear(config?: LocalStorage<ConfSchema>): void;
-export interface TimeInterval {
+interface TimeInterval {
days?: number;
hours?: number;
minutes?: number;
seconds?: number;
}
-export declare function timeIntervalToMilliseconds({ days, hours, minutes, seconds }: TimeInterval): number;
/**
* Execute a task only if the most recent occurrence of the task is older than the specified timeout.
* @param key - The key to use for the cache.
packages/cli-kit/dist/public/node/api/graphql.d.ts@@ -1,4 +1,4 @@
-import { ConfSchema, TimeInterval } from '../../../private/node/conf-store.js';
+import { ConfSchema } from '../../../private/node/conf-store.js';
import { LocalStorage } from '../local-storage.js';
import { rawRequest, RequestDocument, Variables } from 'graphql-request';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
@@ -12,10 +12,11 @@ export interface GraphQLVariables {
}
export type GraphQLResponse<T> = Awaited<ReturnType<typeof rawRequest<T>>>;
export interface CacheOptions {
- cacheTTL: TimeInterval;
+ cacheTTL: CacheTTL;
cacheExtraKey?: string;
cacheStore?: LocalStorage<ConfSchema>;
}
+export type CacheTTL = number;
interface GraphQLRequestBaseOptions<TResult> {
api: string;
url: string;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one small nit/suggestion that isn't really related to your PR directly anyway.
@@ -582,22 +582,24 @@ export class AppManagementClient implements DeveloperPlatformClient { | |||
if (brandingModule) { | |||
updatedName = JSON.parse(brandingModule.config).name | |||
} | |||
|
|||
const metadata = {versionTag, message, sourceControlUrl: commitReference} | |||
const queryVersion: AppVersionSourceUrl | AppVersionSource = bundleUrl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really your PR but since the function argument usage is so different between both versions of this request, I wonder if it'd be better to have two functions: i.e. deploy()
and deployWithUrl()
or something. I suspect it'd be easier to work with the interface if this was the case, instead of having to worry about a bunch optional function args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea. Some observations:
- To do so would involve restructuring a couple of nested interfaces:
AppDeployOptions
which containsAppDeployVariables
wherebundleUrl
is optional. - This interface is shared across
AppManagementClient
andPartnersClient
-- andPartnersClient
is where thisAppDeployVariables
data shape comes from originally.
So while we could refactor it now, I'm wondering if it would simplify things given the two platform clients would not potentially have diverging interfaces. Perhaps easier to do post partners migration?
WHY are these changes introduced?
Following up to #5436 per this issue. Per these issues, we've updated the API shape on the back-end and need to update the CLI to match.
WHAT is this pull request doing?
This changes the
CreateAppVersion
GraphQL call to use the updatedAppVersionInput
data shape. I've also added anAppVersionSourceWithUrl
interface to help to ensure that we're conforming to the API locally. See the previous PR for a brief discussion of that.We also didn't have any tests for the
deploy
command, so I've added some.How to test your changes?
p shopify app init
p shopify app deploy
- which will exercise the non-source-url branchp shopify app generate extension
and pick e.g. Admin Action or another extension that uses assets.p shopify app deploy
- which will exercise the source-url branchPost-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist