From 5d643e883e1c6a603f30b500c0684f87ed76f386 Mon Sep 17 00:00:00 2001 From: Dominic Ferrando Date: Wed, 24 Jun 2026 16:38:00 -0400 Subject: [PATCH] Small getAll fixes --- apps/api/src/scripts/validate-products.ts | 2 +- apps/portal/src/routes/commerce/+page.server.ts | 6 +++--- packages/commerce/src/printful.ts | 4 ++-- packages/commerce/src/webflow.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/api/src/scripts/validate-products.ts b/apps/api/src/scripts/validate-products.ts index 14ee7a2..8321f1f 100644 --- a/apps/api/src/scripts/validate-products.ts +++ b/apps/api/src/scripts/validate-products.ts @@ -40,7 +40,7 @@ const webflow = new WebflowClient({ const syncer = new ProductSyncer(printful, webflow); -const wProducts = await webflow.Products.getAll(); +const wProducts = await webflow.Products.getAll({ forceAll: true }); let invalidCount = 0; for (const wProduct of wProducts) { diff --git a/apps/portal/src/routes/commerce/+page.server.ts b/apps/portal/src/routes/commerce/+page.server.ts index 5f961ca..5c0a9f8 100644 --- a/apps/portal/src/routes/commerce/+page.server.ts +++ b/apps/portal/src/routes/commerce/+page.server.ts @@ -17,11 +17,11 @@ const webflow = new WebflowClient({ webhookSecret: WEBFLOW_WEBHOOK_SECRET, }); -export const load = async ({}: Parameters[0]) => { +export const load = async ({ }: Parameters[0]) => { return { products: { - printful: printful.Products.getAll(), - webflow: webflow.Products.getAll(), + printful: printful.Products.getAll({ forceAll: true }), + webflow: webflow.Products.getAll({ forceAll: true }), }, }; }; diff --git a/packages/commerce/src/printful.ts b/packages/commerce/src/printful.ts index 3c049e4..3d5a65b 100644 --- a/packages/commerce/src/printful.ts +++ b/packages/commerce/src/printful.ts @@ -47,7 +47,7 @@ class ProductsClient { this.Variants = new VariantsClient(creds); } - async getAll(opt: PagingOptions): Promise { + async getAll(opt: PagingOptions = {}): Promise { const allSyncProducts: Printful.Products.SyncProduct[] = []; let offset = opt.offset ?? 0; do { @@ -103,7 +103,7 @@ class OrdersClient { if (!res.ok) throw new PrintfulError("Failed to create Printful order", res.status, await parsePayload(res)); } - async getAll(opt: PagingOptions): Promise { + async getAll(opt: PagingOptions = {}): Promise { const allPrintfulOrders: Printful.Orders.Order[] = []; let offset = opt.offset ?? 0; do { diff --git a/packages/commerce/src/webflow.ts b/packages/commerce/src/webflow.ts index 553c089..fa91ff0 100644 --- a/packages/commerce/src/webflow.ts +++ b/packages/commerce/src/webflow.ts @@ -95,7 +95,7 @@ class ProductsClient { return payload.product.id; } - async getAll(opt: PagingOptions): Promise { + async getAll(opt: PagingOptions = {}): Promise { const allWebflowProducts: Webflow.Products.ProductAndSkus[] = []; let offset = opt.offset ?? 0; do { @@ -156,7 +156,7 @@ class ProductsClient { class OrdersClient { constructor(private creds: Credentials) { } - async getAll(opt: PagingOptions & { status?: Webflow.Orders.Order["status"] }): Promise { + async getAll(opt: PagingOptions & { status?: Webflow.Orders.Order["status"] } = {}): Promise { const allOrders: Webflow.Orders.Order[] = []; let offset = opt.offset ?? 0; do {