Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/shopify

src/types.ts

46 lines · 1.1 KB · TypeScript
/**
 * Shared request options accepted by every authenticated Shopify helper.
 *
 * `shop` is the `*.myshopify.com` handle. After you fork this package, you can
 * persist a default with `./config` and omit `shop` on later calls.
 */
export type ShopifyClientOptions = {
	/** Shop handle, hostname, or admin URL. Example: `acme` or `acme.myshopify.com`. */
	shop?: string
	/** Admin API version. Defaults to `2026-07`. */
	apiVersion?: string
}

export type ShopifyPageInfo = {
	hasNextPage: boolean
	hasPreviousPage: boolean
	startCursor: string | null
	endCursor: string | null
}

export type ShopifyUserError = {
	field: Array<string> | null
	message: string
}

export type Money = {
	amount: string
	currencyCode: string
}

export type DryRunResult<T> = {
	dryRun: true
	wouldCall: T
}

/**
 * Describes the shared type exports for the Shopify package.
 */
export default function describeShopifyTypes() {
	return {
		ShopifyClientOptions: '{ shop?: string; apiVersion?: string }',
		ShopifyPageInfo:
			'{ hasNextPage, hasPreviousPage, startCursor, endCursor }',
		note: 'Import named types from this module; do not invoke it for runtime work.',
	}
}