@cape-io/rg-utils
v7.6.0
Published
Tools and utilities for R&G + D&L item processing.
Downloads
81
Readme
rg-utils
Tools and utilities for R&G + D&L item ID and Category processing.
ID Requirements
{prefix}-{patternId}-{colorId}
Prefer using a patternSeparator
(-
) between prefix
and patternId
when creating new prefix options.
Options are defined in lib/cat-ids.js
.
prefix
valid options are [null, rg, p, l, dl, dli, dlt, pf, pft, pfi]. Max of 16 options includingnull
(textile). 4 bits.patternId
NUMBER must be less than 16777215. 24 bits.colorId
NUMBER must be less than 99. Note this is smaller than the 7 bit max of 127. We assume it always two digits/chars long. Id 99 is reserved for color items that are the same as (wire/sample) the pattern.
ID Processing
getItemIdInfo(itemItemNumber)
Parsing of itemId into an object{ patternId, colorId, otherId, invalidId: Boolean }
- String must start with a valid
patternId
or it will not be processed. - Pattern numbers over 9 are allowed. Pattern must have three or more letter chars.
- Double colorId will be turned into
01|02
. Able to parse as01/02
,01_02
, or01-02
. Will mark as invalidId if used_
or/
. - DL patternId prefix can have hyphen or not. Does not force to have or not.
otherId
is joined with underscore.hasValidIdChars()
uses a regex expression to check if the id is in a known format.
Category Processing
Primary categories in the data should be fabric
, trim
, accessory
.
ID Number
If under 14 bits just use the number 16384.
Need to fit into smaller than 24 bits. Larger numbers almost always have zeros. How to compress out the zeros?
910003 = source 910, size 6, style 3
28 bits
- source = 11 sourceNum | length
- sourceNum = 9 bits (511) Assume 489 is min for 5 length and higher?
- length = 2 bits 0:4, 1:5, 2:6, 3:7
- style = 7 bits (127) Assume it's 99 or smaller
- colorId = 7
- prefix = 3
ColorItem <-> Pattern
categoryId
is a property of colorItem based onpattern.categoryId
. Used for searches.
Notes
appId
is the web application id.appCode
is the backend data feed application code. Should really bedataFeedCode
or something like that.
Changelog
v7
searchHashParse()
should returncategoryId
when passed validitemId
- Updated fields Using
categoryId
&pattern.imageUrl
- added
fixItemId(itemNumber) -> itemId
- Remove extra junk.
v6
6.1 Return
simpleSearch
prop on parse.Switch all instances of
patternNumber
topatternInt
.dl
prefix items are not alwaystextile
.getCategory(item)
no longer send categories to it first, just item.v5.4.0 pager data
5.x Includes fields and categories as code.
4.x Allows colorIds from 63 to 99.
npm run up
to update field & category data.