@blamejs/core 0.6.7 → 0.6.12

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/lib/seeders.js CHANGED
@@ -36,14 +36,14 @@
36
36
  * truncating the seeded tables themselves; "unseed" isn't framework-
37
37
  * knowable.
38
38
  *
39
- * Validation tiers:
39
+ * Validation policy:
40
40
  *
41
- * - create() opts → Tier A (throw at boot)
42
- * - run/status `env` arg → Tier A (throw explicit)
43
- * - seed file shape (missing run, etc) → Tier A (throw at load)
44
- * - dependsOn cycle → Tier A (throw at load)
45
- * - dependsOn missing → Tier A (throw at run)
46
- * - audit emit failures → Tier B (drop silent)
41
+ * - create() opts → throw at boot
42
+ * - run/status `env` arg → throw at call site (explicit)
43
+ * - seed file shape (missing run, etc) → throw at load
44
+ * - dependsOn cycle → throw at load
45
+ * - dependsOn missing → throw at run
46
+ * - audit emit failures → drop silent (hot-path sink)
47
47
  *
48
48
  * Security defaults:
49
49
  *
@@ -103,7 +103,7 @@ function _runSql(db, sql) {
103
103
  throw _err("BAD_DB", "seeders: db handle exposes no DDL runner (exec / runSql)");
104
104
  }
105
105
 
106
- // ---- Tier-A validation helpers ----
106
+ // ---- Call-site validation helpers (throw on bad input) ----
107
107
 
108
108
  function _validateEnv(name, value) {
109
109
  if (typeof value !== "string" || value.length === 0) {
@@ -399,7 +399,7 @@ function create(opts) {
399
399
 
400
400
  function _emitObs(name, labels) {
401
401
  try { observability().event(name, 1, labels || {}); }
402
- catch (_e) { /* Tier B */ }
402
+ catch (_e) { /* drop-silent observability sink must not crash seeders */ }
403
403
  }
404
404
 
405
405
  function _emitAudit(action, info) {
package/lib/session.js CHANGED
@@ -212,8 +212,11 @@ async function touch(token, opts) {
212
212
  // assembly) and matches the call shape clusterStorage expects.
213
213
  // extendBy resets expiresAt relative to NOW, not relative to the
214
214
  // current expiresAt — a soaked session with continuous traffic
215
- // shouldn't accumulate unbounded expiry.
216
- if (typeof opts.extendBy === "number" && opts.extendBy > 0) {
215
+ // shouldn't accumulate unbounded expiry. The same MAX_TTL_MS
216
+ // ceiling create() and rotate() apply gates extendBy too repeated
217
+ // touch() calls cannot push expiresAt past the framework's bound.
218
+ if (opts.extendBy !== undefined && opts.extendBy !== null) {
219
+ _validateTtl(opts.extendBy, "session.touch");
217
220
  var newExpires = nowMs + opts.extendBy;
218
221
  var result = await clusterStorage.execute(
219
222
  "UPDATE _blamejs_sessions SET lastActivity = ?, expiresAt = ? " +
package/lib/slug.js CHANGED
@@ -20,12 +20,12 @@
20
20
  * symbols, and separators — Cyrillic, Greek, CJK, and other scripts pass
21
21
  * through. Operators with non-Latin user content opt into preserveUnicode.
22
22
  *
23
- * Validation tiers:
23
+ * Validation policy:
24
24
  *
25
- * - Opts at first call (every public fn) → Tier A (throw)
26
- * - title not a string → Tier A (throw)
27
- * - title normalizes to empty → Tier C (return opts.fallback)
28
- * - unique() exhausts maxAttempts → Tier A (throw SlugError)
25
+ * - Opts at first call (every public fn) → throw at call site
26
+ * - title not a string → throw at call site
27
+ * - title normalizes to empty → return opts.fallback (tolerant)
28
+ * - unique() exhausts maxAttempts → throw SlugError at call site
29
29
  *
30
30
  * Out of scope (v1):
31
31
  * - Word-by-word transliteration tables (Russian → English, Chinese →
@@ -61,7 +61,7 @@ var _RESERVED = Object.freeze([
61
61
  "new", "edit", "delete", "create", "update",
62
62
  ]);
63
63
 
64
- // ---- Tier-A validation helpers ----
64
+ // ---- Call-site validation helpers (throw on bad input) ----
65
65
 
66
66
  function _isPositiveInt(n) {
67
67
  return typeof n === "number" && isFinite(n) && n >= 1 && Math.floor(n) === n;
package/lib/testing.js CHANGED
@@ -82,7 +82,7 @@ var DEFAULTS = Object.freeze({
82
82
  runMiddlewareTimeoutMs: 5000,
83
83
  });
84
84
 
85
- // ---- Tier-A helpers ----
85
+ // ---- Call-site validation helpers (throw on bad input) ----
86
86
 
87
87
  function _isPositiveInt(n) {
88
88
  return typeof n === "number" && isFinite(n) && n >= 1 && Math.floor(n) === n;
@@ -268,7 +268,7 @@ function fakeHttpClient(responder) {
268
268
 
269
269
  // ---- captureAudit ----
270
270
  //
271
- // Matches b.audit.safeEmit Tier-B drop-silent contract. captured holds
271
+ // Matches b.audit.safeEmit's drop-silent contract. captured holds
272
272
  // every event pushed; clear() empties; byAction(name) filters.
273
273
 
274
274
  function captureAudit() {
@@ -276,9 +276,9 @@ function captureAudit() {
276
276
  return {
277
277
  captured: captured,
278
278
  safeEmit: function (event) {
279
- // Tier B: drop-silent on caller-side bugs that throw inside the
280
- // capture push (shouldn't happen with array.push, but matches the
281
- // real safeEmit's defensive shape).
279
+ // Drop-silent on caller-side bugs that throw inside the capture
280
+ // push (shouldn't happen with array.push, but matches the real
281
+ // safeEmit's defensive shape).
282
282
  try { captured.push(event); }
283
283
  catch (_e) { /* drop-silent */ }
284
284
  },
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  /**
3
- * validate-opts — shared Tier-A helper for primitive create() functions.
3
+ * validate-opts — shared call-site helper for primitive create() functions
4
+ * that throws on unknown / bad-shape opts at config time.
4
5
  *
5
6
  * Catches silent operator typos: `cors({ allowedOrigins: [] })` (wrong
6
7
  * key name) currently looks like config but does nothing — the primitive
package/lib/webhook.js CHANGED
@@ -57,12 +57,12 @@
57
57
  * reference impl; operators plug in Redis/SQL by passing any object
58
58
  * with `checkAndInsert(nonce, expireAt) → bool/Promise<bool>`.
59
59
  *
60
- * Validation tiers:
60
+ * Validation policy:
61
61
  *
62
- * - signer/verifier creation opts → Tier A (throw)
63
- * - signer.sign body type → Tier A (throw)
64
- * - signer.send url shape → Tier A (throw via safeUrl)
65
- * - verifier.verify input shape → Tier A (throw WebhookError)
62
+ * - signer/verifier creation opts → throw at config time
63
+ * - signer.sign body type → throw at call site
64
+ * - signer.send url shape → throw at call site (via safeUrl)
65
+ * - verifier.verify input shape → throw WebhookError at call site
66
66
  * - nonceStore.checkAndInsert err → propagates (fail-closed)
67
67
  */
68
68
 
@@ -79,7 +79,7 @@ var observability = lazyRequire(function () { return require("./observability");
79
79
 
80
80
  function _emitEvent(name, value, labels) {
81
81
  try { observability().event(name, value, labels || {}); }
82
- catch (_e) { /* Tier B: hot-path observability sink */ }
82
+ catch (_e) { /* hot-path observability sink — drops silent on internal throws */ }
83
83
  }
84
84
 
85
85
  var _err = WebhookError.factory;
@@ -111,7 +111,7 @@ var DEFAULTS = Object.freeze({
111
111
  auditSuccess: true,
112
112
  });
113
113
 
114
- // ---- Tier-A validation helpers ----
114
+ // ---- Call-site validation helpers (throw on bad input) ----
115
115
 
116
116
  function _isPositiveInt(n) {
117
117
  return typeof n === "number" && isFinite(n) && n >= 1 && Math.floor(n) === n;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blamejs/core",
3
- "version": "0.6.7",
3
+ "version": "0.6.12",
4
4
  "description": "The Node framework that owns its stack.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "blamejs contributors",