@fabrika/provider-cloudflare 0.9.0-dev.3 → 0.9.0-dev.5

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.
@@ -0,0 +1,80 @@
1
+ import { type ContractArtifact } from '@fabrika/auth-core';
2
+ import type { ProviderManagedEnvironment } from '@fabrika/provider-contract';
3
+ /**
4
+ * The longest a procedure's or a webhook's handler may run on Cloudflare. It runs inside the object's transaction, and
5
+ * workerd resets an object whose transaction runs about 30 s (docs/reference/cloudflare-platform.md).
6
+ */
7
+ export declare const CLOUDFLARE_MAX_HANDLER_MS = 25000;
8
+ /** What the release a caller runs a contract as decides about it; each caller reads them off that release. */
9
+ export interface CloudflareContractGates {
10
+ /** The release caps a job at one segment (`capsJobSegments`). */
11
+ readonly capsSegments: boolean;
12
+ /** The release runs `ctx.sql` on the object's SQLite (`servesRawSql`). */
13
+ readonly servesSql: boolean;
14
+ }
15
+ /**
16
+ * Refuse what a contract declares that an application on Cloudflare cannot run yet (ADR-0065): a file kind that scans
17
+ * its uploads, a handler allowed to outlive the object's transaction limit, and, by the release it runs as, a job longer
18
+ * than one segment and raw SQL (`ctx.sql`).
19
+ */
20
+ export declare const assertCloudflareContract: (contract: ContractArtifact, { capsSegments, servesSql }: CloudflareContractGates) => void;
21
+ /**
22
+ * The object runs due jobs and the file sweep of file kinds, a framework job, from the Worker's cron trigger: the minute
23
+ * tick, or from `servesAlarms` its alarm with an hourly repair tick (ADR-0065 §5). Legacy `files` collections do not
24
+ * count: the object schedules no sweep of theirs.
25
+ */
26
+ export declare const needsMinuteTick: (contract: ContractArtifact) => boolean;
27
+ /**
28
+ * Whether framework release `release` is at least `since`. A prerelease counts as its `major.minor`; a release that
29
+ * does not start with `<major>.<minor>.` is never at least anything (ADR-0062).
30
+ */
31
+ export declare const releaseAtLeast: (release: string, since: {
32
+ readonly major: number;
33
+ readonly minor: number;
34
+ }) => boolean;
35
+ /**
36
+ * Whether an application on framework release `release` runs in its Durable Object. An older release's entry is a
37
+ * stateless Worker, which the platform keeps deploying in its old shape (ADR-0062).
38
+ */
39
+ export declare const runsInObject: (release: string) => boolean;
40
+ /** Whether the Cloudflare deploy of release `release` accepts only the generated entry and regenerates it. */
41
+ export declare const pinsGeneratedEntry: (release: string) => boolean;
42
+ /** Whether an environment on release `release` gets the ops row, the ops key digests and the object variables. */
43
+ export declare const servesOps: (release: string) => boolean;
44
+ /**
45
+ * Whether framework release `release` is at or above the exact version `since` in semver's precedence, prerelease
46
+ * included; a release that is not a semver version never is (ADR-0062).
47
+ */
48
+ export declare const releaseFrom: (release: string, since: string) => boolean;
49
+ /**
50
+ * The release a gate reads for an approved access: the application's pin, never the reader's `checker`, which is this
51
+ * platform's patch of the pin's minor and so passes a `releaseFrom` gate a prerelease pin does not. An access approved before Control recorded the pin is read as the oldest release of its
52
+ * reader's minor (`<major>.<minor>.0-0`): every `releaseAtLeast` gate answers as for that minor, and every `releaseFrom`
53
+ * gate of a prerelease or a patch fails closed, as for an older application, until a deploy reads its pin.
54
+ */
55
+ export declare const applicationRelease: (access: {
56
+ readonly checker: string;
57
+ readonly framework?: string;
58
+ }) => string;
59
+ /**
60
+ * Whether the object of release `release` holds the maintenance barrier and serves Control's data operations: the
61
+ * backups, the migration phase and the side restore (ADR-0069 §3, ADR-0070).
62
+ */
63
+ export declare const servesDataOperations: (release: string) => boolean;
64
+ /**
65
+ * Whether the Worker of release `release` gets the hourly repair tick instead of the minute tick: an older object runs
66
+ * its jobs only from the minute tick and has no alarm.
67
+ */
68
+ export declare const servesAlarms: (release: string) => boolean;
69
+ /**
70
+ * Whether the Cloudflare deploy of release `release` refuses a job whose `timeoutMs` exceeds one segment
71
+ * (`CLOUDFLARE_MAX_JOB_SEGMENT_MS`). An older release deploys as it did (ADR-0062).
72
+ */
73
+ export declare const capsJobSegments: (release: string) => boolean;
74
+ /** Whether an application on release `release` may declare `sql` on Cloudflare. */
75
+ export declare const servesRawSql: (release: string) => boolean;
76
+ /**
77
+ * Refuse what a stateless Worker of an older release cannot run: a job, a webhook, a public procedure, installation
78
+ * mail and token purposes all need the object's database or a Worker secret it never reads.
79
+ */
80
+ export declare const assertStatelessEnvironment: (managed: ProviderManagedEnvironment, release: string) => void;
@@ -1,5 +1,5 @@
1
- import { type AppEnvironment } from '@fabrika/auth-core';
2
- import type { ControlProvider, ProviderCodec, ProviderSource, ProviderSourceBinding, ProviderSourceResolution, ProviderSourceResolutionInput, ProviderTerminalOutcome, SchemaReconciler } from '@fabrika/provider-contract';
1
+ import { type AppEnvironment, type ApplicationObjects } from '@fabrika/auth-core';
2
+ import type { ControlProvider, ProviderCodec, ProviderSource, ProviderSourceBinding, ProviderSourceResolution, ProviderSourceResolutionInput, ProviderTerminalOutcome } from '@fabrika/provider-contract';
3
3
  import { z } from 'zod';
4
4
  import { type RunnerApprovedAccess, type RunnerIamReconcile } from './runner-protocol';
5
5
  export * from './runner-protocol';
@@ -20,12 +20,14 @@ export interface CloudflareRunnerJob {
20
20
  readonly domain?: string;
21
21
  /** The environment's cross-origin list from Control's registry (ADR-0022); the proxy Worker's manifest entry lists it. */
22
22
  readonly crossOrigins?: readonly string[];
23
- /** Every origin IAM may hand this app a session at, projected by the control plane (ADR-0022). */
24
- readonly returnOrigins?: readonly string[];
23
+ /** The origin of the environment's Operations ingest, from Control; the proxy Worker's `connect-src` admits it. */
24
+ readonly operationsOrigin?: string;
25
25
  /** `<app>@<env>` of every Cloudflare deployment in Control's registry; the deploy refuses another application's names. */
26
26
  readonly installationApps?: readonly string[];
27
27
  /** What the deployed proxy enforces and the application starts as; every run but a dry one carries it. */
28
28
  readonly approvedAccess?: RunnerApprovedAccess;
29
+ /** The serving object and the listed objects Control records (ADR-0070 §9); absent, the deployer's defaults. */
30
+ readonly applicationObjects?: ApplicationObjects;
29
31
  readonly dryRun?: boolean;
30
32
  /**
31
33
  * Shared secret the runner verifies before it touches D1 or the container; the binding alone proves
@@ -81,24 +83,41 @@ export declare const cloudflareRunnerJobSchema: z.ZodEffects<z.ZodEffects<z.ZodE
81
83
  stateNamespace: z.ZodOptional<z.ZodString>;
82
84
  domain: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
83
85
  crossOrigins: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
84
- returnOrigins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
86
+ operationsOrigin: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
85
87
  installationApps: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
86
88
  approvedAccess: z.ZodOptional<z.ZodEffects<z.ZodObject<{
87
89
  kind: z.ZodLiteral<"contract">;
88
90
  contract: z.ZodUnknown;
89
91
  contractDigest: z.ZodEffects<z.ZodString, string, string>;
92
+ framework: z.ZodOptional<z.ZodString>;
90
93
  }, "strict", z.ZodTypeAny, {
91
94
  kind: "contract";
92
95
  contractDigest: string;
93
96
  contract?: unknown;
97
+ framework?: string | undefined;
94
98
  }, {
95
99
  kind: "contract";
96
100
  contractDigest: string;
97
101
  contract?: unknown;
102
+ framework?: string | undefined;
98
103
  }>, RunnerApprovedAccess, {
99
104
  kind: "contract";
100
105
  contractDigest: string;
101
106
  contract?: unknown;
107
+ framework?: string | undefined;
108
+ }>>;
109
+ applicationObjects: z.ZodOptional<z.ZodEffects<z.ZodObject<{
110
+ object: z.ZodString;
111
+ objects: z.ZodArray<z.ZodString, "many">;
112
+ }, "strict", z.ZodTypeAny, {
113
+ object: string;
114
+ objects: string[];
115
+ }, {
116
+ object: string;
117
+ objects: string[];
118
+ }>, ApplicationObjects, {
119
+ object: string;
120
+ objects: string[];
102
121
  }>>;
103
122
  dryRun: z.ZodOptional<z.ZodBoolean>;
104
123
  secrets: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">, {
@@ -127,19 +146,19 @@ export declare const cloudflareRunnerJobSchema: z.ZodEffects<z.ZodEffects<z.ZodE
127
146
  }, "strip", z.ZodTypeAny, {
128
147
  url: string;
129
148
  environment: string;
149
+ release: string;
150
+ appId: string;
130
151
  bearer: string;
131
152
  runId: string;
132
- appId: string;
133
153
  serviceKey: string;
134
- release: string;
135
154
  }, {
136
155
  url: string;
137
156
  environment: string;
157
+ release: string;
158
+ appId: string;
138
159
  bearer: string;
139
160
  runId: string;
140
- appId: string;
141
161
  serviceKey: string;
142
- release: string;
143
162
  }>>;
144
163
  }, "strip", z.ZodTypeAny, {
145
164
  env: string;
@@ -156,27 +175,28 @@ export declare const cloudflareRunnerJobSchema: z.ZodEffects<z.ZodEffects<z.ZodE
156
175
  secrets?: {
157
176
  [k: string]: string;
158
177
  } | undefined;
178
+ operationsOrigin?: string | undefined;
159
179
  crossOrigins?: string[] | undefined;
160
180
  dryRun?: boolean | undefined;
161
- returnOrigins?: string[] | undefined;
162
181
  domain?: string | undefined;
163
- installationApps?: string[] | undefined;
164
- stateNamespace?: string | undefined;
182
+ managedEnvironment?: {
183
+ [k: string]: string;
184
+ } | undefined;
185
+ applicationObjects?: ApplicationObjects | undefined;
165
186
  configPath?: string | undefined;
187
+ stateNamespace?: string | undefined;
188
+ installationApps?: string[] | undefined;
166
189
  runnerKey?: string | undefined;
167
190
  workerDir?: string | undefined;
168
191
  approvedAccess?: RunnerApprovedAccess | undefined;
169
- managedEnvironment?: {
170
- [k: string]: string;
171
- } | undefined;
172
192
  artifactUpload?: {
173
193
  url: string;
174
194
  environment: string;
195
+ release: string;
196
+ appId: string;
175
197
  bearer: string;
176
198
  runId: string;
177
- appId: string;
178
199
  serviceKey: string;
179
- release: string;
180
200
  } | undefined;
181
201
  }, {
182
202
  env: string;
@@ -189,29 +209,34 @@ export declare const cloudflareRunnerJobSchema: z.ZodEffects<z.ZodEffects<z.ZodE
189
209
  repoUrl: string;
190
210
  vars?: unknown;
191
211
  secrets?: unknown;
212
+ operationsOrigin?: string | undefined;
192
213
  crossOrigins?: string[] | undefined;
193
214
  dryRun?: boolean | undefined;
194
- returnOrigins?: string[] | undefined;
195
215
  domain?: string | undefined;
196
- installationApps?: string[] | undefined;
197
- stateNamespace?: string | undefined;
216
+ managedEnvironment?: unknown;
217
+ applicationObjects?: {
218
+ object: string;
219
+ objects: string[];
220
+ } | undefined;
198
221
  configPath?: string | undefined;
222
+ stateNamespace?: string | undefined;
223
+ installationApps?: string[] | undefined;
199
224
  runnerKey?: string | undefined;
200
225
  workerDir?: string | undefined;
201
226
  approvedAccess?: {
202
227
  kind: "contract";
203
228
  contractDigest: string;
204
229
  contract?: unknown;
230
+ framework?: string | undefined;
205
231
  } | undefined;
206
- managedEnvironment?: unknown;
207
232
  artifactUpload?: {
208
233
  url: string;
209
234
  environment: string;
235
+ release: string;
236
+ appId: string;
210
237
  bearer: string;
211
238
  runId: string;
212
- appId: string;
213
239
  serviceKey: string;
214
- release: string;
215
240
  } | undefined;
216
241
  }>, {
217
242
  env: string;
@@ -228,27 +253,28 @@ export declare const cloudflareRunnerJobSchema: z.ZodEffects<z.ZodEffects<z.ZodE
228
253
  secrets?: {
229
254
  [k: string]: string;
230
255
  } | undefined;
256
+ operationsOrigin?: string | undefined;
231
257
  crossOrigins?: string[] | undefined;
232
258
  dryRun?: boolean | undefined;
233
- returnOrigins?: string[] | undefined;
234
259
  domain?: string | undefined;
235
- installationApps?: string[] | undefined;
236
- stateNamespace?: string | undefined;
260
+ managedEnvironment?: {
261
+ [k: string]: string;
262
+ } | undefined;
263
+ applicationObjects?: ApplicationObjects | undefined;
237
264
  configPath?: string | undefined;
265
+ stateNamespace?: string | undefined;
266
+ installationApps?: string[] | undefined;
238
267
  runnerKey?: string | undefined;
239
268
  workerDir?: string | undefined;
240
269
  approvedAccess?: RunnerApprovedAccess | undefined;
241
- managedEnvironment?: {
242
- [k: string]: string;
243
- } | undefined;
244
270
  artifactUpload?: {
245
271
  url: string;
246
272
  environment: string;
273
+ release: string;
274
+ appId: string;
247
275
  bearer: string;
248
276
  runId: string;
249
- appId: string;
250
277
  serviceKey: string;
251
- release: string;
252
278
  } | undefined;
253
279
  }, {
254
280
  env: string;
@@ -261,29 +287,34 @@ export declare const cloudflareRunnerJobSchema: z.ZodEffects<z.ZodEffects<z.ZodE
261
287
  repoUrl: string;
262
288
  vars?: unknown;
263
289
  secrets?: unknown;
290
+ operationsOrigin?: string | undefined;
264
291
  crossOrigins?: string[] | undefined;
265
292
  dryRun?: boolean | undefined;
266
- returnOrigins?: string[] | undefined;
267
293
  domain?: string | undefined;
268
- installationApps?: string[] | undefined;
269
- stateNamespace?: string | undefined;
294
+ managedEnvironment?: unknown;
295
+ applicationObjects?: {
296
+ object: string;
297
+ objects: string[];
298
+ } | undefined;
270
299
  configPath?: string | undefined;
300
+ stateNamespace?: string | undefined;
301
+ installationApps?: string[] | undefined;
271
302
  runnerKey?: string | undefined;
272
303
  workerDir?: string | undefined;
273
304
  approvedAccess?: {
274
305
  kind: "contract";
275
306
  contractDigest: string;
276
307
  contract?: unknown;
308
+ framework?: string | undefined;
277
309
  } | undefined;
278
- managedEnvironment?: unknown;
279
310
  artifactUpload?: {
280
311
  url: string;
281
312
  environment: string;
313
+ release: string;
314
+ appId: string;
282
315
  bearer: string;
283
316
  runId: string;
284
- appId: string;
285
317
  serviceKey: string;
286
- release: string;
287
318
  } | undefined;
288
319
  }>, {
289
320
  env: string;
@@ -300,27 +331,28 @@ export declare const cloudflareRunnerJobSchema: z.ZodEffects<z.ZodEffects<z.ZodE
300
331
  secrets?: {
301
332
  [k: string]: string;
302
333
  } | undefined;
334
+ operationsOrigin?: string | undefined;
303
335
  crossOrigins?: string[] | undefined;
304
336
  dryRun?: boolean | undefined;
305
- returnOrigins?: string[] | undefined;
306
337
  domain?: string | undefined;
307
- installationApps?: string[] | undefined;
308
- stateNamespace?: string | undefined;
338
+ managedEnvironment?: {
339
+ [k: string]: string;
340
+ } | undefined;
341
+ applicationObjects?: ApplicationObjects | undefined;
309
342
  configPath?: string | undefined;
343
+ stateNamespace?: string | undefined;
344
+ installationApps?: string[] | undefined;
310
345
  runnerKey?: string | undefined;
311
346
  workerDir?: string | undefined;
312
347
  approvedAccess?: RunnerApprovedAccess | undefined;
313
- managedEnvironment?: {
314
- [k: string]: string;
315
- } | undefined;
316
348
  artifactUpload?: {
317
349
  url: string;
318
350
  environment: string;
351
+ release: string;
352
+ appId: string;
319
353
  bearer: string;
320
354
  runId: string;
321
- appId: string;
322
355
  serviceKey: string;
323
- release: string;
324
356
  } | undefined;
325
357
  }, {
326
358
  env: string;
@@ -333,29 +365,34 @@ export declare const cloudflareRunnerJobSchema: z.ZodEffects<z.ZodEffects<z.ZodE
333
365
  repoUrl: string;
334
366
  vars?: unknown;
335
367
  secrets?: unknown;
368
+ operationsOrigin?: string | undefined;
336
369
  crossOrigins?: string[] | undefined;
337
370
  dryRun?: boolean | undefined;
338
- returnOrigins?: string[] | undefined;
339
371
  domain?: string | undefined;
340
- installationApps?: string[] | undefined;
341
- stateNamespace?: string | undefined;
372
+ managedEnvironment?: unknown;
373
+ applicationObjects?: {
374
+ object: string;
375
+ objects: string[];
376
+ } | undefined;
342
377
  configPath?: string | undefined;
378
+ stateNamespace?: string | undefined;
379
+ installationApps?: string[] | undefined;
343
380
  runnerKey?: string | undefined;
344
381
  workerDir?: string | undefined;
345
382
  approvedAccess?: {
346
383
  kind: "contract";
347
384
  contractDigest: string;
348
385
  contract?: unknown;
386
+ framework?: string | undefined;
349
387
  } | undefined;
350
- managedEnvironment?: unknown;
351
388
  artifactUpload?: {
352
389
  url: string;
353
390
  environment: string;
391
+ release: string;
392
+ appId: string;
354
393
  bearer: string;
355
394
  runId: string;
356
- appId: string;
357
395
  serviceKey: string;
358
- release: string;
359
396
  } | undefined;
360
397
  }>, {
361
398
  env: string;
@@ -372,27 +409,28 @@ export declare const cloudflareRunnerJobSchema: z.ZodEffects<z.ZodEffects<z.ZodE
372
409
  secrets?: {
373
410
  [k: string]: string;
374
411
  } | undefined;
412
+ operationsOrigin?: string | undefined;
375
413
  crossOrigins?: string[] | undefined;
376
414
  dryRun?: boolean | undefined;
377
- returnOrigins?: string[] | undefined;
378
415
  domain?: string | undefined;
379
- installationApps?: string[] | undefined;
380
- stateNamespace?: string | undefined;
416
+ managedEnvironment?: {
417
+ [k: string]: string;
418
+ } | undefined;
419
+ applicationObjects?: ApplicationObjects | undefined;
381
420
  configPath?: string | undefined;
421
+ stateNamespace?: string | undefined;
422
+ installationApps?: string[] | undefined;
382
423
  runnerKey?: string | undefined;
383
424
  workerDir?: string | undefined;
384
425
  approvedAccess?: RunnerApprovedAccess | undefined;
385
- managedEnvironment?: {
386
- [k: string]: string;
387
- } | undefined;
388
426
  artifactUpload?: {
389
427
  url: string;
390
428
  environment: string;
429
+ release: string;
430
+ appId: string;
391
431
  bearer: string;
392
432
  runId: string;
393
- appId: string;
394
433
  serviceKey: string;
395
- release: string;
396
434
  } | undefined;
397
435
  }, {
398
436
  env: string;
@@ -405,29 +443,34 @@ export declare const cloudflareRunnerJobSchema: z.ZodEffects<z.ZodEffects<z.ZodE
405
443
  repoUrl: string;
406
444
  vars?: unknown;
407
445
  secrets?: unknown;
446
+ operationsOrigin?: string | undefined;
408
447
  crossOrigins?: string[] | undefined;
409
448
  dryRun?: boolean | undefined;
410
- returnOrigins?: string[] | undefined;
411
449
  domain?: string | undefined;
412
- installationApps?: string[] | undefined;
413
- stateNamespace?: string | undefined;
450
+ managedEnvironment?: unknown;
451
+ applicationObjects?: {
452
+ object: string;
453
+ objects: string[];
454
+ } | undefined;
414
455
  configPath?: string | undefined;
456
+ stateNamespace?: string | undefined;
457
+ installationApps?: string[] | undefined;
415
458
  runnerKey?: string | undefined;
416
459
  workerDir?: string | undefined;
417
460
  approvedAccess?: {
418
461
  kind: "contract";
419
462
  contractDigest: string;
420
463
  contract?: unknown;
464
+ framework?: string | undefined;
421
465
  } | undefined;
422
- managedEnvironment?: unknown;
423
466
  artifactUpload?: {
424
467
  url: string;
425
468
  environment: string;
469
+ release: string;
470
+ appId: string;
426
471
  bearer: string;
427
472
  runId: string;
428
- appId: string;
429
473
  serviceKey: string;
430
- release: string;
431
474
  } | undefined;
432
475
  }>;
433
476
  export interface CloudflareCloneSource {
@@ -445,13 +488,9 @@ export type CloudflareRunRecovery = CloudflareRunOutcome | {
445
488
  export interface CloudflareControlOptions {
446
489
  readonly accountId: string;
447
490
  readonly apiToken: string;
448
- readonly propustkaUrl?: string;
449
- readonly propustkaProvisioningKey?: string;
450
491
  readonly runnerKey: string;
451
492
  /** Every Cloudflare deployment in Control's registry, sent with each job so another application's names are refused. */
452
493
  installationApps?(signal: AbortSignal): Promise<readonly AppEnvironment[]>;
453
- /** Overridable for tests; production reconciles over HTTPS with the control plane's own admin key. */
454
- readonly reconcileSchema?: SchemaReconciler;
455
494
  resolveSource(input: ProviderSourceResolutionInput): Promise<ProviderSourceResolution>;
456
495
  prepareClone(source: ProviderSource, signal: AbortSignal, sourceBinding?: ProviderSourceBinding): Promise<CloudflareCloneSource>;
457
496
  startRun(job: CloudflareRunnerJob): Promise<CloudflareRunOutcome>;
@@ -0,0 +1,8 @@
1
+ import type { GeneratedConfig } from 'oblaka-iac';
2
+ /**
3
+ * The generated configs in the order `wrangler deploy` can take them: a Worker another generated config binds as a
4
+ * service goes first, because wrangler refuses a service binding to a script with no deployment yet (code 10145) —
5
+ * on a first deploy the proxy would otherwise reach the application Worker before it exists. Configs with no such
6
+ * dependency keep oblaka's order. A cycle has no first deploy, so it is refused.
7
+ */
8
+ export declare const deployOrder: (configs: readonly GeneratedConfig[]) => readonly GeneratedConfig[];
@@ -1,5 +1,5 @@
1
1
  export * from 'oblaka-iac';
2
- export { type CloudflareAppConfig, type CloudflareAppConfigInput, defineApp, isCloudflareAppConfig, type ResourceContext } from './authoring';
2
+ export { type ApplicationWorkerOptions, type CloudflareAppConfig, type CloudflareAppConfigInput, defineApp, isCloudflareAppConfig, type ResourceContext, } from './authoring';
3
3
  export { assertGeneratedConfigs, assertGeneration, generateWranglerConfigs } from './bounds';
4
4
  export type { ConfigGeneration, DeploymentBounds, GeneratedResource } from './bounds';
5
5
  export { parseCloudflareArgs, platformComponents } from './cli-args';
@@ -12,7 +12,7 @@ export { cloudflareStoredTargetCodec, createCloudflareControlProvider } from './
12
12
  export type { CloudflareCloneSource, CloudflareControlOptions, CloudflareRunnerJob, CloudflareStoredTarget } from './control';
13
13
  export { buildPlan, findMigratableDatabases, PLATFORM_RESOURCE_NAMES } from './plan';
14
14
  export type { CloudflareStep, CloudflareStepKind, MigratableDatabase } from './plan';
15
- export { type CloudflareDeployerOptions, type CloudflareDeployResult, type CloudflareDeployRun, createCloudflareDeployer } from './provider';
16
- export { createCloudflareProxyWorker, IAM_APPLICATION_ENTRYPOINT, iamServiceReference } from './proxy';
15
+ export { type CloudflareDeployerOptions, type CloudflareDeployResult, type CloudflareDeployRun, composeLocalApplication, createCloudflareDeployer, type LocalApplicationOptions, type StagedLocalAssets, stageLocalAssets, } from './provider';
16
+ export { createCloudflareProxyWorker, IAM_APPLICATION_ENTRYPOINT, iamServiceReference, proxyManifestJson } from './proxy';
17
17
  export type { CloudflareProxyWorkerOptions } from './proxy';
18
18
  export { type AppSchemaParse, parseAppSchema } from './schema';
@@ -0,0 +1,19 @@
1
+ import type { ProviderManagedEnvironment } from '@fabrika/provider-contract';
2
+ export interface ManagedSplit {
3
+ readonly vars: Readonly<Record<string, string>>;
4
+ readonly secrets: Readonly<Record<string, string>>;
5
+ }
6
+ /** The values a deploy writes: a credential as a Worker secret, any other as a plain var; a null value is not written. */
7
+ export declare const splitManagedEnvironment: (managed: ProviderManagedEnvironment) => ManagedSplit;
8
+ /**
9
+ * Run `body` with the secrets in a JSON file only its owner reads, in a directory of its own, removed however `body`
10
+ * ends. `body` gets null when there is nothing to write.
11
+ */
12
+ export declare const withSecretsFile: <T>(secrets: Readonly<Record<string, string>>, body: (path: string | null) => Promise<T>) => Promise<T>;
13
+ /** The names `wrangler secret list --format json` printed. */
14
+ export declare const parseSecretNames: (stdout: string) => readonly string[];
15
+ /**
16
+ * The framework secrets a Worker still holds that this deploy no longer writes. Wider than `staleManagedVariables`: the
17
+ * executor writes no framework secret of its own, so any other one is stale.
18
+ */
19
+ export declare const staleManagedSecrets: (present: readonly string[], written: Readonly<Record<string, string>>) => readonly string[];
@@ -17,4 +17,5 @@ export declare const findMigratableDatabases: (worker: Worker) => MigratableData
17
17
  * one would take over the platform's own Worker, database or bucket.
18
18
  */
19
19
  export declare const PLATFORM_RESOURCE_NAMES: ReadonlySet<string>;
20
- export declare const buildPlan: (config: CloudflareAppConfig, worker: Worker) => readonly CloudflareStep[];
20
+ /** `regeneratesEntry`: the release pins the generated entry, so the build step always runs, after `pipeline.build`. */
21
+ export declare const buildPlan: (config: CloudflareAppConfig, worker: Worker, regeneratesEntry: boolean) => readonly CloudflareStep[];
@@ -1,7 +1,10 @@
1
- import { type AppEnvironment } from '@fabrika/auth-core';
1
+ import { type AppEnvironment, type ApplicationObjects, type ContractArtifact } from '@fabrika/auth-core';
2
2
  import { type DeployStepResult, type ProviderManagedEnvironment, type SchemaReconciler } from '@fabrika/provider-contract';
3
+ import { Worker } from 'oblaka-iac';
4
+ import type { CloudflareAppConfig } from './authoring';
3
5
  import { type CloudflareCollaborators } from './collaborators';
4
6
  import type { RunnerApprovedAccess } from './runner-protocol';
7
+ import { type AssetMount } from './spa-assets';
5
8
  export interface CloudflareDeployerOptions {
6
9
  readonly accountId: string;
7
10
  readonly apiToken: string;
@@ -27,6 +30,8 @@ export interface CloudflareDeployRun {
27
30
  readonly domain?: string;
28
31
  /** The environment's cross-origin list from Control's registry (ADR-0022); the proxy Worker's manifest entry lists it. */
29
32
  readonly crossOrigins?: readonly string[];
33
+ /** The origin of the environment's Operations ingest, from Control; the proxy Worker's `connect-src` admits it. */
34
+ readonly operationsOrigin?: string;
30
35
  /** Every origin IAM may hand this environment a session at, registered under `<app>@<env>`. */
31
36
  readonly returnOrigins?: readonly string[];
32
37
  readonly cwd: string;
@@ -43,6 +48,8 @@ export interface CloudflareDeployRun {
43
48
  readonly approved?: RunnerApprovedAccess;
44
49
  /** Every Cloudflare deployment of the installation in Control's registry; a name of another application is refused. */
45
50
  readonly installationApps?: readonly AppEnvironment[];
51
+ /** The serving object and the listed objects Control records (ADR-0070 §9); absent, `application` and `rehearsal`. */
52
+ readonly applicationObjects?: ApplicationObjects;
46
53
  readonly dryRun: boolean;
47
54
  readonly signal: AbortSignal;
48
55
  readonly log: (line: string) => void;
@@ -54,3 +61,33 @@ export interface CloudflareDeployResult {
54
61
  readonly steps: readonly DeployStepResult[];
55
62
  }
56
63
  export declare const createCloudflareDeployer: (options: CloudflareDeployerOptions) => (run: CloudflareDeployRun) => Promise<CloudflareDeployResult>;
64
+ /** The SPA files `stageLocalAssets` staged for a local run: the mounts it copied, in the order a deploy stages them. */
65
+ export interface StagedLocalAssets {
66
+ readonly mounts: readonly AssetMount[];
67
+ readonly files: number;
68
+ }
69
+ /**
70
+ * Stage the contract's SPA and link mounts for a local run, with the code a deploy stages them with: each mount's
71
+ * built directory under `root` into `root/fabrika/assets`, where the generated `wrangler.jsonc` beside the config points
72
+ * its `ASSETS`. Run it before oblaka generates the config (`await` at the top of `oblaka.ts`) and after the SPA build.
73
+ */
74
+ export declare const stageLocalAssets: (contract: ContractArtifact, root: string) => Promise<StagedLocalAssets>;
75
+ /** What `composeLocalApplication` needs: the config, the contract it serves, and the IAM a local run reaches. */
76
+ export interface LocalApplicationOptions {
77
+ readonly config: CloudflareAppConfig;
78
+ readonly contract: ContractArtifact;
79
+ /** What `stageLocalAssets` staged; required when the contract has an SPA or link mount and the Worker no `assets`. */
80
+ readonly assets?: StagedLocalAssets;
81
+ /** IAM's origin, the issuer of the local run's tokens. */
82
+ readonly iamOrigin: string;
83
+ readonly env: string;
84
+ readonly domain?: string;
85
+ }
86
+ /**
87
+ * The proxy Worker and the application Worker of a local run (`oblaka.ts`, lopata), composed by the code a deploy runs:
88
+ * the platform's proxy over the contract's endpoint table, and the application's object, files bucket and repair tick,
89
+ * as a release that serves alarms gets them. No deploy takes it. With no Control to write them, the framework values
90
+ * come from here, and the proxy secret, which a deploy uploads as a Worker secret, is drawn anew on each call and
91
+ * written as a variable into the ignored `wrangler.jsonc`.
92
+ */
93
+ export declare const composeLocalApplication: (options: LocalApplicationOptions) => Worker;
@@ -1,6 +1,7 @@
1
1
  import type { ProxyLogger } from '@fabrika/proxy-core';
2
2
  export interface CloudflareProxyEnv {
3
3
  readonly IAM?: unknown;
4
+ /** The manifest JSON the handler serves; the deployed Worker passes the one baked into its bundle. */
4
5
  readonly FABRIKA_PROXY_MANIFEST_JSON?: string;
5
6
  readonly FABRIKA_IAM_ISSUER?: string;
6
7
  readonly [binding: string]: unknown;
@@ -1,5 +1,7 @@
1
1
  import { type ContractProxyTable, type InstallationProxyTable } from '@fabrika/proxy-core/manifest';
2
2
  import { ServiceReference, Worker } from 'oblaka-iac';
3
+ /** A binding as oblaka configures it into a Worker's generated config. */
4
+ type Binding = Pick<ServiceReference, 'configureBinding'>;
3
5
  interface CloudflareProxyWorkerBase {
4
6
  /** Name of the proxy Worker before the environment prefix is applied by oblaka. */
5
7
  readonly name: string;
@@ -37,12 +39,31 @@ export type CloudflareProxyWorkerOptions = (CloudflareProxyWorkerBase & Cloudfla
37
39
  /** Where `createCloudflareProxyWorker` points its Worker: the deployer builds every application's proxy from here. */
38
40
  export declare const CLOUDFLARE_PROXY_WORKER_DIR: string;
39
41
  export declare const CLOUDFLARE_PROXY_WORKER_MAIN = "./proxy-worker.ts";
42
+ /**
43
+ * The identifier the proxy Worker's bundle reads its manifest from. The generated config's `define` replaces it with
44
+ * the manifest as a string literal when wrangler bundles the Worker, so the table has no Worker variable's 5 KB cap.
45
+ */
46
+ export declare const PROXY_MANIFEST_DEFINE = "__FABRIKA_PROXY_MANIFEST__";
47
+ /** The manifest JSON a proxy Worker built here carries, or null for any other Worker. */
48
+ export declare const proxyManifestJson: (worker: Worker) => string | null;
40
49
  /** IAM's Worker: the one platform service an application binds, and only through the entrypoint below. */
41
50
  export declare const IAM_SERVICE = "propustka-worker";
42
51
  /** IAM's narrow `WorkerEntrypoint`, which carries neither key issuing nor device approval (`packages/iam/src/index.ts`). */
43
52
  export declare const IAM_APPLICATION_ENTRYPOINT = "PropustkaApplication";
44
53
  /** The `IAM` binding of an application Worker; a generated config that binds IAM any other way is refused. */
45
54
  export declare const iamServiceReference: () => ServiceReference;
55
+ /**
56
+ * The deployer's `IAM` binding: what the Worker declared, with the IAM service entry's `props` naming the deployment's
57
+ * IAM application id. IAM reads it as `ctx.props.app`, the transport identity of a call over the binding, as the
58
+ * membership transport key is over HTTP (ADR-0067 §3). An application cannot choose it: the deployer writes it, and the
59
+ * bounds refuse an IAM binding that names any other application.
60
+ */
61
+ export declare class IamApplicationReference implements Binding {
62
+ private readonly app;
63
+ private readonly declared;
64
+ constructor(app: string, declared?: Binding);
65
+ configureBinding(args: Parameters<Binding['configureBinding']>[0]): ReturnType<Binding['configureBinding']>;
66
+ }
46
67
  /**
47
68
  * Build the Cloudflare side of the accepted proxy topology: the public Worker owns the route and
48
69
  * binds the private application Worker. IAM remains a global service binding.