@registrystack/client 0.32.0 → 0.34.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/README.md CHANGED
@@ -34,7 +34,8 @@ const work = new casework.CaseworkClient({
34
34
  - `evidence`: Evidence Gateway, request and verify signed minimum-disclosure
35
35
  assertions.
36
36
  - `relay`: Registry Relay, scoped read-only APIs over existing sources.
37
- - `breg`: Base Registry Engine, records, contracts, writes, and lifecycle.
37
+ - `breg`: Base Registry Engine, records, contracts, writes, lifecycle, and typed
38
+ applied-request result navigation.
38
39
  - `casework`: Registry Casework, staff inbox, claims, drafts, decisions,
39
40
  recovery, history, holdings, and directory bootstrap.
40
41
 
package/breg/client.d.ts CHANGED
@@ -216,33 +216,54 @@ export interface RegistryRecord {
216
216
  readonly [member: string]: JsonValue | undefined
217
217
  }
218
218
 
219
- export type BRegRequestReviewStage = JsonObject & {
220
- readonly id: string
221
- readonly approvals: SafeInteger
222
- readonly excludeSubmitter: boolean
223
- readonly excludePreviousReviewers?: boolean
224
- }
225
- export type BRegRequestReviewState = JsonObject & {
226
- readonly stages: ReadonlyArray<BRegRequestReviewStage>
227
- readonly submittedAt: string
228
- readonly pendingStage: string | null
229
- readonly stageEnteredAt: string | null
230
- }
231
- export type BRegRequestReviewTiming = JsonObject & {
232
- readonly firstSubmittedAt: string
233
- readonly pausedMilliseconds: SafeInteger
234
- readonly pauseStartedAt: string | null
235
- readonly completedAt: string | null
236
- }
237
- export type BRegRequestDecision = JsonObject & {
238
- readonly stageId: string
239
- readonly kind: 'approve' | 'reject' | 'request_revision'
240
- readonly decidedAt: string
241
- readonly reasonPresent: boolean
242
- readonly reason?: string
243
- readonly actorReference?: string
244
- }
245
- export type BRegRequestState = 'draft' | 'submitted' | 'approved' | 'needs_changes' | 'rejected' | 'canceled' | 'applied'
219
+ export type BRegRequestResultReferenceData = JsonObject & {
220
+ readonly targetEntityId: string
221
+ readonly targetRecordId: string
222
+ /** Revision written by the application, not a current ETag or precondition. */
223
+ readonly targetRevision: SafeInteger
224
+ }
225
+ export type BRegRequestState = 'draft' | 'submitted' | 'cancelled' | 'applied'
226
+ export type BRegRequestReviewRequirement =
227
+ | Readonly<{ mode: 'none' }>
228
+ | Readonly<{ authority: string; policyId: string }>
229
+ export type BRegExternalReviewStatus = Readonly<{
230
+ submission: Readonly<{
231
+ state: 'pending' | 'accepted' | 'uncertain' | 'cancelling' | 'cancelled' | 'failed'
232
+ authority: string
233
+ requestId?: string
234
+ submissionDigest?: string
235
+ /** Fixed recovery deadline for the durable submission. */
236
+ recoveryDeadline?: string
237
+ policy?: Readonly<{ id: string; version: string; digest: string }>
238
+ }>
239
+ result: Readonly<{
240
+ state: 'pending' | 'approved' | 'rejected' | 'changesRequested' | 'answered' | 'cancelled' | 'superseded'
241
+ resultId?: string
242
+ completedAt?: string
243
+ availableUntil?: string
244
+ }>
245
+ delivery: Readonly<{
246
+ state: 'polling' | 'received' | 'reconciled' | 'unmatched' | 'exhausted'
247
+ eventId?: string
248
+ receivedAt?: string
249
+ }>
250
+ application: Readonly<{
251
+ mode: 'manual' | 'automatic'
252
+ state: 'awaitingReview' | 'ready' | 'queued' | 'applying' | 'applied' | 'blocked' | 'expired'
253
+ executor?: string
254
+ applicationId?: string
255
+ /** Durable automatic-application attempts, from 0 through 1000. */
256
+ attempts?: SafeInteger
257
+ /** Present only while an automatic application is queued or applying. */
258
+ nextAttemptAt?: string
259
+ /** Present when the applied receipt was recovered from already-applied source state. */
260
+ receiptRecovered?: true
261
+ }>
262
+ recovery: Readonly<{
263
+ state: 'none' | 'operatorAttention'
264
+ code?: string
265
+ }>
266
+ }>
246
267
  export type BRegRetainedRequestProposal = JsonObject & {
247
268
  readonly requestEntityId: string
248
269
  readonly requestId: string
@@ -253,9 +274,9 @@ export type BRegRetainedRequestProposal = JsonObject & {
253
274
  readonly detailErased: boolean
254
275
  readonly applicationId: string | null
255
276
  readonly resultLinkCount: SafeInteger
256
- readonly resultLinks: ReadonlyArray<JsonObject>
277
+ readonly resultLinks: ReadonlyArray<BRegRequestResultReferenceData>
257
278
  readonly effectDigest?: string
258
- readonly decisions?: ReadonlyArray<BRegRequestDecision>
279
+ readonly proposal?: Readonly<{ review: BRegRequestReviewRequirement }>
259
280
  }
260
281
  export type BRegRetainedRequestHistory = JsonObject & {
261
282
  readonly proposals: ReadonlyArray<BRegRetainedRequestProposal>
@@ -265,17 +286,15 @@ export type BRegRequestMetadata = JsonObject & {
265
286
  readonly bregState: BRegRequestState
266
287
  readonly proposalVersion: SafeInteger
267
288
  readonly effectDigest?: string | null
268
- readonly proposal?: JsonObject | null
289
+ readonly proposal?: Readonly<{ review: BRegRequestReviewRequirement }> | null
269
290
  readonly editable: boolean
270
291
  readonly detailErased?: true
271
292
  readonly actions?: ReadonlyArray<JsonObject>
272
293
  readonly application?: JsonObject | null
273
- readonly history?: BRegRetainedRequestHistory
274
- readonly review?: BRegRequestReviewState
275
- readonly reviewTiming?: BRegRequestReviewTiming
294
+ readonly history?: BRegRetainedRequestHistory | null
295
+ readonly review?: BRegExternalReviewStatus
276
296
  readonly submitterReference?: string
277
297
  readonly applierReference?: string
278
- readonly decisions?: ReadonlyArray<BRegRequestDecision>
279
298
  }
280
299
 
281
300
  export interface RecordMetadata {
@@ -343,17 +362,6 @@ export interface RemovePatchOperation {
343
362
  field: string
344
363
  }
345
364
 
346
- export interface LifecycleReviewTarget {
347
- entityIdentifier: string
348
- recordIdentifier: string
349
- operation: 'create' | 'patch'
350
- baseRevision?: SafeInteger
351
- before?: Readonly<Record<string, JsonValue>>
352
- after: Readonly<Record<string, JsonValue>>
353
- }
354
-
355
- export interface LifecycleReview { targets: ReadonlyArray<LifecycleReviewTarget> }
356
-
357
365
  export type LifecycleReceipt = JsonObject & {
358
366
  readonly id: string
359
367
  readonly revision: SafeInteger
@@ -592,6 +600,165 @@ export interface BRegBatchReceipt {
592
600
  }>
593
601
  }
594
602
 
603
+ export type BRegIngestionOperation = 'create' | 'patch'
604
+ export type BRegIngestionRunStatus = 'open' | 'complete' | 'cancelled' | 'blocked'
605
+ export type BRegIngestionAttemptOutcome =
606
+ | 'committed'
607
+ | 'replayed'
608
+ | 'invalidItem'
609
+ | 'refused'
610
+ | 'bindingChanged'
611
+ | 'chunkMismatch'
612
+ | 'runNotOpen'
613
+ | 'unavailable'
614
+
615
+ /** The whole-input announcement that opens one durable ingestion run. */
616
+ export interface BRegIngestionRunInput {
617
+ operation: BRegIngestionOperation
618
+ profileId: string
619
+ packageRevision: string
620
+ schemaFingerprint: string
621
+ /** Lowercase SHA-256 of the complete raw source input. */
622
+ inputDigest: string
623
+ inputLength: SafeInteger
624
+ itemCount: SafeInteger
625
+ chunkCount: SafeInteger
626
+ /** The only accepted value is `greedy-canonical-http-batch-v1`. */
627
+ chunkAlgorithmVersion: string
628
+ }
629
+
630
+ export interface BRegIngestionRunListInput {
631
+ accessProfile?: string | null
632
+ limit?: SafeInteger | null
633
+ after?: string | null
634
+ status?: BRegIngestionRunStatus | null
635
+ inputDigest?: string | null
636
+ }
637
+
638
+ export interface BRegIngestionAttempt {
639
+ readonly outcome: BRegIngestionAttemptOutcome
640
+ readonly chunkIndex: SafeInteger | null
641
+ }
642
+
643
+ /** Value-free durable state of one ingestion run: no source rows, no record values. */
644
+ export interface BRegIngestionRun {
645
+ readonly runId: string
646
+ readonly status: BRegIngestionRunStatus
647
+ readonly blockedReason: string | null
648
+ readonly entityId: string
649
+ readonly operation: BRegIngestionOperation
650
+ readonly profileId: string
651
+ readonly packageRevision: string
652
+ readonly schemaFingerprint: string
653
+ readonly inputDigest: string
654
+ readonly inputLength: SafeInteger
655
+ readonly itemCount: SafeInteger
656
+ readonly chunkCount: SafeInteger
657
+ readonly chunkAlgorithmVersion: string
658
+ readonly maximumItems: SafeInteger
659
+ readonly maximumBytes: SafeInteger
660
+ readonly nextChunkIndex: SafeInteger
661
+ readonly committedItems: SafeInteger
662
+ readonly committedPrefixDigest: string
663
+ readonly lastAttempt: BRegIngestionAttempt | null
664
+ readonly createdAt: string
665
+ readonly updatedAt: string
666
+ readonly complete: boolean
667
+ }
668
+
669
+ export interface BRegIngestionRunPage {
670
+ readonly runs: ReadonlyArray<BRegIngestionRun>
671
+ readonly hasMore: boolean
672
+ readonly nextAfter: string | null
673
+ }
674
+
675
+ export interface BRegIngestionReceiptBatch {
676
+ readonly snapshot: string
677
+ readonly results: ReadonlyArray<JsonObject>
678
+ }
679
+
680
+ export interface BRegIngestionChunkReceipt {
681
+ readonly chunkIndex: SafeInteger
682
+ readonly digest: string
683
+ readonly replayed: boolean
684
+ readonly erased: boolean
685
+ readonly batch: BRegIngestionReceiptBatch
686
+ }
687
+
688
+ export interface BRegIngestionChunkSubmission {
689
+ readonly run: BRegIngestionRun
690
+ readonly receipt: BRegIngestionChunkReceipt
691
+ }
692
+
693
+ /**
694
+ * One bounded, digest-bound chunk of an ingestion run. The chunk digest is
695
+ * derived in Rust from the exact canonical batch body the items hash to.
696
+ */
697
+ export declare class BRegIngestionChunk {
698
+ private constructor()
699
+ private readonly __opaque: void
700
+ readonly chunkIndex: SafeInteger
701
+ readonly itemCount: SafeInteger
702
+ readonly digest: string
703
+ readonly prefixDigest: string
704
+ }
705
+
706
+ /**
707
+ * Accumulate the raw source bytes of one ingestion input and derive the
708
+ * rolling prefix digest the run binds: the lowercase SHA-256 of everything
709
+ * absorbed through the end of the current chunk. The digest of an empty
710
+ * accumulation is `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`.
711
+ */
712
+ export declare class BRegIngestionPrefixDigest {
713
+ constructor()
714
+ update(data: Buffer): void
715
+ digest(): string
716
+ }
717
+
718
+ /**
719
+ * Encode one ingestion chunk submission: derive its digest in Rust and bind
720
+ * the announced prefix digest into the exact wire body. `items` are the same
721
+ * batch items the entity's atomic batch route executes.
722
+ */
723
+ export declare function encodeIngestionChunk(
724
+ chunkIndex: SafeInteger,
725
+ items: ReadonlyArray<BRegBatchItem>,
726
+ prefixDigest: string,
727
+ ): BRegIngestionChunk
728
+
729
+ /**
730
+ * Where a change-request target or value comes from, present only when the
731
+ * caller may read it: a request-entity field, or the record another effect
732
+ * of the same request creates.
733
+ */
734
+ export type BRegChangeRequestBinding =
735
+ | { readonly fromField: string; readonly fromEffect?: never }
736
+ | { readonly fromEffect: string; readonly fromField?: never }
737
+ | { readonly fromField?: never; readonly fromEffect?: never }
738
+
739
+ export type BRegChangeRequestTarget = { readonly entity: string } & BRegChangeRequestBinding
740
+
741
+ /**
742
+ * One declared change-request effect on an entity the caller may read. Only
743
+ * target fields the caller may read are named; the value is descriptive and
744
+ * cannot create target-write authority.
745
+ */
746
+ export interface BRegChangeRequestEffect {
747
+ readonly id: string
748
+ readonly operation: 'create' | 'patch'
749
+ readonly target: BRegChangeRequestTarget
750
+ readonly set: ReadonlyArray<{ readonly field: string } & BRegChangeRequestBinding>
751
+ readonly clear: ReadonlyArray<string>
752
+ }
753
+
754
+ /** One declared planner write, filtered to fields the caller may read. */
755
+ export interface BRegChangeRequestPlannerWrite {
756
+ /** A planner write targets a stored record, never another effect. */
757
+ readonly target: { readonly entity: string; readonly fromField?: string; readonly fromEffect?: never }
758
+ readonly operation: 'create' | 'patch'
759
+ readonly fields: ReadonlyArray<string>
760
+ }
761
+
595
762
  export interface BRegChangeRequestCapability {
596
763
  readonly planner: {
597
764
  readonly kind: 'declarative' | 'rhai'
@@ -611,18 +778,16 @@ export interface BRegChangeRequestCapability {
611
778
  } | null
612
779
  readonly possibleWriteCount: SafeInteger | null
613
780
  readonly possibleWriteOperations: ReadonlyArray<string>
781
+ readonly writes: ReadonlyArray<BRegChangeRequestPlannerWrite>
782
+ }
783
+ readonly effects: ReadonlyArray<BRegChangeRequestEffect>
784
+ readonly review: BRegRequestReviewRequirement
785
+ readonly onApproved: {
786
+ readonly mode: 'manual' | 'automatic'
787
+ readonly executor: string | null
614
788
  }
615
- readonly reviewMode: 'none' | 'staged'
616
- readonly stages: ReadonlyArray<{
617
- readonly id: string
618
- readonly approvals: SafeInteger
619
- readonly excludeSubmitter: boolean
620
- readonly excludePreviousReviewers: boolean
621
- }> | null
622
789
  readonly application: {
623
- readonly mode: 'manual' | 'automatic' | 'planner'
624
- readonly allowedDispositions: ReadonlyArray<'apply' | 'queue'>
625
- readonly queueReasons: ReadonlyArray<{ readonly code: string; readonly label: string }>
790
+ readonly preconditions: JsonValue | null
626
791
  }
627
792
  }
628
793
 
@@ -715,18 +880,54 @@ export declare class BRegLifecycleAuthority {
715
880
  private readonly __opaque: void
716
881
  }
717
882
 
883
+ /** Inert caller-visible target provenance. It grants no read authority. */
884
+ export declare class BRegRequestResultReference {
885
+ private constructor()
886
+ private readonly __opaque: void
887
+ readonly targetEntityIdentifier: string
888
+ readonly targetRecordIdentifier: string
889
+ /** Revision written by the application, not a current ETag or precondition. */
890
+ readonly targetRevision: SafeInteger
891
+ toString(): string
892
+ }
893
+
894
+ /** One exact retained proposal from an explicitly loaded history page. */
895
+ export declare class BRegRetainedRequestProposalView {
896
+ private constructor()
897
+ private readonly __opaque: void
898
+ readonly requestEntityIdentifier: string
899
+ readonly requestIdentifier: string
900
+ readonly proposalVersion: SafeInteger
901
+ readonly bregState: BRegRequestState
902
+ readonly current: boolean
903
+ readonly detailErased: boolean
904
+ readonly applicationIdentifier: string | null
905
+ /** Caller-visible count, never an undisclosed application total. */
906
+ readonly resultLinkCount: SafeInteger
907
+ readonly resultReferences: ReadonlyArray<BRegRequestResultReference>
908
+ toString(): string
909
+ }
910
+
911
+ /** One page only. Call getRecord with its cursor to load another page. */
912
+ export declare class BRegRetainedRequestHistoryPage {
913
+ private constructor()
914
+ private readonly __opaque: void
915
+ readonly proposals: ReadonlyArray<BRegRetainedRequestProposalView>
916
+ readonly nextAfterProposalVersion: SafeInteger | null
917
+ findProposal(requestEntityIdentifier: string, requestIdentifier: string, proposalVersion: SafeInteger): BRegRetainedRequestProposalView | null
918
+ findApplication(requestEntityIdentifier: string, requestIdentifier: string, proposalVersion: SafeInteger, applicationIdentifier: string): BRegRetainedRequestProposalView | null
919
+ toString(): string
920
+ }
921
+
718
922
  /** Opaque executable action promoted from a metadata authority and one record. */
719
923
  export declare class BRegLifecycleAction {
720
924
  withReason(reason: string): BRegLifecycleAction
721
925
  private constructor()
722
926
  private readonly __opaque: void
723
927
  readonly operation: string
724
- readonly stage: string | null
725
928
  readonly href: string
726
929
  readonly bodyJson: string
727
- readonly reviewJson: string | null
728
930
  readonly body: JsonObject
729
- readonly review: LifecycleReview | null
730
931
  }
731
932
 
732
933
  /** Inert bounded Create evidence. Persist these bytes with owner-only access. */
@@ -839,9 +1040,17 @@ export declare class BaseRegistryClient {
839
1040
  patchRecord(binding: BRegPatchBinding, recordIdentifier: string, etag: string, operations: ReadonlyArray<PatchOperation | RemovePatchOperation>, idempotencyKey: string, format?: RecordFormat | null): Promise<CompleteOutcome<RecordEnvelope>>
840
1041
  batchRecords(binding: BRegBatchBinding, request: BRegBatchInput, idempotencyKey: string): Promise<CompleteOutcome<BRegBatchReceipt>>
841
1042
  batchRecordsJson(binding: BRegBatchBinding, requestJson: string, idempotencyKey: string): Promise<JsonOutcome>
1043
+ createIngestionRun(entityRoute: string, request: BRegIngestionRunInput): Promise<CompleteOutcome<BRegIngestionRun>>
1044
+ listIngestionRuns(entityRoute: string, query?: BRegIngestionRunListInput | null): Promise<CompleteOutcome<BRegIngestionRunPage>>
1045
+ readIngestionRun(entityRoute: string, runId: string, accessProfile?: string | null): Promise<CompleteOutcome<BRegIngestionRun>>
1046
+ submitIngestionChunk(entityRoute: string, runId: string, chunk: BRegIngestionChunk, profileId: string): Promise<CompleteOutcome<BRegIngestionChunkSubmission>>
1047
+ cancelIngestionRun(entityRoute: string, runId: string, accessProfile?: string | null): Promise<CompleteOutcome<BRegIngestionRun>>
1048
+ ingestionChunkReceipt(entityRoute: string, runId: string, chunkIndex: SafeInteger, profileId: string): Promise<CompleteOutcome<BRegIngestionChunkReceipt>>
842
1049
  tombstoneRecord(binding: BRegTombstoneBinding, recordIdentifier: string, etag: string, idempotencyKey: string, format?: RecordFormat | null): Promise<CompleteOutcome<RecordEnvelope>>
843
1050
  tombstoneRecordJson(binding: BRegTombstoneBinding, recordIdentifier: string, etag: string, idempotencyKey: string, format?: RecordFormat | null): Promise<JsonOutcome>
844
1051
  lifecycleActions(authority: BRegLifecycleAuthority, record: RecordEnvelope, format?: RecordFormat | null): ReadonlyArray<BRegLifecycleAction>
1052
+ /** Pure typed projection of one already loaded page. Performs no I/O. */
1053
+ requestHistory(record: RecordEnvelope, format?: RecordFormat | null): BRegRetainedRequestHistoryPage | null
845
1054
  prepareLifecycleAction(authority: BRegLifecycleAuthority, record: RecordEnvelope, action: BRegLifecycleAction, idempotencyKey: string, format?: RecordFormat | null): BRegPreparedLifecycle
846
1055
  prepareLifecycleActionJson(authority: BRegLifecycleAuthority, recordJson: string, action: BRegLifecycleAction, idempotencyKey: string, format?: RecordFormat | null): BRegPreparedLifecycle
847
1056
  recoverLifecycleAction(authority: BRegLifecycleAuthority, prepared: BRegPreparedLifecycle): BRegRecoveredLifecycle
package/breg/client.js CHANGED
@@ -222,6 +222,8 @@ for (const [method, jsonIndexes, requiredIndexes] of [
222
222
  ['actionTargetConditionsJson'], ['invokeActionJson'], ['batchRecordsJson'], ['tombstoneRecordJson'],
223
223
  ['executeRecoveredCreateJson'], ['executeRecoveredLifecycleActionJson'],
224
224
  ['uploadAttachmentJson'], ['deleteAttachmentJson'],
225
+ ['createIngestionRun', [1], [1]], ['listIngestionRuns', [1]],
226
+ ['readIngestionRun'], ['submitIngestionChunk'], ['cancelIngestionRun'],
225
227
  ]) wrapAsync(method, jsonIndexes, requiredIndexes);
226
228
 
227
229
  for (const [method, jsonIndexes, requiredIndexes] of [
@@ -302,6 +304,32 @@ native.BaseRegistryClient.prototype.lifecycleActions = function (...args) {
302
304
  }
303
305
  };
304
306
 
307
+ const requestHistory = native.BaseRegistryClient.prototype.requestHistory;
308
+ native.BaseRegistryClient.prototype.requestHistory = function (...args) {
309
+ try {
310
+ const sanitized = sanitizeArguments(args, new Set([0]), new Set([0]));
311
+ return requestHistory.apply(this, sanitized);
312
+ } catch (error) {
313
+ throw normalize(error, 'invalid_request');
314
+ }
315
+ };
316
+
317
+ for (const name of ['findProposal', 'findApplication']) {
318
+ const original = native.RetainedRequestHistoryPage.prototype[name];
319
+ native.RetainedRequestHistoryPage.prototype[name] = function (...args) {
320
+ try {
321
+ const proposalVersion = args[2];
322
+ if (!Number.isSafeInteger(proposalVersion)
323
+ || proposalVersion < 1 || proposalVersion > 0xffff_ffff) {
324
+ throw inputError('invalid_request');
325
+ }
326
+ return original.apply(this, args);
327
+ } catch (error) {
328
+ throw normalize(error, 'invalid_request');
329
+ }
330
+ };
331
+ }
332
+
305
333
  const valueIn = native.BRegAttachmentSlot.prototype.valueIn;
306
334
  native.BRegAttachmentSlot.prototype.valueIn = function (...args) {
307
335
  try {
@@ -336,6 +364,42 @@ for (const name of [
336
364
  };
337
365
  }
338
366
 
367
+ function encodeIngestionChunk(chunkIndex, items, prefixDigest) {
368
+ try {
369
+ if (!Number.isSafeInteger(chunkIndex)) throw inputError('invalid_request');
370
+ const sanitized = sanitizeArguments(
371
+ [chunkIndex, items, prefixDigest], new Set([1]), new Set([1]),
372
+ );
373
+ return native.encodeIngestionChunk(...sanitized);
374
+ } catch (error) {
375
+ throw normalize(error, 'invalid_request');
376
+ }
377
+ }
378
+
379
+ // napi truncates a fractional JavaScript number into the i64 chunk index, so
380
+ // the exact chunk-bound protocol checks integrality before it reaches Rust.
381
+ const ingestionChunkReceipt = native.BaseRegistryClient.prototype.ingestionChunkReceipt;
382
+ native.BaseRegistryClient.prototype.ingestionChunkReceipt = function (...args) {
383
+ try {
384
+ if (!Number.isSafeInteger(args[2])) throw inputError('invalid_request');
385
+ return ingestionChunkReceipt.apply(this, args).catch((error) => { throw normalize(error); });
386
+ } catch (error) {
387
+ throw normalize(error, 'invalid_request');
388
+ }
389
+ };
390
+
391
+ const ingestionPrefixDigestUpdate = native.BRegIngestionPrefixDigest.prototype.update;
392
+ native.BRegIngestionPrefixDigest.prototype.update = function (data) {
393
+ try {
394
+ if (!Buffer.isBuffer(data) || isSharedArrayBuffer(data.buffer)) {
395
+ throw inputError('invalid_request');
396
+ }
397
+ return ingestionPrefixDigestUpdate.call(this, data);
398
+ } catch (error) {
399
+ throw normalize(error, 'invalid_request');
400
+ }
401
+ };
402
+
339
403
  class BaseRegistryClient extends native.BaseRegistryClient {
340
404
  constructor(config) {
341
405
  try {
@@ -372,6 +436,9 @@ module.exports = {
372
436
  BRegPatchBinding: native.BRegPatchBinding,
373
437
  BRegLifecycleAuthority: native.BRegLifecycleAuthority,
374
438
  BRegLifecycleAction: native.BRegLifecycleAction,
439
+ BRegRequestResultReference: native.RequestResultReference,
440
+ BRegRetainedRequestProposalView: native.RetainedRequestProposal,
441
+ BRegRetainedRequestHistoryPage: native.RetainedRequestHistoryPage,
375
442
  BRegAttachmentSlot: native.BRegAttachmentSlot,
376
443
  BRegAttachmentUpload: native.BRegAttachmentUpload,
377
444
  BRegImmediateActionBinding: native.BRegImmediateActionBinding,
@@ -382,4 +449,7 @@ module.exports = {
382
449
  BRegPreparedLifecycle,
383
450
  BRegRecoveredCreate: native.BRegRecoveredCreate,
384
451
  BRegRecoveredLifecycle: native.BRegRecoveredLifecycle,
452
+ BRegIngestionChunk: native.BRegIngestionChunk,
453
+ BRegIngestionPrefixDigest: native.BRegIngestionPrefixDigest,
454
+ encodeIngestionChunk,
385
455
  };
package/breg/index.d.ts CHANGED
@@ -41,6 +41,30 @@ export declare class BaseRegistryClient {
41
41
  patchRecord(binding: BRegPatchBinding, recordIdentifier: string, etag: string, operations: any, idempotencyKey: string, formatValue?: string | undefined | null): Promise<CompleteOutcome>
42
42
  /** Execute one metadata-selected atomic batch without automatic retry. */
43
43
  batchRecords(binding: BRegBatchBinding, request: any, idempotencyKey: string): Promise<CompleteOutcome>
44
+ /**
45
+ * Announce one whole input and open a durable ingestion run for it. The
46
+ * run request names the access profile, which the client selects for the
47
+ * exchange.
48
+ */
49
+ createIngestionRun(entityRoute: string, request: any): Promise<CompleteOutcome>
50
+ /** Read one bounded page of ingestion runs for one entity route. */
51
+ listIngestionRuns(entityRoute: string, query?: any | undefined | null): Promise<CompleteOutcome>
52
+ /** Read the current durable state of one ingestion run. */
53
+ readIngestionRun(entityRoute: string, runId: string, accessProfile?: string | undefined | null): Promise<CompleteOutcome>
54
+ /**
55
+ * Submit one bounded chunk of an open ingestion run under the run's
56
+ * access profile. A resubmitted chunk replays its retained receipt
57
+ * instead of executing twice.
58
+ */
59
+ submitIngestionChunk(entityRoute: string, runId: string, chunk: BRegIngestionChunk, profileId: string): Promise<CompleteOutcome>
60
+ /** Cancel an open ingestion run. Committed chunks stay committed. */
61
+ cancelIngestionRun(entityRoute: string, runId: string, accessProfile?: string | undefined | null): Promise<CompleteOutcome>
62
+ /**
63
+ * Read the retained receipt of one committed chunk under the run's
64
+ * access profile. An erased receipt answers with the
65
+ * `ingestion.receipt_erased` problem instead.
66
+ */
67
+ ingestionChunkReceipt(entityRoute: string, runId: string, chunkIndex: number, profileId: string): Promise<CompleteOutcome>
44
68
  /** Tombstone one record against its current strong ETag. */
45
69
  tombstoneRecord(binding: BRegTombstoneBinding, recordIdentifier: string, etag: string, idempotencyKey: string, formatValue?: string | undefined | null): Promise<CompleteOutcome>
46
70
  /**
@@ -53,6 +77,11 @@ export declare class BaseRegistryClient {
53
77
  /** Empty one governed attachment slot. */
54
78
  deleteAttachment(slot: BRegAttachmentSlot, recordIdentifier: string, etag: string, idempotencyKey: string, formatValue?: string | undefined | null): Promise<CompleteOutcome>
55
79
  lifecycleActions(authority: BRegLifecycleAuthority, record: any, formatValue?: string | undefined | null): Array<BRegLifecycleAction>
80
+ /**
81
+ * Decode one already loaded record's retained request-history page.
82
+ * This performs no I/O and does not advance the returned continuation.
83
+ */
84
+ requestHistory(record: any, formatValue?: string | undefined | null): RetainedRequestHistoryPage | null
56
85
  executeLifecycleAction(action: BRegLifecycleAction, idempotencyKey: string): Promise<CompleteOutcome>
57
86
  /** Prepare inert lifecycle evidence before any token acquisition or I/O. */
58
87
  prepareLifecycleAction(authority: BRegLifecycleAuthority, record: any, action: BRegLifecycleAction, idempotencyKey: string, formatValue?: string | undefined | null): BRegPreparedLifecycle
@@ -151,15 +180,42 @@ export declare class BRegImmediateActionBinding {
151
180
  }
152
181
  export type ImmediateActionBinding = BRegImmediateActionBinding
153
182
 
183
+ /**
184
+ * One bounded, digest-bound chunk of an ingestion run. The chunk digest is
185
+ * derived in Rust from the exact canonical batch body the items hash to.
186
+ */
187
+ export declare class BRegIngestionChunk {
188
+ get chunkIndex(): number
189
+ get itemCount(): number
190
+ /** The derived lowercase SHA-256 of the chunk's canonical batch body. */
191
+ get digest(): string
192
+ get prefixDigest(): string
193
+ }
194
+ export type IngestionChunk = BRegIngestionChunk
195
+
196
+ /**
197
+ * Accumulate the raw source bytes of one ingestion input and derive the
198
+ * prefix digest the run binds: the lowercase SHA-256 of everything absorbed
199
+ * through the end of the current chunk. The digest of an empty accumulation
200
+ * is `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`.
201
+ * The digest is never a chain over chunk digests: the server stores it as an
202
+ * opaque value and cannot re-derive the raw bytes.
203
+ */
204
+ export declare class BRegIngestionPrefixDigest {
205
+ constructor()
206
+ /** Absorb the next raw source bytes, typically one chunk's source extent. */
207
+ update(data: Buffer): void
208
+ /** The lowercase SHA-256 of every raw source byte absorbed so far. */
209
+ digest(): string
210
+ }
211
+ export type IngestionPrefixDigest = BRegIngestionPrefixDigest
212
+
154
213
  export declare class BRegLifecycleAction {
155
214
  withReason(reason: string): BRegLifecycleAction
156
215
  get bodyJson(): string
157
- get reviewJson(): string | null
158
216
  get operation(): string
159
- get stage(): string | null
160
217
  get href(): string
161
218
  get body(): any
162
- get review(): any | null
163
219
  }
164
220
  export type LifecycleAction = BRegLifecycleAction
165
221
 
@@ -252,6 +308,37 @@ export declare class PrivateKeyJwt {
252
308
  }
253
309
  export type PrivateKeyJwtBinding = PrivateKeyJwt
254
310
 
311
+ /** One inert caller-visible target written by an applied request. */
312
+ export declare class RequestResultReference {
313
+ get targetEntityIdentifier(): string
314
+ get targetRecordIdentifier(): string
315
+ get targetRevision(): number
316
+ toString(): string
317
+ }
318
+
319
+ /** One explicitly loaded retained request-history page. */
320
+ export declare class RetainedRequestHistoryPage {
321
+ get proposals(): Array<RetainedRequestProposal>
322
+ get nextAfterProposalVersion(): number | null
323
+ findProposal(requestEntityIdentifier: string, requestIdentifier: string, proposalVersion: number): RetainedRequestProposal | null
324
+ findApplication(requestEntityIdentifier: string, requestIdentifier: string, proposalVersion: number, applicationIdentifier: string): RetainedRequestProposal | null
325
+ toString(): string
326
+ }
327
+
328
+ /** One exact retained proposal in an explicitly loaded history page. */
329
+ export declare class RetainedRequestProposal {
330
+ get requestEntityIdentifier(): string
331
+ get requestIdentifier(): string
332
+ get proposalVersion(): number
333
+ get bregState(): string
334
+ get current(): boolean
335
+ get detailErased(): boolean
336
+ get applicationIdentifier(): string | null
337
+ get resultLinkCount(): number
338
+ get resultReferences(): Array<RequestResultReference>
339
+ toString(): string
340
+ }
341
+
255
342
  export interface CompleteOutcome {
256
343
  kind: string
257
344
  value: any
@@ -260,6 +347,15 @@ export interface CompleteOutcome {
260
347
  location?: string
261
348
  }
262
349
 
350
+ /**
351
+ * Encode one ingestion chunk submission: derive its digest in Rust and bind
352
+ * the announced prefix digest into the exact wire body. `items` are the same
353
+ * batch items the entity's atomic batch route executes; `prefixDigest` is the
354
+ * lowercase SHA-256 of the complete raw source input through the end of this
355
+ * chunk, which `BRegIngestionPrefixDigest` accumulates.
356
+ */
357
+ export declare function encodeIngestionChunk(chunkIndex: number, items: any, prefixDigest: string): BRegIngestionChunk
358
+
263
359
  /** Validated product result serialized before the JavaScript number boundary. */
264
360
  export interface JsonOutcome {
265
361
  kind: string
@@ -1,4 +1,7 @@
1
+ /** An integer for which `Number.isSafeInteger` is true. */
1
2
  export type SafeInteger = number
3
+ /** A string validated as an RFC 9562 UUID by the native binding. */
4
+ export type Uuid = string
2
5
  export type JsonScalar = string | number | boolean | null
3
6
  export type JsonValue = JsonScalar | ReadonlyArray<JsonValue> | { readonly [key: string]: JsonValue }
4
7
  export type JsonObject = { readonly [key: string]: JsonValue }
@@ -13,7 +16,7 @@ export interface CaseworkClientConfig {
13
16
  }
14
17
 
15
18
  export type InboxView = 'mine' | 'my_teams' | 'team_holdings' | 'overdue' | 'completed_by_me'
16
- export type OccurrenceKind = 'review' | 'application' | 'hosted'
19
+ export type OccurrenceKind = 'review' | 'application'
17
20
  export type OccurrenceState = 'open' | 'claimed' | 'waiting_applicant' | 'waiting_application' | 'synchronizing' | 'completed' | 'superseded' | 'cancelled'
18
21
  export type OperationName = string
19
22
  export type AttemptState = 'pending' | 'uncertain' | 'completed' | 'refused'
@@ -21,8 +24,9 @@ export type PageStatus = 'complete' | 'budget_exhausted' | 'source_unavailable'
21
24
  export type HistoryKind = 'observed' | 'opened' | 'claimed' | 'assigned' | 'delegated' | 'caseload_moved' | 'clock_reminder' | 'clock_step_applied' | 'clock_recomputed' | 'released' | 'draft_saved' | 'attempt_reserved' | 'attempt_uncertain' | 'action_completed' | 'attempt_settled' | 'superseded' | 'completed'
22
25
 
23
26
  export interface IssuerPrincipal { issuer: string; subject: string }
24
- export type TaskGrantBounds = { type: 'evidence'; requirement: string } | { type: 'breg'; permissions: ReadonlyArray<TaskPermission> }
27
+ export type TaskGrantBounds = { type: 'evidence'; requirement: string } | { type: 'breg'; permissions: ReadonlyArray<TaskPermission> } | { type: 'scheduling'; permissions: ReadonlyArray<SchedulingTaskPermission> }
25
28
  export interface TaskPermission { collection: string; operations: ReadonlyArray<string> }
29
+ export interface SchedulingTaskPermission { service: string; location: string; actions: ReadonlyArray<string> }
26
30
  export interface EvidenceRequesterContext { requesterTags: ReadonlyArray<string>; audience: string }
27
31
  export interface TaskApprovalRequest { templateId: string; templateVersion: string }
28
32
  export interface TaskTemplatePreview {
@@ -84,7 +88,6 @@ export interface WorkItem {
84
88
  updatedAt: string
85
89
  actions: ReadonlyArray<CaseworkAction>
86
90
  routingCopy?: CorrectionRoutingCopy
87
- hosted?: HostedWorkItemContext
88
91
  routing?: WorkItemRouting
89
92
  clockOccurrences?: ReadonlyArray<ClockOccurrenceView>
90
93
  liveAttempt?: AttemptStatus
@@ -213,85 +216,6 @@ export interface SourcePolicy {
213
216
  description: string
214
217
  requests: ReadonlyArray<SourceRequestPolicy>
215
218
  }
216
- export interface HostedRetentionPolicy { terminalDays: SafeInteger; accountabilityDays: SafeInteger }
217
- export interface HostedOutcomePolicy { id: string; label: string; reasonRequired: boolean }
218
- export interface HostedKindPolicy {
219
- id: string
220
- version: string
221
- queue: string
222
- decidingProfiles: ReadonlyArray<string>
223
- retention: HostedRetentionPolicy
224
- displaySchema: JsonValue
225
- outcomes: ReadonlyArray<HostedOutcomePolicy>
226
- }
227
- export interface HostedWorkItemContext {
228
- requesterReference: string
229
- kind: string
230
- version: string
231
- display: JsonValue
232
- kindPolicyDigest: string
233
- outcomes: ReadonlyArray<HostedOutcomePolicy>
234
- }
235
- export interface HostedCreateRequest { kind: string; requesterReference: string; display: JsonValue }
236
- export interface HostedNoteRequest { note: string }
237
- export interface HostedCancelRequest { reason: string }
238
- export interface HostedDecisionRequest { outcome: string; reason?: string }
239
- export interface RequesterHostedItem {
240
- itemId: string
241
- requesterReference: string
242
- kind: string
243
- version: string
244
- display: JsonValue
245
- state: OccurrenceState
246
- revision: SafeInteger
247
- kindPolicyDigest: string
248
- createdAt: string
249
- updatedAt: string
250
- }
251
- export type HostedTerminalResult = {
252
- itemId: string
253
- eventId: string
254
- requesterReference: string
255
- kindPolicyDigest: string
256
- terminalAt: string
257
- } & (
258
- | { state: 'completed'; outcome: string; actorRef: string }
259
- | { state: 'cancelled'; cancellationReason: string }
260
- )
261
- export interface HostedTerminalQuery { cursor?: string; limit?: SafeInteger }
262
- export interface HostedPageQuery { cursor?: string; limit?: SafeInteger }
263
- export interface HostedNote {
264
- noteId: string
265
- itemId: string
266
- note: string
267
- itemRevision: SafeInteger
268
- recordedAt: string
269
- }
270
- export type HostedHistoryKind = 'created' | 'claimed' | 'assigned' | 'delegated' | 'caseload_moved' | 'released' | 'note_added' | 'completed' | 'cancelled'
271
- export interface HostedHistoryEntry {
272
- eventId: string
273
- itemId: string
274
- itemRevision: SafeInteger
275
- kind: HostedHistoryKind
276
- occurredAt: string
277
- actorRef?: string
278
- assignment?: AssignmentContext
279
- note?: string
280
- outcome?: string
281
- reason?: string
282
- cancellationReason?: string
283
- }
284
- export interface HostedAccountabilityRecord {
285
- itemId: string
286
- eventId: string
287
- actorRef: string
288
- actor: IssuerPrincipal
289
- profileId: string
290
- outcome: string
291
- reason?: string
292
- recordedAt: string
293
- retainedUntil: string
294
- }
295
219
  export interface Description {
296
220
  projectId: string
297
221
  policyVersion: string
@@ -299,7 +223,6 @@ export interface Description {
299
223
  sources: ReadonlyArray<SourcePolicy>
300
224
  calendars: ReadonlyArray<CalendarPolicy>
301
225
  clocks: ReadonlyArray<ClockPolicy>
302
- hostedKinds: ReadonlyArray<HostedKindPolicy>
303
226
  }
304
227
  export interface TeamRecord {
305
228
  id: string
@@ -354,6 +277,11 @@ export type KnownCaseworkProblemCode =
354
277
  | 'request.source-rejected'
355
278
  | 'request.unprocessable'
356
279
  | 'request.unsupported-media-type'
280
+ | 'review.initiator-excluded'
281
+ | 'review.initiator-required'
282
+ | 'review.result-expired'
283
+ | 'review.submission-conflict'
284
+ | 'review.task-not-held'
357
285
  | 'runtime.failure'
358
286
  | 'service.unavailable'
359
287
  | 'source-profile.not-applicable'
@@ -372,6 +300,7 @@ export type KnownCaseworkProblemCode =
372
300
  | 'work-item.source-unavailable'
373
301
  | 'work-item.superseded'
374
302
  export type CaseworkProblemCode = KnownCaseworkProblemCode | (string & {})
303
+ export type CaseworkProtocolFailure = 'header_bounds' | 'trace_context' | 'media_type' | 'body' | 'problem' | 'status' | 'protocol'
375
304
 
376
305
  export class CaseworkClientError extends Error {
377
306
  readonly kind: 'configuration' | 'invalid_request' | 'transport' | 'problem' | 'protocol'
@@ -382,10 +311,10 @@ export class CaseworkClientError extends Error {
382
311
  readonly originalAttemptId?: string
383
312
  readonly validation?: {
384
313
  readonly path: string
385
- readonly reason: 'kind_not_allowed' | 'reference_invalid' | 'object_required' | 'maximum_bytes_exceeded' | 'maximum_depth_exceeded' | 'schema_mismatch' | 'outcome_not_declared' | 'reason_required' | 'text_invalid'
314
+ readonly reason: 'kind_not_allowed' | 'reference_invalid' | 'object_required' | 'maximum_bytes_exceeded' | 'maximum_depth_exceeded' | 'schema_mismatch' | 'outcome_not_declared' | 'reason_required' | 'text_invalid' | 'result_not_declared' | 'result_required' | 'field_not_declared' | 'constraint_invalid' | 'constraint_violated'
386
315
  }
387
316
  readonly transportKind?: string
388
- readonly protocolFailure?: string
317
+ readonly protocolFailure?: CaseworkProtocolFailure
389
318
  }
390
319
 
391
320
  export type ClockRuntimeState = 'running' | 'paused' | 'completed' | 'cancelled' | 'verification_pending' | 'source_facts_missing'
@@ -416,22 +345,157 @@ export interface ClockRecomputePreview { previewId: string; clockId: string; hol
416
345
  export interface ClockRecomputeApplyRequest { previewId: string }
417
346
  export interface ClockRecomputeResult { previewId: string; appliedOccurrences: ReadonlyArray<string> }
418
347
 
348
+ export type ContentDigest = `sha256:${string}`
349
+ export interface ReviewSubjectBinding { source: string; type: string; id: string; version: string; digest: ContentDigest }
350
+ export interface ReviewPolicyBinding { id: string; version: string; digest: ContentDigest }
351
+ export interface HumanIdentity { issuer: string; subject: string }
352
+ export type ReviewContext =
353
+ | { strategy: 'submitted'; snapshot: Readonly<Record<string, JsonValue>> }
354
+ | { strategy: 'source'; binding: { reference: string } }
355
+ export interface ReviewCreateRequest {
356
+ kind: string
357
+ subject: ReviewSubjectBinding
358
+ requesterReference: string
359
+ initiator?: HumanIdentity
360
+ context: ReviewContext
361
+ resultConstraints?: JsonObject | null
362
+ }
363
+ export interface ReviewRequestAccepted {
364
+ requestId: Uuid
365
+ subject: ReviewSubjectBinding
366
+ policy: ReviewPolicyBinding
367
+ submissionDigest: ContentDigest
368
+ }
369
+ export type ReviewRequestLifecycle = 'reviewing' | 'approved' | 'rejected' | 'changes_requested' | 'answered' | 'cancelled' | 'superseded'
370
+ export interface ReviewRequestView extends ReviewRequestAccepted {
371
+ requesterReference: string
372
+ lifecycle: ReviewRequestLifecycle
373
+ activeStage?: string
374
+ createdAt: string
375
+ updatedAt: string
376
+ }
377
+ export type ReviewResultStatus = 'approved' | 'rejected' | 'changes_requested' | 'answered' | 'cancelled' | 'superseded'
378
+ export interface ReviewResult extends ReviewRequestAccepted {
379
+ resultId: Uuid
380
+ status: ReviewResultStatus
381
+ outcome?: string
382
+ result?: JsonObject
383
+ completedAt: string
384
+ availableUntil: string
385
+ }
386
+ export type ReviewResultOutcome =
387
+ | { kind: 'available'; value: ReviewResult; traceId: string }
388
+ | { kind: 'pending' | 'concealed_or_unknown' | 'expired'; value: null; traceId: string }
389
+ export interface ReviewResultFeedEntry { eventId: Uuid; requestId: Uuid; resultId: Uuid; completedAt: string }
390
+ export interface ReviewResultFeedPage { items: ReadonlyArray<ReviewResultFeedEntry>; nextCursor?: Uuid }
391
+ export interface ReviewCancelRequest { subject: ReviewSubjectBinding; reason: string }
392
+ export type ReviewCancelResponse =
393
+ | { outcome: 'cancelled'; result: ReviewResult }
394
+ | { outcome: 'already_terminal'; result: ReviewResult }
395
+ export interface ReviewPageQuery { cursor?: Uuid; limit?: SafeInteger }
396
+ export interface ReviewTaskQuery extends ReviewPageQuery { queue?: string }
397
+ export interface WorkItemHistoryQuery { cursor?: string; limit?: SafeInteger }
398
+ export type ReviewerTaskState = 'open' | { held: { holder: IssuerPrincipal } } | 'decided'
399
+ export interface ReviewerTask {
400
+ taskId: Uuid
401
+ requestId: Uuid
402
+ stageIndex: SafeInteger
403
+ stageId: string
404
+ queue: string
405
+ revision: SafeInteger
406
+ eligibleProfiles: ReadonlyArray<string>
407
+ state: ReviewerTaskState
408
+ decidedByCaller?: boolean
409
+ }
410
+ export interface ReviewTaskPage { items: ReadonlyArray<ReviewerTask>; nextCursor?: Uuid }
411
+ export type ReviewSourceBindingStatus = 'current' | 'binding_changed'
412
+ export interface ReviewSourceProjection { binding: SourceBinding; displayReference?: string; display: Readonly<Record<string, JsonValue>> }
413
+ export type ReviewTaskContextData =
414
+ | { strategy: 'submitted'; snapshot: Readonly<Record<string, JsonValue>> }
415
+ | { strategy: 'source'; reference: string; bindingStatus: ReviewSourceBindingStatus; projection?: ReviewSourceProjection }
416
+ export interface ReviewTaskContext {
417
+ taskId: Uuid
418
+ requestId: Uuid
419
+ subject: ReviewSubjectBinding
420
+ requesterReference: string
421
+ policy: ReviewPolicyBinding
422
+ policySnapshot: ReviewKindPolicySnapshot
423
+ resultConstraints?: JsonObject
424
+ context: ReviewTaskContextData
425
+ }
426
+ export type ReviewClockCorrelation =
427
+ | { scope: 'subject'; source: string; subjectType: string; id: string }
428
+ | { scope: 'activity'; taskId: Uuid; stageId: string }
429
+ export interface ReviewClockOccurrence {
430
+ clockOccurrenceId: Uuid
431
+ clockId: string
432
+ requestId: Uuid
433
+ correlation: ReviewClockCorrelation
434
+ state: 'running' | 'paused' | 'completed' | 'cancelled' | 'source_facts_missing'
435
+ policyDigest: ContentDigest
436
+ anchorAt: string
437
+ dueAt?: string
438
+ atRiskAt?: string
439
+ completedAt?: string
440
+ }
441
+ export interface ReviewTaskDraftInput { body: JsonValue }
442
+ export interface ReviewTaskDraft { taskId: Uuid; author: IssuerPrincipal; body: JsonValue; revision: SafeInteger; updatedAt: string }
443
+ export type ReviewerDecision =
444
+ | { type: 'approve' }
445
+ | { type: 'reject' | 'changes_requested' | 'answer'; outcome: string; reason?: string | null; result?: JsonObject | null }
446
+ export interface ReviewTaskDecisionRequest { decision: ReviewerDecision }
447
+ export type ReviewHistoryAudience = 'reviewers' | 'requester'
448
+ export interface ReviewNoteRequest { audience: ReviewHistoryAudience; note: string }
449
+ export interface ReviewHistoryEntry { eventId: Uuid; requestId: Uuid; taskId?: Uuid; kind: string; actorRef?: string; detail: JsonValue; occurredAt: string }
450
+ export interface ReviewHistoryPage { items: ReadonlyArray<ReviewHistoryEntry>; nextCursor?: Uuid }
451
+ export interface ReviewAccountabilityRecord {
452
+ eventId: Uuid; requestId: Uuid; taskId: Uuid; actorRef: string; actor: IssuerPrincipal
453
+ profileId: string; decision: string; privateReason?: string; resultDigest?: string
454
+ occurredAt: string; retainedUntil: string
455
+ }
456
+ export interface ReviewStagePolicy { id: string; queue: string; decidingProfiles: ReadonlyArray<string>; requiredApprovals: SafeInteger; excludeInitiator?: boolean; excludePreviousStageReviewers?: boolean }
457
+ export interface ReviewRetentionPolicy { terminalDays: SafeInteger; accountabilityDays: SafeInteger }
458
+ export interface ReviewKindPolicySnapshot {
459
+ identity: ReviewPolicyBinding
460
+ purpose: 'approval' | 'answer'
461
+ contextStrategy: 'submitted' | 'source'
462
+ stages: ReadonlyArray<ReviewStagePolicy>
463
+ clocks?: ReadonlyArray<string>
464
+ retention: ReviewRetentionPolicy
465
+ displaySchema: JsonValue
466
+ resultSchema?: JsonValue
467
+ outcomes?: ReadonlyArray<{ id: string; label: string; settlement: 'rejected' | 'changes_requested' | 'answered'; reasonRequired: boolean; resultRequired?: boolean }>
468
+ }
469
+
419
470
  export class CaseworkClient {
420
471
  constructor(config: CaseworkClientConfig)
421
472
  description(token: string, profile: string): Promise<CaseworkOutcome<Description>>
422
- createHostedItem(token: string, profile: string, idempotencyKey: string, request: HostedCreateRequest): Promise<CaseworkOutcome<RequesterHostedItem>>
423
- getHostedItem(token: string, profile: string, itemId: string): Promise<CaseworkOutcome<RequesterHostedItem>>
424
- addHostedNote(token: string, profile: string, itemId: string, expectedRevision: SafeInteger, idempotencyKey: string, note: HostedNoteRequest): Promise<CaseworkOutcome<RequesterHostedItem>>
425
- requesterHostedNotes(token: string, profile: string, itemId: string, query?: HostedPageQuery | null): Promise<CaseworkOutcome<Page<HostedNote>>>
426
- cancelHostedItem(token: string, profile: string, itemId: string, expectedRevision: SafeInteger, idempotencyKey: string, cancellation: HostedCancelRequest): Promise<CaseworkOutcome<HostedTerminalResult>>
427
- hostedTerminalItems(token: string, profile: string, query?: HostedTerminalQuery | null): Promise<CaseworkOutcome<Page<HostedTerminalResult>>>
428
- listHostedWorkItems(token: string, profile: string, query: ListWorkItemsQuery): Promise<CaseworkOutcome<WorkItemPage>>
429
- getHostedWorkItem(token: string, profile: string, itemId: string): Promise<CaseworkOutcome<WorkItem>>
430
- hostedWorkItemHistory(token: string, profile: string, itemId: string, query?: HostedPageQuery | null): Promise<CaseworkOutcome<Page<HostedHistoryEntry>>>
431
- hostedAccountabilityRecord(token: string, profile: string, eventId: string): Promise<CaseworkOutcome<HostedAccountabilityRecord>>
432
- claimHostedWorkItem(token: string, profile: string, action: CaseworkAction, idempotencyKey: string): Promise<CaseworkOutcome<MutationResponse>>
433
- releaseHostedWorkItem(token: string, profile: string, action: CaseworkAction, idempotencyKey: string): Promise<CaseworkOutcome<MutationResponse>>
434
- decideHostedWorkItem(token: string, profile: string, action: CaseworkAction, idempotencyKey: string, decision: HostedDecisionRequest): Promise<CaseworkOutcome<HostedTerminalResult>>
473
+ createOrRecoverReviewRequest(token: string, profile: string, idempotencyKey: string, request: ReviewCreateRequest, expectedSubmissionDigest: ContentDigest): Promise<CaseworkOutcome<ReviewRequestAccepted>>
474
+ reviewRequest(token: string, profile: string, requestId: Uuid): Promise<CaseworkOutcome<ReviewRequestView>>
475
+ reviewResult(token: string, profile: string, accepted: ReviewRequestAccepted): Promise<ReviewResultOutcome>
476
+ reviewResults(token: string, profile: string, query?: ReviewPageQuery | null): Promise<CaseworkOutcome<ReviewResultFeedPage>>
477
+ cancelReviewRequest(token: string, profile: string, accepted: ReviewRequestAccepted, idempotencyKey: string, request: ReviewCancelRequest): Promise<CaseworkOutcome<ReviewCancelResponse>>
478
+ reviewKinds(token: string, profile: string): Promise<CaseworkOutcome<ReadonlyArray<ReviewKindPolicySnapshot>>>
479
+ reviewKind(token: string, profile: string, kindId: string): Promise<CaseworkOutcome<ReviewKindPolicySnapshot>>
480
+ reviewTasks(token: string, profile: string, query?: ReviewTaskQuery | null, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewTaskPage>>
481
+ reviewTask(token: string, profile: string, taskId: Uuid, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewerTask>>
482
+ reviewTaskContext(token: string, profile: string, taskId: Uuid, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewTaskContext>>
483
+ previewReviewTaskTemplates(token: string, profile: string, sourceProfile: string, taskId: Uuid): Promise<CaseworkOutcome<TaskTemplatePreviews>>
484
+ listReviewTaskGrants(token: string, profile: string, sourceProfile: string, taskId: Uuid): Promise<CaseworkOutcome<TaskGrantList>>
485
+ approveReviewTaskGrant(token: string, profile: string, sourceProfile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, approval: TaskApprovalRequest): Promise<CaseworkOutcome<TaskGrantView>>
486
+ revokeReviewTaskGrant(token: string, profile: string, taskId: Uuid, grantId: string): Promise<CaseworkOutcome<TaskGrantRevocation>>
487
+ claimReviewTask(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewerTask>>
488
+ releaseReviewTask(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string): Promise<CaseworkOutcome<ReviewerTask>>
489
+ assignReviewTask(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, request: AssignmentRequest, sourceProfile?: string): Promise<CaseworkOutcome<ReviewerTask>>
490
+ delegateReviewTask(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, request: DelegateRequest, sourceProfile?: string): Promise<CaseworkOutcome<ReviewerTask>>
491
+ reviewTaskDraft(token: string, profile: string, taskId: Uuid, sourceProfile?: string): Promise<CaseworkOutcome<ReviewTaskDraft | null>>
492
+ saveReviewTaskDraft(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, draft: ReviewTaskDraftInput, sourceProfile?: string): Promise<CaseworkOutcome<ReviewTaskDraft>>
493
+ deleteReviewTaskDraft(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, sourceProfile?: string): Promise<CaseworkOutcome<null>>
494
+ decideReviewTask(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, decision: ReviewTaskDecisionRequest, sourceProfile?: string | null): Promise<CaseworkOutcome<null>>
495
+ reviewHistory(token: string, profile: string, requestId: Uuid, query?: ReviewPageQuery | null, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewHistoryPage>>
496
+ addReviewNote(token: string, profile: string, requestId: Uuid, idempotencyKey: string, note: ReviewNoteRequest, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewHistoryEntry>>
497
+ reviewClocks(token: string, profile: string, requestId: Uuid, sourceProfile?: string | null): Promise<CaseworkOutcome<ReadonlyArray<ReviewClockOccurrence>>>
498
+ reviewAccountability(token: string, profile: string, eventId: Uuid): Promise<CaseworkOutcome<ReviewAccountabilityRecord>>
435
499
  listWorkItems(token: string, profile: string, sourceProfile: string, query: ListWorkItemsQuery): Promise<CaseworkOutcome<WorkItemPage>>
436
500
  nextWorkItem(token: string, profile: string, sourceProfile: string, query?: NextWorkItemQuery | null): Promise<CaseworkOutcome<WorkItemPage>>
437
501
  getWorkItem(token: string, profile: string, sourceProfile: string, itemId: string): Promise<CaseworkOutcome<WorkItem>>
@@ -451,7 +515,7 @@ export class CaseworkClient {
451
515
  decideWorkItem(token: string, profile: string, sourceProfile: string, action: CaseworkAction, idempotencyKey: string, decision: DecideRequest): Promise<CaseworkOutcome<MutationResponse>>
452
516
  recoverDecision(token: string, profile: string, sourceProfile: string, itemId: string, attemptId: string, recovery: RecoverAttemptRequest): Promise<CaseworkOutcome<MutationResponse>>
453
517
  recoverDecisionByKey(token: string, profile: string, sourceProfile: string, itemId: string, idempotencyKey: string, recovery: RecoverAttemptRequest): Promise<CaseworkOutcome<MutationResponse>>
454
- workItemHistory(token: string, profile: string, sourceProfile: string, itemId: string, query?: HostedPageQuery | null): Promise<CaseworkOutcome<Page<HistoryEntry>>>
518
+ workItemHistory(token: string, profile: string, sourceProfile: string, itemId: string, query?: WorkItemHistoryQuery | null): Promise<CaseworkOutcome<Page<HistoryEntry>>>
455
519
  holdings(token: string, profile: string, sourceProfile: string, query?: HoldingsQuery | null): Promise<CaseworkOutcome<Page<HoldingSummary>>>
456
520
  directory(token: string, profile: string): Promise<CaseworkOutcome<DirectoryResponse>>
457
521
  directoryTargets(token: string, profile: string, query: DirectoryTargetsQuery): Promise<CaseworkOutcome<DirectoryTargetPage>>
@@ -104,19 +104,32 @@ class CaseworkClient {
104
104
 
105
105
  for (const [method, jsonIndexes] of [
106
106
  ['description', []],
107
- ['createHostedItem', [3]],
108
- ['getHostedItem', []],
109
- ['addHostedNote', [5]],
110
- ['requesterHostedNotes', [3]],
111
- ['cancelHostedItem', [5]],
112
- ['hostedTerminalItems', [2]],
113
- ['listHostedWorkItems', [2]],
114
- ['getHostedWorkItem', []],
115
- ['hostedWorkItemHistory', [3]],
116
- ['hostedAccountabilityRecord', []],
117
- ['claimHostedWorkItem', [2]],
118
- ['releaseHostedWorkItem', [2]],
119
- ['decideHostedWorkItem', [2, 4]],
107
+ ['createOrRecoverReviewRequest', [3]],
108
+ ['reviewRequest', []],
109
+ ['reviewResult', [2]],
110
+ ['reviewResults', [2]],
111
+ ['cancelReviewRequest', [2, 4]],
112
+ ['reviewKinds', []],
113
+ ['reviewKind', []],
114
+ ['reviewTasks', [2]],
115
+ ['reviewTask', []],
116
+ ['reviewTaskContext', []],
117
+ ['previewReviewTaskTemplates', []],
118
+ ['listReviewTaskGrants', []],
119
+ ['approveReviewTaskGrant', [6]],
120
+ ['revokeReviewTaskGrant', []],
121
+ ['claimReviewTask', []],
122
+ ['releaseReviewTask', []],
123
+ ['assignReviewTask', [5]],
124
+ ['delegateReviewTask', [5]],
125
+ ['reviewTaskDraft', []],
126
+ ['saveReviewTaskDraft', [5]],
127
+ ['deleteReviewTaskDraft', []],
128
+ ['decideReviewTask', [5]],
129
+ ['reviewHistory', [3]],
130
+ ['addReviewNote', [4]],
131
+ ['reviewClocks', []],
132
+ ['reviewAccountability', []],
120
133
  ['listWorkItems', [3]],
121
134
  ['nextWorkItem', [3]],
122
135
  ['getWorkItem', []],
@@ -3,19 +3,32 @@
3
3
  export declare class CaseworkClient {
4
4
  constructor(config: CaseworkClientConfig)
5
5
  description(token: string, profile: string): Promise<CaseworkOutcome>
6
- createHostedItem(token: string, profile: string, idempotencyKey: string, request: any): Promise<CaseworkOutcome>
7
- getHostedItem(token: string, profile: string, itemId: string): Promise<CaseworkOutcome>
8
- addHostedNote(token: string, profile: string, itemId: string, expectedRevision: number, idempotencyKey: string, note: any): Promise<CaseworkOutcome>
9
- requesterHostedNotes(token: string, profile: string, itemId: string, query?: any | undefined | null): Promise<CaseworkOutcome>
10
- cancelHostedItem(token: string, profile: string, itemId: string, expectedRevision: number, idempotencyKey: string, cancellation: any): Promise<CaseworkOutcome>
11
- hostedTerminalItems(token: string, profile: string, query?: any | undefined | null): Promise<CaseworkOutcome>
12
- listHostedWorkItems(token: string, profile: string, query: any): Promise<CaseworkOutcome>
13
- getHostedWorkItem(token: string, profile: string, itemId: string): Promise<CaseworkOutcome>
14
- hostedWorkItemHistory(token: string, profile: string, itemId: string, query?: any | undefined | null): Promise<CaseworkOutcome>
15
- hostedAccountabilityRecord(token: string, profile: string, eventId: string): Promise<CaseworkOutcome>
16
- claimHostedWorkItem(token: string, profile: string, action: any, idempotencyKey: string): Promise<CaseworkOutcome>
17
- releaseHostedWorkItem(token: string, profile: string, action: any, idempotencyKey: string): Promise<CaseworkOutcome>
18
- decideHostedWorkItem(token: string, profile: string, action: any, idempotencyKey: string, decision: any): Promise<CaseworkOutcome>
6
+ createOrRecoverReviewRequest(token: string, profile: string, idempotencyKey: string, request: any, expectedSubmissionDigest: string): Promise<CaseworkOutcome>
7
+ reviewRequest(token: string, profile: string, requestId: string): Promise<CaseworkOutcome>
8
+ reviewResult(token: string, profile: string, accepted: any): Promise<CaseworkOutcome>
9
+ reviewResults(token: string, profile: string, query?: any | undefined | null): Promise<CaseworkOutcome>
10
+ cancelReviewRequest(token: string, profile: string, accepted: any, idempotencyKey: string, request: any): Promise<CaseworkOutcome>
11
+ reviewKinds(token: string, profile: string): Promise<CaseworkOutcome>
12
+ reviewKind(token: string, profile: string, kindId: string): Promise<CaseworkOutcome>
13
+ reviewTasks(token: string, profile: string, query?: any | undefined | null, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
14
+ reviewTask(token: string, profile: string, taskId: string, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
15
+ reviewTaskContext(token: string, profile: string, taskId: string, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
16
+ previewReviewTaskTemplates(token: string, profile: string, sourceProfile: string, taskId: string): Promise<CaseworkOutcome>
17
+ listReviewTaskGrants(token: string, profile: string, sourceProfile: string, taskId: string): Promise<CaseworkOutcome>
18
+ approveReviewTaskGrant(token: string, profile: string, sourceProfile: string, taskId: string, expectedRevision: number, idempotencyKey: string, approval: any): Promise<CaseworkOutcome>
19
+ revokeReviewTaskGrant(token: string, profile: string, taskId: string, grantId: string): Promise<CaseworkOutcome>
20
+ claimReviewTask(token: string, profile: string, taskId: string, expectedRevision: number, idempotencyKey: string, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
21
+ releaseReviewTask(token: string, profile: string, taskId: string, expectedRevision: number, idempotencyKey: string): Promise<CaseworkOutcome>
22
+ assignReviewTask(token: string, profile: string, taskId: string, expectedRevision: number, idempotencyKey: string, request: any, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
23
+ delegateReviewTask(token: string, profile: string, taskId: string, expectedRevision: number, idempotencyKey: string, request: any, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
24
+ reviewTaskDraft(token: string, profile: string, taskId: string, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
25
+ saveReviewTaskDraft(token: string, profile: string, taskId: string, expectedRevision: number, idempotencyKey: string, draft: any, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
26
+ deleteReviewTaskDraft(token: string, profile: string, taskId: string, expectedRevision: number, idempotencyKey: string, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
27
+ decideReviewTask(token: string, profile: string, taskId: string, expectedRevision: number, idempotencyKey: string, decision: any, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
28
+ reviewHistory(token: string, profile: string, requestId: string, query?: any | undefined | null, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
29
+ addReviewNote(token: string, profile: string, requestId: string, idempotencyKey: string, note: any, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
30
+ reviewClocks(token: string, profile: string, requestId: string, sourceProfile?: string | undefined | null): Promise<CaseworkOutcome>
31
+ reviewAccountability(token: string, profile: string, eventId: string): Promise<CaseworkOutcome>
19
32
  listWorkItems(token: string, profile: string, sourceProfile: string, query: any): Promise<CaseworkOutcome>
20
33
  nextWorkItem(token: string, profile: string, sourceProfile: string, query?: any | undefined | null): Promise<CaseworkOutcome>
21
34
  getWorkItem(token: string, profile: string, sourceProfile: string, itemId: string): Promise<CaseworkOutcome>
@@ -265,8 +265,8 @@ export declare class SdJwtVcBatchResponse {
265
265
  * selector or disclosed value is copied into it here.
266
266
  */
267
267
  export type SubjectContinuity =
268
- | { status: 'firstUse', receipt: any }
269
- | { status: 'matched', receipt: any }
268
+ | { status: 'firstUse'; receipt: any }
269
+ | { status: 'matched'; receipt: any }
270
270
 
271
271
  /**
272
272
  * A response that satisfied every expectation.
@@ -306,7 +306,7 @@ export interface VerifiedEvidenceRequestBatch {
306
306
  * `{ status: "available", verified } | { status: "notAvailable" }`.
307
307
  */
308
308
  export type VerifiedEvidenceRequestBatchItem =
309
- | { status: 'available', verified: VerifiedEvidence }
309
+ | { status: 'available'; verified: VerifiedEvidence }
310
310
  | { status: 'notAvailable' }
311
311
 
312
312
  /**
package/native.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const PACKAGE_VERSION = '0.32.0';
3
+ const PACKAGE_VERSION = '0.34.0';
4
4
  const PRODUCTS = new Set(['discovery', 'evidence', 'relay', 'breg', 'casework']);
5
5
 
6
6
  function target() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@registrystack/client",
3
- "version": "0.32.0",
3
+ "version": "0.34.0",
4
4
  "description": "Unified Node.js client for Registry Stack products.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.registrystack.org/reference/client-api/",
@@ -57,8 +57,8 @@
57
57
  "typescript": "6.0.3"
58
58
  },
59
59
  "optionalDependencies": {
60
- "@registrystack/client-darwin-arm64": "0.32.0",
61
- "@registrystack/client-linux-arm64-gnu": "0.32.0",
62
- "@registrystack/client-linux-x64-gnu": "0.32.0"
60
+ "@registrystack/client-darwin-arm64": "0.34.0",
61
+ "@registrystack/client-linux-arm64-gnu": "0.34.0",
62
+ "@registrystack/client-linux-x64-gnu": "0.34.0"
63
63
  }
64
64
  }