@mcp-b/do-runtime 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,14 +26,24 @@
26
26
  * `abstract` in the types — JSG nested types have no JS constructor — so the
27
27
  * faithful shape is a constructor that refuses. `sql.Cursor` exists for
28
28
  * `instanceof`, which is all upstream exposes it for.
29
- * 3. **The regulator is ported whole; what is missing is the authorizer that
30
- * calls it.** All three callbacks are here and none of them needed the
29
+ * 3. **The regulator is ported whole, and that is not the whole authorizer.**
30
+ * Four of its five members are here as callbacks, and none needed the
31
31
  * authorizer to compute anything — `isAllowedName` is a prefix test,
32
- * `isAllowedTrigger` is `return true`, `allowTransactions` throws. What the
33
- * authorizer supplied was the *identifiers*, not the decisions. With no
34
- * authorizer the statement text is the only source, so `exec` tokenizes it
32
+ * `isAllowedTrigger` is `return true`, `allowTransactions` throws,
33
+ * `shouldAddQueryStats` is a constant. The fifth, `onError`, is not a
34
+ * callback at all in this port: it is every `throw new Error(message)`
35
+ * below, which is all its upstream body does with a refusal message.
36
+ * For those, what the authorizer supplied was the *identifiers*:
37
+ * with none, the statement text is the only source, so `exec` tokenizes it
35
38
  * and runs `isAllowedName` over every identifier-shaped token. That is
36
39
  * deliberately STRICTER than upstream — see `SQL_RESERVED_PREFIX_MESSAGE`.
40
+ *
41
+ * But the authorizer also makes decisions no callback ever sees, and those
42
+ * do NOT arrive with the regulator: `SQLITE_ATTACH` / `SQLITE_DETACH`, the
43
+ * `SQLITE_CREATE_TEMP_*` family and the `temp` schema, `SQLITE_PRAGMA`, and
44
+ * the `SQLITE_CREATE_VTABLE` module list. Each is refused from the text in
45
+ * `refuseUnauthorizedForms` and `requireAllowedPragmas`. `SQLITE_FUNCTION`
46
+ * is the one still unported — see the README divergence row.
37
47
  * 4. **`ingest` stays at upstream's SQLite seam.** `SqliteDatabase.ingest()`
38
48
  * executes every complete statement and returns the partial tail, using the
39
49
  * same compiled boundaries and regulator as `exec`.
@@ -73,7 +83,7 @@ export declare const STATEMENT_NOT_CONSTRUCTIBLE_MESSAGE = "Illegal invocation:
73
83
  */
74
84
  export declare const SQL_RESERVED_PREFIX_MESSAGE: string;
75
85
  /**
76
- * ← `SqlStorageRegulator` (`sql.h:15-22`, `sql.c++:143-173`), whole.
86
+ * ← `SqlStorageRegulator` (`sql.h:15-22`, `sql.c++:141-165`), whole.
77
87
  *
78
88
  * Upstream reaches these through the SQLite authorizer while a statement is
79
89
  * being compiled. `exec` calls them from the statement text instead, which is
@@ -100,6 +110,7 @@ export declare const SqlStorageRegulator: {
100
110
  * byte-identical so a caller matching on it ports unchanged.
101
111
  */
102
112
  export declare const SQL_NOT_AUTHORIZED_MESSAGE = "not authorized: SQLITE_AUTH";
113
+ export declare const SQL_VACUUM_REFUSED_MESSAGE = "cannot VACUUM from within a transaction: SQLITE_ERROR";
103
114
  /**
104
115
  * ← the `jsg::Ref<DurableObjectStorage>` `SqlStorage` holds, narrowed to the one
105
116
  * member it reaches through (`SqlStorage::getDb`). `DurableObjectStorage`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-b/do-runtime",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Cloudflare's Durable Object runtime (workerd), ported to TypeScript: actors with input/output gates, SQLite storage, facets and alarms, running in the browser and in Node.",
5
5
  "keywords": [
6
6
  "actors",