ankka-console 0.10.0 → 0.11.0
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/client/control-plane.d.ts +25 -1
- package/dist/client/control-plane.js +60 -1
- package/dist/client/schemas.d.ts +525 -0
- package/dist/client/schemas.js +174 -0
- package/dist/context.d.ts +98 -0
- package/dist/context.js +73 -0
- package/dist/extensions/render.d.ts +2 -0
- package/dist/extensions/render.js +5 -0
- package/dist/extensions/types.d.ts +1 -1
- package/dist/extensions/types.js +7 -0
- package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.js +7 -1
- package/dist/routes/auth.sign-out.js +8 -3
- package/dist/routes/front.js +12 -6
- package/dist/routes/logs.d.ts +35 -0
- package/dist/routes/logs.js +15 -14
- package/dist/routes/members.js +11 -8
- package/dist/routes/organization-new.js +7 -4
- package/dist/routes/organization.js +13 -6
- package/dist/routes/project-new.js +8 -4
- package/dist/routes/project.d.ts +73 -2
- package/dist/routes/project.js +81 -9
- package/dist/routes/service-apply.d.ts +5 -2
- package/dist/routes/service-apply.js +17 -14
- package/dist/routes/service-history.d.ts +30 -0
- package/dist/routes/service-history.js +79 -0
- package/dist/routes/service-topology.d.ts +153 -0
- package/dist/routes/service-topology.js +54 -0
- package/dist/routes/service.d.ts +34 -10
- package/dist/routes/service.js +27 -22
- package/dist/routes/stream.service.js +18 -1
- package/dist/routes/tokens.js +8 -6
- package/dist/routes.js +2 -0
- package/dist/styles.css +2 -481
- package/dist/testing/fake-control-plane.d.ts +155 -0
- package/dist/testing/fake-control-plane.js +379 -12
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/scenarios.js +6 -0
- package/dist/theme.css +66 -0
- package/dist/ui/console.d.ts +19 -6
- package/dist/ui/console.js +9 -2
- package/dist/ui/errors.js +7 -5
- package/dist/ui/hosting.d.ts +11 -0
- package/dist/ui/hosting.js +20 -0
- package/dist/ui/primitives/button.d.ts +11 -0
- package/dist/ui/primitives/button.js +21 -0
- package/dist/ui/primitives/select.d.ts +10 -0
- package/dist/ui/primitives/select.js +4 -0
- package/dist/ui/primitives/switch.d.ts +9 -0
- package/dist/ui/primitives/switch.js +4 -0
- package/dist/ui/shape.d.ts +4 -0
- package/dist/ui/shape.js +36 -0
- package/dist/ui/shell.d.ts +76 -0
- package/dist/ui/shell.js +107 -0
- package/dist/ui/tokens.d.ts +82 -0
- package/dist/ui/tokens.js +172 -0
- package/dist/ui/topology/Graph.d.ts +13 -0
- package/dist/ui/topology/Graph.js +56 -0
- package/dist/ui/topology/Table.d.ts +10 -0
- package/dist/ui/topology/Table.js +14 -0
- package/dist/ui/topology/layout.d.ts +113 -0
- package/dist/ui/topology/layout.js +177 -0
- package/dist/ui/use-stream.d.ts +137 -1
- package/dist/ui/use-stream.js +11 -1
- package/package.json +11 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AuthDiscovery, type CreateDeployToken, type CreateOrganization, type DeployTokenCreated, type DeployTokenSummary, type HistoryEntry, type LogsResponse, type MembersResponse, type OrganizationSummary, type ProjectDetail, type ProjectSummary, type Quota, type Role, type ServiceStatus, type SetRegistry, type Whoami } from "./schemas.ts";
|
|
1
|
+
import { type AuthDiscovery, type BrokerDeclarationRequest, type CreateDeployToken, type CreateOrganization, type DeployTokenCreated, type DeployTokenSummary, type HistoryEntry, type LogsResponse, type MembersResponse, type OrganizationSummary, type ProjectBroker, type ProjectDetail, type ProjectSecretSummary, type ProjectSummary, type ProjectTopic, type Quota, type Role, type RolledBack, type ServiceStatus, type ServiceTopology, type SetRegistry, type TopicDeclarationRequest, type Whoami } from "./schemas.ts";
|
|
2
2
|
/** `fetch`'s shape; the server supplies one that presents the console's certificate. */
|
|
3
3
|
export type Transport = (url: string, init: RequestInit) => Promise<Response>;
|
|
4
4
|
/**
|
|
@@ -11,6 +11,8 @@ export type BearerSource = (options: {
|
|
|
11
11
|
export interface LogsQuery {
|
|
12
12
|
instance?: string;
|
|
13
13
|
previous?: boolean;
|
|
14
|
+
/** The platform's container (the sidecar, or a web-hosted service's proxy) instead of the developer's. */
|
|
15
|
+
platform?: boolean;
|
|
14
16
|
tail?: number;
|
|
15
17
|
since?: number;
|
|
16
18
|
}
|
|
@@ -56,12 +58,34 @@ export declare class ControlPlaneClient {
|
|
|
56
58
|
deleteProject(id: string): Promise<void>;
|
|
57
59
|
setRegistry(id: string, body: SetRegistry): Promise<void>;
|
|
58
60
|
clearRegistry(id: string): Promise<void>;
|
|
61
|
+
/** Entries of a project secret, merged into what it holds. The values are never read back. */
|
|
62
|
+
setProjectSecret(id: string, name: string, entries: Record<string, string>): Promise<void>;
|
|
63
|
+
unsetProjectSecretEntry(id: string, name: string, entry: string): Promise<void>;
|
|
64
|
+
listProjectSecrets(id: string): Promise<ProjectSecretSummary[]>;
|
|
65
|
+
/** Declares a topic on the project, or raises its partitions; its compaction and contract with it. */
|
|
66
|
+
declareTopic(id: string, name: string, request: TopicDeclarationRequest): Promise<void>;
|
|
67
|
+
/** The schema document a topic's contract was declared with. */
|
|
68
|
+
topicSchema(id: string, name: string): Promise<unknown>;
|
|
69
|
+
/** Stops declaring a topic; it stays on the broker. */
|
|
70
|
+
removeTopic(id: string, name: string): Promise<void>;
|
|
71
|
+
listTopics(id: string): Promise<ProjectTopic[]>;
|
|
72
|
+
/** Declares a broker beside the installation's, or changes where it is; the project secret holds its credential. */
|
|
73
|
+
declareBroker(id: string, name: string, request: BrokerDeclarationRequest): Promise<void>;
|
|
74
|
+
/** Stops declaring a broker; a service naming it is refused at its next start. */
|
|
75
|
+
removeBroker(id: string, name: string): Promise<void>;
|
|
76
|
+
listBrokers(id: string): Promise<ProjectBroker[]>;
|
|
59
77
|
listServices(projectId: string): Promise<ServiceStatus[]>;
|
|
60
78
|
getService(projectId: string, name: string): Promise<ServiceStatus>;
|
|
61
79
|
/** The descriptor is sent as the text the person gave; the control plane is the one that validates it. */
|
|
62
80
|
applyService(projectId: string, name: string, descriptor: string): Promise<ServiceStatus>;
|
|
63
81
|
serviceOperation(projectId: string, name: string, operation: "pause" | "resume" | "restart" | "expose" | "unexpose"): Promise<void>;
|
|
64
82
|
deleteService(projectId: string, name: string): Promise<void>;
|
|
83
|
+
/** Roll a service back to a generation: its descriptor applied again, as a new generation. */
|
|
84
|
+
rollback(projectId: string, name: string, generation: number): Promise<RolledBack>;
|
|
85
|
+
/** The descriptor applied at a generation, as the control plane accepts one. */
|
|
86
|
+
descriptor(projectId: string, name: string, generation: number): Promise<unknown>;
|
|
65
87
|
history(projectId: string, name: string): Promise<HistoryEntry[]>;
|
|
66
88
|
logs(projectId: string, name: string, query?: LogsQuery): Promise<LogsResponse>;
|
|
89
|
+
/** Every instance's topology, merged by the control plane; 404 when no instance runs. */
|
|
90
|
+
topology(projectId: string, name: string): Promise<ServiceTopology>;
|
|
67
91
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ControlPlaneError, ControlPlaneUnreachable, SignInRequired } from "./errors.js";
|
|
2
|
-
import { authDiscoverySchema, deployTokenCreatedSchema, deployTokenSummarySchema, historyEntrySchema, logsResponseSchema, membersResponseSchema, organizationSummarySchema, projectDetailSchema, projectSummarySchema, serviceStatusSchema, whoamiSchema, } from "./schemas.js";
|
|
2
|
+
import { authDiscoverySchema, deployTokenCreatedSchema, deployTokenSummarySchema, historyEntrySchema, logsResponseSchema, membersResponseSchema, organizationSummarySchema, projectBrokerSchema, projectDetailSchema, projectSecretSummarySchema, projectSummarySchema, projectTopicSchema, rolledBackSchema, serviceStatusSchema, serviceTopologySchema, whoamiSchema, } from "./schemas.js";
|
|
3
|
+
/** A descriptor is passed through as the control plane wrote it, as `applyService` takes one. */
|
|
4
|
+
const anyJson = { parse: (value) => value };
|
|
3
5
|
const arrayOf = (schema) => ({
|
|
4
6
|
parse: (value) => {
|
|
5
7
|
if (!Array.isArray(value))
|
|
@@ -119,6 +121,42 @@ export class ControlPlaneClient {
|
|
|
119
121
|
clearRegistry(id) {
|
|
120
122
|
return this.#call("DELETE", `/projects/${segment(id)}/registry`);
|
|
121
123
|
}
|
|
124
|
+
/** Entries of a project secret, merged into what it holds. The values are never read back. */
|
|
125
|
+
setProjectSecret(id, name, entries) {
|
|
126
|
+
return this.#call("PUT", `/projects/${segment(id)}/secrets/${segment(name)}`, { body: { entries } });
|
|
127
|
+
}
|
|
128
|
+
unsetProjectSecretEntry(id, name, entry) {
|
|
129
|
+
return this.#call("DELETE", `/projects/${segment(id)}/secrets/${segment(name)}?entry=${segment(entry)}`);
|
|
130
|
+
}
|
|
131
|
+
listProjectSecrets(id) {
|
|
132
|
+
return this.#call("GET", `/projects/${segment(id)}/secrets`, { schema: arrayOf(projectSecretSummarySchema) });
|
|
133
|
+
}
|
|
134
|
+
/** Declares a topic on the project, or raises its partitions; its compaction and contract with it. */
|
|
135
|
+
declareTopic(id, name, request) {
|
|
136
|
+
return this.#call("PUT", `/projects/${segment(id)}/topics/${segment(name)}`, { body: request });
|
|
137
|
+
}
|
|
138
|
+
/** The schema document a topic's contract was declared with. */
|
|
139
|
+
topicSchema(id, name) {
|
|
140
|
+
return this.#call("GET", `/projects/${segment(id)}/topics/${segment(name)}/schema`, { schema: { parse: (v) => v } });
|
|
141
|
+
}
|
|
142
|
+
/** Stops declaring a topic; it stays on the broker. */
|
|
143
|
+
removeTopic(id, name) {
|
|
144
|
+
return this.#call("DELETE", `/projects/${segment(id)}/topics/${segment(name)}`);
|
|
145
|
+
}
|
|
146
|
+
listTopics(id) {
|
|
147
|
+
return this.#call("GET", `/projects/${segment(id)}/topics`, { schema: arrayOf(projectTopicSchema) });
|
|
148
|
+
}
|
|
149
|
+
/** Declares a broker beside the installation's, or changes where it is; the project secret holds its credential. */
|
|
150
|
+
declareBroker(id, name, request) {
|
|
151
|
+
return this.#call("PUT", `/projects/${segment(id)}/brokers/${segment(name)}`, { body: request });
|
|
152
|
+
}
|
|
153
|
+
/** Stops declaring a broker; a service naming it is refused at its next start. */
|
|
154
|
+
removeBroker(id, name) {
|
|
155
|
+
return this.#call("DELETE", `/projects/${segment(id)}/brokers/${segment(name)}`);
|
|
156
|
+
}
|
|
157
|
+
listBrokers(id) {
|
|
158
|
+
return this.#call("GET", `/projects/${segment(id)}/brokers`, { schema: arrayOf(projectBrokerSchema) });
|
|
159
|
+
}
|
|
122
160
|
// ── Services ──────────────────────────────────────────────────────────────
|
|
123
161
|
listServices(projectId) {
|
|
124
162
|
return this.#call("GET", `/services/${segment(projectId)}`, { schema: arrayOf(serviceStatusSchema) });
|
|
@@ -139,6 +177,19 @@ export class ControlPlaneClient {
|
|
|
139
177
|
deleteService(projectId, name) {
|
|
140
178
|
return this.#call("DELETE", `/services/${segment(projectId)}/${segment(name)}`);
|
|
141
179
|
}
|
|
180
|
+
/** Roll a service back to a generation: its descriptor applied again, as a new generation. */
|
|
181
|
+
rollback(projectId, name, generation) {
|
|
182
|
+
return this.#call("POST", `/services/${segment(projectId)}/${segment(name)}/rollback`, {
|
|
183
|
+
body: { generation },
|
|
184
|
+
schema: rolledBackSchema,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/** The descriptor applied at a generation, as the control plane accepts one. */
|
|
188
|
+
descriptor(projectId, name, generation) {
|
|
189
|
+
return this.#call("GET", `/services/${segment(projectId)}/${segment(name)}/descriptor?generation=${generation}`, {
|
|
190
|
+
schema: anyJson,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
142
193
|
history(projectId, name) {
|
|
143
194
|
return this.#call("GET", `/services/${segment(projectId)}/${segment(name)}/history`, {
|
|
144
195
|
schema: arrayOf(historyEntrySchema),
|
|
@@ -150,6 +201,8 @@ export class ControlPlaneClient {
|
|
|
150
201
|
params.set("instance", query.instance);
|
|
151
202
|
if (query.previous)
|
|
152
203
|
params.set("previous", "true");
|
|
204
|
+
if (query.platform)
|
|
205
|
+
params.set("platform", "true");
|
|
153
206
|
if (query.tail !== undefined)
|
|
154
207
|
params.set("tail", String(query.tail));
|
|
155
208
|
if (query.since !== undefined)
|
|
@@ -159,6 +212,12 @@ export class ControlPlaneClient {
|
|
|
159
212
|
schema: logsResponseSchema,
|
|
160
213
|
});
|
|
161
214
|
}
|
|
215
|
+
/** Every instance's topology, merged by the control plane; 404 when no instance runs. */
|
|
216
|
+
topology(projectId, name) {
|
|
217
|
+
return this.#call("GET", `/services/${segment(projectId)}/${segment(name)}/topology`, {
|
|
218
|
+
schema: serviceTopologySchema,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
162
221
|
// ── Transport ─────────────────────────────────────────────────────────────
|
|
163
222
|
async #call(method, path, options = {}) {
|
|
164
223
|
const url = this.#baseUrl + path;
|