@feltdb/feltkit 0.3.5 → 0.3.6
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/cli/deploy.d.ts +1 -1
- package/dist/cli/deploy.js +19 -11
- package/dist/cli/deploy.js.map +1 -1
- package/dist/cli/main.d.ts +6 -1
- package/dist/cli/main.js +130 -45
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/vercel.d.ts +20 -4
- package/dist/cli/vercel.js +38 -22
- package/dist/cli/vercel.js.map +1 -1
- package/dist/dashboard/assets/index-DLFqtVAO.js +15 -0
- package/dist/dashboard/index.html +1 -1
- package/dist/runtime/deployment.d.ts +48 -0
- package/dist/runtime/deployment.js +141 -0
- package/dist/runtime/deployment.js.map +1 -0
- package/dist/runtime/projects.d.ts +16 -0
- package/dist/runtime/projects.js +8 -1
- package/dist/runtime/projects.js.map +1 -1
- package/dist/server/admin.js +10 -0
- package/dist/server/admin.js.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/production.d.ts +61 -0
- package/dist/server/production.js +113 -0
- package/dist/server/production.js.map +1 -0
- package/dist/server/project.d.ts +1 -1
- package/dist/server/project.js +2 -1
- package/dist/server/project.js.map +1 -1
- package/package.json +2 -2
- package/skills/.claude-plugin/marketplace.json +1 -1
- package/skills/.claude-plugin/plugin.json +1 -1
- package/skills/feltkit-operations/SKILL.md +6 -0
- package/dist/dashboard/assets/index-DnJaSnzt.js +0 -15
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<link rel="apple-touch-icon" href="/_feltkit/apple-touch-icon.png" />
|
|
10
10
|
<title>FeltKit</title>
|
|
11
11
|
<script src="/_feltkit/theme.js"></script>
|
|
12
|
-
<script type="module" crossorigin src="/_feltkit/assets/index-
|
|
12
|
+
<script type="module" crossorigin src="/_feltkit/assets/index-DLFqtVAO.js"></script>
|
|
13
13
|
<link rel="stylesheet" crossorigin href="/_feltkit/assets/index-B-ra0AY9.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type DeployTarget, type TargetContract, type VercelData } from "./targets.js";
|
|
2
|
+
/** Written by `feltkit deploy` into the artifact: how it is meant to run. */
|
|
3
|
+
export declare const DEPLOY_TARGET_FILE: string;
|
|
4
|
+
/** Where `feltkit deploy` writes the artifact, inside the project. */
|
|
5
|
+
export declare const DEPLOY_DIR: string;
|
|
6
|
+
/** The project's record of its last deployment. */
|
|
7
|
+
export declare const DEPLOYMENT_FILE: string;
|
|
8
|
+
/** KEY=value lines, as dotenv writes them (comments and blank lines ignored, quotes removed). */
|
|
9
|
+
export declare function readEnvFile(file: string): Record<string, string>;
|
|
10
|
+
export interface DeploymentArtifact {
|
|
11
|
+
dir: string;
|
|
12
|
+
target: DeployTarget;
|
|
13
|
+
data?: VercelData;
|
|
14
|
+
contract: TargetContract;
|
|
15
|
+
}
|
|
16
|
+
/** The project's artifact: the project itself when it is one (a deployed copy), else its .feltkit/deploy. */
|
|
17
|
+
export declare function deploymentArtifact(projectDir: string): DeploymentArtifact | null;
|
|
18
|
+
export interface DeploymentRecord {
|
|
19
|
+
target: DeployTarget;
|
|
20
|
+
data?: VercelData;
|
|
21
|
+
/** The URL the platform printed for the deployment. */
|
|
22
|
+
url: string;
|
|
23
|
+
/** The platform's environment (Vercel: production or preview). */
|
|
24
|
+
environment: string;
|
|
25
|
+
deployedAt: string;
|
|
26
|
+
/** Whether production Studio (/_feltkit/) is served. */
|
|
27
|
+
studio: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function readDeployment(projectDir: string): DeploymentRecord | null;
|
|
30
|
+
export declare function writeDeployment(projectDir: string, record: DeploymentRecord): void;
|
|
31
|
+
/**
|
|
32
|
+
* The environment production commands run with on this machine.
|
|
33
|
+
*
|
|
34
|
+
* No artifact, or a target whose state is local (one container, on its volume): the process
|
|
35
|
+
* environment, unchanged. A target whose data is in FeltDB: its FeltDB settings, from the process
|
|
36
|
+
* environment first, else the artifact's .env and .env.local, else the project's .env.local; and its
|
|
37
|
+
* storage rule (FELTKIT_STORAGE), so state can never land anywhere else. Missing settings are refused
|
|
38
|
+
* here, naming where to put them.
|
|
39
|
+
*/
|
|
40
|
+
export declare function productionEnv(projectDir: string, env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
41
|
+
/** How production is set up, for display. Never includes a secret. */
|
|
42
|
+
export declare function describeProduction(projectDir: string, env?: NodeJS.ProcessEnv): {
|
|
43
|
+
target: DeployTarget | null;
|
|
44
|
+
title: string | null;
|
|
45
|
+
storage: "local" | "remote" | "unconfigured";
|
|
46
|
+
location: string;
|
|
47
|
+
deployment: DeploymentRecord | null;
|
|
48
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production, as the developer's machine knows it:
|
|
3
|
+
*
|
|
4
|
+
* .feltkit/deploy/ the artifact `feltkit deploy` wrote (its .feltkit/target.json says how it runs)
|
|
5
|
+
* .feltkit/deployment.json where it was last deployed (target, URL, time), written by `feltkit vercel deploy`
|
|
6
|
+
* .env.local the settings it runs with, as `feltdb init-managed` and `feltkit vercel env` wrote them
|
|
7
|
+
*
|
|
8
|
+
* Commands that act on production from this machine (session, operator grant, manage, inspect, Studio's
|
|
9
|
+
* Settings) read production's settings from here, so they reach the FeltDB the deployment uses. When the
|
|
10
|
+
* deployment keeps its data in FeltDB and its settings cannot be found, they refuse: falling back to the
|
|
11
|
+
* local .feltkit/production folder would act on state the deployment never reads.
|
|
12
|
+
*/
|
|
13
|
+
import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
14
|
+
import { join, resolve } from "node:path";
|
|
15
|
+
import { FeltKitError } from "../errors.js";
|
|
16
|
+
import { isDeployTarget, isVercelData, targetContract } from "./targets.js";
|
|
17
|
+
/** Written by `feltkit deploy` into the artifact: how it is meant to run. */
|
|
18
|
+
export const DEPLOY_TARGET_FILE = join(".feltkit", "target.json");
|
|
19
|
+
/** Where `feltkit deploy` writes the artifact, inside the project. */
|
|
20
|
+
export const DEPLOY_DIR = join(".feltkit", "deploy");
|
|
21
|
+
/** The project's record of its last deployment. */
|
|
22
|
+
export const DEPLOYMENT_FILE = join(".feltkit", "deployment.json");
|
|
23
|
+
/** KEY=value lines, as dotenv writes them (comments and blank lines ignored, quotes removed). */
|
|
24
|
+
export function readEnvFile(file) {
|
|
25
|
+
const values = {};
|
|
26
|
+
if (!existsSync(file))
|
|
27
|
+
return values;
|
|
28
|
+
for (const raw of readFileSync(file, "utf8").split(/\r?\n/)) {
|
|
29
|
+
const line = raw.trim();
|
|
30
|
+
if (!line || line.startsWith("#"))
|
|
31
|
+
continue;
|
|
32
|
+
const at = line.indexOf("=");
|
|
33
|
+
if (at < 1)
|
|
34
|
+
continue;
|
|
35
|
+
const name = line.slice(0, at).trim().replace(/^export\s+/, "");
|
|
36
|
+
values[name] = line.slice(at + 1).trim().replace(/^(['"])(.*)\1$/, "$2");
|
|
37
|
+
}
|
|
38
|
+
return values;
|
|
39
|
+
}
|
|
40
|
+
/** The project's artifact: the project itself when it is one (a deployed copy), else its .feltkit/deploy. */
|
|
41
|
+
export function deploymentArtifact(projectDir) {
|
|
42
|
+
for (const dir of [resolve(projectDir), join(resolve(projectDir), DEPLOY_DIR)]) {
|
|
43
|
+
const file = join(dir, DEPLOY_TARGET_FILE);
|
|
44
|
+
if (!existsSync(file))
|
|
45
|
+
continue;
|
|
46
|
+
let record;
|
|
47
|
+
try {
|
|
48
|
+
record = JSON.parse(readFileSync(file, "utf8"));
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
throw new FeltKitError("CONFIGURATION", `${file} is not readable JSON; it says which deployment target this artifact is for.`, { hint: "Deploy again (npx feltkit deploy --target …)." });
|
|
52
|
+
}
|
|
53
|
+
if (!isDeployTarget(record.target))
|
|
54
|
+
throw new FeltKitError("CONFIGURATION", `${file} names an unknown deployment target ${JSON.stringify(record.target)}.`, { hint: "Deploy again with this FeltKit (npx feltkit deploy --target …)." });
|
|
55
|
+
const data = isVercelData(record.data) ? record.data : undefined;
|
|
56
|
+
return { dir, target: record.target, ...(data ? { data } : {}), contract: targetContract(record.target, data) };
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
export function readDeployment(projectDir) {
|
|
61
|
+
const file = join(resolve(projectDir), DEPLOYMENT_FILE);
|
|
62
|
+
if (!existsSync(file))
|
|
63
|
+
return null;
|
|
64
|
+
try {
|
|
65
|
+
const record = JSON.parse(readFileSync(file, "utf8"));
|
|
66
|
+
return typeof record.url === "string" && isDeployTarget(record.target) ? record : null;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export function writeDeployment(projectDir, record) {
|
|
73
|
+
const file = join(resolve(projectDir), DEPLOYMENT_FILE);
|
|
74
|
+
const temp = `${file}.${process.pid}.tmp`;
|
|
75
|
+
writeFileSync(temp, `${JSON.stringify(record, null, 2)}\n`);
|
|
76
|
+
renameSync(temp, file);
|
|
77
|
+
}
|
|
78
|
+
/** Settings beyond the target's variables that production commands on this machine need. */
|
|
79
|
+
const PRODUCTION_SETTINGS = ["FELTKIT_OPERATOR_KEY", "FELTKIT_DASHBOARD"];
|
|
80
|
+
/**
|
|
81
|
+
* The environment production commands run with on this machine.
|
|
82
|
+
*
|
|
83
|
+
* No artifact, or a target whose state is local (one container, on its volume): the process
|
|
84
|
+
* environment, unchanged. A target whose data is in FeltDB: its FeltDB settings, from the process
|
|
85
|
+
* environment first, else the artifact's .env and .env.local, else the project's .env.local; and its
|
|
86
|
+
* storage rule (FELTKIT_STORAGE), so state can never land anywhere else. Missing settings are refused
|
|
87
|
+
* here, naming where to put them.
|
|
88
|
+
*/
|
|
89
|
+
export function productionEnv(projectDir, env = process.env) {
|
|
90
|
+
const artifact = deploymentArtifact(projectDir);
|
|
91
|
+
if (!artifact || env.FELTKIT_STORAGE)
|
|
92
|
+
return env;
|
|
93
|
+
if (artifact.contract.storage === "local")
|
|
94
|
+
return env;
|
|
95
|
+
const names = [...artifact.contract.variables.map((v) => v.name).filter((name) => name !== "PORT"), ...PRODUCTION_SETTINGS];
|
|
96
|
+
const files = {};
|
|
97
|
+
for (const file of [join(artifact.dir, ".env"), join(artifact.dir, ".env.local"), join(resolve(projectDir), ".env.local")])
|
|
98
|
+
Object.assign(files, readEnvFile(file));
|
|
99
|
+
const merged = { ...env, FELTKIT_STORAGE: artifact.contract.storage };
|
|
100
|
+
for (const name of names)
|
|
101
|
+
if (!merged[name] && files[name])
|
|
102
|
+
merged[name] = files[name];
|
|
103
|
+
const required = artifact.contract.variables.filter((v) => v.required === true && v.name !== "PORT" && v.name.startsWith("FELTDB_")).map((v) => v.name);
|
|
104
|
+
const missing = required.filter((name) => !merged[name]);
|
|
105
|
+
if (missing.length) {
|
|
106
|
+
throw new FeltKitError("CONFIGURATION", `Production runs on ${artifact.contract.title}, but ${missing.join(", ")} ${missing.length > 1 ? "are" : "is"} not set here, so this machine cannot reach its FeltDB. Nothing was done.`, {
|
|
107
|
+
hint: "Put the deployment's FeltDB settings in .env.local (`feltdb init-managed` writes them there), or export them. The local .feltkit/production folder is never used for this deployment.",
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return merged;
|
|
111
|
+
}
|
|
112
|
+
/** How production is set up, for display. Never includes a secret. */
|
|
113
|
+
export function describeProduction(projectDir, env = process.env) {
|
|
114
|
+
const artifact = deploymentArtifact(projectDir);
|
|
115
|
+
const deployment = readDeployment(projectDir);
|
|
116
|
+
const base = { target: artifact?.target ?? null, title: artifact?.contract.title ?? null, deployment };
|
|
117
|
+
if (!artifact) {
|
|
118
|
+
// No deployment artifact: production is whatever this machine's settings say, as `feltkit start` reads them.
|
|
119
|
+
if (env.FELTDB_URL)
|
|
120
|
+
return { ...base, storage: "remote", location: safeOrigin(env.FELTDB_URL) };
|
|
121
|
+
return { ...base, storage: "local", location: env.FELTKIT_STATE_DIR ? resolve(projectDir, env.FELTKIT_STATE_DIR) : join(resolve(projectDir), ".feltkit", "production", "state") };
|
|
122
|
+
}
|
|
123
|
+
if (artifact.contract.storage === "local")
|
|
124
|
+
return { ...base, storage: "local", location: "the deployment's own volume (not this machine)" };
|
|
125
|
+
try {
|
|
126
|
+
return { ...base, storage: "remote", location: safeOrigin(productionEnv(projectDir, env).FELTDB_URL) };
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
return { ...base, storage: "unconfigured", location: error.message };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/** A URL's origin for display; never its path, query or credentials. */
|
|
133
|
+
function safeOrigin(url) {
|
|
134
|
+
try {
|
|
135
|
+
return new URL(url).origin;
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
return "(FELTDB_URL is not a valid URL)";
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=deployment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../src/runtime/deployment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAA2D,MAAM,cAAc,CAAC;AAErI,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAClE,sEAAsE;AACtE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AACrD,mDAAmD;AACnD,MAAM,CAAC,MAAM,eAAe,GAAG,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AC,UAAU,EAAE,GAAG,CAAC,CAAC,UAAW,CAAC,EAAE,CAAC;IAC1G,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC;IAClF,CAAC;AACH,CAAC;AAED,wEAAwE;AACxE,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,iCAAiC,CAAC;IAC3C,CAAC;AACH,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DeploymentRecord } from "./deployment.js";
|
|
1
2
|
import type { InstanceIdentity } from "./instance.js";
|
|
2
3
|
import type { FeltKitRuntime } from "./runtime.js";
|
|
3
4
|
export interface RuntimeRecord {
|
|
@@ -27,6 +28,7 @@ export declare function listProjects(): Array<ProjectEntry & {
|
|
|
27
28
|
running: boolean;
|
|
28
29
|
url?: string;
|
|
29
30
|
exists: boolean;
|
|
31
|
+
deployment: DeploymentRecord | null;
|
|
30
32
|
}>;
|
|
31
33
|
export declare function registerProject(entry: ProjectEntry): void;
|
|
32
34
|
/** How each environment is configured from here. Credentials are never included. */
|
|
@@ -40,6 +42,8 @@ export declare function describeEnvironments(projectDir: string, runtime: FeltKi
|
|
|
40
42
|
durable: boolean;
|
|
41
43
|
instanceId: string;
|
|
42
44
|
development: boolean;
|
|
45
|
+
target?: undefined;
|
|
46
|
+
deployment?: undefined;
|
|
43
47
|
} | {
|
|
44
48
|
name: string;
|
|
45
49
|
active: boolean;
|
|
@@ -48,5 +52,17 @@ export declare function describeEnvironments(projectDir: string, runtime: FeltKi
|
|
|
48
52
|
durable: boolean;
|
|
49
53
|
instanceId: null;
|
|
50
54
|
development: boolean;
|
|
55
|
+
target?: undefined;
|
|
56
|
+
deployment?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
name: string;
|
|
59
|
+
active: boolean;
|
|
60
|
+
storage: "unconfigured" | "local" | "remote";
|
|
61
|
+
location: string;
|
|
62
|
+
durable: boolean;
|
|
63
|
+
instanceId: null;
|
|
64
|
+
development: boolean;
|
|
65
|
+
target: string | null;
|
|
66
|
+
deployment: DeploymentRecord | null;
|
|
51
67
|
})[];
|
|
52
68
|
};
|
package/dist/runtime/projects.js
CHANGED
|
@@ -15,6 +15,7 @@ import { randomBytes } from "node:crypto";
|
|
|
15
15
|
import { homedir } from "node:os";
|
|
16
16
|
import { join, resolve } from "node:path";
|
|
17
17
|
import { describeStorage, resolveEnvironment } from "./environment.js";
|
|
18
|
+
import { describeProduction, readDeployment } from "./deployment.js";
|
|
18
19
|
export function writeAtomic(path, content, mode) {
|
|
19
20
|
const temp = `${path}.${process.pid}.tmp`;
|
|
20
21
|
writeFileSync(temp, content, mode === undefined ? undefined : { mode });
|
|
@@ -89,7 +90,8 @@ export function listProjects() {
|
|
|
89
90
|
return entries
|
|
90
91
|
.map((entry) => {
|
|
91
92
|
const record = readRuntimeRecord(join(entry.path, ".feltkit", "development"));
|
|
92
|
-
|
|
93
|
+
const exists = existsSync(entry.path);
|
|
94
|
+
return { ...entry, exists, running: Boolean(record), ...(record ? { url: record.url } : {}), deployment: exists ? readDeployment(entry.path) : null };
|
|
93
95
|
})
|
|
94
96
|
.sort((a, b) => b.lastRunAt.localeCompare(a.lastRunAt));
|
|
95
97
|
}
|
|
@@ -127,6 +129,11 @@ export function describeEnvironments(projectDir, runtime) {
|
|
|
127
129
|
if (name === "test") {
|
|
128
130
|
return { name, active: false, storage: "local", location: "A new temporary directory for each test runtime", durable: true, instanceId: null, development: true };
|
|
129
131
|
}
|
|
132
|
+
if (name === "production") {
|
|
133
|
+
// What the deployment uses: its FeltDB (from .env.local) when its data is there, not this machine's folder.
|
|
134
|
+
const production = describeProduction(projectDir);
|
|
135
|
+
return { name, active: false, storage: production.storage, location: production.location, durable: production.storage !== "unconfigured", instanceId: null, development: false, target: production.title, deployment: production.deployment };
|
|
136
|
+
}
|
|
130
137
|
try {
|
|
131
138
|
const env = resolveEnvironment({ projectDir, appName: runtime.app.name, name, env: process.env });
|
|
132
139
|
const storage = describeStorage(env.storage);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/runtime/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5G,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/runtime/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5G,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAyB,MAAM,iBAAiB,CAAC;AAa5F,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,OAAe,EAAE,IAAa;IACtE,MAAM,IA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AE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;gBAClG,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC;YAC9J,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAG,KAAe,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;YACpJ,CAAC;QACH,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
package/dist/server/admin.js
CHANGED
|
@@ -5,6 +5,7 @@ import { ACTIVITY_COLLECTION } from "../runtime/activity.js";
|
|
|
5
5
|
import { SESSIONS_COLLECTION } from "../runtime/sessions.js";
|
|
6
6
|
import { FILE_CONTENT_COLLECTION } from "../runtime/services.js";
|
|
7
7
|
import { describeEnvironments, listProjects } from "../runtime/projects.js";
|
|
8
|
+
import { defaultOwnerId, studioLink } from "./production.js";
|
|
8
9
|
import { readJSON, safeEqual, sendError, sendJSON, startSSE } from "./http.js";
|
|
9
10
|
import { INTELLIGENCE_CATALOG, getIntelligenceProvider } from "@appport/services";
|
|
10
11
|
import { systemPrincipal } from "../runtime/authority.js";
|
|
@@ -72,6 +73,15 @@ export async function handleAdmin(ctx, request, response, path, url) {
|
|
|
72
73
|
return sendJSON(response, 200, describeEnvironments(ctx.projectDir, runtime));
|
|
73
74
|
if (method === "GET" && segments[0] === "projects")
|
|
74
75
|
return sendJSON(response, 200, { projects: listProjects(), current: ctx.projectDir });
|
|
76
|
+
// POST /production/studio-link: a one-time sign-in to the deployed app's Studio, signed with the
|
|
77
|
+
// deployment's operator key (.env.local). Development only: this Studio runs on the developer's machine.
|
|
78
|
+
if (method === "POST" && segments[0] === "production" && segments[1] === "studio-link") {
|
|
79
|
+
requireDevelopment("Opening production Studio");
|
|
80
|
+
const body = (await readJSON(request).catch(() => ({})));
|
|
81
|
+
const id = typeof body.id === "string" && body.id ? body.id : defaultOwnerId();
|
|
82
|
+
const link = await studioLink(ctx.projectDir, { id });
|
|
83
|
+
return sendJSON(response, 200, { url: link.url, ...(link.url ? {} : { grant: link.grant }), operator: id, roles: link.roles, expiresInMinutes: Math.round(link.ttlMs / 60_000) });
|
|
84
|
+
}
|
|
75
85
|
// Data explorer
|
|
76
86
|
if (segments[0] === "collections") {
|
|
77
87
|
const raw = runtime.instance.handle("feltkit.admin");
|