@01.software/cli 0.10.1 → 0.10.4

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.
@@ -74,7 +74,7 @@ function parseJsonWhere(where) {
74
74
  }
75
75
  }
76
76
 
77
- // ../../packages/auth-contracts/dist/index.js
77
+ // ../../packages/auth-contracts/src/index.ts
78
78
  var MCP_RESOURCE_AUDIENCE = "https://mcp.01.software/mcp";
79
79
  var MCP_OAUTH_ISSUER = "https://01.software";
80
80
  var MCP_PROTECTED_RESOURCE_METADATA_PATH = "/.well-known/oauth-protected-resource/mcp";
@@ -88,8 +88,9 @@ var MCP_CONSOLE_SERVICE_AUDIENCE = "https://api.01.software/internal/mcp";
88
88
  var MCP_CONSOLE_SERVICE_SCOPE = "console:mcp_proxy";
89
89
  var MCP_SERVICE_TOKEN_LIFETIME_SECONDS = 60;
90
90
 
91
- // ../../packages/contracts/src/tenant/index.ts
91
+ // ../../packages/contracts/dist/index.js
92
92
  import { z } from "zod";
93
+ import { z as z2 } from "zod";
93
94
  var tenantFieldConfigStateSchema = z.object({
94
95
  hiddenFields: z.array(z.string()),
95
96
  isHidden: z.boolean()
@@ -238,9 +239,6 @@ var collectionSchemaResponseSchema = z.object({
238
239
  fields: z.array(collectionFieldSchema)
239
240
  }).strict()
240
241
  }).strict();
241
-
242
- // ../../packages/contracts/src/ecommerce/index.ts
243
- import { z as z2 } from "zod";
244
242
  var transactionStatusSchema = z2.enum([
245
243
  "pending",
246
244
  "paid",
@@ -292,7 +290,8 @@ var restockActionSchema = z2.enum(["return_to_stock", "discard"]);
292
290
  var returnWithRefundItemSchema = z2.object({
293
291
  orderItem: z2.union([z2.string(), z2.number()]).transform(String),
294
292
  quantity: z2.number().int().positive("quantity must be a positive integer"),
295
- restockAction: restockActionSchema.default("return_to_stock")
293
+ restockAction: restockActionSchema.default("return_to_stock"),
294
+ restockingFee: z2.number().min(0, "restockingFee must be non-negative").optional().describe("Restocking fee charged for this line (ADR 0005 \xA7Gap 1)")
296
295
  }).strict();
297
296
  var returnWithRefundSchema = z2.object({
298
297
  orderNumber: z2.string().min(1, "orderNumber is required").describe("Order number (required)"),
@@ -300,13 +299,12 @@ var returnWithRefundSchema = z2.object({
300
299
  reasonDetail: z2.string().optional().describe("Detailed reason text (optional)"),
301
300
  returnItems: z2.array(returnWithRefundItemSchema).min(1, "At least one return item is required").max(100, "Too many return items").describe("Array of products to return (required)"),
302
301
  refundAmount: z2.number().min(0, "refundAmount must be non-negative").describe("Refund amount (required, min 0)"),
302
+ returnShippingFee: z2.number().min(0, "returnShippingFee must be non-negative").optional().describe("Return shipping fee charged to the customer (ADR 0005 \xA7Gap 1)"),
303
303
  pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("PG payment ID for refund (required)"),
304
304
  paymentKey: z2.string().min(1).optional().describe("Provider payment key for verified refund"),
305
305
  refundReceiptUrl: z2.string().optional().describe("Refund receipt URL (optional)")
306
306
  }).strict();
307
307
  var ReturnWithRefundSchema = returnWithRefundSchema;
308
-
309
- // ../../packages/contracts/src/mcp/index.ts
310
308
  var MCP_TOOL_CONTRACT = {
311
309
  "query-collection": {
312
310
  consoleRole: "tenant-viewer",
@@ -328,6 +326,16 @@ var MCP_TOOL_CONTRACT = {
328
326
  oauthScope: "mcp:read",
329
327
  readOnly: true
330
328
  },
329
+ "product-detail": {
330
+ consoleRole: "tenant-viewer",
331
+ oauthScope: "mcp:read",
332
+ readOnly: true
333
+ },
334
+ "product-upsert": {
335
+ consoleRole: "tenant-admin",
336
+ oauthScope: "mcp:write",
337
+ readOnly: false
338
+ },
331
339
  "validate-discount": {
332
340
  consoleRole: "tenant-viewer",
333
341
  oauthScope: "mcp:read",
@@ -527,6 +535,21 @@ var TOOL_POLICY_MANIFEST = {
527
535
  consoleSurface: "GET /api/products/{id}/stock",
528
536
  annotationPolicy: READ_ONLY_ANNOTATION
529
537
  },
538
+ "product-detail": {
539
+ category: "read-only-collection",
540
+ oauthScope: MCP_SCOPES.read,
541
+ consoleRole: "tenant-viewer",
542
+ consoleSurface: "GET /api/products/detail",
543
+ annotationPolicy: READ_ONLY_ANNOTATION
544
+ },
545
+ "product-upsert": {
546
+ category: "mutation-product",
547
+ oauthScope: MCP_SCOPES.write,
548
+ consoleRole: "tenant-admin",
549
+ consoleSurface: "POST /api/products/upsert",
550
+ annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
551
+ exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
552
+ },
530
553
  "validate-discount": {
531
554
  category: "read-only-collection",
532
555
  oauthScope: MCP_SCOPES.read,
@@ -880,9 +903,12 @@ function signMcpServiceToken(context) {
880
903
  }
881
904
 
882
905
  // src/lib/console-api.ts
883
- var BASE_URL = process.env.SOFTWARE_API_URL || "http://localhost:3000";
906
+ var DEFAULT_API_URL = "https://api.01.software";
884
907
  var TIMEOUT_MS = 5e3;
885
908
  var MISSING_HTTP_AUTH_CONTEXT_ERROR = "MCP HTTP requests require a validated OAuth tenant context before tool execution.";
909
+ function resolveConsoleApiUrl() {
910
+ return (process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL || DEFAULT_API_URL).replace(/\/$/, "");
911
+ }
886
912
  function resolveAuthHeaderContext() {
887
913
  const oauthContext = tenantAuthContext();
888
914
  if (oauthContext) {
@@ -932,7 +958,7 @@ async function consoleGet(path, apiKey) {
932
958
  const controller = new AbortController();
933
959
  const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
934
960
  try {
935
- const res = await fetch(`${BASE_URL}${path}`, {
961
+ const res = await fetch(`${resolveConsoleApiUrl()}${path}`, {
936
962
  headers: authHeaders,
937
963
  signal: controller.signal
938
964
  });
@@ -951,7 +977,7 @@ async function consolePost(path, body, apiKey) {
951
977
  const controller = new AbortController();
952
978
  const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
953
979
  try {
954
- const res = await fetch(`${BASE_URL}${path}`, {
980
+ const res = await fetch(`${resolveConsoleApiUrl()}${path}`, {
955
981
  method: "POST",
956
982
  headers: { ...authHeaders, "Content-Type": "application/json" },
957
983
  body: JSON.stringify(body),
@@ -972,7 +998,7 @@ async function consolePostTelemetry(path, body, apiKey) {
972
998
  const controller = new AbortController();
973
999
  const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
974
1000
  try {
975
- const res = await fetch(`${BASE_URL}${path}`, {
1001
+ const res = await fetch(`${resolveConsoleApiUrl()}${path}`, {
976
1002
  method: "POST",
977
1003
  headers: { ...authHeaders, "Content-Type": "application/json" },
978
1004
  body: JSON.stringify(body),
@@ -1073,7 +1099,7 @@ async function swallow(promise) {
1073
1099
  import { z as z3 } from "zod";
1074
1100
 
1075
1101
  // src/lib/client.ts
1076
- import { createServerClient } from "@01.software/sdk";
1102
+ import { createServerClient } from "@01.software/sdk/server";
1077
1103
  var MISSING_HTTP_AUTH_CONTEXT_ERROR2 = "MCP HTTP requests require a validated OAuth tenant context before tool execution.";
1078
1104
  var HTTP_OAUTH_SDK_CLIENT_ERROR = "MCP HTTP OAuth requests cannot use SDK-backed tools. Use reviewed Console service endpoints for OAuth transport.";
1079
1105
  function getClient() {
@@ -1870,6 +1896,122 @@ async function stockCheck({
1870
1896
  }
1871
1897
  }
1872
1898
 
1899
+ // src/tools/product-detail.ts
1900
+ import { z as z22 } from "zod";
1901
+ var schema22 = {
1902
+ slug: z22.string().optional().describe("Product slug (one of slug or id required)"),
1903
+ id: z22.string().optional().describe("Product id (one of slug or id required)")
1904
+ };
1905
+ var metadata22 = {
1906
+ name: "product-detail",
1907
+ description: "Fetch full product detail by slug or id. Returns one resolver-ready product with variants, option slugs, option value slugs/media, brand, categories, tags, images, videos, and listing rollup, or null if missing/unpublished/wrong tenant/feature disabled.",
1908
+ annotations: {
1909
+ title: "Get product detail",
1910
+ readOnlyHint: true,
1911
+ destructiveHint: false,
1912
+ idempotentHint: true
1913
+ }
1914
+ };
1915
+ async function productDetail({
1916
+ slug,
1917
+ id
1918
+ }) {
1919
+ try {
1920
+ if (Boolean(slug) === Boolean(id)) {
1921
+ return toolError(new Error("Provide exactly one of slug or id"));
1922
+ }
1923
+ const client = getClient();
1924
+ const params = slug ? { slug } : { id };
1925
+ const result = await client.commerce.product.detail(params);
1926
+ return toolSuccess({ data: result });
1927
+ } catch (error) {
1928
+ return toolError(error);
1929
+ }
1930
+ }
1931
+
1932
+ // src/tools/product-upsert.ts
1933
+ import { z as z23 } from "zod";
1934
+ var optionValueSchema = z23.object({
1935
+ id: z23.string().optional().describe("Stable existing option-value ID for rename-safe updates"),
1936
+ value: z23.string().describe("Display label (e.g. Black, S)"),
1937
+ slug: z23.string().optional().describe(
1938
+ "Optional compatibility value token. The server generates one from value on create when omitted; not canonical identity."
1939
+ ),
1940
+ swatchColor: z23.string().nullable().optional(),
1941
+ thumbnail: z23.string().nullable().optional(),
1942
+ images: z23.array(z23.string()).optional(),
1943
+ metadata: z23.unknown().optional()
1944
+ });
1945
+ var optionSchema = z23.object({
1946
+ id: z23.string().optional().describe("Stable existing option ID for rename-safe updates"),
1947
+ title: z23.string().describe("Option name (e.g. Color, Size)"),
1948
+ slug: z23.string().optional().describe(
1949
+ "Optional compatibility option token. The server generates one from title on create when omitted; not canonical identity."
1950
+ ),
1951
+ values: z23.array(optionValueSchema).describe("Allowed option values")
1952
+ });
1953
+ var variantOptionValueSchema = z23.object({
1954
+ valueSlug: z23.string().optional(),
1955
+ valueId: z23.string().optional(),
1956
+ value: z23.string().optional()
1957
+ });
1958
+ var variantSchema = z23.object({
1959
+ id: z23.string().optional().describe("Existing variant ID for updates"),
1960
+ optionValues: z23.union([
1961
+ z23.record(z23.string(), z23.union([z23.string(), variantOptionValueSchema])),
1962
+ z23.array(z23.string())
1963
+ ]).optional().describe(
1964
+ "Option-value selection. Prefer stable option-value IDs, either as an array or object values using { valueId }. Slug maps and exact { OptionTitle: ValueLabel } maps remain compatibility-only and fail when labels are ambiguous."
1965
+ ),
1966
+ sku: z23.string().nullable().optional(),
1967
+ title: z23.string().nullable().optional(),
1968
+ price: z23.number().nonnegative().describe("Selling price (KRW, min 0)"),
1969
+ compareAtPrice: z23.number().nonnegative().nullable().optional(),
1970
+ stock: z23.number().int().nonnegative().optional(),
1971
+ isUnlimited: z23.boolean().optional(),
1972
+ weight: z23.number().nonnegative().nullable().optional(),
1973
+ requiresShipping: z23.boolean().optional(),
1974
+ barcode: z23.string().nullable().optional(),
1975
+ externalId: z23.string().nullable().optional(),
1976
+ isActive: z23.boolean().optional(),
1977
+ thumbnail: z23.string().nullable().optional(),
1978
+ images: z23.array(z23.string()).optional(),
1979
+ metadata: z23.unknown().optional()
1980
+ });
1981
+ var schema23 = {
1982
+ product: z23.record(z23.string(), z23.unknown()).describe(
1983
+ "Product fields. Include `id` to update an existing product; omit for create (then `title` is required)."
1984
+ ),
1985
+ options: z23.array(optionSchema).optional().describe(
1986
+ "Option definitions. Include stable option/value IDs when updating or renaming existing rows. Slugs are optional compatibility metadata generated from title/value on create when omitted; omitted options on an existing product are deleted (with their values)."
1987
+ ),
1988
+ variants: z23.array(variantSchema).optional().describe(
1989
+ "Variant rows. Prefer stable option-value IDs in optionValues. Slug/title maps are compatibility inputs. Omitted variants on an existing product are deleted, unless referenced by an active cart or non-terminal order \u2014 those are soft-deactivated (isActive: false)."
1990
+ )
1991
+ };
1992
+ var metadata23 = {
1993
+ name: "product-upsert",
1994
+ description: "Atomically create or update a product together with its options, option-values, and variants in a single transaction. Mirrors Shopify productSet semantics. Any failure rolls back the entire write.",
1995
+ annotations: {
1996
+ title: "Upsert product (atomic)",
1997
+ readOnlyHint: false,
1998
+ destructiveHint: true,
1999
+ idempotentHint: true,
2000
+ openWorldHint: false
2001
+ }
2002
+ };
2003
+ async function productUpsert(params) {
2004
+ try {
2005
+ const client = getClient();
2006
+ const result = await client.commerce.product.upsert(
2007
+ params
2008
+ );
2009
+ return toolSuccess({ data: result });
2010
+ } catch (error) {
2011
+ return toolError(error);
2012
+ }
2013
+ }
2014
+
1873
2015
  // src/tools/get-collection-schema.ts
1874
2016
  import { SERVER_COLLECTIONS as SERVER_COLLECTIONS3 } from "@01.software/sdk";
1875
2017
 
@@ -1884,8 +2026,8 @@ async function getCollectionSchema(collection) {
1884
2026
  }
1885
2027
 
1886
2028
  // src/tools/get-collection-schema.ts
1887
- var schema22 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
1888
- var metadata22 = {
2029
+ var schema24 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2030
+ var metadata24 = {
1889
2031
  name: "get-collection-schema",
1890
2032
  description: "Get the authoritative tenant-aware collection schema from console. Use this before create/update to understand writable fields, hidden fields, required metadata, and collection-level visibility.",
1891
2033
  annotations: {
@@ -1936,8 +2078,8 @@ async function getTenantFeatureProgress(feature, includeEvidence = false) {
1936
2078
  }
1937
2079
 
1938
2080
  // src/tools/get-tenant-context.ts
1939
- var schema23 = tenantContextToolInputSchema.shape;
1940
- var metadata23 = {
2081
+ var schema25 = tenantContextToolInputSchema.shape;
2082
+ var metadata25 = {
1941
2083
  name: "get-tenant-context",
1942
2084
  description: "Get current tenant features, active collections, and field visibility. Call this at the start of every session. Use includeCounts=true to also get per-collection document counts for setup diagnostics.",
1943
2085
  annotations: {
@@ -2014,8 +2156,8 @@ async function handler({
2014
2156
  }
2015
2157
 
2016
2158
  // src/tools/check-feature-progress.ts
2017
- var schema24 = tenantFeatureProgressInputSchema.shape;
2018
- var metadata24 = {
2159
+ var schema26 = tenantFeatureProgressInputSchema.shape;
2160
+ var metadata26 = {
2019
2161
  name: "check-feature-progress",
2020
2162
  description: "Check tenant implementation progress for a supported feature. Start with feature=ecommerce to inspect catalog, cart, checkout, payment result, webhook, and operations readiness without mutating tenant data.",
2021
2163
  annotations: {
@@ -2038,7 +2180,7 @@ async function handler2({
2038
2180
  }
2039
2181
 
2040
2182
  // src/tools/list-configurable-fields.ts
2041
- import { z as z22 } from "zod";
2183
+ import { z as z24 } from "zod";
2042
2184
 
2043
2185
  // src/lib/field-config.ts
2044
2186
  async function fetchFieldConfigs() {
@@ -2061,12 +2203,12 @@ function invalidateFieldConfigCache() {
2061
2203
  }
2062
2204
 
2063
2205
  // src/tools/list-configurable-fields.ts
2064
- var schema25 = {
2065
- collection: z22.string().optional().describe(
2206
+ var schema27 = {
2207
+ collection: z24.string().optional().describe(
2066
2208
  "Filter by collection slug (optional \u2014 returns all if omitted). Use this filter to reduce response size when you know which collection to check."
2067
2209
  )
2068
2210
  };
2069
- var metadata25 = {
2211
+ var metadata27 = {
2070
2212
  name: "list-configurable-fields",
2071
2213
  description: "List all configurable fields for tenant collections with current visibility state. Shows which fields can be shown/hidden and their current status. Returns all collections including inactive features \u2014 cross-reference with get-tenant-context for active features. Response includes ~300 fields across 47 collections \u2014 use collection filter when possible.",
2072
2214
  annotations: {
@@ -2097,17 +2239,17 @@ async function listConfigurableFields(params) {
2097
2239
  }
2098
2240
 
2099
2241
  // src/tools/update-field-config.ts
2100
- import { z as z23 } from "zod";
2101
- var schema26 = {
2102
- collection: z23.string().min(1).describe("Collection slug (required)"),
2103
- hiddenFields: z23.array(z23.string().min(1).max(200)).max(300).describe(
2242
+ import { z as z25 } from "zod";
2243
+ var schema28 = {
2244
+ collection: z25.string().min(1).describe("Collection slug (required)"),
2245
+ hiddenFields: z25.array(z25.string().min(1).max(200)).max(300).describe(
2104
2246
  "Fields to hide (required). This is a FULL REPLACE \u2014 fields NOT in this list will be shown. Pass [] to show all fields. Use list-configurable-fields first to see available field paths."
2105
2247
  ),
2106
- isHidden: z23.boolean().optional().describe(
2248
+ isHidden: z25.boolean().optional().describe(
2107
2249
  "Hide the entire collection from Admin Panel (optional). When true, individual hiddenFields are irrelevant."
2108
2250
  )
2109
2251
  };
2110
- var metadata26 = {
2252
+ var metadata28 = {
2111
2253
  name: "update-field-config",
2112
2254
  description: "Update field visibility configuration for a tenant collection. Hidden fields are removed from the Admin Panel UI. IMPORTANT: hiddenFields is a full replace, not a merge. Always call list-configurable-fields first to see current state.",
2113
2255
  annotations: {
@@ -2135,7 +2277,7 @@ async function updateFieldConfig(params) {
2135
2277
  }
2136
2278
 
2137
2279
  // src/tools/sdk-get-recipe.ts
2138
- import { z as z24 } from "zod";
2280
+ import { z as z26 } from "zod";
2139
2281
 
2140
2282
  // src/lib/sdk-recipes.ts
2141
2283
  var recipes = {
@@ -2145,14 +2287,16 @@ var recipes = {
2145
2287
  recommendedSurface: "react-query",
2146
2288
  runtime: "browser",
2147
2289
  code: `import { createClient } from '@01.software/sdk'
2290
+ import { createQueryHooks } from '@01.software/sdk/query'
2148
2291
 
2149
2292
  const client = createClient({
2150
2293
  publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
2151
2294
  })
2295
+ const query = createQueryHooks(client)
2152
2296
 
2153
2297
  // React Query hook \u2014 handles caching and background updates
2154
2298
  function ProductList() {
2155
- const { data, isLoading, error } = client.query.useQuery({
2299
+ const { data, isLoading, error } = query.useQuery({
2156
2300
  collection: 'products',
2157
2301
  options: {
2158
2302
  where: { status: { equals: 'published' } },
@@ -2184,7 +2328,7 @@ function ProductList() {
2184
2328
  title: "Fetch collection list (server)",
2185
2329
  recommendedSurface: "query-builder",
2186
2330
  runtime: "server",
2187
- code: `import { createServerClient } from '@01.software/sdk'
2331
+ code: `import { createServerClient } from '@01.software/sdk/server'
2188
2332
 
2189
2333
  const client = createServerClient({
2190
2334
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -2217,13 +2361,15 @@ const result = await client.collections.from('products').find({
2217
2361
  recommendedSurface: "react-query",
2218
2362
  runtime: "browser",
2219
2363
  code: `import { createClient } from '@01.software/sdk'
2364
+ import { createQueryHooks } from '@01.software/sdk/query'
2220
2365
 
2221
2366
  const client = createClient({
2222
2367
  publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
2223
2368
  })
2369
+ const query = createQueryHooks(client)
2224
2370
 
2225
2371
  function ProductDetail({ id }: { id: string }) {
2226
- const { data, isLoading } = client.query.useQueryById({
2372
+ const { data, isLoading } = query.useQueryById({
2227
2373
  collection: 'products',
2228
2374
  id,
2229
2375
  })
@@ -2243,7 +2389,7 @@ function ProductDetail({ id }: { id: string }) {
2243
2389
  title: "Fetch single item by ID (server)",
2244
2390
  recommendedSurface: "query-builder",
2245
2391
  runtime: "server",
2246
- code: `import { createServerClient } from '@01.software/sdk'
2392
+ code: `import { createServerClient } from '@01.software/sdk/server'
2247
2393
 
2248
2394
  const client = createServerClient({
2249
2395
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -2266,7 +2412,7 @@ console.log(product.title)`,
2266
2412
  title: "Create a new item (server only)",
2267
2413
  recommendedSurface: "server-api",
2268
2414
  runtime: "server",
2269
- code: `import { createServerClient } from '@01.software/sdk'
2415
+ code: `import { createServerClient } from '@01.software/sdk/server'
2270
2416
 
2271
2417
  const client = createServerClient({
2272
2418
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -2295,7 +2441,7 @@ const result = await client.collections.from('products').create({
2295
2441
  title: "Update an existing item (server only)",
2296
2442
  recommendedSurface: "server-api",
2297
2443
  runtime: "server",
2298
- code: `import { createServerClient } from '@01.software/sdk'
2444
+ code: `import { createServerClient } from '@01.software/sdk/server'
2299
2445
 
2300
2446
  const client = createServerClient({
2301
2447
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -2324,7 +2470,7 @@ const result = await client.collections.from('products').update('product-id', {
2324
2470
  title: "Delete an item (server only)",
2325
2471
  recommendedSurface: "server-api",
2326
2472
  runtime: "server",
2327
- code: `import { createServerClient } from '@01.software/sdk'
2473
+ code: `import { createServerClient } from '@01.software/sdk/server'
2328
2474
 
2329
2475
  const client = createServerClient({
2330
2476
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -2349,10 +2495,12 @@ console.log('Deleted:', deleted.title)`,
2349
2495
  recommendedSurface: "react-query",
2350
2496
  runtime: "browser",
2351
2497
  code: `import { createClient } from '@01.software/sdk'
2498
+ import { createQueryHooks } from '@01.software/sdk/query'
2352
2499
 
2353
2500
  const client = createClient({
2354
2501
  publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
2355
2502
  })
2503
+ const query = createQueryHooks(client)
2356
2504
 
2357
2505
  function InfiniteProductList() {
2358
2506
  const {
@@ -2361,7 +2509,7 @@ function InfiniteProductList() {
2361
2509
  hasNextPage,
2362
2510
  isFetchingNextPage,
2363
2511
  isLoading,
2364
- } = client.query.useInfiniteQuery({
2512
+ } = query.useInfiniteQuery({
2365
2513
  collection: 'products',
2366
2514
  options: { where: { status: { equals: 'published' } } },
2367
2515
  pageSize: 20,
@@ -2396,7 +2544,8 @@ function InfiniteProductList() {
2396
2544
  title: "SSR data prefetching (server)",
2397
2545
  recommendedSurface: "react-query",
2398
2546
  runtime: "server",
2399
- code: `import { createServerClient } from '@01.software/sdk'
2547
+ code: `import { createServerClient } from '@01.software/sdk/server'
2548
+ import { createServerQueryHooks, getQueryClient } from '@01.software/sdk/query'
2400
2549
  import { dehydrate, HydrationBoundary } from '@tanstack/react-query'
2401
2550
 
2402
2551
  // In a Next.js Server Component or getServerSideProps:
@@ -2404,27 +2553,29 @@ const client = createServerClient({
2404
2553
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
2405
2554
  secretKey: process.env.SOFTWARE_SECRET_KEY!,
2406
2555
  })
2556
+ const queryClient = getQueryClient()
2557
+ const serverQuery = createServerQueryHooks(client, queryClient)
2407
2558
 
2408
2559
  // Prefetch list \u2014 client hydrates instantly without a loading state
2409
- await client.query.prefetchQuery({
2560
+ await serverQuery.prefetchQuery({
2410
2561
  collection: 'products',
2411
2562
  options: { limit: 20 },
2412
2563
  })
2413
2564
 
2414
2565
  // Prefetch single item
2415
- await client.query.prefetchQueryById({
2566
+ await serverQuery.prefetchQueryById({
2416
2567
  collection: 'products',
2417
2568
  id: 'product-id',
2418
2569
  })
2419
2570
 
2420
2571
  // Prefetch infinite list
2421
- await client.query.prefetchInfiniteQuery({
2572
+ await serverQuery.prefetchInfiniteQuery({
2422
2573
  collection: 'products',
2423
2574
  pageSize: 20,
2424
2575
  })
2425
2576
 
2426
2577
  // Dehydrate and pass to client
2427
- const state = dehydrate(client.query.queryClient)
2578
+ const state = dehydrate(queryClient)
2428
2579
 
2429
2580
  export default function Page() {
2430
2581
  return (
@@ -2494,7 +2645,7 @@ await client.customer.resetPassword(token, 'newPassword123')`,
2494
2645
  title: "File upload pattern (server)",
2495
2646
  recommendedSurface: "server-api",
2496
2647
  runtime: "server",
2497
- code: `import { createServerClient } from '@01.software/sdk'
2648
+ code: `import { createServerClient } from '@01.software/sdk/server'
2498
2649
 
2499
2650
  const client = createServerClient({
2500
2651
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -2525,7 +2676,7 @@ const result = await client.collections.from('images').create(formData as unknow
2525
2676
  title: "Bulk update/delete (server only)",
2526
2677
  recommendedSurface: "server-api",
2527
2678
  runtime: "server",
2528
- code: `import { createServerClient } from '@01.software/sdk'
2679
+ code: `import { createServerClient } from '@01.software/sdk/server'
2529
2680
 
2530
2681
  const client = createServerClient({
2531
2682
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -2567,8 +2718,8 @@ function getRecipe(goal, runtime = "both") {
2567
2718
  }
2568
2719
 
2569
2720
  // src/tools/sdk-get-recipe.ts
2570
- var schema27 = {
2571
- goal: z24.enum([
2721
+ var schema29 = {
2722
+ goal: z26.enum([
2572
2723
  "fetch-list",
2573
2724
  "fetch-by-id",
2574
2725
  "create-item",
@@ -2580,11 +2731,11 @@ var schema27 = {
2580
2731
  "file-upload",
2581
2732
  "bulk-operations"
2582
2733
  ]).describe("What the user wants to accomplish"),
2583
- runtime: z24.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2584
- collection: z24.string().optional().describe("Specific collection name if applicable"),
2585
- includeExample: z24.boolean().default(true).describe("Whether to include a full code example")
2734
+ runtime: z26.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2735
+ collection: z26.string().optional().describe("Specific collection name if applicable"),
2736
+ includeExample: z26.boolean().default(true).describe("Whether to include a full code example")
2586
2737
  };
2587
- var metadata27 = {
2738
+ var metadata29 = {
2588
2739
  name: "sdk-get-recipe",
2589
2740
  description: "Get a complete SDK code recipe for a specific task. Returns recommended approach, code example, and related documentation links. Use this FIRST when the user asks how to do something with the SDK.",
2590
2741
  annotations: {
@@ -2627,7 +2778,7 @@ function handler3({
2627
2778
  }
2628
2779
 
2629
2780
  // src/tools/sdk-search-docs.ts
2630
- import { z as z25 } from "zod";
2781
+ import { z as z27 } from "zod";
2631
2782
 
2632
2783
  // src/lib/sdk-doc-index.ts
2633
2784
  var docIndex = [
@@ -2677,15 +2828,15 @@ var docIndex = [
2677
2828
  },
2678
2829
  {
2679
2830
  title: "Query Builder \u2014 Metadata Generation",
2680
- keywords: ["metadata", "findMetadata", "findMetadataById", "next.js metadata", "seo", "open graph", "query builder"],
2681
- summary: "client.collections.from(collection).findMetadata(options, config) and findMetadataById(id, config) generate Next.js Metadata objects from collection fields.",
2831
+ keywords: ["metadata", "generateMetadata", "extractSeo", "next.js metadata", "seo", "open graph", "query builder"],
2832
+ summary: "Use @01.software/sdk/metadata helpers with fetched documents to generate Metadata-shaped SEO objects without pulling Next.js into the root SDK entry.",
2682
2833
  resourceUri: "docs://sdk/query-builder"
2683
2834
  },
2684
2835
  // React Query Hooks
2685
2836
  {
2686
2837
  title: "React Query \u2014 useQuery()",
2687
2838
  keywords: ["useQuery", "react query", "hook", "list", "fetch", "collection", "cache", "react"],
2688
- summary: "client.query.useQuery({ collection, options }) \u2014 fetches a list with caching and background updates. Use inside a React component.",
2839
+ summary: "createQueryHooks(client).useQuery({ collection, options }) \u2014 fetches a list with caching and background updates. Use inside a React component.",
2689
2840
  resourceUri: "docs://sdk/react-query"
2690
2841
  },
2691
2842
  {
@@ -2697,7 +2848,7 @@ var docIndex = [
2697
2848
  {
2698
2849
  title: "React Query \u2014 useInfiniteQuery()",
2699
2850
  keywords: ["useInfiniteQuery", "useSuspenseInfiniteQuery", "infinite scroll", "load more", "pagination", "react query", "hook"],
2700
- summary: "client.query.useInfiniteQuery({ collection, options, pageSize }) \u2014 infinite scrolling. data.pages is an array of pages; flatten with flatMap for all docs.",
2851
+ summary: "createQueryHooks(client).useInfiniteQuery({ collection, options, pageSize }) \u2014 infinite scrolling. data.pages is an array of pages; flatten with flatMap for all docs.",
2701
2852
  resourceUri: "docs://sdk/react-query"
2702
2853
  },
2703
2854
  {
@@ -2716,7 +2867,7 @@ var docIndex = [
2716
2867
  {
2717
2868
  title: "Cache Invalidation and Manual Cache Management",
2718
2869
  keywords: ["invalidateQueries", "getQueryData", "setQueryData", "cache", "invalidate", "optimistic update", "react query"],
2719
- summary: "client.query.invalidateQueries(collection, type) triggers refetch. getQueryData/setQueryData allow manual optimistic updates.",
2870
+ summary: "query.invalidateQueries(collection, type) triggers refetch. getQueryData/setQueryData allow manual optimistic updates.",
2720
2871
  resourceUri: "docs://sdk/react-query"
2721
2872
  },
2722
2873
  // Filtering
@@ -2802,11 +2953,11 @@ function searchDocs(query, limit = 5) {
2802
2953
  }
2803
2954
 
2804
2955
  // src/tools/sdk-search-docs.ts
2805
- var schema28 = {
2806
- query: z25.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
2807
- limit: z25.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
2956
+ var schema30 = {
2957
+ query: z27.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
2958
+ limit: z27.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
2808
2959
  };
2809
- var metadata28 = {
2960
+ var metadata30 = {
2810
2961
  name: "sdk-search-docs",
2811
2962
  description: "Search SDK documentation by keyword. Returns matching topics with summaries and resource links. Use when looking for specific SDK features or patterns.",
2812
2963
  annotations: {
@@ -2841,9 +2992,9 @@ function handler4({
2841
2992
  }
2842
2993
 
2843
2994
  // src/tools/sdk-get-auth-setup.ts
2844
- import { z as z26 } from "zod";
2845
- var schema29 = {
2846
- scenario: z26.enum([
2995
+ import { z as z28 } from "zod";
2996
+ var schema31 = {
2997
+ scenario: z28.enum([
2847
2998
  "browser-client",
2848
2999
  "server-client",
2849
3000
  "customer-auth",
@@ -2852,7 +3003,7 @@ var schema29 = {
2852
3003
  "webhook-verification"
2853
3004
  ]).describe("Authentication scenario")
2854
3005
  };
2855
- var metadata29 = {
3006
+ var metadata31 = {
2856
3007
  name: "sdk-get-auth-setup",
2857
3008
  description: "Get the current authentication setup for a specific scenario. Returns env var names, code snippets, and security notes.",
2858
3009
  annotations: {
@@ -2867,23 +3018,25 @@ var AUTH_GUIDES = {
2867
3018
  title: "Browser Client Setup",
2868
3019
  envVars: ["NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY"],
2869
3020
  code: `import { createClient } from '@01.software/sdk'
3021
+ import { createQueryHooks } from '@01.software/sdk/query'
2870
3022
 
2871
3023
  const client = createClient({
2872
3024
  publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!
2873
3025
  })
3026
+ const query = createQueryHooks(client)
2874
3027
 
2875
3028
  // Read-only operations + React Query hooks + Customer Auth
2876
- const { data } = client.query.useQuery({ collection: 'products' })`,
3029
+ const { data } = query.useQuery({ collection: 'products' })`,
2877
3030
  notes: [
2878
3031
  "Client is read-only \u2014 no create/update/delete operations",
2879
3032
  "publishableKey is safe to expose in browser (prefixed with NEXT_PUBLIC_)",
2880
- "Includes React Query hooks (client.query) and Customer Auth (client.customer)"
3033
+ "Use createQueryHooks(client) for React Query hooks and client.customer for Customer Auth"
2881
3034
  ]
2882
3035
  },
2883
3036
  "server-client": {
2884
3037
  title: "Server Client Setup",
2885
3038
  envVars: ["SOFTWARE_PUBLISHABLE_KEY", "SOFTWARE_SECRET_KEY"],
2886
- code: `import { createServerClient } from '@01.software/sdk'
3039
+ code: `import { createServerClient } from '@01.software/sdk/server'
2887
3040
 
2888
3041
  const client = createServerClient({
2889
3042
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -2896,7 +3049,7 @@ const result = await client.collections.from('products').create({ title: 'New Pr
2896
3049
  "ServerClient has full CRUD access and must run only in trusted server code",
2897
3050
  "Store server credentials in environment variables and rotate them from the Console",
2898
3051
  "Use in API routes, server actions, or backend services only",
2899
- "React Query hooks available for reads (useQuery, prefetchQuery, etc.) + mutations (useCreate, useUpdate, useRemove)"
3052
+ "Use createServerClient in API routes, server actions, or backend services; keep React Query hooks for browser-safe reads and server prefetching"
2900
3053
  ]
2901
3054
  },
2902
3055
  "customer-auth": {
@@ -3006,14 +3159,14 @@ function handler5({
3006
3159
  }
3007
3160
 
3008
3161
  // src/tools/sdk-get-collection-pattern.ts
3009
- import { z as z27 } from "zod";
3162
+ import { z as z29 } from "zod";
3010
3163
  import { COLLECTIONS, SERVER_COLLECTIONS as SERVER_COLLECTIONS4 } from "@01.software/sdk";
3011
- var schema30 = {
3012
- collection: z27.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3013
- operation: z27.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3014
- surface: z27.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3164
+ var schema32 = {
3165
+ collection: z29.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3166
+ operation: z29.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3167
+ surface: z29.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3015
3168
  };
3016
- var metadata30 = {
3169
+ var metadata32 = {
3017
3170
  name: "sdk-get-collection-pattern",
3018
3171
  description: "Get the recommended CRUD pattern for a specific collection. Returns code examples for the chosen API surface and operation type.",
3019
3172
  annotations: {
@@ -3034,37 +3187,35 @@ function generatePattern(collection, operation, surface) {
3034
3187
  );
3035
3188
  }
3036
3189
  const parts2 = [];
3037
- if (operation === "read") {
3190
+ if (operation === "read" || operation === "full-crud") {
3038
3191
  parts2.push(
3039
3192
  `import { createClient } from '@01.software/sdk'`,
3040
- ``,
3041
- `const client = createClient({`,
3042
- ` publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!`,
3043
- `})`,
3044
- ``
3193
+ `import { createQueryHooks } from '@01.software/sdk/query'`
3045
3194
  );
3046
- } else {
3195
+ }
3196
+ if (operation === "write" || operation === "full-crud") {
3197
+ parts2.push(`import { createServerClient } from '@01.software/sdk/server'`);
3198
+ }
3199
+ parts2.push(``);
3200
+ if (operation === "read" || operation === "full-crud") {
3047
3201
  parts2.push(
3048
- `import { createServerClient } from '@01.software/sdk'`,
3049
- ``,
3050
- `// Mutation hooks require ServerClient`,
3051
- `const client = createServerClient({`,
3052
- ` publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,`,
3053
- ` secretKey: process.env.SOFTWARE_SECRET_KEY!`,
3202
+ `const client = createClient({`,
3203
+ ` publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!`,
3054
3204
  `})`,
3205
+ `const query = createQueryHooks(client)`,
3055
3206
  ``
3056
3207
  );
3057
3208
  }
3058
3209
  if (operation === "read" || operation === "full-crud") {
3059
3210
  parts2.push(
3060
3211
  `// List query`,
3061
- `const { data, isLoading } = client.query.useQuery({`,
3212
+ `const { data, isLoading } = query.useQuery({`,
3062
3213
  ` collection: '${collection}',`,
3063
3214
  ` options: { limit: 10 }`,
3064
3215
  `})`,
3065
3216
  ``,
3066
3217
  `// Single item`,
3067
- `const { data: item } = client.query.useQueryById({`,
3218
+ `const { data: item } = query.useQueryById({`,
3068
3219
  ` collection: '${collection}',`,
3069
3220
  ` id: itemId`,
3070
3221
  `})`
@@ -3073,31 +3224,28 @@ function generatePattern(collection, operation, surface) {
3073
3224
  if (operation === "write" || operation === "full-crud") {
3074
3225
  parts2.push(
3075
3226
  ``,
3076
- `// Create (auto cache invalidation)`,
3077
- `const { mutate: create } = client.query.useCreate({ collection: '${collection}' })`,
3078
- `create({ title: 'New Item' })`,
3079
- ``,
3080
- `// Update`,
3081
- `const { mutate: update } = client.query.useUpdate({ collection: '${collection}' })`,
3082
- `update({ id: itemId, data: { title: 'Updated' } })`,
3227
+ `// Writes belong in a server action or API route, not a client component.`,
3228
+ `const server = createServerClient({`,
3229
+ ` publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,`,
3230
+ ` secretKey: process.env.SOFTWARE_SECRET_KEY!`,
3231
+ `})`,
3083
3232
  ``,
3084
- `// Delete`,
3085
- `const { mutate: remove } = client.query.useRemove({ collection: '${collection}' })`,
3086
- `remove(itemId)`
3233
+ `await server.collections.from('${collection}').create({ title: 'New Item' })`,
3234
+ `await server.collections.from('${collection}').update(itemId, { title: 'Updated' })`,
3235
+ `await server.collections.from('${collection}').remove(itemId)`
3087
3236
  );
3088
3237
  }
3089
3238
  return {
3090
3239
  code: parts2.join("\n"),
3091
3240
  notes: [
3092
- "React Query hooks provide automatic caching and background updates",
3093
- "Mutation hooks auto-invalidate related query caches",
3094
- operation === "write" || operation === "full-crud" ? "Mutation hooks (useCreate, useUpdate, useRemove) require ServerClient with SOFTWARE_PUBLISHABLE_KEY + SOFTWARE_SECRET_KEY" : "Read hooks work in browser components"
3241
+ "React Query hooks provide automatic caching and background updates for browser-safe reads",
3242
+ operation === "write" || operation === "full-crud" ? "Writes require trusted server code with SOFTWARE_PUBLISHABLE_KEY + SOFTWARE_SECRET_KEY; invalidate browser caches after the server action returns" : "Read hooks work in browser components"
3095
3243
  ]
3096
3244
  };
3097
3245
  }
3098
3246
  if (surface === "server-api") {
3099
3247
  const parts2 = [
3100
- `import { createServerClient } from '@01.software/sdk'`,
3248
+ `import { createServerClient } from '@01.software/sdk/server'`,
3101
3249
  ``,
3102
3250
  `const client = createServerClient({`,
3103
3251
  ` publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,`,
@@ -3214,14 +3362,14 @@ function handler6({
3214
3362
  }
3215
3363
 
3216
3364
  // src/prompts/sdk-usage-guide.ts
3217
- import { z as z28 } from "zod";
3218
- var schema31 = {
3219
- goal: z28.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3220
- runtime: z28.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3221
- surface: z28.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3222
- collection: z28.string().optional().describe("Specific collection if relevant")
3365
+ import { z as z30 } from "zod";
3366
+ var schema33 = {
3367
+ goal: z30.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3368
+ runtime: z30.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3369
+ surface: z30.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3370
+ collection: z30.string().optional().describe("Specific collection if relevant")
3223
3371
  };
3224
- var metadata31 = {
3372
+ var metadata33 = {
3225
3373
  name: "sdk-usage-guide",
3226
3374
  title: "SDK Usage Guide",
3227
3375
  description: "Provides guidance on how to perform a specific task using the 01.software SDK",
@@ -3264,8 +3412,12 @@ const result = await client.collections.from('products').find({
3264
3412
  })
3265
3413
 
3266
3414
  // Use React hooks
3415
+ import { createQueryHooks } from '@01.software/sdk/query'
3416
+
3417
+ const query = createQueryHooks(client)
3418
+
3267
3419
  function ProductList() {
3268
- const { data, isLoading } = client.query.useQuery({
3420
+ const { data, isLoading } = query.useQuery({
3269
3421
  collection: 'products',
3270
3422
  options: { limit: 10 }
3271
3423
  })
@@ -3282,7 +3434,7 @@ function ProductList() {
3282
3434
  }
3283
3435
  \`\`\`
3284
3436
 
3285
- ### React Query Hooks (client.query)
3437
+ ### React Query Hooks (@01.software/sdk/query)
3286
3438
 
3287
3439
  | Hook | Description |
3288
3440
  |------|-------------|
@@ -3317,13 +3469,17 @@ await client.collections.from('products').remove('id')
3317
3469
  // count() returns { totalDocs }
3318
3470
  const { totalDocs } = await client.collections.from('products').count()
3319
3471
 
3320
- // Metadata - generate Next.js Metadata from collection fields
3321
- // Auto-maps per-collection fields (e.g. articles: description\u2192description, thumbnail\u2192image)
3322
- const articleMeta = await client.collections.from('articles').findMetadataById(id, { siteName: 'My Blog' })
3323
- const productMeta = await client.collections.from('products').findMetadata(
3324
- { where: { slug: { equals: 'my-product' } } },
3325
- { siteName: 'My Store' }
3326
- )
3472
+ // Metadata - generate Metadata-shaped SEO objects from fetched documents
3473
+ import { extractSeo, generateMetadata } from '@01.software/sdk/metadata'
3474
+
3475
+ const productResult = await client.collections.from('products').find({
3476
+ where: { slug: { equals: 'my-product' } },
3477
+ limit: 1,
3478
+ depth: 1,
3479
+ })
3480
+ const productMeta = productResult.docs[0]
3481
+ ? generateMetadata(extractSeo(productResult.docs[0]), { siteName: 'My Store' })
3482
+ : null
3327
3483
  \`\`\`
3328
3484
 
3329
3485
  ### Filtering (Payload Query Syntax)
@@ -3346,7 +3502,7 @@ For ecommerce collections, use \`products.listing.*\` for browse/search pricing
3346
3502
  ### Server Client (Server-side)
3347
3503
 
3348
3504
  \`\`\`typescript
3349
- import { createServerClient } from '@01.software/sdk'
3505
+ import { createServerClient } from '@01.software/sdk/server'
3350
3506
 
3351
3507
  const client = createServerClient({
3352
3508
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -3354,18 +3510,44 @@ const client = createServerClient({
3354
3510
  })
3355
3511
  \`\`\`
3356
3512
 
3357
- You can perform the "${goal}" task by following the patterns above.`;
3513
+ You can perform the "${goal}" task by following the patterns above.
3514
+
3515
+ ## Common recipes
3516
+
3517
+ ### Product detail page (slug-based)
3518
+
3519
+ \`\`\`typescript
3520
+ const product = await client.commerce.product.detail({ slug })
3521
+ if (!product) return notFound()
3522
+ // product: { product, variants, options, brand, categories, tags, images, videos, listing }
3523
+ \`\`\`
3524
+
3525
+ For React: \`const { data } = createQueryHooks(client).useProductDetailBySlug(slug)\`.
3526
+
3527
+ ### Product listing (grouped)
3528
+
3529
+ \`\`\`typescript
3530
+ const { docs } = await client.commerce.product.listingGroups({ productIds })
3531
+ \`\`\`
3532
+
3533
+ ### Stock check before adding to cart
3534
+
3535
+ \`\`\`typescript
3536
+ const { allAvailable } = await client.commerce.product.stockCheck({
3537
+ items: [{ variantId, quantity }],
3538
+ })
3539
+ \`\`\``;
3358
3540
  }
3359
3541
 
3360
3542
  // src/prompts/collection-query-help.ts
3361
- import { z as z29 } from "zod";
3543
+ import { z as z31 } from "zod";
3362
3544
  import { COLLECTIONS as COLLECTIONS2, SERVER_COLLECTIONS as SERVER_COLLECTIONS5 } from "@01.software/sdk";
3363
- var schema32 = {
3364
- collection: z29.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3365
- operation: z29.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3366
- filters: z29.string().optional().describe("Filter conditions (JSON string, optional)")
3545
+ var schema34 = {
3546
+ collection: z31.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3547
+ operation: z31.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3548
+ filters: z31.string().optional().describe("Filter conditions (JSON string, optional)")
3367
3549
  };
3368
- var metadata32 = {
3550
+ var metadata34 = {
3369
3551
  name: "collection-query-help",
3370
3552
  title: "Collection Query Help",
3371
3553
  description: "Provides guidance on how to write queries for a specific collection",
@@ -3395,7 +3577,8 @@ ${filters}
3395
3577
  ### ${operation === "find" ? "Query" : operation === "create" ? "Create" : operation === "update" ? "Update" : "Delete"} Example
3396
3578
 
3397
3579
  \`\`\`typescript
3398
- import { createClient, createServerClient } from '@01.software/sdk'
3580
+ import { createClient } from '@01.software/sdk'
3581
+ import { createServerClient } from '@01.software/sdk/server'
3399
3582
 
3400
3583
  // Client (read-only public collections)
3401
3584
  const client = createClient({
@@ -3416,14 +3599,18 @@ const result = await ${readClientName}.collections.from('${collection}').find(${
3416
3599
  // result.docs - array of items
3417
3600
  // result.totalDocs, result.page, result.totalPages, result.hasNextPage, ...
3418
3601
 
3419
- ${isPublicCollection ? `// Using React Hook
3420
- const { data, isLoading, error } = client.query.useQuery({
3602
+ ${isPublicCollection ? `// Using React Query hooks
3603
+ import { createQueryHooks } from '@01.software/sdk/query'
3604
+
3605
+ const query = createQueryHooks(client)
3606
+
3607
+ const { data, isLoading, error } = query.useQuery({
3421
3608
  collection: '${collection}',
3422
3609
  options: { limit: 10 }
3423
3610
  })
3424
3611
 
3425
3612
  // With Suspense
3426
- const { data } = client.query.useSuspenseQuery({
3613
+ const { data } = query.useSuspenseQuery({
3427
3614
  collection: '${collection}',
3428
3615
  options: { limit: 10 }
3429
3616
  })` : `// React hooks are browser/public only and do not support '${collection}'.`}` : operation === "create" ? `// Create ${collection} item (ServerClient only)
@@ -3457,16 +3644,16 @@ ${operation === "find" ? `- Use \`where\` option for filtering (Payload query sy
3457
3644
  }
3458
3645
 
3459
3646
  // src/prompts/order-flow-guide.ts
3460
- import { z as z30 } from "zod";
3461
- var schema33 = {
3462
- scenario: z30.enum([
3647
+ import { z as z32 } from "zod";
3648
+ var schema35 = {
3649
+ scenario: z32.enum([
3463
3650
  "simple-order",
3464
3651
  "cart-checkout",
3465
3652
  "return-refund",
3466
3653
  "fulfillment-tracking"
3467
3654
  ]).describe("Order flow scenario")
3468
3655
  };
3469
- var metadata33 = {
3656
+ var metadata35 = {
3470
3657
  name: "order-flow-guide",
3471
3658
  title: "Order Flow Guide",
3472
3659
  description: "Provides step-by-step guidance for ecommerce order flows including creation, checkout, returns, and fulfillment.",
@@ -3492,7 +3679,7 @@ var SCENARIOS = {
3492
3679
 
3493
3680
  ### Code Example (ServerClient)
3494
3681
  \`\`\`typescript
3495
- import { createServerClient } from '@01.software/sdk'
3682
+ import { createServerClient } from '@01.software/sdk/server'
3496
3683
 
3497
3684
  const client = createServerClient({
3498
3685
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -3651,9 +3838,9 @@ ${SCENARIOS[scenario] || "Unknown scenario."}
3651
3838
  }
3652
3839
 
3653
3840
  // src/prompts/feature-setup-guide.ts
3654
- import { z as z31 } from "zod";
3655
- var schema34 = {
3656
- feature: z31.enum([
3841
+ import { z as z33 } from "zod";
3842
+ var schema36 = {
3843
+ feature: z33.enum([
3657
3844
  "ecommerce",
3658
3845
  "customers",
3659
3846
  "articles",
@@ -3668,7 +3855,7 @@ var schema34 = {
3668
3855
  "community"
3669
3856
  ]).describe("Feature to get setup guide for")
3670
3857
  };
3671
- var metadata34 = {
3858
+ var metadata36 = {
3672
3859
  name: "feature-setup-guide",
3673
3860
  title: "Feature Setup Guide",
3674
3861
  description: "Setup checklist and remediation guide for a tenant feature. Load with check-feature-progress and get-tenant-context to diagnose setup gaps.",
@@ -3875,7 +4062,7 @@ ${FEATURES[feature] || "Unknown feature."}
3875
4062
  }
3876
4063
 
3877
4064
  // src/resources/(config)/app.ts
3878
- var metadata35 = {
4065
+ var metadata37 = {
3879
4066
  name: "app-config",
3880
4067
  title: "Application Config",
3881
4068
  description: "01.software SDK and MCP server configuration information"
@@ -3941,7 +4128,7 @@ Rate limits depend on your tenant plan:
3941
4128
 
3942
4129
  // src/resources/(collections)/schema.ts
3943
4130
  import { COLLECTIONS as COLLECTIONS3 } from "@01.software/sdk";
3944
- var metadata36 = {
4131
+ var metadata38 = {
3945
4132
  name: "collections-schema",
3946
4133
  title: "Collection Schema Info",
3947
4134
  description: "Available collections and their schema information"
@@ -3965,7 +4152,12 @@ var COLLECTIONS_BY_CATEGORY = {
3965
4152
  "fulfillments",
3966
4153
  "fulfillment-items"
3967
4154
  ],
3968
- "Shipping & Returns": ["returns", "return-items", "shipping-policies"],
4155
+ "Shipping & Returns": [
4156
+ "returns",
4157
+ "return-items",
4158
+ "shipping-policies",
4159
+ "shipping-zones"
4160
+ ],
3969
4161
  Customers: [
3970
4162
  "customers",
3971
4163
  "customer-profiles",
@@ -3973,7 +4165,7 @@ var COLLECTIONS_BY_CATEGORY = {
3973
4165
  "customer-addresses"
3974
4166
  ],
3975
4167
  Carts: ["carts", "cart-items"],
3976
- "Discounts & Promotions": ["discounts", "promotions"],
4168
+ Discounts: ["discounts"],
3977
4169
  Documents: ["documents", "document-categories", "document-types"],
3978
4170
  Articles: [
3979
4171
  "articles",
@@ -3987,9 +4179,7 @@ var COLLECTIONS_BY_CATEGORY = {
3987
4179
  "reactions",
3988
4180
  "reaction-types",
3989
4181
  "bookmarks",
3990
- "post-categories",
3991
- "reports",
3992
- "community-bans"
4182
+ "post-categories"
3993
4183
  ],
3994
4184
  Playlists: [
3995
4185
  "playlists",
@@ -4079,7 +4269,7 @@ Total available collections: ${COLLECTIONS3.length}`;
4079
4269
  }
4080
4270
 
4081
4271
  // src/resources/(docs)/getting-started.ts
4082
- var metadata37 = {
4272
+ var metadata39 = {
4083
4273
  name: "docs-getting-started",
4084
4274
  title: "Getting Started",
4085
4275
  description: "01.software SDK getting started guide"
@@ -4099,6 +4289,22 @@ yarn add @01.software/sdk
4099
4289
  pnpm add @01.software/sdk
4100
4290
  \`\`\`
4101
4291
 
4292
+ ## Optional peers
4293
+
4294
+ You do not need extra packages for the root SDK entry. Install peer
4295
+ dependencies only when you import a feature sub-path:
4296
+
4297
+ - \`@01.software/sdk/query\` -> \`@tanstack/react-query\`, \`react\`, \`react-dom\`
4298
+ - \`@01.software/sdk/realtime\` -> \`@tanstack/react-query\`
4299
+ - \`@01.software/sdk/analytics/react\` -> \`react\`, \`react-dom\`
4300
+ - \`@01.software/sdk/ui/rich-text\` -> \`@payloadcms/richtext-lexical\`
4301
+ - \`@01.software/sdk/ui/form\` -> none
4302
+ - \`@01.software/sdk/ui/code-block\` -> \`shiki\`, \`hast-util-to-jsx-runtime\`
4303
+ - \`@01.software/sdk/ui/canvas\` -> \`@tanstack/react-query\`, \`@xyflow/react\`, \`quickjs-emscripten\`, \`postcss\`, \`sucrase\`
4304
+ - \`@01.software/sdk/ui/canvas/server\` -> none
4305
+ - \`@01.software/sdk/ui/video\` -> \`@mux/mux-player-react\`
4306
+ - \`@01.software/sdk/ui/image\` -> none
4307
+
4102
4308
  ## Basic Usage
4103
4309
 
4104
4310
  \`\`\`typescript
@@ -4124,7 +4330,7 @@ const result = await client.collections.from('products').find({
4124
4330
  }
4125
4331
 
4126
4332
  // src/resources/(docs)/guides.ts
4127
- var metadata38 = {
4333
+ var metadata40 = {
4128
4334
  name: "docs-guides",
4129
4335
  title: "Guides",
4130
4336
  description: "01.software SDK usage guides"
@@ -4136,7 +4342,7 @@ Comprehensive guides to master the 01.software SDK.
4136
4342
 
4137
4343
  ## Data Fetching
4138
4344
 
4139
- Use the Query Builder or React Query hooks to fetch data efficiently.
4345
+ Use the Query Builder or opt-in React Query hooks to fetch data efficiently.
4140
4346
 
4141
4347
  ### Query Builder
4142
4348
  \`\`\`typescript
@@ -4164,7 +4370,10 @@ const { totalDocs } = await client.collections.from('products').count()
4164
4370
 
4165
4371
  ### React Query Hook
4166
4372
  \`\`\`typescript
4167
- const { data, isLoading, error } = client.query.useQuery({
4373
+ import { createQueryHooks } from '@01.software/sdk/query'
4374
+
4375
+ const query = createQueryHooks(client)
4376
+ const { data, isLoading, error } = query.useQuery({
4168
4377
  collection: 'products',
4169
4378
  options: {
4170
4379
  where: { status: { equals: 'published' } },
@@ -4175,7 +4384,7 @@ const { data, isLoading, error } = client.query.useQuery({
4175
4384
 
4176
4385
  ### Suspense Mode
4177
4386
  \`\`\`typescript
4178
- const { data } = client.query.useSuspenseQuery({
4387
+ const { data } = query.useSuspenseQuery({
4179
4388
  collection: 'products',
4180
4389
  options: { limit: 10 }
4181
4390
  })
@@ -4184,7 +4393,7 @@ const { data } = client.query.useSuspenseQuery({
4184
4393
  ### Infinite Scroll
4185
4394
  \`\`\`typescript
4186
4395
  const { data, fetchNextPage, hasNextPage, isFetchingNextPage } =
4187
- client.query.useInfiniteQuery({
4396
+ query.useInfiniteQuery({
4188
4397
  collection: 'products',
4189
4398
  pageSize: 20
4190
4399
  })
@@ -4231,19 +4440,18 @@ const result = await serverClient.from('products').removeMany(
4231
4440
  )
4232
4441
  \`\`\`
4233
4442
 
4234
- ### Mutation Hooks (React)
4443
+ ### Server Mutations
4235
4444
  \`\`\`typescript
4236
- // Create with auto cache invalidation
4237
- const { mutate: create } = client.query.useCreate({ collection: 'products' })
4238
- create({ title: 'New', status: 'draft' })
4445
+ import { createServerClient } from '@01.software/sdk/server'
4239
4446
 
4240
- // Update with auto cache invalidation
4241
- const { mutate: update } = client.query.useUpdate({ collection: 'products' })
4242
- update({ id: 'product-id', data: { title: 'Updated' } })
4447
+ const server = createServerClient({
4448
+ publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
4449
+ secretKey: process.env.SOFTWARE_SECRET_KEY!,
4450
+ })
4243
4451
 
4244
- // Remove with auto cache invalidation
4245
- const { mutate: remove } = client.query.useRemove({ collection: 'products' })
4246
- remove('product-id')
4452
+ await server.collections.from('products').create({ title: 'New', status: 'draft' })
4453
+ await server.collections.from('products').update('product-id', { title: 'Updated' })
4454
+ await server.collections.from('products').remove('product-id')
4247
4455
  \`\`\`
4248
4456
 
4249
4457
  ## Caching Strategies
@@ -4253,17 +4461,17 @@ The SDK uses React Query for caching and background updates.
4253
4461
  ### SSR Prefetching
4254
4462
  \`\`\`typescript
4255
4463
  // Prefetch in server component for instant client hydration
4256
- await client.query.prefetchQuery({
4464
+ await query.prefetchQuery({
4257
4465
  collection: 'products',
4258
4466
  options: { limit: 10 }
4259
4467
  })
4260
4468
 
4261
- await client.query.prefetchQueryById({
4469
+ await query.prefetchQueryById({
4262
4470
  collection: 'products',
4263
4471
  id: 'product-id'
4264
4472
  })
4265
4473
 
4266
- await client.query.prefetchInfiniteQuery({
4474
+ await query.prefetchInfiniteQuery({
4267
4475
  collection: 'products',
4268
4476
  pageSize: 20
4269
4477
  })
@@ -4272,19 +4480,19 @@ await client.query.prefetchInfiniteQuery({
4272
4480
  ### Cache Invalidation
4273
4481
  \`\`\`typescript
4274
4482
  // Invalidate list cache for a collection
4275
- client.query.invalidateQueries('products', 'list')
4483
+ query.invalidateQueries('products', 'list')
4276
4484
 
4277
4485
  // Invalidate all caches for a collection
4278
- client.query.invalidateQueries('products')
4486
+ query.invalidateQueries('products')
4279
4487
  \`\`\`
4280
4488
 
4281
4489
  ### Manual Cache Management
4282
4490
  \`\`\`typescript
4283
4491
  // Read cached data
4284
- const cached = client.query.getQueryData('products', 'list')
4492
+ const cached = query.getQueryData('products', 'list')
4285
4493
 
4286
4494
  // Write to cache (optimistic updates)
4287
- client.query.setQueryData('products', 'list', newData)
4495
+ query.setQueryData('products', 'list', newData)
4288
4496
  \`\`\`
4289
4497
 
4290
4498
  ## Error Handling
@@ -4335,7 +4543,7 @@ For more implementation guidance, see the [SDK Guide](/developers/sdk).`;
4335
4543
  }
4336
4544
 
4337
4545
  // src/resources/(docs)/api.ts
4338
- var metadata39 = {
4546
+ var metadata41 = {
4339
4547
  name: "docs-api",
4340
4548
  title: "API Reference",
4341
4549
  description: "01.software SDK API reference documentation"
@@ -4362,7 +4570,7 @@ const client = createClient({
4362
4570
  For server-side operations (full CRUD)
4363
4571
 
4364
4572
  \`\`\`typescript
4365
- import { createServerClient } from '@01.software/sdk'
4573
+ import { createServerClient } from '@01.software/sdk/server'
4366
4574
 
4367
4575
  const client = createServerClient({
4368
4576
  publishableKey: string,
@@ -4441,13 +4649,19 @@ const result = await client.collections.from('collection').removeMany(where)
4441
4649
  // Returns PayloadFindResponse with deleted docs
4442
4650
  \`\`\`
4443
4651
 
4444
- ## React Query Hooks (client.query)
4652
+ ## React Query Hooks (\`@01.software/sdk/query\`)
4653
+
4654
+ \`\`\`typescript
4655
+ import { createQueryHooks } from '@01.software/sdk/query'
4656
+
4657
+ const query = createQueryHooks(client)
4658
+ \`\`\`
4445
4659
 
4446
4660
  ### useQuery()
4447
4661
  Query a collection list.
4448
4662
 
4449
4663
  \`\`\`typescript
4450
- const { data, isLoading, error } = client.query.useQuery({
4664
+ const { data, isLoading, error } = query.useQuery({
4451
4665
  collection: 'products',
4452
4666
  options: { limit: 10, where: { status: { equals: 'published' } } }
4453
4667
  })
@@ -4457,7 +4671,7 @@ const { data, isLoading, error } = client.query.useQuery({
4457
4671
  Suspense mode list query.
4458
4672
 
4459
4673
  \`\`\`typescript
4460
- const { data } = client.query.useSuspenseQuery({
4674
+ const { data } = query.useSuspenseQuery({
4461
4675
  collection: 'products',
4462
4676
  options: { limit: 10 }
4463
4677
  })
@@ -4467,7 +4681,7 @@ const { data } = client.query.useSuspenseQuery({
4467
4681
  Get a single item by ID.
4468
4682
 
4469
4683
  \`\`\`typescript
4470
- const { data } = client.query.useQueryById({
4684
+ const { data } = query.useQueryById({
4471
4685
  collection: 'products',
4472
4686
  id: 'product-id'
4473
4687
  })
@@ -4477,7 +4691,7 @@ const { data } = client.query.useQueryById({
4477
4691
  Suspense mode single item query.
4478
4692
 
4479
4693
  \`\`\`typescript
4480
- const { data } = client.query.useSuspenseQueryById({
4694
+ const { data } = query.useSuspenseQueryById({
4481
4695
  collection: 'products',
4482
4696
  id: 'product-id'
4483
4697
  })
@@ -4487,7 +4701,7 @@ const { data } = client.query.useSuspenseQueryById({
4487
4701
  Infinite scroll.
4488
4702
 
4489
4703
  \`\`\`typescript
4490
- const { data, fetchNextPage, hasNextPage } = client.query.useInfiniteQuery({
4704
+ const { data, fetchNextPage, hasNextPage } = query.useInfiniteQuery({
4491
4705
  collection: 'products',
4492
4706
  options: { limit: 20 },
4493
4707
  pageSize: 20
@@ -4498,52 +4712,43 @@ const { data, fetchNextPage, hasNextPage } = client.query.useInfiniteQuery({
4498
4712
  Suspense mode infinite scroll.
4499
4713
 
4500
4714
  \`\`\`typescript
4501
- const { data, fetchNextPage } = client.query.useSuspenseInfiniteQuery({
4715
+ const { data, fetchNextPage } = query.useSuspenseInfiniteQuery({
4502
4716
  collection: 'products',
4503
4717
  pageSize: 20
4504
4718
  })
4505
4719
  \`\`\`
4506
4720
 
4507
- ## Mutation Hooks (client.query)
4508
-
4509
- ### useCreate()
4510
- Create a document with automatic cache invalidation.
4511
-
4512
- \`\`\`typescript
4513
- const { mutate } = client.query.useCreate({ collection: 'products' })
4514
- mutate({ title: 'New Product', status: 'draft' })
4515
- \`\`\`
4721
+ ## Server Mutations
4516
4722
 
4517
- ### useUpdate()
4518
- Update a document with automatic cache invalidation.
4723
+ Writes require trusted server code with \`createServerClient\`; do not run server credentials in React client components.
4519
4724
 
4520
4725
  \`\`\`typescript
4521
- const { mutate } = client.query.useUpdate({ collection: 'products' })
4522
- mutate({ id: 'product-id', data: { title: 'Updated' } })
4523
- \`\`\`
4726
+ import { createServerClient } from '@01.software/sdk/server'
4524
4727
 
4525
- ### useRemove()
4526
- Remove a document with automatic cache invalidation.
4728
+ const server = createServerClient({
4729
+ publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
4730
+ secretKey: process.env.SOFTWARE_SECRET_KEY!,
4731
+ })
4527
4732
 
4528
- \`\`\`typescript
4529
- const { mutate } = client.query.useRemove({ collection: 'products' })
4530
- mutate('product-id')
4733
+ await server.collections.from('products').create({ title: 'New Product', status: 'draft' })
4734
+ await server.collections.from('products').update('product-id', { title: 'Updated' })
4735
+ await server.collections.from('products').remove('product-id')
4531
4736
  \`\`\`
4532
4737
 
4533
4738
  ## Cache Utilities
4534
4739
 
4535
4740
  \`\`\`typescript
4536
4741
  // Invalidate cache
4537
- client.query.invalidateQueries('products', 'list')
4742
+ query.invalidateQueries('products', 'list')
4538
4743
 
4539
4744
  // SSR prefetch
4540
- await client.query.prefetchQuery({ collection: 'products', options: { limit: 10 } })
4541
- await client.query.prefetchQueryById({ collection: 'products', id: 'id' })
4542
- await client.query.prefetchInfiniteQuery({ collection: 'products', pageSize: 20 })
4745
+ await query.prefetchQuery({ collection: 'products', options: { limit: 10 } })
4746
+ await query.prefetchQueryById({ collection: 'products', id: 'id' })
4747
+ await query.prefetchInfiniteQuery({ collection: 'products', pageSize: 20 })
4543
4748
 
4544
4749
  // Get/set cached data
4545
- const cached = client.query.getQueryData('products', 'list')
4546
- client.query.setQueryData('products', 'list', newData)
4750
+ const cached = query.getQueryData('products', 'list')
4751
+ query.setQueryData('products', 'list', newData)
4547
4752
  \`\`\`
4548
4753
 
4549
4754
  For ecommerce reads, prefer \`products.listing.*\` for card/search pricing and keep authoritative sellable pricing on \`product-variants.price\`.
@@ -4621,7 +4826,7 @@ For more details, see the [API documentation](/developers/api).`;
4621
4826
  }
4622
4827
 
4623
4828
  // src/resources/(docs)/query-builder.ts
4624
- var metadata40 = {
4829
+ var metadata42 = {
4625
4830
  name: "docs-query-builder",
4626
4831
  title: "Query Builder",
4627
4832
  description: "01.software SDK Query Builder API reference (client.collections.from)"
@@ -4790,7 +4995,7 @@ const result3 = await client.collections.from('products').find({ sort: '-isFeatu
4790
4995
  ## Full Example
4791
4996
 
4792
4997
  \`\`\`typescript
4793
- import { createServerClient } from '@01.software/sdk'
4998
+ import { createServerClient } from '@01.software/sdk/server'
4794
4999
 
4795
5000
  const serverClient = createServerClient({
4796
5001
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -4815,17 +5020,25 @@ console.log(result.hasNextPage) // true
4815
5020
  }
4816
5021
 
4817
5022
  // src/resources/(docs)/react-query.ts
4818
- var metadata41 = {
5023
+ var metadata43 = {
4819
5024
  name: "docs-react-query",
4820
5025
  title: "React Query Hooks",
4821
- description: "01.software SDK React Query hooks reference (client.query)"
5026
+ description: "01.software SDK React Query hooks reference (@01.software/sdk/query)"
4822
5027
  };
4823
5028
  function handler13() {
4824
5029
  return `# React Query Hooks
4825
5030
 
4826
- React Query hooks are available on the browser-side \`Client\` via \`client.query\`. They provide automatic caching, background refetching, and cache invalidation.
5031
+ React Query hooks are opt-in through \`@01.software/sdk/query\`. They provide automatic caching, background refetching, and cache invalidation without making root \`createClient\` consumers install React Query.
4827
5032
 
4828
- > React Query hooks are available on \`Client\` (createClient) only. \`ServerClient\` does not include them.
5033
+ Install \`@tanstack/react-query\` and React peers only when importing this sub-path.
5034
+
5035
+ \`\`\`typescript
5036
+ import { createClient } from '@01.software/sdk'
5037
+ import { createQueryHooks } from '@01.software/sdk/query'
5038
+
5039
+ const client = createClient({ publishableKey })
5040
+ const query = createQueryHooks(client)
5041
+ \`\`\`
4829
5042
 
4830
5043
  ## Query Hooks
4831
5044
 
@@ -4833,7 +5046,7 @@ React Query hooks are available on the browser-side \`Client\` via \`client.quer
4833
5046
  Query a collection list with automatic caching.
4834
5047
 
4835
5048
  \`\`\`typescript
4836
- const { data, isLoading, error } = client.query.useQuery({
5049
+ const { data, isLoading, error } = query.useQuery({
4837
5050
  collection: 'products',
4838
5051
  options: {
4839
5052
  where: { status: { equals: 'published' } },
@@ -4851,7 +5064,7 @@ Suspense-mode list query. Throws a promise while loading (use with React Suspens
4851
5064
 
4852
5065
  \`\`\`typescript
4853
5066
  // Inside a Suspense boundary
4854
- const { data } = client.query.useSuspenseQuery({
5067
+ const { data } = query.useSuspenseQuery({
4855
5068
  collection: 'products',
4856
5069
  options: { limit: 10 },
4857
5070
  })
@@ -4862,7 +5075,7 @@ const { data } = client.query.useSuspenseQuery({
4862
5075
  Get a single document by ID.
4863
5076
 
4864
5077
  \`\`\`typescript
4865
- const { data, isLoading } = client.query.useQueryById({
5078
+ const { data, isLoading } = query.useQueryById({
4866
5079
  collection: 'products',
4867
5080
  id: 'product-id',
4868
5081
  })
@@ -4873,7 +5086,7 @@ const { data, isLoading } = client.query.useQueryById({
4873
5086
  Suspense-mode single document query.
4874
5087
 
4875
5088
  \`\`\`typescript
4876
- const { data } = client.query.useSuspenseQueryById({
5089
+ const { data } = query.useSuspenseQueryById({
4877
5090
  collection: 'products',
4878
5091
  id: 'product-id',
4879
5092
  })
@@ -4889,7 +5102,7 @@ const {
4889
5102
  fetchNextPage,
4890
5103
  hasNextPage,
4891
5104
  isFetchingNextPage,
4892
- } = client.query.useInfiniteQuery({
5105
+ } = query.useInfiniteQuery({
4893
5106
  collection: 'products',
4894
5107
  options: {
4895
5108
  where: { status: { equals: 'published' } },
@@ -4905,55 +5118,33 @@ const {
4905
5118
  Suspense-mode infinite scroll.
4906
5119
 
4907
5120
  \`\`\`typescript
4908
- const { data, fetchNextPage, hasNextPage } = client.query.useSuspenseInfiniteQuery({
5121
+ const { data, fetchNextPage, hasNextPage } = query.useSuspenseInfiniteQuery({
4909
5122
  collection: 'products',
4910
5123
  pageSize: 20,
4911
5124
  })
4912
5125
  \`\`\`
4913
5126
 
4914
- ## Mutation Hooks
4915
-
4916
- Mutation hooks automatically invalidate relevant cache keys after success.
5127
+ ## Writes
4917
5128
 
4918
- ### useCreate()
4919
- Create a document and invalidate list cache.
5129
+ Keep writes in trusted server code. Use a server action, API route, or backend service with \`createServerClient\`, then invalidate browser React Query caches after the action completes.
4920
5130
 
4921
5131
  \`\`\`typescript
4922
- const { mutate, mutateAsync, isPending } = client.query.useCreate({
4923
- collection: 'products',
4924
- })
4925
-
4926
- // Fire and forget
4927
- mutate({ title: 'New Product', status: 'draft' })
4928
-
4929
- // Await result
4930
- const result = await mutateAsync({ title: 'New Product', status: 'draft' })
4931
- // result.doc - created document
4932
- \`\`\`
4933
-
4934
- For ecommerce reads, price-oriented product cards should consume \`products.listing.minPrice/maxPrice\`. Authoritative sellable pricing still lives on \`product-variants.price\`.
5132
+ // app/products/actions.ts
5133
+ 'use server'
4935
5134
 
4936
- ### useUpdate()
4937
- Update a document and invalidate list + detail cache.
5135
+ import { createServerClient } from '@01.software/sdk/server'
4938
5136
 
4939
- \`\`\`typescript
4940
- const { mutate, mutateAsync } = client.query.useUpdate({
4941
- collection: 'products',
5137
+ const server = createServerClient({
5138
+ publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
5139
+ secretKey: process.env.SOFTWARE_SECRET_KEY!,
4942
5140
  })
4943
5141
 
4944
- mutate({ id: 'product-id', data: { title: 'Updated Title' } })
5142
+ export async function createProduct(data: { title: string; status: 'draft' | 'published' }) {
5143
+ return server.collections.from('products').create(data)
5144
+ }
4945
5145
  \`\`\`
4946
5146
 
4947
- ### useRemove()
4948
- Remove a document and invalidate list cache.
4949
-
4950
- \`\`\`typescript
4951
- const { mutate, mutateAsync } = client.query.useRemove({
4952
- collection: 'products',
4953
- })
4954
-
4955
- mutate('product-id')
4956
- \`\`\`
5147
+ For ecommerce reads, price-oriented product cards should consume \`products.listing.minPrice/maxPrice\`. Authoritative sellable pricing still lives on \`product-variants.price\`.
4957
5148
 
4958
5149
  ## Cache Utilities
4959
5150
 
@@ -4962,10 +5153,10 @@ Manually invalidate cached queries for a collection.
4962
5153
 
4963
5154
  \`\`\`typescript
4964
5155
  // Invalidate all list queries for a collection
4965
- client.query.invalidateQueries('products', 'list')
5156
+ query.invalidateQueries('products', 'list')
4966
5157
 
4967
5158
  // Invalidate all queries for a collection (list + detail)
4968
- client.query.invalidateQueries('products')
5159
+ query.invalidateQueries('products')
4969
5160
  \`\`\`
4970
5161
 
4971
5162
  ### getQueryData() / setQueryData()
@@ -4973,10 +5164,10 @@ Read and write the React Query cache directly.
4973
5164
 
4974
5165
  \`\`\`typescript
4975
5166
  // Read cached data
4976
- const cached = client.query.getQueryData('products', 'list')
5167
+ const cached = query.getQueryData('products', 'list')
4977
5168
 
4978
5169
  // Write to cache (useful for optimistic updates)
4979
- client.query.setQueryData('products', 'list', newData)
5170
+ query.setQueryData('products', 'list', newData)
4980
5171
  \`\`\`
4981
5172
 
4982
5173
  ## SSR Prefetching
@@ -4986,34 +5177,37 @@ Prefetch data in server components for instant hydration on the client.
4986
5177
  \`\`\`typescript
4987
5178
  // app/products/page.tsx (Next.js App Router Server Component)
4988
5179
  import { HydrationBoundary, dehydrate } from '@tanstack/react-query'
4989
- import { createServerClient } from '@01.software/sdk'
5180
+ import { createServerClient } from '@01.software/sdk/server'
5181
+ import { createServerQueryHooks, getQueryClient } from '@01.software/sdk/query'
4990
5182
 
4991
5183
  export default async function ProductsPage() {
4992
5184
  const serverClient = createServerClient({
4993
5185
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
4994
5186
  secretKey: process.env.SOFTWARE_SECRET_KEY!,
4995
5187
  })
5188
+ const queryClient = getQueryClient()
5189
+ const serverQuery = createServerQueryHooks(serverClient, queryClient)
4996
5190
 
4997
5191
  // Prefetch list
4998
- await serverClient.query.prefetchQuery({
5192
+ await serverQuery.prefetchQuery({
4999
5193
  collection: 'products',
5000
5194
  options: { limit: 20, where: { status: { equals: 'published' } } },
5001
5195
  })
5002
5196
 
5003
5197
  // Prefetch single item
5004
- await serverClient.query.prefetchQueryById({
5198
+ await serverQuery.prefetchQueryById({
5005
5199
  collection: 'products',
5006
5200
  id: 'product-id',
5007
5201
  })
5008
5202
 
5009
5203
  // Prefetch infinite query
5010
- await serverClient.query.prefetchInfiniteQuery({
5204
+ await serverQuery.prefetchInfiniteQuery({
5011
5205
  collection: 'products',
5012
5206
  pageSize: 20,
5013
5207
  })
5014
5208
 
5015
5209
  return (
5016
- <HydrationBoundary state={dehydrate(serverClient.query.queryClient)}>
5210
+ <HydrationBoundary state={dehydrate(queryClient)}>
5017
5211
  <ProductList />
5018
5212
  </HydrationBoundary>
5019
5213
  )
@@ -5026,13 +5220,15 @@ export default async function ProductsPage() {
5026
5220
  'use client'
5027
5221
 
5028
5222
  import { createClient } from '@01.software/sdk'
5223
+ import { createQueryHooks } from '@01.software/sdk/query'
5029
5224
 
5030
5225
  const client = createClient({
5031
5226
  publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
5032
5227
  })
5228
+ const query = createQueryHooks(client)
5033
5229
 
5034
5230
  export function ProductList() {
5035
- const { data, isLoading, error } = client.query.useQuery({
5231
+ const { data, isLoading, error } = query.useQuery({
5036
5232
  collection: 'products',
5037
5233
  options: {
5038
5234
  where: { status: { equals: 'published' } },
@@ -5041,20 +5237,13 @@ export function ProductList() {
5041
5237
  },
5042
5238
  })
5043
5239
 
5044
- const { mutate: removeProduct } = client.query.useRemove({
5045
- collection: 'products',
5046
- })
5047
-
5048
5240
  if (isLoading) return <div>Loading...</div>
5049
5241
  if (error) return <div>Error: {error.message}</div>
5050
5242
 
5051
5243
  return (
5052
5244
  <ul>
5053
5245
  {data?.docs.map((product) => (
5054
- <li key={product.id}>
5055
- {product.title}
5056
- <button onClick={() => removeProduct(product.id)}>Delete</button>
5057
- </li>
5246
+ <li key={product.id}>{product.title}</li>
5058
5247
  ))}
5059
5248
  </ul>
5060
5249
  )
@@ -5063,7 +5252,7 @@ export function ProductList() {
5063
5252
  }
5064
5253
 
5065
5254
  // src/resources/(docs)/server-api.ts
5066
- var metadata42 = {
5255
+ var metadata44 = {
5067
5256
  name: "docs-server-api",
5068
5257
  title: "Server-side API",
5069
5258
  description: "01.software SDK server-side API reference (client.commerce) for orders, fulfillments, returns, carts, and validation"
@@ -5074,7 +5263,7 @@ function handler14() {
5074
5263
  Server-side operations are available via \`client.commerce\` on \`ServerClient\`. Use \`createServerClient\` with both \`publishableKey\` and \`secretKey\`.
5075
5264
 
5076
5265
  \`\`\`typescript
5077
- import { createServerClient } from '@01.software/sdk'
5266
+ import { createServerClient } from '@01.software/sdk/server'
5078
5267
 
5079
5268
  const client = createServerClient({
5080
5269
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -5325,7 +5514,7 @@ const result = await client.commerce.shipping.calculate({
5325
5514
  }
5326
5515
 
5327
5516
  // src/resources/(docs)/customer-auth.ts
5328
- var metadata43 = {
5517
+ var metadata45 = {
5329
5518
  name: "docs-customer-auth",
5330
5519
  title: "Customer Auth API",
5331
5520
  description: "01.software SDK Customer Auth API reference (client.customer)"
@@ -5503,7 +5692,7 @@ async function loadProfile() {
5503
5692
  }
5504
5693
 
5505
5694
  // src/resources/(docs)/browser-vs-server.ts
5506
- var metadata44 = {
5695
+ var metadata46 = {
5507
5696
  name: "docs-browser-vs-server",
5508
5697
  title: "Client vs ServerClient",
5509
5698
  description: "When to use Client (createClient) vs ServerClient (createServerClient) in the 01.software SDK"
@@ -5523,9 +5712,9 @@ The SDK provides two client types for different execution environments.
5523
5712
  | Read (\`find\`, \`findById\`, \`count\`) | Yes | Yes |
5524
5713
  | Write (\`create\`, \`update\`, \`remove\`) | No | Yes |
5525
5714
  | Bulk (\`updateMany\`, \`removeMany\`) | No | Yes |
5526
- | React Query hooks (\`client.query\`) | Yes | Yes (SSR prefetch) |
5715
+ | React Query hooks (\`@01.software/sdk/query\`) | Yes | Yes (SSR prefetch) |
5527
5716
  | Customer auth (\`client.customer\`) | Yes | No |
5528
- | Server API (\`client.api\`) | No | Yes |
5717
+ | Commerce/server APIs (\`server.commerce\`, server CRUD) | No | Yes |
5529
5718
 
5530
5719
  ## Client (createClient)
5531
5720
 
@@ -5533,16 +5722,18 @@ Use in browser code, React client components, and anywhere the secret key must n
5533
5722
 
5534
5723
  \`\`\`typescript
5535
5724
  import { createClient } from '@01.software/sdk'
5725
+ import { createQueryHooks } from '@01.software/sdk/query'
5536
5726
 
5537
5727
  const client = createClient({
5538
5728
  publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
5539
5729
  })
5730
+ const query = createQueryHooks(client)
5540
5731
 
5541
5732
  // Read data
5542
5733
  const products = await client.collections.from('products').find({ limit: 10 })
5543
5734
 
5544
5735
  // React Query hooks
5545
- const { data } = client.query.useQuery({ collection: 'products' })
5736
+ const { data } = query.useQuery({ collection: 'products' })
5546
5737
 
5547
5738
  // Customer auth
5548
5739
  await client.customer.login({ email, password })
@@ -5555,7 +5746,7 @@ await client.customer.login({ email, password })
5555
5746
  Use in server components, API routes, server actions, and background jobs. Has full CRUD access.
5556
5747
 
5557
5748
  \`\`\`typescript
5558
- import { createServerClient } from '@01.software/sdk'
5749
+ import { createServerClient } from '@01.software/sdk/server'
5559
5750
 
5560
5751
  const client = createServerClient({
5561
5752
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -5576,11 +5767,14 @@ await client.collections.from('product-variants').create({
5576
5767
  })
5577
5768
  await client.collections.from('products').remove('product-id')
5578
5769
 
5579
- // Server API (orders, carts, etc.)
5770
+ // Commerce API (orders, carts, etc.)
5580
5771
  await client.commerce.orders.create({ ... })
5581
5772
  await client.commerce.orders.checkout({ ... })
5582
5773
  \`\`\`
5583
5774
 
5775
+ Server-only code must import \`createServerClient\` from the \`/server\`
5776
+ sub-path.
5777
+
5584
5778
  **Environment variables**:
5585
5779
  - \`SOFTWARE_PUBLISHABLE_KEY\` \u2014 publishable key (no NEXT_PUBLIC prefix, server-only)
5586
5780
  - \`SOFTWARE_SECRET_KEY\` \u2014 server credential
@@ -5610,7 +5804,7 @@ deploying again.
5610
5804
 
5611
5805
  \`\`\`typescript
5612
5806
  // lib/sdk.ts \u2014 server-only module
5613
- import { createServerClient } from '@01.software/sdk'
5807
+ import { createServerClient } from '@01.software/sdk/server'
5614
5808
 
5615
5809
  export function getServerClient() {
5616
5810
  return createServerClient({
@@ -5623,10 +5817,12 @@ export function getServerClient() {
5623
5817
  \`\`\`typescript
5624
5818
  // lib/sdk-client.ts \u2014 browser-safe module
5625
5819
  import { createClient } from '@01.software/sdk'
5820
+ import { createQueryHooks } from '@01.software/sdk/query'
5626
5821
 
5627
5822
  export const browserClient = createClient({
5628
5823
  publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
5629
5824
  })
5825
+ export const browserQuery = createQueryHooks(browserClient)
5630
5826
  \`\`\`
5631
5827
 
5632
5828
  \`\`\`typescript
@@ -5643,10 +5839,10 @@ export default async function ProductsPage() {
5643
5839
  \`\`\`typescript
5644
5840
  // components/product-list.tsx \u2014 Client Component
5645
5841
  'use client'
5646
- import { browserClient } from '@/lib/sdk-client'
5842
+ import { browserQuery } from '@/lib/sdk-client'
5647
5843
 
5648
5844
  export function ProductList() {
5649
- const { data } = browserClient.query.useQuery({ collection: 'products' })
5845
+ const { data } = browserQuery.useQuery({ collection: 'products' })
5650
5846
  return <ul>{data?.docs.map(p => <li key={p.id}>{p.title}</li>)}</ul>
5651
5847
  }
5652
5848
  \`\`\`
@@ -5662,7 +5858,7 @@ export function ProductList() {
5662
5858
  }
5663
5859
 
5664
5860
  // src/resources/(docs)/file-upload.ts
5665
- var metadata45 = {
5861
+ var metadata47 = {
5666
5862
  name: "docs-file-upload",
5667
5863
  title: "File Upload",
5668
5864
  description: "01.software SDK file upload patterns using the images collection"
@@ -5677,7 +5873,7 @@ Upload files using the \`images\` collection (tenant-scoped, unified image store
5677
5873
  Use \`ServerClient\` with \`FormData\` to upload images server-side.
5678
5874
 
5679
5875
  \`\`\`typescript
5680
- import { createServerClient } from '@01.software/sdk'
5876
+ import { createServerClient } from '@01.software/sdk/server'
5681
5877
 
5682
5878
  const client = createServerClient({
5683
5879
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -5700,7 +5896,7 @@ async function uploadImage(file: File) {
5700
5896
  \`\`\`typescript
5701
5897
  // app/api/upload/route.ts
5702
5898
  import { NextRequest, NextResponse } from 'next/server'
5703
- import { createServerClient } from '@01.software/sdk'
5899
+ import { createServerClient } from '@01.software/sdk/server'
5704
5900
 
5705
5901
  const client = createServerClient({
5706
5902
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -5730,7 +5926,7 @@ export async function POST(req: NextRequest) {
5730
5926
  // actions/upload.ts
5731
5927
  'use server'
5732
5928
 
5733
- import { createServerClient } from '@01.software/sdk'
5929
+ import { createServerClient } from '@01.software/sdk/server'
5734
5930
 
5735
5931
  const client = createServerClient({
5736
5932
  publishableKey: process.env.SOFTWARE_PUBLISHABLE_KEY!,
@@ -5813,7 +6009,7 @@ The platform stores files in Cloudflare R2 and serves via CDN (\`cdn.01.software
5813
6009
  }
5814
6010
 
5815
6011
  // src/resources/(docs)/webhook.ts
5816
- var metadata46 = {
6012
+ var metadata48 = {
5817
6013
  name: "docs-webhook",
5818
6014
  title: "Webhooks",
5819
6015
  description: "01.software SDK webhook verification and event handling"
@@ -5926,9 +6122,100 @@ Failed webhook deliveries are queued with automatic retries. Ensure your handler
5926
6122
  Configure webhook URLs in the 01.software console under Tenant Settings > Webhooks. Multiple URLs can be registered; all receive every event.`;
5927
6123
  }
5928
6124
 
6125
+ // src/resources/(docs)/product-detail.ts
6126
+ var metadata49 = {
6127
+ name: "docs-product-detail",
6128
+ title: "Product Detail Helper",
6129
+ description: "01.software SDK commerce.product.detail helper guide"
6130
+ };
6131
+ function handler19() {
6132
+ return `# Product Detail Helper
6133
+
6134
+ ## When to use the helper vs the raw query builder
6135
+
6136
+ Use \`client.commerce.product.detail({ slug | id })\` when you need a full product detail page payload in one call. The helper folds the Payload query, access policy, and response shaping (variants, options, option value slugs/media, brand, categories, tags, images, videos, listing rollup) into a single call.
6137
+
6138
+ Use \`client.collections.from('products').find(...)\` (escape hatch) when you need bulk reads, custom filter combinations, or fields outside the helper response shape.
6139
+
6140
+ ## Single-call example
6141
+
6142
+ \`\`\`typescript
6143
+ import { createClient, resolveProductSelection } from '@01.software/sdk'
6144
+
6145
+ const client = createClient({
6146
+ publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
6147
+ })
6148
+
6149
+ const detail = await client.commerce.product.detail({ slug: 'my-product' })
6150
+ if (!detail) return notFound()
6151
+ const selection = resolveProductSelection(detail, {
6152
+ search: '?opt.option-color=color-black',
6153
+ })
6154
+ // selection.selectedVariant, selection.price, selection.stock, selection.media
6155
+ \`\`\`
6156
+
6157
+ ## URL round-trip
6158
+
6159
+ Use the SDK codec for canonical selection URLs. Complete selections use
6160
+ \`variant=<variantId>\`; partial selections use
6161
+ \`opt.<optionId>=<valueId>\`. Older
6162
+ \`opt.<optionSlug>=<valueSlug>\` URLs still decode during Stage 1, but slugs are
6163
+ compatibility metadata rather than canonical identity.
6164
+
6165
+ \`\`\`typescript
6166
+ import { createProductSelectionCodec } from '@01.software/sdk'
6167
+
6168
+ const codec = createProductSelectionCodec(detail)
6169
+ const selection = codec.parse('?opt.option-color=color-black')
6170
+ const selectionQuery = codec.stringify(selection)
6171
+ \`\`\`
6172
+
6173
+ Use IDs from \`detail.options[].id\` and \`detail.options[].values[].id\` when building new selection links. Slugs remain useful for display and older inbound URLs, but new outbound URLs should use the codec output.
6174
+
6175
+ Value-slug-only URLs such as \`?black\` or \`?color=black\` are rejected because option titles and values are not stable identifiers.
6176
+
6177
+ ## React Query hook variant
6178
+
6179
+ \`\`\`typescript
6180
+ import { createQueryHooks } from '@01.software/sdk/query'
6181
+
6182
+ const query = createQueryHooks(client)
6183
+ const { data: detail, isLoading } = query.useProductDetailBySlug(slug)
6184
+ \`\`\`
6185
+
6186
+ Cache invalidates automatically when any of 10 detail-relevant collections is mutated through SDK mutation hooks.
6187
+
6188
+ ## SSG / Server Component snippet
6189
+
6190
+ \`\`\`tsx
6191
+ // app/products/[slug]/page.tsx
6192
+ import { createClient } from '@01.software/sdk'
6193
+ import { notFound } from 'next/navigation'
6194
+
6195
+ export const revalidate = 60
6196
+
6197
+ export default async function ProductPage({ params }: { params: { slug: string } }) {
6198
+ const client = createClient({
6199
+ publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
6200
+ })
6201
+ const detail = await client.commerce.product.detail({ slug: params.slug })
6202
+ if (!detail) return notFound()
6203
+ return <ProductView detail={detail} />
6204
+ }
6205
+ \`\`\`
6206
+
6207
+ ## The \`null\` return contract
6208
+
6209
+ The endpoint returns 404 for \`not_found\`, \`not_published\`, \`tenant_mismatch\`, or \`feature_disabled\`. The SDK collapses all 404s to \`null\` so consumer UIs render one "not available" path.
6210
+
6211
+ ## Backend correlation
6212
+
6213
+ Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records the exact 404 code alongside the request ID.`;
6214
+ }
6215
+
5929
6216
  // src/server.ts
5930
6217
  var REGISTERED_TOOLS_BY_SERVER = /* @__PURE__ */ new WeakMap();
5931
- function registerTool(server, schema35, meta, handler19) {
6218
+ function registerTool(server, schema37, meta, handler20) {
5932
6219
  let registered = REGISTERED_TOOLS_BY_SERVER.get(server);
5933
6220
  if (!registered) {
5934
6221
  registered = /* @__PURE__ */ new Set();
@@ -5939,7 +6226,7 @@ function registerTool(server, schema35, meta, handler19) {
5939
6226
  meta.name,
5940
6227
  {
5941
6228
  description: meta.description,
5942
- inputSchema: schema35,
6229
+ inputSchema: schema37,
5943
6230
  annotations: meta.annotations
5944
6231
  },
5945
6232
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -5968,7 +6255,7 @@ function registerTool(server, schema35, meta, handler19) {
5968
6255
  const summary = activeSummary ?? ownSummary;
5969
6256
  let result = null;
5970
6257
  try {
5971
- result = await handler19(params);
6258
+ result = await handler20(params);
5972
6259
  return { content: [{ type: "text", text: result }] };
5973
6260
  } finally {
5974
6261
  if (summary) {
@@ -5985,26 +6272,26 @@ function registerTool(server, schema35, meta, handler19) {
5985
6272
  }
5986
6273
  );
5987
6274
  }
5988
- function registerPrompt(server, schema35, meta, handler19) {
6275
+ function registerPrompt(server, schema37, meta, handler20) {
5989
6276
  server.registerPrompt(
5990
6277
  meta.name,
5991
6278
  {
5992
6279
  title: meta.title,
5993
6280
  description: meta.description,
5994
- argsSchema: schema35
6281
+ argsSchema: schema37
5995
6282
  },
5996
6283
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5997
6284
  (params) => ({
5998
6285
  messages: [
5999
6286
  {
6000
6287
  role: meta.role ?? "assistant",
6001
- content: { type: "text", text: handler19(params) }
6288
+ content: { type: "text", text: handler20(params) }
6002
6289
  }
6003
6290
  ]
6004
6291
  })
6005
6292
  );
6006
6293
  }
6007
- function registerStaticResource(server, uri, meta, handler19) {
6294
+ function registerStaticResource(server, uri, meta, handler20) {
6008
6295
  server.registerResource(
6009
6296
  meta.name,
6010
6297
  uri,
@@ -6014,7 +6301,7 @@ function registerStaticResource(server, uri, meta, handler19) {
6014
6301
  mimeType: meta.mimeType ?? "text/plain"
6015
6302
  },
6016
6303
  async (url) => ({
6017
- contents: [{ uri: url.href, text: handler19() }]
6304
+ contents: [{ uri: url.href, text: handler20() }]
6018
6305
  })
6019
6306
  );
6020
6307
  }
@@ -6116,147 +6403,160 @@ function createServer(options = {}) {
6116
6403
  calculateShipping
6117
6404
  );
6118
6405
  registerTool(server, schema21, metadata21, stockCheck);
6406
+ registerTool(server, schema22, metadata22, productDetail);
6407
+ registerTool(
6408
+ server,
6409
+ schema23,
6410
+ metadata23,
6411
+ productUpsert
6412
+ );
6119
6413
  }
6120
- registerTool(
6121
- server,
6122
- schema22,
6123
- metadata22,
6124
- getCollectionSchemaTool
6125
- );
6126
- registerTool(
6127
- server,
6128
- schema23,
6129
- metadata23,
6130
- handler
6131
- );
6132
6414
  registerTool(
6133
6415
  server,
6134
6416
  schema24,
6135
6417
  metadata24,
6136
- handler2
6418
+ getCollectionSchemaTool
6137
6419
  );
6138
6420
  registerTool(
6139
6421
  server,
6140
6422
  schema25,
6141
6423
  metadata25,
6142
- listConfigurableFields
6424
+ handler
6143
6425
  );
6144
6426
  registerTool(
6145
6427
  server,
6146
6428
  schema26,
6147
6429
  metadata26,
6148
- updateFieldConfig
6430
+ handler2
6149
6431
  );
6150
6432
  registerTool(
6151
6433
  server,
6152
6434
  schema27,
6153
6435
  metadata27,
6154
- handler3
6436
+ listConfigurableFields
6155
6437
  );
6156
6438
  registerTool(
6157
6439
  server,
6158
6440
  schema28,
6159
6441
  metadata28,
6160
- handler4
6442
+ updateFieldConfig
6161
6443
  );
6162
6444
  registerTool(
6163
6445
  server,
6164
6446
  schema29,
6165
6447
  metadata29,
6166
- handler5
6448
+ handler3
6167
6449
  );
6168
6450
  registerTool(
6169
6451
  server,
6170
6452
  schema30,
6171
6453
  metadata30,
6172
- handler6
6454
+ handler4
6173
6455
  );
6174
- registerPrompt(
6456
+ registerTool(
6175
6457
  server,
6176
6458
  schema31,
6177
6459
  metadata31,
6178
- sdkUsageGuide
6460
+ handler5
6179
6461
  );
6180
- registerPrompt(
6462
+ registerTool(
6181
6463
  server,
6182
6464
  schema32,
6183
6465
  metadata32,
6184
- collectionQueryHelp
6466
+ handler6
6185
6467
  );
6186
6468
  registerPrompt(
6187
6469
  server,
6188
6470
  schema33,
6189
6471
  metadata33,
6190
- orderFlowGuide
6472
+ sdkUsageGuide
6191
6473
  );
6192
6474
  registerPrompt(
6193
6475
  server,
6194
6476
  schema34,
6195
6477
  metadata34,
6478
+ collectionQueryHelp
6479
+ );
6480
+ registerPrompt(
6481
+ server,
6482
+ schema35,
6483
+ metadata35,
6484
+ orderFlowGuide
6485
+ );
6486
+ registerPrompt(
6487
+ server,
6488
+ schema36,
6489
+ metadata36,
6196
6490
  featureSetupGuide
6197
6491
  );
6198
6492
  registerStaticResource(
6199
6493
  server,
6200
6494
  "config://app",
6201
- metadata35,
6495
+ metadata37,
6202
6496
  handler7
6203
6497
  );
6204
6498
  registerStaticResource(
6205
6499
  server,
6206
6500
  "collections://schema",
6207
- metadata36,
6501
+ metadata38,
6208
6502
  handler8
6209
6503
  );
6210
6504
  registerStaticResource(
6211
6505
  server,
6212
6506
  "docs://sdk/getting-started",
6213
- metadata37,
6507
+ metadata39,
6214
6508
  handler9
6215
6509
  );
6216
- registerStaticResource(server, "docs://sdk/guides", metadata38, handler10);
6217
- registerStaticResource(server, "docs://sdk/api", metadata39, handler11);
6510
+ registerStaticResource(server, "docs://sdk/guides", metadata40, handler10);
6511
+ registerStaticResource(server, "docs://sdk/api", metadata41, handler11);
6218
6512
  registerStaticResource(
6219
6513
  server,
6220
6514
  "docs://sdk/query-builder",
6221
- metadata40,
6515
+ metadata42,
6222
6516
  handler12
6223
6517
  );
6224
6518
  registerStaticResource(
6225
6519
  server,
6226
6520
  "docs://sdk/react-query",
6227
- metadata41,
6521
+ metadata43,
6228
6522
  handler13
6229
6523
  );
6230
6524
  registerStaticResource(
6231
6525
  server,
6232
6526
  "docs://sdk/server-api",
6233
- metadata42,
6527
+ metadata44,
6234
6528
  handler14
6235
6529
  );
6236
6530
  registerStaticResource(
6237
6531
  server,
6238
6532
  "docs://sdk/customer-auth",
6239
- metadata43,
6533
+ metadata45,
6240
6534
  handler15
6241
6535
  );
6242
6536
  registerStaticResource(
6243
6537
  server,
6244
6538
  "docs://sdk/browser-vs-server",
6245
- metadata44,
6539
+ metadata46,
6246
6540
  handler16
6247
6541
  );
6248
6542
  registerStaticResource(
6249
6543
  server,
6250
6544
  "docs://sdk/file-upload",
6251
- metadata45,
6545
+ metadata47,
6252
6546
  handler17
6253
6547
  );
6254
6548
  registerStaticResource(
6255
6549
  server,
6256
6550
  "docs://sdk/webhook",
6257
- metadata46,
6551
+ metadata48,
6258
6552
  handler18
6259
6553
  );
6554
+ registerStaticResource(
6555
+ server,
6556
+ "docs://sdk/product-detail",
6557
+ metadata49,
6558
+ handler19
6559
+ );
6260
6560
  return server;
6261
6561
  }
6262
6562
 
@@ -6274,4 +6574,4 @@ export {
6274
6574
  flushMcpTelemetrySummary,
6275
6575
  createServer
6276
6576
  };
6277
- //# sourceMappingURL=chunk-2ECTVUKU.js.map
6577
+ //# sourceMappingURL=chunk-F5VI4HQM.js.map