@godaddy/gd-commerce-server 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -2
  2. package/package.json +9 -10
package/dist/index.js CHANGED
@@ -1166,9 +1166,11 @@ function buildSkuGroupVariables({ productId, selectedAttributeValues, skuGroupFi
1166
1166
  //#region src/server/api/commerce/products/[id]/GET.ts
1167
1167
  const skuGroupQuery = `
1168
1168
  query SkuGroup($id: String!, $first: Int, $attributeValues: [String!] = []) {
1169
+ activeSkuGroups: skuGroups(id: { in: [$id] }, status: { eq: "ACTIVE" }, first: 1) {
1170
+ edges { node { id } }
1171
+ }
1169
1172
  skuGroup(id: $id) {
1170
1173
  id
1171
- status
1172
1174
  name
1173
1175
  label
1174
1176
  description
@@ -1282,7 +1284,11 @@ async function handler$9(req, res) {
1282
1284
  clientId
1283
1285
  })
1284
1286
  });
1285
- res.json(data);
1287
+ if (!data.skuGroup || !data.activeSkuGroups?.edges?.some((edge) => edge?.node?.id === productId)) {
1288
+ res.status(404).json({ error: "Product not found" });
1289
+ return;
1290
+ }
1291
+ res.json({ skuGroup: data.skuGroup });
1286
1292
  } catch (error) {
1287
1293
  res.status(500).json({
1288
1294
  error: "Failed to load product",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@godaddy/gd-commerce-server",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Opinionated Express server integration for GoDaddy Commerce",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -19,14 +19,6 @@
19
19
  },
20
20
  "./package.json": "./package.json"
21
21
  },
22
- "scripts": {
23
- "build": "tsdown",
24
- "typecheck": "tsc --noEmit",
25
- "test": "vitest run",
26
- "lint": "biome check src",
27
- "lint:fix": "biome check --write src",
28
- "prepublishOnly": "pnpm build"
29
- },
30
22
  "peerDependencies": {
31
23
  "express": "^5.0.0"
32
24
  },
@@ -47,5 +39,12 @@
47
39
  "type": "git",
48
40
  "url": "git+https://github.com/godaddy/javascript.git",
49
41
  "directory": "packages/commerce-server"
42
+ },
43
+ "scripts": {
44
+ "build": "tsdown",
45
+ "typecheck": "tsc --noEmit",
46
+ "test": "vitest run",
47
+ "lint": "biome check src",
48
+ "lint:fix": "biome check --write src"
50
49
  }
51
- }
50
+ }