nylorun 0.4.0-beta → 0.5.0-beta
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 +22 -0
- package/README.md +108 -98
- package/dist/cli.js +24 -22
- package/dist/doctor.d.ts +7 -7
- package/dist/doctor.js +36 -36
- package/dist/home.d.ts +1 -1
- package/dist/home.js +1 -1
- package/dist/project/derived-key.d.ts +2 -2
- package/dist/project/derived-key.js +2 -2
- package/dist/project/link.d.ts +7 -7
- package/dist/project/link.js +3 -3
- package/dist/stack/commands.d.ts +14 -14
- package/dist/stack/commands.js +132 -192
- package/dist/stack/compose-file.d.ts +7 -7
- package/dist/stack/compose-file.js +13 -11
- package/dist/stack/docker.js +1 -1
- package/dist/stack/env-file.d.ts +7 -2
- package/dist/stack/env-file.js +8 -3
- package/dist/stack/host-files.d.ts +4 -4
- package/dist/stack/host-files.js +3 -3
- package/dist/stack/images.d.ts +1 -1
- package/dist/stack/images.js +1 -1
- package/dist/stack/index.d.ts +2 -2
- package/dist/stack/index.js +7 -3
- package/dist/stack/paths.d.ts +3 -3
- package/dist/stack/paths.js +1 -1
- package/dist/stack/ports.d.ts +2 -2
- package/dist/stack/ports.js +1 -1
- package/dist/stack/prepare.d.ts +5 -3
- package/dist/stack/prepare.js +3 -2
- package/dist/stack/stacks.d.ts +37 -34
- package/dist/stack/stacks.js +91 -57
- package/dist/stack/versions.d.ts +1 -1
- package/dist/stack/versions.js +1 -1
- package/dist/telemetry.d.ts +31 -0
- package/dist/telemetry.js +79 -0
- package/package.json +5 -5
package/dist/project/link.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The Project link (`.nylorun/link.json`) and credentials (`.nylorun/credentials.json`).
|
|
3
|
-
* `nylorun start` writes both, format
|
|
4
|
-
* the Tenant id as information (nothing selects a Tenant).
|
|
5
|
-
*
|
|
3
|
+
* `nylorun start` writes both, format 3: the local Tenant's name, its URL and Host id, and
|
|
4
|
+
* the Tenant id as information (nothing in a request selects a Tenant). `start` replaces a link
|
|
5
|
+
* of an older format.
|
|
6
6
|
*/
|
|
7
7
|
export interface ProjectLink {
|
|
8
|
-
format: 0 | 1 | 2;
|
|
9
|
-
/** The local
|
|
10
|
-
|
|
8
|
+
format: 0 | 1 | 2 | 3;
|
|
9
|
+
/** The local Tenant's name (format 3). */
|
|
10
|
+
tenant?: string;
|
|
11
11
|
hostUrl: string;
|
|
12
12
|
hostId: string;
|
|
13
13
|
tenantId?: string;
|
|
@@ -17,7 +17,7 @@ export declare function credentialsPath(projectRoot: string): string;
|
|
|
17
17
|
/** The Project's link, or undefined when it has none. An unreadable link is an error. */
|
|
18
18
|
export declare function readProjectLink(projectRoot: string): Promise<ProjectLink | undefined>;
|
|
19
19
|
export declare function writeProjectLink(projectRoot: string, link: {
|
|
20
|
-
|
|
20
|
+
tenant: string;
|
|
21
21
|
hostUrl: string;
|
|
22
22
|
hostId: string;
|
|
23
23
|
tenantId: string;
|
package/dist/project/link.js
CHANGED
|
@@ -33,7 +33,7 @@ export async function readProjectLink(projectRoot) {
|
|
|
33
33
|
const link = parsed.data;
|
|
34
34
|
return {
|
|
35
35
|
format: link.format,
|
|
36
|
-
...(link.
|
|
36
|
+
...(link.format === 3 && link.tenant ? { tenant: link.tenant } : {}),
|
|
37
37
|
hostUrl: link.hostUrl.replace(/\/$/, ""),
|
|
38
38
|
hostId: link.hostId,
|
|
39
39
|
...(link.tenantId ? { tenantId: link.tenantId } : {}),
|
|
@@ -60,8 +60,8 @@ async function ensureProjectDir(projectRoot) {
|
|
|
60
60
|
export async function writeProjectLink(projectRoot, link) {
|
|
61
61
|
await ensureProjectDir(projectRoot);
|
|
62
62
|
await writePrivate(linkPath(projectRoot), {
|
|
63
|
-
format:
|
|
64
|
-
|
|
63
|
+
format: 3,
|
|
64
|
+
tenant: link.tenant,
|
|
65
65
|
hostUrl: link.hostUrl.replace(/\/$/, ""),
|
|
66
66
|
hostId: link.hostId,
|
|
67
67
|
tenantId: link.tenantId,
|
package/dist/stack/commands.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { type FetchLike } from "./studio-login.js";
|
|
|
5
5
|
export declare const STACK_SERVICES: readonly ["postgres", "restate", "s2", "gateway", "runtime", "studio"];
|
|
6
6
|
export declare const stackUsage: string;
|
|
7
7
|
export interface StackDeps {
|
|
8
|
-
/** Environment snapshot (NYLORUN_HOME,
|
|
8
|
+
/** Environment snapshot (NYLORUN_HOME, NYLORUN_TENANT, image overrides, NYLORUN_COMPOSE_PROJECT). */
|
|
9
9
|
env: Readonly<Record<string, string | undefined>>;
|
|
10
10
|
docker: DockerRunner;
|
|
11
11
|
fetch: FetchLike;
|
|
@@ -26,7 +26,7 @@ export interface StackDeps {
|
|
|
26
26
|
pidAlive(pid: number): boolean;
|
|
27
27
|
/** Where the project is looked for (default: the process's working directory). */
|
|
28
28
|
cwd?: string;
|
|
29
|
-
/** `~/.nylorun`: the
|
|
29
|
+
/** `~/.nylorun`: the Tenants (tests use a temporary directory). */
|
|
30
30
|
nylorunRoot?: string;
|
|
31
31
|
/** Delay between health polls; tests shorten it. */
|
|
32
32
|
pollMs?: number;
|
|
@@ -35,7 +35,7 @@ export interface StackDeps {
|
|
|
35
35
|
/** How long a Studio login is retried before warning. */
|
|
36
36
|
loginTimeoutMs?: number;
|
|
37
37
|
}
|
|
38
|
-
/** The Compose project of
|
|
38
|
+
/** The Compose project of Tenant `name`: `nylorun-<name>`, or `NYLORUN_COMPOSE_PROJECT`. */
|
|
39
39
|
export declare function stackProject(env: StackDeps["env"], name: string): string;
|
|
40
40
|
interface Flags {
|
|
41
41
|
rest: string[];
|
|
@@ -55,7 +55,7 @@ export type StackTenant = Pick<HostTenant, "id" | "name" | "state" | "cause">;
|
|
|
55
55
|
/** Printed by `start` when it does not open Studio itself. */
|
|
56
56
|
export declare const STUDIO_SIGN_IN_HINT = "To sign a browser in to Studio, run \"npx nylorun studio\".";
|
|
57
57
|
export interface StackStatus {
|
|
58
|
-
/** The
|
|
58
|
+
/** The Tenant's name. */
|
|
59
59
|
name: string;
|
|
60
60
|
/** The Compose project. */
|
|
61
61
|
project: string;
|
|
@@ -64,13 +64,13 @@ export interface StackStatus {
|
|
|
64
64
|
state: "running" | "stopped" | "absent";
|
|
65
65
|
runtime: {
|
|
66
66
|
url?: string;
|
|
67
|
-
/** The Admin API (operator listener), when the
|
|
67
|
+
/** The Admin API (operator listener), when the Tenant publishes one. */
|
|
68
68
|
adminUrl?: string;
|
|
69
69
|
healthy: boolean;
|
|
70
70
|
version?: string;
|
|
71
71
|
hostId?: string;
|
|
72
72
|
};
|
|
73
|
-
/** The
|
|
73
|
+
/** The Tenant as the Runtime reports it, while it answers. */
|
|
74
74
|
tenant?: StackTenant;
|
|
75
75
|
studio: {
|
|
76
76
|
url?: string;
|
|
@@ -92,9 +92,9 @@ export interface StackStatus {
|
|
|
92
92
|
export declare function readStackStatus(deps: StackDeps, options?: {
|
|
93
93
|
name?: string;
|
|
94
94
|
}): Promise<StackStatus>;
|
|
95
|
-
/** The running
|
|
95
|
+
/** The running Tenant as clients reach it. */
|
|
96
96
|
export interface StackEndpoints {
|
|
97
|
-
/** The
|
|
97
|
+
/** The Tenant's name. */
|
|
98
98
|
name: string;
|
|
99
99
|
/** The Host root. */
|
|
100
100
|
home: string;
|
|
@@ -111,7 +111,7 @@ export interface StackEndpoints {
|
|
|
111
111
|
started: boolean;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
* Start the selected
|
|
114
|
+
* Start the selected Tenant unless it is already running (`nylorun studio`): the
|
|
115
115
|
* `start` code path without its output, its Tenant wait or the Project link. Compose
|
|
116
116
|
* progress still streams, since the first run pulls images.
|
|
117
117
|
*/
|
|
@@ -121,18 +121,18 @@ export declare function ensureStack(deps: StackDeps, options: {
|
|
|
121
121
|
}): Promise<StackEndpoints>;
|
|
122
122
|
/** Add Studio's `next` path (e.g. `/tenants/<id>`) to a login URL. */
|
|
123
123
|
export declare function withNext(loginUrl: string, next: string | undefined): string;
|
|
124
|
-
/** The Studio page
|
|
124
|
+
/** The Tenant's Studio page, as a login `next` path. */
|
|
125
125
|
export declare function tenantStudioPath(tenantId: string): string;
|
|
126
126
|
/**
|
|
127
|
-
* Mint a fresh Studio login URL on a running
|
|
127
|
+
* Mint a fresh Studio login URL on a running Tenant, landing on `next`.
|
|
128
128
|
* Undefined (after a warning) when Studio does not answer.
|
|
129
129
|
*/
|
|
130
|
-
export declare function studioLoginUrl(deps: StackDeps,
|
|
131
|
-
/** `nylorun studio`, landing on `next` when given, else on the
|
|
130
|
+
export declare function studioLoginUrl(deps: StackDeps, running: Pick<StackEndpoints, "studioPort" | "adminKey">, next?: string): Promise<string | undefined>;
|
|
131
|
+
/** `nylorun studio`, landing on `next` when given, else on the Tenant's page. */
|
|
132
132
|
export declare function runStudioCommand(args: readonly string[], deps: StackDeps, options?: {
|
|
133
133
|
next?: string;
|
|
134
134
|
}): Promise<number>;
|
|
135
135
|
export declare function isStackCommand(name: string | undefined): boolean;
|
|
136
|
-
/** Run one
|
|
136
|
+
/** Run one Tenant command (`up`/`start`, `down`/`stop`, `status`, `logs`, `reset`, `studio`, `ls`, `delete`). */
|
|
137
137
|
export declare function runStackCommand(name: string, args: readonly string[], deps: StackDeps): Promise<number>;
|
|
138
138
|
export {};
|