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.
@@ -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 2: the stack the Project uses, its URL and Host id, and
4
- * the Tenant id as information (nothing selects a Tenant). Formats 0 and 1 named a Tenant on a
5
- * multi-Tenant Host of an older Runtime.
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 stack (format 2). */
10
- stack?: string;
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
- stack: string;
20
+ tenant: string;
21
21
  hostUrl: string;
22
22
  hostId: string;
23
23
  tenantId: string;
@@ -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.stack ? { stack: link.stack } : {}),
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: 2,
64
- stack: link.stack,
63
+ format: 3,
64
+ tenant: link.tenant,
65
65
  hostUrl: link.hostUrl.replace(/\/$/, ""),
66
66
  hostId: link.hostId,
67
67
  tenantId: link.tenantId,
@@ -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, NYLORUN_STACK, image overrides, NYLORUN_STACK_PROJECT). */
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 stacks and the legacy stack (tests use a temporary directory). */
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 stack `name`: `nylorun-<name>`, or `NYLORUN_STACK_PROJECT`. */
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 stack's name. */
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 stack publishes one. */
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 stack's one Tenant, while the Runtime answers. */
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 stack as clients reach it. */
95
+ /** The running Tenant as clients reach it. */
96
96
  export interface StackEndpoints {
97
- /** The stack's name. */
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 stack unless it is already running (`nylorun studio`): the
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 of the stack's Tenant, as a login `next` path. */
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 stack, landing on `next`.
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, stack: Pick<StackEndpoints, "studioPort" | "adminKey">, next?: string): Promise<string | undefined>;
131
- /** `nylorun studio`, landing on `next` when given, else on the stack's Tenant. */
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 stack command (`up`/`start`, `down`/`stop`, `status`, `logs`, `reset`, `studio`, `ls`, `delete`, `legacy`). */
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 {};