@party-stack/ontology-backend 0.6.0 → 0.8.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.
package/lib/delivery.d.ts CHANGED
@@ -39,6 +39,7 @@ export declare const DeliveryRecordSchema: Schema.Union<readonly [Schema.Struct<
39
39
  readonly now: Schema.String;
40
40
  readonly seed: Schema.NonEmptyString;
41
41
  }>>;
42
+ readonly timeoutMs: Schema.optional<Schema.Finite>;
42
43
  }>;
43
44
  readonly requestIdentity: Schema.String;
44
45
  readonly createdAt: Schema.Finite;
@@ -46,6 +47,7 @@ export declare const DeliveryRecordSchema: Schema.Union<readonly [Schema.Struct<
46
47
  readonly state: Schema.Literals<readonly ["queued", "sending", "acknowledged", "blocked"]>;
47
48
  readonly optimistic: Schema.Boolean;
48
49
  readonly attempts: Schema.Int;
50
+ readonly blockedBy: Schema.optional<Schema.Union<readonly [Schema.NonEmptyString, Schema.Literal<true>]>>;
49
51
  readonly retryFromAttempt: Schema.optional<Schema.Int>;
50
52
  readonly nextAttemptAt: Schema.optional<Schema.Finite>;
51
53
  readonly failureMessage: Schema.optional<Schema.String>;
@@ -118,6 +120,7 @@ export declare const DeliveryChangeSchema: Schema.Union<readonly [Schema.Struct<
118
120
  readonly now: Schema.String;
119
121
  readonly seed: Schema.NonEmptyString;
120
122
  }>>;
123
+ readonly timeoutMs: Schema.optional<Schema.Finite>;
121
124
  }>;
122
125
  readonly requestIdentity: Schema.String;
123
126
  readonly createdAt: Schema.Finite;
@@ -125,6 +128,7 @@ export declare const DeliveryChangeSchema: Schema.Union<readonly [Schema.Struct<
125
128
  readonly state: Schema.Literals<readonly ["queued", "sending", "acknowledged", "blocked"]>;
126
129
  readonly optimistic: Schema.Boolean;
127
130
  readonly attempts: Schema.Int;
131
+ readonly blockedBy: Schema.optional<Schema.Union<readonly [Schema.NonEmptyString, Schema.Literal<true>]>>;
128
132
  readonly retryFromAttempt: Schema.optional<Schema.Int>;
129
133
  readonly nextAttemptAt: Schema.optional<Schema.Finite>;
130
134
  readonly failureMessage: Schema.optional<Schema.String>;
@@ -252,6 +256,7 @@ export declare const DeliveryFrameSchema: Schema.Struct<{
252
256
  readonly now: Schema.String;
253
257
  readonly seed: Schema.NonEmptyString;
254
258
  }>>;
259
+ readonly timeoutMs: Schema.optional<Schema.Finite>;
255
260
  }>;
256
261
  readonly requestIdentity: Schema.String;
257
262
  readonly createdAt: Schema.Finite;
@@ -259,6 +264,7 @@ export declare const DeliveryFrameSchema: Schema.Struct<{
259
264
  readonly state: Schema.Literals<readonly ["queued", "sending", "acknowledged", "blocked"]>;
260
265
  readonly optimistic: Schema.Boolean;
261
266
  readonly attempts: Schema.Int;
267
+ readonly blockedBy: Schema.optional<Schema.Union<readonly [Schema.NonEmptyString, Schema.Literal<true>]>>;
262
268
  readonly retryFromAttempt: Schema.optional<Schema.Int>;
263
269
  readonly nextAttemptAt: Schema.optional<Schema.Finite>;
264
270
  readonly failureMessage: Schema.optional<Schema.String>;
@@ -388,6 +394,7 @@ export declare const DeliveryFrameCodec: Schema.Codec<{
388
394
  readonly now: string;
389
395
  readonly seed: string;
390
396
  } | undefined;
397
+ readonly timeoutMs?: number | undefined;
391
398
  };
392
399
  readonly requestIdentity: string;
393
400
  readonly createdAt: number;
@@ -395,6 +402,7 @@ export declare const DeliveryFrameCodec: Schema.Codec<{
395
402
  readonly state: "acknowledged" | "blocked" | "queued" | "sending";
396
403
  readonly optimistic: boolean;
397
404
  readonly attempts: number;
405
+ readonly blockedBy?: string | true | undefined;
398
406
  readonly retryFromAttempt?: number | undefined;
399
407
  readonly nextAttemptAt?: number | undefined;
400
408
  readonly failureMessage?: string | undefined;
@@ -627,6 +635,7 @@ export declare const makeDeliveryReceiver: (options: {
627
635
  readonly now: string;
628
636
  readonly seed: string;
629
637
  } | undefined;
638
+ readonly timeoutMs?: number | undefined;
630
639
  };
631
640
  readonly requestIdentity: string;
632
641
  readonly createdAt: number;
@@ -634,6 +643,7 @@ export declare const makeDeliveryReceiver: (options: {
634
643
  readonly state: "acknowledged" | "blocked" | "queued" | "sending";
635
644
  readonly optimistic: boolean;
636
645
  readonly attempts: number;
646
+ readonly blockedBy?: string | true | undefined;
637
647
  readonly retryFromAttempt?: number | undefined;
638
648
  readonly nextAttemptAt?: number | undefined;
639
649
  readonly failureMessage?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"delivery.d.ts","names":[],"sources":["../src/delivery.ts"],"mappings":";;;;;;qBAaa,mBAAiB,OAAA,gBAAA,OAAA;;;;;;;;qBAIjB,sBAAoB,OAAA,gBAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiBrB,cAAc,OAAO,OAAO,YAAY;YACxC,iBAAiB,OAAO,OAAO,YAAY;qBAC1C,sBAAoB,OAAA,gBAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAIrB,iBAAiB,OAAO,OAAO,YAAY;qBAC1C,wBAAsB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAgBvB,mBAAmB,OAAO,OAAO,YAAY;qBAE5C,wBAAsB,OAAA;;;;YACvB,mBAAmB,OAAO,OAAO,YAAY;qBAC5C,qBAAmB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAUpB,gBAAgB,OAAO,OAAO,YAAY;qBACzC,oBAAkB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,aAAa;WACjE,gBAAgB,OAAO,eAAe;;;;;;;;WAQtC,aAAa,aAAa,gCAAgC,OAAO;;;;;;;qBAQjE,sBAAmB;WACX,QAAA;WACG;MAssBtB,OAAA,OAAA,wBAAA,MAAA;UAQQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;;;;;;qBAUF,uBAAoB;EACrB,QAAA;EACG;EACE;EACF;;EAEG,eAAC,IAAI,aAAa,OAAO,qBAAqB,OAAO,aAAa;EACzE,QAAC,IAAI,aAAa,OAAO,qBAAqB,OAAO,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2RjC;MACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsB1C,iWAAA,MAAA"}
@@ -23,7 +23,8 @@ export declare const OntologyDescriptionCodec: Schema.Struct<{
23
23
  readonly watchSubset: Schema.optional<Schema.Boolean>;
24
24
  readonly actionParameterResolution: Schema.optional<Schema.Boolean>;
25
25
  readonly queries: Schema.optional<Schema.Boolean>;
26
- readonly pins: Schema.optional<Schema.Boolean>;
26
+ /** The endpoint serves its system ontology (downloads and replica status) as the `system` resource. */
27
+ readonly system: Schema.optional<Schema.Boolean>;
27
28
  /** The definition is also served as meta ontology rows on the `meta` resource. */
28
29
  readonly meta: Schema.optional<Schema.Boolean>;
29
30
  readonly attachments: Schema.optional<Schema.Struct<{
@@ -1 +1 @@
1
- {"version":3,"file":"description.d.ts","names":[],"sources":["../src/description.ts"],"mappings":";;;;qBAKa,0BAAwB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyBzB,6BAA6B,yBAAyB;;qBAErD"}
1
+ {"version":3,"file":"description.d.ts","names":[],"sources":["../src/description.ts"],"mappings":";;;;qBAKa,0BAAwB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA0BzB,6BAA6B,yBAAyB;;qBAErD"}
@@ -22,7 +22,8 @@ const OntologyDescriptionCodec = Schema.Struct({
22
22
  watchSubset: Schema.optional(Schema.Boolean),
23
23
  actionParameterResolution: Schema.optional(Schema.Boolean),
24
24
  queries: Schema.optional(Schema.Boolean),
25
- pins: Schema.optional(Schema.Boolean),
25
+ /** The endpoint serves its system ontology (downloads and replica status) as the `system` resource. */
26
+ system: Schema.optional(Schema.Boolean),
26
27
  /** The definition is also served as meta ontology rows on the `meta` resource. */
27
28
  meta: Schema.optional(Schema.Boolean),
28
29
  attachments: Schema.optional(Schema.Struct({ stage: Schema.Boolean })),
@@ -1 +1 @@
1
- {"version":3,"file":"description.js","names":[],"sources":["../src/description.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { protocolValueCodec } from \"./protocol.js\";\n\n/** The authenticated binding and capabilities needed to reopen a protocol client. The definition\n * itself is served as meta ontology rows on the `meta` resource; the hashes identify it. */\nexport const OntologyDescriptionCodec = Schema.Struct({\n /** The protocol version. 2 serves the definition on the `meta` resource instead of here;\n * a retained version 1 description is still read, with the definition it was accepted with. */\n version: Schema.Literals([1, 2]),\n replication: Schema.Literals([\"committed\", \"speculative\"]),\n /** Hash of the whole definition the endpoint serves. */\n definitionHash: Schema.optional(Schema.String),\n /** Hash of its contract (without presentation); requests and delivery frames carry it. */\n contractHash: Schema.optional(Schema.String),\n sourceId: Schema.NonEmptyString,\n context: Schema.optional(protocolValueCodec(Schema.Record(Schema.String, Schema.Unknown))),\n supportsIdempotency: Schema.Boolean,\n delivery: Schema.optional(Schema.Boolean),\n stateDelivery: Schema.optional(Schema.Boolean),\n changes: Schema.optional(Schema.Boolean),\n watchChanges: Schema.optional(Schema.Boolean),\n watchSubset: Schema.optional(Schema.Boolean),\n actionParameterResolution: Schema.optional(Schema.Boolean),\n queries: Schema.optional(Schema.Boolean),\n pins: Schema.optional(Schema.Boolean),\n /** The definition is also served as meta ontology rows on the `meta` resource. */\n meta: Schema.optional(Schema.Boolean),\n attachments: Schema.optional(Schema.Struct({ stage: Schema.Boolean })),\n encrypted: Schema.optional(Schema.Boolean),\n});\nexport type OntologyDescription = typeof OntologyDescriptionCodec.Type;\n/** The protocol version servers describe and clients require from a fresh description. */\nexport const ontologyProtocolVersion = 2 as const;\n"],"mappings":";;;;;AAKA,MAAa,2BAA2B,OAAO,OAAO;;;CAGlD,SAAS,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;CAC/B,aAAa,OAAO,SAAS,CAAC,aAAa,aAAa,CAAC;;CAEzD,gBAAgB,OAAO,SAAS,OAAO,MAAM;;CAE7C,cAAc,OAAO,SAAS,OAAO,MAAM;CAC3C,UAAU,OAAO;CACjB,SAAS,OAAO,SAAS,mBAAmB,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO,CAAC,CAAC;CACzF,qBAAqB,OAAO;CAC5B,UAAU,OAAO,SAAS,OAAO,OAAO;CACxC,eAAe,OAAO,SAAS,OAAO,OAAO;CAC7C,SAAS,OAAO,SAAS,OAAO,OAAO;CACvC,cAAc,OAAO,SAAS,OAAO,OAAO;CAC5C,aAAa,OAAO,SAAS,OAAO,OAAO;CAC3C,2BAA2B,OAAO,SAAS,OAAO,OAAO;CACzD,SAAS,OAAO,SAAS,OAAO,OAAO;CACvC,MAAM,OAAO,SAAS,OAAO,OAAO;;CAEpC,MAAM,OAAO,SAAS,OAAO,OAAO;CACpC,aAAa,OAAO,SAAS,OAAO,OAAO,EAAE,OAAO,OAAO,QAAQ,CAAC,CAAC;CACrE,WAAW,OAAO,SAAS,OAAO,OAAO;AAC7C,CAAC;;AAGD,MAAa,0BAA0B"}
1
+ {"version":3,"file":"description.js","names":[],"sources":["../src/description.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { protocolValueCodec } from \"./protocol.js\";\n\n/** The authenticated binding and capabilities needed to reopen a protocol client. The definition\n * itself is served as meta ontology rows on the `meta` resource; the hashes identify it. */\nexport const OntologyDescriptionCodec = Schema.Struct({\n /** The protocol version. 2 serves the definition on the `meta` resource instead of here;\n * a retained version 1 description is still read, with the definition it was accepted with. */\n version: Schema.Literals([1, 2]),\n replication: Schema.Literals([\"committed\", \"speculative\"]),\n /** Hash of the whole definition the endpoint serves. */\n definitionHash: Schema.optional(Schema.String),\n /** Hash of its contract (without presentation); requests and delivery frames carry it. */\n contractHash: Schema.optional(Schema.String),\n sourceId: Schema.NonEmptyString,\n context: Schema.optional(protocolValueCodec(Schema.Record(Schema.String, Schema.Unknown))),\n supportsIdempotency: Schema.Boolean,\n delivery: Schema.optional(Schema.Boolean),\n stateDelivery: Schema.optional(Schema.Boolean),\n changes: Schema.optional(Schema.Boolean),\n watchChanges: Schema.optional(Schema.Boolean),\n watchSubset: Schema.optional(Schema.Boolean),\n actionParameterResolution: Schema.optional(Schema.Boolean),\n queries: Schema.optional(Schema.Boolean),\n /** The endpoint serves its system ontology (downloads and replica status) as the `system` resource. */\n system: Schema.optional(Schema.Boolean),\n /** The definition is also served as meta ontology rows on the `meta` resource. */\n meta: Schema.optional(Schema.Boolean),\n attachments: Schema.optional(Schema.Struct({ stage: Schema.Boolean })),\n encrypted: Schema.optional(Schema.Boolean),\n});\nexport type OntologyDescription = typeof OntologyDescriptionCodec.Type;\n/** The protocol version servers describe and clients require from a fresh description. */\nexport const ontologyProtocolVersion = 2 as const;\n"],"mappings":";;;;;AAKA,MAAa,2BAA2B,OAAO,OAAO;;;CAGlD,SAAS,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;CAC/B,aAAa,OAAO,SAAS,CAAC,aAAa,aAAa,CAAC;;CAEzD,gBAAgB,OAAO,SAAS,OAAO,MAAM;;CAE7C,cAAc,OAAO,SAAS,OAAO,MAAM;CAC3C,UAAU,OAAO;CACjB,SAAS,OAAO,SAAS,mBAAmB,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO,CAAC,CAAC;CACzF,qBAAqB,OAAO;CAC5B,UAAU,OAAO,SAAS,OAAO,OAAO;CACxC,eAAe,OAAO,SAAS,OAAO,OAAO;CAC7C,SAAS,OAAO,SAAS,OAAO,OAAO;CACvC,cAAc,OAAO,SAAS,OAAO,OAAO;CAC5C,aAAa,OAAO,SAAS,OAAO,OAAO;CAC3C,2BAA2B,OAAO,SAAS,OAAO,OAAO;CACzD,SAAS,OAAO,SAAS,OAAO,OAAO;;CAEvC,QAAQ,OAAO,SAAS,OAAO,OAAO;;CAEtC,MAAM,OAAO,SAAS,OAAO,OAAO;CACpC,aAAa,OAAO,SAAS,OAAO,OAAO,EAAE,OAAO,OAAO,QAAQ,CAAC,CAAC;CACrE,WAAW,OAAO,SAAS,OAAO,OAAO;AAC7C,CAAC;;AAGD,MAAa,0BAA0B"}
package/lib/errors.d.ts CHANGED
@@ -46,6 +46,14 @@ declare const Fields: {
46
46
  readonly source: Schema.optional<Schema.Literals<readonly ["parameter", "submission", "user-facing"]>>;
47
47
  readonly messageSource: Schema.optional<Schema.Literals<readonly ["standard", "configured"]>>;
48
48
  }>>>;
49
+ /** Set when an action is still pending behind an earlier blocked action: its queue
50
+ * stopped there and sends nothing after it until that action is retried, reconciled
51
+ * or removed. The waiting action keeps its place in the queue. */
52
+ blockedBy: Schema.optional<Schema.Struct<{
53
+ readonly id: Schema.String;
54
+ readonly name: Schema.String;
55
+ readonly failure: Schema.optional<Schema.Literals<readonly ["Unauthenticated", "Forbidden", "NotFound", "ValidationFailed", "InvalidRequest", "InvalidResponse", "InvalidConfiguration", "Conflict", "NotImplemented", "RateLimited", "Unavailable", "Internal", "HistoryExpired", "SessionExpired", "SessionReplaced", "ViewReplaced", "ResultExpired", "SourceMismatch", "SchemaMismatch"]>>;
56
+ }>>;
49
57
  cause: Schema.optional<Schema.Defect>;
50
58
  };
51
59
  declare const BackendError_base: Schema.Class<BackendError<"Conflict" | "Forbidden" | "HistoryExpired" | "Internal" | "InvalidConfiguration" | "InvalidRequest" | "InvalidResponse" | "NotFound" | "NotImplemented" | "RateLimited" | "ResultExpired" | "SchemaMismatch" | "SessionExpired" | "SessionReplaced" | "SourceMismatch" | "Unauthenticated" | "Unavailable" | "ValidationFailed" | "ViewReplaced">, Schema.TaggedStruct<"BackendError", {
@@ -63,6 +71,14 @@ declare const BackendError_base: Schema.Class<BackendError<"Conflict" | "Forbidd
63
71
  readonly source: Schema.optional<Schema.Literals<readonly ["parameter", "submission", "user-facing"]>>;
64
72
  readonly messageSource: Schema.optional<Schema.Literals<readonly ["standard", "configured"]>>;
65
73
  }>>>;
74
+ /** Set when an action is still pending behind an earlier blocked action: its queue
75
+ * stopped there and sends nothing after it until that action is retried, reconciled
76
+ * or removed. The waiting action keeps its place in the queue. */
77
+ blockedBy: Schema.optional<Schema.Struct<{
78
+ readonly id: Schema.String;
79
+ readonly name: Schema.String;
80
+ readonly failure: Schema.optional<Schema.Literals<readonly ["Unauthenticated", "Forbidden", "NotFound", "ValidationFailed", "InvalidRequest", "InvalidResponse", "InvalidConfiguration", "Conflict", "NotImplemented", "RateLimited", "Unavailable", "Internal", "HistoryExpired", "SessionExpired", "SessionReplaced", "ViewReplaced", "ResultExpired", "SourceMismatch", "SchemaMismatch"]>>;
81
+ }>>;
66
82
  cause: Schema.optional<Schema.Defect>;
67
83
  }>, import("effect/Cause").YieldableError>;
68
84
  /** Shared wire schema; hooks narrow the kind without duplicating error classes. */
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","names":[],"sources":["../src/errors.ts"],"mappings":";;;qBAQa,uBAAqB,OAAA;;;;;;;;qBAQrB,wBAAsB,OAAA,gBAAA,OAAA;;;;;;;;;;;;;;;;;;;YAUvB,0BAA0B,uBAAuB;qBAEhD,wBAAsB,OAAA;YAqBvB,0BAA0B,uBAAuB;cACvD;EACF,WAAS,OAAA;EACT,MAAI,OAAA;EACJ,SAAO,OAAA;EACP,WAAS,OAAA;EACT,eAAa,OAAA,SAAA,OAAA;EACb,cAAY,OAAA,SAAA,OAAA;EACZ,QAAM,OAAA,SAAA,OAAA,OAAA,OAA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AAY;aAA8B,MAAM;;;;qBAKlF,qBAAkB,OAAW,KAAK;YAsBnC;YAaA,mBAAmB,aAAa;YAChC,sBAAsB,aAAa;YACnC;YAQA,mBAAmB,aAAa;YAChC,kBAAkB,aAC1B,QAAQ;qBAGC,kBAAe,kBAAA,UAAuD,iBAAY;qBASlF,yBAAsB,mBAAqB,SAAS;;qBAIpD,yBAAsB,OAAW;;wBAuB9B,uBAAuB,mBAAmB,iBAAiB;iBA6L1D;;WAEJ;WACA;;WAEA;;YAED,8CAGJ,OAAO,cAAc,SAAS,2BAA2B;wBACjD,uBACZ,OAAO,iBACP,SAAS,yBACV;;;wBA4Ba,oBACZ,OAAO,cACP,SAAQ,iBACR,UAAS,yBACV;YA2CS,uBAAuB;;wBAGnB,uBAAuB,OAAO,OAAO,uBAAuB"}
package/lib/errors.js CHANGED
@@ -59,6 +59,14 @@ const Fields = {
59
59
  actionOutcome: Schema.optional(Schema.Literals(["not-committed", "unknown"])),
60
60
  retryAfterMs: Schema.optional(Schema.Finite),
61
61
  issues: Schema.optional(Schema.Array(ValidationIssueSchema)),
62
+ /** Set when an action is still pending behind an earlier blocked action: its queue
63
+ * stopped there and sends nothing after it until that action is retried, reconciled
64
+ * or removed. The waiting action keeps its place in the queue. */
65
+ blockedBy: Schema.optional(Schema.Struct({
66
+ id: Schema.String,
67
+ name: Schema.String,
68
+ failure: Schema.optional(BackendErrorKindSchema)
69
+ })),
62
70
  cause: Schema.optional(Schema.Defect())
63
71
  };
64
72
  /** Shared wire schema; hooks narrow the kind without duplicating error classes. */
package/lib/errors.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { OntologyStorageError } from \"@party-stack/ontology-storage\";\nimport { BlobStorageError } from \"@party-stack/ontology-storage/blobs\";\nimport { Predicate, Schema, SchemaIssue, Redacted } from \"effect\";\nimport { HttpClientError } from \"effect/http\";\nimport { RpcClientError } from \"effect/rpc\";\nimport type { ValidationIssue } from \"@party-stack/ontology-spec\";\n\nexport type { ValidationIssue };\nexport const ValidationIssueSchema = Schema.Struct({\n message: Schema.String,\n path: Schema.optional(Schema.Array(Schema.Union([Schema.String, Schema.Number]))),\n code: Schema.optional(Schema.String),\n category: Schema.optional(Schema.Literals([\"input\", \"reference\", \"custom\"])),\n source: Schema.optional(Schema.Literals([\"parameter\", \"submission\", \"user-facing\"])),\n messageSource: Schema.optional(Schema.Literals([\"standard\", \"configured\"])),\n});\nexport const ValidationReportSchema = Schema.Union([\n Schema.Struct({ certain: Schema.Literal(false) }),\n Schema.Struct({\n certain: Schema.Literal(true),\n value: Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"ok\"), value: Schema.Void }),\n Schema.Struct({ kind: Schema.Literal(\"err\"), value: Schema.Array(ValidationIssueSchema) }),\n ]),\n }),\n]);\nexport type ValidationReport = typeof ValidationReportSchema.Type;\n\nexport const BackendErrorKindSchema = Schema.Literals([\n \"Unauthenticated\",\n \"Forbidden\",\n \"NotFound\",\n \"ValidationFailed\",\n \"InvalidRequest\",\n \"InvalidResponse\",\n \"InvalidConfiguration\",\n \"Conflict\",\n \"NotImplemented\",\n \"RateLimited\",\n \"Unavailable\",\n \"Internal\",\n \"HistoryExpired\",\n \"SessionExpired\",\n \"SessionReplaced\",\n \"ViewReplaced\",\n \"ResultExpired\",\n \"SourceMismatch\",\n \"SchemaMismatch\",\n]);\nexport type BackendErrorKind = typeof BackendErrorKindSchema.Type;\nconst Fields = {\n operation: Schema.String,\n kind: BackendErrorKindSchema,\n message: Schema.String,\n retryable: Schema.Boolean,\n actionOutcome: Schema.optional(Schema.Literals([\"not-committed\", \"unknown\"])),\n retryAfterMs: Schema.optional(Schema.Finite),\n issues: Schema.optional(Schema.Array(ValidationIssueSchema)),\n cause: Schema.optional(Schema.Defect()),\n};\n/** Shared wire schema; hooks narrow the kind without duplicating error classes. */\nexport class BackendError<\n K extends BackendErrorKind = BackendErrorKind,\n> extends Schema.TaggedError<BackendError>()(\"BackendError\", Fields) {\n declare readonly kind: K;\n constructor(properties: Omit<Schema.Struct.Type<typeof Fields>, \"kind\"> & { readonly kind: K }) {\n super(properties);\n }\n}\n/** HTTP bindings share these statuses; RPC still carries the typed error schema. */\nexport const backendErrorStatus = (error: Pick<BackendError, \"kind\">): number =>\n ({\n Unauthenticated: 401,\n Forbidden: 403,\n NotFound: 404,\n ValidationFailed: 422,\n InvalidRequest: 400,\n InvalidResponse: 502,\n InvalidConfiguration: 500,\n Conflict: 409,\n NotImplemented: 501,\n RateLimited: 429,\n Unavailable: 503,\n Internal: 500,\n HistoryExpired: 409,\n SessionExpired: 409,\n SessionReplaced: 409,\n ViewReplaced: 409,\n ResultExpired: 409,\n SourceMismatch: 409,\n SchemaMismatch: 409,\n })[error.kind];\nexport type OperationErrorKind =\n | \"Unauthenticated\"\n | \"Forbidden\"\n | \"NotFound\"\n | \"ValidationFailed\"\n | \"InvalidRequest\"\n | \"InvalidResponse\"\n | \"InvalidConfiguration\"\n | \"Conflict\"\n | \"NotImplemented\"\n | \"RateLimited\"\n | \"Unavailable\"\n | \"Internal\";\nexport type ApplyActionError = BackendError<OperationErrorKind>;\nexport type ValidateActionError = BackendError<OperationErrorKind>;\nexport type ReplicationErrorKind =\n | \"HistoryExpired\"\n | \"SessionExpired\"\n | \"SessionReplaced\"\n | \"ViewReplaced\"\n | \"ResultExpired\"\n | \"SourceMismatch\"\n | \"SchemaMismatch\";\nexport type ReplicationError = BackendError<ReplicationErrorKind>;\nexport type LoadSubsetError = BackendError<\n Exclude<OperationErrorKind, \"ValidationFailed\"> | \"HistoryExpired\"\n>;\n\nexport const unauthenticated = (message = \"Authentication is required.\", options?: ErrorOptions) =>\n new BackendError({\n operation: \"authentication\",\n kind: \"Unauthenticated\",\n message,\n retryable: false,\n actionOutcome: \"not-committed\",\n cause: options?.cause,\n });\nexport const isUnauthenticatedError = (error: unknown): error is BackendError<\"Unauthenticated\"> =>\n error instanceof BackendError && error.kind === \"Unauthenticated\";\n\n/** Unknown outcomes apply to dispatch/execution failures, never ordinary rejections. */\nexport const isUnknownActionOutcome = (error: BackendError) =>\n error.actionOutcome === \"unknown\" ||\n (error.actionOutcome === undefined &&\n (error.kind === \"Unavailable\" || error.kind === \"Internal\" || error.kind === \"InvalidResponse\"));\n\nconst ProviderFailure = Schema.Struct({\n reason: Schema.optional(Schema.Unknown),\n cause: Schema.optional(Schema.Unknown),\n response: Schema.optional(\n Schema.Struct({\n status: Schema.Number,\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n })\n ),\n retryAfterMs: Schema.optional(Schema.Finite),\n status: Schema.optional(Schema.Number),\n statusCode: Schema.optional(Schema.Number),\n errorCode: Schema.optional(Schema.String),\n errorName: Schema.optional(Schema.String),\n code: Schema.optional(Schema.String),\n parameters: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n});\n/** Normalize SDK failures. No provider message/body is made public by this classifier. */\nexport function classifyBackendFailure(operation: string, cause: unknown): BackendError {\n if (cause instanceof BackendError) return cause;\n // Effect RPC currently puts HTTP EOF in RpcClientDefect alongside decoding\n // failures. Only its two explicit EOF cases mean transport loss; malformed\n // frames must remain terminal InvalidResponse failures. Replace this narrow\n // normalization when upstream exposes a structured interrupted-response reason.\n if (\n cause instanceof RpcClientError.RpcClientError &&\n cause.reason._tag === \"RpcClientDefect\" &&\n (cause.reason.message === \"HTTP response ended before RPC request completed\" ||\n cause.reason.message === \"Received empty HTTP response from RPC server\")\n )\n return new BackendError({\n operation,\n kind: \"Unavailable\",\n message: \"The RPC connection was interrupted.\",\n retryable: true,\n actionOutcome: \"unknown\",\n cause: Redacted.make(cause),\n });\n if (\n (cause instanceof RpcClientError.RpcClientError && cause.reason._tag === \"RpcClientDefect\") ||\n (cause instanceof HttpClientError.HttpClientError && cause.reason._tag === \"DecodeError\")\n )\n return new BackendError({\n operation,\n kind: \"InvalidResponse\",\n message: \"The source returned an invalid response.\",\n retryable: false,\n actionOutcome: \"unknown\",\n cause: Redacted.make(cause),\n });\n if (\n cause instanceof HttpClientError.HttpClientError &&\n (cause.reason._tag === \"EncodeError\" || cause.reason._tag === \"InvalidUrlError\")\n )\n return new BackendError({\n operation,\n kind: cause.reason._tag === \"EncodeError\" ? \"InvalidRequest\" : \"InvalidConfiguration\",\n message: \"The request could not be constructed.\",\n retryable: false,\n actionOutcome: \"not-committed\",\n cause: Redacted.make(cause),\n });\n const blob =\n cause instanceof BlobStorageError\n ? cause\n : cause instanceof OntologyStorageError && cause.reason._tag === \"BlobStorageError\"\n ? cause.reason\n : undefined;\n if (blob) {\n return new BackendError({\n operation,\n kind:\n blob.kind === \"NotFound\"\n ? \"NotFound\"\n : blob.kind === \"InvalidValue\"\n ? \"InvalidRequest\"\n : blob.kind === \"Busy\" || blob.kind === \"Conflict\"\n ? \"Conflict\"\n : \"Unavailable\",\n message:\n blob.kind === \"NotFound\"\n ? \"Attachment is unavailable.\"\n : blob.kind === \"Busy\"\n ? \"Attachment upload is still in progress.\"\n : blob.kind === \"Conflict\"\n ? \"Attachment state conflicts with this operation.\"\n : blob.kind === \"InvalidValue\"\n ? \"Invalid attachment value.\"\n : \"Attachment storage is unavailable.\",\n retryable: blob.kind === \"Busy\" || blob.kind === \"Bytes\",\n cause: Redacted.make(cause),\n });\n }\n if (cause instanceof OntologyStorageError) {\n const reason = cause.reason;\n const kind: BackendErrorKind =\n reason._tag === \"QueryError\"\n ? \"InvalidRequest\"\n : reason._tag === \"ConfigurationError\" || reason._tag === \"IndexError\"\n ? \"InvalidConfiguration\"\n : reason._tag === \"DefinitionMismatch\" || reason._tag === \"SchemaMismatch\"\n ? \"SchemaMismatch\"\n : reason._tag === \"UniqueConstraint\"\n ? \"Conflict\"\n : reason._tag === \"StorageError\" ||\n (reason._tag === \"TransactionError\" && reason.kind === \"Backend\")\n ? \"Unavailable\"\n : \"Internal\";\n return new BackendError({\n operation,\n kind,\n message:\n kind === \"InvalidRequest\"\n ? \"Invalid storage query.\"\n : kind === \"SchemaMismatch\"\n ? \"Storage schema changed; migrate or reset explicitly.\"\n : \"Storage operation failed.\",\n retryable: cause.isRetryable,\n cause: Redacted.make(cause),\n });\n }\n let candidate = cause;\n let value: typeof ProviderFailure.Type | undefined;\n for (let depth = 0; depth < 5; depth++) {\n if (candidate instanceof BackendError) return candidate;\n const decoded = Schema.decodeUnknownOption(ProviderFailure)(candidate);\n if (decoded._tag === \"None\") break;\n value = decoded.value;\n if (value.cause instanceof BackendError) return value.cause;\n if (\n value.status !== undefined ||\n value.statusCode !== undefined ||\n value.errorCode !== undefined ||\n value.code !== undefined ||\n value.errorName !== undefined ||\n value.response\n )\n break;\n candidate = value.reason ?? value.cause;\n }\n const status = value?.status ?? value?.statusCode ?? value?.response?.status;\n const code = value?.errorCode ?? value?.code;\n const name = value?.errorName?.split(\":\").at(-1);\n const kind: OperationErrorKind =\n status === 501\n ? \"NotImplemented\"\n : status === 401 || code === \"UNAUTHORIZED\" || code === \"INVALID_SESSION_ID\"\n ? \"Unauthenticated\"\n : status === 429 || code === \"REQUEST_LIMIT_EXCEEDED\" || name === \"RateLimitReached\"\n ? \"RateLimited\"\n : status === 403 || code === \"PERMISSION_DENIED\" || code === \"INSUFFICIENT_ACCESS_OR_READONLY\"\n ? \"Forbidden\"\n : status === 404 || code === \"NOT_FOUND\"\n ? \"NotFound\"\n : name === \"FunctionEncounteredUserFacingError\" ||\n name === \"QueryEncounteredUserFacingError\"\n ? \"ValidationFailed\"\n : code === \"FIELD_CUSTOM_VALIDATION_EXCEPTION\" || code === \"REQUIRED_FIELD_MISSING\"\n ? \"ValidationFailed\"\n : status === 400 || code === \"INVALID_ARGUMENT\"\n ? \"InvalidRequest\"\n : status === 409\n ? \"Conflict\"\n : \"Unavailable\";\n const authored =\n name === \"FunctionEncounteredUserFacingError\" || name === \"QueryEncounteredUserFacingError\";\n const issues: readonly ValidationIssue[] | undefined =\n authored && Predicate.isString(value?.parameters?.message)\n ? [\n {\n message: value.parameters.message,\n code: \"custom\",\n category: \"custom\",\n source: \"user-facing\",\n messageSource: \"configured\",\n },\n ]\n : undefined;\n const seconds = value?.response?.headers?.[\"retry-after\"];\n const retryAfterMs =\n value?.retryAfterMs ??\n (seconds !== undefined && /^\\d+(?:\\.\\d+)?$/.test(seconds) ? Number(seconds) * 1_000 : undefined);\n return new BackendError({\n operation,\n kind,\n retryAfterMs,\n message: {\n Unauthenticated: \"Authentication is required.\",\n Forbidden: \"This operation is not permitted.\",\n NotFound: \"Resource not found.\",\n ValidationFailed: \"Submission failed validation.\",\n InvalidRequest: \"The request is invalid.\",\n InvalidResponse: \"The source returned an invalid response.\",\n InvalidConfiguration: \"The service is configured incorrectly.\",\n Conflict: \"The operation conflicts with current state.\",\n NotImplemented: \"This operation is not implemented.\",\n RateLimited: \"Too many requests. Try again later.\",\n Unavailable: \"The service is unavailable. Try again later.\",\n Internal: \"The operation could not be completed.\",\n }[kind],\n retryable: kind === \"Unavailable\" || kind === \"RateLimited\",\n actionOutcome: kind === \"Unavailable\" ? \"unknown\" : \"not-committed\",\n issues,\n cause: Redacted.make(cause),\n });\n}\n\nexport interface ErrorProjectionContext {\n /** Visible action parameter paths. Hidden/fixed parameters must not appear in public issues. */\n readonly parameters?: readonly string[];\n readonly objectReferenceParameters?: readonly string[];\n /** An upstream connection failure cannot request downstream sign-in. */\n readonly upstream?: boolean;\n}\nexport type ErrorProjection =\n | \"forward\"\n | \"projected\"\n | ((error: BackendError, context: ErrorProjectionContext) => BackendError);\nexport function projectValidationIssue(\n issue: ValidationIssue,\n context: ErrorProjectionContext\n): ValidationIssue | undefined {\n const parameter = issue.path?.[0];\n if (!Predicate.isString(parameter) || !context.parameters?.includes(parameter)) return undefined;\n if (issue.category === \"input\") {\n const standard: Readonly<Record<string, string>> = {\n required: \"A value is required.\",\n type: \"Enter a valid value.\",\n range: \"Enter a value in the allowed range.\",\n arraySize: \"Choose an allowed number of items.\",\n stringLength: \"Enter a value of the allowed length.\",\n regex: \"Enter a value in the required format.\",\n };\n const message = issue.messageSource === \"standard\" ? issue.message : standard[issue.code ?? \"\"];\n if (message)\n return {\n message,\n path: issue.path,\n code: issue.code,\n category: \"input\",\n messageSource: \"standard\",\n };\n }\n if (issue.code === \"InvalidObjectReference\")\n return { message: \"Choose a valid value.\", path: issue.path, code: \"InvalidObjectReference\" };\n return undefined;\n}\n/** Forwarding preserves the original error. Projection removes raw causes and\n * cannot change execution/retry facts. */\nexport function projectBackendError(\n error: BackendError,\n policy: ErrorProjection = \"projected\",\n context: ErrorProjectionContext = {}\n): BackendError {\n if (policy === \"forward\") return error;\n const shown = typeof policy === \"function\" ? policy(error, context) : error;\n const kind = error.kind === \"Unauthenticated\" && context.upstream ? \"Unavailable\" : shown.kind;\n const issues =\n shown.kind !== \"ValidationFailed\"\n ? undefined\n : policy === \"projected\"\n ? error.issues?.flatMap((issue) => {\n const visible = projectValidationIssue(issue, context);\n return visible ? [visible] : [];\n })\n : shown.issues;\n const message =\n policy !== \"projected\"\n ? shown.message\n : kind === \"ValidationFailed\"\n ? \"Submission failed validation.\"\n : kind === \"InvalidRequest\"\n ? \"The request is invalid.\"\n : kind === \"InvalidResponse\"\n ? \"The source returned an invalid response.\"\n : kind === \"Unauthenticated\"\n ? \"Authentication is required.\"\n : kind === \"Forbidden\"\n ? \"This operation is not permitted.\"\n : kind === \"NotFound\"\n ? \"Resource not found.\"\n : kind === \"RateLimited\"\n ? \"Too many requests. Try again later.\"\n : kind === \"NotImplemented\"\n ? \"This operation is not implemented.\"\n : \"The operation could not be completed.\";\n return new BackendError({\n operation: error.operation,\n kind,\n message,\n issues: issues?.length ? issues : undefined,\n retryable: error.retryable,\n actionOutcome: error.actionOutcome,\n retryAfterMs: error.retryAfterMs,\n });\n}\nexport type UnauthenticatedError = BackendError<\"Unauthenticated\">;\n\n/** Schema diagnostics retain paths without echoing input values or internal schemas. */\nexport function schemaValidationIssues(error: Schema.SchemaError): readonly ValidationIssue[] {\n return SchemaIssue.makeFormatterStandardSchemaV1({\n leafHook: (issue) => (issue._tag === \"MissingKey\" ? \"A value is required.\" : \"Enter a valid value.\"),\n checkHook: () => \"Enter a valid value.\",\n })(error.issue).issues.map((issue) => ({\n message: issue.message,\n path: issue.path?.flatMap((part) =>\n typeof part === \"string\" || typeof part === \"number\" ? [part] : []\n ),\n category: \"input\",\n code: issue.message === \"A value is required.\" ? \"required\" : \"type\",\n source: \"parameter\",\n messageSource: \"standard\",\n }));\n}\n"],"mappings":";;;;;;AAQA,MAAa,wBAAwB,OAAO,OAAO;CAC/C,SAAS,OAAO;CAChB,MAAM,OAAO,SAAS,OAAO,MAAM,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,MAAM,CAAC,CAAC,CAAC;CAChF,MAAM,OAAO,SAAS,OAAO,MAAM;CACnC,UAAU,OAAO,SAAS,OAAO,SAAS;EAAC;EAAS;EAAa;CAAQ,CAAC,CAAC;CAC3E,QAAQ,OAAO,SAAS,OAAO,SAAS;EAAC;EAAa;EAAc;CAAa,CAAC,CAAC;CACnF,eAAe,OAAO,SAAS,OAAO,SAAS,CAAC,YAAY,YAAY,CAAC,CAAC;AAC9E,CAAC;AACD,MAAa,yBAAyB,OAAO,MAAM,CAC/C,OAAO,OAAO,EAAE,SAAS,OAAO,QAAQ,KAAK,EAAE,CAAC,GAChD,OAAO,OAAO;CACV,SAAS,OAAO,QAAQ,IAAI;CAC5B,OAAO,OAAO,MAAM,CAChB,OAAO,OAAO;EAAE,MAAM,OAAO,QAAQ,IAAI;EAAG,OAAO,OAAO;CAAK,CAAC,GAChE,OAAO,OAAO;EAAE,MAAM,OAAO,QAAQ,KAAK;EAAG,OAAO,OAAO,MAAM,qBAAqB;CAAE,CAAC,CAC7F,CAAC;AACL,CAAC,CACL,CAAC;AAGD,MAAa,yBAAyB,OAAO,SAAS;CAClD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ,CAAC;AAED,MAAM,SAAS;CACX,WAAW,OAAO;CAClB,MAAM;CACN,SAAS,OA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,SAAS,YAAY,OAAO,SAAS,WAAW,CAAC,IAAI,IAAI,CAAC,CACrE;EACA,UAAU;EACV,MAAM,MAAM,YAAY,yBAAyB,aAAa;EAC9D,QAAQ;EACR,eAAe;CACnB,EAAE;AACN"}
1
+ {"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { OntologyStorageError } from \"@party-stack/ontology-storage\";\nimport { BlobStorageError } from \"@party-stack/ontology-storage/blobs\";\nimport { Predicate, Schema, SchemaIssue, Redacted } from \"effect\";\nimport { HttpClientError } from \"effect/http\";\nimport { RpcClientError } from \"effect/rpc\";\nimport type { ValidationIssue } from \"@party-stack/ontology-spec\";\n\nexport type { ValidationIssue };\nexport const ValidationIssueSchema = Schema.Struct({\n message: Schema.String,\n path: Schema.optional(Schema.Array(Schema.Union([Schema.String, Schema.Number]))),\n code: Schema.optional(Schema.String),\n category: Schema.optional(Schema.Literals([\"input\", \"reference\", \"custom\"])),\n source: Schema.optional(Schema.Literals([\"parameter\", \"submission\", \"user-facing\"])),\n messageSource: Schema.optional(Schema.Literals([\"standard\", \"configured\"])),\n});\nexport const ValidationReportSchema = Schema.Union([\n Schema.Struct({ certain: Schema.Literal(false) }),\n Schema.Struct({\n certain: Schema.Literal(true),\n value: Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"ok\"), value: Schema.Void }),\n Schema.Struct({ kind: Schema.Literal(\"err\"), value: Schema.Array(ValidationIssueSchema) }),\n ]),\n }),\n]);\nexport type ValidationReport = typeof ValidationReportSchema.Type;\n\nexport const BackendErrorKindSchema = Schema.Literals([\n \"Unauthenticated\",\n \"Forbidden\",\n \"NotFound\",\n \"ValidationFailed\",\n \"InvalidRequest\",\n \"InvalidResponse\",\n \"InvalidConfiguration\",\n \"Conflict\",\n \"NotImplemented\",\n \"RateLimited\",\n \"Unavailable\",\n \"Internal\",\n \"HistoryExpired\",\n \"SessionExpired\",\n \"SessionReplaced\",\n \"ViewReplaced\",\n \"ResultExpired\",\n \"SourceMismatch\",\n \"SchemaMismatch\",\n]);\nexport type BackendErrorKind = typeof BackendErrorKindSchema.Type;\nconst Fields = {\n operation: Schema.String,\n kind: BackendErrorKindSchema,\n message: Schema.String,\n retryable: Schema.Boolean,\n actionOutcome: Schema.optional(Schema.Literals([\"not-committed\", \"unknown\"])),\n retryAfterMs: Schema.optional(Schema.Finite),\n issues: Schema.optional(Schema.Array(ValidationIssueSchema)),\n /** Set when an action is still pending behind an earlier blocked action: its queue\n * stopped there and sends nothing after it until that action is retried, reconciled\n * or removed. The waiting action keeps its place in the queue. */\n blockedBy: Schema.optional(\n Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n failure: Schema.optional(BackendErrorKindSchema),\n })\n ),\n cause: Schema.optional(Schema.Defect()),\n};\n/** Shared wire schema; hooks narrow the kind without duplicating error classes. */\nexport class BackendError<\n K extends BackendErrorKind = BackendErrorKind,\n> extends Schema.TaggedError<BackendError>()(\"BackendError\", Fields) {\n declare readonly kind: K;\n constructor(properties: Omit<Schema.Struct.Type<typeof Fields>, \"kind\"> & { readonly kind: K }) {\n super(properties);\n }\n}\n/** HTTP bindings share these statuses; RPC still carries the typed error schema. */\nexport const backendErrorStatus = (error: Pick<BackendError, \"kind\">): number =>\n ({\n Unauthenticated: 401,\n Forbidden: 403,\n NotFound: 404,\n ValidationFailed: 422,\n InvalidRequest: 400,\n InvalidResponse: 502,\n InvalidConfiguration: 500,\n Conflict: 409,\n NotImplemented: 501,\n RateLimited: 429,\n Unavailable: 503,\n Internal: 500,\n HistoryExpired: 409,\n SessionExpired: 409,\n SessionReplaced: 409,\n ViewReplaced: 409,\n ResultExpired: 409,\n SourceMismatch: 409,\n SchemaMismatch: 409,\n })[error.kind];\nexport type OperationErrorKind =\n | \"Unauthenticated\"\n | \"Forbidden\"\n | \"NotFound\"\n | \"ValidationFailed\"\n | \"InvalidRequest\"\n | \"InvalidResponse\"\n | \"InvalidConfiguration\"\n | \"Conflict\"\n | \"NotImplemented\"\n | \"RateLimited\"\n | \"Unavailable\"\n | \"Internal\";\nexport type ApplyActionError = BackendError<OperationErrorKind>;\nexport type ValidateActionError = BackendError<OperationErrorKind>;\nexport type ReplicationErrorKind =\n | \"HistoryExpired\"\n | \"SessionExpired\"\n | \"SessionReplaced\"\n | \"ViewReplaced\"\n | \"ResultExpired\"\n | \"SourceMismatch\"\n | \"SchemaMismatch\";\nexport type ReplicationError = BackendError<ReplicationErrorKind>;\nexport type LoadSubsetError = BackendError<\n Exclude<OperationErrorKind, \"ValidationFailed\"> | \"HistoryExpired\"\n>;\n\nexport const unauthenticated = (message = \"Authentication is required.\", options?: ErrorOptions) =>\n new BackendError({\n operation: \"authentication\",\n kind: \"Unauthenticated\",\n message,\n retryable: false,\n actionOutcome: \"not-committed\",\n cause: options?.cause,\n });\nexport const isUnauthenticatedError = (error: unknown): error is BackendError<\"Unauthenticated\"> =>\n error instanceof BackendError && error.kind === \"Unauthenticated\";\n\n/** Unknown outcomes apply to dispatch/execution failures, never ordinary rejections. */\nexport const isUnknownActionOutcome = (error: BackendError) =>\n error.actionOutcome === \"unknown\" ||\n (error.actionOutcome === undefined &&\n (error.kind === \"Unavailable\" || error.kind === \"Internal\" || error.kind === \"InvalidResponse\"));\n\nconst ProviderFailure = Schema.Struct({\n reason: Schema.optional(Schema.Unknown),\n cause: Schema.optional(Schema.Unknown),\n response: Schema.optional(\n Schema.Struct({\n status: Schema.Number,\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n })\n ),\n retryAfterMs: Schema.optional(Schema.Finite),\n status: Schema.optional(Schema.Number),\n statusCode: Schema.optional(Schema.Number),\n errorCode: Schema.optional(Schema.String),\n errorName: Schema.optional(Schema.String),\n code: Schema.optional(Schema.String),\n parameters: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n});\n/** Normalize SDK failures. No provider message/body is made public by this classifier. */\nexport function classifyBackendFailure(operation: string, cause: unknown): BackendError {\n if (cause instanceof BackendError) return cause;\n // Effect RPC currently puts HTTP EOF in RpcClientDefect alongside decoding\n // failures. Only its two explicit EOF cases mean transport loss; malformed\n // frames must remain terminal InvalidResponse failures. Replace this narrow\n // normalization when upstream exposes a structured interrupted-response reason.\n if (\n cause instanceof RpcClientError.RpcClientError &&\n cause.reason._tag === \"RpcClientDefect\" &&\n (cause.reason.message === \"HTTP response ended before RPC request completed\" ||\n cause.reason.message === \"Received empty HTTP response from RPC server\")\n )\n return new BackendError({\n operation,\n kind: \"Unavailable\",\n message: \"The RPC connection was interrupted.\",\n retryable: true,\n actionOutcome: \"unknown\",\n cause: Redacted.make(cause),\n });\n if (\n (cause instanceof RpcClientError.RpcClientError && cause.reason._tag === \"RpcClientDefect\") ||\n (cause instanceof HttpClientError.HttpClientError && cause.reason._tag === \"DecodeError\")\n )\n return new BackendError({\n operation,\n kind: \"InvalidResponse\",\n message: \"The source returned an invalid response.\",\n retryable: false,\n actionOutcome: \"unknown\",\n cause: Redacted.make(cause),\n });\n if (\n cause instanceof HttpClientError.HttpClientError &&\n (cause.reason._tag === \"EncodeError\" || cause.reason._tag === \"InvalidUrlError\")\n )\n return new BackendError({\n operation,\n kind: cause.reason._tag === \"EncodeError\" ? \"InvalidRequest\" : \"InvalidConfiguration\",\n message: \"The request could not be constructed.\",\n retryable: false,\n actionOutcome: \"not-committed\",\n cause: Redacted.make(cause),\n });\n const blob =\n cause instanceof BlobStorageError\n ? cause\n : cause instanceof OntologyStorageError && cause.reason._tag === \"BlobStorageError\"\n ? cause.reason\n : undefined;\n if (blob) {\n return new BackendError({\n operation,\n kind:\n blob.kind === \"NotFound\"\n ? \"NotFound\"\n : blob.kind === \"InvalidValue\"\n ? \"InvalidRequest\"\n : blob.kind === \"Busy\" || blob.kind === \"Conflict\"\n ? \"Conflict\"\n : \"Unavailable\",\n message:\n blob.kind === \"NotFound\"\n ? \"Attachment is unavailable.\"\n : blob.kind === \"Busy\"\n ? \"Attachment upload is still in progress.\"\n : blob.kind === \"Conflict\"\n ? \"Attachment state conflicts with this operation.\"\n : blob.kind === \"InvalidValue\"\n ? \"Invalid attachment value.\"\n : \"Attachment storage is unavailable.\",\n retryable: blob.kind === \"Busy\" || blob.kind === \"Bytes\",\n cause: Redacted.make(cause),\n });\n }\n if (cause instanceof OntologyStorageError) {\n const reason = cause.reason;\n const kind: BackendErrorKind =\n reason._tag === \"QueryError\"\n ? \"InvalidRequest\"\n : reason._tag === \"ConfigurationError\" || reason._tag === \"IndexError\"\n ? \"InvalidConfiguration\"\n : reason._tag === \"DefinitionMismatch\" || reason._tag === \"SchemaMismatch\"\n ? \"SchemaMismatch\"\n : reason._tag === \"UniqueConstraint\"\n ? \"Conflict\"\n : reason._tag === \"StorageError\" ||\n (reason._tag === \"TransactionError\" && reason.kind === \"Backend\")\n ? \"Unavailable\"\n : \"Internal\";\n return new BackendError({\n operation,\n kind,\n message:\n kind === \"InvalidRequest\"\n ? \"Invalid storage query.\"\n : kind === \"SchemaMismatch\"\n ? \"Storage schema changed; migrate or reset explicitly.\"\n : \"Storage operation failed.\",\n retryable: cause.isRetryable,\n cause: Redacted.make(cause),\n });\n }\n let candidate = cause;\n let value: typeof ProviderFailure.Type | undefined;\n for (let depth = 0; depth < 5; depth++) {\n if (candidate instanceof BackendError) return candidate;\n const decoded = Schema.decodeUnknownOption(ProviderFailure)(candidate);\n if (decoded._tag === \"None\") break;\n value = decoded.value;\n if (value.cause instanceof BackendError) return value.cause;\n if (\n value.status !== undefined ||\n value.statusCode !== undefined ||\n value.errorCode !== undefined ||\n value.code !== undefined ||\n value.errorName !== undefined ||\n value.response\n )\n break;\n candidate = value.reason ?? value.cause;\n }\n const status = value?.status ?? value?.statusCode ?? value?.response?.status;\n const code = value?.errorCode ?? value?.code;\n const name = value?.errorName?.split(\":\").at(-1);\n const kind: OperationErrorKind =\n status === 501\n ? \"NotImplemented\"\n : status === 401 || code === \"UNAUTHORIZED\" || code === \"INVALID_SESSION_ID\"\n ? \"Unauthenticated\"\n : status === 429 || code === \"REQUEST_LIMIT_EXCEEDED\" || name === \"RateLimitReached\"\n ? \"RateLimited\"\n : status === 403 || code === \"PERMISSION_DENIED\" || code === \"INSUFFICIENT_ACCESS_OR_READONLY\"\n ? \"Forbidden\"\n : status === 404 || code === \"NOT_FOUND\"\n ? \"NotFound\"\n : name === \"FunctionEncounteredUserFacingError\" ||\n name === \"QueryEncounteredUserFacingError\"\n ? \"ValidationFailed\"\n : code === \"FIELD_CUSTOM_VALIDATION_EXCEPTION\" || code === \"REQUIRED_FIELD_MISSING\"\n ? \"ValidationFailed\"\n : status === 400 || code === \"INVALID_ARGUMENT\"\n ? \"InvalidRequest\"\n : status === 409\n ? \"Conflict\"\n : \"Unavailable\";\n const authored =\n name === \"FunctionEncounteredUserFacingError\" || name === \"QueryEncounteredUserFacingError\";\n const issues: readonly ValidationIssue[] | undefined =\n authored && Predicate.isString(value?.parameters?.message)\n ? [\n {\n message: value.parameters.message,\n code: \"custom\",\n category: \"custom\",\n source: \"user-facing\",\n messageSource: \"configured\",\n },\n ]\n : undefined;\n const seconds = value?.response?.headers?.[\"retry-after\"];\n const retryAfterMs =\n value?.retryAfterMs ??\n (seconds !== undefined && /^\\d+(?:\\.\\d+)?$/.test(seconds) ? Number(seconds) * 1_000 : undefined);\n return new BackendError({\n operation,\n kind,\n retryAfterMs,\n message: {\n Unauthenticated: \"Authentication is required.\",\n Forbidden: \"This operation is not permitted.\",\n NotFound: \"Resource not found.\",\n ValidationFailed: \"Submission failed validation.\",\n InvalidRequest: \"The request is invalid.\",\n InvalidResponse: \"The source returned an invalid response.\",\n InvalidConfiguration: \"The service is configured incorrectly.\",\n Conflict: \"The operation conflicts with current state.\",\n NotImplemented: \"This operation is not implemented.\",\n RateLimited: \"Too many requests. Try again later.\",\n Unavailable: \"The service is unavailable. Try again later.\",\n Internal: \"The operation could not be completed.\",\n }[kind],\n retryable: kind === \"Unavailable\" || kind === \"RateLimited\",\n actionOutcome: kind === \"Unavailable\" ? \"unknown\" : \"not-committed\",\n issues,\n cause: Redacted.make(cause),\n });\n}\n\nexport interface ErrorProjectionContext {\n /** Visible action parameter paths. Hidden/fixed parameters must not appear in public issues. */\n readonly parameters?: readonly string[];\n readonly objectReferenceParameters?: readonly string[];\n /** An upstream connection failure cannot request downstream sign-in. */\n readonly upstream?: boolean;\n}\nexport type ErrorProjection =\n | \"forward\"\n | \"projected\"\n | ((error: BackendError, context: ErrorProjectionContext) => BackendError);\nexport function projectValidationIssue(\n issue: ValidationIssue,\n context: ErrorProjectionContext\n): ValidationIssue | undefined {\n const parameter = issue.path?.[0];\n if (!Predicate.isString(parameter) || !context.parameters?.includes(parameter)) return undefined;\n if (issue.category === \"input\") {\n const standard: Readonly<Record<string, string>> = {\n required: \"A value is required.\",\n type: \"Enter a valid value.\",\n range: \"Enter a value in the allowed range.\",\n arraySize: \"Choose an allowed number of items.\",\n stringLength: \"Enter a value of the allowed length.\",\n regex: \"Enter a value in the required format.\",\n };\n const message = issue.messageSource === \"standard\" ? issue.message : standard[issue.code ?? \"\"];\n if (message)\n return {\n message,\n path: issue.path,\n code: issue.code,\n category: \"input\",\n messageSource: \"standard\",\n };\n }\n if (issue.code === \"InvalidObjectReference\")\n return { message: \"Choose a valid value.\", path: issue.path, code: \"InvalidObjectReference\" };\n return undefined;\n}\n/** Forwarding preserves the original error. Projection removes raw causes and\n * cannot change execution/retry facts. */\nexport function projectBackendError(\n error: BackendError,\n policy: ErrorProjection = \"projected\",\n context: ErrorProjectionContext = {}\n): BackendError {\n if (policy === \"forward\") return error;\n const shown = typeof policy === \"function\" ? policy(error, context) : error;\n const kind = error.kind === \"Unauthenticated\" && context.upstream ? \"Unavailable\" : shown.kind;\n const issues =\n shown.kind !== \"ValidationFailed\"\n ? undefined\n : policy === \"projected\"\n ? error.issues?.flatMap((issue) => {\n const visible = projectValidationIssue(issue, context);\n return visible ? [visible] : [];\n })\n : shown.issues;\n const message =\n policy !== \"projected\"\n ? shown.message\n : kind === \"ValidationFailed\"\n ? \"Submission failed validation.\"\n : kind === \"InvalidRequest\"\n ? \"The request is invalid.\"\n : kind === \"InvalidResponse\"\n ? \"The source returned an invalid response.\"\n : kind === \"Unauthenticated\"\n ? \"Authentication is required.\"\n : kind === \"Forbidden\"\n ? \"This operation is not permitted.\"\n : kind === \"NotFound\"\n ? \"Resource not found.\"\n : kind === \"RateLimited\"\n ? \"Too many requests. Try again later.\"\n : kind === \"NotImplemented\"\n ? \"This operation is not implemented.\"\n : \"The operation could not be completed.\";\n return new BackendError({\n operation: error.operation,\n kind,\n message,\n issues: issues?.length ? issues : undefined,\n retryable: error.retryable,\n actionOutcome: error.actionOutcome,\n retryAfterMs: error.retryAfterMs,\n });\n}\nexport type UnauthenticatedError = BackendError<\"Unauthenticated\">;\n\n/** Schema diagnostics retain paths without echoing input values or internal schemas. */\nexport function schemaValidationIssues(error: Schema.SchemaError): readonly ValidationIssue[] {\n return SchemaIssue.makeFormatterStandardSchemaV1({\n leafHook: (issue) => (issue._tag === \"MissingKey\" ? \"A value is required.\" : \"Enter a valid value.\"),\n checkHook: () => \"Enter a valid value.\",\n })(error.issue).issues.map((issue) => ({\n message: issue.message,\n path: issue.path?.flatMap((part) =>\n typeof part === \"string\" || typeof part === \"number\" ? [part] : []\n ),\n category: \"input\",\n code: issue.message === \"A value is required.\" ? \"required\" : \"type\",\n source: \"parameter\",\n messageSource: \"standard\",\n }));\n}\n"],"mappings":";;;;;;AAQA,MAAa,wBAAwB,OAAO,OAAO;CAC/C,SAAS,OAAO;CAChB,MAAM,OAAO,SAAS,OAAO,MAAM,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,MAAM,CAAC,CAAC,CAAC;CAChF,MAAM,OAAO,SAAS,OAAO,MAAM;CACnC,UAAU,OAAO,SAAS,OAAO,SAAS;EAAC;EAAS;EAAa;CAAQ,CAAC,CAAC;CAC3E,QAAQ,OAAO,SAAS,OAAO,SAAS;EAAC;EAAa;EAAc;CAAa,CAAC,CAAC;CACnF,eAAe,OAAO,SAAS,OAAO,SAAS,CAAC,YAAY,YAAY,CAAC,CAAC;AAC9E,CA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AU;EAC7B,MAAM,UAAU,uBAAuB,OAAO,OAAO;EACrD,OAAO,UAAU,CAAC,OAAO,IAAI,CAAC;CAClC,CAAC,IACD,MAAM;CAClB,MAAM,UACF,WAAW,cACL,MAAM,UACN,SAAS,qBACP,kCACA,SAAS,mBACP,4BACA,SAAS,oBACP,6CACA,SAAS,oBACP,gCACA,SAAS,cACP,qCACA,SAAS,aACP,wBACA,SAAS,gBACP,wCACA,SAAS,mBACP,uCACA;CAC1B,OAAO,IAAI,aAAa;EACpB,WAAW,MAAM;EACjB;EACA;EACA,QAAQ,QAAQ,SAAS,SAAS,KAAA;EAClC,WAAW,MAAM;EACjB,eAAe,MAAM;EACrB,cAAc,MAAM;CACxB,CAAC;AACL;;AAIA,SAAgB,uBAAuB,OAAuD;CAC1F,OAAO,YAAY,8BAA8B;EAC7C,WAAW,UAAW,MAAM,SAAS,eAAe,yBAAyB;EAC7E,iBAAiB;CACrB,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,KAAK,WAAW;EACnC,SAAS,MAAM;EACf,MAAM,MAAM,MAAM,SAAS,SACvB,OAAO,SAAS,YAAY,OAAO,SAAS,WAAW,CAAC,IAAI,IAAI,CAAC,CACrE;EACA,UAAU;EACV,MAAM,MAAM,YAAY,yBAAyB,aAAa;EAC9D,QAAQ;EACR,eAAe;CACnB,EAAE;AACN"}
package/lib/index.d.ts CHANGED
@@ -85,6 +85,9 @@ export interface ActionRequest {
85
85
  readonly now: string;
86
86
  readonly seed: string;
87
87
  };
88
+ /** How long one attempt to send this action may take, in milliseconds, overriding the
89
+ * outbox's `timeoutMs`. For actions known to take long, such as large uploads. */
90
+ readonly timeoutMs?: number;
88
91
  }
89
92
  export interface ActionReceipt {
90
93
  /** The submitted ActionRequest.id, also supplied as the application's idempotencyKey. */
@@ -260,6 +263,13 @@ export interface OntologyBackendService {
260
263
  * Merely receiving an ID, or an action being naturally idempotent, is insufficient.
261
264
  */
262
265
  readonly supportsIdempotency: boolean;
266
+ /**
267
+ * The networks this source is on, such as `"internet"`: its replica syncs while a device link
268
+ * reaching one of them is available (the runtime's `links`). Omitted means the internet. A
269
+ * source on the same device (in the same process, a worker or a message port) is on none, so
270
+ * its replicas sync whatever the device's links report.
271
+ */
272
+ readonly networks?: readonly string[];
263
273
  /** Indexed bounded local maintenance; the backend owner schedules it. */
264
274
  readonly maintenance?: Effect.Effect<void, BackendError>;
265
275
  /** Return the request or explicitly describe the region actually fulfilled.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["_$__encrypted_js0.DecryptedValue","_$__delivery_js0.DeliveryPolicy","_$__delivery_js0.DeliveryPosition","_$__delivery_js0.DeliverySubscription","_$__errors_js0.ValidationReport"],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;iBAuCiB;WACJ,kBAAkB;;iBAEd;;;;;;;WAOJ,kBAAkB;WAClB,eAAe,IAAI;;WAEnB;;;;WAIA;;WAEA,WAAW;;WAEX;;qBAEA,uBAAqB,OAAA;;;;;;;;;;;;;;;;YAetB,kBAAkB,OAAO,OAAO,YAAY;YAC5C;WAEO;WACA;WACA,KAAK;WACL,OAAO;;WAET;WAAyB;WAA6B,KAAK;;iBAC3D;WACJ;WACA,kBAAkB;WAClB;;iBAEI;WACJ,kBAAkB;WAClB;WACA;;iBAEI;WACJ,YAAY;WACZ,MAAM;WACN,SAAS;;iBAEL;;WAEJ;WACA;WACA,YAAY;WACZ,6BAA6B;;WAE7B;aAAoB;aAAsB;;;iBAEtC;;WAEJ;;WAEA;;WAEA;WACA;;WAEA;;;;;;WAMA;aACI;aACA,gBAAgB;;;;;WAKpB;WACA;aAA2C;aAA0B;;;qBAGrE,oBAAkB,OAAA,gBAAA,OAAA;;;;;;;;;;qBASlB,qBAAmB,OAAA;;;;;;;;;;;;;;;;qBAgBnB,qBAAmB,OAAA;;;;;;;;;;;;;;qBAKnB,uBAAqB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;qBAUrB,yBAAuB,OAAA;;;;;;;;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file":"index.d.ts","names":["_$__encrypted_js0.DecryptedValue","_$__delivery_js0.DeliveryPolicy","_$__delivery_js0.DeliveryPosition","_$__delivery_js0.DeliverySubscription","_$__errors_js0.ValidationReport"],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;iBAuCiB;WACJ,kBAAkB;;iBAEd;;;;;;;WAOJ,kBAAkB;WAClB,eAAe,IAAI;;WAEnB;;;;WAIA;;WAEA,WAAW;;WAEX;;qBAEA,uBAAqB,OAAA;;;;;;;;;;;;;;;;YAetB,kBAAkB,OAAO,OAAO,YAAY;YAC5C;WAEO;WACA;WACA,KAAK;WACL,OAAO;;WAET;WAAyB;WAA6B,KAAK;;iBAC3D;WACJ;WACA,kBAAkB;WAClB;;iBAEI;WACJ,kBAAkB;WAClB;WACA;;iBAEI;WACJ,YAAY;WACZ,MAAM;WACN,SAAS;;iBAEL;;WAEJ;WACA;WACA,YAAY;WACZ,6BAA6B;;WAE7B;aAAoB;aAAsB;;;;WAG1C;;iBAEI;;WAEJ;;WAEA;;WAEA;WACA;;WAEA;;;;;;WAMA;aACI;aACA,gBAAgB;;;;;WAKpB;WACA;aAA2C;aAA0B;;;qBAGrE,oBAAkB,OAAA,gBAAA,OAAA;;;;;;;;;;qBASlB,qBAAmB,OAAA;;;;;;;;;;;;;;;;qBAgBnB,qBAAmB,OAAA;;;;;;;;;;;;;;qBAKnB,uBAAqB,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;qBAUrB,yBAAuB,OAAA;;;;;;;;;;;;;;;;;;iBAMnB;;WAEJ,SACL,OAAO,YACP,OAAO,WACP;aAAqB,SAAS;QAC7B,OAAO,OAAO,YAAY;;WAEtB,OACL,OAAO,YACP;aAAqB;aAA0B;QAC9C,OAAO,OAAO,WAAW,cAAc,MAAM;WACzC,WACL,OAAO,YACP;aAAqB;QACpB,OAAO;aAEK;aACA;aACA;aACA;eAAwB;eAAwB;;KAE7D;;iBAWS;;WAEJ,UACL,OAAO,uBACN,OAAO,OADDA,gBACiD;;;;;;;;YAQpD;WACK;WAAsB,KAAK;WAAc,OAAO;;WAChD;WAAuB,KAAK;;WAC5B;WAAyB,KAAK;;;;;;;;YAOnC;WAA+C,kBAAkB;;iBAE5D;WACJ;;WAEA;;;;;;WAMA;;;;;;;WAOA;;WAEA,cAAc,OAAO,aAAa;;;;WAIlC,aAAa,QAAQ,iBAAiB,OAAO,OAAO,iBAAiB;;;;;WAKrE,QACL,UAAU,eACV;aAAqB,SAAS;QAC7B,OAAO,OAAO,yBAAyB;;WAEnC,sBACL,WAAW,iBACX,SADWC,gBAEX,SADiCC,qBAEhC,OAAO,OADyBC,sBAC4B,cAAc,MAAM;WAC5E,uBACL,UAFQD,qBAGP,OAAO,aAAa;;WAEhB,2BACL,cACA,YAAY,4BACX,OAAO,OAAO,yBAAyB;;;;;;;;;WASnC,eACL,QAAQ,iBACP,OAAO,OAAO,OAAO,OAAO,kBAAkB,eAAe,cAAc,MAAM;;;WAG7E,WAAW,QAAQ;aAET;aACA;;WAGV,kBACL,cACA,YAAY,yBACZ;aAAqB;QACpB,OAAO,OAFIE,kBAE2C;WAClD,cAAc,YAAY,kBAAkB,OAAO,OAAO,eAAe;WACzE,gBACL,cACA,YAAY,4BACX,OAAO,gBAAgB;WACnB;aACI,OAAO;eACH;eACA;UACP,OAAO,OAAO,mBAAmB;;;;aAI9B,QAAQ,OAAO,OAAO,OAAO,aAAa,eAAe,cAAc,MAAM;;WAEjF,cAAc;WACd,YAAY;;;;qBAIZ,wBAAwB"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { Context, Schema } from \"effect\";\nimport { ObjectSubsetSchema } from \"./subsetSchema.js\";\nimport type { AttachmentTypeDef, QueryDocument } from \"@party-stack/ontology-spec\";\nimport type { ObjectSubset } from \"@party-stack/ontology-spec/query\";\nimport type { attachment, Encrypted } from \"@party-stack/ontology-spec/values\";\nimport type { Key, Row } from \"@party-stack/ontology-storage\";\nimport type { ByteInput } from \"@party-stack/ontology-storage/blobs\";\nimport type { Scope, Effect, Stream } from \"effect\";\n\nexport {\n schemaValidationIssues,\n BackendError,\n BackendErrorKindSchema,\n backendErrorStatus,\n ValidationIssueSchema,\n ValidationReportSchema,\n unauthenticated,\n isUnauthenticatedError,\n classifyBackendFailure,\n projectBackendError,\n projectValidationIssue,\n isUnknownActionOutcome,\n} from \"./errors.js\";\nexport type {\n BackendErrorKind,\n ReplicationErrorKind,\n ReplicationError,\n ErrorProjection,\n ErrorProjectionContext,\n ValidationReport,\n ValidationIssue,\n UnauthenticatedError,\n ApplyActionError,\n ValidateActionError,\n LoadSubsetError,\n} from \"./errors.js\";\nimport { BackendError } from \"./errors.js\";\nexport { makeOntologyBackend } from \"./query.js\";\n\nexport interface ObjectSelection {\n readonly subsets: readonly ObjectSubset[];\n}\nexport interface BackendSnapshot {\n /** Region represented by these rows, including any window already applied.\n * Omitted means the requested subset. A broader unwindowed region lets the\n * engine finish filtering/ordering/windowing and optionally cache extra objects.\n * Rows may include residual candidates outside this region; consumers discard\n * them before installing its objects or recording complete coverage.\n */\n readonly fulfilledSubset?: ObjectSubset;\n readonly rows: readonly Row<Record<string, unknown>>[];\n /** Complete for fulfilledSubset (or the request when omitted), including its window. */\n readonly complete: boolean;\n /** Rows fetched from the provider, before adapter-side filtering/windowing.\n * Diagnostic only; omitted when the adapter cannot report it. Not a DB scan count.\n */\n readonly fetchedRows?: number;\n /** Diagnostic provider filter, not a query-capability or coverage contract. */\n readonly pushdown?: SourceQueryPlan;\n /** Position coordinated with this snapshot, when the backend exposes a durable change stream. */\n readonly cursor?: string;\n}\nexport const SourceQueryPlanSchema = Schema.Struct({\n source: Schema.String,\n /** Paths into the request's portable where tree: AND/OR child indices, NOT child 0, [] for the root. */\n predicates: Schema.Array(\n Schema.Struct({\n path: Schema.Array(Schema.Int),\n execution: Schema.Literals([\"source\", \"candidate\", \"adapter\", \"engine\"]),\n })\n ),\n sorting: Schema.Literals([\"source\", \"adapter\", \"engine\", \"none\"]),\n pagination: Schema.Literals([\"source\", \"adapter\", \"engine\", \"none\"]),\n rechecksFilter: Schema.Boolean,\n /** Optional native syntax for raw inspection. Consumers must not parse it to infer execution. */\n native: Schema.optional(Schema.Struct({ language: Schema.String, text: Schema.String })),\n});\nexport type SourceQueryPlan = Schema.Schema.Type<typeof SourceQueryPlanSchema>;\nexport type ObjectChange =\n | {\n readonly kind: \"put\";\n readonly objectType: string;\n readonly key: Key;\n readonly value: Record<string, unknown>;\n }\n | { readonly kind: \"delete\"; readonly objectType: string; readonly key: Key };\nexport interface BackendCommit {\n readonly cursor: string;\n readonly changes: readonly ObjectChange[];\n readonly operationId?: string;\n}\nexport interface BackendChangePage {\n readonly commits: readonly BackendCommit[];\n readonly cursor: string;\n readonly hasMore: boolean;\n}\nexport interface AttachmentUpload {\n readonly attachment: attachment;\n readonly blob: ByteInput;\n readonly target?: AttachmentTypeDef;\n}\nexport interface ActionRequest {\n /** Stable across retries. The source must separately guarantee keyed idempotency. */\n readonly id: string;\n readonly name: string;\n readonly parameters: Record<string, unknown>;\n readonly attachmentUploads?: readonly AttachmentUpload[];\n /** Portable replay inputs, preserved across rebases, forwarding and authoritative execution. */\n readonly replay?: { readonly now: string; readonly seed: string };\n}\nexport interface ActionReceipt {\n /** The submitted ActionRequest.id, also supplied as the application's idempotencyKey. */\n readonly operationId: string;\n /** Provider commitment is recorded before local read-back/reconciliation. Parent acceptance is separate. */\n readonly outcome: \"committed\";\n /** Encoded authoritative return value, interpreted using the action returnType. Never a journal payload. */\n readonly result?: unknown;\n readonly cursor?: string;\n /** Optional upstream execution ID. Never substitutes for our stable retry identity. */\n readonly providerOperationId?: string;\n /** Read-back targets for a committed non-journal action. Missing keys\n * means the whole type; an empty list means no modeled object changes.\n * Omission conservatively refreshes every modeled type.\n * Targets are complete unless affectedComplete is explicitly false.\n */\n readonly affected?: readonly {\n readonly objectType: string;\n readonly keys?: readonly Key[];\n }[];\n /** False when these are known targets but automation may have changed other\n * modeled records. Confirmation must not use them as an exhaustive edit list.\n */\n readonly affectedComplete?: boolean;\n readonly attachmentIdMappings?: readonly { readonly localId: string; readonly remoteId: string }[];\n}\nconst KeySchema = Schema.Union([Schema.String, Schema.Finite]);\nexport const ObjectChangeSchema = Schema.Union([\n Schema.Struct({\n kind: Schema.Literal(\"put\"),\n objectType: Schema.String,\n key: KeySchema,\n value: Schema.Record(Schema.String, Schema.Unknown),\n }),\n Schema.Struct({ kind: Schema.Literal(\"delete\"), objectType: Schema.String, key: KeySchema }),\n]);\nexport const ActionReceiptSchema = Schema.Struct({\n operationId: Schema.String,\n outcome: Schema.Literal(\"committed\"),\n result: Schema.optional(Schema.Unknown),\n cursor: Schema.optional(Schema.String),\n providerOperationId: Schema.optional(Schema.String),\n affected: Schema.optional(\n Schema.Array(\n Schema.Struct({ objectType: Schema.String, keys: Schema.optional(Schema.Array(KeySchema)) })\n )\n ),\n affectedComplete: Schema.optional(Schema.Boolean),\n attachmentIdMappings: Schema.optional(\n Schema.Array(Schema.Struct({ localId: Schema.String, remoteId: Schema.String }))\n ),\n});\nexport const BackendCommitSchema = Schema.Struct({\n cursor: Schema.String,\n changes: Schema.Array(ObjectChangeSchema),\n operationId: Schema.optional(Schema.String),\n});\nexport const BackendSnapshotSchema = Schema.Struct({\n fulfilledSubset: Schema.optional(ObjectSubsetSchema),\n fetchedRows: Schema.optional(Schema.Number),\n pushdown: Schema.optional(SourceQueryPlanSchema),\n rows: Schema.Array(\n Schema.Struct({ key: KeySchema, value: Schema.Record(Schema.String, Schema.Unknown) })\n ),\n complete: Schema.Boolean,\n cursor: Schema.optional(Schema.String),\n});\nexport const BackendChangePageSchema = Schema.Struct({\n commits: Schema.Array(BackendCommitSchema),\n cursor: Schema.String,\n hasMore: Schema.Boolean,\n});\n\nexport interface BackendAttachments {\n /** Optional authoritative staging before a subsequent action references the handle. */\n readonly stage?: (\n value: attachment,\n bytes: ByteInput,\n options?: { readonly target?: AttachmentTypeDef }\n ) => Effect.Effect<attachment, BackendError>;\n /** Keep the caller Scope open through consumption; closing it cancels an unconsumed download too. */\n readonly read: (\n value: attachment,\n options?: { readonly offset?: number; readonly length?: number }\n ) => Effect.Effect<ByteInput, BackendError, Scope.Scope>;\n readonly metadata: (\n value: attachment,\n options?: { readonly select?: readonly (\"size\" | \"type\" | \"name\" | \"dimensions\")[] }\n ) => Effect.Effect<\n {\n readonly size?: number;\n readonly type?: string;\n readonly name?: string;\n readonly dimensions?: { readonly width: number; readonly height: number };\n },\n BackendError\n >;\n}\nexport {\n EncryptedValueSchema,\n DecryptedValueSchema,\n encryptedPropertyCodec,\n makePropertyDecryption,\n} from \"./encrypted.js\";\nexport type { DecryptedValue } from \"./encrypted.js\";\n\nexport interface BackendEncryptedValues {\n /** Explicit operation. Ordinary record loads return handles and never decrypt them. */\n readonly decrypt: (\n value: Encrypted<unknown>\n ) => Effect.Effect<import(\"./encrypted.js\").DecryptedValue, BackendError>;\n}\n/** One object a watch reports, in the watched subset's object type.\n * - `put`: the object is now in the subset with this complete value.\n * - `exit`: the object left the subset. It may have changed or been deleted; the\n * replica reads it back by primary key to tell which.\n * - `delete`: the object no longer exists anywhere.\n */\nexport type SubsetWatchChange =\n | { readonly kind: \"put\"; readonly key: Key; readonly value: Record<string, unknown> }\n | { readonly kind: \"exit\"; readonly key: Key }\n | { readonly kind: \"delete\"; readonly key: Key };\n/** A reset requests repair after starting/restarting a watch; it does not\n * assert that data changed. Ordinary void hints always invalidate coverage.\n * `changes` describes exactly what changed, so the replica can apply it without\n * reloading the subset. Report only what is certain: a `put` must carry every\n * property; anything less precise must be an invalidation hint instead.\n */\nexport type SubsetWatchEvent = void | \"reset\" | { readonly changes: readonly SubsetWatchChange[] };\n\nexport interface OntologyBackendService {\n readonly name: string;\n /** Stable identity for the source whose cursors and receipts this binding returns. */\n readonly sourceId: string;\n /** Durable keyed idempotency within the configured receipt-retention window:\n * repeated IDs return the recorded result, with\n * conflicting payloads rejected. The guarantee must survive source restart.\n * Merely receiving an ID, or an action being naturally idempotent, is insufficient.\n */\n readonly supportsIdempotency: boolean;\n /** Indexed bounded local maintenance; the backend owner schedules it. */\n readonly maintenance?: Effect.Effect<void, BackendError>;\n /** Return the request or explicitly describe the region actually fulfilled.\n * Consumers use the shared subset normalizer before applying requested windows.\n */\n readonly loadSubset: (subset: ObjectSubset) => Effect.Effect<BackendSnapshot, BackendError>;\n /** Finite Query IR execution using this binding's trusted context and read path.\n * Provider adapters may evaluate through subset loads; owned storage uses one\n * read transaction. Callers supply query inputs, never authentication context.\n */\n readonly query: (\n document: QueryDocument,\n options?: { readonly inputs?: Record<string, unknown> }\n ) => Effect.Effect<Record<string, unknown>, BackendError>;\n /** Optional selected committed rows. Closing the Scope releases demand; delivery state expires by policy. */\n readonly subscribeSelection?: (\n selection: ObjectSelection,\n policy?: import(\"./delivery.js\").DeliveryPolicy,\n resume?: import(\"./delivery.js\").DeliveryPosition\n ) => Effect.Effect<import(\"./delivery.js\").DeliverySubscription, BackendError, Scope.Scope>;\n readonly acknowledgeDelivery?: (\n position: import(\"./delivery.js\").DeliveryPosition\n ) => Effect.Effect<void, BackendError>;\n /** Read-only defaults and edit prefills; never invokes the action. */\n readonly resolveActionParameters?: (\n name: string,\n parameters: Record<string, unknown>\n ) => Effect.Effect<Record<string, unknown>, BackendError>;\n /** Acquire a demand-scoped watch before reading its snapshot. Completion proves\n * registration and buffering are active, even before the returned stream is pulled.\n * The acquiring Scope owns registration and release. Undefined means polling.\n * Reconnect within the same stream must fail or emit reset/invalidation;\n * reacquisition establishes a new readiness boundary for a fresh read.\n * Must cover every change relevant to the requested subset; broader watches\n * may emit extra hints. It does not maintain broader fulfilledSubset coverage.\n */\n readonly watchSubset?: (\n subset: ObjectSubset\n ) => Effect.Effect<Stream.Stream<SubsetWatchEvent, BackendError>, BackendError, Scope.Scope> | undefined;\n /** Recommended demand refresh defaults. Caller configuration wins; healthy\n * watches/journals keep coverage current independently of snapshot age. */\n readonly refresh?: (subset: ObjectSubset) =>\n | {\n readonly pollIntervalMs?: number | false;\n readonly maxCoverageAgeMs?: number;\n }\n | undefined;\n readonly validateAction?: (\n name: string,\n parameters: Record<string, unknown>,\n options?: { readonly knownParameters?: readonly string[] }\n ) => Effect.Effect<import(\"./errors.js\").ValidationReport, BackendError>;\n readonly applyAction: (invocation: ActionRequest) => Effect.Effect<ActionReceipt, BackendError>;\n readonly queryFunction: (\n name: string,\n parameters: Record<string, unknown>\n ) => Effect.Effect<unknown, BackendError>;\n readonly changes?: {\n readonly pull: (options: {\n readonly cursor?: string;\n readonly limit?: number;\n }) => Effect.Effect<BackendChangePage, BackendError>;\n /** Acquire registered, buffered wake-up hints in the caller's Scope before\n * pulling durable changes. Stream consumption does not initiate registration.\n * Call pull to recover changes after reconnect or restart. */\n readonly watch?: Effect.Effect<Stream.Stream<void, BackendError>, BackendError, Scope.Scope>;\n };\n readonly attachments?: BackendAttachments;\n readonly encrypted?: BackendEncryptedValues;\n}\n\n/** Backend protocol independent of TanStack collections and client lifecycle management. */\nexport class OntologyBackend extends Context.Service<OntologyBackend, OntologyBackendService>()(\n \"@party-stack/ontology-backend/OntologyBackend\"\n) {}\n"],"mappings":";;;;;;AA8DA,MAAa,wBAAwB,OAAO,OAAO;CAC/C,QAAQ,OAAO;;CAEf,YAAY,OAAO,MACf,OAAO,OAAO;EACV,MAAM,OAAO,MAAM,OAAO,GAAG;EAC7B,WAAW,OAAO,SAAS;GAAC;GAAU;GAAa;GAAW;EAAQ,CAAC;CAC3E,CAAC,CACL;CACA,SAAS,OAAO,SAAS;EAAC;EAAU;EAAW;EAAU;CAAM,CAAC;CAChE,YAAY,OAAO,SAAS;EAAC;EAAU;EAAW;EAAU;CAAM,CAAC;CACnE,gBAAgB,OAAO;;CAEvB,QAAQ,OAAO,SAAS,OAAO,OAAO;EAAE,UAAU,OAAO;EAAQ,MAAM,OAAO;CAAO,CAAC,CAAC;AAC3F,CAAC;AA2DD,MAAM,YAAY,OAAO,MAAM,CAAC,OAAO,QAAQ,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AACzC,CAAC;AACD,MAAa,0BAA0B,OAAO,OAAO;CACjD,SAAS,OAAO,MAAM,mBAAmB;CACzC,QAAQ,OAAO;CACf,SAAS,OAAO;AACpB,CAAC;;AA6ID,IAAa,kBAAb,cAAqC,QAAQ,QAAiD,CAAC,CAC3F,+CACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { Context, Schema } from \"effect\";\nimport { ObjectSubsetSchema } from \"./subsetSchema.js\";\nimport type { AttachmentTypeDef, QueryDocument } from \"@party-stack/ontology-spec\";\nimport type { ObjectSubset } from \"@party-stack/ontology-spec/query\";\nimport type { attachment, Encrypted } from \"@party-stack/ontology-spec/values\";\nimport type { Key, Row } from \"@party-stack/ontology-storage\";\nimport type { ByteInput } from \"@party-stack/ontology-storage/blobs\";\nimport type { Scope, Effect, Stream } from \"effect\";\n\nexport {\n schemaValidationIssues,\n BackendError,\n BackendErrorKindSchema,\n backendErrorStatus,\n ValidationIssueSchema,\n ValidationReportSchema,\n unauthenticated,\n isUnauthenticatedError,\n classifyBackendFailure,\n projectBackendError,\n projectValidationIssue,\n isUnknownActionOutcome,\n} from \"./errors.js\";\nexport type {\n BackendErrorKind,\n ReplicationErrorKind,\n ReplicationError,\n ErrorProjection,\n ErrorProjectionContext,\n ValidationReport,\n ValidationIssue,\n UnauthenticatedError,\n ApplyActionError,\n ValidateActionError,\n LoadSubsetError,\n} from \"./errors.js\";\nimport { BackendError } from \"./errors.js\";\nexport { makeOntologyBackend } from \"./query.js\";\n\nexport interface ObjectSelection {\n readonly subsets: readonly ObjectSubset[];\n}\nexport interface BackendSnapshot {\n /** Region represented by these rows, including any window already applied.\n * Omitted means the requested subset. A broader unwindowed region lets the\n * engine finish filtering/ordering/windowing and optionally cache extra objects.\n * Rows may include residual candidates outside this region; consumers discard\n * them before installing its objects or recording complete coverage.\n */\n readonly fulfilledSubset?: ObjectSubset;\n readonly rows: readonly Row<Record<string, unknown>>[];\n /** Complete for fulfilledSubset (or the request when omitted), including its window. */\n readonly complete: boolean;\n /** Rows fetched from the provider, before adapter-side filtering/windowing.\n * Diagnostic only; omitted when the adapter cannot report it. Not a DB scan count.\n */\n readonly fetchedRows?: number;\n /** Diagnostic provider filter, not a query-capability or coverage contract. */\n readonly pushdown?: SourceQueryPlan;\n /** Position coordinated with this snapshot, when the backend exposes a durable change stream. */\n readonly cursor?: string;\n}\nexport const SourceQueryPlanSchema = Schema.Struct({\n source: Schema.String,\n /** Paths into the request's portable where tree: AND/OR child indices, NOT child 0, [] for the root. */\n predicates: Schema.Array(\n Schema.Struct({\n path: Schema.Array(Schema.Int),\n execution: Schema.Literals([\"source\", \"candidate\", \"adapter\", \"engine\"]),\n })\n ),\n sorting: Schema.Literals([\"source\", \"adapter\", \"engine\", \"none\"]),\n pagination: Schema.Literals([\"source\", \"adapter\", \"engine\", \"none\"]),\n rechecksFilter: Schema.Boolean,\n /** Optional native syntax for raw inspection. Consumers must not parse it to infer execution. */\n native: Schema.optional(Schema.Struct({ language: Schema.String, text: Schema.String })),\n});\nexport type SourceQueryPlan = Schema.Schema.Type<typeof SourceQueryPlanSchema>;\nexport type ObjectChange =\n | {\n readonly kind: \"put\";\n readonly objectType: string;\n readonly key: Key;\n readonly value: Record<string, unknown>;\n }\n | { readonly kind: \"delete\"; readonly objectType: string; readonly key: Key };\nexport interface BackendCommit {\n readonly cursor: string;\n readonly changes: readonly ObjectChange[];\n readonly operationId?: string;\n}\nexport interface BackendChangePage {\n readonly commits: readonly BackendCommit[];\n readonly cursor: string;\n readonly hasMore: boolean;\n}\nexport interface AttachmentUpload {\n readonly attachment: attachment;\n readonly blob: ByteInput;\n readonly target?: AttachmentTypeDef;\n}\nexport interface ActionRequest {\n /** Stable across retries. The source must separately guarantee keyed idempotency. */\n readonly id: string;\n readonly name: string;\n readonly parameters: Record<string, unknown>;\n readonly attachmentUploads?: readonly AttachmentUpload[];\n /** Portable replay inputs, preserved across rebases, forwarding and authoritative execution. */\n readonly replay?: { readonly now: string; readonly seed: string };\n /** How long one attempt to send this action may take, in milliseconds, overriding the\n * outbox's `timeoutMs`. For actions known to take long, such as large uploads. */\n readonly timeoutMs?: number;\n}\nexport interface ActionReceipt {\n /** The submitted ActionRequest.id, also supplied as the application's idempotencyKey. */\n readonly operationId: string;\n /** Provider commitment is recorded before local read-back/reconciliation. Parent acceptance is separate. */\n readonly outcome: \"committed\";\n /** Encoded authoritative return value, interpreted using the action returnType. Never a journal payload. */\n readonly result?: unknown;\n readonly cursor?: string;\n /** Optional upstream execution ID. Never substitutes for our stable retry identity. */\n readonly providerOperationId?: string;\n /** Read-back targets for a committed non-journal action. Missing keys\n * means the whole type; an empty list means no modeled object changes.\n * Omission conservatively refreshes every modeled type.\n * Targets are complete unless affectedComplete is explicitly false.\n */\n readonly affected?: readonly {\n readonly objectType: string;\n readonly keys?: readonly Key[];\n }[];\n /** False when these are known targets but automation may have changed other\n * modeled records. Confirmation must not use them as an exhaustive edit list.\n */\n readonly affectedComplete?: boolean;\n readonly attachmentIdMappings?: readonly { readonly localId: string; readonly remoteId: string }[];\n}\nconst KeySchema = Schema.Union([Schema.String, Schema.Finite]);\nexport const ObjectChangeSchema = Schema.Union([\n Schema.Struct({\n kind: Schema.Literal(\"put\"),\n objectType: Schema.String,\n key: KeySchema,\n value: Schema.Record(Schema.String, Schema.Unknown),\n }),\n Schema.Struct({ kind: Schema.Literal(\"delete\"), objectType: Schema.String, key: KeySchema }),\n]);\nexport const ActionReceiptSchema = Schema.Struct({\n operationId: Schema.String,\n outcome: Schema.Literal(\"committed\"),\n result: Schema.optional(Schema.Unknown),\n cursor: Schema.optional(Schema.String),\n providerOperationId: Schema.optional(Schema.String),\n affected: Schema.optional(\n Schema.Array(\n Schema.Struct({ objectType: Schema.String, keys: Schema.optional(Schema.Array(KeySchema)) })\n )\n ),\n affectedComplete: Schema.optional(Schema.Boolean),\n attachmentIdMappings: Schema.optional(\n Schema.Array(Schema.Struct({ localId: Schema.String, remoteId: Schema.String }))\n ),\n});\nexport const BackendCommitSchema = Schema.Struct({\n cursor: Schema.String,\n changes: Schema.Array(ObjectChangeSchema),\n operationId: Schema.optional(Schema.String),\n});\nexport const BackendSnapshotSchema = Schema.Struct({\n fulfilledSubset: Schema.optional(ObjectSubsetSchema),\n fetchedRows: Schema.optional(Schema.Number),\n pushdown: Schema.optional(SourceQueryPlanSchema),\n rows: Schema.Array(\n Schema.Struct({ key: KeySchema, value: Schema.Record(Schema.String, Schema.Unknown) })\n ),\n complete: Schema.Boolean,\n cursor: Schema.optional(Schema.String),\n});\nexport const BackendChangePageSchema = Schema.Struct({\n commits: Schema.Array(BackendCommitSchema),\n cursor: Schema.String,\n hasMore: Schema.Boolean,\n});\n\nexport interface BackendAttachments {\n /** Optional authoritative staging before a subsequent action references the handle. */\n readonly stage?: (\n value: attachment,\n bytes: ByteInput,\n options?: { readonly target?: AttachmentTypeDef }\n ) => Effect.Effect<attachment, BackendError>;\n /** Keep the caller Scope open through consumption; closing it cancels an unconsumed download too. */\n readonly read: (\n value: attachment,\n options?: { readonly offset?: number; readonly length?: number }\n ) => Effect.Effect<ByteInput, BackendError, Scope.Scope>;\n readonly metadata: (\n value: attachment,\n options?: { readonly select?: readonly (\"size\" | \"type\" | \"name\" | \"dimensions\")[] }\n ) => Effect.Effect<\n {\n readonly size?: number;\n readonly type?: string;\n readonly name?: string;\n readonly dimensions?: { readonly width: number; readonly height: number };\n },\n BackendError\n >;\n}\nexport {\n EncryptedValueSchema,\n DecryptedValueSchema,\n encryptedPropertyCodec,\n makePropertyDecryption,\n} from \"./encrypted.js\";\nexport type { DecryptedValue } from \"./encrypted.js\";\n\nexport interface BackendEncryptedValues {\n /** Explicit operation. Ordinary record loads return handles and never decrypt them. */\n readonly decrypt: (\n value: Encrypted<unknown>\n ) => Effect.Effect<import(\"./encrypted.js\").DecryptedValue, BackendError>;\n}\n/** One object a watch reports, in the watched subset's object type.\n * - `put`: the object is now in the subset with this complete value.\n * - `exit`: the object left the subset. It may have changed or been deleted; the\n * replica reads it back by primary key to tell which.\n * - `delete`: the object no longer exists anywhere.\n */\nexport type SubsetWatchChange =\n | { readonly kind: \"put\"; readonly key: Key; readonly value: Record<string, unknown> }\n | { readonly kind: \"exit\"; readonly key: Key }\n | { readonly kind: \"delete\"; readonly key: Key };\n/** A reset requests repair after starting/restarting a watch; it does not\n * assert that data changed. Ordinary void hints always invalidate coverage.\n * `changes` describes exactly what changed, so the replica can apply it without\n * reloading the subset. Report only what is certain: a `put` must carry every\n * property; anything less precise must be an invalidation hint instead.\n */\nexport type SubsetWatchEvent = void | \"reset\" | { readonly changes: readonly SubsetWatchChange[] };\n\nexport interface OntologyBackendService {\n readonly name: string;\n /** Stable identity for the source whose cursors and receipts this binding returns. */\n readonly sourceId: string;\n /** Durable keyed idempotency within the configured receipt-retention window:\n * repeated IDs return the recorded result, with\n * conflicting payloads rejected. The guarantee must survive source restart.\n * Merely receiving an ID, or an action being naturally idempotent, is insufficient.\n */\n readonly supportsIdempotency: boolean;\n /**\n * The networks this source is on, such as `\"internet\"`: its replica syncs while a device link\n * reaching one of them is available (the runtime's `links`). Omitted means the internet. A\n * source on the same device (in the same process, a worker or a message port) is on none, so\n * its replicas sync whatever the device's links report.\n */\n readonly networks?: readonly string[];\n /** Indexed bounded local maintenance; the backend owner schedules it. */\n readonly maintenance?: Effect.Effect<void, BackendError>;\n /** Return the request or explicitly describe the region actually fulfilled.\n * Consumers use the shared subset normalizer before applying requested windows.\n */\n readonly loadSubset: (subset: ObjectSubset) => Effect.Effect<BackendSnapshot, BackendError>;\n /** Finite Query IR execution using this binding's trusted context and read path.\n * Provider adapters may evaluate through subset loads; owned storage uses one\n * read transaction. Callers supply query inputs, never authentication context.\n */\n readonly query: (\n document: QueryDocument,\n options?: { readonly inputs?: Record<string, unknown> }\n ) => Effect.Effect<Record<string, unknown>, BackendError>;\n /** Optional selected committed rows. Closing the Scope releases demand; delivery state expires by policy. */\n readonly subscribeSelection?: (\n selection: ObjectSelection,\n policy?: import(\"./delivery.js\").DeliveryPolicy,\n resume?: import(\"./delivery.js\").DeliveryPosition\n ) => Effect.Effect<import(\"./delivery.js\").DeliverySubscription, BackendError, Scope.Scope>;\n readonly acknowledgeDelivery?: (\n position: import(\"./delivery.js\").DeliveryPosition\n ) => Effect.Effect<void, BackendError>;\n /** Read-only defaults and edit prefills; never invokes the action. */\n readonly resolveActionParameters?: (\n name: string,\n parameters: Record<string, unknown>\n ) => Effect.Effect<Record<string, unknown>, BackendError>;\n /** Acquire a demand-scoped watch before reading its snapshot. Completion proves\n * registration and buffering are active, even before the returned stream is pulled.\n * The acquiring Scope owns registration and release. Undefined means polling.\n * Reconnect within the same stream must fail or emit reset/invalidation;\n * reacquisition establishes a new readiness boundary for a fresh read.\n * Must cover every change relevant to the requested subset; broader watches\n * may emit extra hints. It does not maintain broader fulfilledSubset coverage.\n */\n readonly watchSubset?: (\n subset: ObjectSubset\n ) => Effect.Effect<Stream.Stream<SubsetWatchEvent, BackendError>, BackendError, Scope.Scope> | undefined;\n /** Recommended demand refresh defaults. Caller configuration wins; healthy\n * watches/journals keep coverage current independently of snapshot age. */\n readonly refresh?: (subset: ObjectSubset) =>\n | {\n readonly pollIntervalMs?: number | false;\n readonly maxCoverageAgeMs?: number;\n }\n | undefined;\n readonly validateAction?: (\n name: string,\n parameters: Record<string, unknown>,\n options?: { readonly knownParameters?: readonly string[] }\n ) => Effect.Effect<import(\"./errors.js\").ValidationReport, BackendError>;\n readonly applyAction: (invocation: ActionRequest) => Effect.Effect<ActionReceipt, BackendError>;\n readonly queryFunction: (\n name: string,\n parameters: Record<string, unknown>\n ) => Effect.Effect<unknown, BackendError>;\n readonly changes?: {\n readonly pull: (options: {\n readonly cursor?: string;\n readonly limit?: number;\n }) => Effect.Effect<BackendChangePage, BackendError>;\n /** Acquire registered, buffered wake-up hints in the caller's Scope before\n * pulling durable changes. Stream consumption does not initiate registration.\n * Call pull to recover changes after reconnect or restart. */\n readonly watch?: Effect.Effect<Stream.Stream<void, BackendError>, BackendError, Scope.Scope>;\n };\n readonly attachments?: BackendAttachments;\n readonly encrypted?: BackendEncryptedValues;\n}\n\n/** Backend protocol independent of TanStack collections and client lifecycle management. */\nexport class OntologyBackend extends Context.Service<OntologyBackend, OntologyBackendService>()(\n \"@party-stack/ontology-backend/OntologyBackend\"\n) {}\n"],"mappings":";;;;;;AA8DA,MAAa,wBAAwB,OAAO,OAAO;CAC/C,QAAQ,OAAO;;CAEf,YAAY,OAAO,MACf,OAAO,OAAO;EACV,MAAM,OAAO,MAAM,OAAO,GAAG;EAC7B,WAAW,OAAO,SAAS;GAAC;GAAU;GAAa;GAAW;EAAQ,CAAC;CAC3E,CAAC,CACL;CACA,SAAS,OAAO,SAAS;EAAC;EAAU;EAAW;EAAU;CAAM,CAAC;CAChE,YAAY,OAAO,SAAS;EAAC;EAAU;EAAW;EAAU;CAAM,CAAC;CACnE,gBAAgB,OAAO;;CAEvB,QAAQ,OAAO,SAAS,OAAO,OAAO;EAAE,UAAU,OAAO;EAAQ,MAAM,OAAO;CAAO,CAAC,CAAC;AAC3F,CAAC;AA8DD,MAAM,YAAY,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,MAAM,CAAC;AAC7D,MAAa,qBAAqB,OAAO,MAAM,CAC3C,OAAO,OAAO;CACV,MAAM,OAAO,QAAQ,KAAK;CAC1B,YAAY,OAAO;CACnB,KAAK;CACL,OAAO,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO;AACtD,CAAC,GACD,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,QAAQ;CAAG,YAAY,OAAO;CAAQ,KAAK;AAAU,CAAC,CAC/F,CAAC;AACD,MAAa,sBAAsB,OAAO,OAAO;CAC7C,aAAa,OAAO;CACpB,SAAS,OAAO,QAAQ,WAAW;CACnC,QAAQ,OAAO,SAAS,OAAO,OAAO;CACtC,QAAQ,OAAO,SAAS,OAAO,MAAM;CACrC,qBAAqB,OAAO,SAAS,OAAO,MAAM;CAClD,UAAU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C,OAAO,OAAO,YAAY;wBACb,KACZ,SAAS,KAAK,kCACd,UAAU,cACX,OAAO,OAAO,YAAY;;;;qBAYhB,iBAAc,SAAa,KAAK,qCAAgC,OAAA,OAAA,YAAA;iBAE5D;;;WAGJ,WAAW,OAAO,gBAAgB;;;wBAG/B,oBACZ,IAAI,YACJ,UAAS,yBACV;iBA0Ec,mBAAmB,mBAAmB,KAAK;WAC/C;WACA,SAAS,OAAO,OAAO,wBAAwB,cAAc,IAAI,MAAM"}
1
+ {"version":3,"file":"meta.d.ts","names":[],"sources":["../src/meta.ts"],"mappings":";;;;;iBAiEiB;;EAEb;EACA;EACA;;EAEA,aAAa,UAAU,eAAe,aAAa,QAAQ;;EAE3D;;;YAGQ,sBAAsB,KAAK;iBAEtB;;WAEJ,UAAU;;;;;WAKV,kBAAkB;;;;;;;;wBAyKf,KACZ,SAAS,KAAK,kCACd,SAAS;WAAyB;IACnC,OAAO,OAAO,YAAY;wBACb,KACZ,SAAS,KAAK,kCACd,UAAU,cACX,OAAO,OAAO,YAAY;;;;qBAYhB,iBAAc,SAAa,KAAK,qCAAgC,OAAA,OAAA,YAAA;iBAE5D;;;WAGJ,WAAW,OAAO,gBAAgB;;;wBAG/B,oBACZ,IAAI,YACJ,UAAS,yBACV;iBA0Ec,mBAAmB,mBAAmB,KAAK;WAC/C;WACA,SAAS,OAAO,OAAO,wBAAwB,cAAc,IAAI,MAAM"}
package/lib/meta.js CHANGED
@@ -5,7 +5,7 @@ import { makeOntologyBackend } from "./query.js";
5
5
  import * as q from "@party-stack/ontology-spec/query";
6
6
  import { and, evaluateQuery, field, inArray } from "@party-stack/ontology-storage";
7
7
  import { Effect, Stream } from "effect";
8
- import { omitInvalid, withDefinitionIds, withoutDefaultIds } from "@party-stack/ontology-spec";
8
+ import { cloneDefinition, omitInvalid, withDefinitionIds, withoutDefaultIds } from "@party-stack/ontology-spec";
9
9
  import metaOntology from "@party-stack/ontology-spec/meta";
10
10
  //#region src/meta.ts
11
11
  function getValueTypes(type) {
@@ -138,7 +138,7 @@ const pullDefinitions = Effect.fn("Metadata.pull")(function* (backend, options =
138
138
  message: `Pulled ontology is invalid: ${repaired.issues.map((issue) => issue.message).join(" ")}`,
139
139
  issues: repaired.issues
140
140
  });
141
- if (repaired.omitted.length) yield* Effect.logWarning("Omitted definitions the Ontology IR cannot represent.").pipe(Effect.annotateLogs({ omitted: repaired.omitted.map((entry) => `${entry.name}${entry.parameter ? `.${entry.parameter}` : ""}`) }));
141
+ if (repaired.omitted.length) yield* Effect.logWarning("Omitted definitions the Ontology IR cannot represent.").pipe(Effect.annotateLogs({ omitted: repaired.omitted.map((entry) => `${entry.name}${entry.parameter ? `.${entry.parameter}` : ""}: ${entry.issues.map((issue) => issue.message).join(" ")}`) }));
142
142
  return {
143
143
  ontology: repaired.ontology,
144
144
  omitted: repaired.omitted
@@ -154,7 +154,7 @@ function pull(backend, options = {}) {
154
154
  const loadDefinition = (backend) => pull(backend);
155
155
  /** Serve a definition as meta ontology rows. */
156
156
  function makeMetadataBackend(ir, options = {}) {
157
- ir = withDefinitionIds(structuredClone(ir));
157
+ ir = withDefinitionIds(cloneDefinition(ir));
158
158
  return makeOntologyBackend({
159
159
  ir: metaOntology,
160
160
  name: "local-metadata",