@fabrika/cli 0.8.1 → 0.9.0-cloudflare.1
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/package.json +15 -14
- package/src/app-dev.ts +29 -15
- package/src/control.ts +38 -1
- package/src/db.ts +72 -16
- package/src/index.ts +42 -55
- package/src/namespace.ts +55 -178
- package/types/src/app-dev-outside.d.ts +27 -0
- package/types/src/app-dev-seed.d.ts +37 -0
- package/types/src/app-dev-ui.d.ts +146 -0
- package/types/src/app-dev.d.ts +45 -0
- package/types/src/connect.d.ts +17 -0
- package/types/src/control.d.ts +40 -0
- package/types/src/db.d.ts +12 -0
- package/types/src/index.d.ts +11 -0
- package/types/src/job.d.ts +15 -0
- package/types/src/junit.d.ts +10 -0
- package/types/src/namespace.d.ts +12 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ImplementationLoader } from '@fabrika/app/bun';
|
|
2
|
+
import { type JobRunResult } from '@fabrika/app/implement';
|
|
3
|
+
export declare const JOB_USAGE = "fabrika job \u2014 an application's c.cron jobs\n\nUsage:\n fabrika job run <name> Run the job <name> of fabrika.contract.ts once: the command every crontab entry runs.\n The framework's own fabrika-file-scan scans the uploads of scan: true file collections,\n and fabrika-file-sweep deletes the objects of removed and orphaned files.\n\nRun from the application root. The job boots like the server: the framework variables (FABRIKA_APP_ID,\nFABRIKA_APP_DATABASE_URL, FABRIKA_IAM_*, FABRIKA_CONTRACT_DIGEST, FABRIKA_PROXY_SECRET, FABRIKA_OPERATIONS_DSN)\ncome from the environment only and leave the process before src/app.ts loads; the run itself happens in a\nprocess started again with the runtime role's credential in place of FABRIKA_APP_DATABASE_URL. A run takes the job's lease\nor does not start. It exits 1 when the job failed, and 0 when it succeeded or a previous run still holds the lease.\nA failure is named by a fixed code (timeout, lease_lost, handler_failed, query_refused, capability_refused,\ndriver_failed, crashed, unauthorized, iam_unavailable, boot_failed), never by the application's error; a refusal adds\nits catalog reason (query_refused: undeclared_reach).\n";
|
|
4
|
+
export interface JobCommandDependencies {
|
|
5
|
+
/** The application root. */
|
|
6
|
+
readonly cwd: string;
|
|
7
|
+
readonly source: Readonly<Record<string, string | undefined>>;
|
|
8
|
+
readonly write: (line: string) => void;
|
|
9
|
+
readonly fileExists: (path: string) => Promise<boolean>;
|
|
10
|
+
readonly run: (load: ImplementationLoader, env: Readonly<Record<string, string | undefined>>, name: string) => Promise<JobRunResult>;
|
|
11
|
+
}
|
|
12
|
+
/** Runs one job and answers the process exit code. */
|
|
13
|
+
export declare const runJobCommand: (command: string | undefined, argv: readonly string[], deps: JobCommandDependencies) => Promise<number>;
|
|
14
|
+
/** The process ends with the run, so nothing a handler left running outlives it. */
|
|
15
|
+
export declare const runJobCli: (command: string | undefined, argv: readonly string[]) => Promise<never>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type CaseOutcome = 'passed' | 'failed' | 'skipped';
|
|
2
|
+
export interface ReportedCase {
|
|
3
|
+
/** The test file, relative to the directory `bun test` ran in. */
|
|
4
|
+
readonly file: string;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly outcome: CaseOutcome;
|
|
7
|
+
/** The `expect` calls the case ran, as Bun reports them; `null` when the report does not say. */
|
|
8
|
+
readonly assertions: number | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function readJunitCases(xml: string): ReportedCase[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NamespaceCli } from '@fabrika/provider-contract/app-cli';
|
|
2
|
+
export declare const NAMESPACE_USAGE = "fabrika namespace \u2014 deployment namespaces\n\nUsage:\n fabrika namespace <plan|create|adopt|reconcile> --provider=<name> [provider options] [--json]\n\nThe commands and their options are the provider's: `fabrika namespace --provider=<name> --help` prints them.\n";
|
|
3
|
+
export interface NamespaceCommandDependencies {
|
|
4
|
+
readonly source: Readonly<Record<string, string | undefined>>;
|
|
5
|
+
readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
6
|
+
readonly write: (value: string) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Run one provider's namespace command and print what it answers. `--json` and `--control-url` are this area's own
|
|
10
|
+
* options, so they are taken out before the provider's parser, which refuses unknown options.
|
|
11
|
+
*/
|
|
12
|
+
export declare const runNamespaceCommand: (cli: NamespaceCli, subcommand: string, argv: readonly string[], deps: NamespaceCommandDependencies) => Promise<void>;
|