@fabrika/provider-cloudflare 0.3.2 → 0.4.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.
@@ -1,3 +1,5 @@
1
+ import { contractArtifactSchema } from '@fabrika/app/contract'
2
+ import { type ContractArtifact, contractDigest } from '@fabrika/auth-core'
1
3
  import { z } from 'zod'
2
4
 
3
5
  export const runnerStateSchema = z.enum(['pending', 'cloning', 'installing', 'deploying', 'succeeded', 'failed'])
@@ -17,6 +19,32 @@ export interface RunnerOutcomeFile {
17
19
 
18
20
  export const RUNNER_OUTCOME_FILE_ENV = 'FABRIKA_RUNNER_OUTCOME_FILE'
19
21
 
22
+ /** The executor's copy of `CloudflareRunnerJob.installationApps`: a JSON array of `<app>@<env>`. */
23
+ export const INSTALLATION_APPS_ENV = 'FABRIKA_INSTALLATION_APPS'
24
+
25
+ /**
26
+ * The access Control approved for a run (ADR-0050): the contract it read at the commit. The proxy table and
27
+ * `FABRIKA_CONTRACT_DIGEST` follow this, never the checkout.
28
+ */
29
+ export interface RunnerApprovedAccess {
30
+ readonly kind: 'contract'
31
+ readonly contract: ContractArtifact
32
+ readonly contractDigest: string
33
+ }
34
+
35
+ export const runnerApprovedAccessSchema = z.object({ kind: z.literal('contract'), contract: z.unknown(), contractDigest: z.string() }).strict()
36
+ .transform((access, context): RunnerApprovedAccess => {
37
+ const contract = contractArtifactSchema.safeParse(access.contract)
38
+ if (!contract.success || contractDigest(contract.data) !== access.contractDigest) {
39
+ context.addIssue({ code: z.ZodIssueCode.custom, message: 'not a contract artifact its digest describes' })
40
+ return z.NEVER
41
+ }
42
+ return { kind: 'contract', contract: contract.data, contractDigest: access.contractDigest }
43
+ })
44
+
45
+ /** Where the runner leaves the job's `RunnerApprovedAccess` as JSON for the executor — beside the checkout, never inside it. */
46
+ export const APPROVED_ACCESS_FILE_ENV = 'FABRIKA_APPROVED_ACCESS_FILE'
47
+
20
48
  /** The terminal and in-progress status polled from the container, and persisted by the runner Worker once terminal. */
21
49
  export const runnerStatusSchema = z.object({
22
50
  runId: z.string(),