@sanoma-ai/connector-cloudflare 0.6.5 → 0.11.22
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/README.md +121 -27
- package/dist/connector.d.ts +7 -6
- package/dist/connector.js +5 -4
- package/dist/connector.js.map +1 -1
- package/dist/deploy.d.ts +11 -22
- package/dist/deploy.js +18 -10
- package/dist/deploy.js.map +1 -1
- package/dist/driver.d.ts +1 -1
- package/dist/driver.js +1 -1
- package/dist/driver.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/fake.d.ts +20 -9
- package/dist/fake.js +63 -40
- package/dist/fake.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ops.d.ts +26 -23
- package/dist/ops.js +73 -67
- package/dist/ops.js.map +1 -1
- package/dist/records.d.ts +1 -1
- package/dist/records.js +1 -1
- package/dist/records.js.map +1 -1
- package/dist/registry.js +1 -1
- package/dist/registry.js.map +1 -1
- package/dist/resources.d.ts +4 -4
- package/dist/steps.d.ts +1 -1
- package/dist/steps.js +1 -1
- package/dist/steps.js.map +1 -1
- package/package.json +4 -6
- package/worker/instance.d.ts +1 -1
- package/worker/instance.js +53 -17
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @sanoma-ai/connector-cloudflare
|
|
2
2
|
|
|
3
|
-
[Cloudflare Containers](https://developers.cloudflare.com/containers/) as a host that stops when
|
|
3
|
+
[Cloudflare Containers](https://developers.cloudflare.com/containers/) as a host that stops when its worker is idle, and its [Durable Object](https://developers.cloudflare.com/durable-objects/)'s [alarm](https://developers.cloudflare.com/durable-objects/api/alarms/) as the wakeup that starts it again, for [`sanoma/workflows`](https://github.com/Sanoma-AI/sanoma/blob/main/packages/sanoma/workflows/README.md). Both are one Worker per company, `sanoma-<name>`, on the account's workers.dev subdomain. And a set of [DNS records](#dns-records) in one of the account's zones, such as the ones a sending domain asks for.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
npm install @sanoma-ai/connector-cloudflare
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
The four types are writable: `read` and `import` (effect `read`), and the change operations only the apply workflow may call, `plan` (effect `read`), `create`, `update` and `delete` (effect `write`). The host is a host ([Hosts](https://github.com/Sanoma-AI/sanoma/blob/main/packages/workflows/README.md#hosts)) and the alarm a wakeup, with one more operation, `register`, which the worker calls. `container` is the host's earlier form, deprecated, the same Worker with every field declared:
|
|
11
|
+
The four types are writable: `read` and `import` (effect `read`), and the change operations only the apply workflow may call, `plan` (effect `read`), `create`, `update` and `delete` (effect `write`). The host is a host ([Hosts](https://github.com/Sanoma-AI/sanoma/blob/main/packages/sanoma/workflows/README.md#hosts)) and the alarm a wakeup, with one more operation, `register`, which the worker calls. `container` is the host's earlier form, deprecated, the same Worker with every field declared:
|
|
12
12
|
|
|
13
13
|
| Type | Operations | Import id |
|
|
14
14
|
| ----------- | ----------------------------------------------------------------------------------------- | --------------- |
|
|
@@ -33,7 +33,7 @@ export const host = cloudflare.host({
|
|
|
33
33
|
export const wakeup = cloudflare.alarm({ host });
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
Apply gives the host the rest before it plans (`deriveHosts` in
|
|
36
|
+
Apply gives the host the rest before it plans (`deriveHosts` in `sanoma/workflows`), and a data file never writes it:
|
|
37
37
|
|
|
38
38
|
| Derived | From |
|
|
39
39
|
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -70,13 +70,13 @@ The plan then binds `#host.sourceKey` from `#deployKey` and updates the host in
|
|
|
70
70
|
|
|
71
71
|
`cloudflare.container`, deprecated, declares every field itself: `image`, `source`, `ref`, `port`, `secrets` (each a `secret(...)`) and `domains` (by site name). Workflows that make a host for each of several companies (Sanoma Cloud's) call its operations with those fields filled.
|
|
72
72
|
|
|
73
|
-
The host's outputs are `{ url, wakeUrl, revision, healthy }` (`wakeUrl` its `worker_url`). Its capabilities: stops
|
|
73
|
+
The host's outputs are `{ url, wakeUrl, revision, healthy }` (`wakeUrl` its `worker_url`). Its capabilities: stops on exit (`stops-on-exit`), a public URL, it runs an image rather than building one, no fixed egress. `healthy` is the application existing and the Worker answering `/__sanoma/health`, which does not start a stopped container: a stopped host is healthy, and a read or a drift check leaves it stopped.
|
|
74
74
|
|
|
75
75
|
An explicit `host.update` or `container.update` waits for startup readiness even when the desired fields are unchanged. It starts a stopped container and checks the source and configuration revisions before returning success, so retrying an upload whose startup failed cannot succeed from bindings alone. This unchanged update uploads no Worker or secret values. Reads and plans remain non-starting; a plan with no changes does not perform this readiness check.
|
|
76
76
|
|
|
77
77
|
`configurationRevision` participates in plans and reads. Change it when delivering new secret values without changing the source or image; for example, a managed lifecycle can derive it from its deployment and credential generation (`d1-g2`). The connector sends it as the reserved plain-text binding `SANOMA_CONFIG_REVISION`, and startup waits for that configuration revision as well as the source revision. It must contain no secret value. Secret values remain write-only: changing a stored value alone with the same configuration revision is not detected by a plan.
|
|
78
78
|
|
|
79
|
-
The alarm's field is `host`, the container it wakes (its URL); its state is `{ host, at, rang, healthy }`, the wake it holds, when its alarm last rang the host's `/wake` for it, and whether the host's Worker took the company's token. Its optional `token`, a `secret("NAME")`, names the secret that holds the host's wakeup token, by default `SANOMA_WAKEUP_TOKEN`: a workflow that makes a host and its alarm for each of several companies, outside any data file, gives each its own (`token: secret("CLOUD_ACME_WAKEUP_TOKEN")`, the secret the host's `secrets` give as `SANOMA_WAKEUP_TOKEN`). `create` mints the token there when none is stored, and its state then carries the name as `token`, so a `read`, `update` or `delete` given that state sends the same token; one given only an id uses the default. A data file leaves `token` out: apply reads and deletes an alarm by its id alone, so `plan` refuses another name. `register` takes `{ at }`, an ISO 8601 time, which replaces the wake the Worker held: a wake is "resume if stopped", so one that rings late, twice or for a replaced registration starts a worker that finds nothing to do and stops again. It names no host: on the host,
|
|
79
|
+
The alarm's field is `host`, the container it wakes (its URL); its state is `{ host, at, rang, healthy }`, the wake it holds, when its alarm last rang the host's `/wake` for it, and whether the host's Worker took the company's token. Its optional `token`, a `secret("NAME")`, names the secret that holds the host's wakeup token, by default `SANOMA_WAKEUP_TOKEN`: a workflow that makes a host and its alarm for each of several companies, outside any data file, gives each its own (`token: secret("CLOUD_ACME_WAKEUP_TOKEN")`, the secret the host's `secrets` give as `SANOMA_WAKEUP_TOKEN`). `create` mints the token there when none is stored, and its state then carries the name as `token`, so a `read`, `update` or `delete` given that state sends the same token; one given only an id uses the default. A data file leaves `token` out: apply reads and deletes an alarm by its id alone, so `plan` refuses another name. `register` takes `{ at }`, an ISO 8601 time, which replaces the wake the Worker held: a wake is "resume if stopped", so one that rings late, twice or for a replaced registration starts a worker that finds nothing to do and stops again. It names no host: on the host and off it, it sends to the host's URL that the default token's `alarm.create` stored as `SANOMA_HOST_URL` beside the token, never the process environment's. A `plan` that finds another URL stored there, or none, is an `update` that stores the alarm's again. A runtime whose data files declare no wakeup, but whose environment has both `SANOMA_HOST_URL` and `SANOMA_WAKEUP_TOKEN` (a host Sanoma Cloud made), registers at the same route itself, with no connector call (`envWakeup` in `sanoma/workflows`).
|
|
80
80
|
|
|
81
81
|
The logo is Cloudflare's cloud from [Simple Icons](https://simpleicons.org/?q=cloudflare) (CC0), there only to identify the service an operation calls.
|
|
82
82
|
|
|
@@ -97,7 +97,9 @@ The object runs the company's worker in its container and never sees a visitor's
|
|
|
97
97
|
- at the alarm, starts the container and calls its `/wake`, then notes when (`rang`); a failure throws, so Cloudflare rings the alarm again;
|
|
98
98
|
- over RPC, `startNow()`: sets the alarm now, unless one is due sooner, and the alarm starts the container without the caller waiting and sends it `/wake`; a wake held for later is set again once the start is made, and one that rang never rings twice.
|
|
99
99
|
|
|
100
|
-
A container that ended reports how once (`exit`, a 503), so a deploy waiting on it stops rather than starting it again.
|
|
100
|
+
A container that ended before it answered reports how once (`exit`, a 503), so a deploy waiting on it stops rather than starting it again.
|
|
101
|
+
|
|
102
|
+
The worker decides when the container stops; the object only starts it. Once nothing runs, nothing is queued and nothing is due within a minute, the worker registers its next deadline at `/__sanoma/wake`, stops, and `sanoma worker` exits 0 (its environment names the Worker's wake route, `SANOMA_HOST_URL`, so it knows something starts it again); the container ends with its process, and the object, its storage and its alarm stay. A container that answered and then ended is stopped, not a failed start: health says `running: false`, and the next start or wake starts it again, paying the cold start. A scheduled wake costs the start, the work and about a minute. A wake that comes while the worker is stopping wins, and the worker carries on; one that finds the process gone fails, so the alarm rings again and starts a fresh container. A deploy's bundle being built keeps the process up until it is built. The object sets the container's inactivity timeout to Cloudflare's maximum, six hours, so the platform never decides: work inside the container is not a request to the object, so a run that keeps the worker busy runs to its end, up to six hours after the object's last request.
|
|
101
103
|
|
|
102
104
|
The application is of the `durable_object` scheduling policy (public beta, the one Cloudflare documents for new applications; it refused `default` on the account the connector was first run on): the object starts its container, with the image and the instance type it names, so the application is only a name and the object's namespace, and has no image, versions or rollouts. The policy is fixed once an application is made: one of the `default` policy under that name is deleted by hand before the apply. A Worker of that name that is not Sanoma's (no `SANOMA_INSTANCE` binding) reads as gone, and a create or a delete refuses to touch it.
|
|
103
105
|
|
|
@@ -105,20 +107,111 @@ The application is of the `durable_object` scheduling policy (public beta, the o
|
|
|
105
107
|
|
|
106
108
|
A create, in Wrangler's order, copies and pins the image and waits until Cloudflare prepared it ([The image](#the-image)), makes or updates the [database's config](#the-database), and, the first time, uploads the Worker without an app (`no-app.js`) with the object's migration (`new_sqlite_classes`) and its class as a container's with that image (`containers: [{ name, class_name, images: { runtime } }]`), turns its workers.dev URL on, makes the application for the object's namespace (`{ name, scheduling_policy: "durable_object", durable_objects: { namespace_id } }`), and uploads that Worker once more: the object learns which application backs its namespace only from a deployment made after the application exists (without it every start answers "There is no container application assigned to this Durable Object namespace", found on the first real deploy, 2026-10-29). Then every create and update deploys in three steps:
|
|
107
109
|
|
|
108
|
-
1. **The bundle.** `GET /__sanoma/app-bundle?revision=R` on the workers.dev URL with the instance token, asked every poll:
|
|
110
|
+
1. **The database and the bundle.** The Worker at R is uploaded first (R's bindings and image, this package's `index.js` and `instance.js`), serving visitors what they are served now: the app deployed, its modules read back (`GET …/scripts/{name}/content/v2`), its compatibility date and flags and its assets kept (`keep_assets`), untagged; a Worker that never served an app gets `no-app.js`. Once that version is [live](#live-before-asked), `GET /__sanoma/app-bundle?revision=R` on the workers.dev URL with the instance token, asked every poll: its object drains a container at another revision or image (SIGTERM, thirty seconds, then destroyed) and starts one at `R` (202, unmarked), whose worker prepares the database at its start (R's migrations) before its port answers, then checks out `R` and builds the app bundle for `workerd` (`sanoma/app`'s `AppBundle`: its modules, its assets, its compatibility date and flags), answering 202 until it is built, then 200 with it, each answer marked `x-sanoma-app-bundle`. The database moves before the app: the app on the Worker never migrates and refuses a database without its migrations, while a database a newer release migrated serves the app deployed. So the container deployed never builds it, though it may run the declared image: R's app would go live over R-1's database, and answer every request that opens it 500 until the restart (found live on 2026-11-07, a release adding a migration). An answer without the uploaded version's id is an earlier version's, asked again whatever its status, and an `exit` (R's worker ends at startup) is a refusal. A marked answer other than 200 or 202 (a failed build, a revision the route refuses) is a refusal. Anything else (no answer, an error of Cloudflare's, a body cut off, a workers.dev URL not routed yet) is asked again; one ask may take the whole budget, as a bundle is large. The bundle has its own budget, `startTimeoutMs` (ten minutes): still none after it fails the apply retryably, "still building the app bundle at R after 600 s", saying what the last ask saw. Its assets (the client build and the prerendered pages) then go in through an [assets upload session](https://developers.cloudflare.com/workers/static-assets/direct-upload/) (`POST …/scripts/{name}/assets-upload-session { manifest }`, then each bucket it asks for, one after another, to `POST …/workers/assets/upload?base64=true` with the session's jwt).
|
|
109
111
|
2. **One upload.** The Worker is uploaded once with everything: `index.js`, `instance.js` and the bundle's modules under `app/`, its compatibility date and flags, the bindings (the declared ones, the namespace, `CF_VERSION_METADATA`, `DATABASE` as Hyperdrive, `ASSETS`), `assets: { jwt, config }` (`run_worker_first: ["/*", "!/assets/*"]`, the client build straight from the assets; `html_handling` and `not_found_handling` `none`) and its version tagged with `R` (`annotations: { "workers/tag": R }`). From here visitors get the new app. Then the missing domains are attached, and the upload is waited for until it is [live](#live-before-asked).
|
|
110
|
-
3. **The restart.** `GET /__sanoma/health?start=1` with the token, asked every poll until the object answers 200 at `R` and the configuration revision: the
|
|
112
|
+
3. **The restart.** `GET /__sanoma/health?start=1` with the token, asked every poll until the object answers 200 at `R` and the configuration revision: the container the bundle's ask started at `R` is kept, and one at another revision or image (a deploy cut off, a container stopped meanwhile) is drained and started again at `R`. Its own budget, the same `startTimeoutMs`: still not after it fails the apply retryably, "still starting at R after 600 s". The step is idempotent: the next apply plans none, and an explicit update whose plan is none runs it alone, uploading nothing.
|
|
111
113
|
|
|
112
114
|
### Live before asked
|
|
113
115
|
|
|
114
116
|
An upload takes a while to reach every Cloudflare location, and until then the version before answers (on a new Worker, workers.dev's 404). After its last upload before a step asks the object, a deploy asks `GET /__sanoma/health`, without `start` so an earlier version starts nothing, every poll until the object answers with the uploaded version's id in `x-sanoma-deployment`, within the step's `startTimeoutMs`: any other answer, a 401, a 404 or a 503 among them, is "not yet", never "stale". The step's own asks then count only that version's answers.
|
|
115
117
|
|
|
116
|
-
No step answers a visitor 503 or an error: the app deployed answers until the upload of the new one, while R's container builds
|
|
118
|
+
No step answers a visitor 503 or an error: the app deployed answers until the upload of the new one, while R's container prepares the database and builds the bundle, and the new one after it, over a database with its migrations, and neither needs the container; only a Worker that never served an app answers `no-app.js`. A domain declared before and no longer is detached before the first upload of R's bindings, while they still record it, and a missing one attached once the upload with the app records it: whatever fails in between, none is left attached and unrecorded. A plan compares the version's tag with the revision, so a deploy that ended between its two uploads (the app deployed still served under R's bindings, untagged) plans an update, and one whose version was not tagged (a deploy before tags) plans one once. A built-in workflow's runs on R-1 carry to R when its code is unchanged (`builtInCode` in `sanoma/workflows`), so the restart strands none of them. A plan compares secret binding names, never values: the Worker's settings never show them. Advance `configurationRevision` to upload rotated values and restart a running container with them; a value change alone does not trigger an update. A delete detaches the custom domains the Worker was declared to serve (its `hostname` too), deletes the application, the Worker with its object's storage, then the database's config.
|
|
117
119
|
|
|
118
120
|
## The database
|
|
119
121
|
|
|
120
122
|
Every host needs `SANOMA_DATABASE_URL` among its secrets: a create or an update without it, or with a URL that is not `postgres://` or `postgresql://`, is refused before anything changes, and the error never shows the URL. The container keeps the direct URL in its environment. The app on the Worker reaches the database through a [Hyperdrive](https://developers.cloudflare.com/hyperdrive/) config of the Worker's name, one per host, made or updated at every deploy from the URL (`{ scheme, host, port, database, user, password }`, port 5432 unless the URL names one, user and password decoded) with query caching off, `caching: { disabled: true }`: the app's reads must see its own writes. The upload binds it as `DATABASE`, whose `connectionString` the app connects with. Hyperdrive must reach the database from Cloudflare's network: a host on `localhost` or a private address is refused by Cloudflare at the config's write. The token needs Hyperdrive Edit.
|
|
121
123
|
|
|
124
|
+
## Secrets
|
|
125
|
+
|
|
126
|
+
A host's secrets are read-only startup values. Apply resolves them on the machine that applies it, the Worker holds them, and the container receives them when it starts. Nothing on the host writes them back, and they are not a secret store.
|
|
127
|
+
|
|
128
|
+
**What the host is given.** A `cloudflare.host` is given its `secrets` by apply ([Hosts](https://github.com/Sanoma-AI/sanoma/blob/main/packages/sanoma/workflows/README.md#hosts)), as markers, never values:
|
|
129
|
+
|
|
130
|
+
| Under | From |
|
|
131
|
+
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
132
|
+
| `SANOMA_DATABASE_URL` | The declared `database`'s URL |
|
|
133
|
+
| `SANOMA_SIGNING_KEY` | The config's `SANOMA_SIGNING_KEY` binding (`{ bootstrap }` or `{ env }`), else a key of the host's own, generated at its create |
|
|
134
|
+
| `SANOMA_SECRETS_KEY` | The config's binding of it, only with the built-in store |
|
|
135
|
+
| `SANOMA_WAKEUP_TOKEN`, `SANOMA_SOURCE_KEY` | The wakeup's token, and the deploy key it clones a private repository with |
|
|
136
|
+
| Its vendors' credentials | Those stored on the connector pages of its data file's vendors, its repository's and the sign-in sender's, so it can deploy itself (`CLOUDFLARE_API_TOKEN` among them when it is stored), and the company's GitHub App keys that are stored |
|
|
137
|
+
| Each `{ env, host: true }` binding | That binding's value, under its variable's name: `PROVISIONING: { env: "SANOMA_PROVISIONING_CREDENTIAL", host: true }` is given as `SANOMA_PROVISIONING_CREDENTIAL` |
|
|
138
|
+
|
|
139
|
+
A `host: true` binding whose variable has no value is refused before the deploy. A variable the driver reads from this machine's environment with no binding is a problem the plan names, since the host would not be given it. A `{ path }` binding is never delivered: it is read from the store.
|
|
140
|
+
|
|
141
|
+
**How they reach the Worker.** The driver resolves each marker through the applying runtime's own bindings, so a `SANOMA_SECRETS_KEY_FILE` there is read on that machine and the host receives the key's value, never the path. The [one upload](#the-deploy) binds each as `secret_text`, beside the non-secret `plain_text` bindings (`SANOMA_REVISION`, `SANOMA_CONFIG_REVISION`, `SANOMA_HOST_URL`, `SANOMA_DOMAINS` and the rest). Cloudflare keeps them encrypted and shows their names, never their values, so a plan compares names only. The app on the Worker reads them as its environment (`nodejs_compat` fills `process.env` from the text bindings), and its database through the `DATABASE` binding, not the URL.
|
|
142
|
+
|
|
143
|
+
**How they reach the container.** The object starts the container with the Worker's text bindings, plain and secret, as its environment, and `sanoma worker` there resolves the company's bindings from it: an `{ env }` binding reads that variable, a `{ bootstrap }` binding the key. The process keeps its startup environment: a changed value reaches it only at its next start. To roll out a changed value, advance `configurationRevision` and apply the host: the upload carries the new values and the restart starts a container with them. A value changed alone plans no update.
|
|
144
|
+
|
|
145
|
+
**Mounted files.** `SANOMA_SIGNING_KEY_FILE` and `SANOMA_SECRETS_KEY_FILE` name a file on the machine reading them. Neither is delivered: Cloudflare mounts no files into the container, and the app on the Worker refuses a `_FILE` input, as `workerd` has no file system. Use them on the applying machine or a host of your own.
|
|
146
|
+
|
|
147
|
+
**Read-only.** On the host, a value from the environment or a bootstrap binding cannot be replaced or deleted through Sanoma: a write, a delete or an `ensure` of one fails `read_only`. A binding whose variable the host was not given reads as missing; it never falls back to the store's value of that name.
|
|
148
|
+
|
|
149
|
+
**In the environment is delivery, not encryption at rest.** Cloudflare encrypts Worker secrets at rest. In the running Worker and container they are plain values in the environment, readable by all code there: the app, the company's workflows, its sites' server code and the connectors' drivers. Deliver only what the host's runtime needs.
|
|
150
|
+
|
|
151
|
+
**Limits.** A Worker holds 128 variables on the Paid plan (64 on Free), secrets and plain text together, each at most 5 KB ([Workers limits](https://developers.cloudflare.com/workers/platform/limits/), page updated 2026-10-29).
|
|
152
|
+
|
|
153
|
+
### The token: deploying and running
|
|
154
|
+
|
|
155
|
+
`CLOUDFLARE_API_TOKEN` is management authority. A host's runtime needs none of it to read its own secrets, which arrive in its environment.
|
|
156
|
+
|
|
157
|
+
| Who | Needs |
|
|
158
|
+
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
159
|
+
| Apply of a host (here, or on the host) | Workers Scripts Edit, Workers Containers Edit, Hyperdrive Edit; Zone Read for `domains` and `hostname`; Zone → DNS → Edit on the zones of [DNS records](#dns-records) |
|
|
160
|
+
| The runtime on the host | None for its secrets, its wakeup's register or its wake route, which use `SANOMA_WAKEUP_TOKEN`. A host is given the API token only when it is stored for its vendor, so the host can deploy itself after a push |
|
|
161
|
+
| Anything here | Never Secrets Store Write or Secrets Store Read: Sanoma does not use the account's Secrets Store ([below](#the-account-secrets-store)) |
|
|
162
|
+
|
|
163
|
+
A host given the token holds it in its environment with everything else, so code on the host can deploy Workers with it. Give such a host a token scoped to the permissions above and this account. Without the token stored for `cloudflare`, the host is not given it, and deploys are applied from elsewhere.
|
|
164
|
+
|
|
165
|
+
### The account Secrets Store
|
|
166
|
+
|
|
167
|
+
Cloudflare's account-wide [Secrets Store](https://developers.cloudflare.com/secrets-store/) is not one of Sanoma's secret stores: there is no adapter for it. Cloudflare documents (pages read 2026-11-06):
|
|
168
|
+
|
|
169
|
+
- It is in open beta: one store per account, up to 100 production secrets per account, each value at most 65,536 bytes ([manage account secrets](https://developers.cloudflare.com/secrets-store/manage-secrets/), updated 2026-10-22).
|
|
170
|
+
- Once stored, a value cannot be read through the API or the dashboard; only a bound service reads it. Locally created secrets are kept unencrypted in `.wrangler/state` (same page).
|
|
171
|
+
- A Worker reads one through a `secrets_store_secret` binding (`store_id`, `secret_name`) with `await env.BINDING.get()`. The binding reads only; it has no write or delete ([Workers integration](https://developers.cloudflare.com/secrets-store/integrations/workers/), updated 2026-10-12; [script upload](https://developers.cloudflare.com/api/resources/workers/subresources/scripts/methods/update/) for the binding's type).
|
|
172
|
+
- Writing is management: `PATCH …/secrets_store/stores/{store_id}/secrets/{secret_id}` with `value`, `scopes` and `comment`, under the Secrets Store Write permission. Its result carries `created`, `modified` and `status`, and no version; the API documents no ETag or conditional write ([edit a secret](https://developers.cloudflare.com/api/resources/secrets_store/subresources/stores/subresources/secrets/methods/edit/)). Creating secrets needs the Super Administrator or Secrets Store Admin role, binding them Super Administrator or Secrets Store Deployer.
|
|
173
|
+
- A container receives a Secrets Store value only as the Worker passes it at the container's start, and keeps it until its next start ([containers' environment](https://developers.cloudflare.com/containers/examples/env-vars-and-secrets/), updated 2026-10-12).
|
|
174
|
+
|
|
175
|
+
Against the `SecretStore` contract this is a store that only a Worker's binding reads, that the container where workflows run cannot read, that cannot report a version for a read, and whose only write is an unconditional replace by a management token: `writable: false` at runtime, `conditionalWrites: "none"`, `changeDetection: "read"`. Such a store cannot keep credentials Sanoma writes (an OAuth refresh, a generated secret), which is what a store adapter is for, and a value it holds reaches the runtime only as a startup value, as a host's secrets already do. A method that writes its credentials is refused against a read-only binding or a store without conditional writes before anyone consents, on the connector page and by `sanoma check` ([Credentials](https://github.com/Sanoma-AI/sanoma/blob/main/packages/sanoma/workflows/README.md#credentials)), never kept somewhere else instead. The store's list (`GET …/secrets_store/stores`) answered on Sanoma's account on 2026-11-06 with no store; nothing was made there.
|
|
176
|
+
|
|
177
|
+
### Setups
|
|
178
|
+
|
|
179
|
+
**Supabase and Cloudflare, with the built-in store.** The company's database is Supabase Postgres; the built-in store encrypts credentials in it. Bind both keys as bootstrap and give the host the database:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
// sanoma.config.ts
|
|
183
|
+
secrets: {
|
|
184
|
+
bindings: {
|
|
185
|
+
SANOMA_SIGNING_KEY: { bootstrap: "SANOMA_SIGNING_KEY" },
|
|
186
|
+
SANOMA_SECRETS_KEY: { bootstrap: "SANOMA_SECRETS_KEY" },
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
// resources/infra.ts: `store` a declared `supabase.project`
|
|
193
|
+
export const host = cloudflare.host({ database: store });
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Apply gives the Worker `SANOMA_DATABASE_URL`, `SANOMA_SIGNING_KEY` and `SANOMA_SECRETS_KEY` as secrets, and the container receives them at its start. Back up the encryption key apart from the database: a database backup alone cannot decrypt the credentials.
|
|
197
|
+
|
|
198
|
+
**Supabase and Cloudflare, with Supabase Vault.** The [Vault adapter](../supabase/README.md#supabase-vault-as-the-secret-store) keeps and encrypts the credentials, so there is no `SANOMA_SECRETS_KEY`. Bind `SANOMA_SIGNING_KEY` as above, and deliver the adapter's scoped login to the host:
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
// sanoma.config.ts
|
|
202
|
+
secrets: {
|
|
203
|
+
store: supabaseVault(),
|
|
204
|
+
bindings: {
|
|
205
|
+
SANOMA_SIGNING_KEY: { bootstrap: "SANOMA_SIGNING_KEY" },
|
|
206
|
+
VAULT_LOGIN: { env: "SUPABASE_VAULT_DATABASE_URL", host: true },
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The login authenticates to the store, so it is a host secret, never a value in the store it unlocks.
|
|
212
|
+
|
|
213
|
+
**The account Secrets Store.** Not a setup Sanoma supports, for the reasons above. Keep the company's credentials in the built-in store or Supabase Vault, and what the host's runtime needs at its start as host secrets. Sanoma reads nothing from the account store and copies nothing into it.
|
|
214
|
+
|
|
122
215
|
## The image
|
|
123
216
|
|
|
124
217
|
A container of the `durable_object` policy runs an image of its own account's registry pinned by digest, `registry.cloudflare.com/<account id>/<repository>@sha256:<digest>`, never a tag, which Cloudflare stores and pulls without a limit (Docker Hub's pulls are not cached and are limited per address). So a create or an update first copies the declared image there and pins the copy by its manifest's digest, and the object starts that: `ghcr.io/sanoma-ai/runtime:0.8.1` becomes `registry.cloudflare.com/<account id>/sanoma-ai-runtime@sha256:…` (the path with `-` for `/`, copied as `:0.8.1`). An image in the account's registry by a tag is not copied: its manifest's digest is asked for (`docker-content-digest`); one there pinned by digest runs as it is, with no registry request. The copy is registry to registry in Node, no Docker: the source pulled anonymously (a public image; the token its registry's challenge names), the target pushed to with temporary credentials from `containers.registries.credentials.generate` (push and pull, an hour, never stored or logged). Each blob the account lacks is streamed across in one request of its known length, then the manifest, unchanged; when the account's manifest for that tag already has the source's digest, nothing is copied, and a digest-pinned source must answer that digest. Docker Hub is not copied from: declare `ghcr.io/sanoma-ai/runtime`. The source must be one image manifest (OCI or Docker v2), not an index: the release pushes one (`provenance: false`). Then the account prepares the pinned image to run (`POST …/containers/image-preparations { image }`, `containers.images.prepare`), asked again every two seconds until it is `ready`, as Wrangler does: an `error` fails the apply with Cloudflare's `reason`, not retryable, and fifteen minutes without `ready` fails it as retryable. Both come before the upload, so a copy or a preparation that fails leaves the Worker as it was.
|
|
@@ -130,9 +223,9 @@ The Worker's `SANOMA_IMAGE` binding holds the declared image and its upload the
|
|
|
130
223
|
1. **The connector.** Add `cloudflare` to the connectors in `sanoma.config.ts`: the worker on the host calls `cloudflare.alarm.register` through it.
|
|
131
224
|
2. **Credentials.** On the connector's page, `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` (below).
|
|
132
225
|
3. **Go live.** `infra.ts` declares the host and, after it, `export const wakeup = cloudflare.alarm({ host })`: apply mints `SANOMA_WAKEUP_TOKEN` when none is stored and gives it to the host. One apply makes the Worker, waits for it, then the alarm, which checks the Worker holds the token.
|
|
133
|
-
4. **A sleeping run.** Start a workflow that sleeps
|
|
226
|
+
4. **A sleeping run.** Start a workflow that sleeps for a few minutes. Before its process exits the worker registers the sleep's end; at `at` the object's alarm starts the container and calls `/wake`, and the run continues.
|
|
134
227
|
|
|
135
|
-
|
|
228
|
+
Without the `wakeup` line (from a `cloudflare.container`, its `SANOMA_WAKEUP_TOKEN` too) it still scales to zero: the token stays among the Worker's secrets (apply mints one when none is declared: the bundle and restart routes need it), so the runtime registers with the Worker's wake route itself (`envWakeup`), as a Sanoma Cloud company's does, and exits once idle all the same.
|
|
136
229
|
|
|
137
230
|
## Custom domains
|
|
138
231
|
|
|
@@ -142,7 +235,7 @@ Each hostname in `domains` is attached to the Worker as a [Workers custom domain
|
|
|
142
235
|
|
|
143
236
|
## DNS records
|
|
144
237
|
|
|
145
|
-
`cloudflare.records({ zone, name, records })` is a set of DNS records in one of the account's zones, compared as a set, in no order. A sending domain's records are the case it is made for: `records` names a declared `resend.domain`, whose `dns_records` it then takes ([a field taken from another resource's state](https://github.com/Sanoma-AI/sanoma/blob/main/packages/workflows/README.md#resources)), or is a list written out.
|
|
238
|
+
`cloudflare.records({ zone, name, records })` is a set of DNS records in one of the account's zones, compared as a set, in no order. A sending domain's records are the case it is made for: `records` names a declared `resend.domain`, whose `dns_records` it then takes ([a field taken from another resource's state](https://github.com/Sanoma-AI/sanoma/blob/main/packages/sanoma/workflows/README.md#resources)), or is a list written out.
|
|
146
239
|
|
|
147
240
|
```ts
|
|
148
241
|
// resources/infra.ts
|
|
@@ -153,12 +246,12 @@ export const mail = resend.domain({ name: "sanoma.work" });
|
|
|
153
246
|
export const mailDns = cloudflare.records({ zone: "sanoma.work", name: "resend", records: mail });
|
|
154
247
|
```
|
|
155
248
|
|
|
156
|
-
| Field | What it is
|
|
157
|
-
| ----------------------- |
|
|
158
|
-
| `zone` | The zone's name, as the account holds it (`sanoma.work`); changing it replaces the set
|
|
159
|
-
| `name` | The set's label (`resend`): lower case letters, digits, `-` and `_`. Its identity is `<zone>/<name>`; changing it replaces the set
|
|
160
|
-
| `records` | The records, at least one: `{ type, name, content, priority?, ttl? }` each (`dnsRecord` from
|
|
161
|
-
| `zone_id`, `record_ids` | Cloudflare's: the zone's id, and each record's, in the order of `records` as a read gives them
|
|
249
|
+
| Field | What it is |
|
|
250
|
+
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
251
|
+
| `zone` | The zone's name, as the account holds it (`sanoma.work`); changing it replaces the set |
|
|
252
|
+
| `name` | The set's label (`resend`): lower case letters, digits, `-` and `_`. Its identity is `<zone>/<name>`; changing it replaces the set |
|
|
253
|
+
| `records` | The records, at least one: `{ type, name, content, priority?, ttl? }` each (`dnsRecord` from `sanoma/workflows`): TXT, MX, CNAME or CAA, the full name in lower case (the zone's name or one ending in it), a TXT record's text unquoted, a priority for MX, a ttl in seconds (1, automatic, when left out). One type, name and content declared twice with another ttl or priority, a name outside the zone, or a CNAME declared beside another record of its name, or two SPF policies (`v=spf1` TXT records) declared at one name, is refused, `invalid` |
|
|
254
|
+
| `zone_id`, `record_ids` | Cloudflare's: the zone's id, and each record's, in the order of `records` as a read gives them |
|
|
162
255
|
|
|
163
256
|
**Ownership.** Every record the set writes carries the comment `sanoma:<zone>/<name>` (`sanoma:sanoma.work/resend`), in that case exactly, which is how a read finds its records (`GET /zones/{id}/dns_records?comment.exact=`): the set is the records that carry it, and none is gone. A record's comment holds 100 characters on a Free zone, so a set whose mark is longer is refused, `invalid`. A record without that comment is never changed or deleted, whoever added it, with one exception: a record identical to a declared one in type, name and content, and an MX record's priority (one added by hand before the set was declared), is adopted, patched to carry the comment and the declared ttl; so is one a changed record would be patched to, whose marked one is then deleted. An adopted record is the set's from then on: it carries the mark, so it changes with the set and is **deleted with it**, and the comment it had is replaced by the mark (the set finds its records by the exact comment, so it keeps no other). A record in the way of a declared one is refused, `conflict`, naming it, before anything is written, whether the declared one is to be posted or a marked one patched to it: a CNAME at the name (or a declared CNAME beside any record), another SPF policy (a `v=spf1` TXT) at the name, an MX record to the same server at another priority, a record identical to a declared one that another set's comment marks, or one identical to it that is proxied (a set's records are DNS only, and adopting it would turn its proxy off). Every page of a lookup is read, so a busy name hides nothing.
|
|
164
257
|
|
|
@@ -170,7 +263,7 @@ export const mailDns = cloudflare.records({ zone: "sanoma.work", name: "resend",
|
|
|
170
263
|
|
|
171
264
|
## Driver
|
|
172
265
|
|
|
173
|
-
`@sanoma-ai/connector-cloudflare/driver` calls Cloudflare through its official SDK, [`cloudflare`](https://www.npmjs.com/package/cloudflare) (Stainless), with its own retries off (the runtime retries what is retryable), and calls the company's Worker with `fetch`. The `cloudflare` connector the package root exports carries it and its fake (`withSetup` from
|
|
266
|
+
`@sanoma-ai/connector-cloudflare/driver` calls Cloudflare through its official SDK, [`cloudflare`](https://www.npmjs.com/package/cloudflare) (Stainless), with its own retries off (the runtime retries what is retryable), and calls the company's Worker with `fetch`. The `cloudflare` connector the package root exports carries it and its fake (`withSetup` from `sanoma/workflows`), so a config names the connector alone and workflows never import the driver (the lint refuses that).
|
|
174
267
|
|
|
175
268
|
`./driver` (`cloudflareDriver`; `cloudflareDriver({ timeoutMs, startTimeoutMs, pollMs })`: 30 s a request, ten minutes for each of the deploy's waits (an upload live, the bundle, the restart), two seconds between tries; each request of the image's copy may take ten minutes) and `./fake` (`fakeCloudflare`) are internal entries, for tests.
|
|
176
269
|
|
|
@@ -185,7 +278,7 @@ It reads these on every call, never when the config loads:
|
|
|
185
278
|
| `CLOUDFLARE_API_TOKEN` | An API token with Workers Scripts Edit and Workers Containers Edit (Write, in the API's terms), Zone Read for `domains` (custom domains are attached and detached with Workers Scripts Edit) and DNS records, and Zone → DNS → Edit on the zones of [DNS records](#dns-records) |
|
|
186
279
|
| `CLOUDFLARE_ACCOUNT_ID` | The account's id, 32 hexadecimal digits, on its dashboard's overview |
|
|
187
280
|
|
|
188
|
-
When either is unset, a call fails, not retryable, naming it. The driver declares both in its `env` ([Credentials](https://
|
|
281
|
+
When either is unset, a call fails, not retryable, naming it. The driver declares both in its `env` ([Credentials](https://github.com/Sanoma-AI/sanoma/blob/main/packages/sanoma/workflows/README.md#credentials)): the worker starts without them, and the app's connector page shows their status and lets you set them. The alarm's operations need neither: they call the Worker with `SANOMA_WAKEUP_TOKEN` (`alarm.create` mints it when none is stored), and `alarm.create` stores `SANOMA_HOST_URL` once the host answered, replacing an earlier host's. `register` sends to the stored URL, beside the stored token, on the host as off it: it reads nothing from the process environment. A read without the token reads the alarm as unhealthy, so a plan to delete it still goes on.
|
|
189
282
|
|
|
190
283
|
### Errors and retries
|
|
191
284
|
|
|
@@ -197,11 +290,11 @@ Containers need the Workers Paid plan. An instance is billed while it runs, by i
|
|
|
197
290
|
|
|
198
291
|
### Testing the driver
|
|
199
292
|
|
|
200
|
-
`test/driver.test.ts`, `test/records.test.ts` and the features replay Cloudflare's replies (`test/fixtures`) with [
|
|
293
|
+
`test/driver.test.ts`, `test/records.test.ts` and the features replay Cloudflare's replies (`test/fixtures`) with [`sanoma/testing/replay`](https://github.com/Sanoma-AI/sanoma/blob/main/packages/sanoma/testing/README.md#replaying-a-vendors-api): `pnpm vitest run connectors/cloudflare` needs no account. The fixtures are **written from Cloudflare's API reference, not recorded**: no account was at hand when the connector was written. A recording replaces them (`SANOMA_LIVE=1 SANOMA_RECORD=1` on the features test), losing the account's id and subdomain, ids and tokens; until then, a reply the reference gets wrong is wrong here too. The upload's `containers` field (its `name`, `class_name` and `images`) is Wrangler's and not in the reference or the SDK's types, and the object's `ctx.container.images` and `start({ image, instance })` are the policy's: the live run is what checks them. The DNS records' fixtures (`records-*`) are written from the [DNS records reference](https://developers.cloudflare.com/api/resources/dns/subresources/records/) the same way, on `sanoma.work` with a set named `check` (`check-*.sanoma.work`), to be recorded on their first live run: Cloudflare's TXT content is quoted in them, which a read takes off. That Cloudflare shows a TXT record written unquoted with quotes is the reference's examples', not checked; a read compares it either way. The `sites` fixture's assets session and bucket upload are written from the [direct upload guide](https://developers.cloudflare.com/workers/static-assets/direct-upload/) and the SDK's types the same way, with the guide's example hash (sha256 over an asset's base64 and its extension, 32 hex digits) and each part's type from its extension; that Cloudflare takes them, and serves `/assets/*` before the Worker, is the live run's to check. The image's copy is tested against two small registries in this process (`test/registry.test.ts`), and the driver's call for its credentials over replies written from the SDK's types and the OCI distribution spec; that Cloudflare's registry takes the copy as written is what the live run checks. The driver tests only replay.
|
|
201
294
|
|
|
202
295
|
### Running it live
|
|
203
296
|
|
|
204
|
-
`test/live.ts`, run by hand, runs the Host and Wakeup kits against a real account, then prints how long a cold wake took (a request to a stopped container until it answers). It makes a Worker and a `durable_object` application named `sanoma-host-check` (`CLOUDFLARE_TEST_NAME` changes it), takes
|
|
297
|
+
`test/live.ts`, run by hand, runs the Host and Wakeup kits against a real account, then prints how long a cold wake took (a request to a stopped container until it answers). It makes a Worker and a `durable_object` application named `sanoma-host-check` (`CLOUDFLARE_TEST_NAME` changes it), takes a while (each stop waits for the idle worker to exit, about a minute after its last run), and deletes both at the end. It is what checks what the fixtures cannot: the copy and its pin by digest, the image's preparation, the upload's `containers[].images`, the application's body, the object's `start` with the `standard-1` instance type, and a deploy check's new image started by the object:
|
|
205
298
|
|
|
206
299
|
```sh
|
|
207
300
|
pnpm build
|
|
@@ -223,27 +316,28 @@ It needs:
|
|
|
223
316
|
|
|
224
317
|
## Steps and features
|
|
225
318
|
|
|
226
|
-
The connector carries steps for [scenarios](https://github.com/Sanoma-AI/sanoma/blob/main/packages/workflows/README.md#steps-a-connector-ships) (`cloudflareSteps`, attached with `withSetup`):
|
|
319
|
+
The connector carries steps for [scenarios](https://github.com/Sanoma-AI/sanoma/blob/main/packages/sanoma/workflows/README.md#steps-a-connector-ships) (`cloudflareSteps`, attached with `withSetup`):
|
|
227
320
|
|
|
228
321
|
| Keyword | Step | What it does |
|
|
229
322
|
| ------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
230
323
|
| Given | `a Cloudflare container for {string} at revision {string}` | Creates the company's container through `cloudflare.container.create`, its token generated, named `host` (`$host.state.url`) |
|
|
231
324
|
|
|
232
|
-
`features/cloudflare.feature` creates, reads, plans and deletes a container, and creates an alarm and registers with it, and `features/records.feature` creates a record set, reads it, plans it unchanged, updates it with a changed record and one dropped, and deletes it, on the fake and on the replies in `test/fixtures` (named after each scenario): `test/features.test.ts` runs them with [`describeFeatures`](https://github.com/Sanoma-AI/sanoma/blob/main/packages/testing/README.md#a-connectors-own-features). The package ships `features/`.
|
|
325
|
+
`features/cloudflare.feature` creates, reads, plans and deletes a container, and creates an alarm and registers with it, and `features/records.feature` creates a record set, reads it, plans it unchanged, updates it with a changed record and one dropped, and deletes it, on the fake and on the replies in `test/fixtures` (named after each scenario): `test/features.test.ts` runs them with [`describeFeatures`](https://github.com/Sanoma-AI/sanoma/blob/main/packages/sanoma/testing/README.md#a-connectors-own-features). The package ships `features/`.
|
|
233
326
|
|
|
234
327
|
## Testing
|
|
235
328
|
|
|
236
|
-
`@sanoma-ai/connector-cloudflare/fake` is an in-memory Cloudflare account, the fake the connector carries: each sandbox run makes one of its own. Its registry is in memory too: a copy records the image under its reference there and pulls nothing. Its custom domains are in `state.domains` (hostname, Worker and zone), each zone's DNS records in `state.dns`, by the zone's name (a test adds one by hand there; a batch is all or nothing, and refuses a record identical to one the zone holds (its type, content and priority) or one beside a CNAME, as Cloudflare does), and it holds every zone asked for unless `fakeCloudflare({ zones })` names the ones it holds. A copy pins the image by a made-up digest, and a preparation answers ready for an image pinned in its registry. Its Workers answer on ports of this machine, one per Worker name, and run the package's own object code over a `ctx` in this process: storage in memory, an alarm on a timer (again after a throw), `ctx.container.images` from the upload's `containers[].images`, and a container that runs what `start` returns for the image (the one its pinned copy was copied from) and revision it was started at (by default a stub that answers `/healthz` and `/wake`); `start` refuses an image the upload did not name or an instance type that is not Cloudflare's. An upload answers with its version's id (its object's `CF_VERSION_METADATA.id`), and is live at once, or after `fakeCloudflare({ propagation: N })` more requests to the version before (workers.dev's 404 for a new Worker), as Cloudflare's takes a while to reach every location; it then restarts the object over its new bindings and images: a new image starts the container again at the next request, as the object finds its label changed. Its settings and content give the latest upload back (its bindings, compatibility date and flags, version tag and modules), and an upload with `keep_assets` serves the assets of the version before. Its assets upload session asks, in one bucket, for the hashes `state.assets` lacks, and an upload that redeems the completion jwt keeps each path's hash on the Worker (`state.scripts[name].assets`, beside its `main_module`, `modules`, compatibility date and flags and `tag`). Its Hyperdrive configs are in `state.hyperdrives`, their passwords left out, and its `DATABASE` binding's `connectionString` is the direct URL. Its Workers run the package's own `serve` over the upload's modules, written to a folder and `app/index.js` imported from there; the bundle the container's worker answers is `fakeCloudflare({ bundle })`'s, by default `stubAppBundle`, a plain ES module that answers pages and `/healthz` and serves `/assets/`, since the real bundle is built for `workerd` (`nodejs_compat`, WebAssembly) and Node cannot import it.
|
|
329
|
+
`@sanoma-ai/connector-cloudflare/fake` is an in-memory Cloudflare account, the fake the connector carries: each sandbox run makes one of its own. Its registry is in memory too: a copy records the image under its reference there and pulls nothing. Its custom domains are in `state.domains` (hostname, Worker and zone), each zone's DNS records in `state.dns`, by the zone's name (a test adds one by hand there; a batch is all or nothing, and refuses a record identical to one the zone holds (its type, content and priority) or one beside a CNAME, as Cloudflare does), and it holds every zone asked for unless `fakeCloudflare({ zones })` names the ones it holds. A copy pins the image by a made-up digest, and a preparation answers ready for an image pinned in its registry. Its Workers answer on ports of this machine, one per Worker name, and run the package's own object code over a `ctx` in this process: storage in memory, an alarm on a timer (again after a throw), `ctx.container.images` from the upload's `containers[].images`, and a container that runs what `start` returns for the image (the one its pinned copy was copied from) and revision it was started at (by default `stubContainer`, a stub that answers `/healthz` and `/wake`); `start` refuses an image the upload did not name or an instance type that is not Cloudflare's. An upload answers with its version's id (its object's `CF_VERSION_METADATA.id`), and is live at once, or after `fakeCloudflare({ propagation: N })` more requests to the version before (workers.dev's 404 for a new Worker), as Cloudflare's takes a while to reach every location; it then restarts the object over its new bindings and images: a new image starts the container again at the next request, as the object finds its label changed. Its settings and content give the latest upload back (its bindings, compatibility date and flags, version tag and modules), and an upload with `keep_assets` serves the assets of the version before. Its assets upload session asks, in one bucket, for the hashes `state.assets` lacks, and an upload that redeems the completion jwt keeps each path's hash on the Worker (`state.scripts[name].assets`, beside its `main_module`, `modules`, compatibility date and flags and `tag`). Its Hyperdrive configs are in `state.hyperdrives`, their passwords left out, and its `DATABASE` binding's `connectionString` is the direct URL, beside the fake's own `prepared(revision)`: whether a container's worker at that revision started over the database (its `SANOMA_DATABASE_URL`), as each prepares it at its start. Its Workers run the package's own `serve` over the upload's modules, written to a folder and `app/index.js` imported from there; the bundle the container's worker answers is `fakeCloudflare({ bundle })`'s, by default `stubAppBundle`, a plain ES module that answers pages and `/healthz` and serves `/assets/`, and answers 500 while its database lacks its revision's migrations, since the real bundle is built for `workerd` (`nodejs_compat`, WebAssembly) and Node cannot import it.
|
|
237
330
|
|
|
238
331
|
```ts
|
|
239
332
|
import { fakeCloudflare } from "@sanoma-ai/connector-cloudflare/fake";
|
|
240
|
-
import { inProcessHost } from "
|
|
333
|
+
import { inProcessHost } from "sanoma/testing/host";
|
|
241
334
|
|
|
242
335
|
const fake = fakeCloudflare({
|
|
243
336
|
start: ({ revision, env }) => inProcessHost(config, databaseUrl)({ port: 0, revision, secrets: env }),
|
|
244
337
|
});
|
|
245
338
|
// ...apply a container, then:
|
|
246
|
-
await fake.stop("acme"); // as
|
|
339
|
+
await fake.stop("acme"); // as Cloudflare may on its own: the next start or wake starts it
|
|
340
|
+
fake.running("acme"); // false once the company's process exited: the container ended with it
|
|
247
341
|
await fake.fire(); // rings every armed alarm now
|
|
248
342
|
fake.wakes(); // each /wake the containers answered
|
|
249
343
|
await fake.close();
|
package/dist/connector.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type Connector, type DnsRecord } from "
|
|
1
|
+
import { type Connector, type DnsRecord } from "sanoma/workflows";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
/**
|
|
4
4
|
* `cloudflare.container`: the company's Worker, `sanoma-<name>`, on the account's workers.dev
|
|
5
5
|
* subdomain, whose one Durable Object (`SanomaInstance`) starts the runtime image in a Container
|
|
6
|
-
* on a
|
|
6
|
+
* on a wake, which ends when its process exits once its worker is idle (`Host`: stops on exit, its
|
|
7
|
+
* URL public).
|
|
7
8
|
* What it runs is in the Worker's plain-text bindings, so a read tells its revision with no
|
|
8
9
|
* container running. A deploy uploads the Worker again; a new image is copied into the account's
|
|
9
10
|
* registry (one there by a tag is pinned to its digest) and named by the upload, and the object
|
|
@@ -12,7 +13,7 @@ import { z } from "zod";
|
|
|
12
13
|
* Deprecated: declare `cloudflare.host`, the same Worker, which takes the decisions alone. A
|
|
13
14
|
* declaration renamed to it keeps its lockfile binding, and nothing is made again.
|
|
14
15
|
*/
|
|
15
|
-
export declare const container: import("
|
|
16
|
+
export declare const container: import("sanoma/workflows").Resource<z.ZodObject<{
|
|
16
17
|
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
18
|
name: z.ZodString;
|
|
18
19
|
image: z.ZodString;
|
|
@@ -43,7 +44,7 @@ export declare const container: import("@sanoma-ai/workflows").Resource<z.ZodObj
|
|
|
43
44
|
* as secrets its database's URL, its keys, the source key it clones with (whose public half apply
|
|
44
45
|
* declares on the repository) and the credentials it deploys itself with: names only, never a value.
|
|
45
46
|
*/
|
|
46
|
-
export declare const host: import("
|
|
47
|
+
export declare const host: import("sanoma/workflows").Resource<z.ZodObject<{
|
|
47
48
|
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
49
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
50
|
configurationRevision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -77,7 +78,7 @@ export declare const host: import("@sanoma-ai/workflows").Resource<z.ZodObject<{
|
|
|
77
78
|
* `SANOMA_WAKEUP_TOKEN`: a workflow that makes hosts for several companies names one per company.
|
|
78
79
|
* The state keeps that name, so a `read`, `update` or `delete` given the state sends the same token.
|
|
79
80
|
*/
|
|
80
|
-
export declare const alarm: import("
|
|
81
|
+
export declare const alarm: import("sanoma/workflows").Resource<z.ZodObject<{
|
|
81
82
|
host: z.ZodString;
|
|
82
83
|
at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
83
84
|
rang: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -126,7 +127,7 @@ export declare const canonicalRecord: ({ type, name, content, priority, ttl }: A
|
|
|
126
127
|
* `records` may name a `resend.domain`, whose `dns_records` it then takes (`from`): a sending
|
|
127
128
|
* domain's records go to the zone that holds them.
|
|
128
129
|
*/
|
|
129
|
-
export declare const records: import("
|
|
130
|
+
export declare const records: import("sanoma/workflows").Resource<z.ZodObject<{
|
|
130
131
|
zone: z.ZodString;
|
|
131
132
|
name: z.ZodString;
|
|
132
133
|
records: z.ZodArray<z.ZodObject<{
|
package/dist/connector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { compareDeclared, RUNTIME_PORT, UNNAMED, defineConnector, defineResource, dnsRecord, vendorInfo, } from "
|
|
2
|
-
import { DOMAIN_NAME, SITE_KEY } from "
|
|
1
|
+
import { compareDeclared, RUNTIME_PORT, UNNAMED, defineConnector, defineResource, dnsRecord, vendorInfo, } from "sanoma/workflows";
|
|
2
|
+
import { DOMAIN_NAME, SITE_KEY } from "sanoma/workflows/shared";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
/*
|
|
5
5
|
* Cloudflare, over its official SDK (`cloudflare`): one Worker per company that runs the company
|
|
@@ -97,7 +97,7 @@ const hostSchema = containerSchema.extend({
|
|
|
97
97
|
});
|
|
98
98
|
/** The host contract both types meet, of which `cloudflare.host` derives what it is not told. */
|
|
99
99
|
const capabilities = {
|
|
100
|
-
lifetime: "stops-
|
|
100
|
+
lifetime: "stops-on-exit",
|
|
101
101
|
publicUrl: true,
|
|
102
102
|
buildsFromGit: false,
|
|
103
103
|
staticEgress: false,
|
|
@@ -105,7 +105,8 @@ const capabilities = {
|
|
|
105
105
|
/**
|
|
106
106
|
* `cloudflare.container`: the company's Worker, `sanoma-<name>`, on the account's workers.dev
|
|
107
107
|
* subdomain, whose one Durable Object (`SanomaInstance`) starts the runtime image in a Container
|
|
108
|
-
* on a
|
|
108
|
+
* on a wake, which ends when its process exits once its worker is idle (`Host`: stops on exit, its
|
|
109
|
+
* URL public).
|
|
109
110
|
* What it runs is in the Worker's plain-text bindings, so a read tells its revision with no
|
|
110
111
|
* container running. A deploy uploads the Worker again; a new image is copied into the account's
|
|
111
112
|
* registry (one there by a tag is pinned to its digest) and named by the upload, and the object
|
package/dist/connector.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.js","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,OAAO,EAEP,eAAe,EACf,cAAc,EAEd,SAAS,EAGT,UAAU,GACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AAEH,8GAA8G;AAC9G,MAAM,IAAI,GAAG,wCAAwC,CAAC;AAEtD,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;IAC1F,IAAI,EAAE,CAAC;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/deploy.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppBundle } from "
|
|
1
|
+
import type { AppBundle } from "sanoma/app";
|
|
2
2
|
import type { CloudflareApi, ContainerOptions } from "./ops.ts";
|
|
3
3
|
/** The Worker's entry module, which imports `cloudflare:workers`, `instance.js` and `app/index.js`. */
|
|
4
4
|
export declare const MAIN_MODULE = "index.js";
|
|
@@ -48,31 +48,20 @@ interface BundleAsk {
|
|
|
48
48
|
url: string;
|
|
49
49
|
token: string;
|
|
50
50
|
revision: string;
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
* ask whichever version is deployed, which may be `{ stale }`.
|
|
54
|
-
*/
|
|
55
|
-
deployment?: string;
|
|
51
|
+
/** The id of the Worker version this deploy uploaded at the revision, whose answers alone count. */
|
|
52
|
+
deployment: string;
|
|
56
53
|
}
|
|
57
54
|
/**
|
|
58
55
|
* The app bundle at `revision`, asked of the Worker at `url` with the instance token until it
|
|
59
|
-
* gives it: the object starts its container when it is stopped
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* answer (no answer, an error of Cloudflare's, a body cut off, a workers.dev URL not routed yet) is
|
|
67
|
-
* asked again. Still none after `startTimeoutMs` is a retryable `DriverError` that says what the
|
|
68
|
-
* last ask saw. One ask may take the whole budget: a bundle is large.
|
|
56
|
+
* gives it: the object starts its container at the revision when it is stopped or runs another,
|
|
57
|
+
* and both it and the worker answer 202 meanwhile. An answer without the version `deployment` is an
|
|
58
|
+
* earlier version's, still answering while the upload reaches every location: asked again,
|
|
59
|
+
* whatever its status. A failed build, a revision the route refuses, a container that ended or the
|
|
60
|
+
* version uploaded refusing the ask (any 4xx of its own, such as another token's 401) is a refusal. Any other answer (no answer, an error of Cloudflare's, a body cut off, a workers.dev URL
|
|
61
|
+
* not routed yet) is asked again. Still none after `startTimeoutMs` is a retryable `DriverError`
|
|
62
|
+
* that says what the last ask saw. One ask may take the whole budget: a bundle is large.
|
|
69
63
|
*/
|
|
70
|
-
export declare function appBundle(cf: CloudflareApi,
|
|
71
|
-
deployment: string;
|
|
72
|
-
}, polling: Polling): Promise<AppBundle>;
|
|
73
|
-
export declare function appBundle(cf: CloudflareApi, ask: BundleAsk, polling: Polling): Promise<AppBundle | {
|
|
74
|
-
stale: string;
|
|
75
|
-
}>;
|
|
64
|
+
export declare function appBundle(cf: CloudflareApi, { script, url, token, revision, deployment }: BundleAsk, polling: Polling): Promise<AppBundle>;
|
|
76
65
|
/** Puts the bundle's assets in through an upload session for `script`'s next upload: the completion jwt that upload redeems. */
|
|
77
66
|
export declare function uploadAssets(cf: CloudflareApi, script: string, assets: AppBundle["assets"]): Promise<string>;
|
|
78
67
|
export {};
|