Constructor
new CatalogManager(options)
Creates a new CatalogManager instance
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Configuration options Properties
|
- Source:
Methods
cleanupOrphans(inventory) → {number}
Removes orphaned mappings that don't correspond to inventory items
Parameters:
| Name | Type | Description |
|---|---|---|
inventory |
Array.<Object> | Current inventory items |
- Source:
Returns:
Number of mappings removed
- Type
- number
deduplicateMappings()
Deduplicates identical provider mappings across serials (noop-safe). Returns number of entries simplified (kept first occurrence).
- Source:
exportMappings() → {Object}
Gets serialized export of all mappings for backup
- Source:
Returns:
Mappings data
- Type
- Object
getCatalogId(serial, provideropt) → {string|null}
Gets catalog ID for an item serial
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
serial |
number | string | Item serial number |
||
provider |
string |
<optional> |
'numista' | Provider key |
- Source:
Returns:
Catalog ID or null if not found
- Type
- string | null
getSerialsByCatalogId(catalogId, provideropt) → {Array.<string>}
Gets item serials associated with a catalog ID
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
catalogId |
string | Catalog ID to look up |
||
provider |
string |
<optional> |
'numista' | Provider key |
- Source:
Returns:
Array of serials (may be empty)
- Type
- Array.<string>
getStats() → {Object}
Gets summary statistics about mappings
- Source:
Returns:
Statistics object
- Type
- Object
getStorageStats()
Returns basic storage stats for the catalog mapping blob.
- Source:
importMappings(mappings, mergeopt) → {number}
Imports mappings from backup data
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
mappings |
Object | Mappings data |
||
merge |
boolean |
<optional> |
false | Merge with existing data instead of replacing |
- Source:
Returns:
Number of mappings imported
- Type
- number
removeOrphanedMappings(currentInventory) → {number}
Removes mappings for serials that no longer exist in inventory.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
currentInventory |
Array | null | inventory array (objects with serial) |
- Source:
Returns:
count removed
- Type
- number
setCatalogId(serial, catalogId, provideropt) → {boolean}
Sets catalog ID for an item serial
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
serial |
number | string | Item serial number |
||
catalogId |
string | Catalog ID to set |
||
provider |
string |
<optional> |
'numista' | Provider key |
- Source:
Returns:
True if successful
- Type
- boolean
syncInventory(items) → {Array.<Object>}
Synchronizes all inventory items with catalog mappings
Parameters:
| Name | Type | Description |
|---|---|---|
items |
Array.<Object> | Array of inventory items |
- Source:
Returns:
Updated items
- Type
- Array.<Object>
syncItem(item) → {Object}
Synchronizes an inventory item with the catalog mapping
Parameters:
| Name | Type | Description |
|---|---|---|
item |
Object | Inventory item |
- Source:
Returns:
Updated item
- Type
- Object
validateCatalogId(catalogId, provideropt) → {boolean}
Validates a catalog ID format
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
catalogId |
string | Catalog ID to validate |
||
provider |
string |
<optional> |
'numista' | Provider key |
- Source:
Returns:
True if valid
- Type
- boolean