@namiml/sdk-core 3.5.0-dev.202610190446 → 3.5.0-dev.202610191953

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.
package/dist/index.cjs CHANGED
@@ -106,7 +106,7 @@ const {
106
106
  // version — stamped by scripts/version.sh
107
107
  NAMI_SDK_VERSION: exports.NAMI_SDK_VERSION = "3.5.0",
108
108
  // full package version including dev suffix — stamped by scripts/version.sh
109
- NAMI_SDK_PACKAGE_VERSION: exports.NAMI_SDK_PACKAGE_VERSION = "3.5.0-dev.202610190446",
109
+ NAMI_SDK_PACKAGE_VERSION: exports.NAMI_SDK_PACKAGE_VERSION = "3.5.0-dev.202610191953",
110
110
  // environments
111
111
  PRODUCTION: exports.PRODUCTION = "production", DEVELOPMENT: exports.DEVELOPMENT = "development",
112
112
  // error messages
@@ -61374,16 +61374,33 @@ const parseDay = (expected) => {
61374
61374
  const zoned = splitZoned(expected);
61375
61375
  return zoned && DAYS.includes(zoned.value) ? { day: zoned.value, zone: zoned.zone } : null;
61376
61376
  };
61377
+ /** `H:mm@zone` / `HH:mm@zone` as minutes since local midnight plus the zone, or `null`. */
61378
+ const parseZonedTime = (expected) => {
61379
+ const zoned = splitZoned(expected);
61380
+ const match = zoned && TIME_OF_DAY.exec(zoned.value);
61381
+ return zoned && match ? { minutes: Number(match[1]) * 60 + Number(match[2]), zone: zoned.zone } : null;
61382
+ };
61383
+ /**
61384
+ * Every element parsed by `parse`, or `null` when `values` is not a non-empty array or any element
61385
+ * is invalid — a valid match elsewhere in the list never rescues an invalid element.
61386
+ */
61387
+ const parseAll = (values, parse) => {
61388
+ if (!Array.isArray(values) || values.length === 0)
61389
+ return null;
61390
+ const parsed = [];
61391
+ for (const value of values) {
61392
+ const item = typeof value === "string" ? parse(value) : null;
61393
+ if (item === null)
61394
+ return null;
61395
+ parsed.push(item);
61396
+ }
61397
+ return parsed;
61398
+ };
61377
61399
  const evaluateDayOfWeek = (operator, expected, now) => {
61378
61400
  const isDay = ({ day, zone }) => projectInZone(now, zone)?.dayOfWeek === day;
61379
61401
  if (operator === "in") {
61380
- if (!Array.isArray(expected) || expected.length === 0)
61381
- return false;
61382
- const days = expected.map(parseDay);
61383
- // Any invalid element invalidates the whole assertion, even when another element matches.
61384
- if (days.some((day) => day === null))
61385
- return false;
61386
- return days.some((day) => isDay(day));
61402
+ const days = parseAll(expected, parseDay);
61403
+ return days !== null && days.some(isDay);
61387
61404
  }
61388
61405
  if (operator !== "equals" && operator !== "notEquals")
61389
61406
  return false;
@@ -61398,14 +61415,11 @@ const evaluateDayOfWeek = (operator, expected, now) => {
61398
61415
  const evaluateTimeOfDay = (operator, expected, now) => {
61399
61416
  if (!isOrderingOperator(operator))
61400
61417
  return false;
61401
- const zoned = splitZoned(expected);
61402
- const match = zoned && TIME_OF_DAY.exec(zoned.value);
61403
- if (!zoned || !match)
61418
+ const time = parseZonedTime(expected);
61419
+ const projected = time && projectInZone(now, time.zone);
61420
+ if (!time || !projected)
61404
61421
  return false;
61405
- const projected = projectInZone(now, zoned.zone);
61406
- if (!projected)
61407
- return false;
61408
- return ORDERING[operator](projected.minutes, Number(match[1]) * 60 + Number(match[2]));
61422
+ return ORDERING[operator](projected.minutes, time.minutes);
61409
61423
  };
61410
61424
  const evaluateNow = (operator, expected, now) => {
61411
61425
  if (!isOrderingOperator(operator))
@@ -61446,24 +61460,6 @@ const FLOW_ORDERING = {
61446
61460
  const flowComparison = (operator) => Object.prototype.hasOwnProperty.call(FLOW_ORDERING, operator) ? FLOW_ORDERING[operator] : null;
61447
61461
  /** True when a Flow filter identifier is `System.time.<leaf>` (any leaf; unknown leaves evaluate `false`). */
61448
61462
  const isSystemTimeFilter = (identifier) => typeof identifier === "string" && identifier.startsWith(exports.SYSTEM_TIME_FILTER_PREFIX);
61449
- /** Every element parsed by `parse`, or `null` when `values` is empty or any element is invalid. */
61450
- const parseAll = (values, parse) => {
61451
- if (!Array.isArray(values) || values.length === 0)
61452
- return null;
61453
- const parsed = [];
61454
- for (const value of values) {
61455
- const item = typeof value === "string" ? parse(value) : null;
61456
- if (item === null)
61457
- return null;
61458
- parsed.push(item);
61459
- }
61460
- return parsed;
61461
- };
61462
- const parseZonedTime = (value) => {
61463
- const zoned = splitZoned(value);
61464
- const match = zoned && TIME_OF_DAY.exec(zoned.value);
61465
- return zoned && match ? { minutes: Number(match[1]) * 60 + Number(match[2]), zone: zoned.zone } : null;
61466
- };
61467
61463
  /**
61468
61464
  * Evaluates a Flow branch filter on `System.time.*` (the "Flow branch conditions" section of
61469
61465
  * `shared/time_conditions/README.md`, verified against `flow_vectors.json`). Every value is
package/dist/index.mjs CHANGED
@@ -104,7 +104,7 @@ const {
104
104
  // version — stamped by scripts/version.sh
105
105
  NAMI_SDK_VERSION = "3.5.0",
106
106
  // full package version including dev suffix — stamped by scripts/version.sh
107
- NAMI_SDK_PACKAGE_VERSION = "3.5.0-dev.202610190446",
107
+ NAMI_SDK_PACKAGE_VERSION = "3.5.0-dev.202610191953",
108
108
  // environments
109
109
  PRODUCTION = "production", DEVELOPMENT = "development",
110
110
  // error messages
@@ -61372,16 +61372,33 @@ const parseDay = (expected) => {
61372
61372
  const zoned = splitZoned(expected);
61373
61373
  return zoned && DAYS.includes(zoned.value) ? { day: zoned.value, zone: zoned.zone } : null;
61374
61374
  };
61375
+ /** `H:mm@zone` / `HH:mm@zone` as minutes since local midnight plus the zone, or `null`. */
61376
+ const parseZonedTime = (expected) => {
61377
+ const zoned = splitZoned(expected);
61378
+ const match = zoned && TIME_OF_DAY.exec(zoned.value);
61379
+ return zoned && match ? { minutes: Number(match[1]) * 60 + Number(match[2]), zone: zoned.zone } : null;
61380
+ };
61381
+ /**
61382
+ * Every element parsed by `parse`, or `null` when `values` is not a non-empty array or any element
61383
+ * is invalid — a valid match elsewhere in the list never rescues an invalid element.
61384
+ */
61385
+ const parseAll = (values, parse) => {
61386
+ if (!Array.isArray(values) || values.length === 0)
61387
+ return null;
61388
+ const parsed = [];
61389
+ for (const value of values) {
61390
+ const item = typeof value === "string" ? parse(value) : null;
61391
+ if (item === null)
61392
+ return null;
61393
+ parsed.push(item);
61394
+ }
61395
+ return parsed;
61396
+ };
61375
61397
  const evaluateDayOfWeek = (operator, expected, now) => {
61376
61398
  const isDay = ({ day, zone }) => projectInZone(now, zone)?.dayOfWeek === day;
61377
61399
  if (operator === "in") {
61378
- if (!Array.isArray(expected) || expected.length === 0)
61379
- return false;
61380
- const days = expected.map(parseDay);
61381
- // Any invalid element invalidates the whole assertion, even when another element matches.
61382
- if (days.some((day) => day === null))
61383
- return false;
61384
- return days.some((day) => isDay(day));
61400
+ const days = parseAll(expected, parseDay);
61401
+ return days !== null && days.some(isDay);
61385
61402
  }
61386
61403
  if (operator !== "equals" && operator !== "notEquals")
61387
61404
  return false;
@@ -61396,14 +61413,11 @@ const evaluateDayOfWeek = (operator, expected, now) => {
61396
61413
  const evaluateTimeOfDay = (operator, expected, now) => {
61397
61414
  if (!isOrderingOperator(operator))
61398
61415
  return false;
61399
- const zoned = splitZoned(expected);
61400
- const match = zoned && TIME_OF_DAY.exec(zoned.value);
61401
- if (!zoned || !match)
61416
+ const time = parseZonedTime(expected);
61417
+ const projected = time && projectInZone(now, time.zone);
61418
+ if (!time || !projected)
61402
61419
  return false;
61403
- const projected = projectInZone(now, zoned.zone);
61404
- if (!projected)
61405
- return false;
61406
- return ORDERING[operator](projected.minutes, Number(match[1]) * 60 + Number(match[2]));
61420
+ return ORDERING[operator](projected.minutes, time.minutes);
61407
61421
  };
61408
61422
  const evaluateNow = (operator, expected, now) => {
61409
61423
  if (!isOrderingOperator(operator))
@@ -61444,24 +61458,6 @@ const FLOW_ORDERING = {
61444
61458
  const flowComparison = (operator) => Object.prototype.hasOwnProperty.call(FLOW_ORDERING, operator) ? FLOW_ORDERING[operator] : null;
61445
61459
  /** True when a Flow filter identifier is `System.time.<leaf>` (any leaf; unknown leaves evaluate `false`). */
61446
61460
  const isSystemTimeFilter = (identifier) => typeof identifier === "string" && identifier.startsWith(SYSTEM_TIME_FILTER_PREFIX);
61447
- /** Every element parsed by `parse`, or `null` when `values` is empty or any element is invalid. */
61448
- const parseAll = (values, parse) => {
61449
- if (!Array.isArray(values) || values.length === 0)
61450
- return null;
61451
- const parsed = [];
61452
- for (const value of values) {
61453
- const item = typeof value === "string" ? parse(value) : null;
61454
- if (item === null)
61455
- return null;
61456
- parsed.push(item);
61457
- }
61458
- return parsed;
61459
- };
61460
- const parseZonedTime = (value) => {
61461
- const zoned = splitZoned(value);
61462
- const match = zoned && TIME_OF_DAY.exec(zoned.value);
61463
- return zoned && match ? { minutes: Number(match[1]) * 60 + Number(match[2]), zone: zoned.zone } : null;
61464
- };
61465
61461
  /**
61466
61462
  * Evaluates a Flow branch filter on `System.time.*` (the "Flow branch conditions" section of
61467
61463
  * `shared/time_conditions/README.md`, verified against `flow_vectors.json`). Every value is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namiml/sdk-core",
3
- "version": "3.5.0-dev.202610190446",
3
+ "version": "3.5.0-dev.202610191953",
4
4
  "description": "Platform-agnostic core for the Nami SDK — business logic, API, types, and state management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",