@adep/runtime 0.3.14 → 0.3.15

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.
@@ -3,7 +3,7 @@ import type { CapabilityBundle } from '@adep/types';
3
3
  import type { ProjectDriver } from '../../db/project-driver';
4
4
  export interface CreateDbCapabilityOptions {
5
5
  /**
6
- * 写终端(insert / insertMany / update / delete)执行前的项目级配额钩子(BILL-005,§2.7.3)。
6
+ * 写终端(insert / insertMany / update / delete / upsert)执行前的项目级配额钩子(BILL-005,§2.7.3)。
7
7
  * 由 provider 绑定 projectId + dataDir 注入(方言无关 usageStats 量当前用量,超限抛 429 拒写)。
8
8
  * 缺省不注入 → 不做写前配额门(fail-open 过渡)。
9
9
  */
@@ -11,6 +11,13 @@ export interface CreateDbCapabilityOptions {
11
11
  }
12
12
  /** 链式能力的装配规格:FN worker 只按方法名清单构造客户端,不感知 db 细节。 */
13
13
  export declare const CLOUD_DB_SPEC: ChainSpec;
14
+ /**
15
+ * 写终端:这些终值方法在事务期间必须走事务句柄(否则 `DB_UNSAFE_OP`),也是配额钩子
16
+ * `beforeWrite` 的判定集合。必须与 `CLOUD_DB_SPEC.terminalMethods` 里的写方法一一对应——
17
+ * DB-010 新增 `upsert` 时只登记了规格清单、漏了这里(提交说明声称已补但 diff 没改),
18
+ * 于是 upsert 绕过事务外写拒绝与 BILL-005 配额门。防漂移门 spec-drift.test.ts 用例 ④ 钉住它。
19
+ */
20
+ export declare const WRITE_TERMINALS: ReadonlySet<string>;
14
21
  /**
15
22
  * 按驱动产出一组 `cloud.db` 能力。驱动已绑定项目库(连接层隔离,DB-001);
16
23
  * `projectId` 在装配期绑定,函数侧不可感知。内部无共享可变状态污染跨项目调用。
package/dist/index.js CHANGED
@@ -1149,7 +1149,13 @@ var CLOUD_DB_SPEC = {
1149
1149
  directMethods: ["query", "writeQuery", "execute", "changes"],
1150
1150
  transactionMethod: "transaction"
1151
1151
  };
1152
- var WRITE_TERMINALS = /* @__PURE__ */ new Set(["insert", "insertMany", "update", "delete"]);
1152
+ var WRITE_TERMINALS = /* @__PURE__ */ new Set([
1153
+ "insert",
1154
+ "insertMany",
1155
+ "update",
1156
+ "delete",
1157
+ "upsert"
1158
+ ]);
1153
1159
  function errorWithCode(error) {
1154
1160
  if (error instanceof Error) {
1155
1161
  const sqlite = /no such table: (\S+)/.exec(error.message);
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "homepage": "https://adep.top",
9
9
  "bugs": "https://gitcode.com/yunqiang_wu/ai-yunke/issues",
10
- "version": "0.3.14",
10
+ "version": "0.3.15",
11
11
  "private": false,
12
12
  "type": "module",
13
13
  "sideEffects": false,