@sanoma-ai/connector-cloudflare 0.6.5 → 0.11.21
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 +112 -21
- package/dist/connector.d.ts +5 -5
- package/dist/connector.js +2 -2
- 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 +12 -6
- package/dist/fake.js +38 -11
- 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 +3 -5
- package/worker/instance.d.ts +1 -1
- package/worker/instance.js +2 -2
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 quiet, 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 [
|
|
3
|
+
[Cloudflare Containers](https://developers.cloudflare.com/containers/) as a host that stops when quiet, 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
|
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -76,7 +76,7 @@ An explicit `host.update` or `container.update` waits for startup readiness even
|
|
|
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
|
|
|
@@ -105,20 +105,111 @@ The application is of the `durable_object` scheduling policy (public beta, the o
|
|
|
105
105
|
|
|
106
106
|
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
107
|
|
|
108
|
-
1. **The bundle.** `GET /__sanoma/app-bundle?revision=R` on the workers.dev URL with the instance token, asked every poll:
|
|
108
|
+
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
109
|
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
|
|
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 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
111
|
|
|
112
112
|
### Live before asked
|
|
113
113
|
|
|
114
114
|
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
115
|
|
|
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
|
|
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 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
117
|
|
|
118
118
|
## The database
|
|
119
119
|
|
|
120
120
|
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
121
|
|
|
122
|
+
## Secrets
|
|
123
|
+
|
|
124
|
+
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.
|
|
125
|
+
|
|
126
|
+
**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:
|
|
127
|
+
|
|
128
|
+
| Under | From |
|
|
129
|
+
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
130
|
+
| `SANOMA_DATABASE_URL` | The declared `database`'s URL |
|
|
131
|
+
| `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 |
|
|
132
|
+
| `SANOMA_SECRETS_KEY` | The config's binding of it, only with the built-in store |
|
|
133
|
+
| `SANOMA_WAKEUP_TOKEN`, `SANOMA_SOURCE_KEY` | The wakeup's token, and the deploy key it clones a private repository with |
|
|
134
|
+
| 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 |
|
|
135
|
+
| 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` |
|
|
136
|
+
|
|
137
|
+
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.
|
|
138
|
+
|
|
139
|
+
**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.
|
|
140
|
+
|
|
141
|
+
**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.
|
|
142
|
+
|
|
143
|
+
**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.
|
|
144
|
+
|
|
145
|
+
**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.
|
|
146
|
+
|
|
147
|
+
**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.
|
|
148
|
+
|
|
149
|
+
**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).
|
|
150
|
+
|
|
151
|
+
### The token: deploying and running
|
|
152
|
+
|
|
153
|
+
`CLOUDFLARE_API_TOKEN` is management authority. A host's runtime needs none of it to read its own secrets, which arrive in its environment.
|
|
154
|
+
|
|
155
|
+
| Who | Needs |
|
|
156
|
+
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
157
|
+
| 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) |
|
|
158
|
+
| 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 |
|
|
159
|
+
| Anything here | Never Secrets Store Write or Secrets Store Read: Sanoma does not use the account's Secrets Store ([below](#the-account-secrets-store)) |
|
|
160
|
+
|
|
161
|
+
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.
|
|
162
|
+
|
|
163
|
+
### The account Secrets Store
|
|
164
|
+
|
|
165
|
+
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):
|
|
166
|
+
|
|
167
|
+
- 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).
|
|
168
|
+
- 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).
|
|
169
|
+
- 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).
|
|
170
|
+
- 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.
|
|
171
|
+
- 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).
|
|
172
|
+
|
|
173
|
+
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.
|
|
174
|
+
|
|
175
|
+
### Setups
|
|
176
|
+
|
|
177
|
+
**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:
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
// sanoma.config.ts
|
|
181
|
+
secrets: {
|
|
182
|
+
bindings: {
|
|
183
|
+
SANOMA_SIGNING_KEY: { bootstrap: "SANOMA_SIGNING_KEY" },
|
|
184
|
+
SANOMA_SECRETS_KEY: { bootstrap: "SANOMA_SECRETS_KEY" },
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
// resources/infra.ts: `store` a declared `supabase.project`
|
|
191
|
+
export const host = cloudflare.host({ database: store });
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
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.
|
|
195
|
+
|
|
196
|
+
**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:
|
|
197
|
+
|
|
198
|
+
```ts
|
|
199
|
+
// sanoma.config.ts
|
|
200
|
+
secrets: {
|
|
201
|
+
store: supabaseVault(),
|
|
202
|
+
bindings: {
|
|
203
|
+
SANOMA_SIGNING_KEY: { bootstrap: "SANOMA_SIGNING_KEY" },
|
|
204
|
+
VAULT_LOGIN: { env: "SUPABASE_VAULT_DATABASE_URL", host: true },
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The login authenticates to the store, so it is a host secret, never a value in the store it unlocks.
|
|
210
|
+
|
|
211
|
+
**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.
|
|
212
|
+
|
|
122
213
|
## The image
|
|
123
214
|
|
|
124
215
|
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.
|
|
@@ -142,7 +233,7 @@ Each hostname in `domains` is attached to the Worker as a [Workers custom domain
|
|
|
142
233
|
|
|
143
234
|
## DNS records
|
|
144
235
|
|
|
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.
|
|
236
|
+
`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
237
|
|
|
147
238
|
```ts
|
|
148
239
|
// resources/infra.ts
|
|
@@ -153,12 +244,12 @@ export const mail = resend.domain({ name: "sanoma.work" });
|
|
|
153
244
|
export const mailDns = cloudflare.records({ zone: "sanoma.work", name: "resend", records: mail });
|
|
154
245
|
```
|
|
155
246
|
|
|
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
|
|
247
|
+
| Field | What it is |
|
|
248
|
+
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
249
|
+
| `zone` | The zone's name, as the account holds it (`sanoma.work`); changing it replaces the set |
|
|
250
|
+
| `name` | The set's label (`resend`): lower case letters, digits, `-` and `_`. Its identity is `<zone>/<name>`; changing it replaces the set |
|
|
251
|
+
| `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` |
|
|
252
|
+
| `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
253
|
|
|
163
254
|
**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
255
|
|
|
@@ -170,7 +261,7 @@ export const mailDns = cloudflare.records({ zone: "sanoma.work", name: "resend",
|
|
|
170
261
|
|
|
171
262
|
## Driver
|
|
172
263
|
|
|
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
|
|
264
|
+
`@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
265
|
|
|
175
266
|
`./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
267
|
|
|
@@ -185,7 +276,7 @@ It reads these on every call, never when the config loads:
|
|
|
185
276
|
| `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
277
|
| `CLOUDFLARE_ACCOUNT_ID` | The account's id, 32 hexadecimal digits, on its dashboard's overview |
|
|
187
278
|
|
|
188
|
-
When either is unset, a call fails, not retryable, naming it. The driver declares both in its `env` ([Credentials](https://
|
|
279
|
+
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
280
|
|
|
190
281
|
### Errors and retries
|
|
191
282
|
|
|
@@ -197,7 +288,7 @@ Containers need the Workers Paid plan. An instance is billed while it runs, by i
|
|
|
197
288
|
|
|
198
289
|
### Testing the driver
|
|
199
290
|
|
|
200
|
-
`test/driver.test.ts`, `test/records.test.ts` and the features replay Cloudflare's replies (`test/fixtures`) with [
|
|
291
|
+
`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
292
|
|
|
202
293
|
### Running it live
|
|
203
294
|
|
|
@@ -223,21 +314,21 @@ It needs:
|
|
|
223
314
|
|
|
224
315
|
## Steps and features
|
|
225
316
|
|
|
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`):
|
|
317
|
+
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
318
|
|
|
228
319
|
| Keyword | Step | What it does |
|
|
229
320
|
| ------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
230
321
|
| 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
322
|
|
|
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/`.
|
|
323
|
+
`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
324
|
|
|
234
325
|
## Testing
|
|
235
326
|
|
|
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.
|
|
327
|
+
`@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
328
|
|
|
238
329
|
```ts
|
|
239
330
|
import { fakeCloudflare } from "@sanoma-ai/connector-cloudflare/fake";
|
|
240
|
-
import { inProcessHost } from "
|
|
331
|
+
import { inProcessHost } from "sanoma/testing/host";
|
|
241
332
|
|
|
242
333
|
const fake = fakeCloudflare({
|
|
243
334
|
start: ({ revision, env }) => inProcessHost(config, databaseUrl)({ port: 0, revision, secrets: env }),
|
package/dist/connector.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
@@ -12,7 +12,7 @@ import { z } from "zod";
|
|
|
12
12
|
* Deprecated: declare `cloudflare.host`, the same Worker, which takes the decisions alone. A
|
|
13
13
|
* declaration renamed to it keeps its lockfile binding, and nothing is made again.
|
|
14
14
|
*/
|
|
15
|
-
export declare const container: import("
|
|
15
|
+
export declare const container: import("sanoma/workflows").Resource<z.ZodObject<{
|
|
16
16
|
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
17
|
name: z.ZodString;
|
|
18
18
|
image: z.ZodString;
|
|
@@ -43,7 +43,7 @@ export declare const container: import("@sanoma-ai/workflows").Resource<z.ZodObj
|
|
|
43
43
|
* as secrets its database's URL, its keys, the source key it clones with (whose public half apply
|
|
44
44
|
* declares on the repository) and the credentials it deploys itself with: names only, never a value.
|
|
45
45
|
*/
|
|
46
|
-
export declare const host: import("
|
|
46
|
+
export declare const host: import("sanoma/workflows").Resource<z.ZodObject<{
|
|
47
47
|
id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
48
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
49
|
configurationRevision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -77,7 +77,7 @@ export declare const host: import("@sanoma-ai/workflows").Resource<z.ZodObject<{
|
|
|
77
77
|
* `SANOMA_WAKEUP_TOKEN`: a workflow that makes hosts for several companies names one per company.
|
|
78
78
|
* The state keeps that name, so a `read`, `update` or `delete` given the state sends the same token.
|
|
79
79
|
*/
|
|
80
|
-
export declare const alarm: import("
|
|
80
|
+
export declare const alarm: import("sanoma/workflows").Resource<z.ZodObject<{
|
|
81
81
|
host: z.ZodString;
|
|
82
82
|
at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
83
83
|
rang: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -126,7 +126,7 @@ export declare const canonicalRecord: ({ type, name, content, priority, ttl }: A
|
|
|
126
126
|
* `records` may name a `resend.domain`, whose `dns_records` it then takes (`from`): a sending
|
|
127
127
|
* domain's records go to the zone that holds them.
|
|
128
128
|
*/
|
|
129
|
-
export declare const records: import("
|
|
129
|
+
export declare const records: import("sanoma/workflows").Resource<z.ZodObject<{
|
|
130
130
|
zone: z.ZodString;
|
|
131
131
|
name: z.ZodString;
|
|
132
132
|
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
|
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;SACJ,MAAM,EAAE;SACR,KAAK,CAAC,IAAI,EAAE,mDAAmD,CAAC;SAChE,QAAQ,CACP,0GAA0G,CAC3G;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,KAAK,CAAC,oDAAoD,EAAE,oCAAoC,CAAC;SACjG,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,0CAA0C,CAAC;SACzF,QAAQ,CACP,8IAA8I,CAC/I;IACH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qEAAqE,CAA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,eAAe,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE9G,uFAAuF;AACvF,MAAM,YAAY,GAAG;IACnB,QAAQ,EAAE;QACR,MAAM,EAAE,OAAO;QACf,qEAAqE;QACrE,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,+EAA+E;QAC5F,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC,EAAE,CAAC;QACrG,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;KACrB;CAC+B,CAAC;AAEnC,MAAM,QAAQ,GAAG,eAAe,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;AAUxE;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,GAAG,KAAK;IACR,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE;CACU,CAAC"}
|
package/dist/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 {};
|
package/dist/deploy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { setTimeout as delay } from "node:timers/promises";
|
|
3
|
-
import { DriverError, errorMessage } from "
|
|
4
|
-
import { APP_BUNDLE_HEADER, APP_BUNDLE_PATH } from "
|
|
3
|
+
import { DriverError, errorMessage } from "sanoma/workflows";
|
|
4
|
+
import { APP_BUNDLE_HEADER, APP_BUNDLE_PATH } from "sanoma/workflows/shared";
|
|
5
5
|
import mime from "mime";
|
|
6
6
|
import { refused } from "./errors.js";
|
|
7
7
|
import { DEPLOYMENT_HEADER } from "../worker/instance.js";
|
|
@@ -70,6 +70,16 @@ export async function waitFor(doing, { startTimeoutMs, pollMs }, ask) {
|
|
|
70
70
|
await delay(pollMs);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* The app bundle at `revision`, asked of the Worker at `url` with the instance token until it
|
|
75
|
+
* gives it: the object starts its container at the revision when it is stopped or runs another,
|
|
76
|
+
* and both it and the worker answer 202 meanwhile. An answer without the version `deployment` is an
|
|
77
|
+
* earlier version's, still answering while the upload reaches every location: asked again,
|
|
78
|
+
* whatever its status. A failed build, a revision the route refuses, a container that ended or the
|
|
79
|
+
* 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
|
|
80
|
+
* not routed yet) is asked again. Still none after `startTimeoutMs` is a retryable `DriverError`
|
|
81
|
+
* that says what the last ask saw. One ask may take the whole budget: a bundle is large.
|
|
82
|
+
*/
|
|
73
83
|
export function appBundle(cf, { script, url, token, revision, deployment }, polling) {
|
|
74
84
|
return waitFor(`${script}: still building the app bundle at ${revision}`, polling, async () => {
|
|
75
85
|
try {
|
|
@@ -78,23 +88,21 @@ export function appBundle(cf, { script, url, token, revision, deployment }, poll
|
|
|
78
88
|
headers: { authorization: `Bearer ${token}` },
|
|
79
89
|
signal: AbortSignal.timeout(polling.startTimeoutMs),
|
|
80
90
|
});
|
|
81
|
-
const route = res.headers.has(APP_BUNDLE_HEADER);
|
|
82
91
|
const by = res.headers.get(DEPLOYMENT_HEADER);
|
|
83
|
-
if (
|
|
92
|
+
if (by !== deployment) {
|
|
84
93
|
await res.body?.cancel();
|
|
85
94
|
return { last: `an earlier version (${by || "unmarked"}) answered ${res.status}` };
|
|
86
95
|
}
|
|
96
|
+
const route = res.headers.has(APP_BUNDLE_HEADER);
|
|
87
97
|
// Undefined when it is none (a body cut off where the JSON is).
|
|
88
98
|
const body = (await res.json().catch(() => undefined));
|
|
89
99
|
if (route && res.status === 200 && body !== undefined)
|
|
90
100
|
return { value: body };
|
|
91
101
|
const said = typeof body?.error === "string" ? body.error : `${APP_BUNDLE_PATH} answered ${res.status}`;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// The worker's own refusal (the build's failure, a revision it refuses), or the uploaded version's container ended.
|
|
97
|
-
if (exit || (route && res.status !== 200 && res.status !== 202))
|
|
102
|
+
// The worker's own refusal (the build's failure, a revision it refuses), the container ended, or
|
|
103
|
+
// the version uploaded refuses the ask (the token its bindings hold is another): none passes on asking.
|
|
104
|
+
const own4xx = res.status >= 400 && res.status < 500;
|
|
105
|
+
if (typeof body?.exit === "string" || own4xx || (route && res.status !== 200 && res.status !== 202))
|
|
98
106
|
throw refused(`${script}: no app bundle at ${revision}: ${said}`);
|
|
99
107
|
return {
|
|
100
108
|
last: res.status === 202 ? (route ? "the worker is building it" : "its container is starting") : said,
|
package/dist/deploy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,IAA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C,CACH,CAAC;IACF,yFAAyF;IACzF,gDAAgD;IAChD,IAAI,UAA8B,CAAC;IACnC,KAAK,MAAM,MAAM,IAAI,KAAK;QAAE,UAAU,GAAG,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,IAAI,UAAU,CAAC;IAC5F,IAAI,CAAC,UAAU;QACb,MAAM,OAAO,CAAC,GAAG,MAAM,8EAA8E,CAAC,CAAC;IACzG,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/dist/driver.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ export interface CloudflareDriverOptions {
|
|
|
17
17
|
* over the Worker's wake route with the company's `SANOMA_WAKEUP_TOKEN` (`cloudflare.alarm`), and
|
|
18
18
|
* sets of DNS records in the account's zones (`cloudflare.records`). See the README.
|
|
19
19
|
*/
|
|
20
|
-
export declare function cloudflareDriver(options?: CloudflareDriverOptions): import("
|
|
20
|
+
export declare function cloudflareDriver(options?: CloudflareDriverOptions): import("sanoma/workflows").Driver;
|
package/dist/driver.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineDriver, DriverError, retryableStatus } from "
|
|
1
|
+
import { defineDriver, DriverError, retryableStatus } from "sanoma/workflows";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { cloudflareOps, host } from "./connector.js";
|
|
4
4
|
import { refused } from "./errors.js";
|