totalum-sdk 0.1.0-dev.7 → 0.1.0-dev.8

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.
@@ -97,8 +97,9 @@ declare function withTotalumSession<E extends object>(request: Request, env: E,
97
97
 
98
98
  /**
99
99
  * A `D1Database` for the project's own database wherever the code runs (A3.4, plan 05 §3): the bound
100
- * `TOTALUM_DB` inside a Worker, the libsql adapter when the environment moved to Turso, and an HTTPS client to
101
- * SDK-API everywhere else. Detection happens on the first statement, never at call time (§3.1).
100
+ * `TOTALUM_DB` inside a Worker, the libsql adapter when the environment moved to Turso, the local D1 that
101
+ * `initOpenNextCloudflareForDev()` binds under `next dev`, and an HTTPS client to SDK-API everywhere else.
102
+ * Detection happens on the first statement, never at call time (§3.1).
102
103
  */
103
104
  declare function totalumD1(options?: TotalumD1Options): D1Database;
104
105
 
package/dist/d1/index.js CHANGED
@@ -9,8 +9,9 @@ export { TotalumD1Error, isTotalumD1Error } from './errors.js';
9
9
  export { READ_YOUR_WRITES_COOKIE, withTotalumSession } from './session.js';
10
10
  /**
11
11
  * A `D1Database` for the project's own database wherever the code runs (A3.4, plan 05 §3): the bound
12
- * `TOTALUM_DB` inside a Worker, the libsql adapter when the environment moved to Turso, and an HTTPS client to
13
- * SDK-API everywhere else. Detection happens on the first statement, never at call time (§3.1).
12
+ * `TOTALUM_DB` inside a Worker, the libsql adapter when the environment moved to Turso, the local D1 that
13
+ * `initOpenNextCloudflareForDev()` binds under `next dev`, and an HTTPS client to SDK-API everywhere else.
14
+ * Detection happens on the first statement, never at call time (§3.1).
14
15
  */
15
16
  export function totalumD1(options = {}) {
16
17
  return lazyD1(() => resolveTarget(options), options.mode === 'migrate');
@@ -18,8 +19,8 @@ export function totalumD1(options = {}) {
18
19
  async function resolveTarget(options) {
19
20
  if (options.binding)
20
21
  return options.binding;
21
- if (inWorker() && options.transport !== 'https') {
22
- if (readEnv('TOTALUM_DB_PROVIDER') === 'turso')
22
+ if (options.transport !== 'https') {
23
+ if (inWorker() && readEnv('TOTALUM_DB_PROVIDER') === 'turso')
23
24
  return await tursoTarget();
24
25
  const binding = await openNextBinding();
25
26
  if (binding)
@@ -38,7 +39,8 @@ async function resolveTarget(options) {
38
39
  });
39
40
  }
40
41
  /**
41
- * OpenNext exposes the request's bindings; absent (a laptop) or outside a request, there is no binding. The executor
42
+ * OpenNext exposes the request's bindings, in a Worker and under `next dev` (Miniflare's local D1); absent (`next
43
+ * start`, a script) or outside a request, there is no binding. The executor
42
44
  * reads `TOTALUM_DB` again on every statement: it is the current request's database — the plain binding, or the
43
45
  * read-replica session `withTotalumSession` put there — never the first request's for the isolate's life.
44
46
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "totalum-sdk",
3
- "version": "0.1.0-dev.7",
3
+ "version": "0.1.0-dev.8",
4
4
  "description": "The SDK generated Totalum apps import: every integration namespace over SDK-API (totalum-sdk, or one subpath each: /files, /ai, /web, …) and totalum-sdk/d1, the D1 driver",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
package/totalum-sdk.md CHANGED
@@ -78,8 +78,9 @@ totalumD1(options?: TotalumD1Options): D1Database
78
78
  ```
79
79
 
80
80
  A `D1Database` for the project's own database wherever the code runs: the bound
81
- `TOTALUM_DB` inside a Worker, the libsql adapter when the environment moved to Turso, and an HTTPS client to
82
- SDK-API everywhere else. Detection happens on the first statement, never at call time.
81
+ `TOTALUM_DB` inside a Worker, the libsql adapter when the environment moved to Turso, the local D1 that
82
+ `initOpenNextCloudflareForDev()` binds under `next dev`, and an HTTPS client to SDK-API everywhere else.
83
+ Detection happens on the first statement, never at call time.
83
84
 
84
85
  ## `totalum-sdk/files`
85
86