@odla-ai/chapter 0.33.0 → 0.33.2

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/dist/index.d.cts CHANGED
@@ -300,17 +300,35 @@ interface ChapterPolicy {
300
300
  type ChapterMode = "chapter" | "hub";
301
301
  /** One odla-db transaction op — the wire shape both the real admin client and a
302
302
  * test double (`FakeDb`) accept. Built as a plain object, never via a `tx` proxy. */
303
- interface DbOp {
303
+ interface DbOp<Id extends string | {
304
+ ns: string;
305
+ attr: string;
306
+ value: string | number | boolean;
307
+ } = string> {
304
308
  t: "update" | "merge" | "retract" | "delete";
305
309
  ns: string;
306
- id: string;
310
+ id: Id;
307
311
  attrs?: Record<string, unknown>;
308
312
  }
309
313
  /** The structural view of the odla-db admin client the worker builds and the
310
314
  * member routes consume — so route logic is testable against an in-memory fake. */
311
315
  interface ChapterDb {
312
316
  query(q: Record<string, unknown>): Promise<Record<string, Array<Record<string, unknown>>>>;
313
- transact(ops: DbOp[], opts?: {
317
+ /** Optional bounded aggregate supported by the real privileged odla-db
318
+ * client. Routes use it to prove a result set is non-empty before issuing
319
+ * an ordered lookup, while small test doubles may continue to omit it. */
320
+ aggregate?(ns: string, spec: {
321
+ count?: boolean;
322
+ }, opts?: {
323
+ where?: Record<string, unknown>;
324
+ }): Promise<{
325
+ count?: number;
326
+ }>;
327
+ transact(ops: DbOp<string | {
328
+ ns: string;
329
+ attr: string;
330
+ value: string | number | boolean;
331
+ }>[], opts?: {
314
332
  mutationId?: string;
315
333
  }): Promise<{
316
334
  txId: number;
@@ -2016,7 +2034,7 @@ interface SignupControlReceipt {
2016
2034
  acknowledgedAt: number;
2017
2035
  }
2018
2036
  /** Stable reason codes returned when a follower refuses desired state. */
2019
- type SignupControlRejection = "invalid_document" | "invalid_digest" | "wrong_source" | "wrong_target" | "wrong_environment" | "wrong_stripe_mode" | "stale_revision" | "conflicting_revision";
2037
+ type SignupControlRejection = "invalid_document" | "invalid_digest" | "wrong_source" | "wrong_target" | "wrong_environment" | "wrong_stripe_mode" | "stale_revision" | "conflicting_revision" | "materialization_failed";
2020
2038
  /** Normalized document result returned by the package validator. */
2021
2039
  type SignupControlValidation = {
2022
2040
  ok: true;
package/dist/index.d.ts CHANGED
@@ -300,17 +300,35 @@ interface ChapterPolicy {
300
300
  type ChapterMode = "chapter" | "hub";
301
301
  /** One odla-db transaction op — the wire shape both the real admin client and a
302
302
  * test double (`FakeDb`) accept. Built as a plain object, never via a `tx` proxy. */
303
- interface DbOp {
303
+ interface DbOp<Id extends string | {
304
+ ns: string;
305
+ attr: string;
306
+ value: string | number | boolean;
307
+ } = string> {
304
308
  t: "update" | "merge" | "retract" | "delete";
305
309
  ns: string;
306
- id: string;
310
+ id: Id;
307
311
  attrs?: Record<string, unknown>;
308
312
  }
309
313
  /** The structural view of the odla-db admin client the worker builds and the
310
314
  * member routes consume — so route logic is testable against an in-memory fake. */
311
315
  interface ChapterDb {
312
316
  query(q: Record<string, unknown>): Promise<Record<string, Array<Record<string, unknown>>>>;
313
- transact(ops: DbOp[], opts?: {
317
+ /** Optional bounded aggregate supported by the real privileged odla-db
318
+ * client. Routes use it to prove a result set is non-empty before issuing
319
+ * an ordered lookup, while small test doubles may continue to omit it. */
320
+ aggregate?(ns: string, spec: {
321
+ count?: boolean;
322
+ }, opts?: {
323
+ where?: Record<string, unknown>;
324
+ }): Promise<{
325
+ count?: number;
326
+ }>;
327
+ transact(ops: DbOp<string | {
328
+ ns: string;
329
+ attr: string;
330
+ value: string | number | boolean;
331
+ }>[], opts?: {
314
332
  mutationId?: string;
315
333
  }): Promise<{
316
334
  txId: number;
@@ -2016,7 +2034,7 @@ interface SignupControlReceipt {
2016
2034
  acknowledgedAt: number;
2017
2035
  }
2018
2036
  /** Stable reason codes returned when a follower refuses desired state. */
2019
- type SignupControlRejection = "invalid_document" | "invalid_digest" | "wrong_source" | "wrong_target" | "wrong_environment" | "wrong_stripe_mode" | "stale_revision" | "conflicting_revision";
2037
+ type SignupControlRejection = "invalid_document" | "invalid_digest" | "wrong_source" | "wrong_target" | "wrong_environment" | "wrong_stripe_mode" | "stale_revision" | "conflicting_revision" | "materialization_failed";
2020
2038
  /** Normalized document result returned by the package validator. */
2021
2039
  type SignupControlValidation = {
2022
2040
  ok: true;