@lonca/trendyol 0.3.0 → 0.4.0

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.
package/dist/index.d.cts CHANGED
@@ -391,6 +391,145 @@ interface PackageHistoryEntry {
391
391
  createdAt?: string;
392
392
  raw: Record<string, unknown>;
393
393
  }
394
+ /**
395
+ * A package line update tuple used by `updatePackageStatus` and
396
+ * `cancelPackageItem`. `lineId` is the per-line ID from `ShipmentPackage.lines[].lineId`.
397
+ */
398
+ interface PackageLineUpdate {
399
+ lineId: number;
400
+ quantity: number;
401
+ }
402
+ /**
403
+ * Input for `orders.updatePackageStatus`. Trendyol restricts the seller-side
404
+ * status push to `Picking` (mark as being prepared) and `Invoiced`
405
+ * (invoice issued); other transitions are driven by Trendyol / the cargo
406
+ * provider. `lines` is optional and only used when transitioning subset of
407
+ * line items.
408
+ */
409
+ interface UpdatePackageStatusInput {
410
+ status: 'Picking' | 'Invoiced';
411
+ lines?: PackageLineUpdate[];
412
+ }
413
+ /**
414
+ * Input for `orders.cancelPackageItem` — Trendyol's "supply failure" notification.
415
+ * Marks specific line items as un-suppliable. `reasonId` is a numeric code
416
+ * Trendyol publishes separately (e.g. `577` = "tedarik edemiyorum"); consult
417
+ * Trendyol's seller panel or the "Tedarik Edememe" docs for current values.
418
+ */
419
+ interface CancelPackageItemInput {
420
+ lines: PackageLineUpdate[];
421
+ reasonId: number;
422
+ }
423
+ /**
424
+ * One row from `orders.getCargoInvoiceItems` — a cargo invoice line item
425
+ * that ties a parcel ID to its cargo fee. Useful for reconciling Trendyol's
426
+ * cargo deductions against your shipped packages.
427
+ */
428
+ interface CargoInvoiceItem {
429
+ /** e.g. "Gönderi Kargo Bedeli" (outbound) or "İade Kargo Bedeli" (return). */
430
+ shipmentPackageType?: string;
431
+ /** Cargo parcel unique ID. */
432
+ parcelUniqueId?: number | string;
433
+ orderNumber?: string;
434
+ /** Fee charged in this row. */
435
+ amount?: number;
436
+ /** Desi value used to compute the fee. */
437
+ desi?: number;
438
+ /** Untouched raw row. */
439
+ raw: Record<string, unknown>;
440
+ }
441
+ /**
442
+ * Filter params for `orders.listStream` — the streaming alternative to
443
+ * `orders.list`. Uses Trendyol's opaque `nextCursor` (forwarded as the
444
+ * `@lonca/core` `CursorPaginationParams.cursor`) instead of page-index
445
+ * pagination.
446
+ */
447
+ interface ListOrdersStreamParams {
448
+ cursor?: string;
449
+ limit?: number;
450
+ /**
451
+ * CSV of package-item statuses to filter by (e.g.
452
+ * `'Created,Picking,Invoiced'`). Trendyol accepts the same status
453
+ * vocabulary as `ShipmentPackageStatus`.
454
+ */
455
+ packageItemStatuses?: string;
456
+ /** Lower bound for `lastModified` (Trendyol expects ms-epoch). */
457
+ lastModifiedStartDate?: Date;
458
+ /** Upper bound for `lastModified`. */
459
+ lastModifiedEndDate?: Date;
460
+ }
461
+ /**
462
+ * Box / packaging metadata for `orders.updateBoxInfo`. Both fields are
463
+ * optional but at least one should be set for the call to be meaningful.
464
+ */
465
+ interface UpdateBoxInfoInput {
466
+ /** Desi value (volumetric weight used by Trendyol for shipping cost). */
467
+ deci?: number;
468
+ /** Number of physical boxes in the shipment. */
469
+ boxQuantity?: number;
470
+ }
471
+ /**
472
+ * Per-line labor cost for `orders.updateLaborCosts`. The Trendyol API
473
+ * accepts a raw array of these (no envelope) — the SDK forwards as-is.
474
+ */
475
+ interface LaborCostInput {
476
+ orderLineId: number;
477
+ /** Labor cost charged per single unit of this line. */
478
+ laborCostPerItem: number;
479
+ }
480
+ /**
481
+ * Trendyol cargo provider codes accepted by `orders.changeCargoProvider`.
482
+ * Use the string union for autocomplete; `(string & {})` keeps unknown
483
+ * codes type-compatible so Trendyol can add providers without breaking
484
+ * callers.
485
+ */
486
+ type TrendyolCargoProvider = 'YKMP' | 'ARASMP' | 'SURATMP' | 'HOROZMP' | 'DHLECOMMP' | 'PTTMP' | 'CEVAMP' | 'TEXMP' | 'KOLAYGELSINMP' | 'CEVATEDARIK' | (string & {});
487
+ /**
488
+ * Per-line quantity split for `orders.splitPackageByQuantity`. Each item
489
+ * in `quantities` becomes its own new package containing that many units
490
+ * of `orderLineId`.
491
+ *
492
+ * @example
493
+ * // splits 5 units of line 100 into 3 packages: 2 + 2 + 1
494
+ * { orderLineId: 100, quantities: [2, 2, 1] }
495
+ */
496
+ interface QuantitySplit {
497
+ orderLineId: number;
498
+ quantities: number[];
499
+ }
500
+ /**
501
+ * A group of line IDs that should become a new package together,
502
+ * for `orders.multiSplitPackage`.
503
+ */
504
+ interface SplitGroup {
505
+ orderLineIds: number[];
506
+ }
507
+ /**
508
+ * One package's contents for `orders.splitMultiPackagesByQuantity`. Each
509
+ * element of the outer array becomes a new package; each `packageDetails`
510
+ * entry carries an `orderLineId` and the **single** quantity assigned to
511
+ * that package (note: singular `quantities`, despite the field name).
512
+ */
513
+ interface PackageDetail {
514
+ orderLineId: number;
515
+ /** Quantity of this line to include in this package (singular integer). */
516
+ quantities: number;
517
+ }
518
+ interface SplitPackagePlan {
519
+ packageDetails: PackageDetail[];
520
+ }
521
+ /**
522
+ * Input for `orders.processAlternativeDelivery`. Used when the seller is
523
+ * shipping via a non-Trendyol cargo provider — provide either a phone number
524
+ * (which Trendyol SMSes the tracking link to) or a direct tracking URL.
525
+ */
526
+ interface ProcessAlternativeDeliveryInput {
527
+ /** When true, `trackingInfo` is a phone number; when false, a tracking URL. */
528
+ isPhoneNumber: boolean;
529
+ trackingInfo: string;
530
+ /** Provider-specific extra parameters (Trendyol forwards verbatim). */
531
+ params: Record<string, string>;
532
+ }
394
533
  /**
395
534
  * A Trendyol order — Trendyol models orders as "shipment packages". A single
396
535
  * customer order may produce multiple shipment packages (one per warehouse,
@@ -488,6 +627,162 @@ declare class OrdersResource {
488
627
  * ```
489
628
  */
490
629
  list(params?: ListOrdersParams): Promise<CursorPage<ShipmentPackage>>;
630
+ /**
631
+ * Push a shipment-package status update.
632
+ *
633
+ * Trendyol restricts the seller-side push to two transitions:
634
+ * - `Picking` — order picked up from the shelf / being prepared
635
+ * - `Invoiced` — invoice issued, ready for cargo handoff
636
+ *
637
+ * Other transitions (`Shipped`, `Delivered`, etc.) are driven by Trendyol
638
+ * or the cargo provider — call `processAlternativeDelivery` or
639
+ * `manualDeliverByPackageId` if you ship outside Trendyol's cargo
640
+ * network.
641
+ *
642
+ * Returns void; Trendyol responds with 200 + empty body on success.
643
+ */
644
+ updatePackageStatus(packageId: string | number, input: UpdatePackageStatusInput): Promise<void>;
645
+ /**
646
+ * Notify Trendyol that one or more line items cannot be supplied
647
+ * ("Tedarik Edememe Bildirimi"). Marks the listed line IDs as
648
+ * `UnSupplied`. Trendyol cancels those quantities and notifies the
649
+ * customer.
650
+ *
651
+ * `reasonId` is a numeric code Trendyol publishes separately — consult
652
+ * the seller panel or the "Tedarik Edememe" docs for current values.
653
+ *
654
+ * Returns void; Trendyol responds with 200 + empty body on success.
655
+ */
656
+ cancelPackageItem(packageId: string | number, input: CancelPackageItemInput): Promise<void>;
657
+ /**
658
+ * Extend the agreed delivery date for a shipment package by 1, 2, or 3 days.
659
+ * Trendyol enforces the [1, 3] range server-side; the SDK validates client-side
660
+ * to fail fast.
661
+ *
662
+ * Returns void; Trendyol responds with 200 + empty body on success.
663
+ */
664
+ extendDeliveryDate(packageId: string | number, extendedDayCount: 1 | 2 | 3): Promise<void>;
665
+ /**
666
+ * Notify Trendyol of an alternative delivery channel — used when the
667
+ * seller is shipping via a non-Trendyol cargo provider. Trendyol then
668
+ * either SMSes the customer the tracking link (when `isPhoneNumber` is
669
+ * `true`) or stores the tracking URL on the package directly.
670
+ *
671
+ * Returns void; Trendyol responds with 200 + empty body on success.
672
+ */
673
+ processAlternativeDelivery(packageId: string | number, input: ProcessAlternativeDeliveryInput): Promise<void>;
674
+ /**
675
+ * Split a shipment package by moving a set of line IDs into a new
676
+ * package. The original package keeps the remaining lines.
677
+ *
678
+ * @param packageId The package to split.
679
+ * @param orderLineIds Line IDs to move into the new package (1+).
680
+ * @throws {ValidationError} when `orderLineIds` is empty.
681
+ */
682
+ splitPackage(packageId: string | number, orderLineIds: number[]): Promise<void>;
683
+ /**
684
+ * Split a shipment package by quantity. Each `QuantitySplit` entry
685
+ * carves a single line into multiple packages — e.g. `{ orderLineId: 100,
686
+ * quantities: [2, 2, 1] }` splits 5 units of line 100 into three packages
687
+ * of 2 + 2 + 1.
688
+ *
689
+ * @throws {ValidationError} when `quantitySplit` is empty.
690
+ */
691
+ splitPackageByQuantity(packageId: string | number, quantitySplit: QuantitySplit[]): Promise<void>;
692
+ /**
693
+ * Split a shipment package into multiple new packages by grouping line
694
+ * IDs. Each `SplitGroup` becomes one new package containing the listed
695
+ * line IDs.
696
+ *
697
+ * @throws {ValidationError} when `splitGroups` is empty.
698
+ */
699
+ multiSplitPackage(packageId: string | number, splitGroups: SplitGroup[]): Promise<void>;
700
+ /**
701
+ * Split a shipment package into multiple new packages, each containing a
702
+ * mix of line items at specific quantities. This is the most expressive
703
+ * split — use it when you need fine-grained control over which line IDs
704
+ * and how many of each end up in each new package.
705
+ *
706
+ * @throws {ValidationError} when `splitPackages` is empty.
707
+ */
708
+ splitMultiPackagesByQuantity(packageId: string | number, splitPackages: SplitPackagePlan[]): Promise<void>;
709
+ /**
710
+ * Change the cargo provider on an existing shipment package. Use one of
711
+ * Trendyol's documented marketplace cargo codes (`'YKMP'`, `'ARASMP'`,
712
+ * `'SURATMP'`, etc.) — see `TrendyolCargoProvider` for the full list.
713
+ */
714
+ changeCargoProvider(packageId: string | number, cargoProvider: TrendyolCargoProvider): Promise<void>;
715
+ /**
716
+ * Mark a shipment package as manually delivered via its package ID.
717
+ * Used when the seller delivered the order outside Trendyol's cargo
718
+ * network and needs to flip the package to `Delivered` after handover.
719
+ *
720
+ * No request body; Trendyol responds with 200 + empty body on success.
721
+ */
722
+ manualDeliverByPackageId(packageId: string | number): Promise<void>;
723
+ /**
724
+ * Manual-deliver variant that takes the cargo tracking number instead
725
+ * of the package ID. Useful when you only have the tracking number on
726
+ * hand (e.g., from a cargo provider webhook).
727
+ *
728
+ * Note the path structure: tracking number sits at a sibling location,
729
+ * not under `/shipment-packages/{id}/...`.
730
+ */
731
+ manualDeliverByTrackingNumber(cargoTrackingNumber: string | number): Promise<void>;
732
+ /**
733
+ * Mark a package as delivered through an authorized service ("yetkili
734
+ * servis"). For appliance / installation-required products that are
735
+ * delivered + installed by a third-party service partner.
736
+ */
737
+ markDeliveredByService(packageId: string | number): Promise<void>;
738
+ /**
739
+ * Update box / packaging metadata on a shipment package (desi value
740
+ * and/or number of boxes). Either field can be sent alone.
741
+ */
742
+ updateBoxInfo(packageId: string | number, input: UpdateBoxInfoInput): Promise<void>;
743
+ /**
744
+ * Update labor costs for one or more order lines.
745
+ *
746
+ * **Wire note:** Trendyol's request body is a raw array (no envelope),
747
+ * not `{ items: [...] }`. The SDK forwards `items` verbatim.
748
+ *
749
+ * @throws {ValidationError} when `items` is empty.
750
+ */
751
+ updateLaborCosts(packageId: string | number, items: LaborCostInput[]): Promise<void>;
752
+ /**
753
+ * Reassign a shipment package to a different warehouse. `warehouseId`
754
+ * comes from `client.suppliers.getAddresses()` (filter by `isShipmentAddress`).
755
+ */
756
+ updateWarehouse(packageId: string | number, warehouseId: number): Promise<void>;
757
+ /**
758
+ * Stream variant of `list()`. Trendyol's `getShipmentPackagesStream`
759
+ * returns the same `ShipmentPackage` shape but paginates with an opaque
760
+ * cursor — useful when the dataset is large and page-based pagination
761
+ * would hit the 10 000-record cap.
762
+ *
763
+ * @example
764
+ * ```ts
765
+ * import { paginate } from '@lonca/core';
766
+ * for await (const pkg of paginate((p) =>
767
+ * client.orders.listStream({ ...p, packageItemStatuses: 'Created,Picking' }),
768
+ * )) {
769
+ * console.log(pkg.id, pkg.status);
770
+ * }
771
+ * ```
772
+ */
773
+ listStream(params?: ListOrdersStreamParams): Promise<CursorPage<ShipmentPackage>>;
774
+ /**
775
+ * Fetch the per-parcel cargo-fee breakdown for a single cargo invoice
776
+ * (Trendyol's `getCargoInvoiceItems`). Useful for reconciling Trendyol's
777
+ * cargo deductions against your shipped packages.
778
+ *
779
+ * `invoiceSerialNumber` is sourced from the Current Account Statement
780
+ * ("Cari Hesap Ekstresi") with `transactionType=DeductionInvoices`.
781
+ *
782
+ * Page-based pagination internally (cursor encodes the page index).
783
+ */
784
+ getCargoInvoiceItems(invoiceSerialNumber: string, params?: CursorPaginationParams): Promise<CursorPage<CargoInvoiceItem>>;
785
+ private packagePath;
491
786
  }
492
787
 
493
788
  /** A `{ id, name }` reference object used in product/category/brand wire types. */
@@ -1175,4 +1470,4 @@ interface TrendyolClient {
1175
1470
  */
1176
1471
  declare function createTrendyolClient(opts: CreateClientOptions): TrendyolClient;
1177
1472
 
1178
- export { type BarcodeCategoryLookup, type BatchAcceptedResponse, type BatchRequestItemResult, type BatchRequestResult, type BatchRequestStatus, type Brand, BrandsResource, type BuyboxInfo, CategoriesResource, type Category, type CategoryAttribute, type CategoryAttributeValue, type CreateClientOptions, type CreateProductV2Input, type DeliveryOptionInput, InventoryResource, type ListCategoryAttributeValuesParams, type ListOrdersParams, type ListProductsParams, type ListUnapprovedProductsParams, type NamedRef, type OrderAddress, type OrderAddressLines, type OrderCustomer, type OrderLine, type OrderLineDiscountDetail, OrdersResource, type PackageHistoryEntry, type PriceInventoryUpdate, type Product, type ProductAttribute, type ProductAttributeV2Input, type ProductBase, type ProductImageInput, type ProductVariant, ProductsResource, type ShipmentPackage, type ShipmentPackageStatus, type SupplierAddress, type SupplierAddressType, SuppliersResource, type SuppliersResourceOptions, type TrendyolClient, type TrendyolEnvironment, type UnapprovedDateQueryType, type UnapprovedProduct, type UnapprovedProductRejectReason, type UnapprovedProductStatus, type UpdateContentInput, type UpdateDeliveryInfoInput, type UpdatePriceInventoryResponse, type UpdateUnapprovedInput, type UpdateVariantInput, createTrendyolClient };
1473
+ export { type BarcodeCategoryLookup, type BatchAcceptedResponse, type BatchRequestItemResult, type BatchRequestResult, type BatchRequestStatus, type Brand, BrandsResource, type BuyboxInfo, type CancelPackageItemInput, type CargoInvoiceItem, CategoriesResource, type Category, type CategoryAttribute, type CategoryAttributeValue, type CreateClientOptions, type CreateProductV2Input, type DeliveryOptionInput, InventoryResource, type LaborCostInput, type ListCategoryAttributeValuesParams, type ListOrdersParams, type ListOrdersStreamParams, type ListProductsParams, type ListUnapprovedProductsParams, type NamedRef, type OrderAddress, type OrderAddressLines, type OrderCustomer, type OrderLine, type OrderLineDiscountDetail, OrdersResource, type PackageDetail, type PackageHistoryEntry, type PackageLineUpdate, type PriceInventoryUpdate, type ProcessAlternativeDeliveryInput, type Product, type ProductAttribute, type ProductAttributeV2Input, type ProductBase, type ProductImageInput, type ProductVariant, ProductsResource, type QuantitySplit, type ShipmentPackage, type ShipmentPackageStatus, type SplitGroup, type SplitPackagePlan, type SupplierAddress, type SupplierAddressType, SuppliersResource, type SuppliersResourceOptions, type TrendyolCargoProvider, type TrendyolClient, type TrendyolEnvironment, type UnapprovedDateQueryType, type UnapprovedProduct, type UnapprovedProductRejectReason, type UnapprovedProductStatus, type UpdateBoxInfoInput, type UpdateContentInput, type UpdateDeliveryInfoInput, type UpdatePackageStatusInput, type UpdatePriceInventoryResponse, type UpdateUnapprovedInput, type UpdateVariantInput, createTrendyolClient };
package/dist/index.d.ts CHANGED
@@ -391,6 +391,145 @@ interface PackageHistoryEntry {
391
391
  createdAt?: string;
392
392
  raw: Record<string, unknown>;
393
393
  }
394
+ /**
395
+ * A package line update tuple used by `updatePackageStatus` and
396
+ * `cancelPackageItem`. `lineId` is the per-line ID from `ShipmentPackage.lines[].lineId`.
397
+ */
398
+ interface PackageLineUpdate {
399
+ lineId: number;
400
+ quantity: number;
401
+ }
402
+ /**
403
+ * Input for `orders.updatePackageStatus`. Trendyol restricts the seller-side
404
+ * status push to `Picking` (mark as being prepared) and `Invoiced`
405
+ * (invoice issued); other transitions are driven by Trendyol / the cargo
406
+ * provider. `lines` is optional and only used when transitioning subset of
407
+ * line items.
408
+ */
409
+ interface UpdatePackageStatusInput {
410
+ status: 'Picking' | 'Invoiced';
411
+ lines?: PackageLineUpdate[];
412
+ }
413
+ /**
414
+ * Input for `orders.cancelPackageItem` — Trendyol's "supply failure" notification.
415
+ * Marks specific line items as un-suppliable. `reasonId` is a numeric code
416
+ * Trendyol publishes separately (e.g. `577` = "tedarik edemiyorum"); consult
417
+ * Trendyol's seller panel or the "Tedarik Edememe" docs for current values.
418
+ */
419
+ interface CancelPackageItemInput {
420
+ lines: PackageLineUpdate[];
421
+ reasonId: number;
422
+ }
423
+ /**
424
+ * One row from `orders.getCargoInvoiceItems` — a cargo invoice line item
425
+ * that ties a parcel ID to its cargo fee. Useful for reconciling Trendyol's
426
+ * cargo deductions against your shipped packages.
427
+ */
428
+ interface CargoInvoiceItem {
429
+ /** e.g. "Gönderi Kargo Bedeli" (outbound) or "İade Kargo Bedeli" (return). */
430
+ shipmentPackageType?: string;
431
+ /** Cargo parcel unique ID. */
432
+ parcelUniqueId?: number | string;
433
+ orderNumber?: string;
434
+ /** Fee charged in this row. */
435
+ amount?: number;
436
+ /** Desi value used to compute the fee. */
437
+ desi?: number;
438
+ /** Untouched raw row. */
439
+ raw: Record<string, unknown>;
440
+ }
441
+ /**
442
+ * Filter params for `orders.listStream` — the streaming alternative to
443
+ * `orders.list`. Uses Trendyol's opaque `nextCursor` (forwarded as the
444
+ * `@lonca/core` `CursorPaginationParams.cursor`) instead of page-index
445
+ * pagination.
446
+ */
447
+ interface ListOrdersStreamParams {
448
+ cursor?: string;
449
+ limit?: number;
450
+ /**
451
+ * CSV of package-item statuses to filter by (e.g.
452
+ * `'Created,Picking,Invoiced'`). Trendyol accepts the same status
453
+ * vocabulary as `ShipmentPackageStatus`.
454
+ */
455
+ packageItemStatuses?: string;
456
+ /** Lower bound for `lastModified` (Trendyol expects ms-epoch). */
457
+ lastModifiedStartDate?: Date;
458
+ /** Upper bound for `lastModified`. */
459
+ lastModifiedEndDate?: Date;
460
+ }
461
+ /**
462
+ * Box / packaging metadata for `orders.updateBoxInfo`. Both fields are
463
+ * optional but at least one should be set for the call to be meaningful.
464
+ */
465
+ interface UpdateBoxInfoInput {
466
+ /** Desi value (volumetric weight used by Trendyol for shipping cost). */
467
+ deci?: number;
468
+ /** Number of physical boxes in the shipment. */
469
+ boxQuantity?: number;
470
+ }
471
+ /**
472
+ * Per-line labor cost for `orders.updateLaborCosts`. The Trendyol API
473
+ * accepts a raw array of these (no envelope) — the SDK forwards as-is.
474
+ */
475
+ interface LaborCostInput {
476
+ orderLineId: number;
477
+ /** Labor cost charged per single unit of this line. */
478
+ laborCostPerItem: number;
479
+ }
480
+ /**
481
+ * Trendyol cargo provider codes accepted by `orders.changeCargoProvider`.
482
+ * Use the string union for autocomplete; `(string & {})` keeps unknown
483
+ * codes type-compatible so Trendyol can add providers without breaking
484
+ * callers.
485
+ */
486
+ type TrendyolCargoProvider = 'YKMP' | 'ARASMP' | 'SURATMP' | 'HOROZMP' | 'DHLECOMMP' | 'PTTMP' | 'CEVAMP' | 'TEXMP' | 'KOLAYGELSINMP' | 'CEVATEDARIK' | (string & {});
487
+ /**
488
+ * Per-line quantity split for `orders.splitPackageByQuantity`. Each item
489
+ * in `quantities` becomes its own new package containing that many units
490
+ * of `orderLineId`.
491
+ *
492
+ * @example
493
+ * // splits 5 units of line 100 into 3 packages: 2 + 2 + 1
494
+ * { orderLineId: 100, quantities: [2, 2, 1] }
495
+ */
496
+ interface QuantitySplit {
497
+ orderLineId: number;
498
+ quantities: number[];
499
+ }
500
+ /**
501
+ * A group of line IDs that should become a new package together,
502
+ * for `orders.multiSplitPackage`.
503
+ */
504
+ interface SplitGroup {
505
+ orderLineIds: number[];
506
+ }
507
+ /**
508
+ * One package's contents for `orders.splitMultiPackagesByQuantity`. Each
509
+ * element of the outer array becomes a new package; each `packageDetails`
510
+ * entry carries an `orderLineId` and the **single** quantity assigned to
511
+ * that package (note: singular `quantities`, despite the field name).
512
+ */
513
+ interface PackageDetail {
514
+ orderLineId: number;
515
+ /** Quantity of this line to include in this package (singular integer). */
516
+ quantities: number;
517
+ }
518
+ interface SplitPackagePlan {
519
+ packageDetails: PackageDetail[];
520
+ }
521
+ /**
522
+ * Input for `orders.processAlternativeDelivery`. Used when the seller is
523
+ * shipping via a non-Trendyol cargo provider — provide either a phone number
524
+ * (which Trendyol SMSes the tracking link to) or a direct tracking URL.
525
+ */
526
+ interface ProcessAlternativeDeliveryInput {
527
+ /** When true, `trackingInfo` is a phone number; when false, a tracking URL. */
528
+ isPhoneNumber: boolean;
529
+ trackingInfo: string;
530
+ /** Provider-specific extra parameters (Trendyol forwards verbatim). */
531
+ params: Record<string, string>;
532
+ }
394
533
  /**
395
534
  * A Trendyol order — Trendyol models orders as "shipment packages". A single
396
535
  * customer order may produce multiple shipment packages (one per warehouse,
@@ -488,6 +627,162 @@ declare class OrdersResource {
488
627
  * ```
489
628
  */
490
629
  list(params?: ListOrdersParams): Promise<CursorPage<ShipmentPackage>>;
630
+ /**
631
+ * Push a shipment-package status update.
632
+ *
633
+ * Trendyol restricts the seller-side push to two transitions:
634
+ * - `Picking` — order picked up from the shelf / being prepared
635
+ * - `Invoiced` — invoice issued, ready for cargo handoff
636
+ *
637
+ * Other transitions (`Shipped`, `Delivered`, etc.) are driven by Trendyol
638
+ * or the cargo provider — call `processAlternativeDelivery` or
639
+ * `manualDeliverByPackageId` if you ship outside Trendyol's cargo
640
+ * network.
641
+ *
642
+ * Returns void; Trendyol responds with 200 + empty body on success.
643
+ */
644
+ updatePackageStatus(packageId: string | number, input: UpdatePackageStatusInput): Promise<void>;
645
+ /**
646
+ * Notify Trendyol that one or more line items cannot be supplied
647
+ * ("Tedarik Edememe Bildirimi"). Marks the listed line IDs as
648
+ * `UnSupplied`. Trendyol cancels those quantities and notifies the
649
+ * customer.
650
+ *
651
+ * `reasonId` is a numeric code Trendyol publishes separately — consult
652
+ * the seller panel or the "Tedarik Edememe" docs for current values.
653
+ *
654
+ * Returns void; Trendyol responds with 200 + empty body on success.
655
+ */
656
+ cancelPackageItem(packageId: string | number, input: CancelPackageItemInput): Promise<void>;
657
+ /**
658
+ * Extend the agreed delivery date for a shipment package by 1, 2, or 3 days.
659
+ * Trendyol enforces the [1, 3] range server-side; the SDK validates client-side
660
+ * to fail fast.
661
+ *
662
+ * Returns void; Trendyol responds with 200 + empty body on success.
663
+ */
664
+ extendDeliveryDate(packageId: string | number, extendedDayCount: 1 | 2 | 3): Promise<void>;
665
+ /**
666
+ * Notify Trendyol of an alternative delivery channel — used when the
667
+ * seller is shipping via a non-Trendyol cargo provider. Trendyol then
668
+ * either SMSes the customer the tracking link (when `isPhoneNumber` is
669
+ * `true`) or stores the tracking URL on the package directly.
670
+ *
671
+ * Returns void; Trendyol responds with 200 + empty body on success.
672
+ */
673
+ processAlternativeDelivery(packageId: string | number, input: ProcessAlternativeDeliveryInput): Promise<void>;
674
+ /**
675
+ * Split a shipment package by moving a set of line IDs into a new
676
+ * package. The original package keeps the remaining lines.
677
+ *
678
+ * @param packageId The package to split.
679
+ * @param orderLineIds Line IDs to move into the new package (1+).
680
+ * @throws {ValidationError} when `orderLineIds` is empty.
681
+ */
682
+ splitPackage(packageId: string | number, orderLineIds: number[]): Promise<void>;
683
+ /**
684
+ * Split a shipment package by quantity. Each `QuantitySplit` entry
685
+ * carves a single line into multiple packages — e.g. `{ orderLineId: 100,
686
+ * quantities: [2, 2, 1] }` splits 5 units of line 100 into three packages
687
+ * of 2 + 2 + 1.
688
+ *
689
+ * @throws {ValidationError} when `quantitySplit` is empty.
690
+ */
691
+ splitPackageByQuantity(packageId: string | number, quantitySplit: QuantitySplit[]): Promise<void>;
692
+ /**
693
+ * Split a shipment package into multiple new packages by grouping line
694
+ * IDs. Each `SplitGroup` becomes one new package containing the listed
695
+ * line IDs.
696
+ *
697
+ * @throws {ValidationError} when `splitGroups` is empty.
698
+ */
699
+ multiSplitPackage(packageId: string | number, splitGroups: SplitGroup[]): Promise<void>;
700
+ /**
701
+ * Split a shipment package into multiple new packages, each containing a
702
+ * mix of line items at specific quantities. This is the most expressive
703
+ * split — use it when you need fine-grained control over which line IDs
704
+ * and how many of each end up in each new package.
705
+ *
706
+ * @throws {ValidationError} when `splitPackages` is empty.
707
+ */
708
+ splitMultiPackagesByQuantity(packageId: string | number, splitPackages: SplitPackagePlan[]): Promise<void>;
709
+ /**
710
+ * Change the cargo provider on an existing shipment package. Use one of
711
+ * Trendyol's documented marketplace cargo codes (`'YKMP'`, `'ARASMP'`,
712
+ * `'SURATMP'`, etc.) — see `TrendyolCargoProvider` for the full list.
713
+ */
714
+ changeCargoProvider(packageId: string | number, cargoProvider: TrendyolCargoProvider): Promise<void>;
715
+ /**
716
+ * Mark a shipment package as manually delivered via its package ID.
717
+ * Used when the seller delivered the order outside Trendyol's cargo
718
+ * network and needs to flip the package to `Delivered` after handover.
719
+ *
720
+ * No request body; Trendyol responds with 200 + empty body on success.
721
+ */
722
+ manualDeliverByPackageId(packageId: string | number): Promise<void>;
723
+ /**
724
+ * Manual-deliver variant that takes the cargo tracking number instead
725
+ * of the package ID. Useful when you only have the tracking number on
726
+ * hand (e.g., from a cargo provider webhook).
727
+ *
728
+ * Note the path structure: tracking number sits at a sibling location,
729
+ * not under `/shipment-packages/{id}/...`.
730
+ */
731
+ manualDeliverByTrackingNumber(cargoTrackingNumber: string | number): Promise<void>;
732
+ /**
733
+ * Mark a package as delivered through an authorized service ("yetkili
734
+ * servis"). For appliance / installation-required products that are
735
+ * delivered + installed by a third-party service partner.
736
+ */
737
+ markDeliveredByService(packageId: string | number): Promise<void>;
738
+ /**
739
+ * Update box / packaging metadata on a shipment package (desi value
740
+ * and/or number of boxes). Either field can be sent alone.
741
+ */
742
+ updateBoxInfo(packageId: string | number, input: UpdateBoxInfoInput): Promise<void>;
743
+ /**
744
+ * Update labor costs for one or more order lines.
745
+ *
746
+ * **Wire note:** Trendyol's request body is a raw array (no envelope),
747
+ * not `{ items: [...] }`. The SDK forwards `items` verbatim.
748
+ *
749
+ * @throws {ValidationError} when `items` is empty.
750
+ */
751
+ updateLaborCosts(packageId: string | number, items: LaborCostInput[]): Promise<void>;
752
+ /**
753
+ * Reassign a shipment package to a different warehouse. `warehouseId`
754
+ * comes from `client.suppliers.getAddresses()` (filter by `isShipmentAddress`).
755
+ */
756
+ updateWarehouse(packageId: string | number, warehouseId: number): Promise<void>;
757
+ /**
758
+ * Stream variant of `list()`. Trendyol's `getShipmentPackagesStream`
759
+ * returns the same `ShipmentPackage` shape but paginates with an opaque
760
+ * cursor — useful when the dataset is large and page-based pagination
761
+ * would hit the 10 000-record cap.
762
+ *
763
+ * @example
764
+ * ```ts
765
+ * import { paginate } from '@lonca/core';
766
+ * for await (const pkg of paginate((p) =>
767
+ * client.orders.listStream({ ...p, packageItemStatuses: 'Created,Picking' }),
768
+ * )) {
769
+ * console.log(pkg.id, pkg.status);
770
+ * }
771
+ * ```
772
+ */
773
+ listStream(params?: ListOrdersStreamParams): Promise<CursorPage<ShipmentPackage>>;
774
+ /**
775
+ * Fetch the per-parcel cargo-fee breakdown for a single cargo invoice
776
+ * (Trendyol's `getCargoInvoiceItems`). Useful for reconciling Trendyol's
777
+ * cargo deductions against your shipped packages.
778
+ *
779
+ * `invoiceSerialNumber` is sourced from the Current Account Statement
780
+ * ("Cari Hesap Ekstresi") with `transactionType=DeductionInvoices`.
781
+ *
782
+ * Page-based pagination internally (cursor encodes the page index).
783
+ */
784
+ getCargoInvoiceItems(invoiceSerialNumber: string, params?: CursorPaginationParams): Promise<CursorPage<CargoInvoiceItem>>;
785
+ private packagePath;
491
786
  }
492
787
 
493
788
  /** A `{ id, name }` reference object used in product/category/brand wire types. */
@@ -1175,4 +1470,4 @@ interface TrendyolClient {
1175
1470
  */
1176
1471
  declare function createTrendyolClient(opts: CreateClientOptions): TrendyolClient;
1177
1472
 
1178
- export { type BarcodeCategoryLookup, type BatchAcceptedResponse, type BatchRequestItemResult, type BatchRequestResult, type BatchRequestStatus, type Brand, BrandsResource, type BuyboxInfo, CategoriesResource, type Category, type CategoryAttribute, type CategoryAttributeValue, type CreateClientOptions, type CreateProductV2Input, type DeliveryOptionInput, InventoryResource, type ListCategoryAttributeValuesParams, type ListOrdersParams, type ListProductsParams, type ListUnapprovedProductsParams, type NamedRef, type OrderAddress, type OrderAddressLines, type OrderCustomer, type OrderLine, type OrderLineDiscountDetail, OrdersResource, type PackageHistoryEntry, type PriceInventoryUpdate, type Product, type ProductAttribute, type ProductAttributeV2Input, type ProductBase, type ProductImageInput, type ProductVariant, ProductsResource, type ShipmentPackage, type ShipmentPackageStatus, type SupplierAddress, type SupplierAddressType, SuppliersResource, type SuppliersResourceOptions, type TrendyolClient, type TrendyolEnvironment, type UnapprovedDateQueryType, type UnapprovedProduct, type UnapprovedProductRejectReason, type UnapprovedProductStatus, type UpdateContentInput, type UpdateDeliveryInfoInput, type UpdatePriceInventoryResponse, type UpdateUnapprovedInput, type UpdateVariantInput, createTrendyolClient };
1473
+ export { type BarcodeCategoryLookup, type BatchAcceptedResponse, type BatchRequestItemResult, type BatchRequestResult, type BatchRequestStatus, type Brand, BrandsResource, type BuyboxInfo, type CancelPackageItemInput, type CargoInvoiceItem, CategoriesResource, type Category, type CategoryAttribute, type CategoryAttributeValue, type CreateClientOptions, type CreateProductV2Input, type DeliveryOptionInput, InventoryResource, type LaborCostInput, type ListCategoryAttributeValuesParams, type ListOrdersParams, type ListOrdersStreamParams, type ListProductsParams, type ListUnapprovedProductsParams, type NamedRef, type OrderAddress, type OrderAddressLines, type OrderCustomer, type OrderLine, type OrderLineDiscountDetail, OrdersResource, type PackageDetail, type PackageHistoryEntry, type PackageLineUpdate, type PriceInventoryUpdate, type ProcessAlternativeDeliveryInput, type Product, type ProductAttribute, type ProductAttributeV2Input, type ProductBase, type ProductImageInput, type ProductVariant, ProductsResource, type QuantitySplit, type ShipmentPackage, type ShipmentPackageStatus, type SplitGroup, type SplitPackagePlan, type SupplierAddress, type SupplierAddressType, SuppliersResource, type SuppliersResourceOptions, type TrendyolCargoProvider, type TrendyolClient, type TrendyolEnvironment, type UnapprovedDateQueryType, type UnapprovedProduct, type UnapprovedProductRejectReason, type UnapprovedProductStatus, type UpdateBoxInfoInput, type UpdateContentInput, type UpdateDeliveryInfoInput, type UpdatePackageStatusInput, type UpdatePriceInventoryResponse, type UpdateUnapprovedInput, type UpdateVariantInput, createTrendyolClient };