@fabrika/app 0.9.0-dev.4 → 0.9.0-dev.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/package.json +9 -9
- package/skill/SKILL.md +41 -14
- package/skill/references/app-setup.md +43 -12
- package/skill/references/dev.md +2 -1
- package/skill/references/endpoint.md +30 -24
- package/skill/references/errors.md +40 -35
- package/skill/references/files.md +4 -2
- package/skill/references/jobs.md +21 -4
- package/skill/references/table-and-migration.md +19 -2
- package/skill/references/tests.md +40 -1
- package/skill/references/webhooks-links-connectors.md +1 -1
- package/src/build-recipe.ts +198 -0
- package/src/build.ts +60 -4
- package/src/bun.ts +181 -13
- package/src/cloudflare/application.ts +822 -0
- package/src/cloudflare/bindings.ts +159 -0
- package/src/cloudflare/export.ts +621 -0
- package/src/cloudflare/import.ts +1013 -0
- package/src/cloudflare/maintenance.ts +518 -0
- package/src/cloudflare/names.ts +16 -0
- package/src/cloudflare/ops.ts +375 -0
- package/src/cloudflare/r2-files.ts +172 -0
- package/src/cloudflare/restore.ts +167 -0
- package/src/cloudflare/tracker.ts +192 -0
- package/src/cloudflare.ts +100 -146
- package/src/contract/app-id.ts +5 -0
- package/src/contract/artifact-schema.ts +9 -1
- package/src/contract/build.ts +40 -2
- package/src/contract/compile.ts +1 -0
- package/src/contract/context.ts +35 -9
- package/src/contract/declaration.ts +2 -0
- package/src/contract/defaults.ts +22 -2
- package/src/contract/define.ts +29 -3
- package/src/contract/kit.ts +4 -1
- package/src/contract/platform.ts +3 -2
- package/src/contract/vocabulary.ts +26 -8
- package/src/dev/launcher.ts +50 -4
- package/src/disk-assets.ts +8 -3
- package/src/files/archive.ts +2 -2
- package/src/files/job-names.ts +12 -0
- package/src/files/kinds.ts +73 -31
- package/src/files/scan.ts +3 -4
- package/src/files/streams.ts +3 -1
- package/src/implement/anonymous.ts +12 -11
- package/src/implement/boot.ts +75 -6
- package/src/implement/bounded.ts +21 -2
- package/src/implement/capability.ts +15 -3
- package/src/implement/dispatch.ts +419 -177
- package/src/implement/failures.ts +17 -1
- package/src/implement/faults.ts +1 -0
- package/src/implement/index.ts +1 -0
- package/src/implement/invocation.ts +58 -10
- package/src/implement/principal.ts +25 -2
- package/src/implement/terminals.ts +93 -0
- package/src/implement/workload.ts +42 -16
- package/src/jobs/mail.ts +8 -0
- package/src/jobs/report.ts +5 -1
- package/src/jobs/runner.ts +672 -113
- package/src/jobs/schedule.ts +7 -1
- package/src/jobs/scrub.ts +14 -1
- package/src/jobs/types.ts +6 -0
- package/src/spa-fallback.ts +12 -0
- package/src/testing/endpoint-access.ts +307 -152
- package/src/testing/isolation.ts +8 -1
- package/src/testing/kit.ts +80 -2
- package/src/testing/proxy.ts +15 -10
- package/types/src/build-recipe.d.ts +70 -0
- package/types/src/build.d.ts +19 -1
- package/types/src/bun.d.ts +34 -1
- package/types/src/cloudflare/application.d.ts +73 -0
- package/types/src/cloudflare/bindings.d.ts +33 -0
- package/types/src/cloudflare/export.d.ts +16 -0
- package/types/src/cloudflare/import.d.ts +51 -0
- package/types/src/cloudflare/maintenance.d.ts +117 -0
- package/types/src/cloudflare/names.d.ts +11 -0
- package/types/src/cloudflare/ops.d.ts +81 -0
- package/types/src/cloudflare/r2-files.d.ts +9 -0
- package/types/src/cloudflare/restore.d.ts +9 -0
- package/types/src/cloudflare/tracker.d.ts +29 -0
- package/types/src/cloudflare.d.ts +12 -18
- package/types/src/contract/app-id.d.ts +2 -0
- package/types/src/contract/artifact-schema.d.ts +2 -0
- package/types/src/contract/context.d.ts +35 -11
- package/types/src/contract/declaration.d.ts +4 -0
- package/types/src/contract/defaults.d.ts +19 -1
- package/types/src/contract/define.d.ts +20 -3
- package/types/src/contract/kit.d.ts +2 -1
- package/types/src/contract/platform.d.ts +2 -2
- package/types/src/contract/vocabulary.d.ts +9 -7
- package/types/src/disk-assets.d.ts +4 -1
- package/types/src/files/job-names.d.ts +9 -0
- package/types/src/files/kinds.d.ts +21 -14
- package/types/src/files/scan.d.ts +1 -3
- package/types/src/implement/anonymous.d.ts +2 -4
- package/types/src/implement/boot.d.ts +17 -1
- package/types/src/implement/bounded.d.ts +11 -1
- package/types/src/implement/capability.d.ts +4 -2
- package/types/src/implement/dispatch.d.ts +34 -1
- package/types/src/implement/failures.d.ts +5 -0
- package/types/src/implement/faults.d.ts +1 -0
- package/types/src/implement/index.d.ts +1 -0
- package/types/src/implement/invocation.d.ts +22 -7
- package/types/src/implement/principal.d.ts +6 -1
- package/types/src/implement/terminals.d.ts +33 -0
- package/types/src/implement/workload.d.ts +5 -0
- package/types/src/jobs/runner.d.ts +66 -2
- package/types/src/jobs/schedule.d.ts +2 -0
- package/types/src/jobs/types.d.ts +6 -0
- package/types/src/spa-fallback.d.ts +2 -0
- package/types/src/testing/endpoint-access.d.ts +37 -5
- package/types/src/testing/isolation.d.ts +1 -1
- package/types/src/testing/kit.d.ts +22 -1
- package/types/src/testing/proxy.d.ts +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ContractArtifact, type IamMembershipRpc } from '@fabrika/auth-core';
|
|
1
|
+
import { type ContractArtifact, type IamMembershipRpc, type IamTerminalRpc } from '@fabrika/auth-core';
|
|
2
2
|
import type { Database } from '@fabrika/db';
|
|
3
3
|
import { MemoryEmailSender } from '@fabrika/email/memory';
|
|
4
4
|
import type { FileObjectStore } from '@fabrika/platform';
|
|
@@ -48,6 +48,11 @@ export interface TestKitOptions {
|
|
|
48
48
|
* kit's proxy obtains each delegation grant from it. Without it the kit's IAM answers them under IAM's rules.
|
|
49
49
|
*/
|
|
50
50
|
readonly membership?: IamMembershipRpc;
|
|
51
|
+
/**
|
|
52
|
+
* IAM's identifications at a terminal (ADR-0067), for a contract that declares one. Without it the kit's IAM knows no
|
|
53
|
+
* open identification: `inspect` answers null and `assert` `not_found`.
|
|
54
|
+
*/
|
|
55
|
+
readonly terminals?: IamTerminalRpc;
|
|
51
56
|
/**
|
|
52
57
|
* Each import's owner, by the import's name: its origin and edge key, which the platform writes as the import's
|
|
53
58
|
* framework variables, and how a request reaches it — usually the owner kit's `fetch`.
|
|
@@ -121,6 +126,17 @@ export interface TestKit<C extends AnyContract> {
|
|
|
121
126
|
runJob(name: JobName<C> | typeof FILE_SCAN_JOB | typeof FILE_SWEEP_JOB, options?: JobRunOptions): Promise<JobRunResult>;
|
|
122
127
|
/** Waits for the work requests left running: the runs a site's `ctx.kick` sent, a failure's report. */
|
|
123
128
|
drain(): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Runs every job with a wake due now or within `within` ms (0 by default) once, as the Cloudflare object's alarm
|
|
131
|
+
* runs it: the startup repair first (each job's cron wake at its next fire), then each wake ahead moved to now, then
|
|
132
|
+
* each due job under its lease, a failed run's retry moved to its backoff. It first waits for the runs a site's
|
|
133
|
+
* `ctx.kick` sent. Nothing else fires on its own. Handlers keep real time: only the wakes move, never the clock, so
|
|
134
|
+
* a run again schedules its cron fire from now, and a later call skips a cron fire this kit already ran early. Needs
|
|
135
|
+
* the application's data layer.
|
|
136
|
+
*/
|
|
137
|
+
runDueJobs(options?: {
|
|
138
|
+
readonly within?: number;
|
|
139
|
+
}): Promise<readonly DueJobRun[]>;
|
|
124
140
|
/**
|
|
125
141
|
* The stand-in for every job's transport: what reached it (`accepted`, `handoffs`) and its faults (`refuse`,
|
|
126
142
|
* `unavailable`, `unreachable`, `loseAnswers`, `during`, `heal`). Each message carries the transport key,
|
|
@@ -143,6 +159,11 @@ export interface TestKit<C extends AnyContract> {
|
|
|
143
159
|
*/
|
|
144
160
|
solveChallenge(procedure: object): Promise<string>;
|
|
145
161
|
}
|
|
162
|
+
/** A job `runDueJobs` ran, and its run's result. */
|
|
163
|
+
export interface DueJobRun {
|
|
164
|
+
readonly job: string;
|
|
165
|
+
readonly result: JobRunResult;
|
|
166
|
+
}
|
|
146
167
|
/** The names of the contract's cron jobs. */
|
|
147
168
|
export type JobName<C> = C extends {
|
|
148
169
|
readonly surface: {
|
|
@@ -3,12 +3,12 @@ import { type DelegationIssuer, type IamGateway, type TokenCache } from '@fabrik
|
|
|
3
3
|
/** What the proxy did with a request: answered it itself, or forwarded it with what only the proxy may set. */
|
|
4
4
|
export type ProxyOutcome = {
|
|
5
5
|
readonly outcome: 'forward';
|
|
6
|
-
/** Every header only the proxy may assert, with the value the decision gave it. */
|
|
7
|
-
readonly asserted: ReadonlyMap<string, string>;
|
|
8
6
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Every header only the proxy may assert, with the value the decision gave it. A credentialed request that carried
|
|
8
|
+
* `Authorization` has it replaced by the minted token, so the caller's `px_` key never reaches the application.
|
|
11
9
|
*/
|
|
10
|
+
readonly asserted: ReadonlyMap<string, string>;
|
|
11
|
+
/** Whether the request's own `Authorization` reaches the application: only on a webhook row the decision marked to pass it on. */
|
|
12
12
|
readonly keepsAuthorization: boolean;
|
|
13
13
|
/** What the application's answer is given for an admitted cross-origin request, over its own headers. */
|
|
14
14
|
readonly decorate: (headers: Headers) => void;
|