@use-stall/core 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +46 -51
- package/dist/index.d.ts +46 -51
- package/dist/index.js +1256 -1118
- package/dist/index.mjs +1254 -1118
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -704,6 +704,31 @@ declare const fulfillments: {
|
|
|
704
704
|
}) => Promise<void>;
|
|
705
705
|
};
|
|
706
706
|
|
|
707
|
+
declare const sync_service: {
|
|
708
|
+
get_sync_status: () => Promise<{
|
|
709
|
+
pending: number;
|
|
710
|
+
syncing: number;
|
|
711
|
+
failed: number;
|
|
712
|
+
total: number;
|
|
713
|
+
is_sync_running: boolean;
|
|
714
|
+
}>;
|
|
715
|
+
fix_sync_queue: () => Promise<{
|
|
716
|
+
fixed: number;
|
|
717
|
+
}>;
|
|
718
|
+
trigger_sync: (props: {
|
|
719
|
+
sdk: CoreConfig;
|
|
720
|
+
}) => Promise<{
|
|
721
|
+
sync_batch_id: string;
|
|
722
|
+
total: number;
|
|
723
|
+
synced: number;
|
|
724
|
+
failed: number;
|
|
725
|
+
}>;
|
|
726
|
+
start_sync: (props: {
|
|
727
|
+
sdk: CoreConfig;
|
|
728
|
+
}) => Promise<void>;
|
|
729
|
+
stop_sync: () => void;
|
|
730
|
+
};
|
|
731
|
+
|
|
707
732
|
interface ConnectorCacheType {
|
|
708
733
|
id: string;
|
|
709
734
|
code: string;
|
|
@@ -721,6 +746,7 @@ interface SyncQueueType {
|
|
|
721
746
|
error?: string;
|
|
722
747
|
retry_count: number;
|
|
723
748
|
last_retry_at?: number;
|
|
749
|
+
priority: number;
|
|
724
750
|
}
|
|
725
751
|
interface SyncLogType {
|
|
726
752
|
id: string;
|
|
@@ -756,55 +782,6 @@ type CustomersTable = EntityTable<UnifiedCustomerType, "id">;
|
|
|
756
782
|
type LocationsTable = EntityTable<UnifiedLocationType, "id">;
|
|
757
783
|
type FulfillmentsTable = EntityTable<UnifiedFulfillmentType, "id">;
|
|
758
784
|
|
|
759
|
-
declare const sync_service: {
|
|
760
|
-
process_sync_queue: (props: {
|
|
761
|
-
sdk: CoreConfig;
|
|
762
|
-
}) => Promise<{
|
|
763
|
-
sync_batch_id: string;
|
|
764
|
-
total: number;
|
|
765
|
-
synced: number;
|
|
766
|
-
failed: number;
|
|
767
|
-
summary: {
|
|
768
|
-
table: ConnectorModuleKey;
|
|
769
|
-
synced: number;
|
|
770
|
-
failed: number;
|
|
771
|
-
}[];
|
|
772
|
-
}>;
|
|
773
|
-
sync_queue_item: (props: {
|
|
774
|
-
sdk: CoreConfig;
|
|
775
|
-
item: SyncQueueType;
|
|
776
|
-
sync_batch_id: string;
|
|
777
|
-
}) => Promise<{
|
|
778
|
-
success: boolean;
|
|
779
|
-
connector_id?: string;
|
|
780
|
-
error?: string;
|
|
781
|
-
}>;
|
|
782
|
-
start_sync_service: (props: {
|
|
783
|
-
sdk: CoreConfig;
|
|
784
|
-
interval?: number;
|
|
785
|
-
}) => Promise<void>;
|
|
786
|
-
stop_sync_service: () => void;
|
|
787
|
-
get_sync_stats: () => Promise<{
|
|
788
|
-
pending: number;
|
|
789
|
-
syncing: number;
|
|
790
|
-
failed: number;
|
|
791
|
-
total: number;
|
|
792
|
-
}>;
|
|
793
|
-
trigger_sync: (props: {
|
|
794
|
-
sdk: CoreConfig;
|
|
795
|
-
}) => Promise<{
|
|
796
|
-
sync_batch_id: string;
|
|
797
|
-
total: number;
|
|
798
|
-
synced: number;
|
|
799
|
-
failed: number;
|
|
800
|
-
summary: {
|
|
801
|
-
table: ConnectorModuleKey;
|
|
802
|
-
synced: number;
|
|
803
|
-
failed: number;
|
|
804
|
-
}[];
|
|
805
|
-
}>;
|
|
806
|
-
};
|
|
807
|
-
|
|
808
785
|
/**
|
|
809
786
|
* Generate a temporary offline ID
|
|
810
787
|
* Format: stall_{table}_{uuid}_{timestamp}
|
|
@@ -819,6 +796,7 @@ declare const save_bulk_data: (props: {
|
|
|
819
796
|
}) => Promise<void>;
|
|
820
797
|
/**
|
|
821
798
|
* Add a single item to the sync queue for later synchronization
|
|
799
|
+
* Automatically assigns priority: create=1, update=2, delete=3
|
|
822
800
|
*/
|
|
823
801
|
declare const add_to_sync_queue: (props: {
|
|
824
802
|
action: "create" | "update" | "delete";
|
|
@@ -828,7 +806,14 @@ declare const add_to_sync_queue: (props: {
|
|
|
828
806
|
data: Record<string, any>;
|
|
829
807
|
}) => Promise<SyncQueueType>;
|
|
830
808
|
/**
|
|
831
|
-
* Get pending sync queue items
|
|
809
|
+
* Get pending sync queue items ordered by priority
|
|
810
|
+
* Returns items sorted by: priority (create first), then by timestamp
|
|
811
|
+
* Groups by table to maintain dependency order
|
|
812
|
+
*
|
|
813
|
+
* Execution order:
|
|
814
|
+
* 1. All CREATE operations per table (in timestamp order)
|
|
815
|
+
* 2. All UPDATE operations per table (in timestamp order)
|
|
816
|
+
* 3. All DELETE operations per table (in timestamp order)
|
|
832
817
|
*/
|
|
833
818
|
declare const get_pending_sync_queue: () => Promise<Map<ConnectorModuleKey, SyncQueueType[]>>;
|
|
834
819
|
/**
|
|
@@ -898,4 +883,14 @@ declare const local_db: Dexie & {
|
|
|
898
883
|
fulfillments: FulfillmentsTable;
|
|
899
884
|
};
|
|
900
885
|
|
|
901
|
-
|
|
886
|
+
/**
|
|
887
|
+
* Check if the device is online
|
|
888
|
+
* Returns true if navigator.onLine is true or if navigator is not available (Node.js)
|
|
889
|
+
*/
|
|
890
|
+
declare const is_online: () => boolean;
|
|
891
|
+
/**
|
|
892
|
+
* Check if the device is offline
|
|
893
|
+
*/
|
|
894
|
+
declare const is_offline: () => boolean;
|
|
895
|
+
|
|
896
|
+
export { add_sync_log, add_to_sync_queue, categories, cleanup_old_sync_logs, collections, customers, fulfillments, generate_offline_id, get_pending_sync_queue, get_recent_sync_logs, get_sync_logs_by_batch, initializeStallCore, inventory_levels, is_offline, is_online, local_db, locations, order_notes, orders, payment_providers, payments, products, promotions, refunds, remove_from_sync_queue, save_bulk_data, sync_service, tax_rates, tax_regions, update_sync_queue_status, variants };
|
package/dist/index.d.ts
CHANGED
|
@@ -704,6 +704,31 @@ declare const fulfillments: {
|
|
|
704
704
|
}) => Promise<void>;
|
|
705
705
|
};
|
|
706
706
|
|
|
707
|
+
declare const sync_service: {
|
|
708
|
+
get_sync_status: () => Promise<{
|
|
709
|
+
pending: number;
|
|
710
|
+
syncing: number;
|
|
711
|
+
failed: number;
|
|
712
|
+
total: number;
|
|
713
|
+
is_sync_running: boolean;
|
|
714
|
+
}>;
|
|
715
|
+
fix_sync_queue: () => Promise<{
|
|
716
|
+
fixed: number;
|
|
717
|
+
}>;
|
|
718
|
+
trigger_sync: (props: {
|
|
719
|
+
sdk: CoreConfig;
|
|
720
|
+
}) => Promise<{
|
|
721
|
+
sync_batch_id: string;
|
|
722
|
+
total: number;
|
|
723
|
+
synced: number;
|
|
724
|
+
failed: number;
|
|
725
|
+
}>;
|
|
726
|
+
start_sync: (props: {
|
|
727
|
+
sdk: CoreConfig;
|
|
728
|
+
}) => Promise<void>;
|
|
729
|
+
stop_sync: () => void;
|
|
730
|
+
};
|
|
731
|
+
|
|
707
732
|
interface ConnectorCacheType {
|
|
708
733
|
id: string;
|
|
709
734
|
code: string;
|
|
@@ -721,6 +746,7 @@ interface SyncQueueType {
|
|
|
721
746
|
error?: string;
|
|
722
747
|
retry_count: number;
|
|
723
748
|
last_retry_at?: number;
|
|
749
|
+
priority: number;
|
|
724
750
|
}
|
|
725
751
|
interface SyncLogType {
|
|
726
752
|
id: string;
|
|
@@ -756,55 +782,6 @@ type CustomersTable = EntityTable<UnifiedCustomerType, "id">;
|
|
|
756
782
|
type LocationsTable = EntityTable<UnifiedLocationType, "id">;
|
|
757
783
|
type FulfillmentsTable = EntityTable<UnifiedFulfillmentType, "id">;
|
|
758
784
|
|
|
759
|
-
declare const sync_service: {
|
|
760
|
-
process_sync_queue: (props: {
|
|
761
|
-
sdk: CoreConfig;
|
|
762
|
-
}) => Promise<{
|
|
763
|
-
sync_batch_id: string;
|
|
764
|
-
total: number;
|
|
765
|
-
synced: number;
|
|
766
|
-
failed: number;
|
|
767
|
-
summary: {
|
|
768
|
-
table: ConnectorModuleKey;
|
|
769
|
-
synced: number;
|
|
770
|
-
failed: number;
|
|
771
|
-
}[];
|
|
772
|
-
}>;
|
|
773
|
-
sync_queue_item: (props: {
|
|
774
|
-
sdk: CoreConfig;
|
|
775
|
-
item: SyncQueueType;
|
|
776
|
-
sync_batch_id: string;
|
|
777
|
-
}) => Promise<{
|
|
778
|
-
success: boolean;
|
|
779
|
-
connector_id?: string;
|
|
780
|
-
error?: string;
|
|
781
|
-
}>;
|
|
782
|
-
start_sync_service: (props: {
|
|
783
|
-
sdk: CoreConfig;
|
|
784
|
-
interval?: number;
|
|
785
|
-
}) => Promise<void>;
|
|
786
|
-
stop_sync_service: () => void;
|
|
787
|
-
get_sync_stats: () => Promise<{
|
|
788
|
-
pending: number;
|
|
789
|
-
syncing: number;
|
|
790
|
-
failed: number;
|
|
791
|
-
total: number;
|
|
792
|
-
}>;
|
|
793
|
-
trigger_sync: (props: {
|
|
794
|
-
sdk: CoreConfig;
|
|
795
|
-
}) => Promise<{
|
|
796
|
-
sync_batch_id: string;
|
|
797
|
-
total: number;
|
|
798
|
-
synced: number;
|
|
799
|
-
failed: number;
|
|
800
|
-
summary: {
|
|
801
|
-
table: ConnectorModuleKey;
|
|
802
|
-
synced: number;
|
|
803
|
-
failed: number;
|
|
804
|
-
}[];
|
|
805
|
-
}>;
|
|
806
|
-
};
|
|
807
|
-
|
|
808
785
|
/**
|
|
809
786
|
* Generate a temporary offline ID
|
|
810
787
|
* Format: stall_{table}_{uuid}_{timestamp}
|
|
@@ -819,6 +796,7 @@ declare const save_bulk_data: (props: {
|
|
|
819
796
|
}) => Promise<void>;
|
|
820
797
|
/**
|
|
821
798
|
* Add a single item to the sync queue for later synchronization
|
|
799
|
+
* Automatically assigns priority: create=1, update=2, delete=3
|
|
822
800
|
*/
|
|
823
801
|
declare const add_to_sync_queue: (props: {
|
|
824
802
|
action: "create" | "update" | "delete";
|
|
@@ -828,7 +806,14 @@ declare const add_to_sync_queue: (props: {
|
|
|
828
806
|
data: Record<string, any>;
|
|
829
807
|
}) => Promise<SyncQueueType>;
|
|
830
808
|
/**
|
|
831
|
-
* Get pending sync queue items
|
|
809
|
+
* Get pending sync queue items ordered by priority
|
|
810
|
+
* Returns items sorted by: priority (create first), then by timestamp
|
|
811
|
+
* Groups by table to maintain dependency order
|
|
812
|
+
*
|
|
813
|
+
* Execution order:
|
|
814
|
+
* 1. All CREATE operations per table (in timestamp order)
|
|
815
|
+
* 2. All UPDATE operations per table (in timestamp order)
|
|
816
|
+
* 3. All DELETE operations per table (in timestamp order)
|
|
832
817
|
*/
|
|
833
818
|
declare const get_pending_sync_queue: () => Promise<Map<ConnectorModuleKey, SyncQueueType[]>>;
|
|
834
819
|
/**
|
|
@@ -898,4 +883,14 @@ declare const local_db: Dexie & {
|
|
|
898
883
|
fulfillments: FulfillmentsTable;
|
|
899
884
|
};
|
|
900
885
|
|
|
901
|
-
|
|
886
|
+
/**
|
|
887
|
+
* Check if the device is online
|
|
888
|
+
* Returns true if navigator.onLine is true or if navigator is not available (Node.js)
|
|
889
|
+
*/
|
|
890
|
+
declare const is_online: () => boolean;
|
|
891
|
+
/**
|
|
892
|
+
* Check if the device is offline
|
|
893
|
+
*/
|
|
894
|
+
declare const is_offline: () => boolean;
|
|
895
|
+
|
|
896
|
+
export { add_sync_log, add_to_sync_queue, categories, cleanup_old_sync_logs, collections, customers, fulfillments, generate_offline_id, get_pending_sync_queue, get_recent_sync_logs, get_sync_logs_by_batch, initializeStallCore, inventory_levels, is_offline, is_online, local_db, locations, order_notes, orders, payment_providers, payments, products, promotions, refunds, remove_from_sync_queue, save_bulk_data, sync_service, tax_rates, tax_regions, update_sync_queue_status, variants };
|