@blamejs/core 0.13.43 → 0.13.44

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.
@@ -113,23 +113,23 @@ function create(opts) {
113
113
 
114
114
  if (!opts.db || typeof opts.db.from !== "function" ||
115
115
  typeof opts.db.getTableMetadata !== "function") {
116
- throw new TenantQuotaError("tenantQuota/bad-db",
116
+ throw new TenantQuotaError("tenant-quota/bad-db",
117
117
  "tenantQuota.create: opts.db must be the framework's b.db namespace");
118
118
  }
119
119
  validateOpts.requireNonEmptyString(opts.tenantField,
120
- "tenantQuota.create: tenantField", TenantQuotaError, "tenantQuota/bad-field");
120
+ "tenantQuota.create: tenantField", TenantQuotaError, "tenant-quota/bad-field");
121
121
 
122
122
  var defaultBytesCap = (opts.defaultBytesCap == null)
123
123
  ? DEFAULT_BYTES_CAP
124
124
  : opts.defaultBytesCap;
125
125
  if (typeof defaultBytesCap !== "number" || !isFinite(defaultBytesCap) || defaultBytesCap <= 0) {
126
- throw new TenantQuotaError("tenantQuota/bad-cap",
126
+ throw new TenantQuotaError("tenant-quota/bad-cap",
127
127
  "tenantQuota.create: defaultBytesCap must be a positive finite number");
128
128
  }
129
129
 
130
130
  var perTenantBytesCap = opts.perTenantBytesCap || {};
131
131
  if (typeof perTenantBytesCap !== "object" || Array.isArray(perTenantBytesCap)) {
132
- throw new TenantQuotaError("tenantQuota/bad-per-tenant",
132
+ throw new TenantQuotaError("tenant-quota/bad-per-tenant",
133
133
  "tenantQuota.create: perTenantBytesCap must be a plain object {tenantId: bytes}");
134
134
  }
135
135
  // Validate every per-tenant override at config time so a typo
@@ -138,7 +138,7 @@ function create(opts) {
138
138
  for (var pi = 0; pi < ptKeys.length; pi++) {
139
139
  var v = perTenantBytesCap[ptKeys[pi]];
140
140
  if (typeof v !== "number" || !isFinite(v) || v <= 0) {
141
- throw new TenantQuotaError("tenantQuota/bad-per-tenant",
141
+ throw new TenantQuotaError("tenant-quota/bad-per-tenant",
142
142
  "tenantQuota.create: perTenantBytesCap['" + ptKeys[pi] +
143
143
  "'] must be a positive finite number");
144
144
  }
@@ -147,7 +147,7 @@ function create(opts) {
147
147
  var auditOn = opts.audit !== false;
148
148
  var cacheTtlMs = (opts.cacheTtlMs == null) ? DEFAULT_CACHE_TTL_MS : opts.cacheTtlMs;
149
149
  if (typeof cacheTtlMs !== "number" || !isFinite(cacheTtlMs) || cacheTtlMs < 0) {
150
- throw new TenantQuotaError("tenantQuota/bad-ttl",
150
+ throw new TenantQuotaError("tenant-quota/bad-ttl",
151
151
  "tenantQuota.create: cacheTtlMs must be a non-negative finite number");
152
152
  }
153
153
 
@@ -230,7 +230,7 @@ function create(opts) {
230
230
 
231
231
  async function snapshot(tenantId) {
232
232
  validateOpts.requireNonEmptyString(tenantId,
233
- "tenantQuota.snapshot: tenantId", TenantQuotaError, "tenantQuota/bad-tenant");
233
+ "tenantQuota.snapshot: tenantId", TenantQuotaError, "tenant-quota/bad-tenant");
234
234
  var now = Date.now();
235
235
  var cached = cache.get(tenantId);
236
236
  var bytesUsed;
@@ -258,7 +258,7 @@ function create(opts) {
258
258
  bytesCap: snap.bytesCap,
259
259
  });
260
260
  _emitMetric("tenant.quota.exceeded", 1);
261
- throw new TenantQuotaError("tenantQuota/exceeded",
261
+ throw new TenantQuotaError("tenant-quota/exceeded",
262
262
  "tenantQuota.assert: tenant '" + tenantId + "' is at " +
263
263
  snap.bytesUsed + " of " + snap.bytesCap + " bytes; insert refused");
264
264
  }
@@ -344,21 +344,21 @@ function budget(opts) {
344
344
  ], "tenantQuota.budget");
345
345
 
346
346
  validateOpts.requireNonEmptyString(opts.tenantField,
347
- "tenantQuota.budget: tenantField", TenantQuotaError, "tenantQuota/bad-field");
347
+ "tenantQuota.budget: tenantField", TenantQuotaError, "tenant-quota/bad-field");
348
348
 
349
349
  var qpsCap = (opts.perTenantQpsCap == null) ? DEFAULT_QPS_CAP : opts.perTenantQpsCap;
350
350
  if (typeof qpsCap !== "number" || !isFinite(qpsCap) || qpsCap <= 0) {
351
- throw new TenantQuotaError("tenantQuota/bad-qps",
351
+ throw new TenantQuotaError("tenant-quota/bad-qps",
352
352
  "tenantQuota.budget: perTenantQpsCap must be a positive finite number");
353
353
  }
354
354
  var rowsCap = (opts.perTenantTotalRowsRead == null) ? DEFAULT_ROWS_READ : opts.perTenantTotalRowsRead;
355
355
  if (typeof rowsCap !== "number" || !isFinite(rowsCap) || rowsCap <= 0) {
356
- throw new TenantQuotaError("tenantQuota/bad-rows",
356
+ throw new TenantQuotaError("tenant-quota/bad-rows",
357
357
  "tenantQuota.budget: perTenantTotalRowsRead must be a positive finite number");
358
358
  }
359
359
  var windowMs = (opts.window == null) ? DEFAULT_WINDOW_MS : opts.window;
360
360
  if (typeof windowMs !== "number" || !isFinite(windowMs) || windowMs <= 0) {
361
- throw new TenantQuotaError("tenantQuota/bad-window",
361
+ throw new TenantQuotaError("tenant-quota/bad-window",
362
362
  "tenantQuota.budget: window must be a positive finite number");
363
363
  }
364
364
  var auditOn = opts.audit !== false;
@@ -393,7 +393,7 @@ function budget(opts) {
393
393
 
394
394
  function observe(tenantId, info) {
395
395
  validateOpts.requireNonEmptyString(tenantId,
396
- "tenantQuota.budget.observe: tenantId", TenantQuotaError, "tenantQuota/bad-tenant");
396
+ "tenantQuota.budget.observe: tenantId", TenantQuotaError, "tenant-quota/bad-tenant");
397
397
  info = info || {};
398
398
  var rowsRead = (typeof info.rowsRead === "number" && info.rowsRead >= 0) ? info.rowsRead : 0;
399
399
  var now = Date.now();
@@ -411,7 +411,7 @@ function budget(opts) {
411
411
  windowMs: windowMs,
412
412
  });
413
413
  _emitMetric("tenant.budget.exceeded", 1);
414
- throw new TenantQuotaError("tenantQuota/budget-exceeded",
414
+ throw new TenantQuotaError("tenant-quota/budget-exceeded",
415
415
  "tenantQuota.budget: tenant '" + tenantId + "' exceeded budget " +
416
416
  "(calls=" + c.calls + "/" + maxCalls + ", rowsRead=" + c.rowsRead +
417
417
  "/" + rowsCap + ", windowMs=" + windowMs + ")");
@@ -486,7 +486,7 @@ function budget(opts) {
486
486
  */
487
487
  function instrumentQuery(opts) {
488
488
  if (!opts || typeof opts !== "object") {
489
- throw new TenantQuotaError("tenantQuota/bad-instr",
489
+ throw new TenantQuotaError("tenant-quota/bad-instr",
490
490
  "tenantQuota.instrumentQuery: opts object is required");
491
491
  }
492
492
  validateOpts(opts, [
@@ -494,13 +494,13 @@ function instrumentQuery(opts) {
494
494
  ], "tenantQuota.instrumentQuery");
495
495
 
496
496
  if (!Array.isArray(opts.rows)) {
497
- throw new TenantQuotaError("tenantQuota/bad-rows",
497
+ throw new TenantQuotaError("tenant-quota/bad-rows",
498
498
  "tenantQuota.instrumentQuery: rows must be an array");
499
499
  }
500
500
  validateOpts.requireNonEmptyString(opts.tenantField,
501
- "tenantQuota.instrumentQuery: tenantField", TenantQuotaError, "tenantQuota/bad-field");
501
+ "tenantQuota.instrumentQuery: tenantField", TenantQuotaError, "tenant-quota/bad-field");
502
502
  validateOpts.requireNonEmptyString(opts.tenantId,
503
- "tenantQuota.instrumentQuery: tenantId", TenantQuotaError, "tenantQuota/bad-tenant");
503
+ "tenantQuota.instrumentQuery: tenantId", TenantQuotaError, "tenant-quota/bad-tenant");
504
504
  var auditOn = opts.audit !== false;
505
505
 
506
506
  var crossover = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blamejs/core",
3
- "version": "0.13.43",
3
+ "version": "0.13.44",
4
4
  "description": "The Node framework that owns its stack.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "blamejs contributors",
package/sbom.cdx.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
3
3
  "bomFormat": "CycloneDX",
4
4
  "specVersion": "1.5",
5
- "serialNumber": "urn:uuid:d368c000-a7b7-493e-bb55-a28c08371f7e",
5
+ "serialNumber": "urn:uuid:43cf0213-9944-42ad-9695-86dbc4acd548",
6
6
  "version": 1,
7
7
  "metadata": {
8
- "timestamp": "2026-05-30T00:14:53.721Z",
8
+ "timestamp": "2026-05-30T00:54:18.743Z",
9
9
  "lifecycles": [
10
10
  {
11
11
  "phase": "build"
@@ -19,14 +19,14 @@
19
19
  }
20
20
  ],
21
21
  "component": {
22
- "bom-ref": "@blamejs/core@0.13.43",
22
+ "bom-ref": "@blamejs/core@0.13.44",
23
23
  "type": "application",
24
24
  "name": "blamejs",
25
- "version": "0.13.43",
25
+ "version": "0.13.44",
26
26
  "scope": "required",
27
27
  "author": "blamejs contributors",
28
28
  "description": "The Node framework that owns its stack.",
29
- "purl": "pkg:npm/%40blamejs/core@0.13.43",
29
+ "purl": "pkg:npm/%40blamejs/core@0.13.44",
30
30
  "properties": [],
31
31
  "externalReferences": [
32
32
  {
@@ -54,7 +54,7 @@
54
54
  "components": [],
55
55
  "dependencies": [
56
56
  {
57
- "ref": "@blamejs/core@0.13.43",
57
+ "ref": "@blamejs/core@0.13.44",
58
58
  "dependsOn": []
59
59
  }
60
60
  ]