@use-stall/core 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -19,68 +19,69 @@ The Stall Core SDK provides an adapter-based architecture that allows you to:
19
19
 
20
20
  ```
21
21
  ┌──────────────────────────────────────────┐
22
- Your Application
22
+ Your Application
23
23
  └────────────────┬─────────────────────────┘
24
24
 
25
25
  ┌───────▼──────────────────┐
26
26
  │ initializeStallCore() │
27
- Returns: CoreConfig
27
+ Returns: CoreConfig
28
28
  └───────┬──────────────────┘
29
-
29
+
30
30
  ┌────────────▼──────────────┐
31
- Service Layer
32
- ├──────────────────────────┤
33
- │ - products, orders, etc.
34
- - All 16+ services
35
- └────────────┬─────────────┘
31
+ Service Layer
32
+ ├───────────────────────────┤
33
+ │ - products, orders, etc.
34
+ - All 16+ services
35
+ └────────────┬──────────────┘
36
36
 
37
37
  ┌────────────▼────────────────────────┐
38
- Offline-First Processing
38
+ Offline-First Processing
39
39
  ├─────────────────────────────────────┤
40
40
  │ Read Operations: │
41
- │ 1. Fetch from Connector
42
- │ 2. Cache in Local DB (Dexie)
43
- │ 3. Return cached data
41
+ │ 1. Fetch from Connector
42
+ │ 2. Cache in Local DB (Dexie)
43
+ │ 3. Return cached data
44
44
  │ │
45
45
  │ Write Operations: │
46
- │ 1. Generate temporary offline ID
47
- │ 2. Save locally immediately
48
- │ 3. Queue for sync
49
- │ 4. Return local data instantly
46
+ │ 1. Generate temporary offline ID
47
+ │ 2. Save locally immediately
48
+ │ 3. Queue for sync
49
+ │ 4. Return local data instantly
50
50
  │ │
51
- │ Storage: IndexedDB + Dexie
52
- │ Tables: products, orders, sync_queue,
53
- sync_logs, customers, etc.
51
+ │ Storage: IndexedDB + Dexie
52
+ │ Tables: products, orders,
53
+ sync_queue, sync_logs,
54
+ │ customers, etc. │
54
55
  └────────────┬────────────────────────┘
55
56
 
56
57
  ┌────────────▼──────────────────┐
57
- Sync Queue & Smart Sync
58
+ Sync Queue & Smart Sync
58
59
  ├───────────────────────────────┤
59
60
  │ - Dependency-aware processing │
60
- - 5-layer sync strategy
61
- - Automatic ID replacement
62
- - Batch sync operations
63
- - Sync status logging
61
+ - 5-layer sync strategy
62
+ - Automatic ID replacement
63
+ - Batch sync operations
64
+ - Sync status logging
64
65
  └────────────┬──────────────────┘
65
66
 
66
67
  ┌────────────▼──────────────────────┐
67
- Adapter Module (Cached)
68
+ Adapter Module (Cached)
68
69
  │ ┌─────────────────────────────┐ │
69
- │ │ - Products, Orders modules │ │
70
- │ │ - All connector modules │ │
70
+ │ │ - Products, Orders modules │ │
71
+ │ │ - All connector modules │ │
71
72
  │ └─────────────────────────────┘ │
72
- Caching: TTL 4 hours (default)
73
+ Caching: TTL 4 hours (default)
73
74
  └────────────┬──────────────────────┘
74
75
 
75
76
  ┌────────────▼──────────────────┐
76
- Connector Loader
77
- (Dynamic Module Import)
77
+ Connector Loader
78
+ (Dynamic Module Import)
78
79
  └────────────┬──────────────────┘
79
80
 
80
81
  ┌────────────▼───────────────────────┐
81
- Commerce Platform API
82
- (WooCommerce, Shopify, Medusa, │
83
- Shopware, Google Sheets, etc.)
82
+ Commerce Platform API
83
+ (WooCommerce, Shopify, Medusa, │
84
+ Shopware, Google Sheets, etc.)
84
85
  └────────────────────────────────────┘
85
86
  ```
86
87
 
@@ -112,7 +113,7 @@ const stall = initializeStallCore({
112
113
 
113
114
  ```typescript
114
115
  try {
115
- // Products
116
+ // Core operations - same pattern for all services
116
117
  const productList = await products.list({ sdk: stall, query: 'laptop' });
117
118
  const product = await products.retrieve({ sdk: stall, id: 'prod_123' });
118
119
  const newProduct = await products.create({
@@ -131,13 +132,6 @@ try {
131
132
  sdk: stall,
132
133
  data: [{ name: 'Product 1' }, { name: 'Product 2' }]
133
134
  });
134
- const updated = await products.bulk_update({
135
- sdk: stall,
136
- data: [
137
- { id: 'prod_1', data: { name: 'Updated 1' } },
138
- { id: 'prod_2', data: { name: 'Updated 2' } },
139
- ]
140
- });
141
135
  await products.bulk_delete({ sdk: stall, ids: ['prod_1', 'prod_2'] });
142
136
  } catch (error) {
143
137
  console.error('Operation failed:', error);
@@ -165,12 +159,6 @@ Each service module provides 8 standard operations:
165
159
  // Products
166
160
  const productList = await products.list({ sdk: stall, query: 'laptop' });
167
161
  const product = await products.retrieve({ sdk: stall, id: 'prod_123' });
168
- const newProduct = await products.create({ sdk: stall, data: { name: 'New Product' } });
169
- const updated = await products.update({ sdk: stall, id: 'prod_123', data: { price: 99.99 } });
170
- await products.delete({ sdk: stall, id: 'prod_123' });
171
- const bulkProducts = await products.bulk_create({ sdk: stall, data: [...] });
172
- const updatedBulk = await products.bulk_update({ sdk: stall, data: [...] });
173
- await products.bulk_delete({ sdk: stall, ids: ['prod_1', 'prod_2'] });
174
162
 
175
163
  // Variants
176
164
  const variantList = await variants.list({ sdk: stall, query: 'color-red' });
@@ -182,18 +170,11 @@ const category = await categories.retrieve({ sdk: stall, id: 'cat_123' });
182
170
 
183
171
  // Collections
184
172
  const collectionList = await collections.list({ sdk: stall, query: 'featured' });
185
- const collection = await collections.retrieve({ sdk: stall, id: 'coll_123' });
186
173
  const newCollection = await collections.create({ sdk: stall, data: { title: 'Summer Sale' } });
187
174
 
188
175
  // Inventory Levels
189
176
  const inventoryList = await inventory_levels.list({ sdk: stall, query: 'low' });
190
- const inventory = await inventory_levels.retrieve({ sdk: stall, id: 'inv_123' });
191
177
  const newInventory = await inventory_levels.create({ sdk: stall, data: { quantity: 100 } });
192
- const updatedInventory = await inventory_levels.update({ sdk: stall, id: 'inv_123', data: { quantity: 150 } });
193
- await inventory_levels.delete({ sdk: stall, id: 'inv_123' });
194
- const bulkInventory = await inventory_levels.bulk_create({ sdk: stall, data: [...] });
195
- const updatedBulkInventory = await inventory_levels.bulk_update({ sdk: stall, data: [...] });
196
- await inventory_levels.bulk_delete({ sdk: stall, ids: ['inv_1', 'inv_2'] });
197
178
  ```
198
179
 
199
180
  ### Order Management
@@ -203,17 +184,13 @@ await inventory_levels.bulk_delete({ sdk: stall, ids: ['inv_1', 'inv_2'] });
203
184
  const orderList = await orders.list({ sdk: stall, query: 'pending' });
204
185
  const order = await orders.retrieve({ sdk: stall, id: 'order_123' });
205
186
  const newOrder = await orders.create({ sdk: stall, data: { customer_id: 'cust_123' } });
206
- const updatedOrder = await orders.update({ sdk: stall, id: 'order_123', data: { status: 'shipped' } });
207
- await orders.delete({ sdk: stall, id: 'order_123' });
208
187
 
209
188
  // Order Notes
210
189
  const noteList = await order_notes.list({ sdk: stall, query: 'urgent' });
211
- const note = await order_notes.retrieve({ sdk: stall, id: 'note_123' });
212
190
  const newNote = await order_notes.create({ sdk: stall, data: { text: 'Handle with care' } });
213
191
 
214
192
  // Refunds
215
193
  const refundList = await refunds.list({ sdk: stall, query: 'pending' });
216
- const refund = await refunds.retrieve({ sdk: stall, id: 'ref_123' });
217
194
  const newRefund = await refunds.create({ sdk: stall, data: { amount: 99.99 } });
218
195
  ```
219
196
 
@@ -224,8 +201,6 @@ const newRefund = await refunds.create({ sdk: stall, data: { amount: 99.99 } });
224
201
  const customers_list = await customers.list({ sdk: stall, query: 'john' });
225
202
  const customer = await customers.retrieve({ sdk: stall, id: 'cust_123' });
226
203
  const newCustomer = await customers.create({ sdk: stall, data: { email: 'john@example.com' } });
227
- const updatedCustomer = await customers.update({ sdk: stall, id: 'cust_123', data: { phone: '+1234567890' } });
228
- await customers.delete({ sdk: stall, id: 'cust_123' });
229
204
  ```
230
205
 
231
206
  ### Promotions
@@ -233,7 +208,6 @@ await customers.delete({ sdk: stall, id: 'cust_123' });
233
208
  ```typescript
234
209
  // Promotions
235
210
  const promotionList = await promotions.list({ sdk: stall, query: 'active' });
236
- const promotion = await promotions.retrieve({ sdk: stall, id: 'promo_123' });
237
211
  const newPromotion = await promotions.create({ sdk: stall, data: { code: 'SUMMER20' } });
238
212
  ```
239
213
 
@@ -242,14 +216,10 @@ const newPromotion = await promotions.create({ sdk: stall, data: { code: 'SUMMER
242
216
  ```typescript
243
217
  // Payment Providers
244
218
  const providerList = await payment_providers.list({ sdk: stall, query: 'stripe' });
245
- const provider = await payment_providers.retrieve({ sdk: stall, id: 'pay_prov_123' });
246
219
  const newProvider = await payment_providers.create({ sdk: stall, data: { name: 'PayPal' } });
247
- const updatedProvider = await payment_providers.update({ sdk: stall, id: 'pay_prov_123', data: { status: 'active' } });
248
- await payment_providers.delete({ sdk: stall, id: 'pay_prov_123' });
249
220
 
250
221
  // Payments
251
222
  const paymentList = await payments.list({ sdk: stall, query: 'successful' });
252
- const payment = await payments.retrieve({ sdk: stall, id: 'pay_123' });
253
223
  const newPayment = await payments.create({ sdk: stall, data: { amount: 199.99 } });
254
224
  ```
255
225
 
@@ -258,17 +228,14 @@ const newPayment = await payments.create({ sdk: stall, data: { amount: 199.99 }
258
228
  ```typescript
259
229
  // Tax Regions
260
230
  const taxRegionList = await tax_regions.list({ sdk: stall, query: 'US' });
261
- const taxRegion = await tax_regions.retrieve({ sdk: stall, id: 'tax_reg_123' });
262
231
  const newTaxRegion = await tax_regions.create({ sdk: stall, data: { country: 'US' } });
263
232
 
264
233
  // Tax Rates
265
234
  const taxRateList = await tax_rates.list({ sdk: stall, query: 'standard' });
266
- const taxRate = await tax_rates.retrieve({ sdk: stall, id: 'tax_rate_123' });
267
235
  const newTaxRate = await tax_rates.create({ sdk: stall, data: { rate: 0.1 } });
268
236
 
269
237
  // Locations
270
238
  const locationList = await locations.list({ sdk: stall, query: 'warehouse' });
271
- const location = await locations.retrieve({ sdk: stall, id: 'loc_123' });
272
239
  const newLocation = await locations.create({ sdk: stall, data: { name: 'Main Warehouse' } });
273
240
  ```
274
241
 
@@ -277,7 +244,6 @@ const newLocation = await locations.create({ sdk: stall, data: { name: 'Main War
277
244
  ```typescript
278
245
  // Fulfillments
279
246
  const fulfillmentList = await fulfillments.list({ sdk: stall, query: 'pending' });
280
- const fulfillment = await fulfillments.retrieve({ sdk: stall, id: 'ful_123' });
281
247
  const newFulfillment = await fulfillments.create({ sdk: stall, data: { order_id: 'order_123' } });
282
248
  ```
283
249
 
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConnectorModuleKey, UnifiedProductType, UnifiedVariantsType, UnifiedCollectionType, UnifiedCategoryType, UnifiedTagProductTag, UnifiedInventoryLevelType, UnifiedPromotion, UnifiedOrderType, UnifiedOrderNote, UnifiedOrderRefundType, UnifiedPaymentProviderType, UnifiedPaymentCollectionType, UnifiedTaxRegionType, UnifiedTaxRateType, UnifiedCustomerType, UnifiedLocationType, UnifiedFulfillmentMethodType, UnifiedFulfillmentProviderConfigType, UnifiedFulfillmentType } from '@use-stall/types';
1
+ import { ConnectorModuleKey, UnifiedProductType, UnifiedVariantsType, UnifiedCollectionType, UnifiedCategoryType, UnifiedTagProductTag, UnifiedInventoryLevelType, UnifiedPromotion, UnifiedOrderType, UnifiedOrderNote, UnifiedOrderRefundType, UnifiedPaymentProviderType, UnifiedPaymentCollectionType, UnifiedTaxRate, UnifiedTaxClass, UnifiedCustomerType, UnifiedLocationType, UnifiedFulfillmentMethodType, UnifiedFulfillmentProviderConfigType, UnifiedFulfillmentType } from '@use-stall/types';
2
2
  import Dexie, { EntityTable } from 'dexie';
3
3
 
4
4
  interface StallCoreConfigOptions {
@@ -27,8 +27,8 @@ type ModuleTypeMap = {
27
27
  refunds: UnifiedOrderRefundType;
28
28
  payment_providers: UnifiedPaymentProviderType;
29
29
  payments: UnifiedPaymentCollectionType;
30
- tax_regions: UnifiedTaxRegionType;
31
- tax_rates: UnifiedTaxRateType;
30
+ tax_rates: UnifiedTaxRate;
31
+ tax_classes: UnifiedTaxClass;
32
32
  customers: UnifiedCustomerType;
33
33
  locations: UnifiedLocationType;
34
34
  fulfillment_types: UnifiedFulfillmentMethodType;
@@ -36,12 +36,15 @@ type ModuleTypeMap = {
36
36
  fulfillments: UnifiedFulfillmentType;
37
37
  };
38
38
 
39
- type GetModuleType<K extends ConnectorModuleKey> = K extends keyof ModuleTypeMap
39
+ // Extended module key that includes tax_classes
40
+ type ExtendedModuleKey$1 = ConnectorModuleKey | "tax_classes";
41
+
42
+ type GetModuleType<K extends ExtendedModuleKey$1> = K extends keyof ModuleTypeMap
40
43
  ? ModuleTypeMap[K]
41
44
  : never;
42
45
 
43
46
  type AdapterModuleType = {
44
- [K in ConnectorModuleKey]: {
47
+ [K in ExtendedModuleKey$1]: {
45
48
  list: (props: {
46
49
  connector_config: Record<string, any>;
47
50
  query?: string;
@@ -548,78 +551,78 @@ declare const payments: {
548
551
  }) => Promise<void>;
549
552
  };
550
553
 
551
- declare const tax_regions: {
554
+ declare const tax_rates: {
552
555
  list: (props: {
553
556
  sdk: CoreConfig;
554
557
  query?: string;
555
- }) => Promise<UnifiedTaxRegionType[]>;
558
+ }) => Promise<UnifiedTaxRate[]>;
556
559
  retrieve: (props: {
557
560
  sdk: CoreConfig;
558
561
  id: string;
559
- }) => Promise<UnifiedTaxRegionType>;
562
+ }) => Promise<UnifiedTaxRate>;
560
563
  create: (props: {
561
564
  sdk: CoreConfig;
562
- data: UnifiedTaxRegionType;
563
- }) => Promise<UnifiedTaxRegionType>;
565
+ data: UnifiedTaxRate;
566
+ }) => Promise<UnifiedTaxRate>;
564
567
  update: (props: {
565
568
  sdk: CoreConfig;
566
569
  id: string;
567
- data: Partial<UnifiedTaxRegionType>;
568
- }) => Promise<UnifiedTaxRegionType>;
570
+ data: Partial<UnifiedTaxRate>;
571
+ }) => Promise<UnifiedTaxRate>;
569
572
  delete: (props: {
570
573
  sdk: CoreConfig;
571
574
  id: string;
572
575
  }) => Promise<void>;
573
576
  bulk_create: (props: {
574
577
  sdk: CoreConfig;
575
- data: UnifiedTaxRegionType[];
576
- }) => Promise<UnifiedTaxRegionType[]>;
578
+ data: UnifiedTaxRate[];
579
+ }) => Promise<UnifiedTaxRate[]>;
577
580
  bulk_update: (props: {
578
581
  sdk: CoreConfig;
579
582
  data: Array<{
580
583
  id: string;
581
- data: Partial<UnifiedTaxRegionType>;
584
+ data: Partial<UnifiedTaxRate>;
582
585
  }>;
583
- }) => Promise<UnifiedTaxRegionType[]>;
586
+ }) => Promise<UnifiedTaxRate[]>;
584
587
  bulk_delete: (props: {
585
588
  sdk: CoreConfig;
586
589
  ids: string[];
587
590
  }) => Promise<void>;
588
591
  };
589
592
 
590
- declare const tax_rates: {
593
+ declare const tax_classes: {
591
594
  list: (props: {
592
595
  sdk: CoreConfig;
593
596
  query?: string;
594
- }) => Promise<UnifiedTaxRateType[]>;
597
+ }) => Promise<UnifiedTaxClass[]>;
595
598
  retrieve: (props: {
596
599
  sdk: CoreConfig;
597
600
  id: string;
598
- }) => Promise<UnifiedTaxRateType>;
601
+ }) => Promise<UnifiedTaxClass>;
599
602
  create: (props: {
600
603
  sdk: CoreConfig;
601
- data: UnifiedTaxRateType;
602
- }) => Promise<UnifiedTaxRateType>;
604
+ data: UnifiedTaxClass;
605
+ }) => Promise<UnifiedTaxClass>;
603
606
  update: (props: {
604
607
  sdk: CoreConfig;
605
608
  id: string;
606
- data: Partial<UnifiedTaxRateType>;
607
- }) => Promise<UnifiedTaxRateType>;
609
+ data: Partial<UnifiedTaxClass>;
610
+ }) => Promise<UnifiedTaxClass>;
608
611
  delete: (props: {
609
612
  sdk: CoreConfig;
610
613
  id: string;
611
614
  }) => Promise<void>;
612
615
  bulk_create: (props: {
613
616
  sdk: CoreConfig;
614
- data: UnifiedTaxRateType[];
615
- }) => Promise<UnifiedTaxRateType[]>;
617
+ data: UnifiedTaxClass[];
618
+ }) => Promise<UnifiedTaxClass[]>;
616
619
  bulk_update: (props: {
617
620
  sdk: CoreConfig;
618
621
  data: Array<{
619
622
  id: string;
620
- data: Partial<UnifiedTaxRateType>;
623
+ data: Partial<UnifiedTaxClass>;
621
624
  }>;
622
- }) => Promise<UnifiedTaxRateType[]>;
625
+ }) => Promise<UnifiedTaxClass[]>;
623
626
  bulk_delete: (props: {
624
627
  sdk: CoreConfig;
625
628
  ids: string[];
@@ -732,6 +735,7 @@ declare const sync_service: {
732
735
  }>;
733
736
  };
734
737
 
738
+ type ExtendedModuleKey = ConnectorModuleKey;
735
739
  interface ConnectorCacheType {
736
740
  id: string;
737
741
  code: string;
@@ -740,7 +744,7 @@ interface ConnectorCacheType {
740
744
  interface SyncQueueType {
741
745
  id: string;
742
746
  action: "create" | "update" | "delete";
743
- table: ConnectorModuleKey;
747
+ table: ExtendedModuleKey;
744
748
  document_id: string;
745
749
  stall_offline_id: string;
746
750
  data: Record<string, any>;
@@ -754,7 +758,7 @@ interface SyncQueueType {
754
758
  interface SyncLogType {
755
759
  id: string;
756
760
  sync_batch_id: string;
757
- table: ConnectorModuleKey;
761
+ table: ExtendedModuleKey;
758
762
  action: "create" | "update" | "delete";
759
763
  document_id: string;
760
764
  stall_offline_id: string;
@@ -779,8 +783,8 @@ type OrderNotesTable = EntityTable<UnifiedOrderNote, "id">;
779
783
  type RefundsTable = EntityTable<UnifiedOrderRefundType, "id">;
780
784
  type PaymentProvidersTable = EntityTable<UnifiedPaymentProviderType, "id">;
781
785
  type PaymentsTable = EntityTable<UnifiedPaymentCollectionType, "id">;
782
- type TaxRegionsTable = EntityTable<UnifiedTaxRegionType, "id">;
783
- type TaxRatesTable = EntityTable<UnifiedTaxRateType, "id">;
786
+ type TaxRatesTable = EntityTable<UnifiedTaxRate, "id">;
787
+ type TaxClassesTable = EntityTable<UnifiedTaxClass, "id">;
784
788
  type CustomersTable = EntityTable<UnifiedCustomerType, "id">;
785
789
  type LocationsTable = EntityTable<UnifiedLocationType, "id">;
786
790
  type FulfillmentsTable = EntityTable<UnifiedFulfillmentType, "id">;
@@ -883,8 +887,8 @@ declare const local_db: Dexie & {
883
887
  refunds: RefundsTable;
884
888
  payment_providers: PaymentProvidersTable;
885
889
  payments: PaymentsTable;
886
- tax_regions: TaxRegionsTable;
887
890
  tax_rates: TaxRatesTable;
891
+ tax_classes: TaxClassesTable;
888
892
  customers: CustomersTable;
889
893
  locations: LocationsTable;
890
894
  fulfillments: FulfillmentsTable;
@@ -900,4 +904,4 @@ declare const is_online: () => boolean;
900
904
  */
901
905
  declare const is_offline: () => boolean;
902
906
 
903
- 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, is_sync_queue_empty, 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 };
907
+ 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, is_sync_queue_empty, local_db, locations, order_notes, orders, payment_providers, payments, products, promotions, refunds, remove_from_sync_queue, save_bulk_data, sync_service, tax_classes, tax_rates, update_sync_queue_status, variants };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConnectorModuleKey, UnifiedProductType, UnifiedVariantsType, UnifiedCollectionType, UnifiedCategoryType, UnifiedTagProductTag, UnifiedInventoryLevelType, UnifiedPromotion, UnifiedOrderType, UnifiedOrderNote, UnifiedOrderRefundType, UnifiedPaymentProviderType, UnifiedPaymentCollectionType, UnifiedTaxRegionType, UnifiedTaxRateType, UnifiedCustomerType, UnifiedLocationType, UnifiedFulfillmentMethodType, UnifiedFulfillmentProviderConfigType, UnifiedFulfillmentType } from '@use-stall/types';
1
+ import { ConnectorModuleKey, UnifiedProductType, UnifiedVariantsType, UnifiedCollectionType, UnifiedCategoryType, UnifiedTagProductTag, UnifiedInventoryLevelType, UnifiedPromotion, UnifiedOrderType, UnifiedOrderNote, UnifiedOrderRefundType, UnifiedPaymentProviderType, UnifiedPaymentCollectionType, UnifiedTaxRate, UnifiedTaxClass, UnifiedCustomerType, UnifiedLocationType, UnifiedFulfillmentMethodType, UnifiedFulfillmentProviderConfigType, UnifiedFulfillmentType } from '@use-stall/types';
2
2
  import Dexie, { EntityTable } from 'dexie';
3
3
 
4
4
  interface StallCoreConfigOptions {
@@ -27,8 +27,8 @@ type ModuleTypeMap = {
27
27
  refunds: UnifiedOrderRefundType;
28
28
  payment_providers: UnifiedPaymentProviderType;
29
29
  payments: UnifiedPaymentCollectionType;
30
- tax_regions: UnifiedTaxRegionType;
31
- tax_rates: UnifiedTaxRateType;
30
+ tax_rates: UnifiedTaxRate;
31
+ tax_classes: UnifiedTaxClass;
32
32
  customers: UnifiedCustomerType;
33
33
  locations: UnifiedLocationType;
34
34
  fulfillment_types: UnifiedFulfillmentMethodType;
@@ -36,12 +36,15 @@ type ModuleTypeMap = {
36
36
  fulfillments: UnifiedFulfillmentType;
37
37
  };
38
38
 
39
- type GetModuleType<K extends ConnectorModuleKey> = K extends keyof ModuleTypeMap
39
+ // Extended module key that includes tax_classes
40
+ type ExtendedModuleKey$1 = ConnectorModuleKey | "tax_classes";
41
+
42
+ type GetModuleType<K extends ExtendedModuleKey$1> = K extends keyof ModuleTypeMap
40
43
  ? ModuleTypeMap[K]
41
44
  : never;
42
45
 
43
46
  type AdapterModuleType = {
44
- [K in ConnectorModuleKey]: {
47
+ [K in ExtendedModuleKey$1]: {
45
48
  list: (props: {
46
49
  connector_config: Record<string, any>;
47
50
  query?: string;
@@ -548,78 +551,78 @@ declare const payments: {
548
551
  }) => Promise<void>;
549
552
  };
550
553
 
551
- declare const tax_regions: {
554
+ declare const tax_rates: {
552
555
  list: (props: {
553
556
  sdk: CoreConfig;
554
557
  query?: string;
555
- }) => Promise<UnifiedTaxRegionType[]>;
558
+ }) => Promise<UnifiedTaxRate[]>;
556
559
  retrieve: (props: {
557
560
  sdk: CoreConfig;
558
561
  id: string;
559
- }) => Promise<UnifiedTaxRegionType>;
562
+ }) => Promise<UnifiedTaxRate>;
560
563
  create: (props: {
561
564
  sdk: CoreConfig;
562
- data: UnifiedTaxRegionType;
563
- }) => Promise<UnifiedTaxRegionType>;
565
+ data: UnifiedTaxRate;
566
+ }) => Promise<UnifiedTaxRate>;
564
567
  update: (props: {
565
568
  sdk: CoreConfig;
566
569
  id: string;
567
- data: Partial<UnifiedTaxRegionType>;
568
- }) => Promise<UnifiedTaxRegionType>;
570
+ data: Partial<UnifiedTaxRate>;
571
+ }) => Promise<UnifiedTaxRate>;
569
572
  delete: (props: {
570
573
  sdk: CoreConfig;
571
574
  id: string;
572
575
  }) => Promise<void>;
573
576
  bulk_create: (props: {
574
577
  sdk: CoreConfig;
575
- data: UnifiedTaxRegionType[];
576
- }) => Promise<UnifiedTaxRegionType[]>;
578
+ data: UnifiedTaxRate[];
579
+ }) => Promise<UnifiedTaxRate[]>;
577
580
  bulk_update: (props: {
578
581
  sdk: CoreConfig;
579
582
  data: Array<{
580
583
  id: string;
581
- data: Partial<UnifiedTaxRegionType>;
584
+ data: Partial<UnifiedTaxRate>;
582
585
  }>;
583
- }) => Promise<UnifiedTaxRegionType[]>;
586
+ }) => Promise<UnifiedTaxRate[]>;
584
587
  bulk_delete: (props: {
585
588
  sdk: CoreConfig;
586
589
  ids: string[];
587
590
  }) => Promise<void>;
588
591
  };
589
592
 
590
- declare const tax_rates: {
593
+ declare const tax_classes: {
591
594
  list: (props: {
592
595
  sdk: CoreConfig;
593
596
  query?: string;
594
- }) => Promise<UnifiedTaxRateType[]>;
597
+ }) => Promise<UnifiedTaxClass[]>;
595
598
  retrieve: (props: {
596
599
  sdk: CoreConfig;
597
600
  id: string;
598
- }) => Promise<UnifiedTaxRateType>;
601
+ }) => Promise<UnifiedTaxClass>;
599
602
  create: (props: {
600
603
  sdk: CoreConfig;
601
- data: UnifiedTaxRateType;
602
- }) => Promise<UnifiedTaxRateType>;
604
+ data: UnifiedTaxClass;
605
+ }) => Promise<UnifiedTaxClass>;
603
606
  update: (props: {
604
607
  sdk: CoreConfig;
605
608
  id: string;
606
- data: Partial<UnifiedTaxRateType>;
607
- }) => Promise<UnifiedTaxRateType>;
609
+ data: Partial<UnifiedTaxClass>;
610
+ }) => Promise<UnifiedTaxClass>;
608
611
  delete: (props: {
609
612
  sdk: CoreConfig;
610
613
  id: string;
611
614
  }) => Promise<void>;
612
615
  bulk_create: (props: {
613
616
  sdk: CoreConfig;
614
- data: UnifiedTaxRateType[];
615
- }) => Promise<UnifiedTaxRateType[]>;
617
+ data: UnifiedTaxClass[];
618
+ }) => Promise<UnifiedTaxClass[]>;
616
619
  bulk_update: (props: {
617
620
  sdk: CoreConfig;
618
621
  data: Array<{
619
622
  id: string;
620
- data: Partial<UnifiedTaxRateType>;
623
+ data: Partial<UnifiedTaxClass>;
621
624
  }>;
622
- }) => Promise<UnifiedTaxRateType[]>;
625
+ }) => Promise<UnifiedTaxClass[]>;
623
626
  bulk_delete: (props: {
624
627
  sdk: CoreConfig;
625
628
  ids: string[];
@@ -732,6 +735,7 @@ declare const sync_service: {
732
735
  }>;
733
736
  };
734
737
 
738
+ type ExtendedModuleKey = ConnectorModuleKey;
735
739
  interface ConnectorCacheType {
736
740
  id: string;
737
741
  code: string;
@@ -740,7 +744,7 @@ interface ConnectorCacheType {
740
744
  interface SyncQueueType {
741
745
  id: string;
742
746
  action: "create" | "update" | "delete";
743
- table: ConnectorModuleKey;
747
+ table: ExtendedModuleKey;
744
748
  document_id: string;
745
749
  stall_offline_id: string;
746
750
  data: Record<string, any>;
@@ -754,7 +758,7 @@ interface SyncQueueType {
754
758
  interface SyncLogType {
755
759
  id: string;
756
760
  sync_batch_id: string;
757
- table: ConnectorModuleKey;
761
+ table: ExtendedModuleKey;
758
762
  action: "create" | "update" | "delete";
759
763
  document_id: string;
760
764
  stall_offline_id: string;
@@ -779,8 +783,8 @@ type OrderNotesTable = EntityTable<UnifiedOrderNote, "id">;
779
783
  type RefundsTable = EntityTable<UnifiedOrderRefundType, "id">;
780
784
  type PaymentProvidersTable = EntityTable<UnifiedPaymentProviderType, "id">;
781
785
  type PaymentsTable = EntityTable<UnifiedPaymentCollectionType, "id">;
782
- type TaxRegionsTable = EntityTable<UnifiedTaxRegionType, "id">;
783
- type TaxRatesTable = EntityTable<UnifiedTaxRateType, "id">;
786
+ type TaxRatesTable = EntityTable<UnifiedTaxRate, "id">;
787
+ type TaxClassesTable = EntityTable<UnifiedTaxClass, "id">;
784
788
  type CustomersTable = EntityTable<UnifiedCustomerType, "id">;
785
789
  type LocationsTable = EntityTable<UnifiedLocationType, "id">;
786
790
  type FulfillmentsTable = EntityTable<UnifiedFulfillmentType, "id">;
@@ -883,8 +887,8 @@ declare const local_db: Dexie & {
883
887
  refunds: RefundsTable;
884
888
  payment_providers: PaymentProvidersTable;
885
889
  payments: PaymentsTable;
886
- tax_regions: TaxRegionsTable;
887
890
  tax_rates: TaxRatesTable;
891
+ tax_classes: TaxClassesTable;
888
892
  customers: CustomersTable;
889
893
  locations: LocationsTable;
890
894
  fulfillments: FulfillmentsTable;
@@ -900,4 +904,4 @@ declare const is_online: () => boolean;
900
904
  */
901
905
  declare const is_offline: () => boolean;
902
906
 
903
- 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, is_sync_queue_empty, 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 };
907
+ 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, is_sync_queue_empty, local_db, locations, order_notes, orders, payment_providers, payments, products, promotions, refunds, remove_from_sync_queue, save_bulk_data, sync_service, tax_classes, tax_rates, update_sync_queue_status, variants };