@dealpos-npm/ng-dealpos-library 22.0.4 → 22.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.
@@ -1 +1 @@
1
- {"version":3,"file":"dealpos-npm-ng-dealpos-library-dexie-data-access.mjs","names":["uuidv4"],"sources":["../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/db/pos-database.base.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/di/pos-database.token.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/order-queue.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/orders.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/search/fuzzy-search.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/keyed-table.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/products.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/key-value.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/settings.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/di/provide-pos-dexie-data-access.ts"],"sourcesContent":["import Dexie, { type EntityTable, type IndexableType } from 'dexie';\r\nimport type {\r\n\tSalesOrderDataModel,\r\n\tVariantByIDHttpResponse,\r\n} from '@dealpos-npm/ng-dealpos-library/sell';\r\nimport type { OrderRecord, SettingRecord } from './records.model';\r\n\r\nexport abstract class PosDatabaseBase<\r\n\tTProduct extends { ID: IndexableType } = VariantByIDHttpResponse,\r\n\tTOrder = SalesOrderDataModel,\r\n> extends Dexie {\r\n\tproducts!: EntityTable<TProduct, 'ID'>;\r\n\torders!: EntityTable<OrderRecord<TOrder>, 'id', OrderRecord<TOrder>>;\r\n\tsettings!: EntityTable<SettingRecord, 'key'>;\r\n\r\n\tprotected constructor(name: string) {\r\n\t\tsuper(name);\r\n\t\tthis.version(1).stores({\r\n\t\t\tproducts: 'ID, Code',\r\n\t\t\torders: '++id, status',\r\n\t\t\tsettings: 'key',\r\n\t\t});\r\n\r\n\t\t// v2 replaces the auto-increment `orders` primary key with a UUID string.\r\n\t\t// The schema change already drops the object store, so this explicit clear\r\n\t\t// only states the intent: old numeric-key order rows are not migrated.\r\n\t\tthis.version(2)\r\n\t\t\t.stores({\r\n\t\t\t\torders: 'id, status',\r\n\t\t\t})\r\n\t\t\t.upgrade((tx) => tx.table('orders').clear());\r\n\t}\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport type { PosDatabaseBase } from '../db/pos-database.base';\r\n\r\nexport const POS_DATABASE = new InjectionToken<PosDatabaseBase>('POS_DATABASE');\r\n","import { liveQuery, type EntityTable } from 'dexie';\r\nimport { Observable } from 'rxjs';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport type { SalesOrderDataModel } from '@dealpos-npm/ng-dealpos-library/sell';\r\nimport type { OrderRecord, OrderStatus } from '../db/records.model';\r\n\r\n/** Orders table keyed by a UUID string primary key (`id`). */\r\nexport type OrderTable<TOrder> = EntityTable<\r\n\tOrderRecord<TOrder>,\r\n\t'id',\r\n\tOrderRecord<TOrder>\r\n>;\r\n\r\nexport type StoredEntity<T> = T & { id?: string };\r\n\r\nexport class OrderQueueRepository<TOrder = SalesOrderDataModel> {\r\n\tconstructor(\r\n\t\tprotected readonly table: OrderTable<TOrder>,\r\n\t\tprotected readonly options: {\r\n\t\t\torderIdExtractor: (order: TOrder) => string | number;\r\n\t\t},\r\n\t) {}\r\n\r\n\tprivate toPayload(order: TOrder): TOrder {\r\n\t\tconst payload = JSON.parse(JSON.stringify(order)) as TOrder & { id?: string };\r\n\t\tdelete payload.id;\r\n\t\treturn payload as TOrder;\r\n\t}\r\n\r\n\tprivate toStored(record: OrderRecord<TOrder>): StoredEntity<TOrder> {\r\n\t\treturn Object.assign(record.order as object, { id: record.id }) as StoredEntity<TOrder>;\r\n\t}\r\n\r\n\t/**\r\n\t * Queues an order. Pass `id` to make the save idempotent — re-saving the same\r\n\t * order overwrites the existing record instead of creating a duplicate.\r\n\t * When omitted, a fresh UUID is generated.\r\n\t */\r\n\tsaveUnsent(order: TOrder, id?: string): Promise<string> {\r\n\t\treturn this.table.add({\r\n\t\t\tid: id ?? uuidv4(),\r\n\t\t\tstatus: 'unsent',\r\n\t\t\torder: this.toPayload(order),\r\n\t\t}) as Promise<string>;\r\n\t}\r\n\r\n\tobserveByStatus(status: OrderStatus): Observable<Array<StoredEntity<TOrder>>> {\r\n\t\treturn new Observable((subscriber) => {\r\n\t\t\tconst live = liveQuery(() => this.table.where('status').equals(status).toArray());\r\n\t\t\tconst subscription = live.subscribe({\r\n\t\t\t\tnext: (records) => subscriber.next(records.map((record) => this.toStored(record))),\r\n\t\t\t\terror: (error) => subscriber.error(error),\r\n\t\t\t});\r\n\t\t\treturn () => subscription.unsubscribe();\r\n\t\t});\r\n\t}\r\n\r\n\tasync listByStatus(status: OrderStatus): Promise<Array<StoredEntity<TOrder>>> {\r\n\t\tconst records = await this.table.where('status').equals(status).toArray();\r\n\t\treturn records.map((record) => this.toStored(record));\r\n\t}\r\n\r\n\tlistUnsent(): Promise<Array<StoredEntity<TOrder>>> {\r\n\t\treturn this.listByStatus('unsent');\r\n\t}\r\n\r\n\tlistFailed(): Promise<Array<StoredEntity<TOrder>>> {\r\n\t\treturn this.listByStatus('failed');\r\n\t}\r\n\r\n\tlistSuccess(): Promise<Array<StoredEntity<TOrder>>> {\r\n\t\treturn this.listByStatus('success');\r\n\t}\r\n\r\n\tasync findUnsentByOrderId(\r\n\t\torderId: string | number,\r\n\t): Promise<StoredEntity<TOrder> | undefined> {\r\n\t\tconst records = await this.table.where('status').equals('unsent').toArray();\r\n\t\tconst match = records.find(\r\n\t\t\t(record) => this.options.orderIdExtractor(record.order) == orderId,\r\n\t\t);\r\n\t\treturn match ? this.toStored(match) : undefined;\r\n\t}\r\n\r\n\tasync remove(id: string): Promise<void> {\r\n\t\tawait this.table.delete(id);\r\n\t}\r\n\r\n\tmarkFailed(id: string, order: TOrder): Promise<string> {\r\n\t\treturn this.table.put({\r\n\t\t\tid,\r\n\t\t\tstatus: 'failed',\r\n\t\t\torder: this.toPayload(order),\r\n\t\t}) as Promise<string>;\r\n\t}\r\n\r\n\tmarkSuccess(id: string, order: TOrder): Promise<string> {\r\n\t\treturn this.table.put({\r\n\t\t\tid,\r\n\t\t\tstatus: 'success',\r\n\t\t\torder: this.toPayload(order),\r\n\t\t}) as Promise<string>;\r\n\t}\r\n\r\n\tclearFailed(): Promise<number> {\r\n\t\treturn this.table.where('status').equals('failed').delete();\r\n\t}\r\n\r\n\tclearSuccess(): Promise<number> {\r\n\t\treturn this.table.where('status').equals('success').delete();\r\n\t}\r\n}\r\n","import { Inject, Injectable } from '@angular/core';\r\nimport type { SalesOrderDataModel } from '@dealpos-npm/ng-dealpos-library/sell';\r\nimport { OrderQueueRepository } from './order-queue.repository';\r\nimport { POS_DATABASE } from '../di/pos-database.token';\r\nimport type { PosDatabaseBase } from '../db/pos-database.base';\r\n\r\nexport type StoredOrder = SalesOrderDataModel & { id?: string };\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class OrdersRepository extends OrderQueueRepository<SalesOrderDataModel> {\r\n\tconstructor(@Inject(POS_DATABASE) db: PosDatabaseBase) {\r\n\t\tsuper(db.orders, { orderIdExtractor: (o) => o.Order?.ID });\r\n\t}\r\n}\r\n","import Fuse from 'fuse.js';\r\nimport type {\r\n\tFuseOptionKey,\r\n\tFuseResultMatch,\r\n\tFuseSearchOptions,\r\n\tFuseSortFunction,\r\n\tFuseSortFunctionArg,\r\n\tIFuseOptions,\r\n} from 'fuse.js';\r\n\r\nexport interface FuzzyMatch<T> {\r\n\titem: T;\r\n\tscore: number;\r\n\tmatches: readonly FuseResultMatch[];\r\n}\r\n\r\nconst UNRANKED = Number.MAX_SAFE_INTEGER;\r\n\r\nfunction escapeContainsToken(token: string): string {\r\n\treturn token.replace(/\"/g, '').replace(/\\|/g, '\\\\|');\r\n}\r\n\r\n/**\r\n * Builds an extended-search pattern that matches by **substring** (\"contains\")\r\n * instead of the default fuzzy bitap algorithm. Each word becomes one `include`\r\n * matcher (`'word`) and words are AND-ed because extended search treats\r\n * space-separated tokens as a conjunction.\r\n */\r\nexport function toContainsPattern(query: string): string {\r\n\treturn query\r\n\t\t.trim()\r\n\t\t.split(/\\s+/)\r\n\t\t.map(escapeContainsToken)\r\n\t\t.filter((token) => token.length > 0)\r\n\t\t.map((token) => `'${token}`)\r\n\t\t.join(' ');\r\n}\r\n\r\nfunction firstMatchIndex(arg: FuseSortFunctionArg): number {\r\n\tlet first = UNRANKED;\r\n\tfor (const match of arg.matches ?? []) {\r\n\t\tconst start = match.indices?.[0]?.[0];\r\n\t\tif (typeof start === 'number' && start < first) {\r\n\t\t\tfirst = start;\r\n\t\t}\r\n\t}\r\n\treturn first;\r\n}\r\n\r\nfunction lastMatchIndex(arg: FuseSortFunctionArg): number {\r\n\tlet last = -1;\r\n\tfor (const match of arg.matches ?? []) {\r\n\t\tfor (const range of match.indices ?? []) {\r\n\t\t\tif (range[0] > last) {\r\n\t\t\t\tlast = range[0];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn last;\r\n}\r\n\r\nfunction shortestMatchedValue(arg: FuseSortFunctionArg): number {\r\n\tlet shortest = UNRANKED;\r\n\tfor (const match of arg.matches ?? []) {\r\n\t\tshortest = Math.min(shortest, match.value?.length ?? 0);\r\n\t}\r\n\treturn shortest;\r\n}\r\n\r\n/**\r\n * Substring matches all score 0 in extended search, so relevance is restored\r\n * here: earliest hit first (prefix beats mid-word), then tightest span, then\r\n * shortest matched field, then catalog order as the stable tie-break.\r\n */\r\nexport const matchPositionSortFn: FuseSortFunction = (a, b) => {\r\n\tconst first = firstMatchIndex(a) - firstMatchIndex(b);\r\n\tif (first !== 0) {\r\n\t\treturn first;\r\n\t}\r\n\tconst last = lastMatchIndex(a) - lastMatchIndex(b);\r\n\tif (last !== 0) {\r\n\t\treturn last;\r\n\t}\r\n\tconst length = shortestMatchedValue(a) - shortestMatchedValue(b);\r\n\tif (length !== 0) {\r\n\t\treturn length;\r\n\t}\r\n\treturn a.idx - b.idx;\r\n};\r\n\r\nexport function createFuzzyIndex<T>(\r\n\titems: ReadonlyArray<T>,\r\n\tkeys: ReadonlyArray<FuseOptionKey<T>>,\r\n\toptions?: IFuseOptions<T>,\r\n): Fuse<T> {\r\n\treturn new Fuse([...items], {\r\n\t\tincludeScore: true,\r\n\t\tincludeMatches: true,\r\n\t\tfindAllMatches: true,\r\n\t\tuseExtendedSearch: true,\r\n\t\tsortFn: matchPositionSortFn,\r\n\t\tkeys: [...keys],\r\n\t\t...(options ?? {}),\r\n\t});\r\n}\r\n\r\nexport function fuzzySearch<T>(\r\n\tindex: Fuse<T>,\r\n\tquery: string,\r\n\topts?: FuseSearchOptions,\r\n): Array<FuzzyMatch<T>> {\r\n\tconst pattern =\r\n\t\tindex.options.useExtendedSearch !== false ? toContainsPattern(query) : query.trim();\r\n\tif (!pattern) {\r\n\t\treturn [];\r\n\t}\r\n\treturn index\r\n\t\t.search(pattern, opts)\r\n\t\t.map((r) => ({\r\n\t\t\titem: r.item,\r\n\t\t\tscore: r.score ?? 0,\r\n\t\t\tmatches: r.matches ?? [],\r\n\t\t}));\r\n}\r\n","import type { EntityTable, IDType } from 'dexie';\r\nimport type { default as Fuse, FuseOptionKey, FuseSearchOptions, IFuseOptions } from 'fuse.js';\r\nimport { createFuzzyIndex, fuzzySearch } from '../search/fuzzy-search';\r\nimport type { FuzzyMatch } from '../search/fuzzy-search';\r\n\r\nexport class KeyedTableRepository<T, K extends keyof T & string> {\r\n\tprivate fuzzyIndex: Fuse<T> | undefined;\r\n\r\n\tconstructor(\r\n\t\tprotected readonly table: EntityTable<T, K>,\r\n\t\tprotected readonly options?: {\r\n\t\t\tcodeIndex?: string;\r\n\t\t\tfuzzyKeys?: ReadonlyArray<FuseOptionKey<T>>;\r\n\t\t\tfuzzyOptions?: IFuseOptions<T>;\r\n\t\t},\r\n\t) {}\r\n\r\n\tgetAll(): Promise<T[]> {\r\n\t\treturn this.table.toArray();\r\n\t}\r\n\r\n\tgetById(id: T[K]): Promise<T | undefined> {\r\n\t\treturn this.table.get(id as IDType<T, K>);\r\n\t}\r\n\r\n\tgetByIndex(index: string, value: unknown): Promise<T | undefined> {\r\n\t\treturn this.table.where(index).equals(value as never).first();\r\n\t}\r\n\r\n\tasync searchFuzzy(\r\n\t\tquery: string,\r\n\t\topts?: FuseSearchOptions,\r\n\t): Promise<Array<FuzzyMatch<T>>> {\r\n\t\tconst keys = this.options?.fuzzyKeys;\r\n\t\tif (!keys || keys.length === 0 || !query) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tif (!this.fuzzyIndex) {\r\n\t\t\tthis.fuzzyIndex = createFuzzyIndex(\r\n\t\t\t\tawait this.getAll(),\r\n\t\t\t\tkeys,\r\n\t\t\t\tthis.options?.fuzzyOptions,\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn fuzzySearch(this.fuzzyIndex, query, opts);\r\n\t}\r\n\r\n\treplaceAll(items: T[]): Promise<void> {\r\n\t\tthis.fuzzyIndex = undefined;\r\n\t\treturn this.table.db.transaction('rw', this.table, async () => {\r\n\t\t\tawait this.table.clear();\r\n\t\t\tif (items.length > 0) {\r\n\t\t\t\tawait this.table.bulkAdd(items);\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tclear(): Promise<void> {\r\n\t\tthis.fuzzyIndex = undefined;\r\n\t\treturn this.table.clear();\r\n\t}\r\n\r\n\tcount(): Promise<number> {\r\n\t\treturn this.table.count();\r\n\t}\r\n\r\n\t/**\r\n\t * Estimasi ukuran penyimpanan (byte) untuk seluruh baris di tabel ini.\r\n\t * Dihitung dari panjang serialisasi JSON (UTF-8) tiap record, jadi ini\r\n\t * hanya perkiraan — belum termasuk overhead structured-clone dan index Dexie.\r\n\t * Membaca per baris via `table.each()` agar tidak menahan seluruh tabel di memori.\r\n\t */\r\n\tasync estimateSize(): Promise<number> {\r\n\t\tconst encoder = new TextEncoder();\r\n\t\tlet total = 0;\r\n\t\tawait this.table.each((item) => {\r\n\t\t\ttotal += encoder.encode(JSON.stringify(item)).length;\r\n\t\t});\r\n\t\treturn total;\r\n\t}\r\n}\r\n","import { Inject, Injectable } from '@angular/core';\r\nimport type { VariantByIDHttpResponse } from '@dealpos-npm/ng-dealpos-library/sell';\r\nimport { KeyedTableRepository } from './keyed-table.repository';\r\nimport { POS_DATABASE } from '../di/pos-database.token';\r\nimport type { PosDatabaseBase } from '../db/pos-database.base';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class ProductsRepository extends KeyedTableRepository<VariantByIDHttpResponse, 'ID'> {\r\n\tconstructor(@Inject(POS_DATABASE) db: PosDatabaseBase) {\r\n\t\tsuper(db.products, { codeIndex: 'Code', fuzzyKeys: ['Name', 'Code'] });\r\n\t}\r\n}\r\n","import type { EntityTable } from 'dexie';\r\nimport type { SettingKey, SettingRecord } from '../db/records.model';\r\n\r\nexport class KeyValueRepository<TMap extends object> {\r\n\tconstructor(protected readonly table: EntityTable<SettingRecord, 'key'>) {}\r\n\r\n\tasync get<K extends keyof TMap & string>(key: K): Promise<TMap[K] | undefined> {\r\n\t\tconst record = await this.table.get(key as SettingKey);\r\n\t\treturn record?.value as TMap[K] | undefined;\r\n\t}\r\n\r\n\tput<K extends keyof TMap & string>(key: K, value: TMap[K]): Promise<SettingKey> {\r\n\t\treturn this.table.put({ key: key as SettingKey, value });\r\n\t}\r\n}\r\n","import { Inject, Injectable } from '@angular/core';\r\nimport { KeyValueRepository } from './key-value.repository';\r\nimport { POS_DATABASE } from '../di/pos-database.token';\r\nimport type { PosDatabaseBase } from '../db/pos-database.base';\r\nimport type { SettingKey, SyncTimeValue } from '../db/records.model';\r\n\r\nexport interface CanonicalSettingsMap {\r\n\tsyncTime: SyncTimeValue;\r\n\tLoadPOSAPI: unknown;\r\n\tactiveRegister: unknown;\r\n}\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class SettingsRepository extends KeyValueRepository<CanonicalSettingsMap> {\r\n\tconstructor(@Inject(POS_DATABASE) db: PosDatabaseBase) {\r\n\t\tsuper(db.settings);\r\n\t}\r\n\r\n\tgetSyncTime(): Promise<SyncTimeValue | undefined> {\r\n\t\treturn this.get('syncTime');\r\n\t}\r\n\r\n\t/**\r\n\t * Catat waktu sync terakhir, opsional beserta durasi proses sync (ms).\r\n\t * `durationMs` bersifat opsional agar pemanggil lama tetap kompatibel.\r\n\t * Saat tidak diisi, field tidak disimpan sehingga record tetap `{ time }`.\r\n\t */\r\n\tputSyncTime(time: string, durationMs?: number): Promise<SettingKey> {\r\n\t\tconst value: SyncTimeValue =\r\n\t\t\tdurationMs === undefined ? { time } : { time, durationMs };\r\n\t\treturn this.put('syncTime', value);\r\n\t}\r\n\r\n\tgetLoadPOSAPI<T = unknown>(): Promise<T | undefined> {\r\n\t\treturn this.get('LoadPOSAPI') as Promise<T | undefined>;\r\n\t}\r\n\r\n\tputLoadPOSAPI<T>(value: T): Promise<SettingKey> {\r\n\t\treturn this.put('LoadPOSAPI', value);\r\n\t}\r\n\r\n\tasync getActiveRegister<T = unknown>(): Promise<T | null> {\r\n\t\treturn ((await this.get('activeRegister')) as T | undefined) ?? null;\r\n\t}\r\n\r\n\tputActiveRegister<T>(value: T): Promise<SettingKey> {\r\n\t\treturn this.put('activeRegister', value);\r\n\t}\r\n}\r\n","import { makeEnvironmentProviders } from '@angular/core';\r\nimport type { EnvironmentProviders, Type } from '@angular/core';\r\nimport { POS_DATABASE } from './pos-database.token';\r\nimport type { PosDatabaseBase } from '../db/pos-database.base';\r\nimport { OrdersRepository } from '../repositories/orders.repository';\r\nimport { ProductsRepository } from '../repositories/products.repository';\r\nimport { SettingsRepository } from '../repositories/settings.repository';\r\n\r\nexport function provideDexieDataAccess(database: Type<PosDatabaseBase>): EnvironmentProviders {\r\n\treturn makeEnvironmentProviders([\r\n\t\tdatabase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AAA;GAAA,UAAA;GAAA,MAAA;GAAkB,YADL;EAAM,CAAA;CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAkB,YAAA,CAAA;EAD9B,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE;;;;;GAEpB,MAAA;GAAO,MAAA,CAAA,YAAY;;;;ACNjC,SAAgB,uBAAuB,UAA+B;CACrE,OAAO,yBAAyB;EAC/B;EACA;GAAE,SAAS;GAAc,aAAa;EAAQ;EAC9C;EACA;EACA;CACA,CAAA;AACF"}
1
+ {"version":3,"file":"dealpos-npm-ng-dealpos-library-dexie-data-access.mjs","names":["uuidv4"],"sources":["../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/db/pos-database.base.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/di/pos-database.token.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/order-queue.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/orders.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/search/fuzzy-search.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/keyed-table.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/products.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/key-value.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/repositories/settings.repository.ts","../../../projects/dealpos-npm/ng-dealpos-library/dexie-data-access/src/di/provide-pos-dexie-data-access.ts"],"sourcesContent":["import Dexie, { type EntityTable, type IndexableType } from 'dexie';\r\nimport type {\r\n\tSalesOrderDataModel,\r\n\tVariantByIDHttpResponse,\r\n} from '@dealpos-npm/ng-dealpos-library/sell/models';\r\nimport type { OrderRecord, SettingRecord } from './records.model';\r\n\r\nexport abstract class PosDatabaseBase<\r\n\tTProduct extends { ID: IndexableType } = VariantByIDHttpResponse,\r\n\tTOrder = SalesOrderDataModel,\r\n> extends Dexie {\r\n\tproducts!: EntityTable<TProduct, 'ID'>;\r\n\torders!: EntityTable<OrderRecord<TOrder>, 'id', OrderRecord<TOrder>>;\r\n\tsettings!: EntityTable<SettingRecord, 'key'>;\r\n\r\n\tprotected constructor(name: string) {\r\n\t\tsuper(name);\r\n\t\tthis.version(1).stores({\r\n\t\t\tproducts: 'ID, Code',\r\n\t\t\torders: '++id, status',\r\n\t\t\tsettings: 'key',\r\n\t\t});\r\n\r\n\t\t// v2 replaces the auto-increment `orders` primary key with a UUID string.\r\n\t\t// The schema change already drops the object store, so this explicit clear\r\n\t\t// only states the intent: old numeric-key order rows are not migrated.\r\n\t\tthis.version(2)\r\n\t\t\t.stores({\r\n\t\t\t\torders: 'id, status',\r\n\t\t\t})\r\n\t\t\t.upgrade((tx) => tx.table('orders').clear());\r\n\t}\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport type { PosDatabaseBase } from '../db/pos-database.base';\r\n\r\nexport const POS_DATABASE = new InjectionToken<PosDatabaseBase>('POS_DATABASE');\r\n","import { liveQuery, type EntityTable } from 'dexie';\r\nimport { Observable } from 'rxjs';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport type { SalesOrderDataModel } from '@dealpos-npm/ng-dealpos-library/sell/models';\r\nimport type { OrderRecord, OrderStatus } from '../db/records.model';\r\n\r\n/** Orders table keyed by a UUID string primary key (`id`). */\r\nexport type OrderTable<TOrder> = EntityTable<\r\n\tOrderRecord<TOrder>,\r\n\t'id',\r\n\tOrderRecord<TOrder>\r\n>;\r\n\r\nexport type StoredEntity<T> = T & { id?: string };\r\n\r\nexport class OrderQueueRepository<TOrder = SalesOrderDataModel> {\r\n\tconstructor(\r\n\t\tprotected readonly table: OrderTable<TOrder>,\r\n\t\tprotected readonly options: {\r\n\t\t\torderIdExtractor: (order: TOrder) => string | number;\r\n\t\t},\r\n\t) {}\r\n\r\n\tprivate toPayload(order: TOrder): TOrder {\r\n\t\tconst payload = JSON.parse(JSON.stringify(order)) as TOrder & { id?: string };\r\n\t\tdelete payload.id;\r\n\t\treturn payload as TOrder;\r\n\t}\r\n\r\n\tprivate toStored(record: OrderRecord<TOrder>): StoredEntity<TOrder> {\r\n\t\treturn Object.assign(record.order as object, { id: record.id }) as StoredEntity<TOrder>;\r\n\t}\r\n\r\n\t/**\r\n\t * Queues an order. Pass `id` to make the save idempotent — re-saving the same\r\n\t * order overwrites the existing record instead of creating a duplicate.\r\n\t * When omitted, a fresh UUID is generated.\r\n\t */\r\n\tsaveUnsent(order: TOrder, id?: string): Promise<string> {\r\n\t\treturn this.table.add({\r\n\t\t\tid: id ?? uuidv4(),\r\n\t\t\tstatus: 'unsent',\r\n\t\t\torder: this.toPayload(order),\r\n\t\t}) as Promise<string>;\r\n\t}\r\n\r\n\tobserveByStatus(status: OrderStatus): Observable<Array<StoredEntity<TOrder>>> {\r\n\t\treturn new Observable((subscriber) => {\r\n\t\t\tconst live = liveQuery(() => this.table.where('status').equals(status).toArray());\r\n\t\t\tconst subscription = live.subscribe({\r\n\t\t\t\tnext: (records) => subscriber.next(records.map((record) => this.toStored(record))),\r\n\t\t\t\terror: (error) => subscriber.error(error),\r\n\t\t\t});\r\n\t\t\treturn () => subscription.unsubscribe();\r\n\t\t});\r\n\t}\r\n\r\n\tasync listByStatus(status: OrderStatus): Promise<Array<StoredEntity<TOrder>>> {\r\n\t\tconst records = await this.table.where('status').equals(status).toArray();\r\n\t\treturn records.map((record) => this.toStored(record));\r\n\t}\r\n\r\n\tlistUnsent(): Promise<Array<StoredEntity<TOrder>>> {\r\n\t\treturn this.listByStatus('unsent');\r\n\t}\r\n\r\n\tlistFailed(): Promise<Array<StoredEntity<TOrder>>> {\r\n\t\treturn this.listByStatus('failed');\r\n\t}\r\n\r\n\tlistSuccess(): Promise<Array<StoredEntity<TOrder>>> {\r\n\t\treturn this.listByStatus('success');\r\n\t}\r\n\r\n\tasync findUnsentByOrderId(\r\n\t\torderId: string | number,\r\n\t): Promise<StoredEntity<TOrder> | undefined> {\r\n\t\tconst records = await this.table.where('status').equals('unsent').toArray();\r\n\t\tconst match = records.find(\r\n\t\t\t(record) => this.options.orderIdExtractor(record.order) == orderId,\r\n\t\t);\r\n\t\treturn match ? this.toStored(match) : undefined;\r\n\t}\r\n\r\n\tasync remove(id: string): Promise<void> {\r\n\t\tawait this.table.delete(id);\r\n\t}\r\n\r\n\tmarkFailed(id: string, order: TOrder): Promise<string> {\r\n\t\treturn this.table.put({\r\n\t\t\tid,\r\n\t\t\tstatus: 'failed',\r\n\t\t\torder: this.toPayload(order),\r\n\t\t}) as Promise<string>;\r\n\t}\r\n\r\n\tmarkSuccess(id: string, order: TOrder): Promise<string> {\r\n\t\treturn this.table.put({\r\n\t\t\tid,\r\n\t\t\tstatus: 'success',\r\n\t\t\torder: this.toPayload(order),\r\n\t\t}) as Promise<string>;\r\n\t}\r\n\r\n\tclearFailed(): Promise<number> {\r\n\t\treturn this.table.where('status').equals('failed').delete();\r\n\t}\r\n\r\n\tclearSuccess(): Promise<number> {\r\n\t\treturn this.table.where('status').equals('success').delete();\r\n\t}\r\n}\r\n","import { Inject, Injectable } from '@angular/core';\r\nimport type { SalesOrderDataModel } from '@dealpos-npm/ng-dealpos-library/sell/models';\r\nimport { OrderQueueRepository } from './order-queue.repository';\r\nimport { POS_DATABASE } from '../di/pos-database.token';\r\nimport type { PosDatabaseBase } from '../db/pos-database.base';\r\n\r\nexport type StoredOrder = SalesOrderDataModel & { id?: string };\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class OrdersRepository extends OrderQueueRepository<SalesOrderDataModel> {\r\n\tconstructor(@Inject(POS_DATABASE) db: PosDatabaseBase) {\r\n\t\tsuper(db.orders, { orderIdExtractor: (o) => o.Order?.ID });\r\n\t}\r\n}\r\n","import Fuse from 'fuse.js';\r\nimport type {\r\n\tFuseOptionKey,\r\n\tFuseResultMatch,\r\n\tFuseSearchOptions,\r\n\tFuseSortFunction,\r\n\tFuseSortFunctionArg,\r\n\tIFuseOptions,\r\n} from 'fuse.js';\r\n\r\nexport interface FuzzyMatch<T> {\r\n\titem: T;\r\n\tscore: number;\r\n\tmatches: readonly FuseResultMatch[];\r\n}\r\n\r\nconst UNRANKED = Number.MAX_SAFE_INTEGER;\r\n\r\nfunction escapeContainsToken(token: string): string {\r\n\treturn token.replace(/\"/g, '').replace(/\\|/g, '\\\\|');\r\n}\r\n\r\n/**\r\n * Builds an extended-search pattern that matches by **substring** (\"contains\")\r\n * instead of the default fuzzy bitap algorithm. Each word becomes one `include`\r\n * matcher (`'word`) and words are AND-ed because extended search treats\r\n * space-separated tokens as a conjunction.\r\n */\r\nexport function toContainsPattern(query: string): string {\r\n\treturn query\r\n\t\t.trim()\r\n\t\t.split(/\\s+/)\r\n\t\t.map(escapeContainsToken)\r\n\t\t.filter((token) => token.length > 0)\r\n\t\t.map((token) => `'${token}`)\r\n\t\t.join(' ');\r\n}\r\n\r\nfunction firstMatchIndex(arg: FuseSortFunctionArg): number {\r\n\tlet first = UNRANKED;\r\n\tfor (const match of arg.matches ?? []) {\r\n\t\tconst start = match.indices?.[0]?.[0];\r\n\t\tif (typeof start === 'number' && start < first) {\r\n\t\t\tfirst = start;\r\n\t\t}\r\n\t}\r\n\treturn first;\r\n}\r\n\r\nfunction lastMatchIndex(arg: FuseSortFunctionArg): number {\r\n\tlet last = -1;\r\n\tfor (const match of arg.matches ?? []) {\r\n\t\tfor (const range of match.indices ?? []) {\r\n\t\t\tif (range[0] > last) {\r\n\t\t\t\tlast = range[0];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn last;\r\n}\r\n\r\nfunction shortestMatchedValue(arg: FuseSortFunctionArg): number {\r\n\tlet shortest = UNRANKED;\r\n\tfor (const match of arg.matches ?? []) {\r\n\t\tshortest = Math.min(shortest, match.value?.length ?? 0);\r\n\t}\r\n\treturn shortest;\r\n}\r\n\r\n/**\r\n * Substring matches all score 0 in extended search, so relevance is restored\r\n * here: earliest hit first (prefix beats mid-word), then tightest span, then\r\n * shortest matched field, then catalog order as the stable tie-break.\r\n */\r\nexport const matchPositionSortFn: FuseSortFunction = (a, b) => {\r\n\tconst first = firstMatchIndex(a) - firstMatchIndex(b);\r\n\tif (first !== 0) {\r\n\t\treturn first;\r\n\t}\r\n\tconst last = lastMatchIndex(a) - lastMatchIndex(b);\r\n\tif (last !== 0) {\r\n\t\treturn last;\r\n\t}\r\n\tconst length = shortestMatchedValue(a) - shortestMatchedValue(b);\r\n\tif (length !== 0) {\r\n\t\treturn length;\r\n\t}\r\n\treturn a.idx - b.idx;\r\n};\r\n\r\nexport function createFuzzyIndex<T>(\r\n\titems: ReadonlyArray<T>,\r\n\tkeys: ReadonlyArray<FuseOptionKey<T>>,\r\n\toptions?: IFuseOptions<T>,\r\n): Fuse<T> {\r\n\treturn new Fuse([...items], {\r\n\t\tincludeScore: true,\r\n\t\tincludeMatches: true,\r\n\t\tfindAllMatches: true,\r\n\t\tuseExtendedSearch: true,\r\n\t\tsortFn: matchPositionSortFn,\r\n\t\tkeys: [...keys],\r\n\t\t...(options ?? {}),\r\n\t});\r\n}\r\n\r\nexport function fuzzySearch<T>(\r\n\tindex: Fuse<T>,\r\n\tquery: string,\r\n\topts?: FuseSearchOptions,\r\n): Array<FuzzyMatch<T>> {\r\n\tconst pattern =\r\n\t\tindex.options.useExtendedSearch !== false ? toContainsPattern(query) : query.trim();\r\n\tif (!pattern) {\r\n\t\treturn [];\r\n\t}\r\n\treturn index\r\n\t\t.search(pattern, opts)\r\n\t\t.map((r) => ({\r\n\t\t\titem: r.item,\r\n\t\t\tscore: r.score ?? 0,\r\n\t\t\tmatches: r.matches ?? [],\r\n\t\t}));\r\n}\r\n","import type { EntityTable, IDType } from 'dexie';\r\nimport type { default as Fuse, FuseOptionKey, FuseSearchOptions, IFuseOptions } from 'fuse.js';\r\nimport { createFuzzyIndex, fuzzySearch } from '../search/fuzzy-search';\r\nimport type { FuzzyMatch } from '../search/fuzzy-search';\r\n\r\nexport class KeyedTableRepository<T, K extends keyof T & string> {\r\n\tprivate fuzzyIndex: Fuse<T> | undefined;\r\n\r\n\tconstructor(\r\n\t\tprotected readonly table: EntityTable<T, K>,\r\n\t\tprotected readonly options?: {\r\n\t\t\tcodeIndex?: string;\r\n\t\t\tfuzzyKeys?: ReadonlyArray<FuseOptionKey<T>>;\r\n\t\t\tfuzzyOptions?: IFuseOptions<T>;\r\n\t\t},\r\n\t) {}\r\n\r\n\tgetAll(): Promise<T[]> {\r\n\t\treturn this.table.toArray();\r\n\t}\r\n\r\n\tgetById(id: T[K]): Promise<T | undefined> {\r\n\t\treturn this.table.get(id as IDType<T, K>);\r\n\t}\r\n\r\n\tgetByIndex(index: string, value: unknown): Promise<T | undefined> {\r\n\t\treturn this.table.where(index).equals(value as never).first();\r\n\t}\r\n\r\n\tasync searchFuzzy(\r\n\t\tquery: string,\r\n\t\topts?: FuseSearchOptions,\r\n\t): Promise<Array<FuzzyMatch<T>>> {\r\n\t\tconst keys = this.options?.fuzzyKeys;\r\n\t\tif (!keys || keys.length === 0 || !query) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tif (!this.fuzzyIndex) {\r\n\t\t\tthis.fuzzyIndex = createFuzzyIndex(\r\n\t\t\t\tawait this.getAll(),\r\n\t\t\t\tkeys,\r\n\t\t\t\tthis.options?.fuzzyOptions,\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn fuzzySearch(this.fuzzyIndex, query, opts);\r\n\t}\r\n\r\n\treplaceAll(items: T[]): Promise<void> {\r\n\t\tthis.fuzzyIndex = undefined;\r\n\t\treturn this.table.db.transaction('rw', this.table, async () => {\r\n\t\t\tawait this.table.clear();\r\n\t\t\tif (items.length > 0) {\r\n\t\t\t\tawait this.table.bulkAdd(items);\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tclear(): Promise<void> {\r\n\t\tthis.fuzzyIndex = undefined;\r\n\t\treturn this.table.clear();\r\n\t}\r\n\r\n\tcount(): Promise<number> {\r\n\t\treturn this.table.count();\r\n\t}\r\n\r\n\t/**\r\n\t * Estimasi ukuran penyimpanan (byte) untuk seluruh baris di tabel ini.\r\n\t * Dihitung dari panjang serialisasi JSON (UTF-8) tiap record, jadi ini\r\n\t * hanya perkiraan — belum termasuk overhead structured-clone dan index Dexie.\r\n\t * Membaca per baris via `table.each()` agar tidak menahan seluruh tabel di memori.\r\n\t */\r\n\tasync estimateSize(): Promise<number> {\r\n\t\tconst encoder = new TextEncoder();\r\n\t\tlet total = 0;\r\n\t\tawait this.table.each((item) => {\r\n\t\t\ttotal += encoder.encode(JSON.stringify(item)).length;\r\n\t\t});\r\n\t\treturn total;\r\n\t}\r\n}\r\n","import { Inject, Injectable } from '@angular/core';\r\nimport type { VariantByIDHttpResponse } from '@dealpos-npm/ng-dealpos-library/sell/models';\r\nimport { KeyedTableRepository } from './keyed-table.repository';\r\nimport { POS_DATABASE } from '../di/pos-database.token';\r\nimport type { PosDatabaseBase } from '../db/pos-database.base';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class ProductsRepository extends KeyedTableRepository<VariantByIDHttpResponse, 'ID'> {\r\n\tconstructor(@Inject(POS_DATABASE) db: PosDatabaseBase) {\r\n\t\tsuper(db.products, { codeIndex: 'Code', fuzzyKeys: ['Name', 'Code'] });\r\n\t}\r\n}\r\n","import type { EntityTable } from 'dexie';\r\nimport type { SettingKey, SettingRecord } from '../db/records.model';\r\n\r\nexport class KeyValueRepository<TMap extends object> {\r\n\tconstructor(protected readonly table: EntityTable<SettingRecord, 'key'>) {}\r\n\r\n\tasync get<K extends keyof TMap & string>(key: K): Promise<TMap[K] | undefined> {\r\n\t\tconst record = await this.table.get(key as SettingKey);\r\n\t\treturn record?.value as TMap[K] | undefined;\r\n\t}\r\n\r\n\tput<K extends keyof TMap & string>(key: K, value: TMap[K]): Promise<SettingKey> {\r\n\t\treturn this.table.put({ key: key as SettingKey, value });\r\n\t}\r\n}\r\n","import { Inject, Injectable } from '@angular/core';\r\nimport { KeyValueRepository } from './key-value.repository';\r\nimport { POS_DATABASE } from '../di/pos-database.token';\r\nimport type { PosDatabaseBase } from '../db/pos-database.base';\r\nimport type { SettingKey, SyncTimeValue } from '../db/records.model';\r\n\r\nexport interface CanonicalSettingsMap {\r\n\tsyncTime: SyncTimeValue;\r\n\tLoadPOSAPI: unknown;\r\n\tactiveRegister: unknown;\r\n}\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class SettingsRepository extends KeyValueRepository<CanonicalSettingsMap> {\r\n\tconstructor(@Inject(POS_DATABASE) db: PosDatabaseBase) {\r\n\t\tsuper(db.settings);\r\n\t}\r\n\r\n\tgetSyncTime(): Promise<SyncTimeValue | undefined> {\r\n\t\treturn this.get('syncTime');\r\n\t}\r\n\r\n\t/**\r\n\t * Catat waktu sync terakhir, opsional beserta durasi proses sync (ms).\r\n\t * `durationMs` bersifat opsional agar pemanggil lama tetap kompatibel.\r\n\t * Saat tidak diisi, field tidak disimpan sehingga record tetap `{ time }`.\r\n\t */\r\n\tputSyncTime(time: string, durationMs?: number): Promise<SettingKey> {\r\n\t\tconst value: SyncTimeValue =\r\n\t\t\tdurationMs === undefined ? { time } : { time, durationMs };\r\n\t\treturn this.put('syncTime', value);\r\n\t}\r\n\r\n\tgetLoadPOSAPI<T = unknown>(): Promise<T | undefined> {\r\n\t\treturn this.get('LoadPOSAPI') as Promise<T | undefined>;\r\n\t}\r\n\r\n\tputLoadPOSAPI<T>(value: T): Promise<SettingKey> {\r\n\t\treturn this.put('LoadPOSAPI', value);\r\n\t}\r\n\r\n\tasync getActiveRegister<T = unknown>(): Promise<T | null> {\r\n\t\treturn ((await this.get('activeRegister')) as T | undefined) ?? null;\r\n\t}\r\n\r\n\tputActiveRegister<T>(value: T): Promise<SettingKey> {\r\n\t\treturn this.put('activeRegister', value);\r\n\t}\r\n}\r\n","import { makeEnvironmentProviders } from '@angular/core';\r\nimport type { EnvironmentProviders, Type } from '@angular/core';\r\nimport { POS_DATABASE } from './pos-database.token';\r\nimport type { PosDatabaseBase } from '../db/pos-database.base';\r\nimport { OrdersRepository } from '../repositories/orders.repository';\r\nimport { ProductsRepository } from '../repositories/products.repository';\r\nimport { SettingsRepository } from '../repositories/settings.repository';\r\n\r\nexport function provideDexieDataAccess(database: Type<PosDatabaseBase>): EnvironmentProviders {\r\n\treturn makeEnvironmentProviders([\r\n\t\tdatabase,\r\n\t\t{ provide: POS_DATABASE, useExisting: database },\r\n\t\tOrdersRepository,\r\n\t\tProductsRepository,\r\n\t\tSettingsRepository,\r\n\t]);\r\n}\r\n"],"mappings":";;;;;;AAOA,IAAsB,kBAAtB,cAGU,MAAK;CAKd,YAAsB,MAAY;EACjC,MAAM,IAAI;EACV,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO;GACtB,UAAU;GACV,QAAQ;GACR,UAAU;EACV,CAAA;EAKD,KAAK,QAAQ,CAAC,CAAC,CACb,OAAO,EACP,QAAQ,aACR,CAAA,CAAC,CACD,SAAS,OAAO,GAAG,MAAM,QAAQ,CAAC,CAAC,MAAK,CAAE;CAC7C;AACA;AC7BD,MAAa,eAAe,IAAI,eAAgC,cAAc;ACY9E,IAAa,uBAAb,MAAiC;CAChC,YACoB,OACA,SAElB;EAHkB,KAAA,QAAA;EACA,KAAA,UAAA;CAGjB;CAEK,UAAU,OAAa;EAC9B,MAAM,UAAU,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC;EAChD,OAAO,QAAQ;EACf,OAAO;CACR;CAEQ,SAAS,QAA2B;EAC3C,OAAO,OAAO,OAAO,OAAO,OAAiB,EAAE,IAAI,OAAO,GAAE,CAAE;CAC/D;CAOA,WAAW,OAAe,IAAW;EACpC,OAAO,KAAK,MAAM,IAAI;GACrB,IAAI,MAAMA,GAAM;GAChB,QAAQ;GACR,OAAO,KAAK,UAAU,KAAK;EAC3B,CAAA;CACF;CAEA,gBAAgB,QAAmB;EAClC,OAAO,IAAI,YAAY,eAAc;GAEpC,MAAM,eADO,gBAA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