@01.software/cli 0.10.6 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -309,106 +309,338 @@ var collectionSchemaResponseSchema = z.object({
309
309
  }).strict();
310
310
 
311
311
  // ../../packages/contracts/src/ecommerce/index.ts
312
+ import { z as z3 } from "zod";
313
+
314
+ // ../../packages/contracts/src/ecommerce/product-upsert.ts
312
315
  import { z as z2 } from "zod";
313
- var transactionStatusSchema = z2.enum([
316
+ var IdSchema = z2.union([z2.string(), z2.number()]).transform(String);
317
+ var RemovedLegacyMediaFieldSchema = z2.unknown().optional();
318
+ var productFieldShape = {
319
+ id: IdSchema.optional(),
320
+ title: z2.string().min(1).optional(),
321
+ subtitle: z2.string().optional().nullable(),
322
+ description: z2.string().optional().nullable(),
323
+ status: z2.string().optional(),
324
+ slug: z2.string().optional(),
325
+ primaryMediaItemId: IdSchema.optional().nullable(),
326
+ thumbnail: IdSchema.optional().nullable(),
327
+ images: z2.array(IdSchema).optional(),
328
+ mediaSets: RemovedLegacyMediaFieldSchema,
329
+ vendor: z2.string().optional().nullable(),
330
+ productType: z2.string().optional().nullable(),
331
+ brand: IdSchema.optional().nullable(),
332
+ shippingPolicy: IdSchema.optional().nullable(),
333
+ weight: z2.number().int().min(0).optional().nullable(),
334
+ minOrderQuantity: z2.number().int().min(1).optional().nullable(),
335
+ maxOrderQuantity: z2.number().int().min(1).optional().nullable(),
336
+ listingPrimaryOption: IdSchema.optional().nullable(),
337
+ isFeatured: z2.boolean().optional(),
338
+ publishedAt: z2.string().optional().nullable(),
339
+ categories: z2.array(IdSchema).optional(),
340
+ tags: z2.array(IdSchema).optional(),
341
+ metadata: z2.unknown().optional()
342
+ };
343
+ var PRODUCT_UPSERT_PRODUCT_FIELDS = Object.keys(
344
+ productFieldShape
345
+ );
346
+ var ProductFieldsSchema = z2.object(productFieldShape).passthrough();
347
+ var OptionValueInputSchema = z2.object({
348
+ id: IdSchema.optional(),
349
+ value: z2.string().min(1, "Option value `value` is required"),
350
+ slug: z2.string().optional(),
351
+ swatch: z2.object({
352
+ type: z2.enum(["color", "media"]).optional().nullable(),
353
+ color: z2.string().optional().nullable(),
354
+ mediaItemId: IdSchema.optional().nullable()
355
+ }).optional().nullable(),
356
+ thumbnail: RemovedLegacyMediaFieldSchema,
357
+ images: RemovedLegacyMediaFieldSchema,
358
+ metadata: z2.unknown().optional()
359
+ }).passthrough().superRefine((value, ctx) => {
360
+ if (Object.prototype.hasOwnProperty.call(value, "swatchColor")) {
361
+ ctx.addIssue({
362
+ code: "custom",
363
+ message: "Option value field `swatchColor` was removed. Use nested `swatch.color` instead.",
364
+ path: ["swatchColor"]
365
+ });
366
+ }
367
+ });
368
+ var OptionInputSchema = z2.object({
369
+ id: IdSchema.optional(),
370
+ title: z2.string().min(1, "Option `title` is required"),
371
+ slug: z2.string().optional(),
372
+ values: z2.array(OptionValueInputSchema).min(1, "Each option must have at least one value")
373
+ });
374
+ var VariantOptionValueObjectSchema = z2.object({
375
+ valueSlug: z2.string().optional(),
376
+ valueId: IdSchema.optional(),
377
+ value: z2.string().optional()
378
+ }).refine((data) => Boolean(data.valueSlug ?? data.valueId ?? data.value), {
379
+ message: "Variant option value object requires valueSlug, valueId, or value"
380
+ });
381
+ var VariantInputSchema = z2.object({
382
+ id: IdSchema.optional(),
383
+ optionValues: z2.union([
384
+ z2.record(
385
+ z2.string(),
386
+ z2.union([z2.string(), VariantOptionValueObjectSchema])
387
+ ),
388
+ z2.array(IdSchema)
389
+ ]).optional(),
390
+ sku: z2.string().optional().nullable(),
391
+ title: z2.string().optional().nullable(),
392
+ price: z2.number().min(0),
393
+ compareAtPrice: z2.number().min(0).optional().nullable(),
394
+ stock: z2.number().int().min(0).optional(),
395
+ isUnlimited: z2.boolean().optional(),
396
+ weight: z2.number().int().min(0).optional().nullable(),
397
+ requiresShipping: z2.boolean().optional(),
398
+ barcode: z2.string().optional().nullable(),
399
+ externalId: z2.string().optional().nullable(),
400
+ isActive: z2.boolean().optional(),
401
+ images: z2.array(IdSchema).optional(),
402
+ thumbnail: RemovedLegacyMediaFieldSchema,
403
+ featuredMediaItemId: RemovedLegacyMediaFieldSchema,
404
+ metadata: z2.unknown().optional()
405
+ });
406
+ var ProductUpsertObjectSchema = z2.object({
407
+ /** Required on graph edit when the server graph is non-empty (`productId` set); optional for first seed on an empty graph. */
408
+ graphRevision: z2.string().optional(),
409
+ productId: IdSchema.optional(),
410
+ product: ProductFieldsSchema.optional(),
411
+ options: z2.array(OptionInputSchema).max(10).optional().default([]),
412
+ variants: z2.array(VariantInputSchema).max(500).optional().default([])
413
+ });
414
+ var ProductUpsertSchema = ProductUpsertObjectSchema.superRefine(
415
+ (data, ctx) => {
416
+ const nestedProductId = data.product?.id;
417
+ if (data.productId != null && nestedProductId != null && String(data.productId) !== String(nestedProductId)) {
418
+ ctx.addIssue({
419
+ code: "custom",
420
+ message: "productId must match product.id when both are set on graph upsert.",
421
+ path: ["productId"]
422
+ });
423
+ }
424
+ const productId = data.productId ?? nestedProductId;
425
+ const isEdit = productId != null;
426
+ if (!isEdit && data.productId != null) {
427
+ ctx.addIssue({
428
+ code: "custom",
429
+ message: "productId is not allowed when creating a product.",
430
+ path: ["productId"]
431
+ });
432
+ }
433
+ if (!isEdit && !data.product?.title) {
434
+ ctx.addIssue({
435
+ code: "custom",
436
+ message: "Product `title` is required when creating a new product.",
437
+ path: ["product", "title"]
438
+ });
439
+ }
440
+ if (isEdit && data.product) {
441
+ for (const key of Object.keys(data.product)) {
442
+ if (key !== "id") {
443
+ ctx.addIssue({
444
+ code: "custom",
445
+ message: "Existing product graph upsert accepts only product identity. Save document fields through Payload.",
446
+ path: ["product", key]
447
+ });
448
+ }
449
+ }
450
+ }
451
+ }
452
+ );
453
+
454
+ // ../../packages/contracts/src/ecommerce/index.ts
455
+ var transactionStatusSchema = z3.enum([
314
456
  "pending",
315
457
  "paid",
316
458
  "failed",
317
459
  "canceled"
318
460
  ]);
319
- var entityIdSchema = z2.union([z2.string(), z2.number()]).transform(String);
320
- var createOrderItemSchema = z2.object({
461
+ var orderStatusSchema = z3.enum([
462
+ "pending",
463
+ "paid",
464
+ "failed",
465
+ "canceled",
466
+ "refunded",
467
+ "preparing",
468
+ "shipped",
469
+ "delivered",
470
+ "confirmed",
471
+ "return_requested",
472
+ "return_processing",
473
+ "returned"
474
+ ]);
475
+ var entityIdSchema = z3.union([z3.string(), z3.number()]).transform(String);
476
+ var createOrderItemSchema = z3.object({
321
477
  product: entityIdSchema,
322
478
  variant: entityIdSchema,
323
479
  option: entityIdSchema,
324
- quantity: z2.number().int().positive("quantity must be a positive integer"),
325
- unitPrice: z2.number().optional(),
326
- totalPrice: z2.number().optional()
480
+ quantity: z3.number().int().positive("quantity must be a positive integer"),
481
+ unitPrice: z3.number().optional(),
482
+ totalPrice: z3.number().optional()
327
483
  });
328
- var createOrderSchema = z2.object({
329
- pgPaymentId: z2.string().min(1).optional(),
330
- orderNumber: z2.string().min(1, "orderNumber is required"),
484
+ var createOrderSchema = z3.object({
485
+ pgPaymentId: z3.string().min(1).optional(),
486
+ orderNumber: z3.string().min(1, "orderNumber is required"),
331
487
  customer: entityIdSchema.optional(),
332
- customerSnapshot: z2.object({
333
- name: z2.string().optional(),
334
- email: z2.string().email("Invalid email format"),
335
- phone: z2.string().optional()
488
+ customerSnapshot: z3.object({
489
+ name: z3.string().optional(),
490
+ email: z3.string().email("Invalid email format"),
491
+ phone: z3.string().optional()
336
492
  }),
337
- shippingAddress: z2.object({
338
- postalCode: z2.string().optional(),
339
- address: z2.string().optional(),
340
- detailAddress: z2.string().optional(),
341
- deliveryMessage: z2.string().optional(),
342
- recipientName: z2.string().optional(),
343
- phone: z2.string().optional()
493
+ shippingAddress: z3.object({
494
+ postalCode: z3.string().optional(),
495
+ address: z3.string().optional(),
496
+ detailAddress: z3.string().optional(),
497
+ deliveryMessage: z3.string().optional(),
498
+ recipientName: z3.string().optional(),
499
+ phone: z3.string().optional()
344
500
  }),
345
- orderItems: z2.array(createOrderItemSchema).min(1, "At least one order item is required").max(100, "Maximum 100 items per order"),
346
- totalAmount: z2.number().nonnegative("totalAmount must be non-negative"),
347
- shippingAmount: z2.number().min(0).optional(),
348
- discountCode: z2.string().optional()
501
+ orderItems: z3.array(createOrderItemSchema).min(1, "At least one order item is required").max(100, "Maximum 100 items per order"),
502
+ totalAmount: z3.number().nonnegative("totalAmount must be non-negative"),
503
+ shippingAmount: z3.number().min(0).optional(),
504
+ discountCode: z3.string().optional()
349
505
  });
350
506
  var CreateOrderSchema = createOrderSchema;
351
- var updateTransactionSchema = z2.object({
352
- pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("PG payment ID (required)"),
507
+ var updateTransactionSchema = z3.object({
508
+ pgPaymentId: z3.string().min(1, "pgPaymentId is required").describe("PG payment ID (required)"),
353
509
  status: transactionStatusSchema.describe(
354
510
  "New transaction status (required)"
355
511
  ),
356
- paymentMethod: z2.string().optional().describe("Payment method (optional)"),
357
- receiptUrl: z2.string().optional().describe("Receipt URL (optional)"),
358
- paymentKey: z2.string().min(1).optional().describe("Provider payment key for verified paid confirmation"),
359
- amount: z2.number().int().positive().optional().describe("Provider-confirmed amount for verified paid confirmation")
512
+ paymentMethod: z3.string().optional().describe("Payment method (optional)"),
513
+ receiptUrl: z3.string().optional().describe("Receipt URL (optional)"),
514
+ paymentKey: z3.string().min(1).optional().describe("Provider payment key for verified paid confirmation"),
515
+ amount: z3.number().int().positive().optional().describe("Provider-confirmed amount for verified paid confirmation")
360
516
  }).strict();
361
517
  var UpdateTransactionSchema = updateTransactionSchema;
362
- var providerSlugSchema = z2.string().trim().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/, "pgProvider must be lowercase slug");
363
- var confirmPaymentSchema = z2.object({
364
- orderNumber: z2.string().min(1).optional(),
365
- pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("Provider payment identifier stored on the transaction"),
518
+ var providerSlugSchema = z3.string().trim().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/, "pgProvider must be lowercase slug");
519
+ var confirmPaymentSchema = z3.object({
520
+ orderNumber: z3.string().min(1).optional(),
521
+ pgPaymentId: z3.string().min(1, "pgPaymentId is required").describe("Provider payment identifier stored on the transaction"),
366
522
  pgProvider: providerSlugSchema.describe(
367
523
  "Payment provider slug, e.g. toss, portone, stripe"
368
524
  ),
369
- pgOrderId: z2.string().min(1).optional(),
370
- amount: z2.number().int().nonnegative("amount must be non-negative").describe("Provider-confirmed amount in minor units"),
371
- currency: z2.string().min(1).optional(),
372
- paymentMethod: z2.string().optional(),
373
- receiptUrl: z2.string().url().optional(),
374
- approvedAt: z2.string().optional(),
375
- providerStatus: z2.string().optional(),
376
- providerEventId: z2.string().min(1).optional(),
377
- confirmationSource: z2.enum([
525
+ pgOrderId: z3.string().min(1).optional(),
526
+ amount: z3.number().int().nonnegative("amount must be non-negative").describe("Provider-confirmed amount in minor units"),
527
+ currency: z3.string().min(1).optional(),
528
+ paymentMethod: z3.string().optional(),
529
+ receiptUrl: z3.string().url().optional(),
530
+ approvedAt: z3.string().optional(),
531
+ providerStatus: z3.string().optional(),
532
+ providerEventId: z3.string().min(1).optional(),
533
+ confirmationSource: z3.enum([
378
534
  "provider_webhook",
379
535
  "provider_lookup",
380
536
  "provider_api_confirm",
381
537
  "manual_server"
382
538
  ]).optional(),
383
- metadata: z2.record(z2.string(), z2.unknown()).optional()
539
+ metadata: z3.record(z3.string(), z3.unknown()).optional()
384
540
  }).strict();
385
541
  var ConfirmPaymentSchema = confirmPaymentSchema;
386
- var returnReasonSchema = z2.enum([
542
+ var returnReasonSchema = z3.enum([
387
543
  "change_of_mind",
388
544
  "defective",
389
545
  "wrong_delivery",
390
546
  "damaged",
391
547
  "other"
392
548
  ]);
393
- var restockActionSchema = z2.enum(["return_to_stock", "discard"]);
394
- var returnWithRefundItemSchema = z2.object({
395
- orderItem: z2.union([z2.string(), z2.number()]).transform(String),
396
- quantity: z2.number().int().positive("quantity must be a positive integer"),
549
+ var restockActionSchema = z3.enum(["return_to_stock", "discard"]);
550
+ var returnWithRefundItemSchema = z3.object({
551
+ orderItem: z3.union([z3.string(), z3.number()]).transform(String),
552
+ quantity: z3.number().int().positive("quantity must be a positive integer"),
397
553
  restockAction: restockActionSchema.default("return_to_stock"),
398
- restockingFee: z2.number().min(0, "restockingFee must be non-negative").optional().describe("Restocking fee charged for this line (ADR 0005 \xA7Gap 1)")
554
+ restockingFee: z3.number().min(0, "restockingFee must be non-negative").optional().describe("Restocking fee charged for this line (ADR 0005 \xA7Gap 1)")
399
555
  }).strict();
400
- var returnWithRefundSchema = z2.object({
401
- orderNumber: z2.string().min(1, "orderNumber is required").describe("Order number (required)"),
556
+ var returnWithRefundSchema = z3.object({
557
+ orderNumber: z3.string().min(1, "orderNumber is required").describe("Order number (required)"),
402
558
  reason: returnReasonSchema.optional().describe("Return reason (optional)"),
403
- reasonDetail: z2.string().optional().describe("Detailed reason text (optional)"),
404
- 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)"),
405
- refundAmount: z2.number().min(0, "refundAmount must be non-negative").describe("Refund amount (required, min 0)"),
406
- returnShippingFee: z2.number().min(0, "returnShippingFee must be non-negative").optional().describe("Return shipping fee charged to the customer (ADR 0005 \xA7Gap 1)"),
407
- pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("PG payment ID for refund (required)"),
408
- paymentKey: z2.string().min(1).optional().describe("Provider payment key for verified refund"),
409
- refundReceiptUrl: z2.string().optional().describe("Refund receipt URL (optional)")
559
+ reasonDetail: z3.string().optional().describe("Detailed reason text (optional)"),
560
+ returnItems: z3.array(returnWithRefundItemSchema).min(1, "At least one return item is required").max(100, "Too many return items").describe("Array of products to return (required)"),
561
+ refundAmount: z3.number().min(0, "refundAmount must be non-negative").describe("Refund amount (required, min 0)"),
562
+ returnShippingFee: z3.number().min(0, "returnShippingFee must be non-negative").optional().describe(
563
+ "Return shipping fee charged to the customer (ADR 0005 \xA7Gap 1)"
564
+ ),
565
+ pgPaymentId: z3.string().min(1, "pgPaymentId is required").describe("PG payment ID for refund (required)"),
566
+ paymentKey: z3.string().min(1).optional().describe("Provider payment key for verified refund"),
567
+ refundReceiptUrl: z3.string().optional().describe("Refund receipt URL (optional)")
410
568
  }).strict();
411
569
  var ReturnWithRefundSchema = returnWithRefundSchema;
570
+ var cancelReasonCodeSchema = z3.enum([
571
+ "customer",
572
+ "inventory",
573
+ "fraud",
574
+ "declined",
575
+ "staff",
576
+ "other"
577
+ ]);
578
+ var idempotencyKeySchema = z3.string().trim().min(1, "idempotencyKey is required").max(255, "idempotencyKey must be 255 characters or fewer").regex(
579
+ /^[\x21-\x7E]+$/,
580
+ "idempotencyKey must contain only printable header-safe characters"
581
+ );
582
+ var cancelOrderSchema = z3.object({
583
+ orderNumber: z3.string().min(1, "orderNumber is required").describe("Order number to cancel"),
584
+ reasonCode: cancelReasonCodeSchema.default("other").describe("Operator-selected cancel reason code"),
585
+ reasonDetail: z3.string().trim().max(2e3, "reasonDetail must be 2000 characters or fewer").optional().describe("Internal cancellation detail stored on the order")
586
+ }).strict();
587
+ var CancelOrderSchema = cancelOrderSchema;
588
+ var cancelOrderResponseBaseSchema = {
589
+ orderId: z3.string().min(1)
590
+ };
591
+ var unpaidCancelResponseFields = {
592
+ refundedAmount: z3.literal(0),
593
+ providerRefunded: z3.literal(false)
594
+ };
595
+ var alreadyCanceledResponseFields = {
596
+ refundedAmount: z3.number().int().nonnegative(),
597
+ providerRefunded: z3.literal(false)
598
+ };
599
+ var providerRefundResponseFields = {
600
+ transactionId: z3.string().min(1),
601
+ refundedAmount: z3.number().int().positive(),
602
+ refundSeq: z3.number().int().positive(),
603
+ providerRefunded: z3.literal(true)
604
+ };
605
+ var cancelOrderReconciliationStatusSchema = z3.enum([
606
+ "paid",
607
+ "preparing",
608
+ "shipped",
609
+ "delivered",
610
+ "confirmed",
611
+ "return_requested",
612
+ "return_processing",
613
+ "returned",
614
+ "refunded"
615
+ ]);
616
+ var cancelOrderResponseSchema = z3.union([
617
+ z3.object({
618
+ ...cancelOrderResponseBaseSchema,
619
+ ...unpaidCancelResponseFields,
620
+ status: z3.literal("canceled"),
621
+ cancelCommitted: z3.literal(true)
622
+ }).strict(),
623
+ z3.object({
624
+ ...cancelOrderResponseBaseSchema,
625
+ ...providerRefundResponseFields,
626
+ status: z3.literal("canceled"),
627
+ cancelCommitted: z3.literal(true)
628
+ }).strict(),
629
+ z3.object({
630
+ ...cancelOrderResponseBaseSchema,
631
+ ...alreadyCanceledResponseFields,
632
+ status: z3.literal("canceled"),
633
+ cancelCommitted: z3.literal(false),
634
+ alreadyCanceled: z3.literal(true)
635
+ }).strict(),
636
+ z3.object({
637
+ ...cancelOrderResponseBaseSchema,
638
+ ...providerRefundResponseFields,
639
+ status: cancelOrderReconciliationStatusSchema,
640
+ cancelCommitted: z3.literal(false),
641
+ reconciliationRequired: z3.literal(true)
642
+ }).strict()
643
+ ]);
412
644
 
413
645
  // ../../packages/contracts/src/mcp/index.ts
414
646
  var MCP_TOOL_CONTRACT = {
@@ -517,6 +749,11 @@ var MCP_TOOL_CONTRACT = {
517
749
  oauthScope: "mcp:write",
518
750
  readOnly: false
519
751
  },
752
+ "cancel-order": {
753
+ consoleRole: "tenant-admin",
754
+ oauthScope: "mcp:write",
755
+ readOnly: false
756
+ },
520
757
  "update-order": {
521
758
  consoleRole: "tenant-admin",
522
759
  oauthScope: "mcp:write",
@@ -757,14 +994,14 @@ var TOOL_POLICY_MANIFEST = {
757
994
  category: "mutation-order",
758
995
  oauthScope: MCP_SCOPES.write,
759
996
  consoleRole: "tenant-admin",
760
- consoleSurface: "POST /api/checkout",
997
+ consoleSurface: "POST /api/orders/checkout",
761
998
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
762
999
  },
763
1000
  "create-order": {
764
1001
  category: "mutation-order",
765
1002
  oauthScope: MCP_SCOPES.write,
766
1003
  consoleRole: "tenant-admin",
767
- consoleSurface: "POST /api/orders",
1004
+ consoleSurface: "POST /api/orders/create",
768
1005
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
769
1006
  },
770
1007
  "confirm-payment": {
@@ -775,11 +1012,19 @@ var TOOL_POLICY_MANIFEST = {
775
1012
  annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
776
1013
  exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
777
1014
  },
1015
+ "cancel-order": {
1016
+ category: "mutation-order",
1017
+ oauthScope: MCP_SCOPES.write,
1018
+ consoleRole: "tenant-admin",
1019
+ consoleSurface: "POST /api/orders/cancel",
1020
+ annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
1021
+ exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
1022
+ },
778
1023
  "update-order": {
779
1024
  category: "mutation-order",
780
1025
  oauthScope: MCP_SCOPES.write,
781
1026
  consoleRole: "tenant-admin",
782
- consoleSurface: "PATCH /api/orders/{id}",
1027
+ consoleSurface: "POST /api/orders/update",
783
1028
  annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
784
1029
  exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
785
1030
  },
@@ -788,14 +1033,14 @@ var TOOL_POLICY_MANIFEST = {
788
1033
  category: "mutation-fulfillment",
789
1034
  oauthScope: MCP_SCOPES.write,
790
1035
  consoleRole: "tenant-admin",
791
- consoleSurface: "POST /api/orders/{id}/fulfillments",
1036
+ consoleSurface: "POST /api/orders/create-fulfillment",
792
1037
  annotationPolicy: NON_DESTRUCTIVE_MUTATION_ANNOTATION
793
1038
  },
794
1039
  "update-fulfillment": {
795
1040
  category: "mutation-fulfillment",
796
1041
  oauthScope: MCP_SCOPES.write,
797
1042
  consoleRole: "tenant-admin",
798
- consoleSurface: "PATCH /api/fulfillments/{id}",
1043
+ consoleSurface: "POST /api/orders/update-fulfillment",
799
1044
  annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
800
1045
  exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
801
1046
  },
@@ -804,14 +1049,14 @@ var TOOL_POLICY_MANIFEST = {
804
1049
  category: "mutation-return",
805
1050
  oauthScope: MCP_SCOPES.write,
806
1051
  consoleRole: "tenant-admin",
807
- consoleSurface: "POST /api/returns",
1052
+ consoleSurface: "POST /api/returns/create",
808
1053
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
809
1054
  },
810
1055
  "update-return": {
811
1056
  category: "mutation-return",
812
1057
  oauthScope: MCP_SCOPES.write,
813
1058
  consoleRole: "tenant-admin",
814
- consoleSurface: "PATCH /api/returns/{id}",
1059
+ consoleSurface: "POST /api/returns/update",
815
1060
  annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
816
1061
  exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
817
1062
  },
@@ -819,7 +1064,7 @@ var TOOL_POLICY_MANIFEST = {
819
1064
  category: "mutation-return",
820
1065
  oauthScope: MCP_SCOPES.write,
821
1066
  consoleRole: "tenant-admin",
822
- consoleSurface: "POST /api/returns/with-refund",
1067
+ consoleSurface: "POST /api/returns/return-refund",
823
1068
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
824
1069
  },
825
1070
  // ── Transaction mutations (mcp:write, tenant-admin) ──
@@ -827,7 +1072,7 @@ var TOOL_POLICY_MANIFEST = {
827
1072
  category: "mutation-transaction",
828
1073
  oauthScope: MCP_SCOPES.write,
829
1074
  consoleRole: "tenant-admin",
830
- consoleSurface: "PATCH /api/transactions/{id}",
1075
+ consoleSurface: "POST /api/transactions/update",
831
1076
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
832
1077
  },
833
1078
  // ── Field-config mutations (mcp:write, tenant-admin) ──
@@ -1230,7 +1475,7 @@ async function swallow(promise) {
1230
1475
  }
1231
1476
 
1232
1477
  // src/tools/query-collection.ts
1233
- import { z as z3 } from "zod";
1478
+ import { z as z4 } from "zod";
1234
1479
 
1235
1480
  // src/lib/client.ts
1236
1481
  import { createServerClient } from "@01.software/sdk/server";
@@ -1266,13 +1511,13 @@ function getClient() {
1266
1511
  // src/tools/query-collection.ts
1267
1512
  import { SERVER_COLLECTIONS } from "@01.software/sdk";
1268
1513
  var schema = {
1269
- collection: z3.enum(SERVER_COLLECTIONS).describe("Collection name (required)"),
1270
- where: z3.string().optional().describe(
1514
+ collection: z4.enum(SERVER_COLLECTIONS).describe("Collection name (required)"),
1515
+ where: z4.string().optional().describe(
1271
1516
  `Filter conditions (JSON string, optional). Pass the Payload query condition object as a JSON string. Example: '{"title":{"equals":"Product name"}}'`
1272
1517
  ),
1273
- limit: z3.number().min(1).max(100).default(10).describe("Maximum number of items to return (1-100, default: 10)."),
1274
- page: z3.number().optional().describe("Page number (optional). Starts from 1. Used for pagination."),
1275
- sort: z3.string().regex(
1518
+ limit: z4.number().min(1).max(100).default(10).describe("Maximum number of items to return (1-100, default: 10)."),
1519
+ page: z4.number().optional().describe("Page number (optional). Starts from 1. Used for pagination."),
1520
+ sort: z4.string().regex(
1276
1521
  /^-?[a-zA-Z0-9_.]+$/,
1277
1522
  'Sort must be a field name, optionally prefixed with "-" for descending'
1278
1523
  ).optional().describe(
@@ -1329,11 +1574,11 @@ async function queryCollection({
1329
1574
  }
1330
1575
 
1331
1576
  // src/tools/get-collection-by-id.ts
1332
- import { z as z4 } from "zod";
1577
+ import { z as z5 } from "zod";
1333
1578
  import { SERVER_COLLECTIONS as SERVER_COLLECTIONS2 } from "@01.software/sdk";
1334
1579
  var schema2 = {
1335
- collection: z4.enum(SERVER_COLLECTIONS2).describe("Collection name (required)"),
1336
- id: z4.string().min(1).describe("Item ID (required)")
1580
+ collection: z5.enum(SERVER_COLLECTIONS2).describe("Collection name (required)"),
1581
+ id: z5.string().min(1).describe("Item ID (required)")
1337
1582
  };
1338
1583
  var metadata2 = {
1339
1584
  name: "get-collection-by-id",
@@ -1359,9 +1604,9 @@ async function getCollectionById({
1359
1604
  }
1360
1605
 
1361
1606
  // src/tools/get-order.ts
1362
- import { z as z5 } from "zod";
1607
+ import { z as z6 } from "zod";
1363
1608
  var schema3 = {
1364
- orderNumber: z5.string().min(1).describe("Order number to look up (required)")
1609
+ orderNumber: z6.string().min(1).describe("Order number to look up (required)")
1365
1610
  };
1366
1611
  var metadata3 = {
1367
1612
  name: "get-order",
@@ -1414,10 +1659,10 @@ async function createOrder(params) {
1414
1659
  }
1415
1660
 
1416
1661
  // src/tools/update-order.ts
1417
- import { z as z6 } from "zod";
1662
+ import { z as z7 } from "zod";
1418
1663
  var schema5 = {
1419
- orderNumber: z6.string().min(1).describe("Order number (required)"),
1420
- status: z6.enum([
1664
+ orderNumber: z7.string().min(1).describe("Order number (required)"),
1665
+ status: z7.enum([
1421
1666
  "pending",
1422
1667
  "paid",
1423
1668
  "failed",
@@ -1427,12 +1672,12 @@ var schema5 = {
1427
1672
  "delivered",
1428
1673
  "confirmed"
1429
1674
  ]).describe(
1430
- "New order status. Return-related statuses (return_requested, return_processing, returned) must be set via Return endpoints."
1675
+ "New operator-driven order status. The schema keeps SDK status values for compatibility, but the Console update endpoint rejects server-derived statuses (paid, canceled, returned, refunded); those must be set by payment/refund flows, and return-related statuses must be set via Return endpoints."
1431
1676
  )
1432
1677
  };
1433
1678
  var metadata5 = {
1434
1679
  name: "update-order",
1435
- description: "Update order status. Automatically adjusts stock on status changes (e.g., canceled restores stock).",
1680
+ description: "Update operator-driven order status. Console accepts transitions such as paid\u2192preparing/shipped/delivered/confirmed and rejects server-derived payment/refund statuses such as paid, canceled, returned, and refunded; the MCP schema keeps SDK status values for compatibility.",
1436
1681
  annotations: {
1437
1682
  title: "Update order status",
1438
1683
  readOnlyHint: false,
@@ -1454,15 +1699,15 @@ async function updateOrder({
1454
1699
  }
1455
1700
 
1456
1701
  // src/tools/checkout.ts
1457
- import { z as z7 } from "zod";
1702
+ import { z as z8 } from "zod";
1458
1703
  var schema6 = {
1459
- cartId: z7.string().min(1).describe("Cart ID to convert to order (required)"),
1460
- pgPaymentId: z7.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1461
- orderNumber: z7.string().min(1).describe("Unique order number (required)"),
1462
- customerSnapshot: z7.record(z7.string(), z7.unknown()).describe(
1704
+ cartId: z8.string().min(1).describe("Cart ID to convert to order (required)"),
1705
+ pgPaymentId: z8.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1706
+ orderNumber: z8.string().min(1).describe("Unique order number (required)"),
1707
+ customerSnapshot: z8.record(z8.string(), z8.unknown()).describe(
1463
1708
  "Customer snapshot object (required). Fields: { name?, email, phone? }"
1464
1709
  ),
1465
- discountCode: z7.string().optional().describe("Discount code to apply (optional)")
1710
+ discountCode: z8.string().optional().describe("Discount code to apply (optional)")
1466
1711
  };
1467
1712
  var metadata6 = {
1468
1713
  name: "checkout",
@@ -1487,17 +1732,17 @@ async function checkout(params) {
1487
1732
  }
1488
1733
 
1489
1734
  // src/tools/create-fulfillment.ts
1490
- import { z as z8 } from "zod";
1735
+ import { z as z9 } from "zod";
1491
1736
  var schema7 = {
1492
- orderNumber: z8.string().min(1).describe("Order number (required)"),
1493
- carrier: z8.string().optional().describe("Shipping carrier name (optional)"),
1494
- trackingNumber: z8.string().optional().describe(
1737
+ orderNumber: z9.string().min(1).describe("Order number (required)"),
1738
+ carrier: z9.string().optional().describe("Shipping carrier name (optional)"),
1739
+ trackingNumber: z9.string().optional().describe(
1495
1740
  'Tracking number (optional). Setting carrier + tracking triggers "shipped" status'
1496
1741
  ),
1497
- items: z8.array(
1498
- z8.object({
1499
- orderItem: z8.string().min(1).describe("Order item ID"),
1500
- quantity: z8.number().int().positive().describe("Quantity to fulfill")
1742
+ items: z9.array(
1743
+ z9.object({
1744
+ orderItem: z9.string().min(1).describe("Order item ID"),
1745
+ quantity: z9.number().int().positive().describe("Quantity to fulfill")
1501
1746
  })
1502
1747
  ).describe("Array of items to fulfill (required)")
1503
1748
  };
@@ -1532,16 +1777,16 @@ async function createFulfillment({
1532
1777
  }
1533
1778
 
1534
1779
  // src/tools/update-fulfillment.ts
1535
- import { z as z9 } from "zod";
1780
+ import { z as z10 } from "zod";
1536
1781
  var schema8 = {
1537
- fulfillmentId: z9.string().min(1).describe("Fulfillment ID (required)"),
1538
- status: z9.enum(["packed", "shipped", "delivered", "failed"]).describe(
1782
+ fulfillmentId: z10.string().min(1).describe("Fulfillment ID (required)"),
1783
+ status: z10.enum(["packed", "shipped", "delivered", "failed"]).describe(
1539
1784
  "New fulfillment status (required). FSM: pending\u2192packed/shipped/failed, packed\u2192shipped/failed, shipped\u2192delivered/failed"
1540
1785
  ),
1541
- carrier: z9.string().optional().describe(
1786
+ carrier: z10.string().optional().describe(
1542
1787
  "Shipping carrier (optional, changeable only in pending/packed status)"
1543
1788
  ),
1544
- trackingNumber: z9.string().optional().describe(
1789
+ trackingNumber: z10.string().optional().describe(
1545
1790
  "Tracking number (optional, changeable only in pending/packed status)"
1546
1791
  )
1547
1792
  };
@@ -1635,21 +1880,54 @@ async function confirmPayment(params) {
1635
1880
  }
1636
1881
  }
1637
1882
 
1883
+ // src/tools/cancel-order.ts
1884
+ var CancelOrderToolSchema = CancelOrderSchema.extend({
1885
+ idempotencyKey: idempotencyKeySchema.optional().describe(
1886
+ "Optional X-Idempotency-Key forwarded to the Console cancel endpoint"
1887
+ )
1888
+ }).strict();
1889
+ var schema11 = CancelOrderToolSchema.shape;
1890
+ var metadata11 = {
1891
+ name: "cancel-order",
1892
+ description: "Cancel an eligible pre-fulfillment order through the provider-verified cancellation flow. Paid captured orders are refunded before the local order moves to canceled; shipped, delivered, active-return, and fulfilled orders are rejected.",
1893
+ annotations: {
1894
+ title: "Cancel order",
1895
+ readOnlyHint: false,
1896
+ destructiveHint: true,
1897
+ idempotentHint: true
1898
+ }
1899
+ };
1900
+ async function cancelOrder(params) {
1901
+ try {
1902
+ const parsed = CancelOrderToolSchema.parse(params);
1903
+ const client = getClient();
1904
+ const result = await client.commerce.orders.cancelOrder({
1905
+ orderNumber: parsed.orderNumber,
1906
+ reasonCode: parsed.reasonCode,
1907
+ reasonDetail: parsed.reasonDetail,
1908
+ idempotencyKey: parsed.idempotencyKey
1909
+ });
1910
+ return toolSuccess({ data: result });
1911
+ } catch (error) {
1912
+ return toolError(error);
1913
+ }
1914
+ }
1915
+
1638
1916
  // src/tools/create-return.ts
1639
- import { z as z10 } from "zod";
1640
- var schema11 = {
1641
- orderNumber: z10.string().min(1).describe("Order number (required)"),
1642
- reason: z10.enum(["change_of_mind", "defective", "wrong_delivery", "damaged", "other"]).optional().describe("Return reason (optional)"),
1643
- reasonDetail: z10.string().optional().describe("Detailed reason text (optional)"),
1644
- returnItems: z10.array(
1645
- z10.object({
1646
- orderItem: z10.string().min(1).describe("Order item ID"),
1647
- quantity: z10.number().int().positive().describe("Quantity to return")
1917
+ import { z as z11 } from "zod";
1918
+ var schema12 = {
1919
+ orderNumber: z11.string().min(1).describe("Order number (required)"),
1920
+ reason: z11.enum(["change_of_mind", "defective", "wrong_delivery", "damaged", "other"]).optional().describe("Return reason (optional)"),
1921
+ reasonDetail: z11.string().optional().describe("Detailed reason text (optional)"),
1922
+ returnItems: z11.array(
1923
+ z11.object({
1924
+ orderItem: z11.string().min(1).describe("Order item ID"),
1925
+ quantity: z11.number().int().positive().describe("Quantity to return")
1648
1926
  })
1649
1927
  ).describe("Array of products to return (required)"),
1650
- refundAmount: z10.number().nonnegative().describe("Refund amount (required, min 0)")
1928
+ refundAmount: z11.number().nonnegative().describe("Refund amount (required, min 0)")
1651
1929
  };
1652
- var metadata11 = {
1930
+ var metadata12 = {
1653
1931
  name: "create-return",
1654
1932
  description: "Create a return request for an order. Only works for delivered/confirmed orders. Updates order status to return_requested.",
1655
1933
  annotations: {
@@ -1682,16 +1960,16 @@ async function createReturn({
1682
1960
  }
1683
1961
 
1684
1962
  // src/tools/update-return.ts
1685
- import { z as z11 } from "zod";
1686
- var schema12 = {
1687
- returnId: z11.string().min(1).describe("Return ID (required)"),
1688
- status: z11.enum(["processing", "approved", "rejected", "completed"]).describe(
1689
- "New return status (required). Valid transitions: requested\u2192processing/rejected, processing\u2192approved/rejected, approved\u2192completed"
1963
+ import { z as z12 } from "zod";
1964
+ var schema13 = {
1965
+ returnId: z12.string().min(1).describe("Return ID (required)"),
1966
+ status: z12.enum(["processing", "approved", "rejected", "completed"]).describe(
1967
+ "New operator-driven return status (required). The schema keeps SDK status values for compatibility, but Console accepts only requested\u2192processing/rejected and processing\u2192approved/rejected here; completed is server-derived and must be set by return-with-refund."
1690
1968
  )
1691
1969
  };
1692
- var metadata12 = {
1970
+ var metadata13 = {
1693
1971
  name: "update-return",
1694
- description: "Update return status with FSM validation. Restores inventory on completion, reverts order status on rejection.",
1972
+ description: "Update operator-driven return status with FSM validation. Rejection can restore the order flow; completion and inventory restoration are handled by return-with-refund after provider-verified refund, while the MCP schema keeps SDK status values for compatibility.",
1695
1973
  annotations: {
1696
1974
  title: "Update return status",
1697
1975
  readOnlyHint: false,
@@ -1705,7 +1983,10 @@ async function updateReturn({
1705
1983
  }) {
1706
1984
  try {
1707
1985
  const client = getClient();
1708
- const result = await client.commerce.orders.updateReturn({ returnId, status });
1986
+ const result = await client.commerce.orders.updateReturn({
1987
+ returnId,
1988
+ status
1989
+ });
1709
1990
  return toolSuccess({ data: result });
1710
1991
  } catch (error) {
1711
1992
  return toolError(error);
@@ -1713,10 +1994,10 @@ async function updateReturn({
1713
1994
  }
1714
1995
 
1715
1996
  // src/tools/return-with-refund.ts
1716
- var schema13 = ReturnWithRefundSchema.shape;
1717
- var metadata13 = {
1997
+ var schema14 = ReturnWithRefundSchema.shape;
1998
+ var metadata14 = {
1718
1999
  name: "return-with-refund",
1719
- description: "Combined return + refund operation. Creates return, restores stock, cancels transaction, updates order status.",
2000
+ description: "Combined provider-verified return + refund operation. Creates a completed return, restores eligible stock, records the refund transaction, and advances the order to the returned state.",
1720
2001
  annotations: {
1721
2002
  title: "Return with refund",
1722
2003
  readOnlyHint: false,
@@ -1730,6 +2011,7 @@ async function returnWithRefund({
1730
2011
  reasonDetail,
1731
2012
  returnItems,
1732
2013
  refundAmount,
2014
+ returnShippingFee,
1733
2015
  pgPaymentId,
1734
2016
  paymentKey,
1735
2017
  refundReceiptUrl
@@ -1742,6 +2024,7 @@ async function returnWithRefund({
1742
2024
  reasonDetail,
1743
2025
  returnItems,
1744
2026
  refundAmount,
2027
+ returnShippingFee,
1745
2028
  pgPaymentId,
1746
2029
  paymentKey,
1747
2030
  refundReceiptUrl
@@ -1754,15 +2037,15 @@ async function returnWithRefund({
1754
2037
  }
1755
2038
 
1756
2039
  // src/tools/add-cart-item.ts
1757
- import { z as z12 } from "zod";
1758
- var schema14 = {
1759
- cartId: z12.string().min(1).describe("Cart ID (required)"),
1760
- product: z12.string().min(1).describe("Product ID (required)"),
1761
- variant: z12.string().min(1).describe("Product variant ID (required)"),
1762
- option: z12.string().min(1).describe("Product option ID (required)"),
1763
- quantity: z12.number().int().positive().describe("Quantity to add (required, positive integer)")
2040
+ import { z as z13 } from "zod";
2041
+ var schema15 = {
2042
+ cartId: z13.string().min(1).describe("Cart ID (required)"),
2043
+ product: z13.string().min(1).describe("Product ID (required)"),
2044
+ variant: z13.string().min(1).describe("Product variant ID (required)"),
2045
+ option: z13.string().min(1).describe("Product option ID (required)"),
2046
+ quantity: z13.number().int().positive().describe("Quantity to add (required, positive integer)")
1764
2047
  };
1765
- var metadata14 = {
2048
+ var metadata15 = {
1766
2049
  name: "add-cart-item",
1767
2050
  description: "Add a product to cart. Validates stock, merges quantity if item already exists, recalculates totals.",
1768
2051
  annotations: {
@@ -1795,12 +2078,12 @@ async function addCartItem({
1795
2078
  }
1796
2079
 
1797
2080
  // src/tools/update-cart-item.ts
1798
- import { z as z13 } from "zod";
1799
- var schema15 = {
1800
- cartItemId: z13.string().min(1).describe("Cart item ID (required)"),
1801
- quantity: z13.number().int().positive().describe("New quantity (required, positive integer)")
2081
+ import { z as z14 } from "zod";
2082
+ var schema16 = {
2083
+ cartItemId: z14.string().min(1).describe("Cart item ID (required)"),
2084
+ quantity: z14.number().int().positive().describe("New quantity (required, positive integer)")
1802
2085
  };
1803
- var metadata15 = {
2086
+ var metadata16 = {
1804
2087
  name: "update-cart-item",
1805
2088
  description: "Update cart item quantity. Validates stock availability, recalculates cart totals.",
1806
2089
  annotations: {
@@ -1824,11 +2107,11 @@ async function updateCartItem({
1824
2107
  }
1825
2108
 
1826
2109
  // src/tools/remove-cart-item.ts
1827
- import { z as z14 } from "zod";
1828
- var schema16 = {
1829
- cartItemId: z14.string().min(1).describe("Cart item ID to remove (required)")
2110
+ import { z as z15 } from "zod";
2111
+ var schema17 = {
2112
+ cartItemId: z15.string().min(1).describe("Cart item ID to remove (required)")
1830
2113
  };
1831
- var metadata16 = {
2114
+ var metadata17 = {
1832
2115
  name: "remove-cart-item",
1833
2116
  description: "Remove an item from cart. Recalculates cart totals after removal.",
1834
2117
  annotations: {
@@ -1851,12 +2134,12 @@ async function removeCartItem({
1851
2134
  }
1852
2135
 
1853
2136
  // src/tools/apply-discount.ts
1854
- import { z as z15 } from "zod";
1855
- var schema17 = {
1856
- cartId: z15.string().min(1).describe("Cart ID (required)"),
1857
- discountCode: z15.string().describe("Discount code to apply (required)")
2137
+ import { z as z16 } from "zod";
2138
+ var schema18 = {
2139
+ cartId: z16.string().min(1).describe("Cart ID (required)"),
2140
+ discountCode: z16.string().describe("Discount code to apply (required)")
1858
2141
  };
1859
- var metadata17 = {
2142
+ var metadata18 = {
1860
2143
  name: "apply-discount",
1861
2144
  description: "Apply a discount code to a cart. Validates the code, updates cart totals, and sets free shipping if applicable.",
1862
2145
  annotations: {
@@ -1880,11 +2163,11 @@ async function applyDiscount({
1880
2163
  }
1881
2164
 
1882
2165
  // src/tools/remove-discount.ts
1883
- import { z as z16 } from "zod";
1884
- var schema18 = {
1885
- cartId: z16.string().min(1).describe("Cart ID (required)")
2166
+ import { z as z17 } from "zod";
2167
+ var schema19 = {
2168
+ cartId: z17.string().min(1).describe("Cart ID (required)")
1886
2169
  };
1887
- var metadata18 = {
2170
+ var metadata19 = {
1888
2171
  name: "remove-discount",
1889
2172
  description: "Remove the applied discount code from a cart and recalculate totals.",
1890
2173
  annotations: {
@@ -1907,11 +2190,11 @@ async function removeDiscount({
1907
2190
  }
1908
2191
 
1909
2192
  // src/tools/clear-cart.ts
1910
- import { z as z17 } from "zod";
1911
- var schema19 = {
1912
- cartId: z17.string().min(1).describe("Cart ID (required)")
2193
+ import { z as z18 } from "zod";
2194
+ var schema20 = {
2195
+ cartId: z18.string().min(1).describe("Cart ID (required)")
1913
2196
  };
1914
- var metadata19 = {
2197
+ var metadata20 = {
1915
2198
  name: "clear-cart",
1916
2199
  description: "Remove all items from a cart, reset discount and amounts. Shipping fee is preserved.",
1917
2200
  annotations: {
@@ -1934,12 +2217,12 @@ async function clearCart({
1934
2217
  }
1935
2218
 
1936
2219
  // src/tools/validate-discount.ts
1937
- import { z as z18 } from "zod";
1938
- var schema20 = {
1939
- code: z18.string().describe("Discount code to validate (required)"),
1940
- orderAmount: z18.number().describe("Order amount for validation (required)")
2220
+ import { z as z19 } from "zod";
2221
+ var schema21 = {
2222
+ code: z19.string().describe("Discount code to validate (required)"),
2223
+ orderAmount: z19.number().describe("Order amount for validation (required)")
1941
2224
  };
1942
- var metadata20 = {
2225
+ var metadata21 = {
1943
2226
  name: "validate-discount",
1944
2227
  description: "Validate a discount code. Checks active status, date range, usage limits, minimum order amount, and calculates discount.",
1945
2228
  annotations: {
@@ -1966,13 +2249,13 @@ async function validateDiscount({
1966
2249
  }
1967
2250
 
1968
2251
  // src/tools/calculate-shipping.ts
1969
- import { z as z19 } from "zod";
1970
- var schema21 = {
1971
- shippingPolicyId: z19.string().optional().describe("Shipping policy ID (uses default policy if omitted)"),
1972
- orderAmount: z19.number().describe("Order amount for fee calculation (required)"),
1973
- postalCode: z19.string().optional().describe("Postal code for Jeju surcharge detection (63000-63644)")
2252
+ import { z as z20 } from "zod";
2253
+ var schema22 = {
2254
+ shippingPolicyId: z20.string().optional().describe("Shipping policy ID (uses default policy if omitted)"),
2255
+ orderAmount: z20.number().describe("Order amount for fee calculation (required)"),
2256
+ postalCode: z20.string().optional().describe("Postal code for Jeju surcharge detection (63000-63644)")
1974
2257
  };
1975
- var metadata21 = {
2258
+ var metadata22 = {
1976
2259
  name: "calculate-shipping",
1977
2260
  description: "Calculate shipping fee based on order amount and postal code. Supports free shipping threshold and Jeju surcharge.",
1978
2261
  annotations: {
@@ -2001,18 +2284,18 @@ async function calculateShipping({
2001
2284
  }
2002
2285
 
2003
2286
  // src/tools/stock-check.ts
2004
- import { z as z20 } from "zod";
2005
- var schema22 = {
2006
- items: z20.array(
2007
- z20.object({
2008
- variantId: z20.string().describe("Product variant ID"),
2009
- quantity: z20.number().int().positive().describe("Requested quantity")
2287
+ import { z as z21 } from "zod";
2288
+ var schema23 = {
2289
+ items: z21.array(
2290
+ z21.object({
2291
+ variantId: z21.string().describe("Product variant ID"),
2292
+ quantity: z21.number().int().positive().describe("Requested quantity")
2010
2293
  })
2011
2294
  ).describe(
2012
2295
  "Array of items to check stock for (required, max 100). Each: { variantId, quantity }"
2013
2296
  )
2014
2297
  };
2015
- var metadata22 = {
2298
+ var metadata23 = {
2016
2299
  name: "stock-check",
2017
2300
  description: "Batch check product option stock availability. Returns per-item availability and an allAvailable flag.",
2018
2301
  annotations: {
@@ -2035,14 +2318,14 @@ async function stockCheck({
2035
2318
  }
2036
2319
 
2037
2320
  // src/tools/product-detail.ts
2038
- import { z as z21 } from "zod";
2039
- var schema23 = {
2040
- slug: z21.string().optional().describe("Product slug (one of slug or id required)"),
2041
- id: z21.string().optional().describe("Product id (one of slug or id required)")
2321
+ import { z as z22 } from "zod";
2322
+ var schema24 = {
2323
+ slug: z22.string().optional().describe("Product slug (one of slug or id required)"),
2324
+ id: z22.string().optional().describe("Product id (one of slug or id required)")
2042
2325
  };
2043
- var metadata23 = {
2326
+ var metadata24 = {
2044
2327
  name: "product-detail",
2045
- 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.",
2328
+ 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 found:false with a reason if missing/unpublished/feature disabled. Permission/auth errors still throw.",
2046
2329
  annotations: {
2047
2330
  title: "Get product detail",
2048
2331
  readOnlyHint: true,
@@ -2068,68 +2351,26 @@ async function productDetail({
2068
2351
  }
2069
2352
 
2070
2353
  // src/tools/product-upsert.ts
2071
- import { z as z22 } from "zod";
2072
- var optionValueSchema = z22.object({
2073
- id: z22.string().optional().describe("Stable existing option-value ID for rename-safe updates"),
2074
- value: z22.string().describe("Display label (e.g. Black, S)"),
2075
- slug: z22.string().optional().describe(
2076
- "Optional compatibility value token. The server generates one from value on create when omitted; not canonical identity."
2354
+ var schema25 = {
2355
+ productId: ProductUpsertObjectSchema.shape.productId.describe(
2356
+ "Existing product id for graph-only updates. Prefer this for an existing product on edit after loading GET /api/products/:id/composer-draft."
2077
2357
  ),
2078
- swatchColor: z22.string().nullable().optional(),
2079
- thumbnail: z22.string().nullable().optional(),
2080
- images: z22.array(z22.string()).optional(),
2081
- metadata: z22.unknown().optional()
2082
- });
2083
- var optionSchema = z22.object({
2084
- id: z22.string().optional().describe("Stable existing option ID for rename-safe updates"),
2085
- title: z22.string().describe("Option name (e.g. Color, Size)"),
2086
- slug: z22.string().optional().describe(
2087
- "Optional compatibility option token. The server generates one from title on create when omitted; not canonical identity."
2088
- ),
2089
- values: z22.array(optionValueSchema).describe("Allowed option values")
2090
- });
2091
- var variantOptionValueSchema = z22.object({
2092
- valueSlug: z22.string().optional(),
2093
- valueId: z22.string().optional(),
2094
- value: z22.string().optional()
2095
- });
2096
- var variantSchema = z22.object({
2097
- id: z22.string().optional().describe("Existing variant ID for updates"),
2098
- optionValues: z22.union([
2099
- z22.record(z22.string(), z22.union([z22.string(), variantOptionValueSchema])),
2100
- z22.array(z22.string())
2101
- ]).optional().describe(
2102
- "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."
2358
+ graphRevision: ProductUpsertObjectSchema.shape.graphRevision.describe(
2359
+ "Required when updating a product that already has options or variants on the server. Load from GET /api/products/:id/composer-draft."
2103
2360
  ),
2104
- sku: z22.string().nullable().optional(),
2105
- title: z22.string().nullable().optional(),
2106
- price: z22.number().nonnegative().describe("Selling price (KRW, min 0)"),
2107
- compareAtPrice: z22.number().nonnegative().nullable().optional(),
2108
- stock: z22.number().int().nonnegative().optional(),
2109
- isUnlimited: z22.boolean().optional(),
2110
- weight: z22.number().nonnegative().nullable().optional(),
2111
- requiresShipping: z22.boolean().optional(),
2112
- barcode: z22.string().nullable().optional(),
2113
- externalId: z22.string().nullable().optional(),
2114
- isActive: z22.boolean().optional(),
2115
- thumbnail: z22.string().nullable().optional(),
2116
- images: z22.array(z22.string()).optional(),
2117
- metadata: z22.unknown().optional()
2118
- });
2119
- var schema24 = {
2120
- product: z22.record(z22.string(), z22.unknown()).describe(
2121
- "Product fields. Include `id` to update an existing product; omit for create (then `title` is required)."
2361
+ product: ProductUpsertObjectSchema.shape.product.describe(
2362
+ "Product document fields for create (`title` required). For existing products, save document fields through Payload/Admin and send productId for graph upsert."
2122
2363
  ),
2123
- options: z22.array(optionSchema).optional().describe(
2124
- "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)."
2364
+ options: ProductUpsertObjectSchema.shape.options.describe(
2365
+ "Full desired option graph. On edit, omitted options are deleted. Include stable option/value IDs for rename-safe updates."
2125
2366
  ),
2126
- variants: z22.array(variantSchema).optional().describe(
2127
- "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)."
2367
+ variants: ProductUpsertObjectSchema.shape.variants.describe(
2368
+ "Full desired variant graph. On edit, omitted variants are deleted or deactivated according to server references. Prefer stable option-value IDs."
2128
2369
  )
2129
2370
  };
2130
- var metadata24 = {
2371
+ var metadata25 = {
2131
2372
  name: "product-upsert",
2132
- 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.",
2373
+ description: "Create a product or update an existing product graph. Existing products should load composer-draft first, send productId plus graphRevision, and include the full desired options/variants graph.",
2133
2374
  annotations: {
2134
2375
  title: "Upsert product (atomic)",
2135
2376
  readOnlyHint: false,
@@ -2140,9 +2381,13 @@ var metadata24 = {
2140
2381
  };
2141
2382
  async function productUpsert(params) {
2142
2383
  try {
2384
+ const parsed = ProductUpsertSchema.safeParse(params);
2385
+ if (!parsed.success) {
2386
+ return toolError(parsed.error);
2387
+ }
2143
2388
  const client = getClient();
2144
2389
  const result = await client.commerce.product.upsert(
2145
- params
2390
+ parsed.data
2146
2391
  );
2147
2392
  return toolSuccess({ data: result });
2148
2393
  } catch (error) {
@@ -2164,8 +2409,8 @@ async function getCollectionSchema(collection) {
2164
2409
  }
2165
2410
 
2166
2411
  // src/tools/get-collection-schema.ts
2167
- var schema25 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2168
- var metadata25 = {
2412
+ var schema26 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2413
+ var metadata26 = {
2169
2414
  name: "get-collection-schema",
2170
2415
  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.",
2171
2416
  annotations: {
@@ -2216,8 +2461,8 @@ async function getTenantFeatureProgress(feature, includeEvidence = false) {
2216
2461
  }
2217
2462
 
2218
2463
  // src/tools/get-tenant-context.ts
2219
- var schema26 = tenantContextToolInputSchema.shape;
2220
- var metadata26 = {
2464
+ var schema27 = tenantContextToolInputSchema.shape;
2465
+ var metadata27 = {
2221
2466
  name: "get-tenant-context",
2222
2467
  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.",
2223
2468
  annotations: {
@@ -2294,8 +2539,8 @@ async function handler({
2294
2539
  }
2295
2540
 
2296
2541
  // src/tools/check-feature-progress.ts
2297
- var schema27 = tenantFeatureProgressInputSchema.shape;
2298
- var metadata27 = {
2542
+ var schema28 = tenantFeatureProgressInputSchema.shape;
2543
+ var metadata28 = {
2299
2544
  name: "check-feature-progress",
2300
2545
  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.",
2301
2546
  annotations: {
@@ -2341,12 +2586,12 @@ function invalidateFieldConfigCache() {
2341
2586
  }
2342
2587
 
2343
2588
  // src/tools/list-configurable-fields.ts
2344
- var schema28 = {
2589
+ var schema29 = {
2345
2590
  collection: z23.string().optional().describe(
2346
2591
  "Filter by collection slug (optional \u2014 returns all if omitted). Use this filter to reduce response size when you know which collection to check."
2347
2592
  )
2348
2593
  };
2349
- var metadata28 = {
2594
+ var metadata29 = {
2350
2595
  name: "list-configurable-fields",
2351
2596
  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.",
2352
2597
  annotations: {
@@ -2378,7 +2623,7 @@ async function listConfigurableFields(params) {
2378
2623
 
2379
2624
  // src/tools/update-field-config.ts
2380
2625
  import { z as z24 } from "zod";
2381
- var schema29 = {
2626
+ var schema30 = {
2382
2627
  collection: z24.string().min(1).describe("Collection slug (required)"),
2383
2628
  hiddenFields: z24.array(z24.string().min(1).max(200)).max(300).describe(
2384
2629
  "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."
@@ -2387,7 +2632,7 @@ var schema29 = {
2387
2632
  "Hide the entire collection from Admin Panel (optional). When true, individual hiddenFields are irrelevant."
2388
2633
  )
2389
2634
  };
2390
- var metadata29 = {
2635
+ var metadata30 = {
2391
2636
  name: "update-field-config",
2392
2637
  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.",
2393
2638
  annotations: {
@@ -2856,7 +3101,7 @@ function getRecipe(goal, runtime = "both") {
2856
3101
  }
2857
3102
 
2858
3103
  // src/tools/sdk-get-recipe.ts
2859
- var schema30 = {
3104
+ var schema31 = {
2860
3105
  goal: z25.enum([
2861
3106
  "fetch-list",
2862
3107
  "fetch-by-id",
@@ -2873,7 +3118,7 @@ var schema30 = {
2873
3118
  collection: z25.string().optional().describe("Specific collection name if applicable"),
2874
3119
  includeExample: z25.boolean().default(true).describe("Whether to include a full code example")
2875
3120
  };
2876
- var metadata30 = {
3121
+ var metadata31 = {
2877
3122
  name: "sdk-get-recipe",
2878
3123
  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.",
2879
3124
  annotations: {
@@ -3102,11 +3347,11 @@ function searchDocs(query, limit = 5) {
3102
3347
  }
3103
3348
 
3104
3349
  // src/tools/sdk-search-docs.ts
3105
- var schema31 = {
3350
+ var schema32 = {
3106
3351
  query: z26.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
3107
3352
  limit: z26.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
3108
3353
  };
3109
- var metadata31 = {
3354
+ var metadata32 = {
3110
3355
  name: "sdk-search-docs",
3111
3356
  description: "Search SDK documentation by keyword. Returns matching topics with summaries and resource links. Use when looking for specific SDK features or patterns.",
3112
3357
  annotations: {
@@ -3142,7 +3387,7 @@ function handler4({
3142
3387
 
3143
3388
  // src/tools/sdk-get-auth-setup.ts
3144
3389
  import { z as z27 } from "zod";
3145
- var schema32 = {
3390
+ var schema33 = {
3146
3391
  scenario: z27.enum([
3147
3392
  "browser-client",
3148
3393
  "server-client",
@@ -3152,7 +3397,7 @@ var schema32 = {
3152
3397
  "webhook-verification"
3153
3398
  ]).describe("Authentication scenario")
3154
3399
  };
3155
- var metadata32 = {
3400
+ var metadata33 = {
3156
3401
  name: "sdk-get-auth-setup",
3157
3402
  description: "Get the current authentication setup for a specific scenario. Returns env var names, code snippets, and security notes.",
3158
3403
  annotations: {
@@ -3316,12 +3561,12 @@ function handler5({
3316
3561
  // src/tools/sdk-get-collection-pattern.ts
3317
3562
  import { z as z28 } from "zod";
3318
3563
  import { COLLECTIONS, SERVER_COLLECTIONS as SERVER_COLLECTIONS4 } from "@01.software/sdk";
3319
- var schema33 = {
3564
+ var schema34 = {
3320
3565
  collection: z28.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3321
3566
  operation: z28.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3322
3567
  surface: z28.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3323
3568
  };
3324
- var metadata33 = {
3569
+ var metadata34 = {
3325
3570
  name: "sdk-get-collection-pattern",
3326
3571
  description: "Get the recommended CRUD pattern for a specific collection. Returns code examples for the chosen API surface and operation type.",
3327
3572
  annotations: {
@@ -3518,13 +3763,13 @@ function handler6({
3518
3763
 
3519
3764
  // src/prompts/sdk-usage-guide.ts
3520
3765
  import { z as z29 } from "zod";
3521
- var schema34 = {
3766
+ var schema35 = {
3522
3767
  goal: z29.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3523
3768
  runtime: z29.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3524
3769
  surface: z29.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3525
3770
  collection: z29.string().optional().describe("Specific collection if relevant")
3526
3771
  };
3527
- var metadata34 = {
3772
+ var metadata35 = {
3528
3773
  name: "sdk-usage-guide",
3529
3774
  title: "SDK Usage Guide",
3530
3775
  description: "Provides guidance on how to perform a specific task using the 01.software SDK",
@@ -3672,8 +3917,9 @@ You can perform the "${goal}" task by following the patterns above.
3672
3917
  ### Product detail page (slug-based)
3673
3918
 
3674
3919
  \`\`\`typescript
3675
- const product = await client.commerce.product.detail({ slug })
3676
- if (!product) return notFound()
3920
+ const result = await client.commerce.product.detail({ slug })
3921
+ if (!result.found) return notFound()
3922
+ const product = result.product
3677
3923
  // product: { product, variants, options, brand, categories, tags, images, videos, listing }
3678
3924
  \`\`\`
3679
3925
 
@@ -3697,12 +3943,12 @@ const { allAvailable } = await client.commerce.product.stockCheck({
3697
3943
  // src/prompts/collection-query-help.ts
3698
3944
  import { z as z30 } from "zod";
3699
3945
  import { COLLECTIONS as COLLECTIONS2, SERVER_COLLECTIONS as SERVER_COLLECTIONS5 } from "@01.software/sdk";
3700
- var schema35 = {
3946
+ var schema36 = {
3701
3947
  collection: z30.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3702
3948
  operation: z30.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3703
3949
  filters: z30.string().optional().describe("Filter conditions (JSON string, optional)")
3704
3950
  };
3705
- var metadata35 = {
3951
+ var metadata36 = {
3706
3952
  name: "collection-query-help",
3707
3953
  title: "Collection Query Help",
3708
3954
  description: "Provides guidance on how to write queries for a specific collection",
@@ -3800,15 +4046,16 @@ ${operation === "find" ? `- Use \`where\` option for filtering (Payload query sy
3800
4046
 
3801
4047
  // src/prompts/order-flow-guide.ts
3802
4048
  import { z as z31 } from "zod";
3803
- var schema36 = {
4049
+ var schema37 = {
3804
4050
  scenario: z31.enum([
3805
4051
  "simple-order",
3806
4052
  "cart-checkout",
3807
4053
  "return-refund",
4054
+ "order-cancel",
3808
4055
  "fulfillment-tracking"
3809
4056
  ]).describe("Order flow scenario")
3810
4057
  };
3811
- var metadata36 = {
4058
+ var metadata37 = {
3812
4059
  name: "order-flow-guide",
3813
4060
  title: "Order Flow Guide",
3814
4061
  description: "Provides step-by-step guidance for ecommerce order flows including creation, checkout, returns, and fulfillment.",
@@ -3909,12 +4156,13 @@ const order = await client.commerce.orders.checkout({
3909
4156
  1. **Create Return** \u2192 \`create-return\` tool
3910
4157
  - Order must be \`delivered\` or \`confirmed\`
3911
4158
  - Specify returnItems and refundAmount
3912
- - Return status: requested \u2192 processing \u2192 approved \u2192 completed
4159
+ - Operator transitions: requested \u2192 processing/rejected, processing \u2192 approved/rejected
4160
+ - \`completed\` is server-derived and requires \`return-with-refund\`
3913
4161
 
3914
4162
  ### Option B: Return + Refund (atomic, recommended)
3915
4163
  1. **Return with Refund** \u2192 \`return-with-refund\` tool
3916
4164
  - Handles return + stock restoration + transaction update in one call
3917
- - Return immediately completed (bypasses FSM)
4165
+ - Sets the return to \`completed\` after provider-verified refund
3918
4166
  - Requires pgPaymentId and paymentKey for provider-verified refund
3919
4167
 
3920
4168
  ### Key Points
@@ -3930,12 +4178,42 @@ await client.commerce.orders.returnWithRefund({
3930
4178
  orderNumber: 'ORD-240101-001',
3931
4179
  reason: 'defective',
3932
4180
  reasonDetail: 'Product arrived damaged',
3933
- returnItems: [{ orderItem: 'oi-id', quantity: 1 }],
4181
+ returnItems: [{ orderItem: 'oi-id', quantity: 1, restockingFee: 500 }],
3934
4182
  refundAmount: 29900,
4183
+ returnShippingFee: 1500,
3935
4184
  pgPaymentId: 'pay_xxx',
3936
4185
  paymentKey: 'payment_key_xxx'
3937
4186
  })
3938
4187
  \`\`\``,
4188
+ "order-cancel": `## Provider-Verified Order Cancellation
4189
+
4190
+ ### Flow
4191
+
4192
+ 1. **Cancel Order** -> \`cancel-order\` tool
4193
+ - Pending or failed unpaid orders cancel without a provider call
4194
+ - Paid captured orders use the server-stored provider payment key from the captured transaction
4195
+ - Paid captured orders are refunded through the provider-verified path before local status changes
4196
+ - Successful paid cancellation releases reservedStock and moves the order to \`canceled\`
4197
+ - Duplicate local success returns \`alreadyCanceled: true\`; do not issue a second refund
4198
+ - Provider-refunded local blockers return \`reconciliationRequired: true\` on retry
4199
+
4200
+ ### V1 Rejections
4201
+ - Orders with non-failed fulfillments are rejected
4202
+ - \`shipped\`, \`delivered\`, \`confirmed\`, and return-axis orders are rejected
4203
+ - Active returns are rejected; use \`return-with-refund\` after delivery
4204
+ - Partial line-item cancellation and no-refund paid cancellation are not supported in v1
4205
+
4206
+ ### Code Example
4207
+ \`\`\`typescript
4208
+ await client.commerce.orders.cancelOrder({
4209
+ orderNumber: 'ORD-240101-001',
4210
+ reasonCode: 'customer',
4211
+ reasonDetail: 'Customer emailed before shipment',
4212
+ idempotencyKey: 'cancel-ORD-240101-001'
4213
+ })
4214
+ \`\`\`
4215
+
4216
+ If \`reconciliationRequired\` is true, stop provider retries and hand off to an operator to reconcile fulfillment, stock, and accounting manually.`,
3939
4217
  "fulfillment-tracking": `## Fulfillment & Tracking
3940
4218
 
3941
4219
  ### Creating Fulfillment
@@ -3991,13 +4269,13 @@ ${SCENARIOS[scenario] || "Unknown scenario."}
3991
4269
  - \`checkout\`
3992
4270
  - \`create-fulfillment\`, \`update-fulfillment\`
3993
4271
  - \`create-return\`, \`update-return\`, \`return-with-refund\`
3994
- - \`confirm-payment\`, \`update-transaction\`
4272
+ - \`confirm-payment\`, \`cancel-order\`, \`update-transaction\`
3995
4273
  - \`validate-discount\`, \`calculate-shipping\``;
3996
4274
  }
3997
4275
 
3998
4276
  // src/prompts/feature-setup-guide.ts
3999
4277
  import { z as z32 } from "zod";
4000
- var schema37 = {
4278
+ var schema38 = {
4001
4279
  feature: z32.enum([
4002
4280
  "ecommerce",
4003
4281
  "customers",
@@ -4013,7 +4291,7 @@ var schema37 = {
4013
4291
  "community"
4014
4292
  ]).describe("Feature to get setup guide for")
4015
4293
  };
4016
- var metadata37 = {
4294
+ var metadata38 = {
4017
4295
  name: "feature-setup-guide",
4018
4296
  title: "Feature Setup Guide",
4019
4297
  description: "Setup checklist and remediation guide for a tenant feature. Load with check-feature-progress and get-tenant-context to diagnose setup gaps.",
@@ -4221,7 +4499,7 @@ ${FEATURES[feature] || "Unknown feature."}
4221
4499
  }
4222
4500
 
4223
4501
  // src/resources/(config)/app.ts
4224
- var metadata38 = {
4502
+ var metadata39 = {
4225
4503
  name: "app-config",
4226
4504
  title: "Application Config",
4227
4505
  description: "01.software SDK and MCP server configuration information"
@@ -4287,7 +4565,7 @@ Rate limits depend on your tenant plan:
4287
4565
 
4288
4566
  // src/resources/(collections)/schema.ts
4289
4567
  import { COLLECTIONS as COLLECTIONS3 } from "@01.software/sdk";
4290
- var metadata39 = {
4568
+ var metadata40 = {
4291
4569
  name: "collections-schema",
4292
4570
  title: "Collection Schema Info",
4293
4571
  description: "Available collections and their schema information"
@@ -4424,7 +4702,7 @@ Total available collections: ${COLLECTIONS3.length}`;
4424
4702
  }
4425
4703
 
4426
4704
  // src/resources/(docs)/getting-started.ts
4427
- var metadata40 = {
4705
+ var metadata41 = {
4428
4706
  name: "docs-getting-started",
4429
4707
  title: "Getting Started",
4430
4708
  description: "01.software SDK getting started guide"
@@ -4485,7 +4763,7 @@ const result = await client.collections.from('products').find({
4485
4763
  }
4486
4764
 
4487
4765
  // src/resources/(docs)/guides.ts
4488
- var metadata41 = {
4766
+ var metadata42 = {
4489
4767
  name: "docs-guides",
4490
4768
  title: "Guides",
4491
4769
  description: "01.software SDK usage guides"
@@ -4698,7 +4976,7 @@ For more implementation guidance, see the [SDK Guide](/developers/sdk).`;
4698
4976
  }
4699
4977
 
4700
4978
  // src/resources/(docs)/api.ts
4701
- var metadata42 = {
4979
+ var metadata43 = {
4702
4980
  name: "docs-api",
4703
4981
  title: "API Reference",
4704
4982
  description: "01.software SDK API reference documentation"
@@ -4981,7 +5259,7 @@ For more details, see the [API documentation](/developers/api).`;
4981
5259
  }
4982
5260
 
4983
5261
  // src/resources/(docs)/query-builder.ts
4984
- var metadata43 = {
5262
+ var metadata44 = {
4985
5263
  name: "docs-query-builder",
4986
5264
  title: "Query Builder",
4987
5265
  description: "01.software SDK Query Builder API reference (client.collections.from)"
@@ -5175,7 +5453,7 @@ console.log(result.hasNextPage) // true
5175
5453
  }
5176
5454
 
5177
5455
  // src/resources/(docs)/react-query.ts
5178
- var metadata44 = {
5456
+ var metadata45 = {
5179
5457
  name: "docs-react-query",
5180
5458
  title: "React Query Hooks",
5181
5459
  description: "01.software SDK React Query hooks reference (@01.software/sdk/query)"
@@ -5407,7 +5685,7 @@ export function ProductList() {
5407
5685
  }
5408
5686
 
5409
5687
  // src/resources/(docs)/server-api.ts
5410
- var metadata45 = {
5688
+ var metadata46 = {
5411
5689
  name: "docs-server-api",
5412
5690
  title: "Server-side API",
5413
5691
  description: "01.software SDK server-side API reference (client.commerce) for orders, fulfillments, returns, carts, and validation"
@@ -5538,12 +5816,12 @@ const ret = await client.commerce.orders.createReturn({
5538
5816
  \`\`\`
5539
5817
 
5540
5818
  ### updateReturn()
5541
- Update return status.
5819
+ Update operator-driven return status. \`completed\` is server-derived and must go through \`returnWithRefund()\`.
5542
5820
 
5543
5821
  \`\`\`typescript
5544
5822
  const ret = await client.commerce.orders.updateReturn({
5545
5823
  returnId: 'return-id',
5546
- status: 'processing', // processing | approved | completed | rejected
5824
+ status: 'processing', // processing | approved | rejected
5547
5825
  })
5548
5826
  \`\`\`
5549
5827
 
@@ -5556,9 +5834,10 @@ const result = await client.commerce.orders.returnWithRefund({
5556
5834
  reason?: 'defective',
5557
5835
  reasonDetail?: 'Screen cracked on arrival',
5558
5836
  returnItems: [
5559
- { orderItem: 'order-item-id', quantity: 1 }
5837
+ { orderItem: 'order-item-id', quantity: 1, restockingFee?: 500 }
5560
5838
  ],
5561
5839
  refundAmount: 29900,
5840
+ returnShippingFee?: 1500,
5562
5841
  pgPaymentId: 'provider-payment-id', // required
5563
5842
  paymentKey: 'provider-payment-key', // required for provider refund
5564
5843
  refundReceiptUrl?: 'https://...',
@@ -5690,7 +5969,7 @@ const result = await client.commerce.shipping.calculate({
5690
5969
  }
5691
5970
 
5692
5971
  // src/resources/(docs)/customer-auth.ts
5693
- var metadata46 = {
5972
+ var metadata47 = {
5694
5973
  name: "docs-customer-auth",
5695
5974
  title: "Customer Auth API",
5696
5975
  description: "01.software SDK Customer Auth API reference (client.customer)"
@@ -5868,7 +6147,7 @@ async function loadProfile() {
5868
6147
  }
5869
6148
 
5870
6149
  // src/resources/(docs)/browser-vs-server.ts
5871
- var metadata47 = {
6150
+ var metadata48 = {
5872
6151
  name: "docs-browser-vs-server",
5873
6152
  title: "Client vs ServerClient",
5874
6153
  description: "When to use Client (createClient) vs ServerClient (createServerClient) in the 01.software SDK"
@@ -6034,7 +6313,7 @@ export function ProductList() {
6034
6313
  }
6035
6314
 
6036
6315
  // src/resources/(docs)/file-upload.ts
6037
- var metadata48 = {
6316
+ var metadata49 = {
6038
6317
  name: "docs-file-upload",
6039
6318
  title: "File Upload",
6040
6319
  description: "01.software SDK file upload patterns using the images collection"
@@ -6185,7 +6464,7 @@ The platform stores files in Cloudflare R2 and serves via CDN (\`cdn.01.software
6185
6464
  }
6186
6465
 
6187
6466
  // src/resources/(docs)/webhook.ts
6188
- var metadata49 = {
6467
+ var metadata50 = {
6189
6468
  name: "docs-webhook",
6190
6469
  title: "Webhooks",
6191
6470
  description: "01.software SDK webhook verification and event handling"
@@ -6193,11 +6472,11 @@ var metadata49 = {
6193
6472
  function handler18() {
6194
6473
  return `# Webhooks
6195
6474
 
6196
- The platform dispatches HMAC-SHA256 signed webhook events to your registered URLs. Tenant developers own routing inside their webhook handler.
6475
+ The platform dispatches HMAC-SHA256 signed webhook events to registered URLs. Tenant developers own routing inside their webhook handler.
6197
6476
 
6198
6477
  ## Webhook Handling
6199
6478
 
6200
- Use the SDK \`handleWebhook\` helper to verify signatures. For customer auth events, use \`createCustomerAuthWebhookHandler\` to wire delivery behavior in your app.
6479
+ Use the SDK \`handleWebhook\` helper to verify signatures. For customer auth events, use \`createCustomerAuthWebhookHandler\`; for semantic events, use SDK guards before reading event-specific fields.
6201
6480
 
6202
6481
  \`\`\`typescript
6203
6482
  import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
@@ -6250,28 +6529,119 @@ export async function POST(request: Request) {
6250
6529
  }
6251
6530
  \`\`\`
6252
6531
 
6532
+ ## Commerce Notification Handler Example
6533
+
6534
+ \`\`\`typescript
6535
+ import {
6536
+ handleWebhook,
6537
+ isCommerceNotificationWebhookEvent,
6538
+ } from '@01.software/sdk/webhook'
6539
+
6540
+ function getWebhookSecret(): string {
6541
+ const secret = process.env.WEBHOOK_SECRET
6542
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6543
+ return secret
6544
+ }
6545
+
6546
+ export async function POST(request: Request) {
6547
+ return handleWebhook(request, async (event) => {
6548
+ if (!isCommerceNotificationWebhookEvent(event)) return
6549
+
6550
+ const idempotencyKey = \`\${event.notification.intentId}:\${event.notification.dedupeKey}\`
6551
+ const processed = await processOnce(idempotencyKey, async () => {
6552
+ if (event.notification.event === 'orderPaid') {
6553
+ const orderId = event.notification.orderId ?? event.data.orderId
6554
+ if (orderId) await updateOrderWorkflow(orderId)
6555
+ }
6556
+
6557
+ if (event.notification.event === 'fulfillmentShipped') {
6558
+ const fulfillmentId =
6559
+ event.notification.fulfillmentId ?? event.data.fulfillmentId
6560
+ if (fulfillmentId) await updateFulfillmentWorkflow(fulfillmentId)
6561
+ }
6562
+ })
6563
+
6564
+ if (!processed) return
6565
+ }, {
6566
+ secret: getWebhookSecret(),
6567
+ })
6568
+ }
6569
+ \`\`\`
6570
+
6571
+ Back \`processOnce()\` with durable storage such as a database unique key or queue idempotency store; do not use process-local memory for webhook idempotency.
6572
+
6573
+ ## Headless Commerce Email Workers
6574
+
6575
+ For tenant-owned transactional email, use \`commerce.notification\` as the trigger and build a signed worker with \`createCommerceEmailWebhookHandler()\`. 01.software owns event timing, delivery retries, signing, and idempotency signals; the tenant worker owns template rendering, provider credentials, extra order/customer fetches via \`createServerClient\`, and final delivery through a tenant provider such as Resend.
6576
+
6577
+ Use \`getCommerceNotificationIdempotencyKey(event)\` or the \`idempotencyKey\` passed by \`createCommerceEmailWebhookHandler()\`, then guard provider sends with durable \`processOnce(idempotencyKey, ...)\` storage. The webhook payload is PII-light and is not enough for recipient data, so fetch recipient/template context with server SDK credentials. In the v1 headless path, do not store tenant ESP secrets in 01.software and do not ask 01.software to send directly through the tenant provider.
6578
+
6253
6579
  ## Webhook Payload Structure
6254
6580
 
6255
6581
  All webhook events share this envelope:
6256
6582
 
6257
6583
  \`\`\`typescript
6258
6584
  {
6259
- collection: string, // e.g. 'customers'
6260
- operation: string, // e.g. 'password-reset'
6261
- data: object, // event-specific payload
6585
+ collection: string,
6586
+ operation: string,
6587
+ data: object,
6588
+ eventType?: string,
6589
+ change?: object,
6590
+ notification?: object,
6591
+ timestamp?: string,
6592
+ deliveryId?: string,
6262
6593
  }
6263
6594
  \`\`\`
6264
6595
 
6265
6596
  ## Event Types
6266
6597
 
6598
+ ### Commerce Notification
6599
+
6600
+ V1 commerce notification webhooks use \`eventType: "commerce.notification"\` and \`operation: "notification"\`. The public SDK exports \`COMMERCE_NOTIFICATION_EVENT_TYPE\`, \`COMMERCE_NOTIFICATION_OPERATION\`, commerce notification types, and \`isCommerceNotificationWebhookEvent()\` from \`@01.software/sdk/webhook\`.
6601
+
6602
+ Canonical example (public operational identifiers only; no PII, payment/provider fields, metadata, tracking number, or tracking URL):
6603
+
6604
+ \`\`\`json
6605
+ {
6606
+ "eventType": "commerce.notification",
6607
+ "collection": "orders",
6608
+ "operation": "notification",
6609
+ "data": {
6610
+ "orderId": "order_123",
6611
+ "orderNumber": "ORD-1001",
6612
+ "status": "paid",
6613
+ "totalAmount": 5000,
6614
+ "currency": "KRW"
6615
+ },
6616
+ "notification": {
6617
+ "event": "orderPaid",
6618
+ "intentId": "intent_123",
6619
+ "dedupeKey": "orderPaid:order_123",
6620
+ "orderId": "order_123"
6621
+ },
6622
+ "timestamp": "2026-05-29T00:00:00.000Z",
6623
+ "deliveryId": "delivery_attempt_123"
6624
+ }
6625
+ \`\`\`
6626
+
6627
+ Use \`notification.intentId\` plus \`notification.dedupeKey\` for semantic idempotency. \`deliveryId\` is per delivery attempt / observability and may not be stable across semantic retries.
6628
+ Some normalized deliveries may include \`data.source\` or \`change\` metadata, but handlers should treat those fields as optional. Route from \`notification.orderId\`, \`notification.fulfillmentId\`, \`notification.returnId\`, or the matching typed \`data.*Id\` field.
6629
+
6630
+ V1 source subscription semantics:
6631
+
6632
+ - \`orderPaid\` and \`orderDelivered\` are delivered through \`orders\`-scoped endpoints.
6633
+ - \`fulfillmentShipped\` is delivered through \`fulfillments\`-scoped endpoints.
6634
+ - \`returnRequested\` and \`returnCompleted\` are delivered through \`returns\`-scoped endpoints.
6635
+ - Empty, unscoped, and all-collection endpoints do not receive v1 semantic commerce notifications.
6636
+
6267
6637
  ### Collection Order Changed
6268
6638
 
6269
6639
  Admin Panel manual ordering is delivered as a semantic collection update:
6270
6640
 
6271
6641
  - \`operation\` remains \`"update"\` for compatibility.
6272
6642
  - \`eventType\` is \`"collection.orderChanged"\`.
6273
- - \`change.scope\` identifies collection-level ordering versus join ordering.
6274
6643
  - SDK handlers should use \`isOrderChangedWebhookEvent()\` from \`@01.software/sdk/webhook\`.
6644
+ - \`change.scope\` identifies collection-level ordering versus join ordering.
6275
6645
  - Route on public semantics such as \`change.scope.collection\`, \`change.scope.field\`, and \`change.moved.id\`.
6276
6646
  - Do not branch on hidden Payload order fields or private backing collections; diagnostic fields may still be present.
6277
6647
  - Customer group member ordering is currently unsupported and does not emit a semantic order-change webhook.
@@ -6321,8 +6691,8 @@ Dispatched when a customer calls \`client.customer.forgotPassword(email)\`.
6321
6691
  customerId: string,
6322
6692
  email: string,
6323
6693
  name: string,
6324
- resetPasswordToken: string, // raw token to include in reset link
6325
- resetPasswordExpiresAt: string, // ISO 8601 expiry (1 hour from dispatch)
6694
+ resetPasswordToken: string,
6695
+ resetPasswordExpiresAt: string,
6326
6696
  }
6327
6697
  }
6328
6698
  \`\`\`
@@ -6337,11 +6707,13 @@ async function sendPasswordResetEmail(data: {
6337
6707
  resetPasswordToken: string
6338
6708
  resetPasswordExpiresAt: string
6339
6709
  }) {
6340
- const resetUrl = \`https://yourstore.com/reset-password?token=\${data.resetPasswordToken}\`
6710
+ const resetUrl = new URL('https://yourstore.com/reset-password')
6711
+ resetUrl.searchParams.set('token', data.resetPasswordToken)
6712
+
6341
6713
  await emailService.send({
6342
6714
  to: data.email,
6343
6715
  subject: 'Reset your password',
6344
- body: \`Reset link (expires \${data.resetPasswordExpiresAt}): \${resetUrl}\`,
6716
+ body: \`Reset link (expires \${data.resetPasswordExpiresAt}): \${resetUrl.toString()}\`,
6345
6717
  })
6346
6718
  }
6347
6719
  \`\`\`
@@ -6352,11 +6724,11 @@ Failed webhook deliveries are queued with automatic retries. Ensure your handler
6352
6724
 
6353
6725
  ## Webhook Configuration
6354
6726
 
6355
- Configure webhook URLs in the 01.software console under Tenant Settings > Webhooks. Multiple URLs can be registered; all receive every event.`;
6727
+ Configure webhook URLs in the 01.software console under Tenant Settings > Webhooks. Multiple URLs can be registered; scoped endpoints receive events for their configured source collection.`;
6356
6728
  }
6357
6729
 
6358
6730
  // src/resources/(docs)/product-detail.ts
6359
- var metadata50 = {
6731
+ var metadata51 = {
6360
6732
  name: "docs-product-detail",
6361
6733
  title: "Product Detail Helper",
6362
6734
  description: "01.software SDK commerce.product.detail helper guide"
@@ -6380,8 +6752,8 @@ const client = createClient({
6380
6752
  })
6381
6753
 
6382
6754
  const detail = await client.commerce.product.detail({ slug: 'my-product' })
6383
- if (!detail) return notFound()
6384
- const selection = resolveProductSelection(detail, {
6755
+ if (!detail.found) return notFound()
6756
+ const selection = resolveProductSelection(detail.product, {
6385
6757
  search: '?opt.option-color=color-black',
6386
6758
  })
6387
6759
  // selection.selectedVariant, selection.price, selection.stock, selection.media
@@ -6432,18 +6804,20 @@ export default async function ProductPage({ params }: { params: { slug: string }
6432
6804
  publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
6433
6805
  })
6434
6806
  const detail = await client.commerce.product.detail({ slug: params.slug })
6435
- if (!detail) return notFound()
6436
- return <ProductView detail={detail} />
6807
+ if (!detail.found) return notFound()
6808
+ return <ProductView detail={detail.product} />
6437
6809
  }
6438
6810
  \`\`\`
6439
6811
 
6440
- ## The \`null\` return contract
6812
+ ## The \`ProductDetailResult\` return contract
6813
+
6814
+ The endpoint returns 404 for \`not_found\`, \`not_published\`, or \`feature_disabled\`. The SDK maps those product-detail 404s to \`{ found: false, reason }\` so consumer UIs can render a standard 404, preview CTA, or feature-gating UI. Permission/auth errors, including 403 tenant mismatches, still throw typed SDK errors.
6441
6815
 
6442
- 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.
6816
+ Successful product payloads expose inventory rollups without sentinel values: \`product.totalInventory\` is the tracked stock sum across non-unlimited variants, \`null\` when no variants are tracked, and \`product.hasUnlimitedVariant\` signals whether any variant is unlimited.
6443
6817
 
6444
6818
  ## Backend correlation
6445
6819
 
6446
- Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records the exact 404 code alongside the request ID.`;
6820
+ Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records the exact 404 reason alongside the request ID.`;
6447
6821
  }
6448
6822
 
6449
6823
  // src/server.ts
@@ -6464,7 +6838,7 @@ function runtimeAnnotationsFor(meta) {
6464
6838
  openWorldHint: policy.annotationPolicy.openWorld
6465
6839
  };
6466
6840
  }
6467
- function registerTool(server, schema38, meta, handler20) {
6841
+ function registerTool(server, schema39, meta, handler20) {
6468
6842
  let registered = REGISTERED_TOOLS_BY_SERVER.get(server);
6469
6843
  if (!registered) {
6470
6844
  registered = /* @__PURE__ */ new Set();
@@ -6475,7 +6849,7 @@ function registerTool(server, schema38, meta, handler20) {
6475
6849
  meta.name,
6476
6850
  {
6477
6851
  description: meta.description,
6478
- inputSchema: schema38,
6852
+ inputSchema: schema39,
6479
6853
  annotations: runtimeAnnotationsFor(meta)
6480
6854
  },
6481
6855
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -6525,13 +6899,13 @@ function registerTool(server, schema38, meta, handler20) {
6525
6899
  }
6526
6900
  );
6527
6901
  }
6528
- function registerPrompt(server, schema38, meta, handler20) {
6902
+ function registerPrompt(server, schema39, meta, handler20) {
6529
6903
  server.registerPrompt(
6530
6904
  meta.name,
6531
6905
  {
6532
6906
  title: meta.title,
6533
6907
  description: meta.description,
6534
- argsSchema: schema38
6908
+ argsSchema: schema39
6535
6909
  },
6536
6910
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6537
6911
  (params) => ({
@@ -6605,230 +6979,231 @@ function createServer(options = {}) {
6605
6979
  metadata10,
6606
6980
  confirmPayment
6607
6981
  );
6608
- registerTool(
6609
- server,
6610
- schema11,
6611
- metadata11,
6612
- createReturn
6613
- );
6982
+ registerTool(server, schema11, metadata11, cancelOrder);
6614
6983
  registerTool(
6615
6984
  server,
6616
6985
  schema12,
6617
6986
  metadata12,
6618
- updateReturn
6987
+ createReturn
6619
6988
  );
6620
6989
  registerTool(
6621
6990
  server,
6622
6991
  schema13,
6623
6992
  metadata13,
6624
- returnWithRefund
6993
+ updateReturn
6625
6994
  );
6626
- registerTool(server, schema14, metadata14, addCartItem);
6627
6995
  registerTool(
6628
6996
  server,
6629
- schema15,
6630
- metadata15,
6631
- updateCartItem
6997
+ schema14,
6998
+ metadata14,
6999
+ returnWithRefund
6632
7000
  );
7001
+ registerTool(server, schema15, metadata15, addCartItem);
6633
7002
  registerTool(
6634
7003
  server,
6635
7004
  schema16,
6636
7005
  metadata16,
6637
- removeCartItem
7006
+ updateCartItem
6638
7007
  );
6639
7008
  registerTool(
6640
7009
  server,
6641
7010
  schema17,
6642
7011
  metadata17,
6643
- applyDiscount
7012
+ removeCartItem
6644
7013
  );
6645
7014
  registerTool(
6646
7015
  server,
6647
7016
  schema18,
6648
7017
  metadata18,
6649
- removeDiscount
7018
+ applyDiscount
6650
7019
  );
6651
- registerTool(server, schema19, metadata19, clearCart);
6652
7020
  registerTool(
6653
7021
  server,
6654
- schema20,
6655
- metadata20,
6656
- validateDiscount
7022
+ schema19,
7023
+ metadata19,
7024
+ removeDiscount
6657
7025
  );
7026
+ registerTool(server, schema20, metadata20, clearCart);
6658
7027
  registerTool(
6659
7028
  server,
6660
7029
  schema21,
6661
7030
  metadata21,
6662
- calculateShipping
7031
+ validateDiscount
6663
7032
  );
6664
- registerTool(server, schema22, metadata22, stockCheck);
6665
7033
  registerTool(
6666
7034
  server,
6667
- schema23,
6668
- metadata23,
6669
- productDetail
7035
+ schema22,
7036
+ metadata22,
7037
+ calculateShipping
6670
7038
  );
7039
+ registerTool(server, schema23, metadata23, stockCheck);
6671
7040
  registerTool(
6672
7041
  server,
6673
7042
  schema24,
6674
7043
  metadata24,
7044
+ productDetail
7045
+ );
7046
+ registerTool(
7047
+ server,
7048
+ schema25,
7049
+ metadata25,
6675
7050
  productUpsert
6676
7051
  );
6677
7052
  }
6678
- registerTool(
6679
- server,
6680
- schema25,
6681
- metadata25,
6682
- getCollectionSchemaTool
6683
- );
6684
7053
  registerTool(
6685
7054
  server,
6686
7055
  schema26,
6687
7056
  metadata26,
6688
- handler
7057
+ getCollectionSchemaTool
6689
7058
  );
6690
7059
  registerTool(
6691
7060
  server,
6692
7061
  schema27,
6693
7062
  metadata27,
6694
- handler2
7063
+ handler
6695
7064
  );
6696
7065
  registerTool(
6697
7066
  server,
6698
7067
  schema28,
6699
7068
  metadata28,
6700
- listConfigurableFields
7069
+ handler2
6701
7070
  );
6702
7071
  registerTool(
6703
7072
  server,
6704
7073
  schema29,
6705
7074
  metadata29,
6706
- updateFieldConfig
7075
+ listConfigurableFields
6707
7076
  );
6708
7077
  registerTool(
6709
7078
  server,
6710
7079
  schema30,
6711
7080
  metadata30,
6712
- handler3
7081
+ updateFieldConfig
6713
7082
  );
6714
7083
  registerTool(
6715
7084
  server,
6716
7085
  schema31,
6717
7086
  metadata31,
6718
- handler4
7087
+ handler3
6719
7088
  );
6720
7089
  registerTool(
6721
7090
  server,
6722
7091
  schema32,
6723
7092
  metadata32,
6724
- handler5
7093
+ handler4
6725
7094
  );
6726
7095
  registerTool(
6727
7096
  server,
6728
7097
  schema33,
6729
7098
  metadata33,
6730
- handler6
7099
+ handler5
6731
7100
  );
6732
- registerPrompt(
7101
+ registerTool(
6733
7102
  server,
6734
7103
  schema34,
6735
7104
  metadata34,
6736
- sdkUsageGuide
7105
+ handler6
6737
7106
  );
6738
7107
  registerPrompt(
6739
7108
  server,
6740
7109
  schema35,
6741
7110
  metadata35,
6742
- collectionQueryHelp
7111
+ sdkUsageGuide
6743
7112
  );
6744
7113
  registerPrompt(
6745
7114
  server,
6746
7115
  schema36,
6747
7116
  metadata36,
6748
- orderFlowGuide
7117
+ collectionQueryHelp
6749
7118
  );
6750
7119
  registerPrompt(
6751
7120
  server,
6752
7121
  schema37,
6753
7122
  metadata37,
7123
+ orderFlowGuide
7124
+ );
7125
+ registerPrompt(
7126
+ server,
7127
+ schema38,
7128
+ metadata38,
6754
7129
  featureSetupGuide
6755
7130
  );
6756
7131
  registerStaticResource(
6757
7132
  server,
6758
7133
  mcpResourceUri("app-config"),
6759
- metadata38,
7134
+ metadata39,
6760
7135
  handler7
6761
7136
  );
6762
7137
  registerStaticResource(
6763
7138
  server,
6764
7139
  mcpResourceUri("collections-schema"),
6765
- metadata39,
7140
+ metadata40,
6766
7141
  handler8
6767
7142
  );
6768
7143
  registerStaticResource(
6769
7144
  server,
6770
7145
  mcpResourceUri("docs-getting-started"),
6771
- metadata40,
7146
+ metadata41,
6772
7147
  handler9
6773
7148
  );
6774
7149
  registerStaticResource(
6775
7150
  server,
6776
7151
  mcpResourceUri("docs-guides"),
6777
- metadata41,
7152
+ metadata42,
6778
7153
  handler10
6779
7154
  );
6780
7155
  registerStaticResource(
6781
7156
  server,
6782
7157
  mcpResourceUri("docs-api"),
6783
- metadata42,
7158
+ metadata43,
6784
7159
  handler11
6785
7160
  );
6786
7161
  registerStaticResource(
6787
7162
  server,
6788
7163
  mcpResourceUri("docs-query-builder"),
6789
- metadata43,
7164
+ metadata44,
6790
7165
  handler12
6791
7166
  );
6792
7167
  registerStaticResource(
6793
7168
  server,
6794
7169
  mcpResourceUri("docs-react-query"),
6795
- metadata44,
7170
+ metadata45,
6796
7171
  handler13
6797
7172
  );
6798
7173
  registerStaticResource(
6799
7174
  server,
6800
7175
  mcpResourceUri("docs-server-api"),
6801
- metadata45,
7176
+ metadata46,
6802
7177
  handler14
6803
7178
  );
6804
7179
  registerStaticResource(
6805
7180
  server,
6806
7181
  mcpResourceUri("docs-customer-auth"),
6807
- metadata46,
7182
+ metadata47,
6808
7183
  handler15
6809
7184
  );
6810
7185
  registerStaticResource(
6811
7186
  server,
6812
7187
  mcpResourceUri("docs-browser-vs-server"),
6813
- metadata47,
7188
+ metadata48,
6814
7189
  handler16
6815
7190
  );
6816
7191
  registerStaticResource(
6817
7192
  server,
6818
7193
  mcpResourceUri("docs-file-upload"),
6819
- metadata48,
7194
+ metadata49,
6820
7195
  handler17
6821
7196
  );
6822
7197
  registerStaticResource(
6823
7198
  server,
6824
7199
  mcpResourceUri("docs-webhook"),
6825
- metadata49,
7200
+ metadata50,
6826
7201
  handler18
6827
7202
  );
6828
7203
  registerStaticResource(
6829
7204
  server,
6830
7205
  mcpResourceUri("docs-product-detail"),
6831
- metadata50,
7206
+ metadata51,
6832
7207
  handler19
6833
7208
  );
6834
7209
  return server;
@@ -6849,4 +7224,4 @@ export {
6849
7224
  flushMcpTelemetrySummary,
6850
7225
  createServer
6851
7226
  };
6852
- //# sourceMappingURL=chunk-2ULP5WQH.js.map
7227
+ //# sourceMappingURL=chunk-VEFJZ6VK.js.map