@registrystack/client 0.31.0 → 0.33.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.
@@ -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,9 @@ export type KnownCaseworkProblemCode =
354
277
  | 'request.source-rejected'
355
278
  | 'request.unprocessable'
356
279
  | 'request.unsupported-media-type'
280
+ | 'review.result-expired'
281
+ | 'review.submission-conflict'
282
+ | 'review.task-not-held'
357
283
  | 'runtime.failure'
358
284
  | 'service.unavailable'
359
285
  | 'source-profile.not-applicable'
@@ -372,6 +298,7 @@ export type KnownCaseworkProblemCode =
372
298
  | 'work-item.source-unavailable'
373
299
  | 'work-item.superseded'
374
300
  export type CaseworkProblemCode = KnownCaseworkProblemCode | (string & {})
301
+ export type CaseworkProtocolFailure = 'header_bounds' | 'trace_context' | 'media_type' | 'body' | 'problem' | 'status' | 'protocol'
375
302
 
376
303
  export class CaseworkClientError extends Error {
377
304
  readonly kind: 'configuration' | 'invalid_request' | 'transport' | 'problem' | 'protocol'
@@ -382,10 +309,10 @@ export class CaseworkClientError extends Error {
382
309
  readonly originalAttemptId?: string
383
310
  readonly validation?: {
384
311
  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'
312
+ 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
313
  }
387
314
  readonly transportKind?: string
388
- readonly protocolFailure?: string
315
+ readonly protocolFailure?: CaseworkProtocolFailure
389
316
  }
390
317
 
391
318
  export type ClockRuntimeState = 'running' | 'paused' | 'completed' | 'cancelled' | 'verification_pending' | 'source_facts_missing'
@@ -416,22 +343,156 @@ export interface ClockRecomputePreview { previewId: string; clockId: string; hol
416
343
  export interface ClockRecomputeApplyRequest { previewId: string }
417
344
  export interface ClockRecomputeResult { previewId: string; appliedOccurrences: ReadonlyArray<string> }
418
345
 
346
+ export type ContentDigest = `sha256:${string}`
347
+ export interface ReviewSubjectBinding { source: string; type: string; id: string; version: string; digest: ContentDigest }
348
+ export interface ReviewPolicyBinding { id: string; version: string; digest: ContentDigest }
349
+ export interface HumanIdentity { issuer: string; subject: string }
350
+ export type ReviewContext =
351
+ | { strategy: 'submitted'; snapshot: Readonly<Record<string, JsonValue>> }
352
+ | { strategy: 'source'; binding: { reference: string } }
353
+ export interface ReviewCreateRequest {
354
+ kind: string
355
+ subject: ReviewSubjectBinding
356
+ requesterReference: string
357
+ initiator?: HumanIdentity
358
+ context: ReviewContext
359
+ resultConstraints?: JsonObject | null
360
+ }
361
+ export interface ReviewRequestAccepted {
362
+ requestId: Uuid
363
+ subject: ReviewSubjectBinding
364
+ policy: ReviewPolicyBinding
365
+ submissionDigest: ContentDigest
366
+ }
367
+ export type ReviewRequestLifecycle = 'reviewing' | 'approved' | 'rejected' | 'changes_requested' | 'answered' | 'cancelled' | 'superseded'
368
+ export interface ReviewRequestView extends ReviewRequestAccepted {
369
+ requesterReference: string
370
+ lifecycle: ReviewRequestLifecycle
371
+ activeStage?: string
372
+ createdAt: string
373
+ updatedAt: string
374
+ }
375
+ export type ReviewResultStatus = 'approved' | 'rejected' | 'changes_requested' | 'answered' | 'cancelled' | 'superseded'
376
+ export interface ReviewResult extends ReviewRequestAccepted {
377
+ resultId: Uuid
378
+ status: ReviewResultStatus
379
+ outcome?: string
380
+ result?: JsonObject
381
+ completedAt: string
382
+ availableUntil: string
383
+ }
384
+ export type ReviewResultOutcome =
385
+ | { kind: 'available'; value: ReviewResult; traceId: string }
386
+ | { kind: 'pending' | 'concealed_or_unknown' | 'expired'; value: null; traceId: string }
387
+ export interface ReviewResultFeedEntry { eventId: Uuid; requestId: Uuid; resultId: Uuid; completedAt: string }
388
+ export interface ReviewResultFeedPage { items: ReadonlyArray<ReviewResultFeedEntry>; nextCursor?: Uuid }
389
+ export interface ReviewCancelRequest { subject: ReviewSubjectBinding; reason: string }
390
+ export type ReviewCancelResponse =
391
+ | { outcome: 'cancelled'; result: ReviewResult }
392
+ | { outcome: 'already_terminal'; result: ReviewResult }
393
+ export interface ReviewPageQuery { cursor?: Uuid; limit?: SafeInteger }
394
+ export interface ReviewTaskQuery extends ReviewPageQuery { queue?: string }
395
+ export interface WorkItemHistoryQuery { cursor?: string; limit?: SafeInteger }
396
+ export type ReviewerTaskState = 'open' | { held: { holder: IssuerPrincipal } } | 'decided'
397
+ export interface ReviewerTask {
398
+ taskId: Uuid
399
+ requestId: Uuid
400
+ stageIndex: SafeInteger
401
+ stageId: string
402
+ queue: string
403
+ revision: SafeInteger
404
+ eligibleProfiles: ReadonlyArray<string>
405
+ state: ReviewerTaskState
406
+ }
407
+ export interface ReviewTaskPage { items: ReadonlyArray<ReviewerTask>; nextCursor?: Uuid }
408
+ export type ReviewSourceBindingStatus = 'current' | 'binding_changed'
409
+ export interface ReviewSourceProjection { binding: SourceBinding; displayReference?: string; display: Readonly<Record<string, JsonValue>> }
410
+ export type ReviewTaskContextData =
411
+ | { strategy: 'submitted'; snapshot: Readonly<Record<string, JsonValue>> }
412
+ | { strategy: 'source'; reference: string; bindingStatus: ReviewSourceBindingStatus; projection?: ReviewSourceProjection }
413
+ export interface ReviewTaskContext {
414
+ taskId: Uuid
415
+ requestId: Uuid
416
+ subject: ReviewSubjectBinding
417
+ requesterReference: string
418
+ policy: ReviewPolicyBinding
419
+ policySnapshot: ReviewKindPolicySnapshot
420
+ resultConstraints?: JsonObject
421
+ context: ReviewTaskContextData
422
+ }
423
+ export type ReviewClockCorrelation =
424
+ | { scope: 'subject'; source: string; subjectType: string; id: string }
425
+ | { scope: 'activity'; taskId: Uuid; stageId: string }
426
+ export interface ReviewClockOccurrence {
427
+ clockOccurrenceId: Uuid
428
+ clockId: string
429
+ requestId: Uuid
430
+ correlation: ReviewClockCorrelation
431
+ state: 'running' | 'paused' | 'completed' | 'cancelled' | 'source_facts_missing'
432
+ policyDigest: ContentDigest
433
+ anchorAt: string
434
+ dueAt?: string
435
+ atRiskAt?: string
436
+ completedAt?: string
437
+ }
438
+ export interface ReviewTaskDraftInput { body: JsonValue }
439
+ export interface ReviewTaskDraft { taskId: Uuid; author: IssuerPrincipal; body: JsonValue; revision: SafeInteger; updatedAt: string }
440
+ export type ReviewerDecision =
441
+ | { type: 'approve' }
442
+ | { type: 'reject' | 'changes_requested' | 'answer'; outcome: string; reason?: string | null; result?: JsonObject | null }
443
+ export interface ReviewTaskDecisionRequest { decision: ReviewerDecision }
444
+ export type ReviewHistoryAudience = 'reviewers' | 'requester'
445
+ export interface ReviewNoteRequest { audience: ReviewHistoryAudience; note: string }
446
+ export interface ReviewHistoryEntry { eventId: Uuid; requestId: Uuid; taskId?: Uuid; kind: string; actorRef?: string; detail: JsonValue; occurredAt: string }
447
+ export interface ReviewHistoryPage { items: ReadonlyArray<ReviewHistoryEntry>; nextCursor?: Uuid }
448
+ export interface ReviewAccountabilityRecord {
449
+ eventId: Uuid; requestId: Uuid; taskId: Uuid; actorRef: string; actor: IssuerPrincipal
450
+ profileId: string; decision: string; privateReason?: string; resultDigest?: string
451
+ occurredAt: string; retainedUntil: string
452
+ }
453
+ export interface ReviewStagePolicy { id: string; queue: string; decidingProfiles: ReadonlyArray<string>; requiredApprovals: SafeInteger; excludeInitiator?: boolean; excludePreviousStageReviewers?: boolean }
454
+ export interface ReviewRetentionPolicy { terminalDays: SafeInteger; accountabilityDays: SafeInteger }
455
+ export interface ReviewKindPolicySnapshot {
456
+ identity: ReviewPolicyBinding
457
+ purpose: 'approval' | 'answer'
458
+ contextStrategy: 'submitted' | 'source'
459
+ stages: ReadonlyArray<ReviewStagePolicy>
460
+ clocks?: ReadonlyArray<string>
461
+ retention: ReviewRetentionPolicy
462
+ displaySchema: JsonValue
463
+ resultSchema?: JsonValue
464
+ outcomes?: ReadonlyArray<{ id: string; label: string; settlement: 'rejected' | 'changes_requested' | 'answered'; reasonRequired: boolean; resultRequired?: boolean }>
465
+ }
466
+
419
467
  export class CaseworkClient {
420
468
  constructor(config: CaseworkClientConfig)
421
469
  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>>
470
+ createOrRecoverReviewRequest(token: string, profile: string, idempotencyKey: string, request: ReviewCreateRequest, expectedSubmissionDigest: ContentDigest): Promise<CaseworkOutcome<ReviewRequestAccepted>>
471
+ reviewRequest(token: string, profile: string, requestId: Uuid): Promise<CaseworkOutcome<ReviewRequestView>>
472
+ reviewResult(token: string, profile: string, accepted: ReviewRequestAccepted): Promise<ReviewResultOutcome>
473
+ reviewResults(token: string, profile: string, query?: ReviewPageQuery | null): Promise<CaseworkOutcome<ReviewResultFeedPage>>
474
+ cancelReviewRequest(token: string, profile: string, accepted: ReviewRequestAccepted, idempotencyKey: string, request: ReviewCancelRequest): Promise<CaseworkOutcome<ReviewCancelResponse>>
475
+ reviewKinds(token: string, profile: string): Promise<CaseworkOutcome<ReadonlyArray<ReviewKindPolicySnapshot>>>
476
+ reviewKind(token: string, profile: string, kindId: string): Promise<CaseworkOutcome<ReviewKindPolicySnapshot>>
477
+ reviewTasks(token: string, profile: string, query?: ReviewTaskQuery | null, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewTaskPage>>
478
+ reviewTask(token: string, profile: string, taskId: Uuid, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewerTask>>
479
+ reviewTaskContext(token: string, profile: string, taskId: Uuid, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewTaskContext>>
480
+ previewReviewTaskTemplates(token: string, profile: string, sourceProfile: string, taskId: Uuid): Promise<CaseworkOutcome<TaskTemplatePreviews>>
481
+ listReviewTaskGrants(token: string, profile: string, sourceProfile: string, taskId: Uuid): Promise<CaseworkOutcome<TaskGrantList>>
482
+ approveReviewTaskGrant(token: string, profile: string, sourceProfile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, approval: TaskApprovalRequest): Promise<CaseworkOutcome<TaskGrantView>>
483
+ revokeReviewTaskGrant(token: string, profile: string, taskId: Uuid, grantId: string): Promise<CaseworkOutcome<TaskGrantRevocation>>
484
+ claimReviewTask(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewerTask>>
485
+ releaseReviewTask(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string): Promise<CaseworkOutcome<ReviewerTask>>
486
+ assignReviewTask(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, request: AssignmentRequest, sourceProfile?: string): Promise<CaseworkOutcome<ReviewerTask>>
487
+ delegateReviewTask(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, request: DelegateRequest, sourceProfile?: string): Promise<CaseworkOutcome<ReviewerTask>>
488
+ reviewTaskDraft(token: string, profile: string, taskId: Uuid, sourceProfile?: string): Promise<CaseworkOutcome<ReviewTaskDraft | null>>
489
+ saveReviewTaskDraft(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, draft: ReviewTaskDraftInput, sourceProfile?: string): Promise<CaseworkOutcome<ReviewTaskDraft>>
490
+ deleteReviewTaskDraft(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, sourceProfile?: string): Promise<CaseworkOutcome<null>>
491
+ decideReviewTask(token: string, profile: string, taskId: Uuid, expectedRevision: SafeInteger, idempotencyKey: string, decision: ReviewTaskDecisionRequest, sourceProfile?: string | null): Promise<CaseworkOutcome<null>>
492
+ reviewHistory(token: string, profile: string, requestId: Uuid, query?: ReviewPageQuery | null, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewHistoryPage>>
493
+ addReviewNote(token: string, profile: string, requestId: Uuid, idempotencyKey: string, note: ReviewNoteRequest, sourceProfile?: string | null): Promise<CaseworkOutcome<ReviewHistoryEntry>>
494
+ reviewClocks(token: string, profile: string, requestId: Uuid, sourceProfile?: string | null): Promise<CaseworkOutcome<ReadonlyArray<ReviewClockOccurrence>>>
495
+ reviewAccountability(token: string, profile: string, eventId: Uuid): Promise<CaseworkOutcome<ReviewAccountabilityRecord>>
435
496
  listWorkItems(token: string, profile: string, sourceProfile: string, query: ListWorkItemsQuery): Promise<CaseworkOutcome<WorkItemPage>>
436
497
  nextWorkItem(token: string, profile: string, sourceProfile: string, query?: NextWorkItemQuery | null): Promise<CaseworkOutcome<WorkItemPage>>
437
498
  getWorkItem(token: string, profile: string, sourceProfile: string, itemId: string): Promise<CaseworkOutcome<WorkItem>>
@@ -440,6 +501,8 @@ export class CaseworkClient {
440
501
  approveTaskGrant(token: string, profile: string, sourceProfile: string, itemId: string, expectedRevision: SafeInteger, idempotencyKey: string, approval: TaskApprovalRequest): Promise<CaseworkOutcome<TaskGrantView>>
441
502
  revokeTaskGrant(token: string, profile: string, sourceProfile: string, itemId: string, grantId: string): Promise<CaseworkOutcome<TaskGrantRevocation>>
442
503
  taskAssertion(token: string, grantId: string): Promise<CaseworkOutcome<TaskAssertionResponse>>
504
+ /** Exact empty-POST authority route for the shared remote exchange provider. */
505
+ taskAssertionEndpoint(grantId: string): string
443
506
  taskGrantStatus(token: string, grantId: string): Promise<CaseworkOutcome<TaskGrantStatus>>
444
507
  claimWorkItem(token: string, profile: string, sourceProfile: string, action: CaseworkAction, idempotencyKey: string): Promise<CaseworkOutcome<MutationResponse>>
445
508
  releaseWorkItem(token: string, profile: string, sourceProfile: string, action: CaseworkAction, idempotencyKey: string): Promise<CaseworkOutcome<MutationResponse>>
@@ -449,7 +512,7 @@ export class CaseworkClient {
449
512
  decideWorkItem(token: string, profile: string, sourceProfile: string, action: CaseworkAction, idempotencyKey: string, decision: DecideRequest): Promise<CaseworkOutcome<MutationResponse>>
450
513
  recoverDecision(token: string, profile: string, sourceProfile: string, itemId: string, attemptId: string, recovery: RecoverAttemptRequest): Promise<CaseworkOutcome<MutationResponse>>
451
514
  recoverDecisionByKey(token: string, profile: string, sourceProfile: string, itemId: string, idempotencyKey: string, recovery: RecoverAttemptRequest): Promise<CaseworkOutcome<MutationResponse>>
452
- workItemHistory(token: string, profile: string, sourceProfile: string, itemId: string, query?: HostedPageQuery | null): Promise<CaseworkOutcome<Page<HistoryEntry>>>
515
+ workItemHistory(token: string, profile: string, sourceProfile: string, itemId: string, query?: WorkItemHistoryQuery | null): Promise<CaseworkOutcome<Page<HistoryEntry>>>
453
516
  holdings(token: string, profile: string, sourceProfile: string, query?: HoldingsQuery | null): Promise<CaseworkOutcome<Page<HoldingSummary>>>
454
517
  directory(token: string, profile: string): Promise<CaseworkOutcome<DirectoryResponse>>
455
518
  directoryTargets(token: string, profile: string, query: DirectoryTargetsQuery): Promise<CaseworkOutcome<DirectoryTargetPage>>
@@ -92,23 +92,44 @@ class CaseworkClient {
92
92
  throw normalized(error, 'configuration');
93
93
  }
94
94
  }
95
+
96
+ taskAssertionEndpoint(grantId) {
97
+ try {
98
+ return this.native.taskAssertionEndpoint(grantId);
99
+ } catch (error) {
100
+ throw normalized(error, 'invalid_request');
101
+ }
102
+ }
95
103
  }
96
104
 
97
105
  for (const [method, jsonIndexes] of [
98
106
  ['description', []],
99
- ['createHostedItem', [3]],
100
- ['getHostedItem', []],
101
- ['addHostedNote', [5]],
102
- ['requesterHostedNotes', [3]],
103
- ['cancelHostedItem', [5]],
104
- ['hostedTerminalItems', [2]],
105
- ['listHostedWorkItems', [2]],
106
- ['getHostedWorkItem', []],
107
- ['hostedWorkItemHistory', [3]],
108
- ['hostedAccountabilityRecord', []],
109
- ['claimHostedWorkItem', [2]],
110
- ['releaseHostedWorkItem', [2]],
111
- ['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', []],
112
133
  ['listWorkItems', [3]],
113
134
  ['nextWorkItem', [3]],
114
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>
@@ -24,6 +37,7 @@ export declare class CaseworkClient {
24
37
  approveTaskGrant(token: string, profile: string, sourceProfile: string, itemId: string, expectedRevision: number, idempotencyKey: string, approval: any): Promise<CaseworkOutcome>
25
38
  revokeTaskGrant(token: string, profile: string, sourceProfile: string, itemId: string, grantId: string): Promise<CaseworkOutcome>
26
39
  taskAssertion(token: string, grantId: string): Promise<CaseworkOutcome>
40
+ taskAssertionEndpoint(grantId: string): string
27
41
  taskGrantStatus(token: string, grantId: string): Promise<CaseworkOutcome>
28
42
  claimWorkItem(token: string, profile: string, sourceProfile: string, action: any, idempotencyKey: string): Promise<CaseworkOutcome>
29
43
  releaseWorkItem(token: string, profile: string, sourceProfile: string, action: any, idempotencyKey: string): Promise<CaseworkOutcome>
@@ -35,6 +35,8 @@ export interface ProgressiveVerifiedResult {
35
35
  readonly values: Readonly<Record<string, unknown>>
36
36
  readonly value: unknown
37
37
  readonly subjectContinuity: ProgressiveSubjectContinuity
38
+ /** Pre-response trust and policy snapshot. Retain with the exact artifact. */
39
+ readonly retainedVerification: Buffer
38
40
  }
39
41
 
40
42
  /** A signed-JWS result. The credential member of the native result is `null`. */
@@ -116,12 +118,91 @@ export type EvidenceTokenConfig =
116
118
  | { static: string }
117
119
  | { privateKeyJwt: PrivateKeyJwtConfig }
118
120
 
121
+ /** A verified actor/grant generation with a bounded authorization lifetime. */
122
+ export interface EvidenceExchangeContext {
123
+ issuer: string
124
+ subject: string
125
+ audience: string
126
+ generation: string
127
+ deadlineSeconds: number
128
+ grantId?: string
129
+ }
130
+
131
+ /**
132
+ * The client half of an exchange authorization.
133
+ *
134
+ * This is not a `PrivateKeyJwtConfig`, even though the two describe the same
135
+ * kind of client: an exchange is pinned to one resource and scope set, so both
136
+ * are required here, and the object is read by the shared exchange
137
+ * configuration parser rather than by the binding's own reader, so its timeout
138
+ * members are the full-word ones that parser accepts. State at most one of
139
+ * `requestTimeoutMilliseconds` and `requestTimeoutSeconds`, and at most one of
140
+ * `connectTimeoutMilliseconds` and `connectTimeoutSeconds`; naming both of a
141
+ * pair is refused.
142
+ */
143
+ export interface EvidenceExchangeClientConfig {
144
+ tokenEndpoint: string
145
+ clientId: string
146
+ /** The client's private key, as a JWK. */
147
+ clientKey: Readonly<Record<string, unknown>>
148
+ /**
149
+ * The audience of the client assertion, when the authorization server
150
+ * expects something other than its own token endpoint.
151
+ */
152
+ audience?: string
153
+ /**
154
+ * The RFC 8707 resource indicator the token is requested for: the resource
155
+ * server's registered identifier, not a URL to fetch.
156
+ */
157
+ resource: string
158
+ /**
159
+ * The scopes requested for the token, sent as one space-delimited `scope`
160
+ * parameter. A requested scope may narrow the client's registered
161
+ * permission set; it can never widen it.
162
+ */
163
+ scopes: ReadonlyArray<string>
164
+ assertionLifetimeSeconds?: number
165
+ refreshMarginSeconds?: number
166
+ requestTimeoutMilliseconds?: number
167
+ requestTimeoutSeconds?: number
168
+ connectTimeoutMilliseconds?: number
169
+ connectTimeoutSeconds?: number
170
+ userAgent?: string
171
+ /** Additional trust roots for the token endpoint, as a PEM bundle. */
172
+ trustedRootCertificates?: string
173
+ }
174
+
175
+ /** The owning authority a remote-sourced exchange obtains assertions from. */
176
+ export interface EvidenceExchangeRemoteSourceConfig {
177
+ endpoint: string
178
+ bootstrap: EvidenceExchangeClientConfig
179
+ bootstrapResource: string
180
+ bootstrapScope: string
181
+ requestTimeoutMilliseconds?: number
182
+ requestTimeoutSeconds?: number
183
+ connectTimeoutMilliseconds?: number
184
+ connectTimeoutSeconds?: number
185
+ userAgent?: string
186
+ /** Additional trust roots for the authority, as a PEM bundle. */
187
+ trustedRootCertificates?: string
188
+ }
189
+
190
+ export type EvidenceExchangeAuthorizationConfig = {
191
+ client: EvidenceExchangeClientConfig
192
+ context: EvidenceExchangeContext
193
+ } & (
194
+ | { firstParty: { key: Readonly<Record<string, unknown>>, attributes: Readonly<Record<string, unknown>> }, remote?: never }
195
+ | { firstParty?: never, remote: EvidenceExchangeRemoteSourceConfig }
196
+ )
197
+
119
198
  /** The configuration `new EvidenceClient(...)` reads. */
120
199
  export interface EvidenceClientConfig {
121
200
  baseUrl: string
122
201
  trustedJwks: TrustedJwks
123
202
  revokedKeyIds: ReadonlyArray<string>
124
- token: EvidenceTokenConfig
203
+ /** Configure exactly one of `token` or `authorization`. */
204
+ token?: EvidenceTokenConfig
205
+ authorization?: { exchange: EvidenceExchangeAuthorizationConfig }
125
206
  requestTimeoutMs?: number
126
207
  connectTimeoutMs?: number
127
208
  userAgent?: string
@@ -152,6 +233,10 @@ export declare class EvidenceClient extends NativeEvidenceClient {
152
233
  * the JavaScript wrapper.
153
234
  */
154
235
  static fromProfile(path: string, privateKeyJwk?: Readonly<Record<string, unknown>>): EvidenceClient
236
+ static fromProfileWithAuthorization(
237
+ path: string,
238
+ authorization: { exchange: EvidenceExchangeAuthorizationConfig },
239
+ ): EvidenceClient
155
240
  }
156
241
 
157
242
  /**
@@ -166,6 +166,7 @@ for (const name of [
166
166
  'values',
167
167
  'value',
168
168
  'subjectContinuity',
169
+ 'retainedVerification',
169
170
  ]) {
170
171
  wrapGetter(native.AudienceScopedResult.prototype, name);
171
172
  }
@@ -215,6 +216,16 @@ class EvidenceClient extends native.EvidenceClient {
215
216
  throw normalize(error);
216
217
  }
217
218
  }
219
+
220
+ static fromProfileWithAuthorization(path, authorization) {
221
+ try {
222
+ const client = native.EvidenceClient.fromProfileWithAuthorization(path, authorization);
223
+ Object.setPrototypeOf(client, this.prototype);
224
+ return client;
225
+ } catch (error) {
226
+ throw normalize(error);
227
+ }
228
+ }
218
229
  }
219
230
 
220
231
  class SdJwtVcBatchResponse extends native.SdJwtVcBatchResponse {
@@ -236,4 +247,18 @@ module.exports = {
236
247
  RawEvidenceRequestBatchResponse: native.RawEvidenceRequestBatchResponse,
237
248
  AudienceScopedResult: native.AudienceScopedResult,
238
249
  SdJwtVcBatchResponse,
250
+ verifyRetained(context, response) {
251
+ try {
252
+ return native.verifyRetained(context, response);
253
+ } catch (error) {
254
+ throw normalize(error);
255
+ }
256
+ },
257
+ verifyRetainedAsOf(context, response, asOfMillis) {
258
+ try {
259
+ return native.verifyRetainedAsOf(context, response, asOfMillis);
260
+ } catch (error) {
261
+ throw normalize(error);
262
+ }
263
+ },
239
264
  };