@flowselections/mailbox-orders 1.0.5 → 1.0.7

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.
@@ -748,6 +748,7 @@ export declare const ingestEmailEvent: import("@tanstack/start-client-core").Opt
748
748
  notes: string | null;
749
749
  performed_at: string;
750
750
  rescheduled_count: number;
751
+ stock_consumed_at: string | null;
751
752
  total_carts: number;
752
753
  updated_at: string;
753
754
  user_id: string;
@@ -761,6 +762,7 @@ export declare const ingestEmailEvent: import("@tanstack/start-client-core").Opt
761
762
  notes?: string | null;
762
763
  performed_at?: string;
763
764
  rescheduled_count?: number;
765
+ stock_consumed_at?: string | null;
764
766
  total_carts?: number;
765
767
  updated_at?: string;
766
768
  user_id: string;
@@ -774,6 +776,7 @@ export declare const ingestEmailEvent: import("@tanstack/start-client-core").Opt
774
776
  notes?: string | null;
775
777
  performed_at?: string;
776
778
  rescheduled_count?: number;
779
+ stock_consumed_at?: string | null;
777
780
  total_carts?: number;
778
781
  updated_at?: string;
779
782
  user_id?: string;
@@ -6532,6 +6535,7 @@ export declare const ingestEmailEvent: import("@tanstack/start-client-core").Opt
6532
6535
  purchase_price: number | null;
6533
6536
  quantity: number;
6534
6537
  sale_price: number | null;
6538
+ trade_item_key: string | null;
6535
6539
  unit: string;
6536
6540
  updated_at: string;
6537
6541
  weight: string | null;
@@ -6554,6 +6558,7 @@ export declare const ingestEmailEvent: import("@tanstack/start-client-core").Opt
6554
6558
  purchase_price?: number | null;
6555
6559
  quantity?: number;
6556
6560
  sale_price?: number | null;
6561
+ trade_item_key?: string | null;
6557
6562
  unit?: string;
6558
6563
  updated_at?: string;
6559
6564
  weight?: string | null;
@@ -6576,6 +6581,7 @@ export declare const ingestEmailEvent: import("@tanstack/start-client-core").Opt
6576
6581
  purchase_price?: number | null;
6577
6582
  quantity?: number;
6578
6583
  sale_price?: number | null;
6584
+ trade_item_key?: string | null;
6579
6585
  unit?: string;
6580
6586
  updated_at?: string;
6581
6587
  weight?: string | null;
@@ -7395,6 +7401,60 @@ export declare const ingestEmailEvent: import("@tanstack/start-client-core").Opt
7395
7401
  };
7396
7402
  Relationships: [];
7397
7403
  };
7404
+ stock_mutation_log: {
7405
+ Row: {
7406
+ connection_id: string | null;
7407
+ created_at: string;
7408
+ created_by: string | null;
7409
+ id: string;
7410
+ mutation_type: string;
7411
+ order_id: string | null;
7412
+ order_item_id: string | null;
7413
+ order_source: string | null;
7414
+ physical_after: number | null;
7415
+ physical_before: number | null;
7416
+ qty_delta: number;
7417
+ reason: string | null;
7418
+ reserved_after: number | null;
7419
+ reserved_before: number | null;
7420
+ trade_item_key: string;
7421
+ };
7422
+ Insert: {
7423
+ connection_id?: string | null;
7424
+ created_at?: string;
7425
+ created_by?: string | null;
7426
+ id?: string;
7427
+ mutation_type: string;
7428
+ order_id?: string | null;
7429
+ order_item_id?: string | null;
7430
+ order_source?: string | null;
7431
+ physical_after?: number | null;
7432
+ physical_before?: number | null;
7433
+ qty_delta: number;
7434
+ reason?: string | null;
7435
+ reserved_after?: number | null;
7436
+ reserved_before?: number | null;
7437
+ trade_item_key: string;
7438
+ };
7439
+ Update: {
7440
+ connection_id?: string | null;
7441
+ created_at?: string;
7442
+ created_by?: string | null;
7443
+ id?: string;
7444
+ mutation_type?: string;
7445
+ order_id?: string | null;
7446
+ order_item_id?: string | null;
7447
+ order_source?: string | null;
7448
+ physical_after?: number | null;
7449
+ physical_before?: number | null;
7450
+ qty_delta?: number;
7451
+ reason?: string | null;
7452
+ reserved_after?: number | null;
7453
+ reserved_before?: number | null;
7454
+ trade_item_key?: string;
7455
+ };
7456
+ Relationships: [];
7457
+ };
7398
7458
  supplier_products: {
7399
7459
  Row: {
7400
7460
  article_number: string | null;
@@ -9256,6 +9316,54 @@ export declare const ingestEmailEvent: import("@tanstack/start-client-core").Opt
9256
9316
  };
9257
9317
  Returns: number;
9258
9318
  };
9319
+ afh_city_code: {
9320
+ Args: {
9321
+ _city: string;
9322
+ _country: string;
9323
+ };
9324
+ Returns: string;
9325
+ };
9326
+ afh_normalize_country: {
9327
+ Args: {
9328
+ _raw: string;
9329
+ };
9330
+ Returns: string;
9331
+ };
9332
+ afh_normalize_nl_province: {
9333
+ Args: {
9334
+ _raw: string;
9335
+ };
9336
+ Returns: string;
9337
+ };
9338
+ afh_subtract_workdays: {
9339
+ Args: {
9340
+ _date: string;
9341
+ _days: number;
9342
+ };
9343
+ Returns: string;
9344
+ };
9345
+ apply_stock_consumption: {
9346
+ Args: {
9347
+ p_order_id: string;
9348
+ p_order_item_id: string;
9349
+ p_qty: number;
9350
+ p_reason: string;
9351
+ p_source: string;
9352
+ p_trade_item_key: string;
9353
+ };
9354
+ Returns: undefined;
9355
+ };
9356
+ apply_stock_reservation: {
9357
+ Args: {
9358
+ p_order_id: string;
9359
+ p_order_item_id: string;
9360
+ p_qty: number;
9361
+ p_reason: string;
9362
+ p_source: string;
9363
+ p_trade_item_key: string;
9364
+ };
9365
+ Returns: undefined;
9366
+ };
9259
9367
  assign_cart_numbers: {
9260
9368
  Args: {
9261
9369
  p_carts: import("../integrations/supabase/types").Json;
@@ -9279,12 +9387,40 @@ export declare const ingestEmailEvent: import("@tanstack/start-client-core").Opt
9279
9387
  order_number: string;
9280
9388
  }[];
9281
9389
  };
9390
+ backfill_open_order_reservations: {
9391
+ Args: never;
9392
+ Returns: {
9393
+ processed_items: number;
9394
+ }[];
9395
+ };
9282
9396
  call_exact_route: {
9283
9397
  Args: {
9284
9398
  path: string;
9285
9399
  };
9286
9400
  Returns: number;
9287
9401
  };
9402
+ check_offer_product_available_stock: {
9403
+ Args: {
9404
+ p_campaign_product_id: string;
9405
+ p_code: string;
9406
+ p_needed_qty?: number;
9407
+ p_product_name?: string;
9408
+ };
9409
+ Returns: import("../integrations/supabase/types").Json;
9410
+ };
9411
+ check_trade_item_available_stock: {
9412
+ Args: {
9413
+ p_connection_id?: string;
9414
+ p_context?: string;
9415
+ p_needed_qty?: number;
9416
+ p_order_id?: string;
9417
+ p_order_item_id?: string;
9418
+ p_owner_id?: string;
9419
+ p_product_name?: string;
9420
+ p_trade_item_key: string;
9421
+ };
9422
+ Returns: import("../integrations/supabase/types").Json;
9423
+ };
9288
9424
  cleanup_old_bookings: {
9289
9425
  Args: never;
9290
9426
  Returns: number;
@@ -9328,6 +9464,12 @@ export declare const ingestEmailEvent: import("@tanstack/start-client-core").Opt
9328
9464
  table_name: string;
9329
9465
  }[];
9330
9466
  };
9467
+ dispatch_carrier_signups_sql: {
9468
+ Args: {
9469
+ _catchup?: string;
9470
+ };
9471
+ Returns: import("../integrations/supabase/types").Json;
9472
+ };
9331
9473
  email_auth_decrypt: {
9332
9474
  Args: {
9333
9475
  cipher: string;
@@ -9400,6 +9542,12 @@ export declare const ingestEmailEvent: import("@tanstack/start-client-core").Opt
9400
9542
  };
9401
9543
  Returns: boolean;
9402
9544
  };
9545
+ find_trade_item_key_by_name: {
9546
+ Args: {
9547
+ p_name: string;
9548
+ };
9549
+ Returns: string;
9550
+ };
9403
9551
  format_cart_number: {
9404
9552
  Args: {
9405
9553
  p_pick_date: string;
@@ -10673,6 +10821,7 @@ export declare const backfillRecentEvents: import("@tanstack/start-client-core")
10673
10821
  notes: string | null;
10674
10822
  performed_at: string;
10675
10823
  rescheduled_count: number;
10824
+ stock_consumed_at: string | null;
10676
10825
  total_carts: number;
10677
10826
  updated_at: string;
10678
10827
  user_id: string;
@@ -10686,6 +10835,7 @@ export declare const backfillRecentEvents: import("@tanstack/start-client-core")
10686
10835
  notes?: string | null;
10687
10836
  performed_at?: string;
10688
10837
  rescheduled_count?: number;
10838
+ stock_consumed_at?: string | null;
10689
10839
  total_carts?: number;
10690
10840
  updated_at?: string;
10691
10841
  user_id: string;
@@ -10699,6 +10849,7 @@ export declare const backfillRecentEvents: import("@tanstack/start-client-core")
10699
10849
  notes?: string | null;
10700
10850
  performed_at?: string;
10701
10851
  rescheduled_count?: number;
10852
+ stock_consumed_at?: string | null;
10702
10853
  total_carts?: number;
10703
10854
  updated_at?: string;
10704
10855
  user_id?: string;
@@ -16457,6 +16608,7 @@ export declare const backfillRecentEvents: import("@tanstack/start-client-core")
16457
16608
  purchase_price: number | null;
16458
16609
  quantity: number;
16459
16610
  sale_price: number | null;
16611
+ trade_item_key: string | null;
16460
16612
  unit: string;
16461
16613
  updated_at: string;
16462
16614
  weight: string | null;
@@ -16479,6 +16631,7 @@ export declare const backfillRecentEvents: import("@tanstack/start-client-core")
16479
16631
  purchase_price?: number | null;
16480
16632
  quantity?: number;
16481
16633
  sale_price?: number | null;
16634
+ trade_item_key?: string | null;
16482
16635
  unit?: string;
16483
16636
  updated_at?: string;
16484
16637
  weight?: string | null;
@@ -16501,6 +16654,7 @@ export declare const backfillRecentEvents: import("@tanstack/start-client-core")
16501
16654
  purchase_price?: number | null;
16502
16655
  quantity?: number;
16503
16656
  sale_price?: number | null;
16657
+ trade_item_key?: string | null;
16504
16658
  unit?: string;
16505
16659
  updated_at?: string;
16506
16660
  weight?: string | null;
@@ -17320,6 +17474,60 @@ export declare const backfillRecentEvents: import("@tanstack/start-client-core")
17320
17474
  };
17321
17475
  Relationships: [];
17322
17476
  };
17477
+ stock_mutation_log: {
17478
+ Row: {
17479
+ connection_id: string | null;
17480
+ created_at: string;
17481
+ created_by: string | null;
17482
+ id: string;
17483
+ mutation_type: string;
17484
+ order_id: string | null;
17485
+ order_item_id: string | null;
17486
+ order_source: string | null;
17487
+ physical_after: number | null;
17488
+ physical_before: number | null;
17489
+ qty_delta: number;
17490
+ reason: string | null;
17491
+ reserved_after: number | null;
17492
+ reserved_before: number | null;
17493
+ trade_item_key: string;
17494
+ };
17495
+ Insert: {
17496
+ connection_id?: string | null;
17497
+ created_at?: string;
17498
+ created_by?: string | null;
17499
+ id?: string;
17500
+ mutation_type: string;
17501
+ order_id?: string | null;
17502
+ order_item_id?: string | null;
17503
+ order_source?: string | null;
17504
+ physical_after?: number | null;
17505
+ physical_before?: number | null;
17506
+ qty_delta: number;
17507
+ reason?: string | null;
17508
+ reserved_after?: number | null;
17509
+ reserved_before?: number | null;
17510
+ trade_item_key: string;
17511
+ };
17512
+ Update: {
17513
+ connection_id?: string | null;
17514
+ created_at?: string;
17515
+ created_by?: string | null;
17516
+ id?: string;
17517
+ mutation_type?: string;
17518
+ order_id?: string | null;
17519
+ order_item_id?: string | null;
17520
+ order_source?: string | null;
17521
+ physical_after?: number | null;
17522
+ physical_before?: number | null;
17523
+ qty_delta?: number;
17524
+ reason?: string | null;
17525
+ reserved_after?: number | null;
17526
+ reserved_before?: number | null;
17527
+ trade_item_key?: string;
17528
+ };
17529
+ Relationships: [];
17530
+ };
17323
17531
  supplier_products: {
17324
17532
  Row: {
17325
17533
  article_number: string | null;
@@ -19181,6 +19389,54 @@ export declare const backfillRecentEvents: import("@tanstack/start-client-core")
19181
19389
  };
19182
19390
  Returns: number;
19183
19391
  };
19392
+ afh_city_code: {
19393
+ Args: {
19394
+ _city: string;
19395
+ _country: string;
19396
+ };
19397
+ Returns: string;
19398
+ };
19399
+ afh_normalize_country: {
19400
+ Args: {
19401
+ _raw: string;
19402
+ };
19403
+ Returns: string;
19404
+ };
19405
+ afh_normalize_nl_province: {
19406
+ Args: {
19407
+ _raw: string;
19408
+ };
19409
+ Returns: string;
19410
+ };
19411
+ afh_subtract_workdays: {
19412
+ Args: {
19413
+ _date: string;
19414
+ _days: number;
19415
+ };
19416
+ Returns: string;
19417
+ };
19418
+ apply_stock_consumption: {
19419
+ Args: {
19420
+ p_order_id: string;
19421
+ p_order_item_id: string;
19422
+ p_qty: number;
19423
+ p_reason: string;
19424
+ p_source: string;
19425
+ p_trade_item_key: string;
19426
+ };
19427
+ Returns: undefined;
19428
+ };
19429
+ apply_stock_reservation: {
19430
+ Args: {
19431
+ p_order_id: string;
19432
+ p_order_item_id: string;
19433
+ p_qty: number;
19434
+ p_reason: string;
19435
+ p_source: string;
19436
+ p_trade_item_key: string;
19437
+ };
19438
+ Returns: undefined;
19439
+ };
19184
19440
  assign_cart_numbers: {
19185
19441
  Args: {
19186
19442
  p_carts: import("../integrations/supabase/types").Json;
@@ -19204,12 +19460,40 @@ export declare const backfillRecentEvents: import("@tanstack/start-client-core")
19204
19460
  order_number: string;
19205
19461
  }[];
19206
19462
  };
19463
+ backfill_open_order_reservations: {
19464
+ Args: never;
19465
+ Returns: {
19466
+ processed_items: number;
19467
+ }[];
19468
+ };
19207
19469
  call_exact_route: {
19208
19470
  Args: {
19209
19471
  path: string;
19210
19472
  };
19211
19473
  Returns: number;
19212
19474
  };
19475
+ check_offer_product_available_stock: {
19476
+ Args: {
19477
+ p_campaign_product_id: string;
19478
+ p_code: string;
19479
+ p_needed_qty?: number;
19480
+ p_product_name?: string;
19481
+ };
19482
+ Returns: import("../integrations/supabase/types").Json;
19483
+ };
19484
+ check_trade_item_available_stock: {
19485
+ Args: {
19486
+ p_connection_id?: string;
19487
+ p_context?: string;
19488
+ p_needed_qty?: number;
19489
+ p_order_id?: string;
19490
+ p_order_item_id?: string;
19491
+ p_owner_id?: string;
19492
+ p_product_name?: string;
19493
+ p_trade_item_key: string;
19494
+ };
19495
+ Returns: import("../integrations/supabase/types").Json;
19496
+ };
19213
19497
  cleanup_old_bookings: {
19214
19498
  Args: never;
19215
19499
  Returns: number;
@@ -19253,6 +19537,12 @@ export declare const backfillRecentEvents: import("@tanstack/start-client-core")
19253
19537
  table_name: string;
19254
19538
  }[];
19255
19539
  };
19540
+ dispatch_carrier_signups_sql: {
19541
+ Args: {
19542
+ _catchup?: string;
19543
+ };
19544
+ Returns: import("../integrations/supabase/types").Json;
19545
+ };
19256
19546
  email_auth_decrypt: {
19257
19547
  Args: {
19258
19548
  cipher: string;
@@ -19325,6 +19615,12 @@ export declare const backfillRecentEvents: import("@tanstack/start-client-core")
19325
19615
  };
19326
19616
  Returns: boolean;
19327
19617
  };
19618
+ find_trade_item_key_by_name: {
19619
+ Args: {
19620
+ p_name: string;
19621
+ };
19622
+ Returns: string;
19623
+ };
19328
19624
  format_cart_number: {
19329
19625
  Args: {
19330
19626
  p_pick_date: string;
@@ -20596,6 +20892,7 @@ export declare const listMessages: import("@tanstack/start-client-core").Optiona
20596
20892
  notes: string | null;
20597
20893
  performed_at: string;
20598
20894
  rescheduled_count: number;
20895
+ stock_consumed_at: string | null;
20599
20896
  total_carts: number;
20600
20897
  updated_at: string;
20601
20898
  user_id: string;
@@ -20609,6 +20906,7 @@ export declare const listMessages: import("@tanstack/start-client-core").Optiona
20609
20906
  notes?: string | null;
20610
20907
  performed_at?: string;
20611
20908
  rescheduled_count?: number;
20909
+ stock_consumed_at?: string | null;
20612
20910
  total_carts?: number;
20613
20911
  updated_at?: string;
20614
20912
  user_id: string;
@@ -20622,6 +20920,7 @@ export declare const listMessages: import("@tanstack/start-client-core").Optiona
20622
20920
  notes?: string | null;
20623
20921
  performed_at?: string;
20624
20922
  rescheduled_count?: number;
20923
+ stock_consumed_at?: string | null;
20625
20924
  total_carts?: number;
20626
20925
  updated_at?: string;
20627
20926
  user_id?: string;
@@ -26380,6 +26679,7 @@ export declare const listMessages: import("@tanstack/start-client-core").Optiona
26380
26679
  purchase_price: number | null;
26381
26680
  quantity: number;
26382
26681
  sale_price: number | null;
26682
+ trade_item_key: string | null;
26383
26683
  unit: string;
26384
26684
  updated_at: string;
26385
26685
  weight: string | null;
@@ -26402,6 +26702,7 @@ export declare const listMessages: import("@tanstack/start-client-core").Optiona
26402
26702
  purchase_price?: number | null;
26403
26703
  quantity?: number;
26404
26704
  sale_price?: number | null;
26705
+ trade_item_key?: string | null;
26405
26706
  unit?: string;
26406
26707
  updated_at?: string;
26407
26708
  weight?: string | null;
@@ -26424,6 +26725,7 @@ export declare const listMessages: import("@tanstack/start-client-core").Optiona
26424
26725
  purchase_price?: number | null;
26425
26726
  quantity?: number;
26426
26727
  sale_price?: number | null;
26728
+ trade_item_key?: string | null;
26427
26729
  unit?: string;
26428
26730
  updated_at?: string;
26429
26731
  weight?: string | null;
@@ -27243,6 +27545,60 @@ export declare const listMessages: import("@tanstack/start-client-core").Optiona
27243
27545
  };
27244
27546
  Relationships: [];
27245
27547
  };
27548
+ stock_mutation_log: {
27549
+ Row: {
27550
+ connection_id: string | null;
27551
+ created_at: string;
27552
+ created_by: string | null;
27553
+ id: string;
27554
+ mutation_type: string;
27555
+ order_id: string | null;
27556
+ order_item_id: string | null;
27557
+ order_source: string | null;
27558
+ physical_after: number | null;
27559
+ physical_before: number | null;
27560
+ qty_delta: number;
27561
+ reason: string | null;
27562
+ reserved_after: number | null;
27563
+ reserved_before: number | null;
27564
+ trade_item_key: string;
27565
+ };
27566
+ Insert: {
27567
+ connection_id?: string | null;
27568
+ created_at?: string;
27569
+ created_by?: string | null;
27570
+ id?: string;
27571
+ mutation_type: string;
27572
+ order_id?: string | null;
27573
+ order_item_id?: string | null;
27574
+ order_source?: string | null;
27575
+ physical_after?: number | null;
27576
+ physical_before?: number | null;
27577
+ qty_delta: number;
27578
+ reason?: string | null;
27579
+ reserved_after?: number | null;
27580
+ reserved_before?: number | null;
27581
+ trade_item_key: string;
27582
+ };
27583
+ Update: {
27584
+ connection_id?: string | null;
27585
+ created_at?: string;
27586
+ created_by?: string | null;
27587
+ id?: string;
27588
+ mutation_type?: string;
27589
+ order_id?: string | null;
27590
+ order_item_id?: string | null;
27591
+ order_source?: string | null;
27592
+ physical_after?: number | null;
27593
+ physical_before?: number | null;
27594
+ qty_delta?: number;
27595
+ reason?: string | null;
27596
+ reserved_after?: number | null;
27597
+ reserved_before?: number | null;
27598
+ trade_item_key?: string;
27599
+ };
27600
+ Relationships: [];
27601
+ };
27246
27602
  supplier_products: {
27247
27603
  Row: {
27248
27604
  article_number: string | null;
@@ -29104,6 +29460,54 @@ export declare const listMessages: import("@tanstack/start-client-core").Optiona
29104
29460
  };
29105
29461
  Returns: number;
29106
29462
  };
29463
+ afh_city_code: {
29464
+ Args: {
29465
+ _city: string;
29466
+ _country: string;
29467
+ };
29468
+ Returns: string;
29469
+ };
29470
+ afh_normalize_country: {
29471
+ Args: {
29472
+ _raw: string;
29473
+ };
29474
+ Returns: string;
29475
+ };
29476
+ afh_normalize_nl_province: {
29477
+ Args: {
29478
+ _raw: string;
29479
+ };
29480
+ Returns: string;
29481
+ };
29482
+ afh_subtract_workdays: {
29483
+ Args: {
29484
+ _date: string;
29485
+ _days: number;
29486
+ };
29487
+ Returns: string;
29488
+ };
29489
+ apply_stock_consumption: {
29490
+ Args: {
29491
+ p_order_id: string;
29492
+ p_order_item_id: string;
29493
+ p_qty: number;
29494
+ p_reason: string;
29495
+ p_source: string;
29496
+ p_trade_item_key: string;
29497
+ };
29498
+ Returns: undefined;
29499
+ };
29500
+ apply_stock_reservation: {
29501
+ Args: {
29502
+ p_order_id: string;
29503
+ p_order_item_id: string;
29504
+ p_qty: number;
29505
+ p_reason: string;
29506
+ p_source: string;
29507
+ p_trade_item_key: string;
29508
+ };
29509
+ Returns: undefined;
29510
+ };
29107
29511
  assign_cart_numbers: {
29108
29512
  Args: {
29109
29513
  p_carts: import("../integrations/supabase/types").Json;
@@ -29127,12 +29531,40 @@ export declare const listMessages: import("@tanstack/start-client-core").Optiona
29127
29531
  order_number: string;
29128
29532
  }[];
29129
29533
  };
29534
+ backfill_open_order_reservations: {
29535
+ Args: never;
29536
+ Returns: {
29537
+ processed_items: number;
29538
+ }[];
29539
+ };
29130
29540
  call_exact_route: {
29131
29541
  Args: {
29132
29542
  path: string;
29133
29543
  };
29134
29544
  Returns: number;
29135
29545
  };
29546
+ check_offer_product_available_stock: {
29547
+ Args: {
29548
+ p_campaign_product_id: string;
29549
+ p_code: string;
29550
+ p_needed_qty?: number;
29551
+ p_product_name?: string;
29552
+ };
29553
+ Returns: import("../integrations/supabase/types").Json;
29554
+ };
29555
+ check_trade_item_available_stock: {
29556
+ Args: {
29557
+ p_connection_id?: string;
29558
+ p_context?: string;
29559
+ p_needed_qty?: number;
29560
+ p_order_id?: string;
29561
+ p_order_item_id?: string;
29562
+ p_owner_id?: string;
29563
+ p_product_name?: string;
29564
+ p_trade_item_key: string;
29565
+ };
29566
+ Returns: import("../integrations/supabase/types").Json;
29567
+ };
29136
29568
  cleanup_old_bookings: {
29137
29569
  Args: never;
29138
29570
  Returns: number;
@@ -29176,6 +29608,12 @@ export declare const listMessages: import("@tanstack/start-client-core").Optiona
29176
29608
  table_name: string;
29177
29609
  }[];
29178
29610
  };
29611
+ dispatch_carrier_signups_sql: {
29612
+ Args: {
29613
+ _catchup?: string;
29614
+ };
29615
+ Returns: import("../integrations/supabase/types").Json;
29616
+ };
29179
29617
  email_auth_decrypt: {
29180
29618
  Args: {
29181
29619
  cipher: string;
@@ -29248,6 +29686,12 @@ export declare const listMessages: import("@tanstack/start-client-core").Optiona
29248
29686
  };
29249
29687
  Returns: boolean;
29250
29688
  };
29689
+ find_trade_item_key_by_name: {
29690
+ Args: {
29691
+ p_name: string;
29692
+ };
29693
+ Returns: string;
29694
+ };
29251
29695
  format_cart_number: {
29252
29696
  Args: {
29253
29697
  p_pick_date: string;
@@ -30519,6 +30963,7 @@ export declare const parseMessage: import("@tanstack/start-client-core").Optiona
30519
30963
  notes: string | null;
30520
30964
  performed_at: string;
30521
30965
  rescheduled_count: number;
30966
+ stock_consumed_at: string | null;
30522
30967
  total_carts: number;
30523
30968
  updated_at: string;
30524
30969
  user_id: string;
@@ -30532,6 +30977,7 @@ export declare const parseMessage: import("@tanstack/start-client-core").Optiona
30532
30977
  notes?: string | null;
30533
30978
  performed_at?: string;
30534
30979
  rescheduled_count?: number;
30980
+ stock_consumed_at?: string | null;
30535
30981
  total_carts?: number;
30536
30982
  updated_at?: string;
30537
30983
  user_id: string;
@@ -30545,6 +30991,7 @@ export declare const parseMessage: import("@tanstack/start-client-core").Optiona
30545
30991
  notes?: string | null;
30546
30992
  performed_at?: string;
30547
30993
  rescheduled_count?: number;
30994
+ stock_consumed_at?: string | null;
30548
30995
  total_carts?: number;
30549
30996
  updated_at?: string;
30550
30997
  user_id?: string;
@@ -36303,6 +36750,7 @@ export declare const parseMessage: import("@tanstack/start-client-core").Optiona
36303
36750
  purchase_price: number | null;
36304
36751
  quantity: number;
36305
36752
  sale_price: number | null;
36753
+ trade_item_key: string | null;
36306
36754
  unit: string;
36307
36755
  updated_at: string;
36308
36756
  weight: string | null;
@@ -36325,6 +36773,7 @@ export declare const parseMessage: import("@tanstack/start-client-core").Optiona
36325
36773
  purchase_price?: number | null;
36326
36774
  quantity?: number;
36327
36775
  sale_price?: number | null;
36776
+ trade_item_key?: string | null;
36328
36777
  unit?: string;
36329
36778
  updated_at?: string;
36330
36779
  weight?: string | null;
@@ -36347,6 +36796,7 @@ export declare const parseMessage: import("@tanstack/start-client-core").Optiona
36347
36796
  purchase_price?: number | null;
36348
36797
  quantity?: number;
36349
36798
  sale_price?: number | null;
36799
+ trade_item_key?: string | null;
36350
36800
  unit?: string;
36351
36801
  updated_at?: string;
36352
36802
  weight?: string | null;
@@ -37166,6 +37616,60 @@ export declare const parseMessage: import("@tanstack/start-client-core").Optiona
37166
37616
  };
37167
37617
  Relationships: [];
37168
37618
  };
37619
+ stock_mutation_log: {
37620
+ Row: {
37621
+ connection_id: string | null;
37622
+ created_at: string;
37623
+ created_by: string | null;
37624
+ id: string;
37625
+ mutation_type: string;
37626
+ order_id: string | null;
37627
+ order_item_id: string | null;
37628
+ order_source: string | null;
37629
+ physical_after: number | null;
37630
+ physical_before: number | null;
37631
+ qty_delta: number;
37632
+ reason: string | null;
37633
+ reserved_after: number | null;
37634
+ reserved_before: number | null;
37635
+ trade_item_key: string;
37636
+ };
37637
+ Insert: {
37638
+ connection_id?: string | null;
37639
+ created_at?: string;
37640
+ created_by?: string | null;
37641
+ id?: string;
37642
+ mutation_type: string;
37643
+ order_id?: string | null;
37644
+ order_item_id?: string | null;
37645
+ order_source?: string | null;
37646
+ physical_after?: number | null;
37647
+ physical_before?: number | null;
37648
+ qty_delta: number;
37649
+ reason?: string | null;
37650
+ reserved_after?: number | null;
37651
+ reserved_before?: number | null;
37652
+ trade_item_key: string;
37653
+ };
37654
+ Update: {
37655
+ connection_id?: string | null;
37656
+ created_at?: string;
37657
+ created_by?: string | null;
37658
+ id?: string;
37659
+ mutation_type?: string;
37660
+ order_id?: string | null;
37661
+ order_item_id?: string | null;
37662
+ order_source?: string | null;
37663
+ physical_after?: number | null;
37664
+ physical_before?: number | null;
37665
+ qty_delta?: number;
37666
+ reason?: string | null;
37667
+ reserved_after?: number | null;
37668
+ reserved_before?: number | null;
37669
+ trade_item_key?: string;
37670
+ };
37671
+ Relationships: [];
37672
+ };
37169
37673
  supplier_products: {
37170
37674
  Row: {
37171
37675
  article_number: string | null;
@@ -39027,6 +39531,54 @@ export declare const parseMessage: import("@tanstack/start-client-core").Optiona
39027
39531
  };
39028
39532
  Returns: number;
39029
39533
  };
39534
+ afh_city_code: {
39535
+ Args: {
39536
+ _city: string;
39537
+ _country: string;
39538
+ };
39539
+ Returns: string;
39540
+ };
39541
+ afh_normalize_country: {
39542
+ Args: {
39543
+ _raw: string;
39544
+ };
39545
+ Returns: string;
39546
+ };
39547
+ afh_normalize_nl_province: {
39548
+ Args: {
39549
+ _raw: string;
39550
+ };
39551
+ Returns: string;
39552
+ };
39553
+ afh_subtract_workdays: {
39554
+ Args: {
39555
+ _date: string;
39556
+ _days: number;
39557
+ };
39558
+ Returns: string;
39559
+ };
39560
+ apply_stock_consumption: {
39561
+ Args: {
39562
+ p_order_id: string;
39563
+ p_order_item_id: string;
39564
+ p_qty: number;
39565
+ p_reason: string;
39566
+ p_source: string;
39567
+ p_trade_item_key: string;
39568
+ };
39569
+ Returns: undefined;
39570
+ };
39571
+ apply_stock_reservation: {
39572
+ Args: {
39573
+ p_order_id: string;
39574
+ p_order_item_id: string;
39575
+ p_qty: number;
39576
+ p_reason: string;
39577
+ p_source: string;
39578
+ p_trade_item_key: string;
39579
+ };
39580
+ Returns: undefined;
39581
+ };
39030
39582
  assign_cart_numbers: {
39031
39583
  Args: {
39032
39584
  p_carts: import("../integrations/supabase/types").Json;
@@ -39050,12 +39602,40 @@ export declare const parseMessage: import("@tanstack/start-client-core").Optiona
39050
39602
  order_number: string;
39051
39603
  }[];
39052
39604
  };
39605
+ backfill_open_order_reservations: {
39606
+ Args: never;
39607
+ Returns: {
39608
+ processed_items: number;
39609
+ }[];
39610
+ };
39053
39611
  call_exact_route: {
39054
39612
  Args: {
39055
39613
  path: string;
39056
39614
  };
39057
39615
  Returns: number;
39058
39616
  };
39617
+ check_offer_product_available_stock: {
39618
+ Args: {
39619
+ p_campaign_product_id: string;
39620
+ p_code: string;
39621
+ p_needed_qty?: number;
39622
+ p_product_name?: string;
39623
+ };
39624
+ Returns: import("../integrations/supabase/types").Json;
39625
+ };
39626
+ check_trade_item_available_stock: {
39627
+ Args: {
39628
+ p_connection_id?: string;
39629
+ p_context?: string;
39630
+ p_needed_qty?: number;
39631
+ p_order_id?: string;
39632
+ p_order_item_id?: string;
39633
+ p_owner_id?: string;
39634
+ p_product_name?: string;
39635
+ p_trade_item_key: string;
39636
+ };
39637
+ Returns: import("../integrations/supabase/types").Json;
39638
+ };
39059
39639
  cleanup_old_bookings: {
39060
39640
  Args: never;
39061
39641
  Returns: number;
@@ -39099,6 +39679,12 @@ export declare const parseMessage: import("@tanstack/start-client-core").Optiona
39099
39679
  table_name: string;
39100
39680
  }[];
39101
39681
  };
39682
+ dispatch_carrier_signups_sql: {
39683
+ Args: {
39684
+ _catchup?: string;
39685
+ };
39686
+ Returns: import("../integrations/supabase/types").Json;
39687
+ };
39102
39688
  email_auth_decrypt: {
39103
39689
  Args: {
39104
39690
  cipher: string;
@@ -39171,6 +39757,12 @@ export declare const parseMessage: import("@tanstack/start-client-core").Optiona
39171
39757
  };
39172
39758
  Returns: boolean;
39173
39759
  };
39760
+ find_trade_item_key_by_name: {
39761
+ Args: {
39762
+ p_name: string;
39763
+ };
39764
+ Returns: string;
39765
+ };
39174
39766
  format_cart_number: {
39175
39767
  Args: {
39176
39768
  p_pick_date: string;
@@ -40434,6 +41026,7 @@ export declare const listProposals: import("@tanstack/start-client-core").Option
40434
41026
  notes: string | null;
40435
41027
  performed_at: string;
40436
41028
  rescheduled_count: number;
41029
+ stock_consumed_at: string | null;
40437
41030
  total_carts: number;
40438
41031
  updated_at: string;
40439
41032
  user_id: string;
@@ -40447,6 +41040,7 @@ export declare const listProposals: import("@tanstack/start-client-core").Option
40447
41040
  notes?: string | null;
40448
41041
  performed_at?: string;
40449
41042
  rescheduled_count?: number;
41043
+ stock_consumed_at?: string | null;
40450
41044
  total_carts?: number;
40451
41045
  updated_at?: string;
40452
41046
  user_id: string;
@@ -40460,6 +41054,7 @@ export declare const listProposals: import("@tanstack/start-client-core").Option
40460
41054
  notes?: string | null;
40461
41055
  performed_at?: string;
40462
41056
  rescheduled_count?: number;
41057
+ stock_consumed_at?: string | null;
40463
41058
  total_carts?: number;
40464
41059
  updated_at?: string;
40465
41060
  user_id?: string;
@@ -46218,6 +46813,7 @@ export declare const listProposals: import("@tanstack/start-client-core").Option
46218
46813
  purchase_price: number | null;
46219
46814
  quantity: number;
46220
46815
  sale_price: number | null;
46816
+ trade_item_key: string | null;
46221
46817
  unit: string;
46222
46818
  updated_at: string;
46223
46819
  weight: string | null;
@@ -46240,6 +46836,7 @@ export declare const listProposals: import("@tanstack/start-client-core").Option
46240
46836
  purchase_price?: number | null;
46241
46837
  quantity?: number;
46242
46838
  sale_price?: number | null;
46839
+ trade_item_key?: string | null;
46243
46840
  unit?: string;
46244
46841
  updated_at?: string;
46245
46842
  weight?: string | null;
@@ -46262,6 +46859,7 @@ export declare const listProposals: import("@tanstack/start-client-core").Option
46262
46859
  purchase_price?: number | null;
46263
46860
  quantity?: number;
46264
46861
  sale_price?: number | null;
46862
+ trade_item_key?: string | null;
46265
46863
  unit?: string;
46266
46864
  updated_at?: string;
46267
46865
  weight?: string | null;
@@ -47081,6 +47679,60 @@ export declare const listProposals: import("@tanstack/start-client-core").Option
47081
47679
  };
47082
47680
  Relationships: [];
47083
47681
  };
47682
+ stock_mutation_log: {
47683
+ Row: {
47684
+ connection_id: string | null;
47685
+ created_at: string;
47686
+ created_by: string | null;
47687
+ id: string;
47688
+ mutation_type: string;
47689
+ order_id: string | null;
47690
+ order_item_id: string | null;
47691
+ order_source: string | null;
47692
+ physical_after: number | null;
47693
+ physical_before: number | null;
47694
+ qty_delta: number;
47695
+ reason: string | null;
47696
+ reserved_after: number | null;
47697
+ reserved_before: number | null;
47698
+ trade_item_key: string;
47699
+ };
47700
+ Insert: {
47701
+ connection_id?: string | null;
47702
+ created_at?: string;
47703
+ created_by?: string | null;
47704
+ id?: string;
47705
+ mutation_type: string;
47706
+ order_id?: string | null;
47707
+ order_item_id?: string | null;
47708
+ order_source?: string | null;
47709
+ physical_after?: number | null;
47710
+ physical_before?: number | null;
47711
+ qty_delta: number;
47712
+ reason?: string | null;
47713
+ reserved_after?: number | null;
47714
+ reserved_before?: number | null;
47715
+ trade_item_key: string;
47716
+ };
47717
+ Update: {
47718
+ connection_id?: string | null;
47719
+ created_at?: string;
47720
+ created_by?: string | null;
47721
+ id?: string;
47722
+ mutation_type?: string;
47723
+ order_id?: string | null;
47724
+ order_item_id?: string | null;
47725
+ order_source?: string | null;
47726
+ physical_after?: number | null;
47727
+ physical_before?: number | null;
47728
+ qty_delta?: number;
47729
+ reason?: string | null;
47730
+ reserved_after?: number | null;
47731
+ reserved_before?: number | null;
47732
+ trade_item_key?: string;
47733
+ };
47734
+ Relationships: [];
47735
+ };
47084
47736
  supplier_products: {
47085
47737
  Row: {
47086
47738
  article_number: string | null;
@@ -48942,6 +49594,54 @@ export declare const listProposals: import("@tanstack/start-client-core").Option
48942
49594
  };
48943
49595
  Returns: number;
48944
49596
  };
49597
+ afh_city_code: {
49598
+ Args: {
49599
+ _city: string;
49600
+ _country: string;
49601
+ };
49602
+ Returns: string;
49603
+ };
49604
+ afh_normalize_country: {
49605
+ Args: {
49606
+ _raw: string;
49607
+ };
49608
+ Returns: string;
49609
+ };
49610
+ afh_normalize_nl_province: {
49611
+ Args: {
49612
+ _raw: string;
49613
+ };
49614
+ Returns: string;
49615
+ };
49616
+ afh_subtract_workdays: {
49617
+ Args: {
49618
+ _date: string;
49619
+ _days: number;
49620
+ };
49621
+ Returns: string;
49622
+ };
49623
+ apply_stock_consumption: {
49624
+ Args: {
49625
+ p_order_id: string;
49626
+ p_order_item_id: string;
49627
+ p_qty: number;
49628
+ p_reason: string;
49629
+ p_source: string;
49630
+ p_trade_item_key: string;
49631
+ };
49632
+ Returns: undefined;
49633
+ };
49634
+ apply_stock_reservation: {
49635
+ Args: {
49636
+ p_order_id: string;
49637
+ p_order_item_id: string;
49638
+ p_qty: number;
49639
+ p_reason: string;
49640
+ p_source: string;
49641
+ p_trade_item_key: string;
49642
+ };
49643
+ Returns: undefined;
49644
+ };
48945
49645
  assign_cart_numbers: {
48946
49646
  Args: {
48947
49647
  p_carts: import("../integrations/supabase/types").Json;
@@ -48965,12 +49665,40 @@ export declare const listProposals: import("@tanstack/start-client-core").Option
48965
49665
  order_number: string;
48966
49666
  }[];
48967
49667
  };
49668
+ backfill_open_order_reservations: {
49669
+ Args: never;
49670
+ Returns: {
49671
+ processed_items: number;
49672
+ }[];
49673
+ };
48968
49674
  call_exact_route: {
48969
49675
  Args: {
48970
49676
  path: string;
48971
49677
  };
48972
49678
  Returns: number;
48973
49679
  };
49680
+ check_offer_product_available_stock: {
49681
+ Args: {
49682
+ p_campaign_product_id: string;
49683
+ p_code: string;
49684
+ p_needed_qty?: number;
49685
+ p_product_name?: string;
49686
+ };
49687
+ Returns: import("../integrations/supabase/types").Json;
49688
+ };
49689
+ check_trade_item_available_stock: {
49690
+ Args: {
49691
+ p_connection_id?: string;
49692
+ p_context?: string;
49693
+ p_needed_qty?: number;
49694
+ p_order_id?: string;
49695
+ p_order_item_id?: string;
49696
+ p_owner_id?: string;
49697
+ p_product_name?: string;
49698
+ p_trade_item_key: string;
49699
+ };
49700
+ Returns: import("../integrations/supabase/types").Json;
49701
+ };
48974
49702
  cleanup_old_bookings: {
48975
49703
  Args: never;
48976
49704
  Returns: number;
@@ -49014,6 +49742,12 @@ export declare const listProposals: import("@tanstack/start-client-core").Option
49014
49742
  table_name: string;
49015
49743
  }[];
49016
49744
  };
49745
+ dispatch_carrier_signups_sql: {
49746
+ Args: {
49747
+ _catchup?: string;
49748
+ };
49749
+ Returns: import("../integrations/supabase/types").Json;
49750
+ };
49017
49751
  email_auth_decrypt: {
49018
49752
  Args: {
49019
49753
  cipher: string;
@@ -49086,6 +49820,12 @@ export declare const listProposals: import("@tanstack/start-client-core").Option
49086
49820
  };
49087
49821
  Returns: boolean;
49088
49822
  };
49823
+ find_trade_item_key_by_name: {
49824
+ Args: {
49825
+ p_name: string;
49826
+ };
49827
+ Returns: string;
49828
+ };
49089
49829
  format_cart_number: {
49090
49830
  Args: {
49091
49831
  p_pick_date: string;
@@ -50394,6 +51134,7 @@ export declare const approveProposal: import("@tanstack/start-client-core").Opti
50394
51134
  notes: string | null;
50395
51135
  performed_at: string;
50396
51136
  rescheduled_count: number;
51137
+ stock_consumed_at: string | null;
50397
51138
  total_carts: number;
50398
51139
  updated_at: string;
50399
51140
  user_id: string;
@@ -50407,6 +51148,7 @@ export declare const approveProposal: import("@tanstack/start-client-core").Opti
50407
51148
  notes?: string | null;
50408
51149
  performed_at?: string;
50409
51150
  rescheduled_count?: number;
51151
+ stock_consumed_at?: string | null;
50410
51152
  total_carts?: number;
50411
51153
  updated_at?: string;
50412
51154
  user_id: string;
@@ -50420,6 +51162,7 @@ export declare const approveProposal: import("@tanstack/start-client-core").Opti
50420
51162
  notes?: string | null;
50421
51163
  performed_at?: string;
50422
51164
  rescheduled_count?: number;
51165
+ stock_consumed_at?: string | null;
50423
51166
  total_carts?: number;
50424
51167
  updated_at?: string;
50425
51168
  user_id?: string;
@@ -56178,6 +56921,7 @@ export declare const approveProposal: import("@tanstack/start-client-core").Opti
56178
56921
  purchase_price: number | null;
56179
56922
  quantity: number;
56180
56923
  sale_price: number | null;
56924
+ trade_item_key: string | null;
56181
56925
  unit: string;
56182
56926
  updated_at: string;
56183
56927
  weight: string | null;
@@ -56200,6 +56944,7 @@ export declare const approveProposal: import("@tanstack/start-client-core").Opti
56200
56944
  purchase_price?: number | null;
56201
56945
  quantity?: number;
56202
56946
  sale_price?: number | null;
56947
+ trade_item_key?: string | null;
56203
56948
  unit?: string;
56204
56949
  updated_at?: string;
56205
56950
  weight?: string | null;
@@ -56222,6 +56967,7 @@ export declare const approveProposal: import("@tanstack/start-client-core").Opti
56222
56967
  purchase_price?: number | null;
56223
56968
  quantity?: number;
56224
56969
  sale_price?: number | null;
56970
+ trade_item_key?: string | null;
56225
56971
  unit?: string;
56226
56972
  updated_at?: string;
56227
56973
  weight?: string | null;
@@ -57041,6 +57787,60 @@ export declare const approveProposal: import("@tanstack/start-client-core").Opti
57041
57787
  };
57042
57788
  Relationships: [];
57043
57789
  };
57790
+ stock_mutation_log: {
57791
+ Row: {
57792
+ connection_id: string | null;
57793
+ created_at: string;
57794
+ created_by: string | null;
57795
+ id: string;
57796
+ mutation_type: string;
57797
+ order_id: string | null;
57798
+ order_item_id: string | null;
57799
+ order_source: string | null;
57800
+ physical_after: number | null;
57801
+ physical_before: number | null;
57802
+ qty_delta: number;
57803
+ reason: string | null;
57804
+ reserved_after: number | null;
57805
+ reserved_before: number | null;
57806
+ trade_item_key: string;
57807
+ };
57808
+ Insert: {
57809
+ connection_id?: string | null;
57810
+ created_at?: string;
57811
+ created_by?: string | null;
57812
+ id?: string;
57813
+ mutation_type: string;
57814
+ order_id?: string | null;
57815
+ order_item_id?: string | null;
57816
+ order_source?: string | null;
57817
+ physical_after?: number | null;
57818
+ physical_before?: number | null;
57819
+ qty_delta: number;
57820
+ reason?: string | null;
57821
+ reserved_after?: number | null;
57822
+ reserved_before?: number | null;
57823
+ trade_item_key: string;
57824
+ };
57825
+ Update: {
57826
+ connection_id?: string | null;
57827
+ created_at?: string;
57828
+ created_by?: string | null;
57829
+ id?: string;
57830
+ mutation_type?: string;
57831
+ order_id?: string | null;
57832
+ order_item_id?: string | null;
57833
+ order_source?: string | null;
57834
+ physical_after?: number | null;
57835
+ physical_before?: number | null;
57836
+ qty_delta?: number;
57837
+ reason?: string | null;
57838
+ reserved_after?: number | null;
57839
+ reserved_before?: number | null;
57840
+ trade_item_key?: string;
57841
+ };
57842
+ Relationships: [];
57843
+ };
57044
57844
  supplier_products: {
57045
57845
  Row: {
57046
57846
  article_number: string | null;
@@ -58902,6 +59702,54 @@ export declare const approveProposal: import("@tanstack/start-client-core").Opti
58902
59702
  };
58903
59703
  Returns: number;
58904
59704
  };
59705
+ afh_city_code: {
59706
+ Args: {
59707
+ _city: string;
59708
+ _country: string;
59709
+ };
59710
+ Returns: string;
59711
+ };
59712
+ afh_normalize_country: {
59713
+ Args: {
59714
+ _raw: string;
59715
+ };
59716
+ Returns: string;
59717
+ };
59718
+ afh_normalize_nl_province: {
59719
+ Args: {
59720
+ _raw: string;
59721
+ };
59722
+ Returns: string;
59723
+ };
59724
+ afh_subtract_workdays: {
59725
+ Args: {
59726
+ _date: string;
59727
+ _days: number;
59728
+ };
59729
+ Returns: string;
59730
+ };
59731
+ apply_stock_consumption: {
59732
+ Args: {
59733
+ p_order_id: string;
59734
+ p_order_item_id: string;
59735
+ p_qty: number;
59736
+ p_reason: string;
59737
+ p_source: string;
59738
+ p_trade_item_key: string;
59739
+ };
59740
+ Returns: undefined;
59741
+ };
59742
+ apply_stock_reservation: {
59743
+ Args: {
59744
+ p_order_id: string;
59745
+ p_order_item_id: string;
59746
+ p_qty: number;
59747
+ p_reason: string;
59748
+ p_source: string;
59749
+ p_trade_item_key: string;
59750
+ };
59751
+ Returns: undefined;
59752
+ };
58905
59753
  assign_cart_numbers: {
58906
59754
  Args: {
58907
59755
  p_carts: import("../integrations/supabase/types").Json;
@@ -58925,12 +59773,40 @@ export declare const approveProposal: import("@tanstack/start-client-core").Opti
58925
59773
  order_number: string;
58926
59774
  }[];
58927
59775
  };
59776
+ backfill_open_order_reservations: {
59777
+ Args: never;
59778
+ Returns: {
59779
+ processed_items: number;
59780
+ }[];
59781
+ };
58928
59782
  call_exact_route: {
58929
59783
  Args: {
58930
59784
  path: string;
58931
59785
  };
58932
59786
  Returns: number;
58933
59787
  };
59788
+ check_offer_product_available_stock: {
59789
+ Args: {
59790
+ p_campaign_product_id: string;
59791
+ p_code: string;
59792
+ p_needed_qty?: number;
59793
+ p_product_name?: string;
59794
+ };
59795
+ Returns: import("../integrations/supabase/types").Json;
59796
+ };
59797
+ check_trade_item_available_stock: {
59798
+ Args: {
59799
+ p_connection_id?: string;
59800
+ p_context?: string;
59801
+ p_needed_qty?: number;
59802
+ p_order_id?: string;
59803
+ p_order_item_id?: string;
59804
+ p_owner_id?: string;
59805
+ p_product_name?: string;
59806
+ p_trade_item_key: string;
59807
+ };
59808
+ Returns: import("../integrations/supabase/types").Json;
59809
+ };
58934
59810
  cleanup_old_bookings: {
58935
59811
  Args: never;
58936
59812
  Returns: number;
@@ -58974,6 +59850,12 @@ export declare const approveProposal: import("@tanstack/start-client-core").Opti
58974
59850
  table_name: string;
58975
59851
  }[];
58976
59852
  };
59853
+ dispatch_carrier_signups_sql: {
59854
+ Args: {
59855
+ _catchup?: string;
59856
+ };
59857
+ Returns: import("../integrations/supabase/types").Json;
59858
+ };
58977
59859
  email_auth_decrypt: {
58978
59860
  Args: {
58979
59861
  cipher: string;
@@ -59046,6 +59928,12 @@ export declare const approveProposal: import("@tanstack/start-client-core").Opti
59046
59928
  };
59047
59929
  Returns: boolean;
59048
59930
  };
59931
+ find_trade_item_key_by_name: {
59932
+ Args: {
59933
+ p_name: string;
59934
+ };
59935
+ Returns: string;
59936
+ };
59049
59937
  format_cart_number: {
59050
59938
  Args: {
59051
59939
  p_pick_date: string;
@@ -60325,6 +61213,7 @@ export declare const rejectProposal: import("@tanstack/start-client-core").Optio
60325
61213
  notes: string | null;
60326
61214
  performed_at: string;
60327
61215
  rescheduled_count: number;
61216
+ stock_consumed_at: string | null;
60328
61217
  total_carts: number;
60329
61218
  updated_at: string;
60330
61219
  user_id: string;
@@ -60338,6 +61227,7 @@ export declare const rejectProposal: import("@tanstack/start-client-core").Optio
60338
61227
  notes?: string | null;
60339
61228
  performed_at?: string;
60340
61229
  rescheduled_count?: number;
61230
+ stock_consumed_at?: string | null;
60341
61231
  total_carts?: number;
60342
61232
  updated_at?: string;
60343
61233
  user_id: string;
@@ -60351,6 +61241,7 @@ export declare const rejectProposal: import("@tanstack/start-client-core").Optio
60351
61241
  notes?: string | null;
60352
61242
  performed_at?: string;
60353
61243
  rescheduled_count?: number;
61244
+ stock_consumed_at?: string | null;
60354
61245
  total_carts?: number;
60355
61246
  updated_at?: string;
60356
61247
  user_id?: string;
@@ -66109,6 +67000,7 @@ export declare const rejectProposal: import("@tanstack/start-client-core").Optio
66109
67000
  purchase_price: number | null;
66110
67001
  quantity: number;
66111
67002
  sale_price: number | null;
67003
+ trade_item_key: string | null;
66112
67004
  unit: string;
66113
67005
  updated_at: string;
66114
67006
  weight: string | null;
@@ -66131,6 +67023,7 @@ export declare const rejectProposal: import("@tanstack/start-client-core").Optio
66131
67023
  purchase_price?: number | null;
66132
67024
  quantity?: number;
66133
67025
  sale_price?: number | null;
67026
+ trade_item_key?: string | null;
66134
67027
  unit?: string;
66135
67028
  updated_at?: string;
66136
67029
  weight?: string | null;
@@ -66153,6 +67046,7 @@ export declare const rejectProposal: import("@tanstack/start-client-core").Optio
66153
67046
  purchase_price?: number | null;
66154
67047
  quantity?: number;
66155
67048
  sale_price?: number | null;
67049
+ trade_item_key?: string | null;
66156
67050
  unit?: string;
66157
67051
  updated_at?: string;
66158
67052
  weight?: string | null;
@@ -66972,6 +67866,60 @@ export declare const rejectProposal: import("@tanstack/start-client-core").Optio
66972
67866
  };
66973
67867
  Relationships: [];
66974
67868
  };
67869
+ stock_mutation_log: {
67870
+ Row: {
67871
+ connection_id: string | null;
67872
+ created_at: string;
67873
+ created_by: string | null;
67874
+ id: string;
67875
+ mutation_type: string;
67876
+ order_id: string | null;
67877
+ order_item_id: string | null;
67878
+ order_source: string | null;
67879
+ physical_after: number | null;
67880
+ physical_before: number | null;
67881
+ qty_delta: number;
67882
+ reason: string | null;
67883
+ reserved_after: number | null;
67884
+ reserved_before: number | null;
67885
+ trade_item_key: string;
67886
+ };
67887
+ Insert: {
67888
+ connection_id?: string | null;
67889
+ created_at?: string;
67890
+ created_by?: string | null;
67891
+ id?: string;
67892
+ mutation_type: string;
67893
+ order_id?: string | null;
67894
+ order_item_id?: string | null;
67895
+ order_source?: string | null;
67896
+ physical_after?: number | null;
67897
+ physical_before?: number | null;
67898
+ qty_delta: number;
67899
+ reason?: string | null;
67900
+ reserved_after?: number | null;
67901
+ reserved_before?: number | null;
67902
+ trade_item_key: string;
67903
+ };
67904
+ Update: {
67905
+ connection_id?: string | null;
67906
+ created_at?: string;
67907
+ created_by?: string | null;
67908
+ id?: string;
67909
+ mutation_type?: string;
67910
+ order_id?: string | null;
67911
+ order_item_id?: string | null;
67912
+ order_source?: string | null;
67913
+ physical_after?: number | null;
67914
+ physical_before?: number | null;
67915
+ qty_delta?: number;
67916
+ reason?: string | null;
67917
+ reserved_after?: number | null;
67918
+ reserved_before?: number | null;
67919
+ trade_item_key?: string;
67920
+ };
67921
+ Relationships: [];
67922
+ };
66975
67923
  supplier_products: {
66976
67924
  Row: {
66977
67925
  article_number: string | null;
@@ -68833,6 +69781,54 @@ export declare const rejectProposal: import("@tanstack/start-client-core").Optio
68833
69781
  };
68834
69782
  Returns: number;
68835
69783
  };
69784
+ afh_city_code: {
69785
+ Args: {
69786
+ _city: string;
69787
+ _country: string;
69788
+ };
69789
+ Returns: string;
69790
+ };
69791
+ afh_normalize_country: {
69792
+ Args: {
69793
+ _raw: string;
69794
+ };
69795
+ Returns: string;
69796
+ };
69797
+ afh_normalize_nl_province: {
69798
+ Args: {
69799
+ _raw: string;
69800
+ };
69801
+ Returns: string;
69802
+ };
69803
+ afh_subtract_workdays: {
69804
+ Args: {
69805
+ _date: string;
69806
+ _days: number;
69807
+ };
69808
+ Returns: string;
69809
+ };
69810
+ apply_stock_consumption: {
69811
+ Args: {
69812
+ p_order_id: string;
69813
+ p_order_item_id: string;
69814
+ p_qty: number;
69815
+ p_reason: string;
69816
+ p_source: string;
69817
+ p_trade_item_key: string;
69818
+ };
69819
+ Returns: undefined;
69820
+ };
69821
+ apply_stock_reservation: {
69822
+ Args: {
69823
+ p_order_id: string;
69824
+ p_order_item_id: string;
69825
+ p_qty: number;
69826
+ p_reason: string;
69827
+ p_source: string;
69828
+ p_trade_item_key: string;
69829
+ };
69830
+ Returns: undefined;
69831
+ };
68836
69832
  assign_cart_numbers: {
68837
69833
  Args: {
68838
69834
  p_carts: import("../integrations/supabase/types").Json;
@@ -68856,12 +69852,40 @@ export declare const rejectProposal: import("@tanstack/start-client-core").Optio
68856
69852
  order_number: string;
68857
69853
  }[];
68858
69854
  };
69855
+ backfill_open_order_reservations: {
69856
+ Args: never;
69857
+ Returns: {
69858
+ processed_items: number;
69859
+ }[];
69860
+ };
68859
69861
  call_exact_route: {
68860
69862
  Args: {
68861
69863
  path: string;
68862
69864
  };
68863
69865
  Returns: number;
68864
69866
  };
69867
+ check_offer_product_available_stock: {
69868
+ Args: {
69869
+ p_campaign_product_id: string;
69870
+ p_code: string;
69871
+ p_needed_qty?: number;
69872
+ p_product_name?: string;
69873
+ };
69874
+ Returns: import("../integrations/supabase/types").Json;
69875
+ };
69876
+ check_trade_item_available_stock: {
69877
+ Args: {
69878
+ p_connection_id?: string;
69879
+ p_context?: string;
69880
+ p_needed_qty?: number;
69881
+ p_order_id?: string;
69882
+ p_order_item_id?: string;
69883
+ p_owner_id?: string;
69884
+ p_product_name?: string;
69885
+ p_trade_item_key: string;
69886
+ };
69887
+ Returns: import("../integrations/supabase/types").Json;
69888
+ };
68865
69889
  cleanup_old_bookings: {
68866
69890
  Args: never;
68867
69891
  Returns: number;
@@ -68905,6 +69929,12 @@ export declare const rejectProposal: import("@tanstack/start-client-core").Optio
68905
69929
  table_name: string;
68906
69930
  }[];
68907
69931
  };
69932
+ dispatch_carrier_signups_sql: {
69933
+ Args: {
69934
+ _catchup?: string;
69935
+ };
69936
+ Returns: import("../integrations/supabase/types").Json;
69937
+ };
68908
69938
  email_auth_decrypt: {
68909
69939
  Args: {
68910
69940
  cipher: string;
@@ -68977,6 +70007,12 @@ export declare const rejectProposal: import("@tanstack/start-client-core").Optio
68977
70007
  };
68978
70008
  Returns: boolean;
68979
70009
  };
70010
+ find_trade_item_key_by_name: {
70011
+ Args: {
70012
+ p_name: string;
70013
+ };
70014
+ Returns: string;
70015
+ };
68980
70016
  format_cart_number: {
68981
70017
  Args: {
68982
70018
  p_pick_date: string;
@@ -70241,6 +71277,7 @@ export declare const reopenProposal: import("@tanstack/start-client-core").Optio
70241
71277
  notes: string | null;
70242
71278
  performed_at: string;
70243
71279
  rescheduled_count: number;
71280
+ stock_consumed_at: string | null;
70244
71281
  total_carts: number;
70245
71282
  updated_at: string;
70246
71283
  user_id: string;
@@ -70254,6 +71291,7 @@ export declare const reopenProposal: import("@tanstack/start-client-core").Optio
70254
71291
  notes?: string | null;
70255
71292
  performed_at?: string;
70256
71293
  rescheduled_count?: number;
71294
+ stock_consumed_at?: string | null;
70257
71295
  total_carts?: number;
70258
71296
  updated_at?: string;
70259
71297
  user_id: string;
@@ -70267,6 +71305,7 @@ export declare const reopenProposal: import("@tanstack/start-client-core").Optio
70267
71305
  notes?: string | null;
70268
71306
  performed_at?: string;
70269
71307
  rescheduled_count?: number;
71308
+ stock_consumed_at?: string | null;
70270
71309
  total_carts?: number;
70271
71310
  updated_at?: string;
70272
71311
  user_id?: string;
@@ -76025,6 +77064,7 @@ export declare const reopenProposal: import("@tanstack/start-client-core").Optio
76025
77064
  purchase_price: number | null;
76026
77065
  quantity: number;
76027
77066
  sale_price: number | null;
77067
+ trade_item_key: string | null;
76028
77068
  unit: string;
76029
77069
  updated_at: string;
76030
77070
  weight: string | null;
@@ -76047,6 +77087,7 @@ export declare const reopenProposal: import("@tanstack/start-client-core").Optio
76047
77087
  purchase_price?: number | null;
76048
77088
  quantity?: number;
76049
77089
  sale_price?: number | null;
77090
+ trade_item_key?: string | null;
76050
77091
  unit?: string;
76051
77092
  updated_at?: string;
76052
77093
  weight?: string | null;
@@ -76069,6 +77110,7 @@ export declare const reopenProposal: import("@tanstack/start-client-core").Optio
76069
77110
  purchase_price?: number | null;
76070
77111
  quantity?: number;
76071
77112
  sale_price?: number | null;
77113
+ trade_item_key?: string | null;
76072
77114
  unit?: string;
76073
77115
  updated_at?: string;
76074
77116
  weight?: string | null;
@@ -76888,6 +77930,60 @@ export declare const reopenProposal: import("@tanstack/start-client-core").Optio
76888
77930
  };
76889
77931
  Relationships: [];
76890
77932
  };
77933
+ stock_mutation_log: {
77934
+ Row: {
77935
+ connection_id: string | null;
77936
+ created_at: string;
77937
+ created_by: string | null;
77938
+ id: string;
77939
+ mutation_type: string;
77940
+ order_id: string | null;
77941
+ order_item_id: string | null;
77942
+ order_source: string | null;
77943
+ physical_after: number | null;
77944
+ physical_before: number | null;
77945
+ qty_delta: number;
77946
+ reason: string | null;
77947
+ reserved_after: number | null;
77948
+ reserved_before: number | null;
77949
+ trade_item_key: string;
77950
+ };
77951
+ Insert: {
77952
+ connection_id?: string | null;
77953
+ created_at?: string;
77954
+ created_by?: string | null;
77955
+ id?: string;
77956
+ mutation_type: string;
77957
+ order_id?: string | null;
77958
+ order_item_id?: string | null;
77959
+ order_source?: string | null;
77960
+ physical_after?: number | null;
77961
+ physical_before?: number | null;
77962
+ qty_delta: number;
77963
+ reason?: string | null;
77964
+ reserved_after?: number | null;
77965
+ reserved_before?: number | null;
77966
+ trade_item_key: string;
77967
+ };
77968
+ Update: {
77969
+ connection_id?: string | null;
77970
+ created_at?: string;
77971
+ created_by?: string | null;
77972
+ id?: string;
77973
+ mutation_type?: string;
77974
+ order_id?: string | null;
77975
+ order_item_id?: string | null;
77976
+ order_source?: string | null;
77977
+ physical_after?: number | null;
77978
+ physical_before?: number | null;
77979
+ qty_delta?: number;
77980
+ reason?: string | null;
77981
+ reserved_after?: number | null;
77982
+ reserved_before?: number | null;
77983
+ trade_item_key?: string;
77984
+ };
77985
+ Relationships: [];
77986
+ };
76891
77987
  supplier_products: {
76892
77988
  Row: {
76893
77989
  article_number: string | null;
@@ -78749,6 +79845,54 @@ export declare const reopenProposal: import("@tanstack/start-client-core").Optio
78749
79845
  };
78750
79846
  Returns: number;
78751
79847
  };
79848
+ afh_city_code: {
79849
+ Args: {
79850
+ _city: string;
79851
+ _country: string;
79852
+ };
79853
+ Returns: string;
79854
+ };
79855
+ afh_normalize_country: {
79856
+ Args: {
79857
+ _raw: string;
79858
+ };
79859
+ Returns: string;
79860
+ };
79861
+ afh_normalize_nl_province: {
79862
+ Args: {
79863
+ _raw: string;
79864
+ };
79865
+ Returns: string;
79866
+ };
79867
+ afh_subtract_workdays: {
79868
+ Args: {
79869
+ _date: string;
79870
+ _days: number;
79871
+ };
79872
+ Returns: string;
79873
+ };
79874
+ apply_stock_consumption: {
79875
+ Args: {
79876
+ p_order_id: string;
79877
+ p_order_item_id: string;
79878
+ p_qty: number;
79879
+ p_reason: string;
79880
+ p_source: string;
79881
+ p_trade_item_key: string;
79882
+ };
79883
+ Returns: undefined;
79884
+ };
79885
+ apply_stock_reservation: {
79886
+ Args: {
79887
+ p_order_id: string;
79888
+ p_order_item_id: string;
79889
+ p_qty: number;
79890
+ p_reason: string;
79891
+ p_source: string;
79892
+ p_trade_item_key: string;
79893
+ };
79894
+ Returns: undefined;
79895
+ };
78752
79896
  assign_cart_numbers: {
78753
79897
  Args: {
78754
79898
  p_carts: import("../integrations/supabase/types").Json;
@@ -78772,12 +79916,40 @@ export declare const reopenProposal: import("@tanstack/start-client-core").Optio
78772
79916
  order_number: string;
78773
79917
  }[];
78774
79918
  };
79919
+ backfill_open_order_reservations: {
79920
+ Args: never;
79921
+ Returns: {
79922
+ processed_items: number;
79923
+ }[];
79924
+ };
78775
79925
  call_exact_route: {
78776
79926
  Args: {
78777
79927
  path: string;
78778
79928
  };
78779
79929
  Returns: number;
78780
79930
  };
79931
+ check_offer_product_available_stock: {
79932
+ Args: {
79933
+ p_campaign_product_id: string;
79934
+ p_code: string;
79935
+ p_needed_qty?: number;
79936
+ p_product_name?: string;
79937
+ };
79938
+ Returns: import("../integrations/supabase/types").Json;
79939
+ };
79940
+ check_trade_item_available_stock: {
79941
+ Args: {
79942
+ p_connection_id?: string;
79943
+ p_context?: string;
79944
+ p_needed_qty?: number;
79945
+ p_order_id?: string;
79946
+ p_order_item_id?: string;
79947
+ p_owner_id?: string;
79948
+ p_product_name?: string;
79949
+ p_trade_item_key: string;
79950
+ };
79951
+ Returns: import("../integrations/supabase/types").Json;
79952
+ };
78781
79953
  cleanup_old_bookings: {
78782
79954
  Args: never;
78783
79955
  Returns: number;
@@ -78821,6 +79993,12 @@ export declare const reopenProposal: import("@tanstack/start-client-core").Optio
78821
79993
  table_name: string;
78822
79994
  }[];
78823
79995
  };
79996
+ dispatch_carrier_signups_sql: {
79997
+ Args: {
79998
+ _catchup?: string;
79999
+ };
80000
+ Returns: import("../integrations/supabase/types").Json;
80001
+ };
78824
80002
  email_auth_decrypt: {
78825
80003
  Args: {
78826
80004
  cipher: string;
@@ -78893,6 +80071,12 @@ export declare const reopenProposal: import("@tanstack/start-client-core").Optio
78893
80071
  };
78894
80072
  Returns: boolean;
78895
80073
  };
80074
+ find_trade_item_key_by_name: {
80075
+ Args: {
80076
+ p_name: string;
80077
+ };
80078
+ Returns: string;
80079
+ };
78896
80080
  format_cart_number: {
78897
80081
  Args: {
78898
80082
  p_pick_date: string;
@@ -80156,6 +81340,7 @@ export declare const listCustomersForPicker: import("@tanstack/start-client-core
80156
81340
  notes: string | null;
80157
81341
  performed_at: string;
80158
81342
  rescheduled_count: number;
81343
+ stock_consumed_at: string | null;
80159
81344
  total_carts: number;
80160
81345
  updated_at: string;
80161
81346
  user_id: string;
@@ -80169,6 +81354,7 @@ export declare const listCustomersForPicker: import("@tanstack/start-client-core
80169
81354
  notes?: string | null;
80170
81355
  performed_at?: string;
80171
81356
  rescheduled_count?: number;
81357
+ stock_consumed_at?: string | null;
80172
81358
  total_carts?: number;
80173
81359
  updated_at?: string;
80174
81360
  user_id: string;
@@ -80182,6 +81368,7 @@ export declare const listCustomersForPicker: import("@tanstack/start-client-core
80182
81368
  notes?: string | null;
80183
81369
  performed_at?: string;
80184
81370
  rescheduled_count?: number;
81371
+ stock_consumed_at?: string | null;
80185
81372
  total_carts?: number;
80186
81373
  updated_at?: string;
80187
81374
  user_id?: string;
@@ -85940,6 +87127,7 @@ export declare const listCustomersForPicker: import("@tanstack/start-client-core
85940
87127
  purchase_price: number | null;
85941
87128
  quantity: number;
85942
87129
  sale_price: number | null;
87130
+ trade_item_key: string | null;
85943
87131
  unit: string;
85944
87132
  updated_at: string;
85945
87133
  weight: string | null;
@@ -85962,6 +87150,7 @@ export declare const listCustomersForPicker: import("@tanstack/start-client-core
85962
87150
  purchase_price?: number | null;
85963
87151
  quantity?: number;
85964
87152
  sale_price?: number | null;
87153
+ trade_item_key?: string | null;
85965
87154
  unit?: string;
85966
87155
  updated_at?: string;
85967
87156
  weight?: string | null;
@@ -85984,6 +87173,7 @@ export declare const listCustomersForPicker: import("@tanstack/start-client-core
85984
87173
  purchase_price?: number | null;
85985
87174
  quantity?: number;
85986
87175
  sale_price?: number | null;
87176
+ trade_item_key?: string | null;
85987
87177
  unit?: string;
85988
87178
  updated_at?: string;
85989
87179
  weight?: string | null;
@@ -86803,6 +87993,60 @@ export declare const listCustomersForPicker: import("@tanstack/start-client-core
86803
87993
  };
86804
87994
  Relationships: [];
86805
87995
  };
87996
+ stock_mutation_log: {
87997
+ Row: {
87998
+ connection_id: string | null;
87999
+ created_at: string;
88000
+ created_by: string | null;
88001
+ id: string;
88002
+ mutation_type: string;
88003
+ order_id: string | null;
88004
+ order_item_id: string | null;
88005
+ order_source: string | null;
88006
+ physical_after: number | null;
88007
+ physical_before: number | null;
88008
+ qty_delta: number;
88009
+ reason: string | null;
88010
+ reserved_after: number | null;
88011
+ reserved_before: number | null;
88012
+ trade_item_key: string;
88013
+ };
88014
+ Insert: {
88015
+ connection_id?: string | null;
88016
+ created_at?: string;
88017
+ created_by?: string | null;
88018
+ id?: string;
88019
+ mutation_type: string;
88020
+ order_id?: string | null;
88021
+ order_item_id?: string | null;
88022
+ order_source?: string | null;
88023
+ physical_after?: number | null;
88024
+ physical_before?: number | null;
88025
+ qty_delta: number;
88026
+ reason?: string | null;
88027
+ reserved_after?: number | null;
88028
+ reserved_before?: number | null;
88029
+ trade_item_key: string;
88030
+ };
88031
+ Update: {
88032
+ connection_id?: string | null;
88033
+ created_at?: string;
88034
+ created_by?: string | null;
88035
+ id?: string;
88036
+ mutation_type?: string;
88037
+ order_id?: string | null;
88038
+ order_item_id?: string | null;
88039
+ order_source?: string | null;
88040
+ physical_after?: number | null;
88041
+ physical_before?: number | null;
88042
+ qty_delta?: number;
88043
+ reason?: string | null;
88044
+ reserved_after?: number | null;
88045
+ reserved_before?: number | null;
88046
+ trade_item_key?: string;
88047
+ };
88048
+ Relationships: [];
88049
+ };
86806
88050
  supplier_products: {
86807
88051
  Row: {
86808
88052
  article_number: string | null;
@@ -88664,6 +89908,54 @@ export declare const listCustomersForPicker: import("@tanstack/start-client-core
88664
89908
  };
88665
89909
  Returns: number;
88666
89910
  };
89911
+ afh_city_code: {
89912
+ Args: {
89913
+ _city: string;
89914
+ _country: string;
89915
+ };
89916
+ Returns: string;
89917
+ };
89918
+ afh_normalize_country: {
89919
+ Args: {
89920
+ _raw: string;
89921
+ };
89922
+ Returns: string;
89923
+ };
89924
+ afh_normalize_nl_province: {
89925
+ Args: {
89926
+ _raw: string;
89927
+ };
89928
+ Returns: string;
89929
+ };
89930
+ afh_subtract_workdays: {
89931
+ Args: {
89932
+ _date: string;
89933
+ _days: number;
89934
+ };
89935
+ Returns: string;
89936
+ };
89937
+ apply_stock_consumption: {
89938
+ Args: {
89939
+ p_order_id: string;
89940
+ p_order_item_id: string;
89941
+ p_qty: number;
89942
+ p_reason: string;
89943
+ p_source: string;
89944
+ p_trade_item_key: string;
89945
+ };
89946
+ Returns: undefined;
89947
+ };
89948
+ apply_stock_reservation: {
89949
+ Args: {
89950
+ p_order_id: string;
89951
+ p_order_item_id: string;
89952
+ p_qty: number;
89953
+ p_reason: string;
89954
+ p_source: string;
89955
+ p_trade_item_key: string;
89956
+ };
89957
+ Returns: undefined;
89958
+ };
88667
89959
  assign_cart_numbers: {
88668
89960
  Args: {
88669
89961
  p_carts: import("../integrations/supabase/types").Json;
@@ -88687,12 +89979,40 @@ export declare const listCustomersForPicker: import("@tanstack/start-client-core
88687
89979
  order_number: string;
88688
89980
  }[];
88689
89981
  };
89982
+ backfill_open_order_reservations: {
89983
+ Args: never;
89984
+ Returns: {
89985
+ processed_items: number;
89986
+ }[];
89987
+ };
88690
89988
  call_exact_route: {
88691
89989
  Args: {
88692
89990
  path: string;
88693
89991
  };
88694
89992
  Returns: number;
88695
89993
  };
89994
+ check_offer_product_available_stock: {
89995
+ Args: {
89996
+ p_campaign_product_id: string;
89997
+ p_code: string;
89998
+ p_needed_qty?: number;
89999
+ p_product_name?: string;
90000
+ };
90001
+ Returns: import("../integrations/supabase/types").Json;
90002
+ };
90003
+ check_trade_item_available_stock: {
90004
+ Args: {
90005
+ p_connection_id?: string;
90006
+ p_context?: string;
90007
+ p_needed_qty?: number;
90008
+ p_order_id?: string;
90009
+ p_order_item_id?: string;
90010
+ p_owner_id?: string;
90011
+ p_product_name?: string;
90012
+ p_trade_item_key: string;
90013
+ };
90014
+ Returns: import("../integrations/supabase/types").Json;
90015
+ };
88696
90016
  cleanup_old_bookings: {
88697
90017
  Args: never;
88698
90018
  Returns: number;
@@ -88736,6 +90056,12 @@ export declare const listCustomersForPicker: import("@tanstack/start-client-core
88736
90056
  table_name: string;
88737
90057
  }[];
88738
90058
  };
90059
+ dispatch_carrier_signups_sql: {
90060
+ Args: {
90061
+ _catchup?: string;
90062
+ };
90063
+ Returns: import("../integrations/supabase/types").Json;
90064
+ };
88739
90065
  email_auth_decrypt: {
88740
90066
  Args: {
88741
90067
  cipher: string;
@@ -88808,6 +90134,12 @@ export declare const listCustomersForPicker: import("@tanstack/start-client-core
88808
90134
  };
88809
90135
  Returns: boolean;
88810
90136
  };
90137
+ find_trade_item_key_by_name: {
90138
+ Args: {
90139
+ p_name: string;
90140
+ };
90141
+ Returns: string;
90142
+ };
88811
90143
  format_cart_number: {
88812
90144
  Args: {
88813
90145
  p_pick_date: string;
@@ -90073,6 +91405,7 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
90073
91405
  notes: string | null;
90074
91406
  performed_at: string;
90075
91407
  rescheduled_count: number;
91408
+ stock_consumed_at: string | null;
90076
91409
  total_carts: number;
90077
91410
  updated_at: string;
90078
91411
  user_id: string;
@@ -90086,6 +91419,7 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
90086
91419
  notes?: string | null;
90087
91420
  performed_at?: string;
90088
91421
  rescheduled_count?: number;
91422
+ stock_consumed_at?: string | null;
90089
91423
  total_carts?: number;
90090
91424
  updated_at?: string;
90091
91425
  user_id: string;
@@ -90099,6 +91433,7 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
90099
91433
  notes?: string | null;
90100
91434
  performed_at?: string;
90101
91435
  rescheduled_count?: number;
91436
+ stock_consumed_at?: string | null;
90102
91437
  total_carts?: number;
90103
91438
  updated_at?: string;
90104
91439
  user_id?: string;
@@ -95857,6 +97192,7 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
95857
97192
  purchase_price: number | null;
95858
97193
  quantity: number;
95859
97194
  sale_price: number | null;
97195
+ trade_item_key: string | null;
95860
97196
  unit: string;
95861
97197
  updated_at: string;
95862
97198
  weight: string | null;
@@ -95879,6 +97215,7 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
95879
97215
  purchase_price?: number | null;
95880
97216
  quantity?: number;
95881
97217
  sale_price?: number | null;
97218
+ trade_item_key?: string | null;
95882
97219
  unit?: string;
95883
97220
  updated_at?: string;
95884
97221
  weight?: string | null;
@@ -95901,6 +97238,7 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
95901
97238
  purchase_price?: number | null;
95902
97239
  quantity?: number;
95903
97240
  sale_price?: number | null;
97241
+ trade_item_key?: string | null;
95904
97242
  unit?: string;
95905
97243
  updated_at?: string;
95906
97244
  weight?: string | null;
@@ -96720,6 +98058,60 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
96720
98058
  };
96721
98059
  Relationships: [];
96722
98060
  };
98061
+ stock_mutation_log: {
98062
+ Row: {
98063
+ connection_id: string | null;
98064
+ created_at: string;
98065
+ created_by: string | null;
98066
+ id: string;
98067
+ mutation_type: string;
98068
+ order_id: string | null;
98069
+ order_item_id: string | null;
98070
+ order_source: string | null;
98071
+ physical_after: number | null;
98072
+ physical_before: number | null;
98073
+ qty_delta: number;
98074
+ reason: string | null;
98075
+ reserved_after: number | null;
98076
+ reserved_before: number | null;
98077
+ trade_item_key: string;
98078
+ };
98079
+ Insert: {
98080
+ connection_id?: string | null;
98081
+ created_at?: string;
98082
+ created_by?: string | null;
98083
+ id?: string;
98084
+ mutation_type: string;
98085
+ order_id?: string | null;
98086
+ order_item_id?: string | null;
98087
+ order_source?: string | null;
98088
+ physical_after?: number | null;
98089
+ physical_before?: number | null;
98090
+ qty_delta: number;
98091
+ reason?: string | null;
98092
+ reserved_after?: number | null;
98093
+ reserved_before?: number | null;
98094
+ trade_item_key: string;
98095
+ };
98096
+ Update: {
98097
+ connection_id?: string | null;
98098
+ created_at?: string;
98099
+ created_by?: string | null;
98100
+ id?: string;
98101
+ mutation_type?: string;
98102
+ order_id?: string | null;
98103
+ order_item_id?: string | null;
98104
+ order_source?: string | null;
98105
+ physical_after?: number | null;
98106
+ physical_before?: number | null;
98107
+ qty_delta?: number;
98108
+ reason?: string | null;
98109
+ reserved_after?: number | null;
98110
+ reserved_before?: number | null;
98111
+ trade_item_key?: string;
98112
+ };
98113
+ Relationships: [];
98114
+ };
96723
98115
  supplier_products: {
96724
98116
  Row: {
96725
98117
  article_number: string | null;
@@ -98581,6 +99973,54 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
98581
99973
  };
98582
99974
  Returns: number;
98583
99975
  };
99976
+ afh_city_code: {
99977
+ Args: {
99978
+ _city: string;
99979
+ _country: string;
99980
+ };
99981
+ Returns: string;
99982
+ };
99983
+ afh_normalize_country: {
99984
+ Args: {
99985
+ _raw: string;
99986
+ };
99987
+ Returns: string;
99988
+ };
99989
+ afh_normalize_nl_province: {
99990
+ Args: {
99991
+ _raw: string;
99992
+ };
99993
+ Returns: string;
99994
+ };
99995
+ afh_subtract_workdays: {
99996
+ Args: {
99997
+ _date: string;
99998
+ _days: number;
99999
+ };
100000
+ Returns: string;
100001
+ };
100002
+ apply_stock_consumption: {
100003
+ Args: {
100004
+ p_order_id: string;
100005
+ p_order_item_id: string;
100006
+ p_qty: number;
100007
+ p_reason: string;
100008
+ p_source: string;
100009
+ p_trade_item_key: string;
100010
+ };
100011
+ Returns: undefined;
100012
+ };
100013
+ apply_stock_reservation: {
100014
+ Args: {
100015
+ p_order_id: string;
100016
+ p_order_item_id: string;
100017
+ p_qty: number;
100018
+ p_reason: string;
100019
+ p_source: string;
100020
+ p_trade_item_key: string;
100021
+ };
100022
+ Returns: undefined;
100023
+ };
98584
100024
  assign_cart_numbers: {
98585
100025
  Args: {
98586
100026
  p_carts: import("../integrations/supabase/types").Json;
@@ -98604,12 +100044,40 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
98604
100044
  order_number: string;
98605
100045
  }[];
98606
100046
  };
100047
+ backfill_open_order_reservations: {
100048
+ Args: never;
100049
+ Returns: {
100050
+ processed_items: number;
100051
+ }[];
100052
+ };
98607
100053
  call_exact_route: {
98608
100054
  Args: {
98609
100055
  path: string;
98610
100056
  };
98611
100057
  Returns: number;
98612
100058
  };
100059
+ check_offer_product_available_stock: {
100060
+ Args: {
100061
+ p_campaign_product_id: string;
100062
+ p_code: string;
100063
+ p_needed_qty?: number;
100064
+ p_product_name?: string;
100065
+ };
100066
+ Returns: import("../integrations/supabase/types").Json;
100067
+ };
100068
+ check_trade_item_available_stock: {
100069
+ Args: {
100070
+ p_connection_id?: string;
100071
+ p_context?: string;
100072
+ p_needed_qty?: number;
100073
+ p_order_id?: string;
100074
+ p_order_item_id?: string;
100075
+ p_owner_id?: string;
100076
+ p_product_name?: string;
100077
+ p_trade_item_key: string;
100078
+ };
100079
+ Returns: import("../integrations/supabase/types").Json;
100080
+ };
98613
100081
  cleanup_old_bookings: {
98614
100082
  Args: never;
98615
100083
  Returns: number;
@@ -98653,6 +100121,12 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
98653
100121
  table_name: string;
98654
100122
  }[];
98655
100123
  };
100124
+ dispatch_carrier_signups_sql: {
100125
+ Args: {
100126
+ _catchup?: string;
100127
+ };
100128
+ Returns: import("../integrations/supabase/types").Json;
100129
+ };
98656
100130
  email_auth_decrypt: {
98657
100131
  Args: {
98658
100132
  cipher: string;
@@ -98725,6 +100199,12 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
98725
100199
  };
98726
100200
  Returns: boolean;
98727
100201
  };
100202
+ find_trade_item_key_by_name: {
100203
+ Args: {
100204
+ p_name: string;
100205
+ };
100206
+ Returns: string;
100207
+ };
98728
100208
  format_cart_number: {
98729
100209
  Args: {
98730
100210
  p_pick_date: string;
@@ -99276,6 +100756,7 @@ export declare const listProductsForPicker: import("@tanstack/start-client-core"
99276
100756
  plants_per_crate: number;
99277
100757
  crates_per_layer: number;
99278
100758
  layers_per_cart: number;
100759
+ custom_fields: import("../integrations/supabase/types").Json;
99279
100760
  }[];
99280
100761
  }>>;
99281
100762
  export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
@@ -99993,6 +101474,7 @@ export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core")
99993
101474
  notes: string | null;
99994
101475
  performed_at: string;
99995
101476
  rescheduled_count: number;
101477
+ stock_consumed_at: string | null;
99996
101478
  total_carts: number;
99997
101479
  updated_at: string;
99998
101480
  user_id: string;
@@ -100006,6 +101488,7 @@ export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core")
100006
101488
  notes?: string | null;
100007
101489
  performed_at?: string;
100008
101490
  rescheduled_count?: number;
101491
+ stock_consumed_at?: string | null;
100009
101492
  total_carts?: number;
100010
101493
  updated_at?: string;
100011
101494
  user_id: string;
@@ -100019,6 +101502,7 @@ export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core")
100019
101502
  notes?: string | null;
100020
101503
  performed_at?: string;
100021
101504
  rescheduled_count?: number;
101505
+ stock_consumed_at?: string | null;
100022
101506
  total_carts?: number;
100023
101507
  updated_at?: string;
100024
101508
  user_id?: string;
@@ -105777,6 +107261,7 @@ export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core")
105777
107261
  purchase_price: number | null;
105778
107262
  quantity: number;
105779
107263
  sale_price: number | null;
107264
+ trade_item_key: string | null;
105780
107265
  unit: string;
105781
107266
  updated_at: string;
105782
107267
  weight: string | null;
@@ -105799,6 +107284,7 @@ export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core")
105799
107284
  purchase_price?: number | null;
105800
107285
  quantity?: number;
105801
107286
  sale_price?: number | null;
107287
+ trade_item_key?: string | null;
105802
107288
  unit?: string;
105803
107289
  updated_at?: string;
105804
107290
  weight?: string | null;
@@ -105821,6 +107307,7 @@ export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core")
105821
107307
  purchase_price?: number | null;
105822
107308
  quantity?: number;
105823
107309
  sale_price?: number | null;
107310
+ trade_item_key?: string | null;
105824
107311
  unit?: string;
105825
107312
  updated_at?: string;
105826
107313
  weight?: string | null;
@@ -106640,6 +108127,60 @@ export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core")
106640
108127
  };
106641
108128
  Relationships: [];
106642
108129
  };
108130
+ stock_mutation_log: {
108131
+ Row: {
108132
+ connection_id: string | null;
108133
+ created_at: string;
108134
+ created_by: string | null;
108135
+ id: string;
108136
+ mutation_type: string;
108137
+ order_id: string | null;
108138
+ order_item_id: string | null;
108139
+ order_source: string | null;
108140
+ physical_after: number | null;
108141
+ physical_before: number | null;
108142
+ qty_delta: number;
108143
+ reason: string | null;
108144
+ reserved_after: number | null;
108145
+ reserved_before: number | null;
108146
+ trade_item_key: string;
108147
+ };
108148
+ Insert: {
108149
+ connection_id?: string | null;
108150
+ created_at?: string;
108151
+ created_by?: string | null;
108152
+ id?: string;
108153
+ mutation_type: string;
108154
+ order_id?: string | null;
108155
+ order_item_id?: string | null;
108156
+ order_source?: string | null;
108157
+ physical_after?: number | null;
108158
+ physical_before?: number | null;
108159
+ qty_delta: number;
108160
+ reason?: string | null;
108161
+ reserved_after?: number | null;
108162
+ reserved_before?: number | null;
108163
+ trade_item_key: string;
108164
+ };
108165
+ Update: {
108166
+ connection_id?: string | null;
108167
+ created_at?: string;
108168
+ created_by?: string | null;
108169
+ id?: string;
108170
+ mutation_type?: string;
108171
+ order_id?: string | null;
108172
+ order_item_id?: string | null;
108173
+ order_source?: string | null;
108174
+ physical_after?: number | null;
108175
+ physical_before?: number | null;
108176
+ qty_delta?: number;
108177
+ reason?: string | null;
108178
+ reserved_after?: number | null;
108179
+ reserved_before?: number | null;
108180
+ trade_item_key?: string;
108181
+ };
108182
+ Relationships: [];
108183
+ };
106643
108184
  supplier_products: {
106644
108185
  Row: {
106645
108186
  article_number: string | null;
@@ -108501,6 +110042,54 @@ export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core")
108501
110042
  };
108502
110043
  Returns: number;
108503
110044
  };
110045
+ afh_city_code: {
110046
+ Args: {
110047
+ _city: string;
110048
+ _country: string;
110049
+ };
110050
+ Returns: string;
110051
+ };
110052
+ afh_normalize_country: {
110053
+ Args: {
110054
+ _raw: string;
110055
+ };
110056
+ Returns: string;
110057
+ };
110058
+ afh_normalize_nl_province: {
110059
+ Args: {
110060
+ _raw: string;
110061
+ };
110062
+ Returns: string;
110063
+ };
110064
+ afh_subtract_workdays: {
110065
+ Args: {
110066
+ _date: string;
110067
+ _days: number;
110068
+ };
110069
+ Returns: string;
110070
+ };
110071
+ apply_stock_consumption: {
110072
+ Args: {
110073
+ p_order_id: string;
110074
+ p_order_item_id: string;
110075
+ p_qty: number;
110076
+ p_reason: string;
110077
+ p_source: string;
110078
+ p_trade_item_key: string;
110079
+ };
110080
+ Returns: undefined;
110081
+ };
110082
+ apply_stock_reservation: {
110083
+ Args: {
110084
+ p_order_id: string;
110085
+ p_order_item_id: string;
110086
+ p_qty: number;
110087
+ p_reason: string;
110088
+ p_source: string;
110089
+ p_trade_item_key: string;
110090
+ };
110091
+ Returns: undefined;
110092
+ };
108504
110093
  assign_cart_numbers: {
108505
110094
  Args: {
108506
110095
  p_carts: import("../integrations/supabase/types").Json;
@@ -108524,12 +110113,40 @@ export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core")
108524
110113
  order_number: string;
108525
110114
  }[];
108526
110115
  };
110116
+ backfill_open_order_reservations: {
110117
+ Args: never;
110118
+ Returns: {
110119
+ processed_items: number;
110120
+ }[];
110121
+ };
108527
110122
  call_exact_route: {
108528
110123
  Args: {
108529
110124
  path: string;
108530
110125
  };
108531
110126
  Returns: number;
108532
110127
  };
110128
+ check_offer_product_available_stock: {
110129
+ Args: {
110130
+ p_campaign_product_id: string;
110131
+ p_code: string;
110132
+ p_needed_qty?: number;
110133
+ p_product_name?: string;
110134
+ };
110135
+ Returns: import("../integrations/supabase/types").Json;
110136
+ };
110137
+ check_trade_item_available_stock: {
110138
+ Args: {
110139
+ p_connection_id?: string;
110140
+ p_context?: string;
110141
+ p_needed_qty?: number;
110142
+ p_order_id?: string;
110143
+ p_order_item_id?: string;
110144
+ p_owner_id?: string;
110145
+ p_product_name?: string;
110146
+ p_trade_item_key: string;
110147
+ };
110148
+ Returns: import("../integrations/supabase/types").Json;
110149
+ };
108533
110150
  cleanup_old_bookings: {
108534
110151
  Args: never;
108535
110152
  Returns: number;
@@ -108573,6 +110190,12 @@ export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core")
108573
110190
  table_name: string;
108574
110191
  }[];
108575
110192
  };
110193
+ dispatch_carrier_signups_sql: {
110194
+ Args: {
110195
+ _catchup?: string;
110196
+ };
110197
+ Returns: import("../integrations/supabase/types").Json;
110198
+ };
108576
110199
  email_auth_decrypt: {
108577
110200
  Args: {
108578
110201
  cipher: string;
@@ -108645,6 +110268,12 @@ export declare const planAndSaveAutoCarts: import("@tanstack/start-client-core")
108645
110268
  };
108646
110269
  Returns: boolean;
108647
110270
  };
110271
+ find_trade_item_key_by_name: {
110272
+ Args: {
110273
+ p_name: string;
110274
+ };
110275
+ Returns: string;
110276
+ };
108648
110277
  format_cart_number: {
108649
110278
  Args: {
108650
110279
  p_pick_date: string;
@@ -109930,6 +111559,7 @@ export declare const saveManualCarts: import("@tanstack/start-client-core").Opti
109930
111559
  notes: string | null;
109931
111560
  performed_at: string;
109932
111561
  rescheduled_count: number;
111562
+ stock_consumed_at: string | null;
109933
111563
  total_carts: number;
109934
111564
  updated_at: string;
109935
111565
  user_id: string;
@@ -109943,6 +111573,7 @@ export declare const saveManualCarts: import("@tanstack/start-client-core").Opti
109943
111573
  notes?: string | null;
109944
111574
  performed_at?: string;
109945
111575
  rescheduled_count?: number;
111576
+ stock_consumed_at?: string | null;
109946
111577
  total_carts?: number;
109947
111578
  updated_at?: string;
109948
111579
  user_id: string;
@@ -109956,6 +111587,7 @@ export declare const saveManualCarts: import("@tanstack/start-client-core").Opti
109956
111587
  notes?: string | null;
109957
111588
  performed_at?: string;
109958
111589
  rescheduled_count?: number;
111590
+ stock_consumed_at?: string | null;
109959
111591
  total_carts?: number;
109960
111592
  updated_at?: string;
109961
111593
  user_id?: string;
@@ -115714,6 +117346,7 @@ export declare const saveManualCarts: import("@tanstack/start-client-core").Opti
115714
117346
  purchase_price: number | null;
115715
117347
  quantity: number;
115716
117348
  sale_price: number | null;
117349
+ trade_item_key: string | null;
115717
117350
  unit: string;
115718
117351
  updated_at: string;
115719
117352
  weight: string | null;
@@ -115736,6 +117369,7 @@ export declare const saveManualCarts: import("@tanstack/start-client-core").Opti
115736
117369
  purchase_price?: number | null;
115737
117370
  quantity?: number;
115738
117371
  sale_price?: number | null;
117372
+ trade_item_key?: string | null;
115739
117373
  unit?: string;
115740
117374
  updated_at?: string;
115741
117375
  weight?: string | null;
@@ -115758,6 +117392,7 @@ export declare const saveManualCarts: import("@tanstack/start-client-core").Opti
115758
117392
  purchase_price?: number | null;
115759
117393
  quantity?: number;
115760
117394
  sale_price?: number | null;
117395
+ trade_item_key?: string | null;
115761
117396
  unit?: string;
115762
117397
  updated_at?: string;
115763
117398
  weight?: string | null;
@@ -116577,6 +118212,60 @@ export declare const saveManualCarts: import("@tanstack/start-client-core").Opti
116577
118212
  };
116578
118213
  Relationships: [];
116579
118214
  };
118215
+ stock_mutation_log: {
118216
+ Row: {
118217
+ connection_id: string | null;
118218
+ created_at: string;
118219
+ created_by: string | null;
118220
+ id: string;
118221
+ mutation_type: string;
118222
+ order_id: string | null;
118223
+ order_item_id: string | null;
118224
+ order_source: string | null;
118225
+ physical_after: number | null;
118226
+ physical_before: number | null;
118227
+ qty_delta: number;
118228
+ reason: string | null;
118229
+ reserved_after: number | null;
118230
+ reserved_before: number | null;
118231
+ trade_item_key: string;
118232
+ };
118233
+ Insert: {
118234
+ connection_id?: string | null;
118235
+ created_at?: string;
118236
+ created_by?: string | null;
118237
+ id?: string;
118238
+ mutation_type: string;
118239
+ order_id?: string | null;
118240
+ order_item_id?: string | null;
118241
+ order_source?: string | null;
118242
+ physical_after?: number | null;
118243
+ physical_before?: number | null;
118244
+ qty_delta: number;
118245
+ reason?: string | null;
118246
+ reserved_after?: number | null;
118247
+ reserved_before?: number | null;
118248
+ trade_item_key: string;
118249
+ };
118250
+ Update: {
118251
+ connection_id?: string | null;
118252
+ created_at?: string;
118253
+ created_by?: string | null;
118254
+ id?: string;
118255
+ mutation_type?: string;
118256
+ order_id?: string | null;
118257
+ order_item_id?: string | null;
118258
+ order_source?: string | null;
118259
+ physical_after?: number | null;
118260
+ physical_before?: number | null;
118261
+ qty_delta?: number;
118262
+ reason?: string | null;
118263
+ reserved_after?: number | null;
118264
+ reserved_before?: number | null;
118265
+ trade_item_key?: string;
118266
+ };
118267
+ Relationships: [];
118268
+ };
116580
118269
  supplier_products: {
116581
118270
  Row: {
116582
118271
  article_number: string | null;
@@ -118438,6 +120127,54 @@ export declare const saveManualCarts: import("@tanstack/start-client-core").Opti
118438
120127
  };
118439
120128
  Returns: number;
118440
120129
  };
120130
+ afh_city_code: {
120131
+ Args: {
120132
+ _city: string;
120133
+ _country: string;
120134
+ };
120135
+ Returns: string;
120136
+ };
120137
+ afh_normalize_country: {
120138
+ Args: {
120139
+ _raw: string;
120140
+ };
120141
+ Returns: string;
120142
+ };
120143
+ afh_normalize_nl_province: {
120144
+ Args: {
120145
+ _raw: string;
120146
+ };
120147
+ Returns: string;
120148
+ };
120149
+ afh_subtract_workdays: {
120150
+ Args: {
120151
+ _date: string;
120152
+ _days: number;
120153
+ };
120154
+ Returns: string;
120155
+ };
120156
+ apply_stock_consumption: {
120157
+ Args: {
120158
+ p_order_id: string;
120159
+ p_order_item_id: string;
120160
+ p_qty: number;
120161
+ p_reason: string;
120162
+ p_source: string;
120163
+ p_trade_item_key: string;
120164
+ };
120165
+ Returns: undefined;
120166
+ };
120167
+ apply_stock_reservation: {
120168
+ Args: {
120169
+ p_order_id: string;
120170
+ p_order_item_id: string;
120171
+ p_qty: number;
120172
+ p_reason: string;
120173
+ p_source: string;
120174
+ p_trade_item_key: string;
120175
+ };
120176
+ Returns: undefined;
120177
+ };
118441
120178
  assign_cart_numbers: {
118442
120179
  Args: {
118443
120180
  p_carts: import("../integrations/supabase/types").Json;
@@ -118461,12 +120198,40 @@ export declare const saveManualCarts: import("@tanstack/start-client-core").Opti
118461
120198
  order_number: string;
118462
120199
  }[];
118463
120200
  };
120201
+ backfill_open_order_reservations: {
120202
+ Args: never;
120203
+ Returns: {
120204
+ processed_items: number;
120205
+ }[];
120206
+ };
118464
120207
  call_exact_route: {
118465
120208
  Args: {
118466
120209
  path: string;
118467
120210
  };
118468
120211
  Returns: number;
118469
120212
  };
120213
+ check_offer_product_available_stock: {
120214
+ Args: {
120215
+ p_campaign_product_id: string;
120216
+ p_code: string;
120217
+ p_needed_qty?: number;
120218
+ p_product_name?: string;
120219
+ };
120220
+ Returns: import("../integrations/supabase/types").Json;
120221
+ };
120222
+ check_trade_item_available_stock: {
120223
+ Args: {
120224
+ p_connection_id?: string;
120225
+ p_context?: string;
120226
+ p_needed_qty?: number;
120227
+ p_order_id?: string;
120228
+ p_order_item_id?: string;
120229
+ p_owner_id?: string;
120230
+ p_product_name?: string;
120231
+ p_trade_item_key: string;
120232
+ };
120233
+ Returns: import("../integrations/supabase/types").Json;
120234
+ };
118470
120235
  cleanup_old_bookings: {
118471
120236
  Args: never;
118472
120237
  Returns: number;
@@ -118510,6 +120275,12 @@ export declare const saveManualCarts: import("@tanstack/start-client-core").Opti
118510
120275
  table_name: string;
118511
120276
  }[];
118512
120277
  };
120278
+ dispatch_carrier_signups_sql: {
120279
+ Args: {
120280
+ _catchup?: string;
120281
+ };
120282
+ Returns: import("../integrations/supabase/types").Json;
120283
+ };
118513
120284
  email_auth_decrypt: {
118514
120285
  Args: {
118515
120286
  cipher: string;
@@ -118582,6 +120353,12 @@ export declare const saveManualCarts: import("@tanstack/start-client-core").Opti
118582
120353
  };
118583
120354
  Returns: boolean;
118584
120355
  };
120356
+ find_trade_item_key_by_name: {
120357
+ Args: {
120358
+ p_name: string;
120359
+ };
120360
+ Returns: string;
120361
+ };
118585
120362
  format_cart_number: {
118586
120363
  Args: {
118587
120364
  p_pick_date: string;
@@ -119857,6 +121634,7 @@ export declare const listOrderCarts: import("@tanstack/start-client-core").Requi
119857
121634
  notes: string | null;
119858
121635
  performed_at: string;
119859
121636
  rescheduled_count: number;
121637
+ stock_consumed_at: string | null;
119860
121638
  total_carts: number;
119861
121639
  updated_at: string;
119862
121640
  user_id: string;
@@ -119870,6 +121648,7 @@ export declare const listOrderCarts: import("@tanstack/start-client-core").Requi
119870
121648
  notes?: string | null;
119871
121649
  performed_at?: string;
119872
121650
  rescheduled_count?: number;
121651
+ stock_consumed_at?: string | null;
119873
121652
  total_carts?: number;
119874
121653
  updated_at?: string;
119875
121654
  user_id: string;
@@ -119883,6 +121662,7 @@ export declare const listOrderCarts: import("@tanstack/start-client-core").Requi
119883
121662
  notes?: string | null;
119884
121663
  performed_at?: string;
119885
121664
  rescheduled_count?: number;
121665
+ stock_consumed_at?: string | null;
119886
121666
  total_carts?: number;
119887
121667
  updated_at?: string;
119888
121668
  user_id?: string;
@@ -125641,6 +127421,7 @@ export declare const listOrderCarts: import("@tanstack/start-client-core").Requi
125641
127421
  purchase_price: number | null;
125642
127422
  quantity: number;
125643
127423
  sale_price: number | null;
127424
+ trade_item_key: string | null;
125644
127425
  unit: string;
125645
127426
  updated_at: string;
125646
127427
  weight: string | null;
@@ -125663,6 +127444,7 @@ export declare const listOrderCarts: import("@tanstack/start-client-core").Requi
125663
127444
  purchase_price?: number | null;
125664
127445
  quantity?: number;
125665
127446
  sale_price?: number | null;
127447
+ trade_item_key?: string | null;
125666
127448
  unit?: string;
125667
127449
  updated_at?: string;
125668
127450
  weight?: string | null;
@@ -125685,6 +127467,7 @@ export declare const listOrderCarts: import("@tanstack/start-client-core").Requi
125685
127467
  purchase_price?: number | null;
125686
127468
  quantity?: number;
125687
127469
  sale_price?: number | null;
127470
+ trade_item_key?: string | null;
125688
127471
  unit?: string;
125689
127472
  updated_at?: string;
125690
127473
  weight?: string | null;
@@ -126504,6 +128287,60 @@ export declare const listOrderCarts: import("@tanstack/start-client-core").Requi
126504
128287
  };
126505
128288
  Relationships: [];
126506
128289
  };
128290
+ stock_mutation_log: {
128291
+ Row: {
128292
+ connection_id: string | null;
128293
+ created_at: string;
128294
+ created_by: string | null;
128295
+ id: string;
128296
+ mutation_type: string;
128297
+ order_id: string | null;
128298
+ order_item_id: string | null;
128299
+ order_source: string | null;
128300
+ physical_after: number | null;
128301
+ physical_before: number | null;
128302
+ qty_delta: number;
128303
+ reason: string | null;
128304
+ reserved_after: number | null;
128305
+ reserved_before: number | null;
128306
+ trade_item_key: string;
128307
+ };
128308
+ Insert: {
128309
+ connection_id?: string | null;
128310
+ created_at?: string;
128311
+ created_by?: string | null;
128312
+ id?: string;
128313
+ mutation_type: string;
128314
+ order_id?: string | null;
128315
+ order_item_id?: string | null;
128316
+ order_source?: string | null;
128317
+ physical_after?: number | null;
128318
+ physical_before?: number | null;
128319
+ qty_delta: number;
128320
+ reason?: string | null;
128321
+ reserved_after?: number | null;
128322
+ reserved_before?: number | null;
128323
+ trade_item_key: string;
128324
+ };
128325
+ Update: {
128326
+ connection_id?: string | null;
128327
+ created_at?: string;
128328
+ created_by?: string | null;
128329
+ id?: string;
128330
+ mutation_type?: string;
128331
+ order_id?: string | null;
128332
+ order_item_id?: string | null;
128333
+ order_source?: string | null;
128334
+ physical_after?: number | null;
128335
+ physical_before?: number | null;
128336
+ qty_delta?: number;
128337
+ reason?: string | null;
128338
+ reserved_after?: number | null;
128339
+ reserved_before?: number | null;
128340
+ trade_item_key?: string;
128341
+ };
128342
+ Relationships: [];
128343
+ };
126507
128344
  supplier_products: {
126508
128345
  Row: {
126509
128346
  article_number: string | null;
@@ -128365,6 +130202,54 @@ export declare const listOrderCarts: import("@tanstack/start-client-core").Requi
128365
130202
  };
128366
130203
  Returns: number;
128367
130204
  };
130205
+ afh_city_code: {
130206
+ Args: {
130207
+ _city: string;
130208
+ _country: string;
130209
+ };
130210
+ Returns: string;
130211
+ };
130212
+ afh_normalize_country: {
130213
+ Args: {
130214
+ _raw: string;
130215
+ };
130216
+ Returns: string;
130217
+ };
130218
+ afh_normalize_nl_province: {
130219
+ Args: {
130220
+ _raw: string;
130221
+ };
130222
+ Returns: string;
130223
+ };
130224
+ afh_subtract_workdays: {
130225
+ Args: {
130226
+ _date: string;
130227
+ _days: number;
130228
+ };
130229
+ Returns: string;
130230
+ };
130231
+ apply_stock_consumption: {
130232
+ Args: {
130233
+ p_order_id: string;
130234
+ p_order_item_id: string;
130235
+ p_qty: number;
130236
+ p_reason: string;
130237
+ p_source: string;
130238
+ p_trade_item_key: string;
130239
+ };
130240
+ Returns: undefined;
130241
+ };
130242
+ apply_stock_reservation: {
130243
+ Args: {
130244
+ p_order_id: string;
130245
+ p_order_item_id: string;
130246
+ p_qty: number;
130247
+ p_reason: string;
130248
+ p_source: string;
130249
+ p_trade_item_key: string;
130250
+ };
130251
+ Returns: undefined;
130252
+ };
128368
130253
  assign_cart_numbers: {
128369
130254
  Args: {
128370
130255
  p_carts: import("../integrations/supabase/types").Json;
@@ -128388,12 +130273,40 @@ export declare const listOrderCarts: import("@tanstack/start-client-core").Requi
128388
130273
  order_number: string;
128389
130274
  }[];
128390
130275
  };
130276
+ backfill_open_order_reservations: {
130277
+ Args: never;
130278
+ Returns: {
130279
+ processed_items: number;
130280
+ }[];
130281
+ };
128391
130282
  call_exact_route: {
128392
130283
  Args: {
128393
130284
  path: string;
128394
130285
  };
128395
130286
  Returns: number;
128396
130287
  };
130288
+ check_offer_product_available_stock: {
130289
+ Args: {
130290
+ p_campaign_product_id: string;
130291
+ p_code: string;
130292
+ p_needed_qty?: number;
130293
+ p_product_name?: string;
130294
+ };
130295
+ Returns: import("../integrations/supabase/types").Json;
130296
+ };
130297
+ check_trade_item_available_stock: {
130298
+ Args: {
130299
+ p_connection_id?: string;
130300
+ p_context?: string;
130301
+ p_needed_qty?: number;
130302
+ p_order_id?: string;
130303
+ p_order_item_id?: string;
130304
+ p_owner_id?: string;
130305
+ p_product_name?: string;
130306
+ p_trade_item_key: string;
130307
+ };
130308
+ Returns: import("../integrations/supabase/types").Json;
130309
+ };
128397
130310
  cleanup_old_bookings: {
128398
130311
  Args: never;
128399
130312
  Returns: number;
@@ -128437,6 +130350,12 @@ export declare const listOrderCarts: import("@tanstack/start-client-core").Requi
128437
130350
  table_name: string;
128438
130351
  }[];
128439
130352
  };
130353
+ dispatch_carrier_signups_sql: {
130354
+ Args: {
130355
+ _catchup?: string;
130356
+ };
130357
+ Returns: import("../integrations/supabase/types").Json;
130358
+ };
128440
130359
  email_auth_decrypt: {
128441
130360
  Args: {
128442
130361
  cipher: string;
@@ -128509,6 +130428,12 @@ export declare const listOrderCarts: import("@tanstack/start-client-core").Requi
128509
130428
  };
128510
130429
  Returns: boolean;
128511
130430
  };
130431
+ find_trade_item_key_by_name: {
130432
+ Args: {
130433
+ p_name: string;
130434
+ };
130435
+ Returns: string;
130436
+ };
128512
130437
  format_cart_number: {
128513
130438
  Args: {
128514
130439
  p_pick_date: string;
@@ -129791,6 +131716,7 @@ export declare const listDeliveryLocationsForCustomer: import("@tanstack/start-c
129791
131716
  notes: string | null;
129792
131717
  performed_at: string;
129793
131718
  rescheduled_count: number;
131719
+ stock_consumed_at: string | null;
129794
131720
  total_carts: number;
129795
131721
  updated_at: string;
129796
131722
  user_id: string;
@@ -129804,6 +131730,7 @@ export declare const listDeliveryLocationsForCustomer: import("@tanstack/start-c
129804
131730
  notes?: string | null;
129805
131731
  performed_at?: string;
129806
131732
  rescheduled_count?: number;
131733
+ stock_consumed_at?: string | null;
129807
131734
  total_carts?: number;
129808
131735
  updated_at?: string;
129809
131736
  user_id: string;
@@ -129817,6 +131744,7 @@ export declare const listDeliveryLocationsForCustomer: import("@tanstack/start-c
129817
131744
  notes?: string | null;
129818
131745
  performed_at?: string;
129819
131746
  rescheduled_count?: number;
131747
+ stock_consumed_at?: string | null;
129820
131748
  total_carts?: number;
129821
131749
  updated_at?: string;
129822
131750
  user_id?: string;
@@ -135575,6 +137503,7 @@ export declare const listDeliveryLocationsForCustomer: import("@tanstack/start-c
135575
137503
  purchase_price: number | null;
135576
137504
  quantity: number;
135577
137505
  sale_price: number | null;
137506
+ trade_item_key: string | null;
135578
137507
  unit: string;
135579
137508
  updated_at: string;
135580
137509
  weight: string | null;
@@ -135597,6 +137526,7 @@ export declare const listDeliveryLocationsForCustomer: import("@tanstack/start-c
135597
137526
  purchase_price?: number | null;
135598
137527
  quantity?: number;
135599
137528
  sale_price?: number | null;
137529
+ trade_item_key?: string | null;
135600
137530
  unit?: string;
135601
137531
  updated_at?: string;
135602
137532
  weight?: string | null;
@@ -135619,6 +137549,7 @@ export declare const listDeliveryLocationsForCustomer: import("@tanstack/start-c
135619
137549
  purchase_price?: number | null;
135620
137550
  quantity?: number;
135621
137551
  sale_price?: number | null;
137552
+ trade_item_key?: string | null;
135622
137553
  unit?: string;
135623
137554
  updated_at?: string;
135624
137555
  weight?: string | null;
@@ -136438,6 +138369,60 @@ export declare const listDeliveryLocationsForCustomer: import("@tanstack/start-c
136438
138369
  };
136439
138370
  Relationships: [];
136440
138371
  };
138372
+ stock_mutation_log: {
138373
+ Row: {
138374
+ connection_id: string | null;
138375
+ created_at: string;
138376
+ created_by: string | null;
138377
+ id: string;
138378
+ mutation_type: string;
138379
+ order_id: string | null;
138380
+ order_item_id: string | null;
138381
+ order_source: string | null;
138382
+ physical_after: number | null;
138383
+ physical_before: number | null;
138384
+ qty_delta: number;
138385
+ reason: string | null;
138386
+ reserved_after: number | null;
138387
+ reserved_before: number | null;
138388
+ trade_item_key: string;
138389
+ };
138390
+ Insert: {
138391
+ connection_id?: string | null;
138392
+ created_at?: string;
138393
+ created_by?: string | null;
138394
+ id?: string;
138395
+ mutation_type: string;
138396
+ order_id?: string | null;
138397
+ order_item_id?: string | null;
138398
+ order_source?: string | null;
138399
+ physical_after?: number | null;
138400
+ physical_before?: number | null;
138401
+ qty_delta: number;
138402
+ reason?: string | null;
138403
+ reserved_after?: number | null;
138404
+ reserved_before?: number | null;
138405
+ trade_item_key: string;
138406
+ };
138407
+ Update: {
138408
+ connection_id?: string | null;
138409
+ created_at?: string;
138410
+ created_by?: string | null;
138411
+ id?: string;
138412
+ mutation_type?: string;
138413
+ order_id?: string | null;
138414
+ order_item_id?: string | null;
138415
+ order_source?: string | null;
138416
+ physical_after?: number | null;
138417
+ physical_before?: number | null;
138418
+ qty_delta?: number;
138419
+ reason?: string | null;
138420
+ reserved_after?: number | null;
138421
+ reserved_before?: number | null;
138422
+ trade_item_key?: string;
138423
+ };
138424
+ Relationships: [];
138425
+ };
136441
138426
  supplier_products: {
136442
138427
  Row: {
136443
138428
  article_number: string | null;
@@ -138299,6 +140284,54 @@ export declare const listDeliveryLocationsForCustomer: import("@tanstack/start-c
138299
140284
  };
138300
140285
  Returns: number;
138301
140286
  };
140287
+ afh_city_code: {
140288
+ Args: {
140289
+ _city: string;
140290
+ _country: string;
140291
+ };
140292
+ Returns: string;
140293
+ };
140294
+ afh_normalize_country: {
140295
+ Args: {
140296
+ _raw: string;
140297
+ };
140298
+ Returns: string;
140299
+ };
140300
+ afh_normalize_nl_province: {
140301
+ Args: {
140302
+ _raw: string;
140303
+ };
140304
+ Returns: string;
140305
+ };
140306
+ afh_subtract_workdays: {
140307
+ Args: {
140308
+ _date: string;
140309
+ _days: number;
140310
+ };
140311
+ Returns: string;
140312
+ };
140313
+ apply_stock_consumption: {
140314
+ Args: {
140315
+ p_order_id: string;
140316
+ p_order_item_id: string;
140317
+ p_qty: number;
140318
+ p_reason: string;
140319
+ p_source: string;
140320
+ p_trade_item_key: string;
140321
+ };
140322
+ Returns: undefined;
140323
+ };
140324
+ apply_stock_reservation: {
140325
+ Args: {
140326
+ p_order_id: string;
140327
+ p_order_item_id: string;
140328
+ p_qty: number;
140329
+ p_reason: string;
140330
+ p_source: string;
140331
+ p_trade_item_key: string;
140332
+ };
140333
+ Returns: undefined;
140334
+ };
138302
140335
  assign_cart_numbers: {
138303
140336
  Args: {
138304
140337
  p_carts: import("../integrations/supabase/types").Json;
@@ -138322,12 +140355,40 @@ export declare const listDeliveryLocationsForCustomer: import("@tanstack/start-c
138322
140355
  order_number: string;
138323
140356
  }[];
138324
140357
  };
140358
+ backfill_open_order_reservations: {
140359
+ Args: never;
140360
+ Returns: {
140361
+ processed_items: number;
140362
+ }[];
140363
+ };
138325
140364
  call_exact_route: {
138326
140365
  Args: {
138327
140366
  path: string;
138328
140367
  };
138329
140368
  Returns: number;
138330
140369
  };
140370
+ check_offer_product_available_stock: {
140371
+ Args: {
140372
+ p_campaign_product_id: string;
140373
+ p_code: string;
140374
+ p_needed_qty?: number;
140375
+ p_product_name?: string;
140376
+ };
140377
+ Returns: import("../integrations/supabase/types").Json;
140378
+ };
140379
+ check_trade_item_available_stock: {
140380
+ Args: {
140381
+ p_connection_id?: string;
140382
+ p_context?: string;
140383
+ p_needed_qty?: number;
140384
+ p_order_id?: string;
140385
+ p_order_item_id?: string;
140386
+ p_owner_id?: string;
140387
+ p_product_name?: string;
140388
+ p_trade_item_key: string;
140389
+ };
140390
+ Returns: import("../integrations/supabase/types").Json;
140391
+ };
138331
140392
  cleanup_old_bookings: {
138332
140393
  Args: never;
138333
140394
  Returns: number;
@@ -138371,6 +140432,12 @@ export declare const listDeliveryLocationsForCustomer: import("@tanstack/start-c
138371
140432
  table_name: string;
138372
140433
  }[];
138373
140434
  };
140435
+ dispatch_carrier_signups_sql: {
140436
+ Args: {
140437
+ _catchup?: string;
140438
+ };
140439
+ Returns: import("../integrations/supabase/types").Json;
140440
+ };
138374
140441
  email_auth_decrypt: {
138375
140442
  Args: {
138376
140443
  cipher: string;
@@ -138443,6 +140510,12 @@ export declare const listDeliveryLocationsForCustomer: import("@tanstack/start-c
138443
140510
  };
138444
140511
  Returns: boolean;
138445
140512
  };
140513
+ find_trade_item_key_by_name: {
140514
+ Args: {
140515
+ p_name: string;
140516
+ };
140517
+ Returns: string;
140518
+ };
138446
140519
  format_cart_number: {
138447
140520
  Args: {
138448
140521
  p_pick_date: string;
@@ -139724,6 +141797,7 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
139724
141797
  notes: string | null;
139725
141798
  performed_at: string;
139726
141799
  rescheduled_count: number;
141800
+ stock_consumed_at: string | null;
139727
141801
  total_carts: number;
139728
141802
  updated_at: string;
139729
141803
  user_id: string;
@@ -139737,6 +141811,7 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
139737
141811
  notes?: string | null;
139738
141812
  performed_at?: string;
139739
141813
  rescheduled_count?: number;
141814
+ stock_consumed_at?: string | null;
139740
141815
  total_carts?: number;
139741
141816
  updated_at?: string;
139742
141817
  user_id: string;
@@ -139750,6 +141825,7 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
139750
141825
  notes?: string | null;
139751
141826
  performed_at?: string;
139752
141827
  rescheduled_count?: number;
141828
+ stock_consumed_at?: string | null;
139753
141829
  total_carts?: number;
139754
141830
  updated_at?: string;
139755
141831
  user_id?: string;
@@ -145508,6 +147584,7 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
145508
147584
  purchase_price: number | null;
145509
147585
  quantity: number;
145510
147586
  sale_price: number | null;
147587
+ trade_item_key: string | null;
145511
147588
  unit: string;
145512
147589
  updated_at: string;
145513
147590
  weight: string | null;
@@ -145530,6 +147607,7 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
145530
147607
  purchase_price?: number | null;
145531
147608
  quantity?: number;
145532
147609
  sale_price?: number | null;
147610
+ trade_item_key?: string | null;
145533
147611
  unit?: string;
145534
147612
  updated_at?: string;
145535
147613
  weight?: string | null;
@@ -145552,6 +147630,7 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
145552
147630
  purchase_price?: number | null;
145553
147631
  quantity?: number;
145554
147632
  sale_price?: number | null;
147633
+ trade_item_key?: string | null;
145555
147634
  unit?: string;
145556
147635
  updated_at?: string;
145557
147636
  weight?: string | null;
@@ -146371,6 +148450,60 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
146371
148450
  };
146372
148451
  Relationships: [];
146373
148452
  };
148453
+ stock_mutation_log: {
148454
+ Row: {
148455
+ connection_id: string | null;
148456
+ created_at: string;
148457
+ created_by: string | null;
148458
+ id: string;
148459
+ mutation_type: string;
148460
+ order_id: string | null;
148461
+ order_item_id: string | null;
148462
+ order_source: string | null;
148463
+ physical_after: number | null;
148464
+ physical_before: number | null;
148465
+ qty_delta: number;
148466
+ reason: string | null;
148467
+ reserved_after: number | null;
148468
+ reserved_before: number | null;
148469
+ trade_item_key: string;
148470
+ };
148471
+ Insert: {
148472
+ connection_id?: string | null;
148473
+ created_at?: string;
148474
+ created_by?: string | null;
148475
+ id?: string;
148476
+ mutation_type: string;
148477
+ order_id?: string | null;
148478
+ order_item_id?: string | null;
148479
+ order_source?: string | null;
148480
+ physical_after?: number | null;
148481
+ physical_before?: number | null;
148482
+ qty_delta: number;
148483
+ reason?: string | null;
148484
+ reserved_after?: number | null;
148485
+ reserved_before?: number | null;
148486
+ trade_item_key: string;
148487
+ };
148488
+ Update: {
148489
+ connection_id?: string | null;
148490
+ created_at?: string;
148491
+ created_by?: string | null;
148492
+ id?: string;
148493
+ mutation_type?: string;
148494
+ order_id?: string | null;
148495
+ order_item_id?: string | null;
148496
+ order_source?: string | null;
148497
+ physical_after?: number | null;
148498
+ physical_before?: number | null;
148499
+ qty_delta?: number;
148500
+ reason?: string | null;
148501
+ reserved_after?: number | null;
148502
+ reserved_before?: number | null;
148503
+ trade_item_key?: string;
148504
+ };
148505
+ Relationships: [];
148506
+ };
146374
148507
  supplier_products: {
146375
148508
  Row: {
146376
148509
  article_number: string | null;
@@ -148232,6 +150365,54 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
148232
150365
  };
148233
150366
  Returns: number;
148234
150367
  };
150368
+ afh_city_code: {
150369
+ Args: {
150370
+ _city: string;
150371
+ _country: string;
150372
+ };
150373
+ Returns: string;
150374
+ };
150375
+ afh_normalize_country: {
150376
+ Args: {
150377
+ _raw: string;
150378
+ };
150379
+ Returns: string;
150380
+ };
150381
+ afh_normalize_nl_province: {
150382
+ Args: {
150383
+ _raw: string;
150384
+ };
150385
+ Returns: string;
150386
+ };
150387
+ afh_subtract_workdays: {
150388
+ Args: {
150389
+ _date: string;
150390
+ _days: number;
150391
+ };
150392
+ Returns: string;
150393
+ };
150394
+ apply_stock_consumption: {
150395
+ Args: {
150396
+ p_order_id: string;
150397
+ p_order_item_id: string;
150398
+ p_qty: number;
150399
+ p_reason: string;
150400
+ p_source: string;
150401
+ p_trade_item_key: string;
150402
+ };
150403
+ Returns: undefined;
150404
+ };
150405
+ apply_stock_reservation: {
150406
+ Args: {
150407
+ p_order_id: string;
150408
+ p_order_item_id: string;
150409
+ p_qty: number;
150410
+ p_reason: string;
150411
+ p_source: string;
150412
+ p_trade_item_key: string;
150413
+ };
150414
+ Returns: undefined;
150415
+ };
148235
150416
  assign_cart_numbers: {
148236
150417
  Args: {
148237
150418
  p_carts: import("../integrations/supabase/types").Json;
@@ -148255,12 +150436,40 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
148255
150436
  order_number: string;
148256
150437
  }[];
148257
150438
  };
150439
+ backfill_open_order_reservations: {
150440
+ Args: never;
150441
+ Returns: {
150442
+ processed_items: number;
150443
+ }[];
150444
+ };
148258
150445
  call_exact_route: {
148259
150446
  Args: {
148260
150447
  path: string;
148261
150448
  };
148262
150449
  Returns: number;
148263
150450
  };
150451
+ check_offer_product_available_stock: {
150452
+ Args: {
150453
+ p_campaign_product_id: string;
150454
+ p_code: string;
150455
+ p_needed_qty?: number;
150456
+ p_product_name?: string;
150457
+ };
150458
+ Returns: import("../integrations/supabase/types").Json;
150459
+ };
150460
+ check_trade_item_available_stock: {
150461
+ Args: {
150462
+ p_connection_id?: string;
150463
+ p_context?: string;
150464
+ p_needed_qty?: number;
150465
+ p_order_id?: string;
150466
+ p_order_item_id?: string;
150467
+ p_owner_id?: string;
150468
+ p_product_name?: string;
150469
+ p_trade_item_key: string;
150470
+ };
150471
+ Returns: import("../integrations/supabase/types").Json;
150472
+ };
148264
150473
  cleanup_old_bookings: {
148265
150474
  Args: never;
148266
150475
  Returns: number;
@@ -148304,6 +150513,12 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
148304
150513
  table_name: string;
148305
150514
  }[];
148306
150515
  };
150516
+ dispatch_carrier_signups_sql: {
150517
+ Args: {
150518
+ _catchup?: string;
150519
+ };
150520
+ Returns: import("../integrations/supabase/types").Json;
150521
+ };
148307
150522
  email_auth_decrypt: {
148308
150523
  Args: {
148309
150524
  cipher: string;
@@ -148376,6 +150591,12 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
148376
150591
  };
148377
150592
  Returns: boolean;
148378
150593
  };
150594
+ find_trade_item_key_by_name: {
150595
+ Args: {
150596
+ p_name: string;
150597
+ };
150598
+ Returns: string;
150599
+ };
148379
150600
  format_cart_number: {
148380
150601
  Args: {
148381
150602
  p_pick_date: string;
@@ -148922,7 +151143,7 @@ export declare const listPickupLocations: import("@tanstack/start-client-core").
148922
151143
  }, undefined, undefined, undefined>], undefined, Promise<{
148923
151144
  items: {
148924
151145
  id: string;
148925
- name: string;
151146
+ name: any;
148926
151147
  sort_order: number;
148927
151148
  }[];
148928
151149
  }>>;
@@ -149641,6 +151862,7 @@ export declare const listCarriersForPicker: import("@tanstack/start-client-core"
149641
151862
  notes: string | null;
149642
151863
  performed_at: string;
149643
151864
  rescheduled_count: number;
151865
+ stock_consumed_at: string | null;
149644
151866
  total_carts: number;
149645
151867
  updated_at: string;
149646
151868
  user_id: string;
@@ -149654,6 +151876,7 @@ export declare const listCarriersForPicker: import("@tanstack/start-client-core"
149654
151876
  notes?: string | null;
149655
151877
  performed_at?: string;
149656
151878
  rescheduled_count?: number;
151879
+ stock_consumed_at?: string | null;
149657
151880
  total_carts?: number;
149658
151881
  updated_at?: string;
149659
151882
  user_id: string;
@@ -149667,6 +151890,7 @@ export declare const listCarriersForPicker: import("@tanstack/start-client-core"
149667
151890
  notes?: string | null;
149668
151891
  performed_at?: string;
149669
151892
  rescheduled_count?: number;
151893
+ stock_consumed_at?: string | null;
149670
151894
  total_carts?: number;
149671
151895
  updated_at?: string;
149672
151896
  user_id?: string;
@@ -155425,6 +157649,7 @@ export declare const listCarriersForPicker: import("@tanstack/start-client-core"
155425
157649
  purchase_price: number | null;
155426
157650
  quantity: number;
155427
157651
  sale_price: number | null;
157652
+ trade_item_key: string | null;
155428
157653
  unit: string;
155429
157654
  updated_at: string;
155430
157655
  weight: string | null;
@@ -155447,6 +157672,7 @@ export declare const listCarriersForPicker: import("@tanstack/start-client-core"
155447
157672
  purchase_price?: number | null;
155448
157673
  quantity?: number;
155449
157674
  sale_price?: number | null;
157675
+ trade_item_key?: string | null;
155450
157676
  unit?: string;
155451
157677
  updated_at?: string;
155452
157678
  weight?: string | null;
@@ -155469,6 +157695,7 @@ export declare const listCarriersForPicker: import("@tanstack/start-client-core"
155469
157695
  purchase_price?: number | null;
155470
157696
  quantity?: number;
155471
157697
  sale_price?: number | null;
157698
+ trade_item_key?: string | null;
155472
157699
  unit?: string;
155473
157700
  updated_at?: string;
155474
157701
  weight?: string | null;
@@ -156288,6 +158515,60 @@ export declare const listCarriersForPicker: import("@tanstack/start-client-core"
156288
158515
  };
156289
158516
  Relationships: [];
156290
158517
  };
158518
+ stock_mutation_log: {
158519
+ Row: {
158520
+ connection_id: string | null;
158521
+ created_at: string;
158522
+ created_by: string | null;
158523
+ id: string;
158524
+ mutation_type: string;
158525
+ order_id: string | null;
158526
+ order_item_id: string | null;
158527
+ order_source: string | null;
158528
+ physical_after: number | null;
158529
+ physical_before: number | null;
158530
+ qty_delta: number;
158531
+ reason: string | null;
158532
+ reserved_after: number | null;
158533
+ reserved_before: number | null;
158534
+ trade_item_key: string;
158535
+ };
158536
+ Insert: {
158537
+ connection_id?: string | null;
158538
+ created_at?: string;
158539
+ created_by?: string | null;
158540
+ id?: string;
158541
+ mutation_type: string;
158542
+ order_id?: string | null;
158543
+ order_item_id?: string | null;
158544
+ order_source?: string | null;
158545
+ physical_after?: number | null;
158546
+ physical_before?: number | null;
158547
+ qty_delta: number;
158548
+ reason?: string | null;
158549
+ reserved_after?: number | null;
158550
+ reserved_before?: number | null;
158551
+ trade_item_key: string;
158552
+ };
158553
+ Update: {
158554
+ connection_id?: string | null;
158555
+ created_at?: string;
158556
+ created_by?: string | null;
158557
+ id?: string;
158558
+ mutation_type?: string;
158559
+ order_id?: string | null;
158560
+ order_item_id?: string | null;
158561
+ order_source?: string | null;
158562
+ physical_after?: number | null;
158563
+ physical_before?: number | null;
158564
+ qty_delta?: number;
158565
+ reason?: string | null;
158566
+ reserved_after?: number | null;
158567
+ reserved_before?: number | null;
158568
+ trade_item_key?: string;
158569
+ };
158570
+ Relationships: [];
158571
+ };
156291
158572
  supplier_products: {
156292
158573
  Row: {
156293
158574
  article_number: string | null;
@@ -158149,6 +160430,54 @@ export declare const listCarriersForPicker: import("@tanstack/start-client-core"
158149
160430
  };
158150
160431
  Returns: number;
158151
160432
  };
160433
+ afh_city_code: {
160434
+ Args: {
160435
+ _city: string;
160436
+ _country: string;
160437
+ };
160438
+ Returns: string;
160439
+ };
160440
+ afh_normalize_country: {
160441
+ Args: {
160442
+ _raw: string;
160443
+ };
160444
+ Returns: string;
160445
+ };
160446
+ afh_normalize_nl_province: {
160447
+ Args: {
160448
+ _raw: string;
160449
+ };
160450
+ Returns: string;
160451
+ };
160452
+ afh_subtract_workdays: {
160453
+ Args: {
160454
+ _date: string;
160455
+ _days: number;
160456
+ };
160457
+ Returns: string;
160458
+ };
160459
+ apply_stock_consumption: {
160460
+ Args: {
160461
+ p_order_id: string;
160462
+ p_order_item_id: string;
160463
+ p_qty: number;
160464
+ p_reason: string;
160465
+ p_source: string;
160466
+ p_trade_item_key: string;
160467
+ };
160468
+ Returns: undefined;
160469
+ };
160470
+ apply_stock_reservation: {
160471
+ Args: {
160472
+ p_order_id: string;
160473
+ p_order_item_id: string;
160474
+ p_qty: number;
160475
+ p_reason: string;
160476
+ p_source: string;
160477
+ p_trade_item_key: string;
160478
+ };
160479
+ Returns: undefined;
160480
+ };
158152
160481
  assign_cart_numbers: {
158153
160482
  Args: {
158154
160483
  p_carts: import("../integrations/supabase/types").Json;
@@ -158172,12 +160501,40 @@ export declare const listCarriersForPicker: import("@tanstack/start-client-core"
158172
160501
  order_number: string;
158173
160502
  }[];
158174
160503
  };
160504
+ backfill_open_order_reservations: {
160505
+ Args: never;
160506
+ Returns: {
160507
+ processed_items: number;
160508
+ }[];
160509
+ };
158175
160510
  call_exact_route: {
158176
160511
  Args: {
158177
160512
  path: string;
158178
160513
  };
158179
160514
  Returns: number;
158180
160515
  };
160516
+ check_offer_product_available_stock: {
160517
+ Args: {
160518
+ p_campaign_product_id: string;
160519
+ p_code: string;
160520
+ p_needed_qty?: number;
160521
+ p_product_name?: string;
160522
+ };
160523
+ Returns: import("../integrations/supabase/types").Json;
160524
+ };
160525
+ check_trade_item_available_stock: {
160526
+ Args: {
160527
+ p_connection_id?: string;
160528
+ p_context?: string;
160529
+ p_needed_qty?: number;
160530
+ p_order_id?: string;
160531
+ p_order_item_id?: string;
160532
+ p_owner_id?: string;
160533
+ p_product_name?: string;
160534
+ p_trade_item_key: string;
160535
+ };
160536
+ Returns: import("../integrations/supabase/types").Json;
160537
+ };
158181
160538
  cleanup_old_bookings: {
158182
160539
  Args: never;
158183
160540
  Returns: number;
@@ -158221,6 +160578,12 @@ export declare const listCarriersForPicker: import("@tanstack/start-client-core"
158221
160578
  table_name: string;
158222
160579
  }[];
158223
160580
  };
160581
+ dispatch_carrier_signups_sql: {
160582
+ Args: {
160583
+ _catchup?: string;
160584
+ };
160585
+ Returns: import("../integrations/supabase/types").Json;
160586
+ };
158224
160587
  email_auth_decrypt: {
158225
160588
  Args: {
158226
160589
  cipher: string;
@@ -158293,6 +160656,12 @@ export declare const listCarriersForPicker: import("@tanstack/start-client-core"
158293
160656
  };
158294
160657
  Returns: boolean;
158295
160658
  };
160659
+ find_trade_item_key_by_name: {
160660
+ Args: {
160661
+ p_name: string;
160662
+ };
160663
+ Returns: string;
160664
+ };
158296
160665
  format_cart_number: {
158297
160666
  Args: {
158298
160667
  p_pick_date: string;
@@ -159560,6 +161929,7 @@ export declare const getOrderPickDays: import("@tanstack/start-client-core").Opt
159560
161929
  notes: string | null;
159561
161930
  performed_at: string;
159562
161931
  rescheduled_count: number;
161932
+ stock_consumed_at: string | null;
159563
161933
  total_carts: number;
159564
161934
  updated_at: string;
159565
161935
  user_id: string;
@@ -159573,6 +161943,7 @@ export declare const getOrderPickDays: import("@tanstack/start-client-core").Opt
159573
161943
  notes?: string | null;
159574
161944
  performed_at?: string;
159575
161945
  rescheduled_count?: number;
161946
+ stock_consumed_at?: string | null;
159576
161947
  total_carts?: number;
159577
161948
  updated_at?: string;
159578
161949
  user_id: string;
@@ -159586,6 +161957,7 @@ export declare const getOrderPickDays: import("@tanstack/start-client-core").Opt
159586
161957
  notes?: string | null;
159587
161958
  performed_at?: string;
159588
161959
  rescheduled_count?: number;
161960
+ stock_consumed_at?: string | null;
159589
161961
  total_carts?: number;
159590
161962
  updated_at?: string;
159591
161963
  user_id?: string;
@@ -165344,6 +167716,7 @@ export declare const getOrderPickDays: import("@tanstack/start-client-core").Opt
165344
167716
  purchase_price: number | null;
165345
167717
  quantity: number;
165346
167718
  sale_price: number | null;
167719
+ trade_item_key: string | null;
165347
167720
  unit: string;
165348
167721
  updated_at: string;
165349
167722
  weight: string | null;
@@ -165366,6 +167739,7 @@ export declare const getOrderPickDays: import("@tanstack/start-client-core").Opt
165366
167739
  purchase_price?: number | null;
165367
167740
  quantity?: number;
165368
167741
  sale_price?: number | null;
167742
+ trade_item_key?: string | null;
165369
167743
  unit?: string;
165370
167744
  updated_at?: string;
165371
167745
  weight?: string | null;
@@ -165388,6 +167762,7 @@ export declare const getOrderPickDays: import("@tanstack/start-client-core").Opt
165388
167762
  purchase_price?: number | null;
165389
167763
  quantity?: number;
165390
167764
  sale_price?: number | null;
167765
+ trade_item_key?: string | null;
165391
167766
  unit?: string;
165392
167767
  updated_at?: string;
165393
167768
  weight?: string | null;
@@ -166207,6 +168582,60 @@ export declare const getOrderPickDays: import("@tanstack/start-client-core").Opt
166207
168582
  };
166208
168583
  Relationships: [];
166209
168584
  };
168585
+ stock_mutation_log: {
168586
+ Row: {
168587
+ connection_id: string | null;
168588
+ created_at: string;
168589
+ created_by: string | null;
168590
+ id: string;
168591
+ mutation_type: string;
168592
+ order_id: string | null;
168593
+ order_item_id: string | null;
168594
+ order_source: string | null;
168595
+ physical_after: number | null;
168596
+ physical_before: number | null;
168597
+ qty_delta: number;
168598
+ reason: string | null;
168599
+ reserved_after: number | null;
168600
+ reserved_before: number | null;
168601
+ trade_item_key: string;
168602
+ };
168603
+ Insert: {
168604
+ connection_id?: string | null;
168605
+ created_at?: string;
168606
+ created_by?: string | null;
168607
+ id?: string;
168608
+ mutation_type: string;
168609
+ order_id?: string | null;
168610
+ order_item_id?: string | null;
168611
+ order_source?: string | null;
168612
+ physical_after?: number | null;
168613
+ physical_before?: number | null;
168614
+ qty_delta: number;
168615
+ reason?: string | null;
168616
+ reserved_after?: number | null;
168617
+ reserved_before?: number | null;
168618
+ trade_item_key: string;
168619
+ };
168620
+ Update: {
168621
+ connection_id?: string | null;
168622
+ created_at?: string;
168623
+ created_by?: string | null;
168624
+ id?: string;
168625
+ mutation_type?: string;
168626
+ order_id?: string | null;
168627
+ order_item_id?: string | null;
168628
+ order_source?: string | null;
168629
+ physical_after?: number | null;
168630
+ physical_before?: number | null;
168631
+ qty_delta?: number;
168632
+ reason?: string | null;
168633
+ reserved_after?: number | null;
168634
+ reserved_before?: number | null;
168635
+ trade_item_key?: string;
168636
+ };
168637
+ Relationships: [];
168638
+ };
166210
168639
  supplier_products: {
166211
168640
  Row: {
166212
168641
  article_number: string | null;
@@ -168068,6 +170497,54 @@ export declare const getOrderPickDays: import("@tanstack/start-client-core").Opt
168068
170497
  };
168069
170498
  Returns: number;
168070
170499
  };
170500
+ afh_city_code: {
170501
+ Args: {
170502
+ _city: string;
170503
+ _country: string;
170504
+ };
170505
+ Returns: string;
170506
+ };
170507
+ afh_normalize_country: {
170508
+ Args: {
170509
+ _raw: string;
170510
+ };
170511
+ Returns: string;
170512
+ };
170513
+ afh_normalize_nl_province: {
170514
+ Args: {
170515
+ _raw: string;
170516
+ };
170517
+ Returns: string;
170518
+ };
170519
+ afh_subtract_workdays: {
170520
+ Args: {
170521
+ _date: string;
170522
+ _days: number;
170523
+ };
170524
+ Returns: string;
170525
+ };
170526
+ apply_stock_consumption: {
170527
+ Args: {
170528
+ p_order_id: string;
170529
+ p_order_item_id: string;
170530
+ p_qty: number;
170531
+ p_reason: string;
170532
+ p_source: string;
170533
+ p_trade_item_key: string;
170534
+ };
170535
+ Returns: undefined;
170536
+ };
170537
+ apply_stock_reservation: {
170538
+ Args: {
170539
+ p_order_id: string;
170540
+ p_order_item_id: string;
170541
+ p_qty: number;
170542
+ p_reason: string;
170543
+ p_source: string;
170544
+ p_trade_item_key: string;
170545
+ };
170546
+ Returns: undefined;
170547
+ };
168071
170548
  assign_cart_numbers: {
168072
170549
  Args: {
168073
170550
  p_carts: import("../integrations/supabase/types").Json;
@@ -168091,12 +170568,40 @@ export declare const getOrderPickDays: import("@tanstack/start-client-core").Opt
168091
170568
  order_number: string;
168092
170569
  }[];
168093
170570
  };
170571
+ backfill_open_order_reservations: {
170572
+ Args: never;
170573
+ Returns: {
170574
+ processed_items: number;
170575
+ }[];
170576
+ };
168094
170577
  call_exact_route: {
168095
170578
  Args: {
168096
170579
  path: string;
168097
170580
  };
168098
170581
  Returns: number;
168099
170582
  };
170583
+ check_offer_product_available_stock: {
170584
+ Args: {
170585
+ p_campaign_product_id: string;
170586
+ p_code: string;
170587
+ p_needed_qty?: number;
170588
+ p_product_name?: string;
170589
+ };
170590
+ Returns: import("../integrations/supabase/types").Json;
170591
+ };
170592
+ check_trade_item_available_stock: {
170593
+ Args: {
170594
+ p_connection_id?: string;
170595
+ p_context?: string;
170596
+ p_needed_qty?: number;
170597
+ p_order_id?: string;
170598
+ p_order_item_id?: string;
170599
+ p_owner_id?: string;
170600
+ p_product_name?: string;
170601
+ p_trade_item_key: string;
170602
+ };
170603
+ Returns: import("../integrations/supabase/types").Json;
170604
+ };
168100
170605
  cleanup_old_bookings: {
168101
170606
  Args: never;
168102
170607
  Returns: number;
@@ -168140,6 +170645,12 @@ export declare const getOrderPickDays: import("@tanstack/start-client-core").Opt
168140
170645
  table_name: string;
168141
170646
  }[];
168142
170647
  };
170648
+ dispatch_carrier_signups_sql: {
170649
+ Args: {
170650
+ _catchup?: string;
170651
+ };
170652
+ Returns: import("../integrations/supabase/types").Json;
170653
+ };
168143
170654
  email_auth_decrypt: {
168144
170655
  Args: {
168145
170656
  cipher: string;
@@ -168212,6 +170723,12 @@ export declare const getOrderPickDays: import("@tanstack/start-client-core").Opt
168212
170723
  };
168213
170724
  Returns: boolean;
168214
170725
  };
170726
+ find_trade_item_key_by_name: {
170727
+ Args: {
170728
+ p_name: string;
170729
+ };
170730
+ Returns: string;
170731
+ };
168215
170732
  format_cart_number: {
168216
170733
  Args: {
168217
170734
  p_pick_date: string;