@lunora/runtime 1.0.0-alpha.11 → 1.0.0-alpha.111
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/LICENSE.md +126 -0
- package/README.md +59 -0
- package/dist/index.d.mts +4216 -1357
- package/dist/index.d.ts +4216 -1357
- package/dist/index.mjs +1 -15
- package/dist/packem_shared/BACKUP_KEY_PREFIX-BOtSu-_3.mjs +1 -0
- package/dist/packem_shared/DEFAULT_LOG_COLUMNS-gYMhXLzO.mjs +1 -0
- package/dist/packem_shared/DEFAULT_REGISTRY_CACHE_TTL_MS-D5O7elXI.mjs +1 -0
- package/dist/packem_shared/HEALTH_PATH-D0i8LhwT.mjs +1 -0
- package/dist/packem_shared/LOG_ARCHIVE_NOT_CONFIGURED-CDpi4yFD.mjs +1 -0
- package/dist/packem_shared/LOG_ARCHIVE_PATH-Hmjpz_Ko.mjs +1 -0
- package/dist/packem_shared/LunoraError-DksAgIpa.mjs +1 -0
- package/dist/packem_shared/NOOP_EXECUTION_CONTEXT-YmXqH-jH.mjs +1 -0
- package/dist/packem_shared/STORAGE_UPLOAD_MAX_BODY_BYTES-BqyO-1l6.mjs +1 -0
- package/dist/packem_shared/analyticsEngineSink-JUcPmzoo.mjs +1 -0
- package/dist/packem_shared/applyJurisdiction-C0ddU7Tg.mjs +1 -0
- package/dist/packem_shared/applyRestCache-N81U9dff.mjs +1 -0
- package/dist/packem_shared/argsFromQuery-CGoFTmhB.mjs +1 -0
- package/dist/packem_shared/base64-Bl1_r2k1.mjs +1 -0
- package/dist/packem_shared/composeIdentityResolvers-BHZ4jH8o.mjs +1 -0
- package/dist/packem_shared/composeWorker-DE4s7EQK.mjs +6 -0
- package/dist/packem_shared/createCrossShardRelationCapabilities-D_S3beMO.mjs +1 -0
- package/dist/packem_shared/createKvCursorStore-DQXTTD0l.mjs +1 -0
- package/dist/packem_shared/createQueryCoordinator-DlWITOu1.mjs +1 -0
- package/dist/packem_shared/createShardClient-I984JFkv.mjs +1 -0
- package/dist/packem_shared/decorateResponse-Y2sCM0w1.mjs +1 -0
- package/dist/packem_shared/emitLogEvent-CiOzTq1X.mjs +1 -0
- package/dist/packem_shared/evict-oldest-BNXsKx4s.mjs +1 -0
- package/dist/packem_shared/export-tap-CAyZ2TWC.mjs +3 -0
- package/dist/packem_shared/identity-header-C4Z5pldl.mjs +1 -0
- package/dist/packem_shared/memoizeIdentity-DnOj3QRi.mjs +1 -0
- package/dist/packem_shared/method-guard-BG_vJNTl.mjs +1 -0
- package/dist/packem_shared/observability-B1hLjwgx.mjs +1 -0
- package/dist/packem_shared/origin-paywall-B6eOO67m.mjs +1 -0
- package/dist/packem_shared/otlp-resource-JKBCWf6c.mjs +1 -0
- package/dist/packem_shared/pipeline-log-reader-C-nuWG_e.mjs +1 -0
- package/dist/packem_shared/portable-json-BSCiOfqE.mjs +1 -0
- package/dist/packem_shared/rest-cache-D1BlbZb1.mjs +1 -0
- package/dist/packem_shared/rest-routes-CpbO5QEx.mjs +1 -0
- package/dist/packem_shared/toAirbyteMessages-2d_iJXPf.mjs +1 -0
- package/dist/packem_shared/wire-codec-BLvSm5Mn.mjs +1 -0
- package/package.json +11 -1
- package/dist/packem_shared/DEFAULT_REGISTRY_CACHE_TTL_MS-ocax8v0n.mjs +0 -78
- package/dist/packem_shared/LunoraError-CL0aOtpo.mjs +0 -46
- package/dist/packem_shared/NOOP_EXECUTION_CONTEXT-CCTu0Bf1.mjs +0 -8
- package/dist/packem_shared/analyticsEngineSink-DqEvrQs0.mjs +0 -141
- package/dist/packem_shared/applyJurisdiction-BkZtTkct.mjs +0 -20
- package/dist/packem_shared/composeWorker-BNYeYQqL.mjs +0 -2767
- package/dist/packem_shared/createCrossShardRelationCapabilities-C0KOf7er.mjs +0 -61
- package/dist/packem_shared/createQueryCoordinator-Cbds9cUI.mjs +0 -838
- package/dist/packem_shared/decorateResponse-DbISh_Wi.mjs +0 -233
- package/dist/packem_shared/emitLogEvent-pEdtqAK8.mjs +0 -20
- package/dist/packem_shared/toAirbyteMessages-DrHdplb4.mjs +0 -39
package/LICENSE.md
CHANGED
|
@@ -103,3 +103,129 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
|
103
103
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
104
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
105
|
specific language governing permissions and limitations under the License.
|
|
106
|
+
|
|
107
|
+
<!-- DEPENDENCIES -->
|
|
108
|
+
<!-- /DEPENDENCIES -->
|
|
109
|
+
|
|
110
|
+
<!-- TYPE_DEPENDENCIES -->
|
|
111
|
+
|
|
112
|
+
# Licenses of bundled types
|
|
113
|
+
The published @lunora/runtime artifact additionally contains code with the following licenses:
|
|
114
|
+
FSL-1.1-Apache-2.0
|
|
115
|
+
|
|
116
|
+
# Bundled types:
|
|
117
|
+
## @lunora/workflow
|
|
118
|
+
License: FSL-1.1-Apache-2.0
|
|
119
|
+
By: Daniel Bannert
|
|
120
|
+
Repository: git+https://github.com/anolilab/lunora.git
|
|
121
|
+
|
|
122
|
+
> # Functional Source License, Version 1.1, Apache 2.0 Future License
|
|
123
|
+
>
|
|
124
|
+
> ## Abbreviation
|
|
125
|
+
>
|
|
126
|
+
> FSL-1.1-Apache-2.0
|
|
127
|
+
>
|
|
128
|
+
> ## Notice
|
|
129
|
+
>
|
|
130
|
+
> Copyright 2026 anolilab and contributors
|
|
131
|
+
>
|
|
132
|
+
> ## Terms and Conditions
|
|
133
|
+
>
|
|
134
|
+
> ### Licensor ("We")
|
|
135
|
+
>
|
|
136
|
+
> The party offering the Software under these Terms and Conditions.
|
|
137
|
+
>
|
|
138
|
+
> ### The Software
|
|
139
|
+
>
|
|
140
|
+
> The "Software" is each version of the software that we make available under
|
|
141
|
+
> these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
142
|
+
> Conditions with the Software.
|
|
143
|
+
>
|
|
144
|
+
> ### License Grant
|
|
145
|
+
>
|
|
146
|
+
> Subject to your compliance with this License Grant and the Patents,
|
|
147
|
+
> Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
148
|
+
> use, copy, modify, create derivative works, publicly perform, publicly display
|
|
149
|
+
> and redistribute the Software for any Permitted Purpose identified below.
|
|
150
|
+
>
|
|
151
|
+
> ### Permitted Purpose
|
|
152
|
+
>
|
|
153
|
+
> A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
154
|
+
> means making the Software available to others in a commercial product or service
|
|
155
|
+
> that:
|
|
156
|
+
>
|
|
157
|
+
> 1. substitutes for the Software;
|
|
158
|
+
>
|
|
159
|
+
> 2. substitutes for any other product or service we offer using the Software that
|
|
160
|
+
> exists as of the date we make the Software available; or
|
|
161
|
+
>
|
|
162
|
+
> 3. offers the same or substantially similar functionality as the Software.
|
|
163
|
+
>
|
|
164
|
+
> Permitted Purposes specifically include using the Software:
|
|
165
|
+
>
|
|
166
|
+
> 1. for your internal use and access;
|
|
167
|
+
>
|
|
168
|
+
> 2. for non-commercial education;
|
|
169
|
+
>
|
|
170
|
+
> 3. for non-commercial research; and
|
|
171
|
+
>
|
|
172
|
+
> 4. in connection with professional services that you provide to a licensee using
|
|
173
|
+
> the Software in accordance with these Terms and Conditions.
|
|
174
|
+
>
|
|
175
|
+
> ### Patents
|
|
176
|
+
>
|
|
177
|
+
> To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
178
|
+
> patents, the license grant above includes a license under our patents. If you
|
|
179
|
+
> make a claim against any party that the Software infringes or contributes to the
|
|
180
|
+
> infringement of any patent, then your patent license to the Software ends
|
|
181
|
+
> immediately.
|
|
182
|
+
>
|
|
183
|
+
> ### Redistribution
|
|
184
|
+
>
|
|
185
|
+
> The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
186
|
+
> the Software.
|
|
187
|
+
>
|
|
188
|
+
> If you redistribute any copies, modifications or derivatives of the Software,
|
|
189
|
+
> you must include a copy of or a link to these Terms and Conditions and not
|
|
190
|
+
> remove any copyright notices provided in or with the Software.
|
|
191
|
+
>
|
|
192
|
+
> ### Disclaimer
|
|
193
|
+
>
|
|
194
|
+
> THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
195
|
+
> IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
196
|
+
> PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
197
|
+
>
|
|
198
|
+
> IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
199
|
+
> SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN
|
|
200
|
+
> IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
201
|
+
>
|
|
202
|
+
> ### Trademarks
|
|
203
|
+
>
|
|
204
|
+
> Except for displaying the License Details and identifying us as the origin of
|
|
205
|
+
> the Software, you have no right under these Terms and Conditions to use our
|
|
206
|
+
> trademarks, trade names, service marks or product names.
|
|
207
|
+
>
|
|
208
|
+
> ## Grant of Future License
|
|
209
|
+
>
|
|
210
|
+
> We hereby irrevocably grant you an additional license to use the Software under
|
|
211
|
+
> the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
212
|
+
> the date we make the Software available. On or after that date, you may use the
|
|
213
|
+
> Software under the Apache License, Version 2.0, in which case the following will
|
|
214
|
+
> apply:
|
|
215
|
+
>
|
|
216
|
+
> Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
217
|
+
> this file except in compliance with the License.
|
|
218
|
+
>
|
|
219
|
+
> You may obtain a copy of the License at
|
|
220
|
+
>
|
|
221
|
+
> http://www.apache.org/licenses/LICENSE-2.0
|
|
222
|
+
>
|
|
223
|
+
> Unless required by applicable law or agreed to in writing, software distributed
|
|
224
|
+
> under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
225
|
+
> CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
226
|
+
> specific language governing permissions and limitations under the License.
|
|
227
|
+
>
|
|
228
|
+
> <!-- DEPENDENCIES -->
|
|
229
|
+
> <!-- /DEPENDENCIES -->
|
|
230
|
+
|
|
231
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/README.md
CHANGED
|
@@ -86,6 +86,65 @@ export { ShardDO };
|
|
|
86
86
|
|
|
87
87
|
> This README covers the basics. For the full API, options, and guides, see the **[documentation](https://lunora.sh/docs/packages/runtime)**.
|
|
88
88
|
|
|
89
|
+
### Workers Cache
|
|
90
|
+
|
|
91
|
+
When `cache: { enabled: true }` is present in `wrangler.jsonc` and `compatibility_date >= "2026-05-01"`, the runtime forwards the Worker's `ExecutionContext.cache` into the **HTTP action** context as `ctx.cache`. This lets you purge cache by tag from an `httpRouter()` handler:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
app.post(
|
|
95
|
+
"/admin/refresh-products",
|
|
96
|
+
httpAction(async (ctx) => {
|
|
97
|
+
if (!ctx.cache) {
|
|
98
|
+
return new Response("Workers Cache is not enabled in wrangler.jsonc", { status: 501 });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
await ctx.cache.purge({ tags: ["products"] });
|
|
102
|
+
|
|
103
|
+
return Response.json({ ok: true });
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The `ctx.cache` binding reaches **HTTP action handlers only**. Queries, mutations, and RPC actions all run inside the Durable Object, which has no cache binding, so `ctx.cache` is `undefined` for every one of them — always branch on it. Cache header declarations on `httpRoute` (`.cacheControl()`, `.cacheTag()`, `.vary()`) are attached by `@lunora/server` before the response leaves the handler.
|
|
109
|
+
|
|
110
|
+
### Scheduled backups
|
|
111
|
+
|
|
112
|
+
The worker can take its own NDJSON snapshots on a Cron Trigger, writing them to an R2 bucket in your account — the same format and key layout `lunora backup list|restore` reads, so cron-written and hand-taken snapshots share one history.
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
interface BackupEnv extends Env {
|
|
116
|
+
BACKUPS: R2Bucket;
|
|
117
|
+
LUNORA_ADMIN_TOKEN: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
let worker: LunoraWorker | null = null;
|
|
121
|
+
|
|
122
|
+
const build = (env: BackupEnv): LunoraWorker =>
|
|
123
|
+
(worker ??= createWorker({
|
|
124
|
+
adminToken: env.LUNORA_ADMIN_TOKEN,
|
|
125
|
+
backupCron: "0 3 * * *", // a literal is written into wrangler `triggers.crons` for you
|
|
126
|
+
backupRetain: 14,
|
|
127
|
+
backupStore: env.BACKUPS, // a bound R2 bucket satisfies `BackupStore`
|
|
128
|
+
queryCoordinator, // the export walks every shard through it
|
|
129
|
+
shardDO: env.SHARD,
|
|
130
|
+
}));
|
|
131
|
+
|
|
132
|
+
export default {
|
|
133
|
+
fetch: (request: Request, env: BackupEnv, ctx: ExecutionContext) => build(env).fetch(request, env, ctx),
|
|
134
|
+
scheduled: (controller: ScheduledController, env: BackupEnv, ctx: ExecutionContext) => build(env).scheduled(controller, env, ctx),
|
|
135
|
+
};
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Five things are easy to get wrong, and four of them fail silently:
|
|
139
|
+
|
|
140
|
+
- **`scheduled` must be wired.** `createWorker` returns it, but a worker that only exports `fetch` never runs a backup, and nothing reports that.
|
|
141
|
+
- **`backupCron` is compared verbatim** against the firing expression. `"0 3 * * *"` and `"0 3 * * *"` are different strings, and the mismatch is silent — the trigger fires, no backup runs. A literal is discovered by codegen and written into `triggers.crons`; a computed one (`env.NIGHTLY_CRON`, or one supplied via `.extend()`) is not, so that entry is yours to add — the reconciler will not remove it.
|
|
142
|
+
- **`backupStore`, `adminToken` and `queryCoordinator` are all required.** The snapshot is assembled by walking every shard's admin export route, so it needs the coordinator to reach them and a token to authorize itself. Missing any one throws `BACKUP_NOT_CONFIGURED` from inside the scheduled handler — the one failure here that is loud.
|
|
143
|
+
- **`backupRetain` does not delete anything.** It is a reporting window: each run logs how many snapshots sit past the newest N and tells you to run `lunora backup prune`, which is the only thing that removes a backup. A bucket therefore grows until you prune it.
|
|
144
|
+
- **The snapshot is built in memory.** It is capped at 24 MiB and refuses past it, writing nothing — narrow it with `backupTables`, or take that snapshot off-platform with `lunora backup create --bucket`.
|
|
145
|
+
|
|
146
|
+
`backupPrefix` (default `"backups/"`) sets the key prefix, and `backupTables` narrows the snapshot to an allowlist. The 24 MiB cap is smaller than the 32 MiB one on `lunora backup create --bucket`, which travels through the checksum-verified upload route instead of being held in an isolate.
|
|
147
|
+
|
|
89
148
|
## Related
|
|
90
149
|
|
|
91
150
|
- [`@lunora/do`](https://www.npmjs.com/package/@lunora/do) — the `ShardDO` / `SessionDO` Durable Objects this runtime routes to.
|