@ehrenkind/shopify-lib 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated-api-types/2025-04/admin.generated.d.ts +14 -2
- package/dist/generated-api-types/2025-04/admin.generated.d.ts.map +1 -1
- package/dist/generated-api-types/2025-04/admin.types.d.ts +12 -11
- package/dist/generated-api-types/2025-04/admin.types.d.ts.map +1 -1
- package/dist/generated-api-types/2025-04/admin.types.js +3 -3
- package/dist/generated-api-types/2025-04/admin.types.js.map +1 -1
- package/dist/index.cjs +63 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -39
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -42
- package/dist/index.mjs.map +1 -1
- package/dist/mutations/orders/cancelOrderById.d.ts +23 -0
- package/dist/mutations/orders/cancelOrderById.d.ts.map +1 -0
- package/dist/mutations/orders/cancelOrderById.js +63 -0
- package/dist/mutations/orders/cancelOrderById.js.map +1 -0
- package/dist/mutations/orders/cancelOrderById.mock.d.ts +15 -0
- package/dist/mutations/orders/cancelOrderById.mock.d.ts.map +1 -0
- package/dist/mutations/orders/cancelOrderById.mock.js +17 -0
- package/dist/mutations/orders/cancelOrderById.mock.js.map +1 -0
- package/dist/mutations/orders/cancelOrderById.test.d.ts +2 -0
- package/dist/mutations/orders/cancelOrderById.test.d.ts.map +1 -0
- package/dist/mutations/orders/cancelOrderById.test.js +42 -0
- package/dist/mutations/orders/cancelOrderById.test.js.map +1 -0
- package/dist/queries/orders/getOrderById.d.ts +2 -2
- package/dist/queries/orders/getOrderById.d.ts.map +1 -1
- package/dist/queries/orders/getOrderById.mock.d.ts +1 -1
- package/dist/queries/orders/getOrderById.mock.d.ts.map +1 -1
- package/dist/queries/orders/getOrderById.mock.js +1 -0
- package/dist/queries/orders/getOrderById.mock.js.map +1 -1
- package/dist/queries/orders/getOrderById.queries.d.ts.map +1 -1
- package/dist/queries/orders/getOrderById.queries.js +1 -0
- package/dist/queries/orders/getOrderById.queries.js.map +1 -1
- package/dist/utils/mswHandlers.d.ts +6 -0
- package/dist/utils/mswHandlers.d.ts.map +1 -1
- package/dist/utils/mswHandlers.js +5 -2
- package/dist/utils/mswHandlers.js.map +1 -1
- package/dist/utils/shopifyFetch.d.ts +24 -3
- package/dist/utils/shopifyFetch.d.ts.map +1 -1
- package/dist/utils/shopifyFetch.js +23 -1
- package/dist/utils/shopifyFetch.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mutations/customers/deleteCustomerById.ts","../src/utils/logger.ts","../src/utils/shopifyClient.ts","../src/utils/shopifyFetch.ts","../src/utils/zod.ts","../src/queries/orders/getOrderById.ts","../src/queries/orders/getOrderById.queries.ts","../src/queries/orders/getOrderByName.ts","../src/queries/orders/getOrderByName.queries.ts","../src/queries/productVariants/getLeanProductVariants.ts","../src/queries/orders/getOrderPaymentDetails.ts","../src/queries/orders/getOrderPaymentDetails.queries.ts","../src/utils/toRestFormat.ts","../src/utils/parseGid.ts"],"sourcesContent":["import z from 'zod'\nimport type {\n CustomerDeleteMutation,\n CustomerDeleteMutationVariables,\n} from '../../generated-api-types/2025-04/admin.generated'\nimport { gql } from '../../utils/logger'\nimport { fetchShopifyGraphql } from '../../utils/shopifyFetch'\nimport { returnOutputParsed } from '../../utils/zod'\n\nexport const DeleteCustomerByIdReturn = z.string().nullable()\n\ntype SingleNode = { deletedCustomerId: string | null }\n\nexport async function deleteCustomerById(\n customerId: string,\n): Promise<z.infer<typeof DeleteCustomerByIdReturn>> {\n const mutation = gql`#graphql\n mutation customerDelete($input: CustomerDeleteInput!) {\n customerDelete(input: $input) {\n deletedCustomerId\n userErrors {\n field\n message\n }\n }\n }\n `\n\n const variables: CustomerDeleteMutationVariables = {\n input: { id: customerId },\n }\n\n const response = await fetchShopifyGraphql<\n SingleNode,\n CustomerDeleteMutation\n >({\n query: mutation,\n variables,\n dataExtractor: (data: CustomerDeleteMutation) => {\n if (!data.customerDelete) {\n throw new Error(\"GraphQL response missing 'customerDelete' field\")\n }\n return {\n nodes: [\n { deletedCustomerId: data.customerDelete.deletedCustomerId ?? null },\n ],\n userErrors: data.customerDelete.userErrors,\n }\n },\n })\n\n return returnOutputParsed(\n response[0]?.deletedCustomerId ?? null,\n DeleteCustomerByIdReturn,\n )\n}\n","const { env } = process\n\nexport const gql = String.raw\n\nconst logLevels = {\n silent: 0,\n error: 1,\n warn: 2,\n info: 3,\n debug: 4,\n} as const\n\ntype LogLevelName = keyof typeof logLevels\n\nfunction getLogLevel(\n nodeEnv: string | undefined,\n logLevelEnv: string | undefined,\n): LogLevelName {\n if (logLevelEnv && logLevelEnv in logLevels) {\n return logLevelEnv as LogLevelName\n }\n\n if (nodeEnv === 'test') {\n return 'silent'\n }\n\n if (nodeEnv === 'production') {\n return 'info'\n }\n return 'debug'\n}\n\nexport const activeLogLevelName = getLogLevel(env.NODE_ENV, env.LOG_LEVEL)\nconst activeLogLevelValue = logLevels[activeLogLevelName]\n\nexport const logger = {\n debug: (...args: unknown[]) => {\n if (logLevels.debug <= activeLogLevelValue) {\n // biome-ignore lint/suspicious/noConsole: <explanation>\n console.debug(...args)\n }\n },\n info: (...args: unknown[]) => {\n if (logLevels.info <= activeLogLevelValue) {\n // biome-ignore lint/suspicious/noConsole: <explanation>\n console.info(...args)\n }\n },\n warn: (...args: unknown[]) => {\n if (logLevels.warn <= activeLogLevelValue) {\n // biome-ignore lint/suspicious/noConsole: <explanation>\n console.warn(...args)\n }\n },\n error: (...args: unknown[]) => {\n if (logLevels.error <= activeLogLevelValue) {\n // biome-ignore lint/suspicious/noConsole: <explanation>\n console.error(...args)\n }\n },\n}\n","import {\n ApiVersion,\n type GraphqlClient,\n LogSeverity,\n Session,\n shopifyApi,\n} from '@shopify/shopify-api'\nimport '@shopify/shopify-api/adapters/node'\nimport dotenv from 'dotenv'\nimport { z } from 'zod'\nimport { activeLogLevelName, logger } from './logger.js'\n\n// https://shopify.dev/docs/api/admin-graphql/2025-04/\nexport const SHOPIFY_API_VERSION = ApiVersion.April25\n\ndotenv.config()\n\nconst envSchema = z.object({\n SHOPIFY_API_KEY: z.string({\n required_error: 'SHOPIFY_API_KEY is required',\n }),\n SHOPIFY_API_SECRET: z.string({\n required_error: 'SHOPIFY_API_SECRET is required',\n }),\n SHOPIFY_API_HOSTNAME: z.string({\n required_error: 'SHOPIFY_API_HOSTNAME is required',\n }),\n SHOPIFY_ACCESS_TOKEN: z.string({\n required_error: 'SHOPIFY_ACCESS_TOKEN is required',\n }),\n NODE_ENV: z\n .enum(['development', 'production', 'test'])\n .default('development'),\n})\n\nconst mapLogLevelToShopifySeverity = (level: string): LogSeverity => {\n switch (level) {\n case 'silent':\n return LogSeverity.Error\n case 'debug':\n return LogSeverity.Debug\n case 'info':\n return LogSeverity.Info\n case 'warn':\n return LogSeverity.Warning\n case 'error':\n return LogSeverity.Error\n default:\n return LogSeverity.Info\n }\n}\n\nlet shopifyGraphqlClient: GraphqlClient\n\ntry {\n // biome-ignore lint/nursery/noProcessEnv: <explanation>\n const env = envSchema.parse(process.env)\n\n const shopify = shopifyApi({\n apiKey: env.SHOPIFY_API_KEY,\n apiSecretKey: env.SHOPIFY_API_SECRET,\n hostName: env.SHOPIFY_API_HOSTNAME,\n apiVersion: SHOPIFY_API_VERSION,\n isEmbeddedApp: false,\n logger: { level: mapLogLevelToShopifySeverity(activeLogLevelName) },\n future: {\n customerAddressDefaultFix: true,\n lineItemBilling: true,\n unstable_managedPricingSupport: false,\n },\n })\n\n const shopifySession = new Session({\n id: `custom-session-${env.SHOPIFY_API_HOSTNAME}`,\n shop: env.SHOPIFY_API_HOSTNAME,\n state: 'authenticated',\n isOnline: true,\n accessToken: env.SHOPIFY_ACCESS_TOKEN,\n })\n\n shopifyGraphqlClient = new shopify.clients.Graphql({\n session: shopifySession,\n })\n\n logger.info('Shopify API client initialized successfully.')\n} catch (error) {\n if (error instanceof z.ZodError) {\n const msg = JSON.stringify(error.format(), null, 2)\n logger.error(msg)\n } else {\n logger.error('Failed to initialize Shopify API client:', error)\n }\n throw error\n}\n\nexport { shopifyGraphqlClient as shopifyClient }\n","import { logger } from './logger.js'\nimport { shopifyClient } from './shopifyClient.js'\n\nexport function convertIdIntoGid(\n id: bigint,\n type: 'Order' | 'Customer',\n): string {\n return `gid://shopify/${type}/${id}`\n}\n\ninterface PageInfo {\n hasNextPage: boolean\n endCursor?: string | null | undefined\n}\n\ninterface ShopifyErrorWithMessage {\n message?: string\n [key: string]: unknown\n}\n\ntype TExtractorFunctionType<TResultNode, TPageData> = (pageData: TPageData) => {\n nodes: TResultNode[]\n pageInfo?: PageInfo\n userErrors?: { message?: string }[]\n}\n\nexport async function fetchShopifyGraphql<TResultNode, TPageData>(params: {\n query: string\n variables: Record<string, unknown>\n dataExtractor?: TExtractorFunctionType<TResultNode, TPageData>\n fetchAllPages?: boolean\n}): Promise<TResultNode[]>\nexport async function fetchShopifyGraphql<TReturnType>(params: {\n query: string\n variables: Record<string, unknown>\n}): Promise<TReturnType>\nexport async function fetchShopifyGraphql<\n TResultNode,\n TPageData,\n TReturnType,\n>(params: {\n query: string\n variables: Record<string, unknown>\n dataExtractor?: TExtractorFunctionType<TResultNode, TPageData>\n fetchAllPages?: boolean\n}): Promise<TResultNode[] | TReturnType> {\n const {\n query,\n variables: initialVariables,\n dataExtractor,\n fetchAllPages = false,\n } = params\n\n let currentVariables = { ...initialVariables }\n\n if (!dataExtractor) {\n return makeRequest<NonNullable<TReturnType>>(query, currentVariables)\n }\n\n const allNodes: TResultNode[] = []\n let hasNextLoop = true\n\n do {\n const response = await makeRequest<TPageData>(query, currentVariables)\n const { nodes, pageInfo, userErrors } = dataExtractor(response)\n\n // Handle Shopify mutation userErrors pattern\n if (Array.isArray(userErrors) && userErrors.length > 0) {\n const errorMessages = userErrors\n .map((e) => e.message || JSON.stringify(e))\n .join('\\n')\n logger.error('Shopify mutation userErrors:', errorMessages)\n throw new Error(`Shopify mutation userErrors: ${errorMessages}`)\n }\n\n allNodes.push(...nodes)\n\n hasNextLoop = fetchAllPages ? !!pageInfo?.hasNextPage : false\n if (hasNextLoop && pageInfo?.endCursor) {\n currentVariables = {\n ...currentVariables,\n after: pageInfo.endCursor,\n }\n }\n } while (hasNextLoop)\n\n return allNodes\n}\n\nasync function makeRequest<TReturnDataType>(\n query: string,\n variables: Record<string, unknown>,\n): Promise<NonNullable<TReturnDataType>> {\n type ShopifyRequestErrorType = {\n errors?: ShopifyErrorWithMessage | ShopifyErrorWithMessage[]\n }\n\n const response = (await shopifyClient.request<TReturnDataType>(query, {\n variables,\n })) as { data?: TReturnDataType } & ShopifyRequestErrorType\n\n if (response.errors) {\n let errorMessages = 'GraphQL query failed.'\n const errors = response.errors\n if (Array.isArray(errors)) {\n errorMessages = errors\n .map((e: ShopifyErrorWithMessage) => e.message || JSON.stringify(e))\n .join('\\n')\n } else if (\n typeof errors === 'object' &&\n errors !== null &&\n 'message' in errors\n ) {\n errorMessages = errors.message || JSON.stringify(errors)\n } else if (typeof errors === 'string') {\n errorMessages = errors\n } else {\n errorMessages = JSON.stringify(errors)\n }\n logger.error('GraphQL query failed:', errorMessages)\n throw new Error(`GraphQL errors: ${errorMessages}`)\n }\n\n if (!response.data) {\n throw new Error('No data in Shopify API response')\n }\n\n return response.data\n}\n","import z from 'zod'\nimport { logger } from './logger.js'\n\nexport async function returnOutputParsed<T>(\n data: unknown,\n Model: z.ZodType<T>,\n) {\n const parsed = await Model.safeParseAsync(data)\n if (!parsed.success) {\n if (parsed.error instanceof z.ZodError) {\n const msg = JSON.stringify(parsed.error.format(), null, 2)\n logger.error(msg)\n } else {\n logger.error('Failed to parse:', parsed.error)\n }\n // throw parsedVariants.error\n throw new Error('Failed to parse product variants')\n }\n logger.info('Parsed data successfully')\n return parsed.data\n}\n","import z from 'zod'\nimport type {\n OrderByIdFullQuery,\n OrderByIdQuery,\n OrderByIdQueryVariables,\n} from '../../generated-api-types/2025-04/admin.generated.js'\nimport { logger } from '../../utils/logger.js'\nimport {\n convertIdIntoGid,\n fetchShopifyGraphql,\n} from '../../utils/shopifyFetch.js'\nimport { returnOutputParsed } from '../../utils/zod.js'\nimport { queryOrderById, queryOrderByIdFull } from './getOrderById.queries.js'\n\n// Address schema (shared between lean and full)\nconst AddressSchema = z\n .object({\n firstName: z.string().nullable(),\n lastName: z.string().nullable(),\n address1: z.string().nullable(),\n address2: z.string().nullable(),\n city: z.string().nullable(),\n province: z.string().nullable(),\n country: z.string().nullable(),\n zip: z.string().nullable(),\n })\n .nullable()\n\n// Lean order schema\nconst GetLeanOrderByIdReturn = z\n .object({\n id: z.string(),\n name: z.string(),\n createdAt: z.string(),\n updatedAt: z.string(),\n cancelledAt: z.string().nullable(),\n cancelReason: z.string().nullable(),\n totalPrice: z.object({\n amount: z.string(),\n currencyCode: z.string(),\n }),\n customer: z\n .object({\n id: z.string(),\n displayName: z.string(),\n firstName: z.string().nullable(),\n lastName: z.string().nullable(),\n emailAddress: z.string().nullable(),\n })\n .nullable(),\n financialStatus: z.string().nullable(),\n fulfillmentStatus: z.string().nullable(),\n shippingAddress: AddressSchema,\n })\n .nullable()\n\nexport type LeanOrder = z.infer<typeof GetLeanOrderByIdReturn>\n\n// Full order type - derived from the generated GraphQL types\nexport type FullOrder = NonNullable<OrderByIdFullQuery['order']> | null\n\ntype OrderDetailLevel = 'lean' | 'full'\n\n// Function overloads\nexport function getOrderById(id: number | bigint): Promise<LeanOrder>\nexport function getOrderById(\n id: number | bigint,\n detailLevel: 'lean',\n): Promise<LeanOrder>\nexport function getOrderById(\n id: number | bigint,\n detailLevel: 'full',\n): Promise<FullOrder>\n\n/**\n * Retrieves a single order from Shopify by its numeric ID.\n * Returns null if no order is found with the specified ID.\n *\n * @param {number | bigint} id - The numerical Shopify order ID (e.g., 12345678 or 12345678n).\n * @param {OrderDetailLevel} detailLevel - The level of detail to return ('lean' or 'full'). Defaults to 'lean'.\n * @returns {Promise<LeanOrder | FullOrder>} A promise that resolves to the order data or null if not found.\n * @throws {Error} If the GraphQL query fails or if the response structure is invalid.\n */\nexport async function getOrderById(\n id: number | bigint,\n detailLevel: OrderDetailLevel = 'lean',\n): Promise<LeanOrder | FullOrder> {\n const bigIntId = typeof id === 'number' ? BigInt(id) : id\n if (detailLevel === 'lean') {\n return getLeanOrderById(bigIntId)\n }\n return getFullOrderById(bigIntId)\n}\n\nasync function getLeanOrderById(id: bigint): Promise<LeanOrder> {\n const variables: OrderByIdQueryVariables = {\n id: convertIdIntoGid(id, 'Order'),\n }\n\n const response = await fetchShopifyGraphql<OrderByIdQuery>({\n query: queryOrderById,\n variables,\n })\n\n if (!response.order) {\n logger.debug(`No order found with ID: ${id}`)\n return null\n }\n\n const order = response.order\n\n const leanOrder = {\n id: order.id,\n name: order.name,\n createdAt: order.createdAt,\n updatedAt: order.updatedAt,\n cancelledAt: order.cancelledAt ?? null,\n cancelReason: order.cancelReason ?? null,\n totalPrice: {\n amount: order.totalPriceSet?.shopMoney?.amount ?? '',\n currencyCode: order.totalPriceSet?.shopMoney?.currencyCode ?? '',\n },\n customer: order.customer\n ? {\n id: order.customer.id,\n displayName: order.customer.displayName,\n firstName: order.customer.firstName ?? null,\n lastName: order.customer.lastName ?? null,\n emailAddress:\n order.customer.defaultEmailAddress?.emailAddress ?? null,\n }\n : null,\n financialStatus: order.displayFinancialStatus ?? null,\n fulfillmentStatus: order.displayFulfillmentStatus ?? null,\n shippingAddress: order.shippingAddress\n ? {\n firstName: order.shippingAddress.firstName ?? null,\n lastName: order.shippingAddress.lastName ?? null,\n address1: order.shippingAddress.address1 ?? null,\n address2: order.shippingAddress.address2 ?? null,\n city: order.shippingAddress.city ?? null,\n province: order.shippingAddress.province ?? null,\n country: order.shippingAddress.country ?? null,\n zip: order.shippingAddress.zip ?? null,\n }\n : null,\n }\n\n return await returnOutputParsed(leanOrder, GetLeanOrderByIdReturn)\n}\n\nasync function getFullOrderById(id: bigint): Promise<FullOrder> {\n const variables: OrderByIdQueryVariables = {\n id: convertIdIntoGid(id, 'Order'),\n }\n\n const response = await fetchShopifyGraphql<OrderByIdFullQuery>({\n query: queryOrderByIdFull,\n variables,\n })\n\n if (!response.order) {\n logger.debug(`No order found with ID: ${id}`)\n return null\n }\n\n return response.order\n}\n","import { gql } from '../../utils/logger'\n\nexport const queryOrderById = gql`#graphql\n query orderById($id: ID!) {\n order(id: $id) {\n id\n name\n createdAt\n updatedAt\n cancelledAt\n cancelReason\n totalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n customer {\n id\n lastName\n defaultEmailAddress {\n emailAddress\n }\n displayName\n firstName\n }\n displayFinancialStatus\n displayFulfillmentStatus\n shippingAddress {\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n }\n }\n }\n`\n\nexport const queryOrderByIdFull = gql`#graphql\n query orderByIdFull($id: ID!) {\n order(id: $id) {\n id\n name\n createdAt\n updatedAt\n processedAt\n closedAt\n cancelledAt\n cancelReason\n totalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n customer {\n id\n firstName\n lastName\n email\n phone\n }\n displayFinancialStatus\n displayFulfillmentStatus\n shippingAddress {\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n }\n billingAddress {\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n }\n lineItems(first: 100) {\n edges {\n node {\n id\n sku\n title\n variantTitle\n quantity\n customAttributes {\n key\n value\n }\n originalUnitPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n vendor\n image {\n url\n width\n height\n altText\n }\n }\n }\n }\n fulfillments {\n id\n name\n totalQuantity\n status\n createdAt\n estimatedDeliveryAt\n deliveredAt\n trackingInfo {\n company\n number\n url\n }\n fulfillmentLineItems(first: 100) {\n edges {\n node {\n id\n quantity\n lineItem {\n id\n }\n }\n }\n }\n }\n shippingLine {\n originalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n taxLines {\n priceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n totalDiscountsSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n discountCodes\n refunds {\n totalRefundedSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n }\n`\n","import z from 'zod'\nimport type {\n OrdersByNameFullQuery,\n OrdersByNameQuery,\n OrdersByNameQueryVariables,\n} from '../../generated-api-types/2025-04/admin.generated.js'\nimport { logger } from '../../utils/logger.js'\nimport { fetchShopifyGraphql } from '../../utils/shopifyFetch.js'\nimport { returnOutputParsed } from '../../utils/zod.js'\nimport {\n queryOrdersByName,\n queryOrdersByNameFull,\n} from './getOrderByName.queries.js'\n\nconst GetLeanOrderByNameReturn = z\n .object({\n id: z.string(),\n name: z.string(),\n createdAt: z.string(),\n updatedAt: z.string(),\n totalPrice: z.object({\n amount: z.string(),\n currencyCode: z.string(),\n }),\n customer: z\n .object({\n id: z.string(),\n displayName: z.string(),\n emailAddress: z.string().nullable(),\n })\n .nullable(),\n financialStatus: z.string().nullable(),\n fulfillmentStatus: z.string().nullable(),\n })\n .nullable()\n\nexport type LeanOrderByName = z.infer<typeof GetLeanOrderByNameReturn>\n\nexport type FullOrderByName = NonNullable<\n NonNullable<OrdersByNameFullQuery['orders']>['edges'][number]['node']\n> | null\n\ntype OrderDetailLevel = 'lean' | 'full'\n\n// Function overloads\nexport function getOrderByName(\n orderName: string,\n detailLevel: 'lean',\n): Promise<LeanOrderByName>\nexport function getOrderByName(\n orderName: string,\n detailLevel: 'full',\n): Promise<FullOrderByName>\nexport function getOrderByName(orderName: string): Promise<LeanOrderByName>\n\n/**\n * Retrieves a single order from Shopify by its order name (e.g., \"B12345\").\n * Returns null if no order is found with the specified name.\n *\n * @param {string} orderName - The order name to search for (e.g., \"B12345\").\n * @param {OrderDetailLevel} detailLevel - The level of detail to return ('lean' or 'full'). Defaults to 'lean'.\n * @returns {Promise<LeanOrderByName | FullOrderByName>} A promise that resolves to the order data or null if not found.\n * @throws {Error} If the GraphQL query fails or if the response structure is invalid.\n */\nexport async function getOrderByName(\n orderName: string,\n detailLevel: OrderDetailLevel = 'lean',\n): Promise<LeanOrderByName | FullOrderByName> {\n if (detailLevel === 'lean') {\n return getLeanOrderByName(orderName)\n }\n return getFullOrderByName(orderName)\n}\n\nasync function getLeanOrderByName(orderName: string): Promise<LeanOrderByName> {\n const variables: OrdersByNameQueryVariables = {\n first: 1,\n queryFilter: `name:${orderName}`,\n }\n\n type SingleNode = NonNullable<\n NonNullable<OrdersByNameQuery['orders']>['edges'][number]['node']\n >\n\n const extractedNodes = await fetchShopifyGraphql<\n SingleNode,\n OrdersByNameQuery\n >({\n query: queryOrdersByName,\n variables,\n dataExtractor: (pageData: OrdersByNameQuery) => {\n if (!pageData.orders) {\n throw new Error(\n \"GraphQL response for orders is missing the 'orders' field.\",\n )\n }\n const nodes: SingleNode[] = pageData.orders.edges.map(\n (edge: { node: SingleNode }) => edge.node,\n )\n return {\n nodes,\n }\n },\n fetchAllPages: false,\n })\n\n const order = extractedNodes[0]\n if (!order) {\n logger.debug(`No order found with name: ${orderName}`)\n return null\n }\n\n const leanOrder = {\n id: order.id,\n name: order.name,\n createdAt: order.createdAt,\n updatedAt: order.updatedAt,\n totalPrice: {\n amount: order.totalPriceSet?.shopMoney?.amount ?? '',\n currencyCode: order.totalPriceSet?.shopMoney?.currencyCode ?? '',\n },\n customer: order.customer\n ? {\n id: order.customer.id,\n displayName: order.customer.displayName,\n emailAddress:\n order.customer.defaultEmailAddress?.emailAddress ?? null,\n }\n : null,\n financialStatus: order.displayFinancialStatus ?? null,\n fulfillmentStatus: order.displayFulfillmentStatus ?? null,\n }\n\n return await returnOutputParsed(leanOrder, GetLeanOrderByNameReturn)\n}\n\nasync function getFullOrderByName(orderName: string): Promise<FullOrderByName> {\n const variables: OrdersByNameQueryVariables = {\n first: 1,\n queryFilter: `name:${orderName}`,\n }\n\n type SingleNode = NonNullable<\n NonNullable<OrdersByNameFullQuery['orders']>['edges'][number]['node']\n >\n\n const extractedNodes = await fetchShopifyGraphql<\n SingleNode,\n OrdersByNameFullQuery\n >({\n query: queryOrdersByNameFull,\n variables,\n dataExtractor: (pageData: OrdersByNameFullQuery) => {\n if (!pageData.orders) {\n throw new Error(\n \"GraphQL response for orders is missing the 'orders' field.\",\n )\n }\n const nodes: SingleNode[] = pageData.orders.edges.map(\n (edge: { node: SingleNode }) => edge.node,\n )\n return {\n nodes,\n }\n },\n fetchAllPages: false,\n })\n\n if (extractedNodes.length === 0) {\n logger.debug(`No order found with name: ${orderName}`)\n return null\n }\n\n const order = extractedNodes[0]\n if (!order) {\n logger.debug(`No order found with name: ${orderName}`)\n return null\n }\n\n return order\n}\n","import { gql } from '../../utils/logger'\n\nexport const queryOrdersByName = gql`#graphql\n query ordersByName($first: Int!, $queryFilter: String!) {\n orders(first: $first, query: $queryFilter) {\n edges {\n node {\n id\n name\n createdAt\n updatedAt\n totalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n customer {\n id\n lastName\n defaultEmailAddress {\n emailAddress\n }\n displayName\n firstName\n }\n displayFinancialStatus\n displayFulfillmentStatus\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`\n\nexport const queryOrdersByNameFull = gql`#graphql\n query ordersByNameFull($first: Int!, $queryFilter: String!) {\n orders(first: $first, query: $queryFilter) {\n edges {\n node {\n billingAddress {\n address1\n address2\n city\n company\n country\n countryCodeV2\n firstName\n formattedArea\n id\n lastName\n name\n phone\n province\n provinceCode\n timeZone\n zip\n }\n billingAddressMatchesShippingAddress\n cancelReason\n cancellation {\n staffNote\n }\n cancelledAt\n capturable\n clientIp\n closed\n closedAt\n confirmed\n createdAt\n currencyCode\n currentCartDiscountAmountSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentShippingPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentSubtotalLineItemsQuantity\n currentSubtotalPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTaxLines {\n channelLiable\n rate\n ratePercentage\n source\n title\n priceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n currentTotalAdditionalFeesSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTotalDiscountsSet {\n presentmentMoney {\n amount\n currencyCode\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTotalDutiesSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTotalPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTotalTaxSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTotalWeight\n customer {\n id\n lastName\n defaultEmailAddress {\n emailAddress\n }\n displayName\n firstName\n }\n customerAcceptsMarketing\n discountCodes\n discountCode\n displayAddress {\n address1\n address2\n city\n company\n country\n countryCodeV2\n firstName\n formattedArea\n id\n lastName\n name\n phone\n province\n provinceCode\n timeZone\n zip\n }\n displayFinancialStatus\n displayFulfillmentStatus\n dutiesIncluded\n edited\n email\n estimatedTaxes\n fulfillable\n fulfillments(first: 20) {\n createdAt\n deliveredAt\n displayStatus\n estimatedDeliveryAt\n updatedAt\n trackingInfo(first: 10) {\n company\n url\n }\n totalQuantity\n status\n name\n id\n }\n fullyPaid\n id\n lineItems(first: 50) {\n edges {\n node {\n id\n name\n originalUnitPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n quantity\n requiresShipping\n sku\n title\n variantTitle\n }\n }\n }\n name\n note\n processedAt\n shippingAddress {\n address1\n address2\n city\n company\n country\n countryCodeV2\n firstName\n formattedArea\n id\n lastName\n name\n phone\n province\n provinceCode\n timeZone\n zip\n }\n statusPageUrl\n tags\n totalPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n totalReceivedSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n totalRefundedSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n totalShippingPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n totalTaxSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n totalWeight\n unpaid\n updatedAt\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`\n","import z from 'zod'\nimport type {\n LeanProductVariantsQuery,\n LeanProductVariantsQueryVariables,\n} from '../../generated-api-types/2025-04/admin.generated.js'\nimport { gql, logger } from '../../utils/logger.js'\nimport { fetchShopifyGraphql } from '../../utils/shopifyFetch.js'\nimport { returnOutputParsed } from '../../utils/zod.js'\n\nconst GetLeanProductVariantsReturn = z.array(\n z.object({\n productId: z.string(),\n productTitle: z.string(),\n variantId: z.string(),\n variantTitle: z.string(),\n sku: z.string(),\n }),\n)\n\ntype GetLeanProductVariantsReturnType = z.infer<\n typeof GetLeanProductVariantsReturn\n>\n\n/**\n * Retrieves a lean list of product variants from Shopify, optionally filtered by SKUs.\n * Product variants are mapped to a simpler output structure.\n * Variants missing essential properties (e.g., SKU) will be filtered out and logged.\n *\n * @param {string[]} [skus] - An optional array of SKUs to filter by. If provided, only variants matching these SKUs will be fetched.\n * @returns {Promise<GetLeanProductVariantsReturnType>} A promise that resolves to an array of lean product variant data.\n * @throws {Error} If the GraphQL query fails, returns no data, or if the `productVariants` field is missing in the response.\n */\nexport async function getLeanProductVariants(\n skus?: string[],\n): Promise<GetLeanProductVariantsReturnType> {\n const queryGql = gql`#graphql\n query leanProductVariants($first: Int!, $after: String, $queryFilter: String) {\n productVariants(first: $first, after: $after, query: $queryFilter) {\n edges {\n node { \n id\n title\n sku\n product {\n id\n title\n }\n }\n }\n pageInfo { \n hasNextPage\n endCursor\n }\n }\n }\n `\n\n const initialVariables: LeanProductVariantsQueryVariables = { first: 250 }\n if (skus && skus.length > 0) {\n initialVariables.queryFilter = skus\n .map((sku: string) => `sku:${sku}`)\n .join(' OR ')\n }\n\n // Type for a single node from the productVariants query\n type SingleNode = NonNullable<\n NonNullable<\n LeanProductVariantsQuery['productVariants']\n >['edges'][number]['node']\n >\n\n const extractedNodes = await fetchShopifyGraphql<\n SingleNode,\n LeanProductVariantsQuery\n >({\n query: queryGql,\n variables: initialVariables,\n dataExtractor: (pageData: LeanProductVariantsQuery) => {\n if (!pageData.productVariants) {\n throw new Error(\n \"GraphQL response for product variants is missing the 'productVariants' field.\",\n )\n }\n const nodes: SingleNode[] = pageData.productVariants.edges.map(\n (edge: { node: SingleNode }) => edge.node,\n )\n return {\n nodes,\n pageInfo: pageData.productVariants.pageInfo,\n }\n },\n fetchAllPages: true,\n })\n\n const allVariants = extractedNodes.flatMap<\n GetLeanProductVariantsReturnType[number]\n >((v) => {\n if (v.sku) {\n return [\n {\n productId: v.product.id,\n productTitle: v.product.title,\n variantId: v.id,\n variantTitle: v.title,\n sku: v.sku,\n },\n ]\n }\n logger.debug(\n `Product ${v.product.title} (ID: ${v.product.id}) has a variant (ID: ${v.id}) with no SKU. Filtering out.`,\n )\n return []\n })\n\n return await returnOutputParsed(allVariants, GetLeanProductVariantsReturn)\n}\n","import z from 'zod'\nimport type {\n OrderPaymentDetailsByIdQuery,\n OrderPaymentDetailsByIdQueryVariables,\n} from '../../generated-api-types/2025-04/admin.generated.js'\nimport { logger } from '../../utils/logger.js'\nimport {\n convertIdIntoGid,\n fetchShopifyGraphql,\n} from '../../utils/shopifyFetch.js'\nimport { returnOutputParsed } from '../../utils/zod.js'\nimport { queryOrderPaymentDetails } from './getOrderPaymentDetails.queries.js'\n\nconst GetOrderPaymentDetailsByIdReturn = z.object({\n order: z.object({\n transactions: z.array(\n z.object({\n amountSet: z.object({\n shopMoney: z.object({\n amount: z.string(),\n currencyCode: z.string(),\n }),\n }),\n createdAt: z.string(),\n gateway: z.string(),\n formattedGateway: z.string(),\n kind: z.string(),\n paymentId: z.string(),\n }),\n ),\n }),\n})\n\ntype GetOrderPaymentDetailsByIdReturnType = z.infer<\n typeof GetOrderPaymentDetailsByIdReturn\n>\n\n/**\n * Retrieves payment details for a single order from Shopify by its ID.\n * Returns null if no order is found with the specified ID.\n *\n * @param {bigint} id - The numerical Shopify order ID (e.g., 12345678n).\n * @returns {Promise<GetOrderPaymentDetailsByIdReturnType | null>} A promise that resolves to the order payment data or null if not found.\n * @throws {Error} If the GraphQL query fails or if the response structure is invalid.\n */\nexport async function getOrderPaymentDetailsById(\n id: bigint,\n): Promise<GetOrderPaymentDetailsByIdReturnType | null> {\n const variables: OrderPaymentDetailsByIdQueryVariables = {\n id: convertIdIntoGid(id, 'Order'),\n }\n\n const response = await fetchShopifyGraphql<OrderPaymentDetailsByIdQuery>({\n query: queryOrderPaymentDetails,\n variables,\n })\n\n if (!response.order) {\n logger.debug(`No order found with ID: ${id}`)\n return null\n }\n\n return await returnOutputParsed(response, GetOrderPaymentDetailsByIdReturn)\n}\n","import { gql } from '../../utils/logger.js'\n\nexport const queryOrderPaymentDetails = gql`#graphql\n query orderPaymentDetailsById($id: ID!) {\n order(id: $id) {\n transactions {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n createdAt\n gateway\n formattedGateway\n kind\n paymentId\n }\n }\n }\n`\n","/**\n * Transforms GraphQL responses to REST-like format.\n *\n * This utility recursively:\n * 1. Flattens `{ edges: [{ node: ... }] }` → `[...]`\n * 2. Converts camelCase to snake_case (`lineItems` → `line_items`)\n * 3. Extracts numeric IDs from GIDs (`gid://shopify/Order/123` → `123`)\n */\n\n/**\n * Convert a camelCase string to snake_case\n */\nfunction camelToSnake(str: string): string {\n return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)\n}\n\n/**\n * Extract numeric ID from a Shopify GID string\n */\nfunction extractNumericId(gid: string): number {\n const match = gid.match(/\\d+$/)\n return match ? parseInt(match[0], 10) : 0\n}\n\n/**\n * Transform a GraphQL response object to REST-like format.\n *\n * @example\n * ```typescript\n * const graphqlOrder = {\n * id: 'gid://shopify/Order/123',\n * lineItems: {\n * edges: [{ node: { id: 'gid://shopify/LineItem/456', sku: 'ABC' } }]\n * }\n * };\n *\n * const restOrder = toRestFormat(graphqlOrder);\n * // Result:\n * // {\n * // id: 123,\n * // line_items: [{ id: 456, sku: 'ABC' }]\n * // }\n * ```\n */\nexport function toRestFormat<T>(obj: T): unknown {\n if (obj === null || obj === undefined) {\n return obj\n }\n\n if (Array.isArray(obj)) {\n return obj.map(toRestFormat)\n }\n\n if (typeof obj === 'object') {\n const record = obj as Record<string, unknown>\n const result: Record<string, unknown> = {}\n\n for (const [key, value] of Object.entries(record)) {\n // Flatten edges/node pattern: { edges: [{ node: ... }] } → [...]\n if (\n key === 'edges' &&\n Array.isArray(value) &&\n value.every(\n (item) =>\n typeof item === 'object' && item !== null && 'node' in item,\n )\n ) {\n return value.map((edge: { node: unknown }) => toRestFormat(edge.node))\n }\n\n // Convert GID to numeric ID\n if (\n key === 'id' &&\n typeof value === 'string' &&\n value.startsWith('gid://')\n ) {\n result[key] = extractNumericId(value)\n continue\n }\n\n // Convert camelCase to snake_case and recurse\n const snakeKey = camelToSnake(key)\n result[snakeKey] = toRestFormat(value)\n }\n\n return result\n }\n\n return obj\n}\n","/**\n * Extract numeric ID from a Shopify GID string.\n *\n * @example\n * parseGid('gid://shopify/Order/12345678901234') // → 12345678901234\n * parseGid('gid://shopify/LineItem/999') // → 999\n */\nexport function parseGid(gid: string): number {\n const match = gid.match(/\\d+$/)\n return match ? parseInt(match[0], 10) : 0\n}\n"],"mappings":";AAAA,OAAOA,QAAO;;;ACAd,IAAM,EAAE,IAAI,IAAI;AAET,IAA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AAG,EAAE,IAAI;AAC1C;","names":["z","env","z","z","z","z","z","z","z","z","z","z","z"]}
|
|
1
|
+
{"version":3,"sources":["../src/mutations/customers/deleteCustomerById.ts","../src/utils/logger.ts","../src/utils/shopifyClient.ts","../src/utils/shopifyFetch.ts","../src/utils/zod.ts","../src/mutations/orders/cancelOrderById.ts","../src/queries/orders/getOrderById.ts","../src/queries/orders/getOrderById.queries.ts","../src/queries/orders/getOrderByName.ts","../src/queries/orders/getOrderByName.queries.ts","../src/queries/productVariants/getLeanProductVariants.ts","../src/queries/orders/getOrderPaymentDetails.ts","../src/queries/orders/getOrderPaymentDetails.queries.ts","../src/utils/parseGid.ts"],"sourcesContent":["import z from 'zod'\nimport type {\n CustomerDeleteMutation,\n CustomerDeleteMutationVariables,\n} from '../../generated-api-types/2025-04/admin.generated'\nimport { gql } from '../../utils/logger'\nimport { fetchShopifyGraphql } from '../../utils/shopifyFetch'\nimport { returnOutputParsed } from '../../utils/zod'\n\nexport const DeleteCustomerByIdReturn = z.string().nullable()\n\ntype SingleNode = { deletedCustomerId: string | null }\n\nexport async function deleteCustomerById(\n customerId: string,\n): Promise<z.infer<typeof DeleteCustomerByIdReturn>> {\n const mutation = gql`#graphql\n mutation customerDelete($input: CustomerDeleteInput!) {\n customerDelete(input: $input) {\n deletedCustomerId\n userErrors {\n field\n message\n }\n }\n }\n `\n\n const variables: CustomerDeleteMutationVariables = {\n input: { id: customerId },\n }\n\n const response = await fetchShopifyGraphql<\n SingleNode,\n CustomerDeleteMutation\n >({\n query: mutation,\n variables,\n dataExtractor: (data: CustomerDeleteMutation) => {\n if (!data.customerDelete) {\n throw new Error(\"GraphQL response missing 'customerDelete' field\")\n }\n return {\n nodes: [\n { deletedCustomerId: data.customerDelete.deletedCustomerId ?? null },\n ],\n userErrors: data.customerDelete.userErrors,\n }\n },\n })\n\n return returnOutputParsed(\n response[0]?.deletedCustomerId ?? null,\n DeleteCustomerByIdReturn,\n )\n}\n","const { env } = process\n\nexport const gql = String.raw\n\nconst logLevels = {\n silent: 0,\n error: 1,\n warn: 2,\n info: 3,\n debug: 4,\n} as const\n\ntype LogLevelName = keyof typeof logLevels\n\nfunction getLogLevel(\n nodeEnv: string | undefined,\n logLevelEnv: string | undefined,\n): LogLevelName {\n if (logLevelEnv && logLevelEnv in logLevels) {\n return logLevelEnv as LogLevelName\n }\n\n if (nodeEnv === 'test') {\n return 'silent'\n }\n\n if (nodeEnv === 'production') {\n return 'info'\n }\n return 'debug'\n}\n\nexport const activeLogLevelName = getLogLevel(env.NODE_ENV, env.LOG_LEVEL)\nconst activeLogLevelValue = logLevels[activeLogLevelName]\n\nexport const logger = {\n debug: (...args: unknown[]) => {\n if (logLevels.debug <= activeLogLevelValue) {\n // biome-ignore lint/suspicious/noConsole: <explanation>\n console.debug(...args)\n }\n },\n info: (...args: unknown[]) => {\n if (logLevels.info <= activeLogLevelValue) {\n // biome-ignore lint/suspicious/noConsole: <explanation>\n console.info(...args)\n }\n },\n warn: (...args: unknown[]) => {\n if (logLevels.warn <= activeLogLevelValue) {\n // biome-ignore lint/suspicious/noConsole: <explanation>\n console.warn(...args)\n }\n },\n error: (...args: unknown[]) => {\n if (logLevels.error <= activeLogLevelValue) {\n // biome-ignore lint/suspicious/noConsole: <explanation>\n console.error(...args)\n }\n },\n}\n","import {\n ApiVersion,\n type GraphqlClient,\n LogSeverity,\n Session,\n shopifyApi,\n} from '@shopify/shopify-api'\nimport '@shopify/shopify-api/adapters/node'\nimport dotenv from 'dotenv'\nimport { z } from 'zod'\nimport { activeLogLevelName, logger } from './logger.js'\n\n// https://shopify.dev/docs/api/admin-graphql/2025-04/\nexport const SHOPIFY_API_VERSION = ApiVersion.April25\n\ndotenv.config()\n\nconst envSchema = z.object({\n SHOPIFY_API_KEY: z.string({\n required_error: 'SHOPIFY_API_KEY is required',\n }),\n SHOPIFY_API_SECRET: z.string({\n required_error: 'SHOPIFY_API_SECRET is required',\n }),\n SHOPIFY_API_HOSTNAME: z.string({\n required_error: 'SHOPIFY_API_HOSTNAME is required',\n }),\n SHOPIFY_ACCESS_TOKEN: z.string({\n required_error: 'SHOPIFY_ACCESS_TOKEN is required',\n }),\n NODE_ENV: z\n .enum(['development', 'production', 'test'])\n .default('development'),\n})\n\nconst mapLogLevelToShopifySeverity = (level: string): LogSeverity => {\n switch (level) {\n case 'silent':\n return LogSeverity.Error\n case 'debug':\n return LogSeverity.Debug\n case 'info':\n return LogSeverity.Info\n case 'warn':\n return LogSeverity.Warning\n case 'error':\n return LogSeverity.Error\n default:\n return LogSeverity.Info\n }\n}\n\nlet shopifyGraphqlClient: GraphqlClient\n\ntry {\n // biome-ignore lint/nursery/noProcessEnv: <explanation>\n const env = envSchema.parse(process.env)\n\n const shopify = shopifyApi({\n apiKey: env.SHOPIFY_API_KEY,\n apiSecretKey: env.SHOPIFY_API_SECRET,\n hostName: env.SHOPIFY_API_HOSTNAME,\n apiVersion: SHOPIFY_API_VERSION,\n isEmbeddedApp: false,\n logger: { level: mapLogLevelToShopifySeverity(activeLogLevelName) },\n future: {\n customerAddressDefaultFix: true,\n lineItemBilling: true,\n unstable_managedPricingSupport: false,\n },\n })\n\n const shopifySession = new Session({\n id: `custom-session-${env.SHOPIFY_API_HOSTNAME}`,\n shop: env.SHOPIFY_API_HOSTNAME,\n state: 'authenticated',\n isOnline: true,\n accessToken: env.SHOPIFY_ACCESS_TOKEN,\n })\n\n shopifyGraphqlClient = new shopify.clients.Graphql({\n session: shopifySession,\n })\n\n logger.info('Shopify API client initialized successfully.')\n} catch (error) {\n if (error instanceof z.ZodError) {\n const msg = JSON.stringify(error.format(), null, 2)\n logger.error(msg)\n } else {\n logger.error('Failed to initialize Shopify API client:', error)\n }\n throw error\n}\n\nexport { shopifyGraphqlClient as shopifyClient }\n","import { logger } from './logger.js'\nimport { shopifyClient } from './shopifyClient.js'\n\nexport function convertIdIntoGid(\n id: bigint,\n type: 'Order' | 'Customer',\n): string {\n return `gid://shopify/${type}/${id}`\n}\n\ninterface PageInfo {\n hasNextPage: boolean\n endCursor?: string | null | undefined\n}\n\ninterface ShopifyErrorWithMessage {\n message?: string\n [key: string]: unknown\n}\n\nexport interface ShopifyUserErrorDetail {\n code?: string | null\n field?: string[] | null\n message?: string | null\n}\n\n/**\n * Custom error class for Shopify mutation userErrors.\n * Preserves the full error array so callers can inspect specific error codes.\n *\n * @example\n * try {\n * await cancelOrderById(orderId)\n * } catch (error) {\n * if (error instanceof ShopifyUserError) {\n * const alreadyCancelled = error.errors.some(e => e.code === 'ORDER_ALREADY_CANCELLED')\n * if (alreadyCancelled) { ... }\n * }\n * }\n */\nexport class ShopifyUserError extends Error {\n constructor(\n message: string,\n public readonly errors: ShopifyUserErrorDetail[],\n ) {\n super(message)\n this.name = 'ShopifyUserError'\n }\n}\n\ntype TExtractorFunctionType<TResultNode, TPageData> = (pageData: TPageData) => {\n nodes: TResultNode[]\n pageInfo?: PageInfo\n userErrors?: ShopifyUserErrorDetail[]\n}\n\nexport async function fetchShopifyGraphql<TResultNode, TPageData>(params: {\n query: string\n variables: Record<string, unknown>\n dataExtractor?: TExtractorFunctionType<TResultNode, TPageData>\n fetchAllPages?: boolean\n}): Promise<TResultNode[]>\nexport async function fetchShopifyGraphql<TReturnType>(params: {\n query: string\n variables: Record<string, unknown>\n}): Promise<TReturnType>\nexport async function fetchShopifyGraphql<\n TResultNode,\n TPageData,\n TReturnType,\n>(params: {\n query: string\n variables: Record<string, unknown>\n dataExtractor?: TExtractorFunctionType<TResultNode, TPageData>\n fetchAllPages?: boolean\n}): Promise<TResultNode[] | TReturnType> {\n const {\n query,\n variables: initialVariables,\n dataExtractor,\n fetchAllPages = false,\n } = params\n\n let currentVariables = { ...initialVariables }\n\n if (!dataExtractor) {\n return makeRequest<NonNullable<TReturnType>>(query, currentVariables)\n }\n\n const allNodes: TResultNode[] = []\n let hasNextLoop = true\n\n do {\n const response = await makeRequest<TPageData>(query, currentVariables)\n const { nodes, pageInfo, userErrors } = dataExtractor(response)\n\n // Handle Shopify mutation userErrors pattern\n if (Array.isArray(userErrors) && userErrors.length > 0) {\n const errorMessages = userErrors\n .map((e) => e.message || JSON.stringify(e))\n .join('\\n')\n logger.error('Shopify mutation userErrors:', errorMessages)\n throw new ShopifyUserError(\n `Shopify mutation userErrors: ${errorMessages}`,\n userErrors,\n )\n }\n\n allNodes.push(...nodes)\n\n hasNextLoop = fetchAllPages ? !!pageInfo?.hasNextPage : false\n if (hasNextLoop && pageInfo?.endCursor) {\n currentVariables = {\n ...currentVariables,\n after: pageInfo.endCursor,\n }\n }\n } while (hasNextLoop)\n\n return allNodes\n}\n\nasync function makeRequest<TReturnDataType>(\n query: string,\n variables: Record<string, unknown>,\n): Promise<NonNullable<TReturnDataType>> {\n type ShopifyRequestErrorType = {\n errors?: ShopifyErrorWithMessage | ShopifyErrorWithMessage[]\n }\n\n const response = (await shopifyClient.request<TReturnDataType>(query, {\n variables,\n })) as { data?: TReturnDataType } & ShopifyRequestErrorType\n\n if (response.errors) {\n let errorMessages = 'GraphQL query failed.'\n const errors = response.errors\n if (Array.isArray(errors)) {\n errorMessages = errors\n .map((e: ShopifyErrorWithMessage) => e.message || JSON.stringify(e))\n .join('\\n')\n } else if (\n typeof errors === 'object' &&\n errors !== null &&\n 'message' in errors\n ) {\n errorMessages = errors.message || JSON.stringify(errors)\n } else if (typeof errors === 'string') {\n errorMessages = errors\n } else {\n errorMessages = JSON.stringify(errors)\n }\n logger.error('GraphQL query failed:', errorMessages)\n throw new Error(`GraphQL errors: ${errorMessages}`)\n }\n\n if (!response.data) {\n throw new Error('No data in Shopify API response')\n }\n\n return response.data\n}\n","import z from 'zod'\nimport { logger } from './logger.js'\n\nexport async function returnOutputParsed<T>(\n data: unknown,\n Model: z.ZodType<T>,\n) {\n const parsed = await Model.safeParseAsync(data)\n if (!parsed.success) {\n if (parsed.error instanceof z.ZodError) {\n const msg = JSON.stringify(parsed.error.format(), null, 2)\n logger.error(msg)\n } else {\n logger.error('Failed to parse:', parsed.error)\n }\n // throw parsedVariants.error\n throw new Error('Failed to parse product variants')\n }\n logger.info('Parsed data successfully')\n return parsed.data\n}\n","import type {\n OrderCancelMutation,\n OrderCancelMutationVariables,\n} from '../../generated-api-types/2025-04/admin.generated.js'\nimport { gql, logger } from '../../utils/logger.js'\nimport {\n convertIdIntoGid,\n fetchShopifyGraphql,\n} from '../../utils/shopifyFetch.js'\n\ntype CancelOrderNode = { success: true }\n\nconst mutation = gql`#graphql\n mutation orderCancel($orderId: ID!) {\n orderCancel(\n orderId: $orderId\n refund: true\n restock: false\n reason: CUSTOMER\n notifyCustomer: true\n ) {\n orderCancelUserErrors {\n code\n field\n message\n }\n }\n }\n`\n\n/**\n * Cancel an order in Shopify.\n *\n * @param orderId - The order ID (numeric, bigint, or GID string)\n * @returns Promise resolving to true on success\n * @throws {ShopifyUserError} When cancellation fails (e.g., ORDER_ALREADY_CANCELLED)\n *\n * @example\n * // Success case\n * await cancelOrderById(12345678901234)\n *\n * // Error handling\n * import { ShopifyUserError } from '@ehrenkind/shopify-lib'\n * try {\n * await cancelOrderById(orderId)\n * } catch (error) {\n * if (error instanceof ShopifyUserError) {\n * const alreadyCancelled = error.errors.some(e => e.code === 'ORDER_ALREADY_CANCELLED')\n * }\n * }\n */\nexport async function cancelOrderById(\n orderId: number | bigint | string,\n): Promise<boolean> {\n const orderGid =\n typeof orderId === 'string'\n ? orderId\n : convertIdIntoGid(\n typeof orderId === 'number' ? BigInt(orderId) : orderId,\n 'Order',\n )\n\n logger.debug(`Cancelling order ${orderGid}`)\n\n const variables: OrderCancelMutationVariables = { orderId: orderGid }\n\n await fetchShopifyGraphql<CancelOrderNode, OrderCancelMutation>({\n query: mutation,\n variables,\n dataExtractor: (data) => {\n if (!data.orderCancel) {\n throw new Error(\"GraphQL response missing 'orderCancel' field\")\n }\n return {\n nodes: [{ success: true }],\n userErrors: data.orderCancel.orderCancelUserErrors,\n }\n },\n })\n\n logger.debug(`Order ${orderGid} cancelled successfully`)\n return true\n}\n","import z from 'zod'\nimport type {\n OrderByIdFullQuery,\n OrderByIdQuery,\n OrderByIdQueryVariables,\n} from '../../generated-api-types/2025-04/admin.generated.js'\nimport { logger } from '../../utils/logger.js'\nimport {\n convertIdIntoGid,\n fetchShopifyGraphql,\n} from '../../utils/shopifyFetch.js'\nimport { returnOutputParsed } from '../../utils/zod.js'\nimport { queryOrderById, queryOrderByIdFull } from './getOrderById.queries.js'\n\n// Address schema (shared between lean and full)\nconst AddressSchema = z\n .object({\n firstName: z.string().nullable(),\n lastName: z.string().nullable(),\n address1: z.string().nullable(),\n address2: z.string().nullable(),\n city: z.string().nullable(),\n province: z.string().nullable(),\n country: z.string().nullable(),\n zip: z.string().nullable(),\n })\n .nullable()\n\n// Lean order schema\nconst GetLeanOrderByIdReturn = z\n .object({\n id: z.string(),\n name: z.string(),\n createdAt: z.string(),\n updatedAt: z.string(),\n cancelledAt: z.string().nullable(),\n cancelReason: z.string().nullable(),\n totalPrice: z.object({\n amount: z.string(),\n currencyCode: z.string(),\n }),\n customer: z\n .object({\n id: z.string(),\n displayName: z.string(),\n firstName: z.string().nullable(),\n lastName: z.string().nullable(),\n emailAddress: z.string().nullable(),\n })\n .nullable(),\n financialStatus: z.string().nullable(),\n fulfillmentStatus: z.string().nullable(),\n shippingAddress: AddressSchema,\n })\n .nullable()\n\nexport type LeanOrder = z.infer<typeof GetLeanOrderByIdReturn>\n\n// Full order type - derived from the generated GraphQL types\nexport type FullOrder = NonNullable<OrderByIdFullQuery['order']>\n\ntype OrderDetailLevel = 'lean' | 'full'\n\n// Function overloads\nexport function getOrderById(id: number | bigint): Promise<LeanOrder>\nexport function getOrderById(\n id: number | bigint,\n detailLevel: 'lean',\n): Promise<LeanOrder>\nexport function getOrderById(\n id: number | bigint,\n detailLevel: 'full',\n): Promise<FullOrder | null>\n\n/**\n * Retrieves a single order from Shopify by its numeric ID.\n * Returns null if no order is found with the specified ID.\n *\n * @param {number | bigint} id - The numerical Shopify order ID (e.g., 12345678 or 12345678n).\n * @param {OrderDetailLevel} detailLevel - The level of detail to return ('lean' or 'full'). Defaults to 'lean'.\n * @returns {Promise<LeanOrder | FullOrder>} A promise that resolves to the order data or null if not found.\n * @throws {Error} If the GraphQL query fails or if the response structure is invalid.\n */\nexport async function getOrderById(\n id: number | bigint,\n detailLevel: OrderDetailLevel = 'lean',\n): Promise<LeanOrder | FullOrder> {\n const bigIntId = typeof id === 'number' ? BigInt(id) : id\n if (detailLevel === 'lean') {\n return getLeanOrderById(bigIntId)\n }\n return getFullOrderById(bigIntId)\n}\n\nasync function getLeanOrderById(id: bigint): Promise<LeanOrder> {\n const variables: OrderByIdQueryVariables = {\n id: convertIdIntoGid(id, 'Order'),\n }\n\n const response = await fetchShopifyGraphql<OrderByIdQuery>({\n query: queryOrderById,\n variables,\n })\n\n if (!response.order) {\n logger.debug(`No order found with ID: ${id}`)\n return null\n }\n\n const order = response.order\n\n const leanOrder = {\n id: order.id,\n name: order.name,\n createdAt: order.createdAt,\n updatedAt: order.updatedAt,\n cancelledAt: order.cancelledAt ?? null,\n cancelReason: order.cancelReason ?? null,\n totalPrice: {\n amount: order.totalPriceSet?.shopMoney?.amount ?? '',\n currencyCode: order.totalPriceSet?.shopMoney?.currencyCode ?? '',\n },\n customer: order.customer\n ? {\n id: order.customer.id,\n displayName: order.customer.displayName,\n firstName: order.customer.firstName ?? null,\n lastName: order.customer.lastName ?? null,\n emailAddress:\n order.customer.defaultEmailAddress?.emailAddress ?? null,\n }\n : null,\n financialStatus: order.displayFinancialStatus ?? null,\n fulfillmentStatus: order.displayFulfillmentStatus ?? null,\n shippingAddress: order.shippingAddress\n ? {\n firstName: order.shippingAddress.firstName ?? null,\n lastName: order.shippingAddress.lastName ?? null,\n address1: order.shippingAddress.address1 ?? null,\n address2: order.shippingAddress.address2 ?? null,\n city: order.shippingAddress.city ?? null,\n province: order.shippingAddress.province ?? null,\n country: order.shippingAddress.country ?? null,\n zip: order.shippingAddress.zip ?? null,\n }\n : null,\n }\n\n return await returnOutputParsed(leanOrder, GetLeanOrderByIdReturn)\n}\n\nasync function getFullOrderById(id: bigint): Promise<FullOrder | null> {\n const variables: OrderByIdQueryVariables = {\n id: convertIdIntoGid(id, 'Order'),\n }\n\n const response = await fetchShopifyGraphql<OrderByIdFullQuery>({\n query: queryOrderByIdFull,\n variables,\n })\n\n if (!response.order) {\n logger.debug(`No order found with ID: ${id}`)\n return null\n }\n\n return response.order\n}\n","import { gql } from '../../utils/logger'\n\nexport const queryOrderById = gql`#graphql\n query orderById($id: ID!) {\n order(id: $id) {\n id\n name\n createdAt\n updatedAt\n cancelledAt\n cancelReason\n totalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n customer {\n id\n lastName\n defaultEmailAddress {\n emailAddress\n }\n displayName\n firstName\n }\n displayFinancialStatus\n displayFulfillmentStatus\n shippingAddress {\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n }\n }\n }\n`\n\nexport const queryOrderByIdFull = gql`#graphql\n query orderByIdFull($id: ID!) {\n order(id: $id) {\n id\n name\n createdAt\n updatedAt\n processedAt\n closedAt\n cancelledAt\n cancelReason\n totalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n customer {\n id\n firstName\n lastName\n email\n phone\n }\n displayFinancialStatus\n displayFulfillmentStatus\n shippingAddress {\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n }\n billingAddress {\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n }\n lineItems(first: 100) {\n edges {\n node {\n id\n sku\n title\n variantTitle\n quantity\n customAttributes {\n key\n value\n }\n originalUnitPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n vendor\n image {\n url\n width\n height\n altText\n }\n }\n }\n }\n fulfillments {\n id\n name\n totalQuantity\n status\n createdAt\n estimatedDeliveryAt\n deliveredAt\n trackingInfo {\n company\n number\n url\n }\n fulfillmentLineItems(first: 100) {\n edges {\n node {\n id\n quantity\n lineItem {\n id\n sku\n }\n }\n }\n }\n }\n shippingLine {\n originalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n taxLines {\n priceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n totalDiscountsSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n discountCodes\n refunds {\n totalRefundedSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n }\n }\n`\n","import z from 'zod'\nimport type {\n OrdersByNameFullQuery,\n OrdersByNameQuery,\n OrdersByNameQueryVariables,\n} from '../../generated-api-types/2025-04/admin.generated.js'\nimport { logger } from '../../utils/logger.js'\nimport { fetchShopifyGraphql } from '../../utils/shopifyFetch.js'\nimport { returnOutputParsed } from '../../utils/zod.js'\nimport {\n queryOrdersByName,\n queryOrdersByNameFull,\n} from './getOrderByName.queries.js'\n\nconst GetLeanOrderByNameReturn = z\n .object({\n id: z.string(),\n name: z.string(),\n createdAt: z.string(),\n updatedAt: z.string(),\n totalPrice: z.object({\n amount: z.string(),\n currencyCode: z.string(),\n }),\n customer: z\n .object({\n id: z.string(),\n displayName: z.string(),\n emailAddress: z.string().nullable(),\n })\n .nullable(),\n financialStatus: z.string().nullable(),\n fulfillmentStatus: z.string().nullable(),\n })\n .nullable()\n\nexport type LeanOrderByName = z.infer<typeof GetLeanOrderByNameReturn>\n\nexport type FullOrderByName = NonNullable<\n NonNullable<OrdersByNameFullQuery['orders']>['edges'][number]['node']\n> | null\n\ntype OrderDetailLevel = 'lean' | 'full'\n\n// Function overloads\nexport function getOrderByName(\n orderName: string,\n detailLevel: 'lean',\n): Promise<LeanOrderByName>\nexport function getOrderByName(\n orderName: string,\n detailLevel: 'full',\n): Promise<FullOrderByName>\nexport function getOrderByName(orderName: string): Promise<LeanOrderByName>\n\n/**\n * Retrieves a single order from Shopify by its order name (e.g., \"B12345\").\n * Returns null if no order is found with the specified name.\n *\n * @param {string} orderName - The order name to search for (e.g., \"B12345\").\n * @param {OrderDetailLevel} detailLevel - The level of detail to return ('lean' or 'full'). Defaults to 'lean'.\n * @returns {Promise<LeanOrderByName | FullOrderByName>} A promise that resolves to the order data or null if not found.\n * @throws {Error} If the GraphQL query fails or if the response structure is invalid.\n */\nexport async function getOrderByName(\n orderName: string,\n detailLevel: OrderDetailLevel = 'lean',\n): Promise<LeanOrderByName | FullOrderByName> {\n if (detailLevel === 'lean') {\n return getLeanOrderByName(orderName)\n }\n return getFullOrderByName(orderName)\n}\n\nasync function getLeanOrderByName(orderName: string): Promise<LeanOrderByName> {\n const variables: OrdersByNameQueryVariables = {\n first: 1,\n queryFilter: `name:${orderName}`,\n }\n\n type SingleNode = NonNullable<\n NonNullable<OrdersByNameQuery['orders']>['edges'][number]['node']\n >\n\n const extractedNodes = await fetchShopifyGraphql<\n SingleNode,\n OrdersByNameQuery\n >({\n query: queryOrdersByName,\n variables,\n dataExtractor: (pageData: OrdersByNameQuery) => {\n if (!pageData.orders) {\n throw new Error(\n \"GraphQL response for orders is missing the 'orders' field.\",\n )\n }\n const nodes: SingleNode[] = pageData.orders.edges.map(\n (edge: { node: SingleNode }) => edge.node,\n )\n return {\n nodes,\n }\n },\n fetchAllPages: false,\n })\n\n const order = extractedNodes[0]\n if (!order) {\n logger.debug(`No order found with name: ${orderName}`)\n return null\n }\n\n const leanOrder = {\n id: order.id,\n name: order.name,\n createdAt: order.createdAt,\n updatedAt: order.updatedAt,\n totalPrice: {\n amount: order.totalPriceSet?.shopMoney?.amount ?? '',\n currencyCode: order.totalPriceSet?.shopMoney?.currencyCode ?? '',\n },\n customer: order.customer\n ? {\n id: order.customer.id,\n displayName: order.customer.displayName,\n emailAddress:\n order.customer.defaultEmailAddress?.emailAddress ?? null,\n }\n : null,\n financialStatus: order.displayFinancialStatus ?? null,\n fulfillmentStatus: order.displayFulfillmentStatus ?? null,\n }\n\n return await returnOutputParsed(leanOrder, GetLeanOrderByNameReturn)\n}\n\nasync function getFullOrderByName(orderName: string): Promise<FullOrderByName> {\n const variables: OrdersByNameQueryVariables = {\n first: 1,\n queryFilter: `name:${orderName}`,\n }\n\n type SingleNode = NonNullable<\n NonNullable<OrdersByNameFullQuery['orders']>['edges'][number]['node']\n >\n\n const extractedNodes = await fetchShopifyGraphql<\n SingleNode,\n OrdersByNameFullQuery\n >({\n query: queryOrdersByNameFull,\n variables,\n dataExtractor: (pageData: OrdersByNameFullQuery) => {\n if (!pageData.orders) {\n throw new Error(\n \"GraphQL response for orders is missing the 'orders' field.\",\n )\n }\n const nodes: SingleNode[] = pageData.orders.edges.map(\n (edge: { node: SingleNode }) => edge.node,\n )\n return {\n nodes,\n }\n },\n fetchAllPages: false,\n })\n\n if (extractedNodes.length === 0) {\n logger.debug(`No order found with name: ${orderName}`)\n return null\n }\n\n const order = extractedNodes[0]\n if (!order) {\n logger.debug(`No order found with name: ${orderName}`)\n return null\n }\n\n return order\n}\n","import { gql } from '../../utils/logger'\n\nexport const queryOrdersByName = gql`#graphql\n query ordersByName($first: Int!, $queryFilter: String!) {\n orders(first: $first, query: $queryFilter) {\n edges {\n node {\n id\n name\n createdAt\n updatedAt\n totalPriceSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n customer {\n id\n lastName\n defaultEmailAddress {\n emailAddress\n }\n displayName\n firstName\n }\n displayFinancialStatus\n displayFulfillmentStatus\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`\n\nexport const queryOrdersByNameFull = gql`#graphql\n query ordersByNameFull($first: Int!, $queryFilter: String!) {\n orders(first: $first, query: $queryFilter) {\n edges {\n node {\n billingAddress {\n address1\n address2\n city\n company\n country\n countryCodeV2\n firstName\n formattedArea\n id\n lastName\n name\n phone\n province\n provinceCode\n timeZone\n zip\n }\n billingAddressMatchesShippingAddress\n cancelReason\n cancellation {\n staffNote\n }\n cancelledAt\n capturable\n clientIp\n closed\n closedAt\n confirmed\n createdAt\n currencyCode\n currentCartDiscountAmountSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentShippingPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentSubtotalLineItemsQuantity\n currentSubtotalPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTaxLines {\n channelLiable\n rate\n ratePercentage\n source\n title\n priceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n }\n currentTotalAdditionalFeesSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTotalDiscountsSet {\n presentmentMoney {\n amount\n currencyCode\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTotalDutiesSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTotalPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTotalTaxSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n currentTotalWeight\n customer {\n id\n lastName\n defaultEmailAddress {\n emailAddress\n }\n displayName\n firstName\n }\n customerAcceptsMarketing\n discountCodes\n discountCode\n displayAddress {\n address1\n address2\n city\n company\n country\n countryCodeV2\n firstName\n formattedArea\n id\n lastName\n name\n phone\n province\n provinceCode\n timeZone\n zip\n }\n displayFinancialStatus\n displayFulfillmentStatus\n dutiesIncluded\n edited\n email\n estimatedTaxes\n fulfillable\n fulfillments(first: 20) {\n createdAt\n deliveredAt\n displayStatus\n estimatedDeliveryAt\n updatedAt\n trackingInfo(first: 10) {\n company\n url\n }\n totalQuantity\n status\n name\n id\n }\n fullyPaid\n id\n lineItems(first: 50) {\n edges {\n node {\n id\n name\n originalUnitPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n quantity\n requiresShipping\n sku\n title\n variantTitle\n }\n }\n }\n name\n note\n processedAt\n shippingAddress {\n address1\n address2\n city\n company\n country\n countryCodeV2\n firstName\n formattedArea\n id\n lastName\n name\n phone\n province\n provinceCode\n timeZone\n zip\n }\n statusPageUrl\n tags\n totalPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n totalReceivedSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n totalRefundedSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n totalShippingPriceSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n totalTaxSet {\n presentmentMoney {\n amount\n currencyCode\n }\n shopMoney {\n amount\n currencyCode\n }\n }\n totalWeight\n unpaid\n updatedAt\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n`\n","import z from 'zod'\nimport type {\n LeanProductVariantsQuery,\n LeanProductVariantsQueryVariables,\n} from '../../generated-api-types/2025-04/admin.generated.js'\nimport { gql, logger } from '../../utils/logger.js'\nimport { fetchShopifyGraphql } from '../../utils/shopifyFetch.js'\nimport { returnOutputParsed } from '../../utils/zod.js'\n\nconst GetLeanProductVariantsReturn = z.array(\n z.object({\n productId: z.string(),\n productTitle: z.string(),\n variantId: z.string(),\n variantTitle: z.string(),\n sku: z.string(),\n }),\n)\n\ntype GetLeanProductVariantsReturnType = z.infer<\n typeof GetLeanProductVariantsReturn\n>\n\n/**\n * Retrieves a lean list of product variants from Shopify, optionally filtered by SKUs.\n * Product variants are mapped to a simpler output structure.\n * Variants missing essential properties (e.g., SKU) will be filtered out and logged.\n *\n * @param {string[]} [skus] - An optional array of SKUs to filter by. If provided, only variants matching these SKUs will be fetched.\n * @returns {Promise<GetLeanProductVariantsReturnType>} A promise that resolves to an array of lean product variant data.\n * @throws {Error} If the GraphQL query fails, returns no data, or if the `productVariants` field is missing in the response.\n */\nexport async function getLeanProductVariants(\n skus?: string[],\n): Promise<GetLeanProductVariantsReturnType> {\n const queryGql = gql`#graphql\n query leanProductVariants($first: Int!, $after: String, $queryFilter: String) {\n productVariants(first: $first, after: $after, query: $queryFilter) {\n edges {\n node { \n id\n title\n sku\n product {\n id\n title\n }\n }\n }\n pageInfo { \n hasNextPage\n endCursor\n }\n }\n }\n `\n\n const initialVariables: LeanProductVariantsQueryVariables = { first: 250 }\n if (skus && skus.length > 0) {\n initialVariables.queryFilter = skus\n .map((sku: string) => `sku:${sku}`)\n .join(' OR ')\n }\n\n // Type for a single node from the productVariants query\n type SingleNode = NonNullable<\n NonNullable<\n LeanProductVariantsQuery['productVariants']\n >['edges'][number]['node']\n >\n\n const extractedNodes = await fetchShopifyGraphql<\n SingleNode,\n LeanProductVariantsQuery\n >({\n query: queryGql,\n variables: initialVariables,\n dataExtractor: (pageData: LeanProductVariantsQuery) => {\n if (!pageData.productVariants) {\n throw new Error(\n \"GraphQL response for product variants is missing the 'productVariants' field.\",\n )\n }\n const nodes: SingleNode[] = pageData.productVariants.edges.map(\n (edge: { node: SingleNode }) => edge.node,\n )\n return {\n nodes,\n pageInfo: pageData.productVariants.pageInfo,\n }\n },\n fetchAllPages: true,\n })\n\n const allVariants = extractedNodes.flatMap<\n GetLeanProductVariantsReturnType[number]\n >((v) => {\n if (v.sku) {\n return [\n {\n productId: v.product.id,\n productTitle: v.product.title,\n variantId: v.id,\n variantTitle: v.title,\n sku: v.sku,\n },\n ]\n }\n logger.debug(\n `Product ${v.product.title} (ID: ${v.product.id}) has a variant (ID: ${v.id}) with no SKU. Filtering out.`,\n )\n return []\n })\n\n return await returnOutputParsed(allVariants, GetLeanProductVariantsReturn)\n}\n","import z from 'zod'\nimport type {\n OrderPaymentDetailsByIdQuery,\n OrderPaymentDetailsByIdQueryVariables,\n} from '../../generated-api-types/2025-04/admin.generated.js'\nimport { logger } from '../../utils/logger.js'\nimport {\n convertIdIntoGid,\n fetchShopifyGraphql,\n} from '../../utils/shopifyFetch.js'\nimport { returnOutputParsed } from '../../utils/zod.js'\nimport { queryOrderPaymentDetails } from './getOrderPaymentDetails.queries.js'\n\nconst GetOrderPaymentDetailsByIdReturn = z.object({\n order: z.object({\n transactions: z.array(\n z.object({\n amountSet: z.object({\n shopMoney: z.object({\n amount: z.string(),\n currencyCode: z.string(),\n }),\n }),\n createdAt: z.string(),\n gateway: z.string(),\n formattedGateway: z.string(),\n kind: z.string(),\n paymentId: z.string(),\n }),\n ),\n }),\n})\n\ntype GetOrderPaymentDetailsByIdReturnType = z.infer<\n typeof GetOrderPaymentDetailsByIdReturn\n>\n\n/**\n * Retrieves payment details for a single order from Shopify by its ID.\n * Returns null if no order is found with the specified ID.\n *\n * @param {bigint} id - The numerical Shopify order ID (e.g., 12345678n).\n * @returns {Promise<GetOrderPaymentDetailsByIdReturnType | null>} A promise that resolves to the order payment data or null if not found.\n * @throws {Error} If the GraphQL query fails or if the response structure is invalid.\n */\nexport async function getOrderPaymentDetailsById(\n id: bigint,\n): Promise<GetOrderPaymentDetailsByIdReturnType | null> {\n const variables: OrderPaymentDetailsByIdQueryVariables = {\n id: convertIdIntoGid(id, 'Order'),\n }\n\n const response = await fetchShopifyGraphql<OrderPaymentDetailsByIdQuery>({\n query: queryOrderPaymentDetails,\n variables,\n })\n\n if (!response.order) {\n logger.debug(`No order found with ID: ${id}`)\n return null\n }\n\n return await returnOutputParsed(response, GetOrderPaymentDetailsByIdReturn)\n}\n","import { gql } from '../../utils/logger.js'\n\nexport const queryOrderPaymentDetails = gql`#graphql\n query orderPaymentDetailsById($id: ID!) {\n order(id: $id) {\n transactions {\n amountSet {\n shopMoney {\n amount\n currencyCode\n }\n }\n createdAt\n gateway\n formattedGateway\n kind\n paymentId\n }\n }\n }\n`\n","/**\n * Extract numeric ID from a Shopify GID string.\n *\n * @example\n * parseGid('gid://shopify/Order/12345678901234') // → 12345678901234\n * parseGid('gid://shopify/LineItem/999') // → 999\n */\nexport function parseGid(gid: string): number {\n const match = gid.match(/\\d+$/)\n return match ? Number.parseInt(match[0], 10) : 0\n}\n"],"mappings":";AAAA,OAAOA,QAAO;;;ACAd,IAAM,EAAE,I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3
|
+
*
|
|
4
|
+
* @param orderId - The order ID (numeric, bigint, or GID string)
|
|
5
|
+
* @returns Promise resolving to true on success
|
|
6
|
+
* @throws {ShopifyUserError} When cancellation fails (e.g., ORDER_ALREADY_CANCELLED)
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Success case
|
|
10
|
+
* await cancelOrderById(12345678901234)
|
|
11
|
+
*
|
|
12
|
+
* // Error handling
|
|
13
|
+
* import { ShopifyUserError } from '@ehrenkind/shopify-lib'
|
|
14
|
+
* try {
|
|
15
|
+
* await cancelOrderById(orderId)
|
|
16
|
+
* } catch (error) {
|
|
17
|
+
* if (error instanceof ShopifyUserError) {
|
|
18
|
+
* const alreadyCancelled = error.errors.some(e => e.code === 'ORDER_ALREADY_CANCELLED')
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
*/
|
|
22
|
+
export declare function cancelOrderById(orderId: number | bigint | string): Promise<boolean>;
|
|
23
|
+
//# sourceMappingURL=cancelOrderById.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelOrderById.d.ts","sourceRoot":"","sources":["../../../src/mutations/orders/cancelOrderById.ts"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAChC,OAAO,CAAC,OAAO,CAAC,CA6BlB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { gql, logger } from '../../utils/logger.js';
|
|
2
|
+
import { convertIdIntoGid, fetchShopifyGraphql, } from '../../utils/shopifyFetch.js';
|
|
3
|
+
const mutation = gql `#graphql
|
|
4
|
+
mutation orderCancel($orderId: ID!) {
|
|
5
|
+
orderCancel(
|
|
6
|
+
orderId: $orderId
|
|
7
|
+
refund: true
|
|
8
|
+
restock: false
|
|
9
|
+
reason: CUSTOMER
|
|
10
|
+
notifyCustomer: true
|
|
11
|
+
) {
|
|
12
|
+
orderCancelUserErrors {
|
|
13
|
+
code
|
|
14
|
+
field
|
|
15
|
+
message
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
/**
|
|
21
|
+
* Cancel an order in Shopify.
|
|
22
|
+
*
|
|
23
|
+
* @param orderId - The order ID (numeric, bigint, or GID string)
|
|
24
|
+
* @returns Promise resolving to true on success
|
|
25
|
+
* @throws {ShopifyUserError} When cancellation fails (e.g., ORDER_ALREADY_CANCELLED)
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Success case
|
|
29
|
+
* await cancelOrderById(12345678901234)
|
|
30
|
+
*
|
|
31
|
+
* // Error handling
|
|
32
|
+
* import { ShopifyUserError } from '@ehrenkind/shopify-lib'
|
|
33
|
+
* try {
|
|
34
|
+
* await cancelOrderById(orderId)
|
|
35
|
+
* } catch (error) {
|
|
36
|
+
* if (error instanceof ShopifyUserError) {
|
|
37
|
+
* const alreadyCancelled = error.errors.some(e => e.code === 'ORDER_ALREADY_CANCELLED')
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
*/
|
|
41
|
+
export async function cancelOrderById(orderId) {
|
|
42
|
+
const orderGid = typeof orderId === 'string'
|
|
43
|
+
? orderId
|
|
44
|
+
: convertIdIntoGid(typeof orderId === 'number' ? BigInt(orderId) : orderId, 'Order');
|
|
45
|
+
logger.debug(`Cancelling order ${orderGid}`);
|
|
46
|
+
const variables = { orderId: orderGid };
|
|
47
|
+
await fetchShopifyGraphql({
|
|
48
|
+
query: mutation,
|
|
49
|
+
variables,
|
|
50
|
+
dataExtractor: (data) => {
|
|
51
|
+
if (!data.orderCancel) {
|
|
52
|
+
throw new Error("GraphQL response missing 'orderCancel' field");
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
nodes: [{ success: true }],
|
|
56
|
+
userErrors: data.orderCancel.orderCancelUserErrors,
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
logger.debug(`Order ${orderGid} cancelled successfully`);
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=cancelOrderById.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelOrderById.js","sourceRoot":"","sources":["../../../src/mutations/orders/cancelOrderById.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,6BAA6B,CAAA;AAIpC,MAAM,QAAQ,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;CAgBnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAiC;IAEjC,MAAM,QAAQ,GACZ,OAAO,OAAO,KAAK,QAAQ;QACzB,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,gBAAgB,CACd,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EACvD,OAAO,CACR,CAAA;IAEP,MAAM,CAAC,KAAK,CAAC,oBAAoB,QAAQ,EAAE,CAAC,CAAA;IAE5C,MAAM,SAAS,GAAiC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;IAErE,MAAM,mBAAmB,CAAuC;QAC9D,KAAK,EAAE,QAAQ;QACf,SAAS;QACT,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;YACtB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;YACjE,CAAC;YACD,OAAO;gBACL,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gBAC1B,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,qBAAqB;aACnD,CAAA;QACH,CAAC;KACF,CAAC,CAAA;IAEF,MAAM,CAAC,KAAK,CAAC,SAAS,QAAQ,yBAAyB,CAAC,CAAA;IACxD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const orderCancelSuccessMock: {
|
|
2
|
+
orderCancel: {
|
|
3
|
+
orderCancelUserErrors: never[];
|
|
4
|
+
};
|
|
5
|
+
};
|
|
6
|
+
export declare const orderCancelErrorMock: {
|
|
7
|
+
orderCancel: {
|
|
8
|
+
orderCancelUserErrors: {
|
|
9
|
+
code: string;
|
|
10
|
+
field: string[];
|
|
11
|
+
message: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=cancelOrderById.mock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelOrderById.mock.d.ts","sourceRoot":"","sources":["../../../src/mutations/orders/cancelOrderById.mock.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB;;;;CAIlC,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;;;;;CAUhC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const orderCancelSuccessMock = {
|
|
2
|
+
orderCancel: {
|
|
3
|
+
orderCancelUserErrors: [],
|
|
4
|
+
},
|
|
5
|
+
};
|
|
6
|
+
export const orderCancelErrorMock = {
|
|
7
|
+
orderCancel: {
|
|
8
|
+
orderCancelUserErrors: [
|
|
9
|
+
{
|
|
10
|
+
code: 'ORDER_ALREADY_CANCELLED',
|
|
11
|
+
field: ['orderId'],
|
|
12
|
+
message: 'Order is already cancelled',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=cancelOrderById.mock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelOrderById.mock.js","sourceRoot":"","sources":["../../../src/mutations/orders/cancelOrderById.mock.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,WAAW,EAAE;QACX,qBAAqB,EAAE,EAAE;KAC1B;CACF,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE;QACX,qBAAqB,EAAE;YACrB;gBACE,IAAI,EAAE,yBAAyB;gBAC/B,KAAK,EAAE,CAAC,SAAS,CAAC;gBAClB,OAAO,EAAE,4BAA4B;aACtC;SACF;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelOrderById.test.d.ts","sourceRoot":"","sources":["../../../src/mutations/orders/cancelOrderById.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { createGqlResponse, graphql, server } from '../../utils/mswHandlers.js';
|
|
3
|
+
import { ShopifyUserError } from '../../utils/shopifyFetch.js';
|
|
4
|
+
import { cancelOrderById } from './cancelOrderById.js';
|
|
5
|
+
import { orderCancelErrorMock } from './cancelOrderById.mock.js';
|
|
6
|
+
describe('cancelOrderById', () => {
|
|
7
|
+
it('returns true when order is cancelled with GID string', async () => {
|
|
8
|
+
const result = await cancelOrderById('gid://shopify/Order/123');
|
|
9
|
+
expect(result).toBe(true);
|
|
10
|
+
});
|
|
11
|
+
it('accepts numeric order ID and converts to GID', async () => {
|
|
12
|
+
const result = await cancelOrderById(123);
|
|
13
|
+
expect(result).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
it('accepts bigint order ID and converts to GID', async () => {
|
|
16
|
+
const result = await cancelOrderById(12345678901234n);
|
|
17
|
+
expect(result).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
it('throws ShopifyUserError when order cancellation fails', async () => {
|
|
20
|
+
server.use(graphql.mutation('orderCancel', createGqlResponse(orderCancelErrorMock)));
|
|
21
|
+
await expect(cancelOrderById('gid://shopify/Order/456')).rejects.toThrow(ShopifyUserError);
|
|
22
|
+
});
|
|
23
|
+
it('preserves error details in ShopifyUserError', async () => {
|
|
24
|
+
server.use(graphql.mutation('orderCancel', createGqlResponse(orderCancelErrorMock)));
|
|
25
|
+
try {
|
|
26
|
+
await cancelOrderById('gid://shopify/Order/456');
|
|
27
|
+
expect.fail('Expected ShopifyUserError to be thrown');
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
expect(error).toBeInstanceOf(ShopifyUserError);
|
|
31
|
+
if (error instanceof ShopifyUserError) {
|
|
32
|
+
expect(error.errors).toHaveLength(1);
|
|
33
|
+
expect(error.errors[0]).toEqual({
|
|
34
|
+
code: 'ORDER_ALREADY_CANCELLED',
|
|
35
|
+
field: ['orderId'],
|
|
36
|
+
message: 'Order is already cancelled',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=cancelOrderById.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelOrderById.test.js","sourceRoot":"","sources":["../../../src/mutations/orders/cancelOrderById.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEhE,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;QACpE,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,yBAAyB,CAAC,CAAA;QAC/D,MAAM,CAAC,MAAM,CAA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AAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;gBACpC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;oBAC9B,IAAI,EAAE,yBAAyB;oBAC/B,KAAK,EAAE,CAAC,SAAS,CAAC;oBAClB,OAAO,EAAE,4BAA4B;iBACtC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -128,9 +128,9 @@ declare const GetLeanOrderByIdReturn: z.ZodNullable<z.ZodObject<{
|
|
|
128
128
|
financialStatus: string | null;
|
|
129
129
|
}>>;
|
|
130
130
|
export type LeanOrder = z.infer<typeof GetLeanOrderByIdReturn>;
|
|
131
|
-
export type FullOrder = NonNullable<OrderByIdFullQuery['order']
|
|
131
|
+
export type FullOrder = NonNullable<OrderByIdFullQuery['order']>;
|
|
132
132
|
export declare function getOrderById(id: number | bigint): Promise<LeanOrder>;
|
|
133
133
|
export declare function getOrderById(id: number | bigint, detailLevel: 'lean'): Promise<LeanOrder>;
|
|
134
|
-
export declare function getOrderById(id: number | bigint, detailLevel: 'full'): Promise<FullOrder>;
|
|
134
|
+
export declare function getOrderById(id: number | bigint, detailLevel: 'full'): Promise<FullOrder | null>;
|
|
135
135
|
export {};
|
|
136
136
|
//# sourceMappingURL=getOrderById.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrderById.d.ts","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AACnB,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,sDAAsD,CAAA;AAwB7D,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBf,CAAA;AAEb,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAG9D,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"getOrderById.d.ts","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AACnB,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,sDAAsD,CAAA;AAwB7D,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBf,CAAA;AAEb,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAG9D,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAA;AAKhE,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;AACrE,wBAAgB,YAAY,CAC1B,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,SAAS,CAAC,CAAA;AACrB,wBAAgB,YAAY,CAC1B,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAA"}
|
|
@@ -55,7 +55,7 @@ export declare const expectedFullOrderById: import("../../generated-api-types/20
|
|
|
55
55
|
fulfillmentLineItems: {
|
|
56
56
|
edges: Array<{
|
|
57
57
|
node: (Pick<import("../../generated-api-types/2025-04/admin.types").FulfillmentLineItem, "id" | "quantity"> & {
|
|
58
|
-
lineItem: Pick<import("../../generated-api-types/2025-04/admin.types").LineItem, "id">;
|
|
58
|
+
lineItem: Pick<import("../../generated-api-types/2025-04/admin.types").LineItem, "id" | "sku">;
|
|
59
59
|
});
|
|
60
60
|
}>;
|
|
61
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrderById.mock.d.ts","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,mDAAmD,CAAA;AAS1D,eAAO,MAAM,aAAa,EAAE,cAoC3B,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BjC,CAAA;AAGD,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"getOrderById.mock.d.ts","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,mDAAmD,CAAA;AAS1D,eAAO,MAAM,aAAa,EAAE,cAoC3B,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BjC,CAAA;AAGD,eAAO,MAAM,iBAAiB,EAAE,kBAmI/B,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;qBAnFc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmFW,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrderById.mock.js","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.mock.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,+CAA+C,CAAA;AAEtD,kBAAkB;AAClB,MAAM,CAAC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AE;wBACL;4BACE,IAAI,EAAE;gCACJ,EAAE,EAAE,gDAAgD;gCACpD,QAAQ,EAAE,CAAC;gCACX,QAAQ,EAAE;oCACR,EAAE,EAAE,qCAAqC;oCACzC,GAAG,EAAE,cAAc;iCACpB;6BACF;yBACF;qBACF;iBACF;aACF;SACF;QACD,YAAY,EAAE;YACZ,gBAAgB,EAAE;gBAChB,SAAS,EAAE;oBACT,MAAM,EAAE,MAAM;oBACd,YAAY,EAAE,YAAY,CAAC,GAAG;iBAC/B;aACF;SACF;QACD,QAAQ,EAAE;YACR;gBACE,QAAQ,EAAE;oBACR,SAAS,EAAE;wBACT,MAAM,EAAE,OAAO;wBACf,YAAY,EAAE,YAAY,CAAC,GAAG;qBAC/B;iBACF;aACF;SACF;QACD,iBAAiB,EAAE;YACjB,SAAS,EAAE;gBACT,MAAM,EAAE,KAAK;gBACb,YAAY,EAAE,YAAY,CAAC,GAAG;aAC/B;SACF;QACD,OAAO,EAAE,EAAE;KACZ;CACF,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,KAAK,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrderById.queries.d.ts","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.queries.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,QAsC1B,CAAA;AAED,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"getOrderById.queries.d.ts","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.queries.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,QAsC1B,CAAA;AAED,eAAO,MAAM,kBAAkB,QAqI9B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrderById.queries.js","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsChC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"getOrderById.queries.js","sourceRoot":"","sources":["../../../src/queries/orders/getOrderById.queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsChC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqIpC,CAAA"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
type GqlResponseHandler = (args: {
|
|
2
|
+
operationName: string;
|
|
3
|
+
query: string;
|
|
4
|
+
}) => Response;
|
|
5
|
+
export declare function createGqlResponse<T>(mockData: T): GqlResponseHandler;
|
|
6
|
+
export { graphql } from 'msw';
|
|
1
7
|
export declare const server: import("msw/node").SetupServerApi;
|
|
2
8
|
//# sourceMappingURL=mswHandlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mswHandlers.d.ts","sourceRoot":"","sources":["../../src/utils/mswHandlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mswHandlers.d.ts","sourceRoot":"","sources":["../../src/utils/mswHandlers.ts"],"names":[],"mappings":"AAqDA,KAAK,kBAAkB,GAAG,CAAC,IAAI,EAAE;IAC/B,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;CACd,KAAK,QAAQ,CAAA;AAEd,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,kBAAkB,CAUpE;AAED,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAE7B,eAAO,MAAM,MAAM,mCAA2B,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { graphql } from 'msw';
|
|
2
2
|
import { setupServer } from 'msw/node';
|
|
3
3
|
import { customerDeleteMock } from '../mutations/customers/deleteCustomerById.mock';
|
|
4
|
+
import { orderCancelSuccessMock } from '../mutations/orders/cancelOrderById.mock';
|
|
4
5
|
import { connectMetaObjectToProductVariantMock } from '../mutations/productVariantsBulkUpdate/connectMetaObjectToProductVariant.mock';
|
|
5
6
|
import { orderByIdFullMock, orderByIdMock, } from '../queries/orders/getOrderById.mock';
|
|
6
7
|
import { ordersByNameMock } from '../queries/orders/getOrderByName.mock';
|
|
@@ -14,6 +15,7 @@ const orders = [
|
|
|
14
15
|
graphql.query('ordersByName', createGqlResponse(ordersByNameMock)),
|
|
15
16
|
graphql.query('ordersByNameFull', createGqlResponse(ordersByNameMock)),
|
|
16
17
|
graphql.query('orderPaymentDetailsById', createGqlResponse(orderPaymentDetailsMock)),
|
|
18
|
+
graphql.mutation('orderCancel', createGqlResponse(orderCancelSuccessMock)),
|
|
17
19
|
];
|
|
18
20
|
const productVariants = [
|
|
19
21
|
graphql.query('productHandles', createGqlResponse(productHandlesMock)),
|
|
@@ -31,8 +33,8 @@ const handlers = [
|
|
|
31
33
|
...productVariantsBulkUpdate,
|
|
32
34
|
...customers,
|
|
33
35
|
];
|
|
34
|
-
function createGqlResponse(mockData) {
|
|
35
|
-
return ({ operationName, query
|
|
36
|
+
export function createGqlResponse(mockData) {
|
|
37
|
+
return ({ operationName, query }) => {
|
|
36
38
|
logger.debug(`[MSW] Mocking GraphQL query: ${operationName}`);
|
|
37
39
|
logger.debug(query);
|
|
38
40
|
return new Response(JSON.stringify({ data: mockData }), {
|
|
@@ -42,5 +44,6 @@ function createGqlResponse(mockData) {
|
|
|
42
44
|
});
|
|
43
45
|
};
|
|
44
46
|
}
|
|
47
|
+
export { graphql } from 'msw';
|
|
45
48
|
export const server = setupServer(...handlers);
|
|
46
49
|
//# sourceMappingURL=mswHandlers.js.map
|