b2b-platform-utils 1.1.99 → 1.1.100

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.
@@ -4,6 +4,8 @@ const { createHash } = require('node:crypto');
4
4
  const A = require('./financialAdmissionMath');
5
5
  const failure = (code) => Object.assign(new TypeError(code), { code });
6
6
  const sequence = (v) => typeof v === 'string' && /^(0|[1-9]\d{0,35})$/.test(v);
7
+ // AccountPrecisionState/Entry.precision_version is an existing signed SQL BIGINT.
8
+ const precisionVersion = (v) => sequence(v) && BigInt(v) <= 9223372036854775807n;
7
9
  const minor = (v) => typeof v === 'string' && v !== '-0' && /^-?(0|[1-9]\d{0,35})$/.test(v);
8
10
  const id = (v) => typeof v === 'string' && v.length > 0 && v.length <= 200 && !/[\x00-\x1f\x7f]/.test(v);
9
11
  const fingerprint = (v) => typeof v === 'string' && /^[a-f0-9]{64}$/.test(v);
@@ -50,7 +52,7 @@ function state(value) {
50
52
  throw failure('financial_admission_state_invalid');
51
53
  for (const prefix of ['cash', 'bonus']) {
52
54
  const r = fraction(value[`${prefix}RemainderNumerator`], value[`${prefix}RemainderDenominator`]);
53
- if (!sequence(value[`${prefix}PrecisionVersion`]) || (prefix === 'cash' && (r.n < 0n || r.n >= r.d)))
55
+ if (!precisionVersion(value[`${prefix}PrecisionVersion`]) || (prefix === 'cash' && (r.n < 0n || r.n >= r.d)))
54
56
  throw failure('financial_admission_state_invalid');
55
57
  }
56
58
  return Object.fromEntries(STATE_FIELDS.map((field) => [field, value[field]]));
@@ -117,7 +119,7 @@ function preparePlan(input) {
117
119
  after[`${bucket}RemainderNumerator`] = String(next.remainder.n);
118
120
  after[`${bucket}RemainderDenominator`] = String(next.remainder.d);
119
121
  after[`${bucket}PrecisionVersion`] = String(BigInt(after[`${bucket}PrecisionVersion`]) + (dr.n === 0n ? 0n : 1n));
120
- if (!sequence(after[`${bucket}PrecisionVersion`])) throw failure('financial_admission_version_exhausted');
122
+ if (!precisionVersion(after[`${bucket}PrecisionVersion`])) throw failure('financial_admission_version_exhausted');
121
123
  // Existing RG eligibility is based on actual real-wallet debit, not bonus.
122
124
  // Freespin/free-bet/session eligibility still belongs to the caller's
123
125
  // established policy checks, independently verified by Payment.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "b2b-platform-utils",
3
- "version": "1.1.99",
3
+ "version": "1.1.100",
4
4
  "description": "Shared utilities for Node.js microservices: errors map, local cache, logger, numbers, dates, filesystem, media optimization, paginator, slugger, crypto wrapper, sanitize HTML, sorting.",
5
5
  "type": "commonjs",
6
6
  "license": "KingSizer",