Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {TypedDocumentNode as DocumentNode} from '@graphql-typed-document-node/co
export type DevSessionCreateMutationVariables = Types.Exact<{
appId: Types.Scalars['String']['input']
assetsUrl: Types.Scalars['String']['input']
clientState?: Types.InputMaybe<Types.Scalars['JSON']['input']>
}>

export type DevSessionCreateMutation = {
Expand All @@ -33,6 +34,11 @@ export const DevSessionCreate = {
variable: {kind: 'Variable', name: {kind: 'Name', value: 'assetsUrl'}},
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'String'}}},
},
{
kind: 'VariableDefinition',
variable: {kind: 'Variable', name: {kind: 'Name', value: 'clientState'}},
type: {kind: 'NamedType', name: {kind: 'Name', value: 'JSON'}},
},
],
selectionSet: {
kind: 'SelectionSet',
Expand All @@ -51,6 +57,11 @@ export const DevSessionCreate = {
name: {kind: 'Name', value: 'assetsUrl'},
value: {kind: 'Variable', name: {kind: 'Name', value: 'assetsUrl'}},
},
{
kind: 'Argument',
name: {kind: 'Name', value: 'clientState'},
value: {kind: 'Variable', name: {kind: 'Name', value: 'clientState'}},
},
],
selectionSet: {
kind: 'SelectionSet',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mutation DevSessionCreate($appId: String!, $assetsUrl: String!) {
devSessionCreate(appId: $appId, assetsUrl: $assetsUrl) {
mutation DevSessionCreate($appId: String!, $assetsUrl: String!, $clientState: JSON) {
devSessionCreate(appId: $appId, assetsUrl: $assetsUrl, clientState: $clientState) {
userErrors {
message
on
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* eslint-disable @typescript-eslint/consistent-type-definitions, @typescript-eslint/naming-convention, @typescript-eslint/no-explicit-any */
import {JsonMapType} from '@shopify/cli-kit/node/toml'

export type Maybe<T> = T | null
export type InputMaybe<T> = Maybe<T>
export type Exact<T extends {[key: string]: unknown}> = {[K in keyof T]: T[K]}
Expand Down Expand Up @@ -42,8 +40,6 @@ export type Scalars = {
ISO8601Date: {input: any; output: any}
/** An ISO 8601-encoded datetime */
ISO8601DateTime: {input: any; output: any}
/** Represents untyped JSON */
JSON: {input: JsonMapType | string; output: JsonMapType}
/** The ID for a LegalEntity. */
LegalEntityID: {input: any; output: any}
/** The ID for a OrganizationDomain. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export class DevSession {
assetsUrl: signedURL,
manifest,
inheritedModuleUids,
clientState: {my_key: 'my_value'},
}
if (this.statusManager.status.isReady) {
return this.devSessionUpdateWithRetry(payload)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ interface DevSessionSharedOptions {
export interface DevSessionCreateOptions extends DevSessionSharedOptions {
assetsUrl?: string
manifest: AppManifest
clientState?: JsonMapType
}

export interface DevSessionUpdateOptions extends DevSessionSharedOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1013,12 +1013,17 @@ export class AppManagementClient implements DeveloperPlatformClient {
return appDeepLink({id, organizationId})
}

async devSessionCreate({appId, assetsUrl, shopFqdn}: DevSessionCreateOptions): Promise<DevSessionCreateMutation> {
async devSessionCreate({
appId,
assetsUrl,
shopFqdn,
clientState,
}: DevSessionCreateOptions): Promise<DevSessionCreateMutation> {
const appIdNumber = String(numberFromGid(appId))
return this.appDevRequest({
query: DevSessionCreate,
shopFqdn,
variables: {appId: appIdNumber, assetsUrl: assetsUrl ?? ''},
variables: {appId: appIdNumber, assetsUrl: assetsUrl ?? '', clientState},
requestOptions: {requestMode: 'slow-request'},
})
}
Expand Down
Loading