|
1 | | -export interface StoreInfoStoreOwner { |
2 | | - name?: string |
3 | | - email?: string |
4 | | -} |
| 1 | +import {defineJsonOutputSchema, type InferJsonOutputSchema} from '@shopify/cli-kit/node/json-output-schema' |
| 2 | +import {zod} from '@shopify/cli-kit/node/schema' |
5 | 3 |
|
6 | | -export interface StoreInfoResult { |
7 | | - id?: string |
8 | | - displayName?: string |
9 | | - subdomain: string |
10 | | - organizationId?: string |
11 | | - organizationName?: string |
12 | | - storeOwner?: StoreInfoStoreOwner |
13 | | - type?: string |
14 | | - // Admin API public display name for store-auth stores, or public plan handle for BP-backed stores. |
15 | | - plan?: string |
16 | | - featurePreview?: string |
17 | | - adminUrl?: string |
18 | | - accessUrl?: string |
19 | | - saveUrl?: string |
20 | | - // Preapproved Admin API access scopes for the store (currently only preview stores, which |
21 | | - // cache the scopes granted at creation time). Preview stores aren't a logged-in experience, so |
22 | | - // there's no way to grant additional scopes later. |
23 | | - authScopes?: string[] |
24 | | -} |
| 4 | +const StoreInfoStoreOwnerSchema = zod.object({ |
| 5 | + name: zod.string().optional(), |
| 6 | + email: zod.string().optional(), |
| 7 | +}) |
| 8 | + |
| 9 | +export const storeInfoJsonOutputSchema = defineJsonOutputSchema({ |
| 10 | + name: 'StoreInfoResult', |
| 11 | + schema: zod.object({ |
| 12 | + id: zod.string().optional(), |
| 13 | + displayName: zod.string().optional(), |
| 14 | + subdomain: zod.string(), |
| 15 | + organizationId: zod.string().optional(), |
| 16 | + organizationName: zod.string().optional(), |
| 17 | + storeOwner: StoreInfoStoreOwnerSchema.optional(), |
| 18 | + type: zod.string().optional(), |
| 19 | + // Admin API public display name for store-auth stores, or public plan handle for BP-backed stores. |
| 20 | + plan: zod.string().optional(), |
| 21 | + featurePreview: zod.string().optional(), |
| 22 | + adminUrl: zod.string().optional(), |
| 23 | + accessUrl: zod.string().optional(), |
| 24 | + saveUrl: zod.string().optional(), |
| 25 | + // Preapproved Admin API access scopes for preview stores. Preview stores aren't a logged-in |
| 26 | + // experience, so there's no way to grant additional scopes later. |
| 27 | + authScopes: zod.array(zod.string()).optional(), |
| 28 | + }), |
| 29 | + definitions: {StoreInfoStoreOwner: StoreInfoStoreOwnerSchema}, |
| 30 | +}) |
| 31 | + |
| 32 | +export type StoreInfoStoreOwner = zod.infer<typeof StoreInfoStoreOwnerSchema> |
| 33 | +export type StoreInfoResult = InferJsonOutputSchema<typeof storeInfoJsonOutputSchema> |
0 commit comments