7.3.0 • Published 3 days ago

@cape-io/rg-utils v7.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 days ago

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 including null (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 as 01/02, 01_02, or 01-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 on pattern.categoryId. Used for searches.

Notes

  • appId is the web application id.
  • appCode is the backend data feed application code. Should really be dataFeedCode or something like that.

Changelog

v7

  • searchHashParse() should return categoryId when passed valid itemId
  • 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 to patternInt.
  • dl prefix items are not always textile.
  • 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.

7.3.0

3 days ago

7.2.4

4 days ago

7.2.3

6 days ago

7.2.2

6 days ago

7.2.1

6 days ago

7.1.1

8 days ago

7.2.0

7 days ago

7.1.0

10 days ago

7.0.0

15 days ago

7.0.1

15 days ago

6.1.0

23 days ago

6.0.5

24 days ago

6.0.4

26 days ago

5.3.0

28 days ago

5.1.0

29 days ago

4.7.5

29 days ago

5.4.0

28 days ago

5.2.1

29 days ago

5.0.0

29 days ago

6.0.1

28 days ago

6.0.0

28 days ago

6.0.3

28 days ago

6.0.2

28 days ago

4.7.2

30 days ago

4.7.1

30 days ago

4.5.3

1 month ago

4.7.3

30 days ago

4.7.0

30 days ago

4.5.1

1 month ago

4.4.0

1 month ago

4.3.1

1 month ago

4.2.1

1 month ago

4.2.0

1 month ago

4.1.3

2 months ago

4.1.0

2 months ago

4.1.2

2 months ago

4.1.1

2 months ago

4.0.0

1 year ago

3.3.0

2 years ago

3.0.3

2 years ago

3.2.0

2 years ago

3.1.1

2 years ago

3.0.2

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.5.0

2 years ago

2.7.0

2 years ago

2.6.0

2 years ago

2.5.1

2 years ago

2.8.1

2 years ago

2.8.0

2 years ago

2.4.0

2 years ago

2.3.0

2 years ago

2.2.3

2 years ago

2.2.1

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago