@feltdb/feltkit 0.3.10 → 0.3.12
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/app.d.ts +86 -3
- package/dist/app.js +63 -2
- package/dist/app.js.map +1 -1
- package/dist/appboundry/build.d.ts +39 -1
- package/dist/appboundry/build.js +77 -7
- package/dist/appboundry/build.js.map +1 -1
- package/dist/appboundry/guest.js +79 -2
- package/dist/appboundry/guest.js.map +1 -1
- package/dist/appboundry/host.d.ts +44 -0
- package/dist/appboundry/host.js +456 -0
- package/dist/appboundry/host.js.map +1 -0
- package/dist/appboundry/runtime.d.ts +44 -0
- package/dist/appboundry/runtime.js +99 -0
- package/dist/appboundry/runtime.js.map +1 -0
- package/dist/cli/entry.d.ts +1 -0
- package/dist/cli/entry.js +4 -0
- package/dist/cli/entry.js.map +1 -0
- package/dist/cli/main.js +459 -8
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/skills.d.ts +8 -0
- package/dist/cli/skills.js +37 -0
- package/dist/cli/skills.js.map +1 -1
- package/dist/cli/test-reporter.d.ts +9 -0
- package/dist/cli/test-reporter.js +26 -0
- package/dist/cli/test-reporter.js.map +1 -0
- package/dist/errors.d.ts +7 -1
- package/dist/errors.js +1 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/platform/changes.d.ts +340 -0
- package/dist/platform/changes.js +353 -0
- package/dist/platform/changes.js.map +1 -0
- package/dist/platform/deployments.d.ts +653 -0
- package/dist/platform/deployments.js +530 -0
- package/dist/platform/deployments.js.map +1 -0
- package/dist/platform/operations.d.ts +74 -0
- package/dist/platform/operations.js +198 -0
- package/dist/platform/operations.js.map +1 -0
- package/dist/platform/platform.d.ts +78 -0
- package/dist/platform/platform.js +264 -0
- package/dist/platform/platform.js.map +1 -0
- package/dist/platform/server.d.ts +25 -0
- package/dist/platform/server.js +165 -0
- package/dist/platform/server.js.map +1 -0
- package/dist/platform/source.d.ts +27 -0
- package/dist/platform/source.js +142 -0
- package/dist/platform/source.js.map +1 -0
- package/dist/runtime/backup-environment.d.ts +25 -0
- package/dist/runtime/backup-environment.js +60 -0
- package/dist/runtime/backup-environment.js.map +1 -0
- package/dist/runtime/backup.d.ts +87 -0
- package/dist/runtime/backup.js +175 -0
- package/dist/runtime/backup.js.map +1 -0
- package/dist/runtime/capabilities.d.ts +1 -1
- package/dist/runtime/capabilities.js +19 -2
- package/dist/runtime/capabilities.js.map +1 -1
- package/dist/runtime/context.d.ts +7 -0
- package/dist/runtime/contract.js +5 -1
- package/dist/runtime/contract.js.map +1 -1
- package/dist/runtime/data.d.ts +28 -0
- package/dist/runtime/data.js +49 -1
- package/dist/runtime/data.js.map +1 -1
- package/dist/runtime/instance.js +17 -0
- package/dist/runtime/instance.js.map +1 -1
- package/dist/runtime/loader.js +6 -2
- package/dist/runtime/loader.js.map +1 -1
- package/dist/runtime/migration-context.d.ts +25 -0
- package/dist/runtime/migration-context.js +69 -0
- package/dist/runtime/migration-context.js.map +1 -0
- package/dist/runtime/outbox.d.ts +7 -0
- package/dist/runtime/outbox.js +47 -0
- package/dist/runtime/outbox.js.map +1 -0
- package/dist/runtime/readiness.js +12 -0
- package/dist/runtime/readiness.js.map +1 -1
- package/dist/runtime/runtime.d.ts +65 -1
- package/dist/runtime/runtime.js +380 -66
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/services.d.ts +30 -0
- package/dist/runtime/services.js +82 -1
- package/dist/runtime/services.js.map +1 -1
- package/dist/runtime/state-contract.d.ts +167 -0
- package/dist/runtime/state-contract.js +438 -0
- package/dist/runtime/state-contract.js.map +1 -0
- package/dist/runtime/transactions.d.ts +199 -0
- package/dist/runtime/transactions.js +246 -0
- package/dist/runtime/transactions.js.map +1 -0
- package/dist/schema.d.ts +42 -2
- package/dist/schema.js +58 -2
- package/dist/schema.js.map +1 -1
- package/dist/server/admin.d.ts +1 -0
- package/dist/server/admin.js +27 -0
- package/dist/server/admin.js.map +1 -1
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.js +45 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/project.d.ts +5 -0
- package/dist/server/project.js +13 -2
- package/dist/server/project.js.map +1 -1
- package/dist/testing/index.d.ts +24 -0
- package/dist/testing/index.js +31 -0
- package/dist/testing/index.js.map +1 -1
- package/package.json +5 -5
- package/skills/.claude-plugin/marketplace.json +1 -1
- package/skills/.claude-plugin/plugin.json +1 -1
- package/skills/feltkit-agent/SKILL.md +1 -1
- package/skills/feltkit-build/SKILL.md +33 -2
- package/skills/feltkit-data/SKILL.md +12 -1
- package/skills/feltkit-operations/SKILL.md +1 -1
- package/skills/feltkit-services/SKILL.md +22 -2
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which AppBoundry can run what FeltKit builds.
|
|
3
|
+
*
|
|
4
|
+
* Releases and what each one does:
|
|
5
|
+
*
|
|
6
|
+
* 1.1.x no `run`, rejects the format, no `--version`
|
|
7
|
+
* 1.2.0 runs `appboundry.app/1`; ignores the artifact's `state.contract`
|
|
8
|
+
* 1.3.0 also enforces `state.contract` through FeltDB, the same references, unique
|
|
9
|
+
* constraints, types and schema compatibility as FeltKit's runtime
|
|
10
|
+
* 1.4.0 also runs the artifact's `app.migration()`s (host interface migrations@1,
|
|
11
|
+
* manifest `state.migrations`) inside the FeltDB evolution, as FeltKit's runtime does
|
|
12
|
+
* 1.5.0 also provides ctx.db.sequence and ctx.afterCommit (host interface transactions@1),
|
|
13
|
+
* with the contract in docs/TRANSACTIONS.md
|
|
14
|
+
*
|
|
15
|
+
* A FeltKit artifact always carries a contract, so the minimum is 1.3.0: a runtime that runs
|
|
16
|
+
* the code but not its data guarantees is not compatible. `appboundry --version --json`
|
|
17
|
+
* reports the format, guest ABI, host interfaces, services and `stateContract: "enforced"`,
|
|
18
|
+
* and a runtime is compatible when it implements what the manifest requires.
|
|
19
|
+
*
|
|
20
|
+
* An artifact with migrations requires migrations@1 (1.4.0 or later); one that uses sequences or
|
|
21
|
+
* after-commit effects requires transactions@1 (1.5.0 or later); one with neither runs on 1.3.0.
|
|
22
|
+
*/
|
|
23
|
+
import { execFileSync } from "node:child_process";
|
|
24
|
+
import { FeltKitError } from "../errors.js";
|
|
25
|
+
export const APPBOUNDRY_PACKAGE = "@appport/appboundry";
|
|
26
|
+
/** The first release that runs appboundry.app/1 with its state contract enforced. */
|
|
27
|
+
export const MINIMUM_APPBOUNDRY = "1.3.0";
|
|
28
|
+
/** The first release that runs an artifact's migrations (host interface migrations@1). */
|
|
29
|
+
export const MIGRATIONS_APPBOUNDRY = "1.4.0";
|
|
30
|
+
/** The first release that provides ctx.db.sequence and ctx.afterCommit (host interface transactions@1). */
|
|
31
|
+
export const TRANSACTIONS_APPBOUNDRY = "1.5.0";
|
|
32
|
+
/** What to install: any 1.x from the minimum. */
|
|
33
|
+
export const APPBOUNDRY_RANGE = `>=${MINIMUM_APPBOUNDRY} <2.0.0`;
|
|
34
|
+
function newer(a, b) {
|
|
35
|
+
const [x, y] = [a, b].map((v) => v.split("-")[0].split(".").map(Number));
|
|
36
|
+
for (let i = 0; i < 3; i++)
|
|
37
|
+
if ((x[i] ?? 0) !== (y[i] ?? 0))
|
|
38
|
+
return (x[i] ?? 0) - (y[i] ?? 0);
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
/** Why a missing optional interface matters, and the release that provides it. */
|
|
42
|
+
const INTERFACE_RELEASES = {
|
|
43
|
+
migrations: ` (it does not run the artifact's app.migration()s; ${MIGRATIONS_APPBOUNDRY} or later does)`,
|
|
44
|
+
transactions: ` (it does not provide ctx.db.sequence and ctx.afterCommit; ${TRANSACTIONS_APPBOUNDRY} or later does)`,
|
|
45
|
+
};
|
|
46
|
+
/** Why `report` cannot run an artifact needing `needs` (empty: it can). */
|
|
47
|
+
export function appboundryProblems(report, needs) {
|
|
48
|
+
const problems = [];
|
|
49
|
+
if (newer(report.version, MINIMUM_APPBOUNDRY) < 0)
|
|
50
|
+
problems.push(`${report.name ?? APPBOUNDRY_PACKAGE} ${report.version} is older than ${MINIMUM_APPBOUNDRY}, the first release that runs ${needs.format} with its state contract enforced`);
|
|
51
|
+
if (needs.state?.contract !== undefined && report.artifact?.stateContract !== "enforced")
|
|
52
|
+
problems.push("it does not enforce the artifact's state contract (references, unique constraints, schema compatibility), so the application's data guarantees would not hold there");
|
|
53
|
+
if (report.artifact?.format !== needs.format)
|
|
54
|
+
problems.push(`it runs ${report.artifact?.format ?? "no artifact format"}, not ${needs.format}`);
|
|
55
|
+
if (report.artifact?.abi !== needs.runtime.abi)
|
|
56
|
+
problems.push(`its guest ABI is ${report.artifact?.abi ?? "unknown"}, not ${needs.runtime.abi}`);
|
|
57
|
+
for (const [name, version] of Object.entries(needs.runtime.interfaces)) {
|
|
58
|
+
if (!report.artifact?.interfaces?.[name]?.includes(version))
|
|
59
|
+
problems.push(`it does not implement the ${name}@${version} host interface${INTERFACE_RELEASES[name] ?? ""}`);
|
|
60
|
+
}
|
|
61
|
+
for (const service of needs.permissions?.services ?? []) {
|
|
62
|
+
if (report.artifact?.services && !report.artifact.services.includes(service))
|
|
63
|
+
problems.push(`it does not provide the ${service} service`);
|
|
64
|
+
}
|
|
65
|
+
return problems;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Ask an installed AppBoundry what it runs (`<bin> --version --json`). A release before
|
|
69
|
+
* 1.2.0 answers with its usage text instead: that is reported as too old, by name.
|
|
70
|
+
*/
|
|
71
|
+
export function probeAppBoundry(bin) {
|
|
72
|
+
let output;
|
|
73
|
+
try {
|
|
74
|
+
output = execFileSync(process.execPath, [bin, "--version", "--json"], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 30_000 });
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
throw new FeltKitError("CONFIGURATION", `${bin} did not answer \`--version --json\`: ${error.message.split("\n")[0]}`, { hint: installHint() });
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
const report = JSON.parse(output);
|
|
81
|
+
if (typeof report?.version !== "string" || !report.artifact)
|
|
82
|
+
throw new Error("not a runtime report");
|
|
83
|
+
return report;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
throw new FeltKitError("CONFIGURATION", `The AppBoundry at ${bin} predates \`--version\` (it is older than 1.2.0, the first release that runs appboundry.app/1); FeltKit artifacts need ${MINIMUM_APPBOUNDRY} or later.`, { hint: installHint() });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** Refuse an installed AppBoundry that cannot run this artifact, naming every reason. */
|
|
90
|
+
export function assertAppBoundryRuns(report, needs) {
|
|
91
|
+
const problems = appboundryProblems(report, needs);
|
|
92
|
+
if (problems.length) {
|
|
93
|
+
throw new FeltKitError("CONFIGURATION", `${report.name ?? APPBOUNDRY_PACKAGE} ${report.version} cannot run this artifact: ${problems.join("; ")}.`, { hint: installHint() });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export function installHint() {
|
|
97
|
+
return `Install a compatible runtime: npm install ${APPBOUNDRY_PACKAGE}@"${APPBOUNDRY_RANGE}" (or run it with npx ${APPBOUNDRY_PACKAGE}@^${MINIMUM_APPBOUNDRY} run <name>.app).`;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/appboundry/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AACxD,qFAAqF;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAC1C,0FAA0F;AAC1F,MAAM,CAAC,MAAM,qBAA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