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