@north-light/api 0.3.753 → 0.3.754
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/commands/sys/doctor.js +0 -9
- package/dist/commands/sys/signin.js +0 -4
- package/dist/commands/sys/update.js +1 -2
- package/dist/core/import/load/prepare.d.ts +3 -0
- package/dist/core/import/load/prepare.js +6 -0
- package/dist/core/self-update.d.ts +1 -4
- package/dist/core/self-update.js +1 -1
- package/package.json +1 -1
- package/dist/commands/sys/old-package.d.ts +0 -9
- package/dist/commands/sys/old-package.js +0 -20
|
@@ -12,7 +12,6 @@ import { pathExists, listDirs, removePath } from '../../core/fs-utils.js';
|
|
|
12
12
|
import { lsRemote } from '../../core/git.js';
|
|
13
13
|
import { cliClient } from '../api-client.js';
|
|
14
14
|
import { detectNerdFont, nerdFontInstallCommand, NERD_FONT_SELECT_HINT } from '../../core/runtime/nerd-font.js';
|
|
15
|
-
import { oldPackageInstalled } from './old-package.js';
|
|
16
15
|
import { detectPackageManager } from './setup-core.js';
|
|
17
16
|
import { validateEffectiveCommandPlugins } from '../../core/command-plugins/discovery.js';
|
|
18
17
|
import { adaptPluginContributions } from '../../core/command-plugins/compose.js';
|
|
@@ -387,13 +386,6 @@ function runNerdFontCheck() {
|
|
|
387
386
|
...(plan.command ? { command: plan.command } : {}),
|
|
388
387
|
});
|
|
389
388
|
}
|
|
390
|
-
/** `@crouton-kit/crouter` installed beside this package fights it for the `crtr` bin, and npm refuses to install over it; only uninstalling it first works. */
|
|
391
|
-
function oldPackageCheck() {
|
|
392
|
-
const old = oldPackageInstalled();
|
|
393
|
-
if (old === undefined)
|
|
394
|
-
return pass('canvas', 'package:old-crouter', 'the old @crouton-kit/crouter package is not installed');
|
|
395
|
-
return failCheck('canvas', 'package:old-crouter', old.message, { kind: 'human_action', description: 'Remove the old package, then reinstall this one', command: `${old.uninstall} && npm i -g @north-light/cli@latest` });
|
|
396
|
-
}
|
|
397
389
|
/** Where the generation was installed from (`<id>.source.json` beside it, written by install-runtime). */
|
|
398
390
|
function installSourceCheck(label, generation) {
|
|
399
391
|
const name = `runtime:${label}:source`;
|
|
@@ -638,7 +630,6 @@ export const sysDoctorLeaf = defineLeaf({
|
|
|
638
630
|
allResults.push(...runBinContributionChecks(scopes));
|
|
639
631
|
allResults.push(...runHumanActionChecks(scopes));
|
|
640
632
|
allResults.push(...await runRequiresChecks(scopes));
|
|
641
|
-
allResults.push(oldPackageCheck());
|
|
642
633
|
allResults.push(...await runFaultChecks());
|
|
643
634
|
const processLocation = processGeneration();
|
|
644
635
|
allResults.push(...await generationChecks('selected', selectedGeneration(), processLocation === null));
|
|
@@ -13,7 +13,6 @@ import { envNodeId } from '../../shared/env.js';
|
|
|
13
13
|
import { ExitCode } from '../../types.js';
|
|
14
14
|
import { insideBroker } from './join.js';
|
|
15
15
|
import { defaultDirectoryUrl, finishMove, registerThisMac, runMove, settleEarlierMove } from './import/move.js';
|
|
16
|
-
import { oldPackageInstalled } from './old-package.js';
|
|
17
16
|
import { WAIT_FOR_PID_ENV } from './import/start.js';
|
|
18
17
|
/** Open the confirm page in the person's browser; a failure to open it is harmless because the code and address are printed too. */
|
|
19
18
|
function openBrowser(url) {
|
|
@@ -126,9 +125,6 @@ export const sysSigninLeaf = defineLeaf({
|
|
|
126
125
|
// A computer with local records needs its daemon (the move reads the canvas through it) and a machine's daemon is the machine role; a fresh computer starts none until it is registered.
|
|
127
126
|
if (readMachineConfig() !== undefined || hasLocalCanvas())
|
|
128
127
|
await spawnDaemon();
|
|
129
|
-
const oldPackage = oldPackageInstalled();
|
|
130
|
-
if (oldPackage !== undefined)
|
|
131
|
-
process.stderr.write(`${oldPackage.message}\n`);
|
|
132
128
|
const directoryUrl = input.directoryUrl === undefined ? defaultDirectoryUrl() : String(input.directoryUrl);
|
|
133
129
|
const unfinished = await settleEarlierMove(showSignIn);
|
|
134
130
|
if (unfinished !== undefined) {
|
|
@@ -47,8 +47,7 @@ export const sysUpdateLeaf = defineLeaf({
|
|
|
47
47
|
kind: 'self',
|
|
48
48
|
current: r.current,
|
|
49
49
|
latest: r.latest,
|
|
50
|
-
|
|
51
|
-
up_to_date: !r.migrating && r.current === r.latest,
|
|
50
|
+
up_to_date: r.current === r.latest,
|
|
52
51
|
unreachable: false,
|
|
53
52
|
});
|
|
54
53
|
}
|
|
@@ -36,6 +36,9 @@ export declare function dropExistingWatches(db: CanvasDb, schema: string, target
|
|
|
36
36
|
watches: number;
|
|
37
37
|
watch_subscriptions: number;
|
|
38
38
|
}>;
|
|
39
|
+
/** A hosted cron runs in its anchor node's sandbox and fails with no anchor. A Mac cron made without `--anchor` has none, so a staged cron of a hosted source with no anchor
|
|
40
|
+
* takes its creator as anchor when that node is staged (still in the bundle after the drops). The anchor's `ON DELETE CASCADE` then removes the cron with its creator. Runs after the drops. Returns the crons anchored. */
|
|
41
|
+
export declare function anchorCronsToCreator(db: CanvasDb, schema: string): Promise<number>;
|
|
39
42
|
/** A staged idempotency key whose (grantee, key) the target already holds is already imported (a hosted person's runs the control plane has since served): it is dropped, the target's
|
|
40
43
|
* row stands, so the copy never inserts it and verify never compares it. Only this key is skipped; any other difference still fails. Returns the dropped rows. Runs before the pre-check. */
|
|
41
44
|
export declare function dropExistingIdempotencyKeys(db: CanvasDb, schema: string, target: string): Promise<number>;
|
|
@@ -121,6 +121,12 @@ export async function dropExistingWatches(db, schema, target) {
|
|
|
121
121
|
const watches = await db.prepareUncached(`DELETE FROM ${sq(schema, 'watches')} s WHERE EXISTS (SELECT 1 ${same})`).run();
|
|
122
122
|
return { watches: Number(watches.changes), watch_subscriptions: Number(subs.changes) };
|
|
123
123
|
}
|
|
124
|
+
/** A hosted cron runs in its anchor node's sandbox and fails with no anchor. A Mac cron made without `--anchor` has none, so a staged cron of a hosted source with no anchor
|
|
125
|
+
* takes its creator as anchor when that node is staged (still in the bundle after the drops). The anchor's `ON DELETE CASCADE` then removes the cron with its creator. Runs after the drops. Returns the crons anchored. */
|
|
126
|
+
export async function anchorCronsToCreator(db, schema) {
|
|
127
|
+
const done = await db.prepareUncached(`UPDATE ${sq(schema, 'crons')} c SET anchor_node = c.created_by WHERE c.anchor_node IS NULL AND c.created_by IN (SELECT node_id FROM ${sq(schema, 'nodes')})`).run();
|
|
128
|
+
return Number(done.changes);
|
|
129
|
+
}
|
|
124
130
|
/** A staged idempotency key whose (grantee, key) the target already holds is already imported (a hosted person's runs the control plane has since served): it is dropped, the target's
|
|
125
131
|
* row stands, so the copy never inserts it and verify never compares it. Only this key is skipped; any other difference still fails. Returns the dropped rows. Runs before the pre-check. */
|
|
126
132
|
export async function dropExistingIdempotencyKeys(db, schema, target) {
|
|
@@ -4,11 +4,8 @@ export declare function selfUpdate(): void;
|
|
|
4
4
|
export interface SelfCheckResult {
|
|
5
5
|
current: string;
|
|
6
6
|
latest: string;
|
|
7
|
-
/** The npm package an update installs from: this install's own name
|
|
8
|
-
* `@north-light/cli` for an install of the deprecated `@crouter/cli`. */
|
|
7
|
+
/** The npm package an update installs from: this install's own name. */
|
|
9
8
|
package: string;
|
|
10
|
-
/** True when an update moves this install to a different package. */
|
|
11
|
-
migrating: boolean;
|
|
12
9
|
}
|
|
13
10
|
/** Check whether a newer crtr version is available on npm. The package to ask
|
|
14
11
|
* comes from scripts/self-update.mjs, so a check and an update always agree.
|
package/dist/core/self-update.js
CHANGED
|
@@ -34,7 +34,7 @@ export function selfCheck() {
|
|
|
34
34
|
const parsed = JSON.parse(res.stdout);
|
|
35
35
|
if (typeof parsed.latest !== 'string')
|
|
36
36
|
return null;
|
|
37
|
-
return { current: currentVersion(), latest: parsed.latest, package: parsed.package
|
|
37
|
+
return { current: currentVersion(), latest: parsed.latest, package: parsed.package };
|
|
38
38
|
}
|
|
39
39
|
catch {
|
|
40
40
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.754",
|
|
4
4
|
"description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/api/index.js",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const OLD_PACKAGE = "@crouton-kit/crouter";
|
|
2
|
-
export declare const OLD_PACKAGE_UNINSTALL = "npm uninstall -g @crouton-kit/crouter";
|
|
3
|
-
/** Where a global install of this package sits beside the old one: `<lib>/node_modules/@north-light/cli` → `<lib>/node_modules/@crouton-kit/crouter`. */
|
|
4
|
-
export declare function oldPackageDir(packageRoot: string): string | undefined;
|
|
5
|
-
/** The old package installed next to this one, with the message that names the command that removes it; undefined when it is absent. */
|
|
6
|
-
export declare function oldPackageInstalled(packageRoot?: string): {
|
|
7
|
-
uninstall: string;
|
|
8
|
-
message: string;
|
|
9
|
-
} | undefined;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// The old `@crouton-kit/crouter` package declares the same `crtr` bin as `@north-light/cli`. npm checks bin ownership before any install script runs,
|
|
2
|
-
// so `npm i -g @north-light/cli` over it fails with EEXIST and no script of ours can prevent that; the old package has to be uninstalled first.
|
|
3
|
-
import { existsSync } from 'node:fs';
|
|
4
|
-
import { dirname, join, sep } from 'node:path';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
export const OLD_PACKAGE = '@crouton-kit/crouter';
|
|
7
|
-
export const OLD_PACKAGE_UNINSTALL = `npm uninstall -g ${OLD_PACKAGE}`;
|
|
8
|
-
/** Where a global install of this package sits beside the old one: `<lib>/node_modules/@north-light/cli` → `<lib>/node_modules/@crouton-kit/crouter`. */
|
|
9
|
-
export function oldPackageDir(packageRoot) {
|
|
10
|
-
const marker = `${sep}node_modules${sep}@north-light${sep}cli`;
|
|
11
|
-
const at = packageRoot.lastIndexOf(marker);
|
|
12
|
-
return at < 0 ? undefined : join(packageRoot.slice(0, at), 'node_modules', OLD_PACKAGE);
|
|
13
|
-
}
|
|
14
|
-
/** The old package installed next to this one, with the message that names the command that removes it; undefined when it is absent. */
|
|
15
|
-
export function oldPackageInstalled(packageRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..')) {
|
|
16
|
-
const dir = oldPackageDir(packageRoot);
|
|
17
|
-
if (dir === undefined || !existsSync(join(dir, 'package.json')))
|
|
18
|
-
return undefined;
|
|
19
|
-
return { uninstall: OLD_PACKAGE_UNINSTALL, message: `The old ${OLD_PACKAGE} package is still installed at ${dir} and owns the \`crtr\` command. Run \`${OLD_PACKAGE_UNINSTALL}\`, then \`npm i -g @north-light/cli@latest\`.` };
|
|
20
|
-
}
|