ofpos-shared-core 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/README.md +37 -0
  2. package/dist/AdapterRegistry.d.ts +83 -0
  3. package/dist/DomainServices.d.ts +151 -0
  4. package/dist/IntegrationServices.d.ts +75 -0
  5. package/dist/PosCore.d.ts +216 -0
  6. package/dist/contracts/contractVersioning.d.ts +6 -0
  7. package/dist/contracts/crossDomainPrimitives.d.ts +5 -0
  8. package/dist/contracts/responseEnvelope.d.ts +6 -0
  9. package/dist/contracts/syncProtocol.d.ts +8 -0
  10. package/dist/data/DbAdapter.d.ts +7 -0
  11. package/dist/data/applyPendingMigrations.d.ts +18 -0
  12. package/dist/data/inMemoryDbAdapter.d.ts +65 -0
  13. package/dist/data/migrations.d.ts +12 -0
  14. package/dist/data/relations.d.ts +3 -0
  15. package/dist/data/schema.d.ts +9 -0
  16. package/dist/data/seed.d.ts +370 -0
  17. package/dist/index.browser.mjs +18 -0
  18. package/dist/index.browser.mjs.LEGAL.txt +46 -0
  19. package/dist/index.cjs.js +18 -0
  20. package/dist/index.cjs.js.LEGAL.txt +46 -0
  21. package/dist/index.d.ts +116 -0
  22. package/dist/index.esm.js +18 -0
  23. package/dist/index.esm.js.LEGAL.txt +46 -0
  24. package/dist/index.umd.js +18 -0
  25. package/dist/index.umd.js.LEGAL.txt +46 -0
  26. package/dist/integration/NotificationAdapter.d.ts +69 -0
  27. package/dist/integration/activityLogger.d.ts +44 -0
  28. package/dist/integration/activitySink.d.ts +8 -0
  29. package/dist/integration/apiService.d.ts +255 -0
  30. package/dist/integration/authorizationService.d.ts +225 -0
  31. package/dist/integration/backupScheduler.d.ts +75 -0
  32. package/dist/integration/checksum.d.ts +9 -0
  33. package/dist/integration/checksumAdapter.d.ts +8 -0
  34. package/dist/integration/configService.d.ts +431 -0
  35. package/dist/integration/defaultChecksumAdapter.d.ts +6 -0
  36. package/dist/integration/defaultEncryptionAdapter.d.ts +9 -0
  37. package/dist/integration/encryption.d.ts +95 -0
  38. package/dist/integration/encryptionAdapter.d.ts +8 -0
  39. package/dist/integration/httpAdapter.d.ts +9 -0
  40. package/dist/integration/loggerAdapter.d.ts +45 -0
  41. package/dist/integration/notificationService.d.ts +45 -0
  42. package/dist/integration/ofauthBridge.d.ts +29 -0
  43. package/dist/integration/ofauthCoreBridge.d.ts +19 -0
  44. package/dist/integration/platformAdapter.d.ts +8 -0
  45. package/dist/integration/roleAdapter.d.ts +61 -0
  46. package/dist/integration/socket.d.ts +60 -0
  47. package/dist/integration/socketAdapter.d.ts +8 -0
  48. package/dist/integration/userService.d.ts +126 -0
  49. package/dist/models/Bom.d.ts +17 -0
  50. package/dist/models/Category.d.ts +13 -0
  51. package/dist/models/Customer.d.ts +17 -0
  52. package/dist/models/CustomerGroup.d.ts +11 -0
  53. package/dist/models/Expense.d.ts +19 -0
  54. package/dist/models/FinancialSetting.d.ts +14 -0
  55. package/dist/models/History.d.ts +18 -0
  56. package/dist/models/InventoryLog.d.ts +23 -0
  57. package/dist/models/InventoryLot.d.ts +34 -0
  58. package/dist/models/KitchenTicket.d.ts +13 -0
  59. package/dist/models/KitchenTicketItem.d.ts +12 -0
  60. package/dist/models/LoyaltyAccount.d.ts +12 -0
  61. package/dist/models/LoyaltyLedger.d.ts +17 -0
  62. package/dist/models/Order.d.ts +45 -0
  63. package/dist/models/OrderItem.d.ts +19 -0
  64. package/dist/models/Payable.d.ts +23 -0
  65. package/dist/models/PriceHistory.d.ts +17 -0
  66. package/dist/models/PriceTier.d.ts +19 -0
  67. package/dist/models/Product.d.ts +25 -0
  68. package/dist/models/Promotion.d.ts +25 -0
  69. package/dist/models/Purchase.d.ts +29 -0
  70. package/dist/models/PurchaseItem.d.ts +21 -0
  71. package/dist/models/PurchaseOrder.d.ts +23 -0
  72. package/dist/models/PurchaseOrderItem.d.ts +19 -0
  73. package/dist/models/Receivable.d.ts +23 -0
  74. package/dist/models/ReportSchedule.d.ts +21 -0
  75. package/dist/models/Return.d.ts +57 -0
  76. package/dist/models/ReturnItem.d.ts +31 -0
  77. package/dist/models/Role.d.ts +13 -0
  78. package/dist/models/Sale.d.ts +43 -0
  79. package/dist/models/SaleItem.d.ts +19 -0
  80. package/dist/models/Settlement.d.ts +23 -0
  81. package/dist/models/Shift.d.ts +41 -0
  82. package/dist/models/StockAdjustment.d.ts +21 -0
  83. package/dist/models/StockOpname.d.ts +22 -0
  84. package/dist/models/StockOpnameItem.d.ts +27 -0
  85. package/dist/models/Supplier.d.ts +19 -0
  86. package/dist/models/TaxRate.d.ts +13 -0
  87. package/dist/models/Transaction.d.ts +32 -0
  88. package/dist/models/Uom.d.ts +15 -0
  89. package/dist/models/User.d.ts +21 -0
  90. package/dist/services/bomService.d.ts +71 -0
  91. package/dist/services/cartService.d.ts +65 -0
  92. package/dist/services/categoryService.d.ts +54 -0
  93. package/dist/services/customerGroupService.d.ts +47 -0
  94. package/dist/services/customerService.d.ts +133 -0
  95. package/dist/services/documentNumberPolicy.d.ts +15 -0
  96. package/dist/services/expenseService.d.ts +47 -0
  97. package/dist/services/exportAdapter.d.ts +48 -0
  98. package/dist/services/exportService.d.ts +263 -0
  99. package/dist/services/financialSettingService.d.ts +47 -0
  100. package/dist/services/historyService.d.ts +60 -0
  101. package/dist/services/inventoryLogService.d.ts +47 -0
  102. package/dist/services/inventoryService.d.ts +43 -0
  103. package/dist/services/orderItemService.d.ts +47 -0
  104. package/dist/services/orderService.d.ts +161 -0
  105. package/dist/services/payableService.d.ts +51 -0
  106. package/dist/services/priceHistoryService.d.ts +61 -0
  107. package/dist/services/priceTierService.d.ts +47 -0
  108. package/dist/services/pricingService.d.ts +192 -0
  109. package/dist/services/productService.d.ts +59 -0
  110. package/dist/services/promotionService.d.ts +47 -0
  111. package/dist/services/purchaseItemService.d.ts +47 -0
  112. package/dist/services/purchaseOrderItemService.d.ts +47 -0
  113. package/dist/services/purchaseOrderService.d.ts +47 -0
  114. package/dist/services/purchaseService.d.ts +130 -0
  115. package/dist/services/receivableService.d.ts +47 -0
  116. package/dist/services/reportScheduleService.d.ts +47 -0
  117. package/dist/services/reportingService.d.ts +251 -0
  118. package/dist/services/returnItemService.d.ts +47 -0
  119. package/dist/services/returnService.d.ts +123 -0
  120. package/dist/services/roleService.d.ts +47 -0
  121. package/dist/services/saleItemService.d.ts +47 -0
  122. package/dist/services/saleService.d.ts +154 -0
  123. package/dist/services/settlementService.d.ts +68 -0
  124. package/dist/services/shiftService.d.ts +92 -0
  125. package/dist/services/stockAdjustmentService.d.ts +47 -0
  126. package/dist/services/stockOpnameItemService.d.ts +47 -0
  127. package/dist/services/stockOpnameService.d.ts +51 -0
  128. package/dist/services/stockTransferService.d.ts +67 -0
  129. package/dist/services/supplierService.d.ts +51 -0
  130. package/dist/services/taxRateService.d.ts +47 -0
  131. package/dist/services/taxService.d.ts +63 -0
  132. package/dist/services/transactionService.d.ts +109 -0
  133. package/dist/services/uiProductService.d.ts +102 -0
  134. package/dist/services/uiTransactionService.d.ts +68 -0
  135. package/dist/services/uomService.d.ts +53 -0
  136. package/dist/services/userService.d.ts +47 -0
  137. package/dist/stores/cartStore.d.ts +109 -0
  138. package/dist/stores/eventBus.d.ts +55 -0
  139. package/dist/stores/sessionStore.d.ts +108 -0
  140. package/dist/stores/storageAdapter.d.ts +44 -0
  141. package/dist/stores/syncService.d.ts +90 -0
  142. package/dist/stores/syncStore.d.ts +163 -0
  143. package/package.json +82 -0
@@ -0,0 +1,47 @@
1
+ import { PosCore } from '../PosCore';
2
+ import { DbAdapter, QueryOptions } from 'ofcore';
3
+ import { Role, RoleData } from '../models/Role';
4
+ /** Service interface for Role operations. */
5
+ export interface IRoleService {
6
+ /** Add new Role. */
7
+ addRole(data: RoleData, tx?: DbAdapter): Promise<Role>;
8
+ /** Update existing Role. */
9
+ updateRole(id: string, data: Partial<RoleData>): Promise<Role>;
10
+ /** Get all Roles with complex options. */
11
+ getRoles(options?: QueryOptions, tx?: DbAdapter): Promise<Role[]>;
12
+ /** Get Role by ID or options. */
13
+ getRole(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Role | null>;
14
+ /** Delete Role (logical). */
15
+ deleteRole(id: string, tx?: DbAdapter): Promise<{
16
+ id: string;
17
+ queued: boolean;
18
+ }>;
19
+ /** Duplicate Role by ID. */
20
+ duplicateRole(originalId: string, tx?: DbAdapter): Promise<Role>;
21
+ }
22
+ /** Service implementation for Role operations. */
23
+ export declare class RoleService implements IRoleService {
24
+ private context;
25
+ private dbAdapter;
26
+ private syncStore?;
27
+ /**
28
+ * Initialize RoleService.
29
+ * @param context - PosCore context
30
+ */
31
+ constructor(context: PosCore);
32
+ /** Add new Role. */
33
+ addRole(data: RoleData, tx?: DbAdapter): Promise<Role>;
34
+ /** Update existing Role. */
35
+ updateRole(id: string, data: Partial<RoleData>, tx?: DbAdapter): Promise<Role>;
36
+ /** Get all Roles with complex options. */
37
+ getRoles(options?: QueryOptions, tx?: DbAdapter): Promise<Role[]>;
38
+ /** Get Role by ID or options. */
39
+ getRole(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Role | null>;
40
+ /** Delete Role (logical). */
41
+ deleteRole(id: string, tx?: DbAdapter): Promise<{
42
+ id: string;
43
+ queued: boolean;
44
+ }>;
45
+ /** Duplicate Role by ID. */
46
+ duplicateRole(originalId: string, tx?: DbAdapter): Promise<Role>;
47
+ }
@@ -0,0 +1,47 @@
1
+ import { PosCore } from '../PosCore';
2
+ import { DbAdapter, QueryOptions } from 'ofcore';
3
+ import { SaleItem, SaleItemData } from '../models/SaleItem';
4
+ /** Service interface for SaleItem operations. */
5
+ export interface ISaleItemService {
6
+ /** Add new SaleItem. */
7
+ addSaleItem(data: SaleItemData, tx?: DbAdapter): Promise<SaleItem>;
8
+ /** Update existing SaleItem. */
9
+ updateSaleItem(id: string, data: Partial<SaleItemData>): Promise<SaleItem>;
10
+ /** Get all SaleItems with complex options. */
11
+ getSaleItems(options?: QueryOptions, tx?: DbAdapter): Promise<SaleItem[]>;
12
+ /** Get SaleItem by ID or options. */
13
+ getSaleItem(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<SaleItem | null>;
14
+ /** Delete SaleItem (logical). */
15
+ deleteSaleItem(id: string, tx?: DbAdapter): Promise<{
16
+ id: string;
17
+ queued: boolean;
18
+ }>;
19
+ /** Duplicate SaleItem by ID. */
20
+ duplicateSaleItem(originalId: string, tx?: DbAdapter): Promise<SaleItem>;
21
+ }
22
+ /** Service implementation for SaleItem operations. */
23
+ export declare class SaleItemService implements ISaleItemService {
24
+ private context;
25
+ private dbAdapter;
26
+ private syncStore?;
27
+ /**
28
+ * Initialize SaleItemService.
29
+ * @param context - PosCore context
30
+ */
31
+ constructor(context: PosCore);
32
+ /** Add new SaleItem. */
33
+ addSaleItem(data: SaleItemData, tx?: DbAdapter): Promise<SaleItem>;
34
+ /** Update existing SaleItem. */
35
+ updateSaleItem(id: string, data: Partial<SaleItemData>, tx?: DbAdapter): Promise<SaleItem>;
36
+ /** Get all SaleItems with complex options. */
37
+ getSaleItems(options?: QueryOptions, tx?: DbAdapter): Promise<SaleItem[]>;
38
+ /** Get SaleItem by ID or options. */
39
+ getSaleItem(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<SaleItem | null>;
40
+ /** Delete SaleItem (logical). */
41
+ deleteSaleItem(id: string, tx?: DbAdapter): Promise<{
42
+ id: string;
43
+ queued: boolean;
44
+ }>;
45
+ /** Duplicate SaleItem by ID. */
46
+ duplicateSaleItem(originalId: string, tx?: DbAdapter): Promise<SaleItem>;
47
+ }
@@ -0,0 +1,154 @@
1
+ import { PosCore } from '../PosCore';
2
+ import { DbAdapter, QueryOptions } from 'ofcore';
3
+ import { Sale, SaleData } from '../models/Sale';
4
+ import { SaleItem } from '../models/SaleItem';
5
+ /** Service interface for Sale operations. */
6
+ export interface ISaleService {
7
+ /** Add new Sale. */
8
+ addSale(data: SaleData, tx?: DbAdapter): Promise<Sale>;
9
+ /** Update existing Sale. */
10
+ updateSale(id: string, data: Partial<SaleData>): Promise<Sale>;
11
+ /** Get all Sales with complex options. */
12
+ getSales(options?: QueryOptions, tx?: DbAdapter): Promise<Sale[]>;
13
+ /** Get Sale by ID or options. */
14
+ getSale(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Sale | null>;
15
+ /** Delete Sale (logical). */
16
+ deleteSale(id: string, tx?: DbAdapter): Promise<{
17
+ id: string;
18
+ queued: boolean;
19
+ }>;
20
+ /** Duplicate Sale by ID. */
21
+ duplicateSale(originalId: string, tx?: DbAdapter): Promise<Sale>;
22
+ createSale(sale: Pick<Sale, 'userId' | 'customerId' | 'sourceOrderId' | 'date' | 'note'>): Promise<Sale>;
23
+ createSale(sale: Omit<Sale, 'version' | 'lastModified' | 'deleted'>, items: Omit<SaleItem, 'version' | 'lastModified' | 'deleted' | 'id' | 'saleId'>[], payment: {
24
+ method: string;
25
+ data?: any;
26
+ dueDate?: string;
27
+ }): Promise<{
28
+ sale: Sale;
29
+ items: SaleItem[];
30
+ }>;
31
+ finalizeSale(saleId: string, payment?: {
32
+ method: string;
33
+ data?: any;
34
+ dueDate?: string;
35
+ }): Promise<void>;
36
+ createSaleFromOrder(orderId: string, payment: {
37
+ method: string;
38
+ data?: any;
39
+ dueDate?: string;
40
+ }): Promise<{
41
+ sale: Sale;
42
+ items: SaleItem[];
43
+ }>;
44
+ createSaleFromCart(cartId: string, payment: {
45
+ method: string;
46
+ data?: any;
47
+ dueDate?: string;
48
+ }): Promise<{
49
+ sale: Sale;
50
+ items: SaleItem[];
51
+ }>;
52
+ requestReprint(saleId: string, input: {
53
+ actorId: string;
54
+ reason: string;
55
+ terminalId?: string | null;
56
+ }): Promise<{
57
+ saleId: string;
58
+ docNo: string | null;
59
+ reprintCount: number;
60
+ duplicateDocNoDetected: boolean;
61
+ }>;
62
+ getDuplicateDocumentNumbers(options?: {
63
+ dateFrom?: string;
64
+ dateTo?: string;
65
+ }): Promise<Array<{
66
+ docNo: string;
67
+ saleIds: string[];
68
+ }>>;
69
+ }
70
+ /** Service implementation for Sale operations. */
71
+ export declare class SaleService implements ISaleService {
72
+ private context;
73
+ private dbAdapter;
74
+ private syncStore?;
75
+ private docNumberPolicy;
76
+ private readonly defaultBaseCurrencyCode;
77
+ /**
78
+ * Initialize SaleService.
79
+ * @param context - PosCore context
80
+ */
81
+ constructor(context: PosCore);
82
+ private roundCurrencyAmount;
83
+ private resolveCurrencySnapshot;
84
+ private isExpiredLot;
85
+ private diffInDays;
86
+ private enforceTempoCustomerCreditPolicy;
87
+ private normalizeDocNo;
88
+ getDuplicateDocumentNumbers(options?: {
89
+ dateFrom?: string;
90
+ dateTo?: string;
91
+ }): Promise<Array<{
92
+ docNo: string;
93
+ saleIds: string[];
94
+ }>>;
95
+ requestReprint(saleId: string, input: {
96
+ actorId: string;
97
+ reason: string;
98
+ terminalId?: string | null;
99
+ }): Promise<{
100
+ saleId: string;
101
+ docNo: string | null;
102
+ reprintCount: number;
103
+ duplicateDocNoDetected: boolean;
104
+ }>;
105
+ private consumeInventoryLotsForSale;
106
+ /** Add new Sale. */
107
+ addSale(data: SaleData, tx?: DbAdapter): Promise<Sale>;
108
+ /** Update existing Sale. */
109
+ updateSale(id: string, data: Partial<SaleData>, tx?: DbAdapter): Promise<Sale>;
110
+ /** Get all Sales with complex options. */
111
+ getSales(options?: QueryOptions, tx?: DbAdapter): Promise<Sale[]>;
112
+ /** Get Sale by ID or options. */
113
+ getSale(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Sale | null>;
114
+ /** Delete Sale (logical). */
115
+ deleteSale(id: string, tx?: DbAdapter): Promise<{
116
+ id: string;
117
+ queued: boolean;
118
+ }>;
119
+ /** Duplicate Sale by ID. */
120
+ duplicateSale(originalId: string, tx?: DbAdapter): Promise<Sale>;
121
+ createSale(sale: Pick<Sale, 'userId' | 'customerId' | 'sourceOrderId' | 'date' | 'note'>): Promise<Sale>;
122
+ createSale(sale: Omit<Sale, 'version' | 'lastModified' | 'deleted'>, items: Omit<SaleItem, 'version' | 'lastModified' | 'deleted' | 'id' | 'saleId'>[], payment: {
123
+ method: string;
124
+ data?: any;
125
+ dueDate?: string;
126
+ }): Promise<{
127
+ sale: Sale;
128
+ items: SaleItem[];
129
+ }>;
130
+ finalizeSale(saleId: string, payment?: {
131
+ method: string;
132
+ data?: any;
133
+ dueDate?: string;
134
+ }): Promise<void>;
135
+ createSaleFromOrder(orderId: string, payment: {
136
+ method: string;
137
+ data?: any;
138
+ dueDate?: string;
139
+ }): Promise<{
140
+ sale: Sale;
141
+ items: SaleItem[];
142
+ }>;
143
+ /**
144
+ * Membuat penjualan dari keranjang belanja (cart).
145
+ */
146
+ createSaleFromCart(cartId: string, payment: {
147
+ method: string;
148
+ data?: any;
149
+ dueDate?: string;
150
+ }): Promise<{
151
+ sale: Sale;
152
+ items: SaleItem[];
153
+ }>;
154
+ }
@@ -0,0 +1,68 @@
1
+ import { PosCore } from '../PosCore';
2
+ import { DbAdapter, QueryOptions } from 'ofcore';
3
+ import { Settlement, SettlementData } from '../models/Settlement';
4
+ /** Service interface for Settlement operations. */
5
+ export interface ISettlementService {
6
+ /** Add new Settlement. */
7
+ addSettlement(data: SettlementData, tx?: DbAdapter): Promise<Settlement>;
8
+ /** Update existing Settlement. */
9
+ updateSettlement(id: string, data: Partial<SettlementData>): Promise<Settlement>;
10
+ /** Get all Settlements with complex options. */
11
+ getSettlements(options?: QueryOptions, tx?: DbAdapter): Promise<Settlement[]>;
12
+ /** Get Settlement by ID or options. */
13
+ getSettlement(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Settlement | null>;
14
+ /** Delete Settlement (logical). */
15
+ deleteSettlement(id: string, tx?: DbAdapter): Promise<{
16
+ id: string;
17
+ queued: boolean;
18
+ }>;
19
+ /** Duplicate Settlement by ID. */
20
+ duplicateSettlement(originalId: string, tx?: DbAdapter): Promise<Settlement>;
21
+ createSettlement(data: {
22
+ receivableId?: string;
23
+ payableId?: string;
24
+ amount: number;
25
+ method: string;
26
+ date: string;
27
+ reference?: string;
28
+ userId: string;
29
+ idempotencyKey?: string;
30
+ }): Promise<Settlement>;
31
+ }
32
+ /** Service implementation for Settlement operations. */
33
+ export declare class SettlementService implements ISettlementService {
34
+ private context;
35
+ private dbAdapter;
36
+ private syncStore?;
37
+ private runInTransaction;
38
+ /**
39
+ * Initialize SettlementService.
40
+ * @param context - PosCore context
41
+ */
42
+ constructor(context: PosCore);
43
+ /** Add new Settlement. */
44
+ addSettlement(data: SettlementData, tx?: DbAdapter): Promise<Settlement>;
45
+ /** Update existing Settlement. */
46
+ updateSettlement(id: string, data: Partial<SettlementData>, tx?: DbAdapter): Promise<Settlement>;
47
+ /** Get all Settlements with complex options. */
48
+ getSettlements(options?: QueryOptions, tx?: DbAdapter): Promise<Settlement[]>;
49
+ /** Get Settlement by ID or options. */
50
+ getSettlement(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Settlement | null>;
51
+ /** Delete Settlement (logical). */
52
+ deleteSettlement(id: string, tx?: DbAdapter): Promise<{
53
+ id: string;
54
+ queued: boolean;
55
+ }>;
56
+ /** Duplicate Settlement by ID. */
57
+ duplicateSettlement(originalId: string, tx?: DbAdapter): Promise<Settlement>;
58
+ createSettlement(data: {
59
+ receivableId?: string;
60
+ payableId?: string;
61
+ amount: number;
62
+ method: string;
63
+ date: string;
64
+ reference?: string;
65
+ userId: string;
66
+ idempotencyKey?: string;
67
+ }): Promise<Settlement>;
68
+ }
@@ -0,0 +1,92 @@
1
+ import { PosCore } from '../PosCore';
2
+ import { DbAdapter, QueryOptions } from 'ofcore';
3
+ import { Shift, ShiftData } from '../models/Shift';
4
+ import { DailyReport } from './reportingService';
5
+ /** Service interface for Shift operations. */
6
+ export interface IShiftService {
7
+ /** Add new Shift. */
8
+ addShift(data: ShiftData, tx?: DbAdapter): Promise<Shift>;
9
+ /** Update existing Shift. */
10
+ updateShift(id: string, data: Partial<ShiftData>): Promise<Shift>;
11
+ /** Get all Shifts with complex options. */
12
+ getShifts(options?: QueryOptions, tx?: DbAdapter): Promise<Shift[]>;
13
+ /** Get Shift by ID or options. */
14
+ getShift(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Shift | null>;
15
+ /** Delete Shift (logical). */
16
+ deleteShift(id: string, tx?: DbAdapter): Promise<{
17
+ id: string;
18
+ queued: boolean;
19
+ }>;
20
+ /** Duplicate Shift by ID. */
21
+ duplicateShift(originalId: string, tx?: DbAdapter): Promise<Shift>;
22
+ openShift(cashierId: string, startingCash: number, note?: string): Promise<Shift>;
23
+ closeShift(shiftId: string, endingCash: number, noteOrOptions?: string | {
24
+ note?: string;
25
+ approval?: {
26
+ approvedBy: string;
27
+ reason: string;
28
+ };
29
+ }): Promise<Shift>;
30
+ reopenShift(closedShiftId: string, approval: {
31
+ approvedBy: string;
32
+ reason: string;
33
+ startingCash?: number;
34
+ }): Promise<Shift>;
35
+ getActiveShift(cashierId: string): Promise<Shift | null>;
36
+ getShiftsByDate(date: string): Promise<Shift[]>;
37
+ closeShiftPreview(shiftId: string): Promise<{
38
+ cashIn: number;
39
+ cashOut: number;
40
+ }>;
41
+ getDailyReport(date: string): Promise<DailyReport>;
42
+ }
43
+ /** Service implementation for Shift operations. */
44
+ export declare class ShiftService implements IShiftService {
45
+ private context;
46
+ private dbAdapter;
47
+ private syncStore?;
48
+ /**
49
+ * Initialize ShiftService.
50
+ * @param context - PosCore context
51
+ */
52
+ constructor(context: PosCore);
53
+ /** Add new Shift. */
54
+ addShift(data: ShiftData, tx?: DbAdapter): Promise<Shift>;
55
+ /** Update existing Shift. */
56
+ updateShift(id: string, data: Partial<ShiftData>, tx?: DbAdapter): Promise<Shift>;
57
+ /** Get all Shifts with complex options. */
58
+ getShifts(options?: QueryOptions, tx?: DbAdapter): Promise<Shift[]>;
59
+ /** Get Shift by ID or options. */
60
+ getShift(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Shift | null>;
61
+ /** Delete Shift (logical). */
62
+ deleteShift(id: string, tx?: DbAdapter): Promise<{
63
+ id: string;
64
+ queued: boolean;
65
+ }>;
66
+ /** Duplicate Shift by ID. */
67
+ duplicateShift(originalId: string, tx?: DbAdapter): Promise<Shift>;
68
+ openShift(cashierId: string, startingCash: number, note?: string): Promise<Shift>;
69
+ /** Tutup shift + hitung selisih kas */
70
+ closeShift(shiftId: string, endingCash: number, noteOrOptions?: string | {
71
+ note?: string;
72
+ approval?: {
73
+ approvedBy: string;
74
+ reason: string;
75
+ };
76
+ }): Promise<Shift>;
77
+ reopenShift(closedShiftId: string, approval: {
78
+ approvedBy: string;
79
+ reason: string;
80
+ startingCash?: number;
81
+ }): Promise<Shift>;
82
+ /** Ambil shift aktif kasir */
83
+ getActiveShift(cashierId: string): Promise<Shift | null>;
84
+ /** Ambil semua shift di tanggal tertentu */
85
+ getShiftsByDate(date: string): Promise<Shift[]>;
86
+ closeShiftPreview(shiftId: string): Promise<{
87
+ cashIn: number;
88
+ cashOut: number;
89
+ }>;
90
+ /** Laporan harian lengkap */
91
+ getDailyReport(date: string): Promise<DailyReport>;
92
+ }
@@ -0,0 +1,47 @@
1
+ import { PosCore } from '../PosCore';
2
+ import { DbAdapter, QueryOptions } from 'ofcore';
3
+ import { StockAdjustment, StockAdjustmentData } from '../models/StockAdjustment';
4
+ /** Service interface for StockAdjustment operations. */
5
+ export interface IStockAdjustmentService {
6
+ /** Add new StockAdjustment. */
7
+ addStockAdjustment(data: StockAdjustmentData, tx?: DbAdapter): Promise<StockAdjustment>;
8
+ /** Update existing StockAdjustment. */
9
+ updateStockAdjustment(id: string, data: Partial<StockAdjustmentData>): Promise<StockAdjustment>;
10
+ /** Get all StockAdjustments with complex options. */
11
+ getStockAdjustments(options?: QueryOptions, tx?: DbAdapter): Promise<StockAdjustment[]>;
12
+ /** Get StockAdjustment by ID or options. */
13
+ getStockAdjustment(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<StockAdjustment | null>;
14
+ /** Delete StockAdjustment (logical). */
15
+ deleteStockAdjustment(id: string, tx?: DbAdapter): Promise<{
16
+ id: string;
17
+ queued: boolean;
18
+ }>;
19
+ /** Duplicate StockAdjustment by ID. */
20
+ duplicateStockAdjustment(originalId: string, tx?: DbAdapter): Promise<StockAdjustment>;
21
+ }
22
+ /** Service implementation for StockAdjustment operations. */
23
+ export declare class StockAdjustmentService implements IStockAdjustmentService {
24
+ private context;
25
+ private dbAdapter;
26
+ private syncStore?;
27
+ /**
28
+ * Initialize StockAdjustmentService.
29
+ * @param context - PosCore context
30
+ */
31
+ constructor(context: PosCore);
32
+ /** Add new StockAdjustment. */
33
+ addStockAdjustment(data: StockAdjustmentData, tx?: DbAdapter): Promise<StockAdjustment>;
34
+ /** Update existing StockAdjustment. */
35
+ updateStockAdjustment(id: string, data: Partial<StockAdjustmentData>, tx?: DbAdapter): Promise<StockAdjustment>;
36
+ /** Get all StockAdjustments with complex options. */
37
+ getStockAdjustments(options?: QueryOptions, tx?: DbAdapter): Promise<StockAdjustment[]>;
38
+ /** Get StockAdjustment by ID or options. */
39
+ getStockAdjustment(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<StockAdjustment | null>;
40
+ /** Delete StockAdjustment (logical). */
41
+ deleteStockAdjustment(id: string, tx?: DbAdapter): Promise<{
42
+ id: string;
43
+ queued: boolean;
44
+ }>;
45
+ /** Duplicate StockAdjustment by ID. */
46
+ duplicateStockAdjustment(originalId: string, tx?: DbAdapter): Promise<StockAdjustment>;
47
+ }
@@ -0,0 +1,47 @@
1
+ import { PosCore } from '../PosCore';
2
+ import { DbAdapter, QueryOptions } from 'ofcore';
3
+ import { StockOpnameItem, StockOpnameItemData } from '../models/StockOpnameItem';
4
+ /** Service interface for StockOpnameItem operations. */
5
+ export interface IStockOpnameItemService {
6
+ /** Add new StockOpnameItem. */
7
+ addStockOpnameItem(data: StockOpnameItemData, tx?: DbAdapter): Promise<StockOpnameItem>;
8
+ /** Update existing StockOpnameItem. */
9
+ updateStockOpnameItem(id: string, data: Partial<StockOpnameItemData>): Promise<StockOpnameItem>;
10
+ /** Get all StockOpnameItems with complex options. */
11
+ getStockOpnameItems(options?: QueryOptions, tx?: DbAdapter): Promise<StockOpnameItem[]>;
12
+ /** Get StockOpnameItem by ID or options. */
13
+ getStockOpnameItem(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<StockOpnameItem | null>;
14
+ /** Delete StockOpnameItem (logical). */
15
+ deleteStockOpnameItem(id: string, tx?: DbAdapter): Promise<{
16
+ id: string;
17
+ queued: boolean;
18
+ }>;
19
+ /** Duplicate StockOpnameItem by ID. */
20
+ duplicateStockOpnameItem(originalId: string, tx?: DbAdapter): Promise<StockOpnameItem>;
21
+ }
22
+ /** Service implementation for StockOpnameItem operations. */
23
+ export declare class StockOpnameItemService implements IStockOpnameItemService {
24
+ private context;
25
+ private dbAdapter;
26
+ private syncStore?;
27
+ /**
28
+ * Initialize StockOpnameItemService.
29
+ * @param context - PosCore context
30
+ */
31
+ constructor(context: PosCore);
32
+ /** Add new StockOpnameItem. */
33
+ addStockOpnameItem(data: StockOpnameItemData, tx?: DbAdapter): Promise<StockOpnameItem>;
34
+ /** Update existing StockOpnameItem. */
35
+ updateStockOpnameItem(id: string, data: Partial<StockOpnameItemData>, tx?: DbAdapter): Promise<StockOpnameItem>;
36
+ /** Get all StockOpnameItems with complex options. */
37
+ getStockOpnameItems(options?: QueryOptions, tx?: DbAdapter): Promise<StockOpnameItem[]>;
38
+ /** Get StockOpnameItem by ID or options. */
39
+ getStockOpnameItem(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<StockOpnameItem | null>;
40
+ /** Delete StockOpnameItem (logical). */
41
+ deleteStockOpnameItem(id: string, tx?: DbAdapter): Promise<{
42
+ id: string;
43
+ queued: boolean;
44
+ }>;
45
+ /** Duplicate StockOpnameItem by ID. */
46
+ duplicateStockOpnameItem(originalId: string, tx?: DbAdapter): Promise<StockOpnameItem>;
47
+ }
@@ -0,0 +1,51 @@
1
+ import { PosCore } from '../PosCore';
2
+ import { DbAdapter, QueryOptions } from 'ofcore';
3
+ import { StockOpname, StockOpnameData } from '../models/StockOpname';
4
+ /** Service interface for StockOpname operations. */
5
+ export interface IStockOpnameService {
6
+ /** Add new StockOpname. */
7
+ addStockOpname(data: StockOpnameData, tx?: DbAdapter): Promise<StockOpname>;
8
+ /** Update existing StockOpname. */
9
+ updateStockOpname(id: string, data: Partial<StockOpnameData>): Promise<StockOpname>;
10
+ /** Get all StockOpnames with complex options. */
11
+ getStockOpnames(options?: QueryOptions, tx?: DbAdapter): Promise<StockOpname[]>;
12
+ /** Get StockOpname by ID or options. */
13
+ getStockOpname(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<StockOpname | null>;
14
+ /** Delete StockOpname (logical). */
15
+ deleteStockOpname(id: string, tx?: DbAdapter): Promise<{
16
+ id: string;
17
+ queued: boolean;
18
+ }>;
19
+ /** Duplicate StockOpname by ID. */
20
+ duplicateStockOpname(originalId: string, tx?: DbAdapter): Promise<StockOpname>;
21
+ cancelOpname(opnameId: string): Promise<void>;
22
+ completeOpname(stockOpnameId: string): Promise<void>;
23
+ }
24
+ /** Service implementation for StockOpname operations. */
25
+ export declare class StockOpnameService implements IStockOpnameService {
26
+ private context;
27
+ private dbAdapter;
28
+ private syncStore?;
29
+ /**
30
+ * Initialize StockOpnameService.
31
+ * @param context - PosCore context
32
+ */
33
+ constructor(context: PosCore);
34
+ /** Add new StockOpname. */
35
+ addStockOpname(data: StockOpnameData, tx?: DbAdapter): Promise<StockOpname>;
36
+ /** Update existing StockOpname. */
37
+ updateStockOpname(id: string, data: Partial<StockOpnameData>, tx?: DbAdapter): Promise<StockOpname>;
38
+ /** Get all StockOpnames with complex options. */
39
+ getStockOpnames(options?: QueryOptions, tx?: DbAdapter): Promise<StockOpname[]>;
40
+ /** Get StockOpname by ID or options. */
41
+ getStockOpname(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<StockOpname | null>;
42
+ /** Delete StockOpname (logical). */
43
+ deleteStockOpname(id: string, tx?: DbAdapter): Promise<{
44
+ id: string;
45
+ queued: boolean;
46
+ }>;
47
+ /** Duplicate StockOpname by ID. */
48
+ duplicateStockOpname(originalId: string, tx?: DbAdapter): Promise<StockOpname>;
49
+ cancelOpname(opnameId: string): Promise<void>;
50
+ completeOpname(stockOpnameId: string): Promise<void>;
51
+ }
@@ -0,0 +1,67 @@
1
+ import { PosCore } from '../PosCore';
2
+ type TransferStatus = 'requested' | 'approved' | 'shipped' | 'received' | 'cancelled';
3
+ interface TransferItem {
4
+ productId: string;
5
+ quantity: number;
6
+ }
7
+ interface TransferRecord {
8
+ id: string;
9
+ sourceBranchId: string;
10
+ targetBranchId: string;
11
+ status: TransferStatus;
12
+ items: TransferItem[];
13
+ notes?: string | null;
14
+ requestedBy?: string | null;
15
+ approvedBy?: string | null;
16
+ shippedBy?: string | null;
17
+ receivedBy?: string | null;
18
+ requestedAt?: string;
19
+ approvedAt?: string;
20
+ shippedAt?: string;
21
+ receivedAt?: string;
22
+ }
23
+ export interface IStockTransferService {
24
+ requestTransfer(input: {
25
+ sourceBranchId: string;
26
+ targetBranchId: string;
27
+ items: TransferItem[];
28
+ notes?: string | null;
29
+ }): Promise<TransferRecord>;
30
+ approveTransfer(transferId: string, input?: {
31
+ notes?: string | null;
32
+ }): Promise<TransferRecord>;
33
+ shipTransfer(transferId: string, input?: {
34
+ notes?: string | null;
35
+ }): Promise<TransferRecord>;
36
+ receiveTransfer(transferId: string, input?: {
37
+ notes?: string | null;
38
+ }): Promise<TransferRecord>;
39
+ getTransfer(transferId: string): Promise<TransferRecord | null>;
40
+ }
41
+ export declare class StockTransferService implements IStockTransferService {
42
+ private context;
43
+ private dbAdapter;
44
+ constructor(context: PosCore);
45
+ private getActorId;
46
+ private normalizeBranch;
47
+ private ensureItems;
48
+ private appendEvent;
49
+ private mergeState;
50
+ getTransfer(transferId: string): Promise<TransferRecord | null>;
51
+ requestTransfer(input: {
52
+ sourceBranchId: string;
53
+ targetBranchId: string;
54
+ items: TransferItem[];
55
+ notes?: string | null;
56
+ }): Promise<TransferRecord>;
57
+ approveTransfer(transferId: string, input?: {
58
+ notes?: string | null;
59
+ }): Promise<TransferRecord>;
60
+ shipTransfer(transferId: string, input?: {
61
+ notes?: string | null;
62
+ }): Promise<TransferRecord>;
63
+ receiveTransfer(transferId: string, input?: {
64
+ notes?: string | null;
65
+ }): Promise<TransferRecord>;
66
+ }
67
+ export {};
@@ -0,0 +1,51 @@
1
+ import { PosCore } from '../PosCore';
2
+ import { DbAdapter, QueryOptions } from 'ofcore';
3
+ import { Supplier, SupplierData } from '../models/Supplier';
4
+ /** Service interface for Supplier operations. */
5
+ export interface ISupplierService {
6
+ /** Add new Supplier. */
7
+ addSupplier(data: SupplierData, tx?: DbAdapter): Promise<Supplier>;
8
+ /** Update existing Supplier. */
9
+ updateSupplier(id: string, data: Partial<SupplierData>): Promise<Supplier>;
10
+ /** Get all Suppliers with complex options. */
11
+ getSuppliers(options?: QueryOptions, tx?: DbAdapter): Promise<Supplier[]>;
12
+ /** Get Supplier by ID or options. */
13
+ getSupplier(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Supplier | null>;
14
+ /** Delete Supplier (logical). */
15
+ deleteSupplier(id: string, tx?: DbAdapter): Promise<{
16
+ id: string;
17
+ queued: boolean;
18
+ }>;
19
+ /** Duplicate Supplier by ID. */
20
+ duplicateSupplier(originalId: string, tx?: DbAdapter): Promise<Supplier>;
21
+ /** Search Supplier by full-text keyword. */
22
+ searchSuppliers(keyword: string, options?: QueryOptions, tx?: DbAdapter): Promise<Supplier[]>;
23
+ }
24
+ /** Service implementation for Supplier operations. */
25
+ export declare class SupplierService implements ISupplierService {
26
+ private context;
27
+ private dbAdapter;
28
+ private syncStore?;
29
+ /**
30
+ * Initialize SupplierService.
31
+ * @param context - PosCore context
32
+ */
33
+ constructor(context: PosCore);
34
+ /** Add new Supplier. */
35
+ addSupplier(data: SupplierData, tx?: DbAdapter): Promise<Supplier>;
36
+ /** Update existing Supplier. */
37
+ updateSupplier(id: string, data: Partial<SupplierData>, tx?: DbAdapter): Promise<Supplier>;
38
+ /** Get all Suppliers with complex options. */
39
+ getSuppliers(options?: QueryOptions, tx?: DbAdapter): Promise<Supplier[]>;
40
+ /** Get Supplier by ID or options. */
41
+ getSupplier(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Supplier | null>;
42
+ /** Delete Supplier (logical). */
43
+ deleteSupplier(id: string, tx?: DbAdapter): Promise<{
44
+ id: string;
45
+ queued: boolean;
46
+ }>;
47
+ /** Duplicate Supplier by ID. */
48
+ duplicateSupplier(originalId: string, tx?: DbAdapter): Promise<Supplier>;
49
+ /** Search Supplier by full-text keyword. */
50
+ searchSuppliers(keyword: string, options?: QueryOptions, tx?: DbAdapter): Promise<Supplier[]>;
51
+ }