@proteinjs/db-file 1.8.0 → 1.8.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.8.2](https://github.com/proteinjs/db/compare/@proteinjs/db-file@1.8.1...@proteinjs/db-file@1.8.2) (2026-09-23)
7
+
8
+ **Note:** Version bump only for package @proteinjs/db-file
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.8.1](https://github.com/proteinjs/db/compare/@proteinjs/db-file@1.8.0...@proteinjs/db-file@1.8.1) (2026-09-20)
15
+
16
+ **Note:** Version bump only for package @proteinjs/db-file
17
+
18
+
19
+
20
+
21
+
6
22
  # [1.8.0](https://github.com/proteinjs/db/compare/@proteinjs/db-file@1.7.22...@proteinjs/db-file@1.8.0) (2026-09-17)
7
23
 
8
24
 
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=emulatorLockName.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emulatorLockName.test.d.ts","sourceRoot":"","sources":["../../test/emulatorLockName.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var os_1 = __importDefault(require("os"));
7
+ var path_1 = __importDefault(require("path"));
8
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
9
+ var lockFilePathFor = require('./emulatorLock').lockFilePathFor;
10
+ /**
11
+ * The emulator lock's FILE NAME is a contract between every copy of the lock: two jest runs
12
+ * serialize on a shared emulator only when they compute the same file for the same host. No
13
+ * shared package carries the lock yet, so the contract is pinned by value — this table is the
14
+ * same, row for row, in every repository that keeps a copy. A change to a row here is a change
15
+ * to all of them, made in the same window; a copy that drifts stops contending, silently.
16
+ */
17
+ // [emulator host, lock file name, what the row pins]
18
+ var LOCK_FILE_NAMES = [
19
+ ['localhost:9010', 'spanner-emulator-localhost-9010-0091e79a.lock', 'the default shared emulator'],
20
+ [
21
+ 'localhost-9010',
22
+ 'spanner-emulator-localhost-9010-493b66d1.lock',
23
+ 'the same slug as the row above: the hash alone keeps two hosts apart',
24
+ ],
25
+ [
26
+ '[emulator.a-host-name-long-enough-to-run-past-the-sixty-four-cap.example.test]:9010',
27
+ 'spanner-emulator-emulator-a-host-name-long-enough-to-run-past-the-sixty-four-cap--fe958a1a.lock',
28
+ 'edge dashes trimmed first, the slug capped at 64 second (the cap lands on a dash, and it stays)',
29
+ ],
30
+ ];
31
+ describe('the emulator lock file name (the contract every copy of the lock shares)', function () {
32
+ it.each(LOCK_FILE_NAMES)('%s locks on %s (%s)', function (host, fileName) {
33
+ expect(lockFilePathFor(host)).toBe(path_1.default.join(os_1.default.tmpdir(), fileName));
34
+ });
35
+ });
36
+ //# sourceMappingURL=emulatorLockName.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emulatorLockName.test.js","sourceRoot":"","sources":["../../test/emulatorLockName.test.ts"],"names":[],"mappings":";;;;;AAAA,0CAAoB;AACpB,8CAAwB;AAExB,8DAA8D;AACtD,IAAA,eAAe,GAAK,OAAO,CAAC,gBAAgB,CAAkD,gBAA/E,CAAgF;AAEvG;;;;;;GAMG;AACH,qDAAqD;AACrD,IAAM,eAAe,GAA+B;IAClD,CAAC,gBAAgB,EAAE,+CAA+C,EAAE,6BAA6B,CAAC;IAClG;QACE,gBAAgB;QAChB,+CAA+C;QAC/C,sEAAsE;KACvE;IACD;QACE,qFAAqF;QACrF,iGAAiG;QACjG,iGAAiG;KAClG;CACF,CAAC;AAEF,QAAQ,CAAC,0EAA0E,EAAE;IACnF,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,qBAAqB,EAAE,UAAC,IAAI,EAAE,QAAQ;QAC7D,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteinjs/db-file",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "File storage in the db",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,7 +22,7 @@
22
22
  "watch": "reflection-watch"
23
23
  },
24
24
  "dependencies": {
25
- "@proteinjs/db": "^1.47.1",
25
+ "@proteinjs/db": "^1.47.2",
26
26
  "@proteinjs/logger": "^1.0.21",
27
27
  "@proteinjs/reflection": "^1.2.0",
28
28
  "@proteinjs/server-api": "^3.0.11",
@@ -31,7 +31,7 @@
31
31
  "moment": "2.29.4"
32
32
  },
33
33
  "devDependencies": {
34
- "@proteinjs/db-driver-spanner": "^1.30.2",
34
+ "@proteinjs/db-driver-spanner": "^1.31.1",
35
35
  "@proteinjs/reflection-build": "^2.0.1",
36
36
  "@types/jest": "29.5.5",
37
37
  "@types/node": "14.0.27",
@@ -46,5 +46,5 @@
46
46
  },
47
47
  "main": "./dist/generated/index.js",
48
48
  "types": "./dist/generated/index.d.ts",
49
- "gitHead": "c1037d11c75f92b6d015f10efb9e1a761f7d7710"
49
+ "gitHead": "e87f7725a3051bf624920e1089cbc36de5ac476e"
50
50
  }
@@ -7,11 +7,10 @@
7
7
  * FAILED_PRECONDITION). This lock closes that gap for this package: a lockfile in os.tmpdir()
8
8
  * keyed by the emulator host string, held for the whole jest run via globalSetup/globalTeardown.
9
9
  *
10
- * The lockfile PATH FORMULA must stay byte-identical to the fleet's canonical implementation
11
- * (`EmulatorLock.lockFilePathFor` in @n3xah/thought-common/test) so suites from every repo
12
- * pointed at the same emulator actually contend on the same file. The logic is duplicated here
13
- * because this repo sits BELOW @n3xah in the dependency layering (thought-common itself depends
14
- * on @proteinjs/user) — future extraction target: @proteinjs/db-driver-spanner/test, beside
10
+ * The lockfile PATH FORMULA must stay byte-identical in every copy of this lock (other
11
+ * repositories' suites, a consumer application's suites) so runs pointed at the same emulator
12
+ * actually contend on the same file. The logic is duplicated here because no shared package
13
+ * carries it yet — future extraction target: @proteinjs/db-driver-spanner/test, beside
15
14
  * SpannerEmulatorProvisioner.
16
15
  */
17
16
  const crypto = require('crypto');
@@ -30,7 +29,7 @@ function lockFilePathFor(host) {
30
29
  .replace(/^-+|-+$/g, '')
31
30
  .slice(0, 64);
32
31
  const hash = crypto.createHash('sha1').update(host).digest('hex').slice(0, 8);
33
- return path.join(os.tmpdir(), `n3xa-spanner-emulator-${slug}-${hash}.lock`);
32
+ return path.join(os.tmpdir(), `spanner-emulator-${slug}-${hash}.lock`);
34
33
  }
35
34
 
36
35
  function isPidAlive(pid) {
@@ -0,0 +1,33 @@
1
+ import os from 'os';
2
+ import path from 'path';
3
+
4
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
5
+ const { lockFilePathFor } = require('./emulatorLock') as { lockFilePathFor: (host: string) => string };
6
+
7
+ /**
8
+ * The emulator lock's FILE NAME is a contract between every copy of the lock: two jest runs
9
+ * serialize on a shared emulator only when they compute the same file for the same host. No
10
+ * shared package carries the lock yet, so the contract is pinned by value — this table is the
11
+ * same, row for row, in every repository that keeps a copy. A change to a row here is a change
12
+ * to all of them, made in the same window; a copy that drifts stops contending, silently.
13
+ */
14
+ // [emulator host, lock file name, what the row pins]
15
+ const LOCK_FILE_NAMES: [string, string, string][] = [
16
+ ['localhost:9010', 'spanner-emulator-localhost-9010-0091e79a.lock', 'the default shared emulator'],
17
+ [
18
+ 'localhost-9010',
19
+ 'spanner-emulator-localhost-9010-493b66d1.lock',
20
+ 'the same slug as the row above: the hash alone keeps two hosts apart',
21
+ ],
22
+ [
23
+ '[emulator.a-host-name-long-enough-to-run-past-the-sixty-four-cap.example.test]:9010',
24
+ 'spanner-emulator-emulator-a-host-name-long-enough-to-run-past-the-sixty-four-cap--fe958a1a.lock',
25
+ 'edge dashes trimmed first, the slug capped at 64 second (the cap lands on a dash, and it stays)',
26
+ ],
27
+ ];
28
+
29
+ describe('the emulator lock file name (the contract every copy of the lock shares)', () => {
30
+ it.each(LOCK_FILE_NAMES)('%s locks on %s (%s)', (host, fileName) => {
31
+ expect(lockFilePathFor(host)).toBe(path.join(os.tmpdir(), fileName));
32
+ });
33
+ });