@code-partner/codepipe-hub 0.14.1-dev.388.g455782fa → 0.14.1-dev.390.g897b6f57

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.
Files changed (2) hide show
  1. package/hub/dist/index.js +27 -4
  2. package/package.json +1 -1
package/hub/dist/index.js CHANGED
@@ -13,7 +13,7 @@ var PLATFORM_VERSION;
13
13
  var init_version_generated = __esm({
14
14
  "../packages/shared/dist/version.generated.js"() {
15
15
  "use strict";
16
- PLATFORM_VERSION = "0.14.1-dev.388.g455782fa";
16
+ PLATFORM_VERSION = "0.14.1-dev.390.g897b6f57";
17
17
  }
18
18
  });
19
19
 
@@ -41,6 +41,15 @@ var init_hub_url = __esm({
41
41
  }
42
42
  });
43
43
 
44
+ // ../packages/shared/dist/local-hub.js
45
+ var LOCAL_HUB_OWNER_EMAIL;
46
+ var init_local_hub = __esm({
47
+ "../packages/shared/dist/local-hub.js"() {
48
+ "use strict";
49
+ LOCAL_HUB_OWNER_EMAIL = "local-owner@localhost";
50
+ }
51
+ });
52
+
44
53
  // ../packages/shared/dist/context-template.js
45
54
  var init_context_template = __esm({
46
55
  "../packages/shared/dist/context-template.js"() {
@@ -3001,6 +3010,7 @@ var init_dist = __esm({
3001
3010
  "use strict";
3002
3011
  init_version();
3003
3012
  init_hub_url();
3013
+ init_local_hub();
3004
3014
  init_context_template();
3005
3015
  init_project_map();
3006
3016
  init_phase();
@@ -4505,6 +4515,11 @@ function applySqliteMigrations(client) {
4505
4515
  client.raw.pragma("busy_timeout = 0");
4506
4516
  }
4507
4517
  }
4518
+ function assertNotAhead(current, known, what) {
4519
+ if (current > known) {
4520
+ throw new Error(`${what} was migrated by a newer build (schema ${current}; this build knows ${known}). Run the newer codepipe, or start from a fresh data directory.`);
4521
+ }
4522
+ }
4508
4523
  function applyLadder(client) {
4509
4524
  client.raw.exec(`CREATE TABLE IF NOT EXISTS schema_version (
4510
4525
  version INTEGER PRIMARY KEY,
@@ -4513,6 +4528,7 @@ function applyLadder(client) {
4513
4528
  )`);
4514
4529
  const row = client.raw.prepare(`SELECT MAX(version) AS v FROM schema_version`).get();
4515
4530
  let current = row.v ?? 0;
4531
+ assertNotAhead(current, SQLITE_SCHEMA_VERSION, "this database");
4516
4532
  for (const m of SQLITE_MIGRATIONS) {
4517
4533
  if (m.version <= current)
4518
4534
  continue;
@@ -4772,6 +4788,11 @@ function applyLocalHostMigrations(client) {
4772
4788
  )`);
4773
4789
  const row = client.raw.prepare(`SELECT MAX(version) AS v FROM host_schema_version`).get();
4774
4790
  let current = row.v ?? 0;
4791
+ if (current > LOCAL_HOST_SCHEMA_VERSION) {
4792
+ throw new Error(
4793
+ `this local hub store was migrated by a newer build (host schema ${current}; this build knows ${LOCAL_HOST_SCHEMA_VERSION}). Run the newer codepipe, or start from a fresh data directory.`
4794
+ );
4795
+ }
4775
4796
  for (const m of LOCAL_HOST_MIGRATIONS) {
4776
4797
  if (m.version <= current) continue;
4777
4798
  const apply = client.raw.transaction(() => {
@@ -4786,7 +4807,7 @@ function applyLocalHostMigrations(client) {
4786
4807
  client.raw.pragma("busy_timeout = 0");
4787
4808
  }
4788
4809
  }
4789
- var LOCAL_HOST_MIGRATIONS;
4810
+ var LOCAL_HOST_MIGRATIONS, LOCAL_HOST_SCHEMA_VERSION;
4790
4811
  var init_schema_local = __esm({
4791
4812
  "src/db/schema-local.ts"() {
4792
4813
  "use strict";
@@ -5361,6 +5382,7 @@ CREATE INDEX idx_model_search_project ON model_search_index(project_id);
5361
5382
  sql: `ALTER TABLE projects ADD COLUMN routing_json TEXT;`
5362
5383
  }
5363
5384
  ];
5385
+ LOCAL_HOST_SCHEMA_VERSION = LOCAL_HOST_MIGRATIONS[LOCAL_HOST_MIGRATIONS.length - 1].version;
5364
5386
  }
5365
5387
  });
5366
5388
 
@@ -22166,6 +22188,7 @@ var init_ws = __esm({
22166
22188
  init_dist();
22167
22189
 
22168
22190
  // src/config.ts
22191
+ init_dist();
22169
22192
  import { randomBytes } from "node:crypto";
22170
22193
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
22171
22194
  import { resolve } from "node:path";
@@ -22293,8 +22316,8 @@ function loadLocalConfig() {
22293
22316
  baseUrl: process.env["HUB_BASE_URL"] ?? `http://127.0.0.1:${port}`,
22294
22317
  consoleBaseUrl: "",
22295
22318
  databaseUrl: `sqlite:${resolve(dataDir, "codepipe.db")}`,
22296
- adminEmail: "local-owner@localhost",
22297
- registrationNotifyEmail: "local-owner@localhost",
22319
+ adminEmail: LOCAL_HUB_OWNER_EMAIL,
22320
+ registrationNotifyEmail: LOCAL_HUB_OWNER_EMAIL,
22298
22321
  sessionCookieSecret: process.env["HUB_SESSION_COOKIE_SECRET"] ?? localSecret(dataDir, "session-secret", 32),
22299
22322
  // The break-glass ownerless registration token must never be well-known:
22300
22323
  // any process reaching the loopback port could otherwise register a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-partner/codepipe-hub",
3
- "version": "0.14.1-dev.388.g455782fa",
3
+ "version": "0.14.1-dev.390.g897b6f57",
4
4
  "description": "The CodePipe hub, packaged for one machine: the CLI installs it on demand for the local profile.",
5
5
  "type": "module",
6
6
  "main": "./hub/dist/index.js",