ofpos-shared-core 1.1.0 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IntegrationServices.d.ts +0 -4
- package/dist/PosCore.d.ts +46 -1
- package/dist/data/schema.d.ts +1 -3
- package/dist/finance/offinanceProjection.d.ts +37 -0
- package/dist/index.browser.mjs +4 -4
- package/dist/index.cjs.js +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.esm.js +4 -4
- package/dist/index.umd.js +4 -4
- package/dist/integration/NotificationAdapter.d.ts +6 -67
- package/dist/integration/authorizationService.d.ts +2 -19
- package/dist/integration/changeQueuePort.d.ts +5 -0
- package/dist/integration/loggerAdapter.d.ts +6 -43
- package/dist/integration/socket.d.ts +13 -0
- package/dist/integration/userService.d.ts +17 -32
- package/dist/models/User.d.ts +0 -6
- package/dist/services/bomService.d.ts +1 -1
- package/dist/services/categoryService.d.ts +1 -1
- package/dist/services/customerGroupService.d.ts +1 -1
- package/dist/services/customerService.d.ts +1 -1
- package/dist/services/expenseService.d.ts +1 -1
- package/dist/services/exportAdapter.d.ts +6 -46
- package/dist/services/financialSettingService.d.ts +1 -1
- package/dist/services/historyService.d.ts +1 -1
- package/dist/services/inventoryLogService.d.ts +2 -1
- package/dist/services/inventoryService.d.ts +7 -1
- package/dist/services/orderItemService.d.ts +1 -1
- package/dist/services/orderService.d.ts +1 -1
- package/dist/services/payableService.d.ts +1 -1
- package/dist/services/priceHistoryService.d.ts +1 -1
- package/dist/services/priceTierService.d.ts +1 -1
- package/dist/services/productService.d.ts +1 -1
- package/dist/services/promotionService.d.ts +1 -1
- package/dist/services/purchaseItemService.d.ts +1 -1
- package/dist/services/purchaseOrderItemService.d.ts +1 -1
- package/dist/services/purchaseOrderService.d.ts +1 -1
- package/dist/services/purchaseService.d.ts +3 -1
- package/dist/services/receivableService.d.ts +1 -1
- package/dist/services/reportScheduleService.d.ts +1 -1
- package/dist/services/reportingService.d.ts +1 -1
- package/dist/services/returnItemService.d.ts +1 -1
- package/dist/services/returnService.d.ts +1 -1
- package/dist/services/roleService.d.ts +1 -1
- package/dist/services/saleItemService.d.ts +1 -1
- package/dist/services/saleService.d.ts +2 -1
- package/dist/services/settlementService.d.ts +1 -1
- package/dist/services/shiftService.d.ts +1 -1
- package/dist/services/stockAdjustmentService.d.ts +1 -1
- package/dist/services/stockOpnameItemService.d.ts +1 -1
- package/dist/services/stockOpnameService.d.ts +1 -1
- package/dist/services/supplierService.d.ts +1 -1
- package/dist/services/taxRateService.d.ts +1 -1
- package/dist/services/transactionService.d.ts +1 -1
- package/dist/services/uiProductService.d.ts +0 -1
- package/dist/services/uomService.d.ts +1 -1
- package/dist/services/userService.d.ts +1 -1
- package/dist/stores/storageAdapter.d.ts +8 -39
- package/dist/stores/syncService.d.ts +16 -0
- package/package.json +27 -7
- package/dist/data/inMemoryDbAdapter.d.ts +0 -65
- package/dist/data/seed.d.ts +0 -370
- package/dist/integration/ofauthBridge.d.ts +0 -29
- package/dist/integration/ofauthCoreBridge.d.ts +0 -19
|
@@ -9,7 +9,6 @@ import { ISocketService } from './integration/socket';
|
|
|
9
9
|
import { INotificationService } from './integration/notificationService';
|
|
10
10
|
import { IConfigService } from './integration/configService';
|
|
11
11
|
import { IBackupScheduler } from './integration/backupScheduler';
|
|
12
|
-
import { IOfauthBridge } from './integration/ofauthBridge';
|
|
13
12
|
/**
|
|
14
13
|
* Override layanan integrasi untuk menginisialisasi IntegrationServices dengan implementasi kustom.
|
|
15
14
|
*/
|
|
@@ -33,7 +32,6 @@ export type IntegrationServicesOverride = {
|
|
|
33
32
|
/** Layanan pencatatan aktivitas. */
|
|
34
33
|
activityLogger: IActivityLogger;
|
|
35
34
|
backupScheduler: IBackupScheduler;
|
|
36
|
-
ofauthBridge: IOfauthBridge;
|
|
37
35
|
};
|
|
38
36
|
/**
|
|
39
37
|
* Penyedia seluruh layanan integrasi yang digunakan oleh PosCore.
|
|
@@ -62,8 +60,6 @@ export declare class IntegrationServices {
|
|
|
62
60
|
/** Layanan pencatatan aktivitas. */
|
|
63
61
|
activityLogger: IActivityLogger;
|
|
64
62
|
backupScheduler: IBackupScheduler;
|
|
65
|
-
/** Bridge auth compatibility (opsional) untuk adopsi ofauth-shared-core bertahap. */
|
|
66
|
-
ofauthBridge: IOfauthBridge;
|
|
67
63
|
/**
|
|
68
64
|
* Membuat instance IntegrationServices.
|
|
69
65
|
* @param context - Instans PosCore yang menggunakan layanan ini.
|
package/dist/PosCore.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReadonlyStore } from 'ofcore';
|
|
2
2
|
import { DomainServices, DomainServicesOverride } from './DomainServices';
|
|
3
|
-
import { SyncStore } from './stores/syncStore';
|
|
3
|
+
import { SyncStore, type State as SyncState, type SyncChange } from './stores/syncStore';
|
|
4
4
|
import { ConfigService } from './integration/configService';
|
|
5
5
|
import { AdapterRegistry, AdapterRegistryOptions } from './AdapterRegistry';
|
|
6
6
|
import { IntegrationServices, IntegrationServicesOverride } from './IntegrationServices';
|
|
@@ -22,6 +22,11 @@ export interface PosRuntimeState {
|
|
|
22
22
|
lastError: string | null;
|
|
23
23
|
lastTransitionAt: string;
|
|
24
24
|
}
|
|
25
|
+
export type DomainChangeQueueState = SyncState;
|
|
26
|
+
export type DomainChangeQueueItem = SyncChange;
|
|
27
|
+
export type SyncOrchestrationMode = 'host-managed';
|
|
28
|
+
export type AuthBridgePolicyMode = 'bridge-required';
|
|
29
|
+
export type DomainChangeSink = (change: DomainChangeQueueItem) => void | Promise<void>;
|
|
25
30
|
/**
|
|
26
31
|
* Kelas utama PosCore yang mengatur lifecycle, registri adapter,
|
|
27
32
|
* domain services, integration services, dan plugin.
|
|
@@ -45,11 +50,34 @@ export declare class PosCore {
|
|
|
45
50
|
integrationServiceOverrides: Partial<IntegrationServicesOverride>;
|
|
46
51
|
private runtime;
|
|
47
52
|
private pluginSpecs;
|
|
53
|
+
private authBridgePolicyMode;
|
|
54
|
+
private domainChangeSink?;
|
|
48
55
|
constructor();
|
|
49
56
|
/**
|
|
50
57
|
* Dapatkan instansi SyncStore.
|
|
51
58
|
*/
|
|
52
59
|
getSyncStore(): SyncStore | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Ambil snapshot antrean perubahan domain (API netral, tanpa surface sync runtime).
|
|
62
|
+
*/
|
|
63
|
+
getDomainChangeQueueState(): DomainChangeQueueState;
|
|
64
|
+
/**
|
|
65
|
+
* Subscribe perubahan antrean domain.
|
|
66
|
+
*/
|
|
67
|
+
subscribeDomainChangeQueue(listener: (state: DomainChangeQueueState) => void): () => void;
|
|
68
|
+
/**
|
|
69
|
+
* Ambil daftar perubahan domain yang belum tersinkron.
|
|
70
|
+
*/
|
|
71
|
+
getQueuedDomainChanges(): DomainChangeQueueItem[];
|
|
72
|
+
/**
|
|
73
|
+
* Tambahkan perubahan domain ke antrean.
|
|
74
|
+
*/
|
|
75
|
+
enqueueDomainChange(change: unknown): void;
|
|
76
|
+
/**
|
|
77
|
+
* Hapus item antrean domain (biasanya setelah ack sinkronisasi host).
|
|
78
|
+
*/
|
|
79
|
+
removeDomainQueuedChange(changeId: string): void;
|
|
80
|
+
setDomainChangeSink(sink?: DomainChangeSink): void;
|
|
53
81
|
/**
|
|
54
82
|
* Dapatkan instansi SessionStore untuk update status login.
|
|
55
83
|
*/
|
|
@@ -122,6 +150,9 @@ export declare class PosCore {
|
|
|
122
150
|
*/
|
|
123
151
|
get config(): ConfigService;
|
|
124
152
|
isOnline(): boolean | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Generate correlation id untuk tracing lintas request/log.
|
|
155
|
+
*/
|
|
125
156
|
/**
|
|
126
157
|
* Generate correlation id untuk tracing lintas request/log.
|
|
127
158
|
*/
|
|
@@ -141,6 +172,7 @@ export declare class PosCore {
|
|
|
141
172
|
export declare class PosCoreBuilder {
|
|
142
173
|
private core;
|
|
143
174
|
private adapterOpts;
|
|
175
|
+
private syncOrchestrationMode;
|
|
144
176
|
/**
|
|
145
177
|
* Set platform adapter.
|
|
146
178
|
*/
|
|
@@ -197,6 +229,19 @@ export declare class PosCoreBuilder {
|
|
|
197
229
|
* Override default integration services.
|
|
198
230
|
*/
|
|
199
231
|
overrideIntegrationServices(overrides?: Partial<IntegrationServicesOverride>): this;
|
|
232
|
+
/**
|
|
233
|
+
* Pilih mode orchestration sinkronisasi.
|
|
234
|
+
* Saat ini hanya `host-managed` yang didukung:
|
|
235
|
+
* orchestration wajib diserahkan ke host (mis. ofsync-shared-core).
|
|
236
|
+
*/
|
|
237
|
+
withSyncOrchestrationMode(mode: SyncOrchestrationMode): this;
|
|
238
|
+
withDomainChangeSink(sink?: DomainChangeSink): this;
|
|
239
|
+
/**
|
|
240
|
+
* Nonaktifkan orchestration sinkronisasi internal (sync + socket).
|
|
241
|
+
* Gunakan ini saat host menyerahkan sync ke ofsync-shared-core.
|
|
242
|
+
*/
|
|
243
|
+
disableInternalSyncOrchestration(): this;
|
|
244
|
+
private applySyncOrchestrationMode;
|
|
200
245
|
/**
|
|
201
246
|
* Build PosCore: inisialisasi registry dan stores, lalu kembalikan instansi.
|
|
202
247
|
*/
|
package/dist/data/schema.d.ts
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* Schema definitions for database tables and columns.
|
|
3
3
|
*/
|
|
4
4
|
import { TableSchema } from "./DbAdapter";
|
|
5
|
-
/**
|
|
6
|
-
* Array of table schemas to initialize or migrate the database.
|
|
7
|
-
*/
|
|
8
5
|
declare const schemas: TableSchema[];
|
|
6
|
+
export declare const POS_DOMAIN_TABLES: readonly string[];
|
|
9
7
|
export { schemas };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Sale } from '../models/Sale';
|
|
2
|
+
export interface ScopedAccountMapping<TMapping> {
|
|
3
|
+
default: TMapping;
|
|
4
|
+
byTenant?: Record<string, Partial<TMapping>>;
|
|
5
|
+
byBranch?: Record<string, Partial<TMapping>>;
|
|
6
|
+
}
|
|
7
|
+
export interface PosSaleAccountMapping {
|
|
8
|
+
paymentAccountId: string;
|
|
9
|
+
revenueAccountId: string;
|
|
10
|
+
discountAccountId?: string;
|
|
11
|
+
taxPayableAccountId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface PosFinanceAdapterContext {
|
|
14
|
+
journalId: string;
|
|
15
|
+
tenantId: string;
|
|
16
|
+
branchId?: string;
|
|
17
|
+
occurredAt: string;
|
|
18
|
+
reference?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ScopedPosSaleFinanceProjection {
|
|
21
|
+
context: PosFinanceAdapterContext;
|
|
22
|
+
input: {
|
|
23
|
+
grossAmount: number;
|
|
24
|
+
discountAmount?: number;
|
|
25
|
+
taxAmount?: number;
|
|
26
|
+
scopedAccountMapping: ScopedAccountMapping<PosSaleAccountMapping>;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface ProjectScopedPosSaleFinanceInput {
|
|
30
|
+
sale: Pick<Sale, 'id' | 'date' | 'total' | 'discount' | 'ppn' | 'finalTotal'>;
|
|
31
|
+
tenantId: string;
|
|
32
|
+
branchId?: string;
|
|
33
|
+
scopedAccountMapping: ScopedAccountMapping<PosSaleAccountMapping>;
|
|
34
|
+
journalId?: string;
|
|
35
|
+
referencePrefix?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function projectScopedPosSaleFinance(input: ProjectScopedPosSaleFinanceInput): ScopedPosSaleFinanceProjection;
|