@happyvertical/smrt-sales 0.40.0 → 0.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/AGENTS.md +14 -6
  2. package/dist/agreements/collections/AgreementExecutionCollection.d.ts +106 -0
  3. package/dist/agreements/collections/AgreementExecutionCollection.d.ts.map +1 -0
  4. package/dist/agreements/collections/AgreementExecutionEventCollection.d.ts +16 -0
  5. package/dist/agreements/collections/AgreementExecutionEventCollection.d.ts.map +1 -0
  6. package/dist/agreements/collections/ExecutedAgreementCollection.d.ts +17 -0
  7. package/dist/agreements/collections/ExecutedAgreementCollection.d.ts.map +1 -0
  8. package/dist/agreements/index.d.ts +18 -0
  9. package/dist/agreements/index.d.ts.map +1 -0
  10. package/dist/agreements/models/AgreementExecution.d.ts +66 -0
  11. package/dist/agreements/models/AgreementExecution.d.ts.map +1 -0
  12. package/dist/agreements/models/AgreementExecutionEvent.d.ts +25 -0
  13. package/dist/agreements/models/AgreementExecutionEvent.d.ts.map +1 -0
  14. package/dist/agreements/models/ExecutedAgreement.d.ts +35 -0
  15. package/dist/agreements/models/ExecutedAgreement.d.ts.map +1 -0
  16. package/dist/agreements/services/AgreementExecutionService.d.ts +85 -0
  17. package/dist/agreements/services/AgreementExecutionService.d.ts.map +1 -0
  18. package/dist/agreements/types.d.ts +140 -0
  19. package/dist/agreements/types.d.ts.map +1 -0
  20. package/dist/agreements.d.ts +2 -0
  21. package/dist/agreements.d.ts.map +1 -0
  22. package/dist/agreements.js +3 -0
  23. package/dist/chunks/__smrt-register__-Cwn1Fb4I.js +6 -0
  24. package/dist/chunks/{__smrt-register__-DGR1u9K2.js.map → __smrt-register__-Cwn1Fb4I.js.map} +1 -1
  25. package/dist/chunks/agreements-DbzW1Pcq.js +1640 -0
  26. package/dist/chunks/agreements-DbzW1Pcq.js.map +1 -0
  27. package/dist/chunks/{referrals-CzkrPeKv.js → referrals-cYYg4YZw.js} +163 -40
  28. package/dist/chunks/referrals-cYYg4YZw.js.map +1 -0
  29. package/dist/commissions.js +1 -1
  30. package/dist/crm.js +1 -1
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +4 -3
  34. package/dist/manifest.json +1853 -99
  35. package/dist/referrals/collections/ReferralAgreementCollection.d.ts +0 -4
  36. package/dist/referrals/collections/ReferralAgreementCollection.d.ts.map +1 -1
  37. package/dist/referrals/index.d.ts +1 -0
  38. package/dist/referrals/index.d.ts.map +1 -1
  39. package/dist/referrals/models/ReferralAgreement.d.ts +8 -19
  40. package/dist/referrals/models/ReferralAgreement.d.ts.map +1 -1
  41. package/dist/referrals/services/ReferralAgreementExecutionService.d.ts +55 -0
  42. package/dist/referrals/services/ReferralAgreementExecutionService.d.ts.map +1 -0
  43. package/dist/referrals/types.d.ts +2 -4
  44. package/dist/referrals/types.d.ts.map +1 -1
  45. package/dist/referrals.js +3 -3
  46. package/dist/smrt-knowledge.json +780 -33
  47. package/dist/svelte/components/ExecutedAgreementsList.svelte +36 -10
  48. package/dist/svelte/components/ExecutedAgreementsList.svelte.d.ts +2 -0
  49. package/dist/svelte/components/ExecutedAgreementsList.svelte.d.ts.map +1 -1
  50. package/dist/svelte/types.d.ts +7 -3
  51. package/dist/svelte/types.d.ts.map +1 -1
  52. package/package.json +13 -7
  53. package/dist/chunks/__smrt-register__-DGR1u9K2.js +0 -6
  54. package/dist/chunks/referrals-CzkrPeKv.js.map +0 -1
package/AGENTS.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # @happyvertical/smrt-sales
2
2
 
3
- Modular sales: CRM (Leads, Opportunities, Pipelines), referral intake with versioned attribution policies, a neutral commissions financial core with immutable term snapshots, and reusable Svelte surfaces. One installable package, four modules with distinct subpath exports:
3
+ Modular sales: provider-neutral agreement execution, CRM, referral intake, a neutral commissions financial core, and reusable Svelte surfaces. One installable package with distinct subpath exports:
4
4
 
5
+ - `@happyvertical/smrt-sales/agreements`
5
6
  - `@happyvertical/smrt-sales/crm`
6
7
  - `@happyvertical/smrt-sales/referrals`
7
8
  - `@happyvertical/smrt-sales/commissions`
8
9
  - `@happyvertical/smrt-sales/svelte`
9
10
 
10
- The root export re-exports every TS module. Internal module dependency order is `crm commissions` and `referrals commissions` (by string references only); `commissions` never imports from `crm`/`referrals` and never assumes advertising, Referral, Lead, or Opportunity semantics.
11
+ The root export re-exports every TS module. `agreements` depends on the provider-neutral `@happyvertical/signatures` contract and `smrt-assets`; provider credentials stay in the injected SDK adapter/secret store. `referrals` binds its versioned terms to `agreements`.
11
12
 
12
13
  ## Validation
13
14
 
@@ -22,6 +23,13 @@ Referrers and Sales Representatives are **distinct roles** and stay that way. Bo
22
23
 
23
24
  ## Modules
24
25
 
26
+ ### agreements — verified execution evidence
27
+
28
+ - **AgreementExecution**: private required-tenant orchestration state keyed by `(tenant_id, idempotency_key)`, with a collision-checked provider request/status, an expiring create-operation lease, source version/hash/size/Asset, intended signer identity/auth method, cancellation/expiry, reconciliation, exact staged artifact metadata, and secret-store references only.
29
+ - **AgreementExecutionEvent**: private append-only evidence for verified webhooks and operator/provider operations. Provider events are deduped by tenant/provider replay key; explicit occurrence/first-receipt timestamps and the exact payload/hash are retained, while signature headers are never stored. A later receipt time for the same verified provider event is an idempotent replay. Stale, regressive, or conflicting terminal events are audited without regressing lifecycle state or creating executed evidence.
30
+ - **ExecutedAgreement**: immutable read-only source version plus signed-document and audit-trail Asset ids/hashes/sizes/filenames/media types, completed signer evidence, acceptance/effective dates, and supersession reference. Amendments create new records.
31
+ - **AgreementExecutionService**: accepts an SDK `SignatureProvider` and shared `AssetRuntimeLike`; enforces ambient tenant equality, expiring remote-attempt fencing, create idempotency, verified webhook ingestion/replay, tenant-fenced lifecycle compare-and-set with monotonic provider-event ordering, partial audit/failure updates that cannot overwrite lifecycle state, cancellation/expiry/reconciliation, exact artifact hashing, and immutable finalization. An expired create lease may be reclaimed only when the provider advertises atomic idempotency; otherwise a create with no confirmed request id must be reconciled/adopted before retry.
32
+
25
33
  ### commissions — neutral financial core
26
34
 
27
35
  - **Earner**: `profileId`, `status` (`pending|active|suspended`), `payoutMethod` (`bank_transfer|check|paypal|credit|other`), `payoutThresholdCents`, `payoutScheduleKey` (open string: `manual`, `monthly`, …), `currency`, `metadata`.
@@ -53,9 +61,9 @@ Referrers and Sales Representatives are **distinct roles** and stay that way. Bo
53
61
  - **ReferralTouch**: immutable attribution evidence (`click|code_entry|manual_assignment|partner_entry`) with subject hints and evidence JSON.
54
62
  - **Referral**: the introduction — generic qualifying target (`targetKind`/`targetId`: lead, opportunity, client, project, subscription, …), resolved policy version, credit fraction (splits create sibling Referrals sharing `splitGroupId`), lifecycle `pending → attributed → qualified | disqualified | expired | under_review`.
55
63
  - **AttributionException**: conflict review queue. Conclusive policy resolves automatically; ambiguity creates an exception; overrides require a `resolutionReason` and are audited.
56
- - **ReferralAgreement**: versioned per-Referrer terms binding — pins `commissionPlanKey`/`planVersion`, effective dating, optional cross-package string refs to a commerce Contract and executed-artifact evidence (e-signature execution lives downstream).
64
+ - **ReferralAgreement**: versioned per-Referrer terms binding — pins `commissionPlanKey`/`planVersion`, effective dating, and an immutable `ExecutedAgreement` before activation. Amendments are fresh unsigned drafts and never inherit execution evidence.
57
65
  - **ReferralTermSnapshot**: immutable at qualification — freezes agreement/plan/policy version refs plus the calculation inputs needed to reproduce every later earning.
58
- - **Services**: `AttributionService` (resolve touches Referral(s) or exception; typed refusals `existing_client_ineligible | no_active_policy | no_eligible_touches`; `override()` requires a reason, audits via a resolved AttributionException, pins the displaced credit's policy version, and throws `QualifiedReferralOverrideError` on qualified referrals), `ReferralQualificationService` (eligibility + frozen snapshot + transition; `requalify()` is the explicit apply-amendment path), `ReferralCommissionService` (bridge: qualified Referral + EarningEvent → Commissions through the snapshot with `termsSnapshotKind = REFERRAL_TERMS_SNAPSHOT_KIND`; occurrence limits counted per `(termsSnapshotId, componentKey)`; fully idempotent on replay).
66
+ - **Services**: `ReferralAgreementExecutionService` binds generated Referral Agreement versions to the generic execution service and activates/supersedes them transactionally with future-effective amendment support; `AttributionService`, `ReferralQualificationService`, and `ReferralCommissionService` retain their existing attribution/qualification/earning responsibilities.
59
67
 
60
68
  ### svelte
61
69
 
@@ -71,7 +79,7 @@ Every model is `@TenantScoped({ mode: 'optional' })` with `@tenantId({ nullable:
71
79
 
72
80
  ## Cross-package references (plain strings)
73
81
 
74
- `profileId` → smrt-profiles Profile; `invoiceId` (CommissionPayout) → smrt-commerce Invoice; `contractRef` (ReferralAgreement) → smrt-commerce Contract. No static imports of sibling domain packages.
82
+ `profileId` → smrt-profiles Profile; `invoiceId` (CommissionPayout) → smrt-commerce Invoice; agreement artifacts → smrt-assets Asset ids. No static imports of unrelated sibling domain packages.
75
83
 
76
84
  ## smrt-affiliates migration
77
85
 
@@ -90,7 +98,7 @@ Every model is `@TenantScoped({ mode: 'optional' })` with `@tenantId({ nullable:
90
98
  - **`reject()` alone strands rows**: the model method only flips status — always reject through `transitionPayoutForSource`, which releases the batch's membership in the same transaction; stamped rows on a rejected payout would be unsettleable forever.
91
99
  - **The payout source stamp is derived data, never authorization**: `sourceKind`/`sourceId` on CommissionPayout index the history listing; both the listing and the lifecycle service re-verify actual membership and fail closed when the stamp cannot be proven.
92
100
  - **`sweepClearing` treats `clearingEndsAt: null` as immediately sweepable** (no clearing configured ⇒ nothing to wait for).
93
- - **Agreement freeze scope**: activating a ReferralAgreement freezes referrer/program/version/plan refs/clearingDays/approvalMode/effectiveFrom; `effectiveTo` (end-dating) and the evidence fields (`contractRef`, artifact url/hash, `acceptanceEvidence`) stay writable e-signature completes downstream.
101
+ - **Agreement freeze scope**: activating a ReferralAgreement requires and freezes its execution/evidence refs along with its commercial terms. `effectiveTo` remains writable for explicit end-dating; signed bytes, hashes, signer evidence, and audit trail exist only on immutable ExecutedAgreement/Asset records.
94
102
  - **Circular FK pair by design**: `Referral.snapshotId ↔ ReferralTermSnapshot.referralId`. Fine on SQLite (and no cross-table DDL constraints are emitted for these string FKs); keep an eye on strict-DDL environments.
95
103
  - **Attribution resolution is single-writer per (target, program)**: `resolve()` is idempotent against PERSISTED state, but two workers resolving the same target concurrently can both pass the existence check and create duplicate credit — the collection layer has no cross-row transaction (the same stance as payout batching, which relies on disjoint scopes for concurrency). Run intake resolution serially per target (it naturally is, in a request handler); duplicates are visible in the portal and correctable via `override()`.
96
104
  - **`ObjectRegistry.getConfig(X)` needs the class module imported** (decorator side effects) — manifest-only registration doesn't carry api/mcp/conflictColumns; tests asserting surface configs need a side-effect import of the module barrel.
@@ -0,0 +1,106 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { AgreementExecution } from '../models/AgreementExecution.js';
3
+ import { AgreementExecutionStatus } from '../types.js';
4
+ export interface ClaimAgreementCreateAttemptInput {
5
+ tenantId: string;
6
+ executionId: string;
7
+ expectedAttemptCount: number;
8
+ expectedLeaseId: string;
9
+ expectedStatus: string;
10
+ expectedLastError: string;
11
+ operationId: string;
12
+ leaseExpiresAt: Date;
13
+ now: Date;
14
+ }
15
+ export interface CompleteAgreementCreateAttemptInput {
16
+ tenantId: string;
17
+ executionId: string;
18
+ operationId: string;
19
+ provider: string;
20
+ providerRequestId: string;
21
+ status: AgreementExecutionStatus;
22
+ expiresAt: Date | null;
23
+ }
24
+ export interface FailAgreementCreateAttemptInput {
25
+ tenantId: string;
26
+ executionId: string;
27
+ operationId: string;
28
+ lastError: string;
29
+ }
30
+ export interface BindAgreementProviderRequestInput {
31
+ tenantId: string;
32
+ executionId: string;
33
+ provider: string;
34
+ providerRequestId: string;
35
+ }
36
+ export interface CompareAndSetAgreementLifecycleInput {
37
+ tenantId: string;
38
+ executionId: string;
39
+ expectedStatus: AgreementExecutionStatus;
40
+ status: AgreementExecutionStatus;
41
+ expiresAt: Date | null;
42
+ cancellationReason: string;
43
+ lastProviderEventAt: Date;
44
+ lastReconciledAt: Date | null;
45
+ completedAt: Date | null;
46
+ }
47
+ export interface UpdateAgreementExecutionErrorInput {
48
+ tenantId: string;
49
+ executionId: string;
50
+ lastError: string;
51
+ }
52
+ export type AgreementEvidenceArtifactKind = 'signed_document' | 'audit_trail';
53
+ export interface BindAgreementEvidenceArtifactInput {
54
+ tenantId: string;
55
+ executionId: string;
56
+ kind: AgreementEvidenceArtifactKind;
57
+ assetId: string;
58
+ sha256: string;
59
+ sizeBytes: number;
60
+ mediaType: string;
61
+ filename: string;
62
+ }
63
+ export declare class AgreementExecutionCollection extends SmrtCollection<AgreementExecution> {
64
+ static readonly _itemClass: typeof AgreementExecution;
65
+ findByIdempotencyKey(idempotencyKey: string): Promise<AgreementExecution | null>;
66
+ findByProviderRequest(provider: string, providerRequestId: string): Promise<AgreementExecution | null>;
67
+ /**
68
+ * Atomically claim an expired or cleared provider-create lease.
69
+ *
70
+ * The explicit tenant predicate and expected-state predicates make the raw
71
+ * compare-and-swap fail closed across workers. `RETURNING id` is used
72
+ * because not every database adapter reports affected-row counts reliably.
73
+ */
74
+ claimCreateAttempt(input: ClaimAgreementCreateAttemptInput): Promise<AgreementExecution | null>;
75
+ /**
76
+ * Persist a provider-create result only while the caller still owns its
77
+ * lease. This prevents a slow, expired attempt from overwriting a newer
78
+ * recovery attempt after returning from the provider.
79
+ */
80
+ completeCreateAttempt(input: CompleteAgreementCreateAttemptInput): Promise<AgreementExecution | null>;
81
+ /** Record a create failure only while the caller still owns its lease. */
82
+ failCreateAttempt(input: FailAgreementCreateAttemptInput): Promise<AgreementExecution | null>;
83
+ /** Bind an adopted provider request without saving a stale object snapshot. */
84
+ bindProviderRequest(input: BindAgreementProviderRequestInput): Promise<AgreementExecution | null>;
85
+ /**
86
+ * Apply provider lifecycle state only while status still matches the
87
+ * caller's snapshot and the candidate observation is not older than the
88
+ * persisted provider event. Service retries re-read the winner before
89
+ * deciding whether the candidate state remains monotonic.
90
+ */
91
+ compareAndSetLifecycle(input: CompareAndSetAgreementLifecycleInput): Promise<AgreementExecution | null>;
92
+ /** Increment audit attempts without writing any lifecycle columns. */
93
+ incrementAttemptCount(tenantId: string, executionId: string): Promise<AgreementExecution>;
94
+ /** Update failure diagnostics without writing a stale lifecycle snapshot. */
95
+ updateLastError(input: UpdateAgreementExecutionErrorInput): Promise<AgreementExecution>;
96
+ /**
97
+ * Bind one immutable evidence artifact with a tenant-fenced compare-and-swap.
98
+ * Concurrent finalizers can only publish one asset identity for each kind.
99
+ */
100
+ bindEvidenceArtifact(input: BindAgreementEvidenceArtifactInput): Promise<AgreementExecution | null>;
101
+ findBySource(sourceKind: string, sourceId: string): Promise<AgreementExecution[]>;
102
+ private assertCreateAttemptTenant;
103
+ private getReturnedExecution;
104
+ }
105
+ export default AgreementExecutionCollection;
106
+ //# sourceMappingURL=AgreementExecutionCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgreementExecutionCollection.d.ts","sourceRoot":"","sources":["../../../src/agreements/collections/AgreementExecutionCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,IAAI,CAAC;IACrB,GAAG,EAAE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,mCAAmC;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAA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Ae,4BAA4B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { AgreementExecutionEvent } from '../models/AgreementExecutionEvent.js';
3
+ import { VerifiedAgreementExecutionEventOptions } from '../types.js';
4
+ export declare class AgreementExecutionEventCollection extends SmrtCollection<AgreementExecutionEvent> {
5
+ static readonly _itemClass: typeof AgreementExecutionEvent;
6
+ findByDedupeKey(dedupeKey: string): Promise<AgreementExecutionEvent | null>;
7
+ recordVerified(options: VerifiedAgreementExecutionEventOptions): Promise<{
8
+ event: AgreementExecutionEvent;
9
+ created: boolean;
10
+ }>;
11
+ private assertSameVerifiedEvent;
12
+ findByExecution(executionId: string): Promise<AgreementExecutionEvent[]>;
13
+ findProviderEventsByExecution(executionId: string): Promise<AgreementExecutionEvent[]>;
14
+ }
15
+ export default AgreementExecutionEventCollection;
16
+ //# sourceMappingURL=AgreementExecutionEventCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgreementExecutionEventCollection.d.ts","sourceRoot":"","sources":["../../../src/agreements/collections/AgreementExecutionEventCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,aAAa,CAAC;AAG1E,qBAAa,iCAAkC,SAAQ,cAAc,CAAC,uBAAuB,CAAC;IAC5F,MAAM,CAAC,QAAQ,CAAC,UAAU,iCAA2B;IAE/C,eAAe,CACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;IAKpC,cAAc,CAClB,OAAO,EAAE,sCAAsC,GAC9C,OAAO,CAAC;QAAE,KAAK,EAAE,uBAAuB,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAwChE,OAAO,CAAC,uBAAuB;IAyBzB,eAAe,CACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAO/B,6BAA6B,CACjC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,uBAAuB,EAAE,CAAC;CAMtC;AAED,eAAe,iCAAiC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { ExecutedAgreement } from '../models/ExecutedAgreement.js';
3
+ import { ExecutedAgreementOptions } from '../types.js';
4
+ export declare class ExecutedAgreementCollection extends SmrtCollection<ExecutedAgreement> {
5
+ static readonly _itemClass: typeof ExecutedAgreement;
6
+ findByExecution(executionId: string): Promise<ExecutedAgreement | null>;
7
+ createImmutable(options: ExecutedAgreementOptions): Promise<{
8
+ agreement: ExecutedAgreement;
9
+ created: boolean;
10
+ }>;
11
+ private assertSameEvidence;
12
+ private assertCompleteEvidence;
13
+ findVersionsBySource(sourceKind: string, sourceId: string): Promise<ExecutedAgreement[]>;
14
+ effectiveForSource(sourceKind: string, sourceId: string, at?: Date): Promise<ExecutedAgreement | null>;
15
+ }
16
+ export default ExecutedAgreementCollection;
17
+ //# sourceMappingURL=ExecutedAgreementCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExecutedAgreementCollection.d.ts","sourceRoot":"","sources":["../../../src/agreements/collections/ExecutedAgreementCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAG5D,qBAAa,2BAA4B,SAAQ,cAAc,CAAC,iBAAiB,CAAC;IAChF,MAAM,CAAC,QAAQ,CAAC,UAAU,2BAAqB;IAEzC,eAAe,CACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAK9B,eAAe,CACnB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC;QAAE,SAAS,EAAE,iBAAiB,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAoC9D,OAAO,CAAC,kBAAkB;IAwC1B,OAAO,CAAC,sBAAsB;IAgExB,oBAAoB,CACxB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAOzB,kBAAkB,CACtB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,EAAE,GAAE,IAAiB,GACpB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;CAIrC;AAED,eAAe,2BAA2B,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Provider-neutral agreement signature orchestration and immutable evidence.
3
+ *
4
+ * Provider adapters come from `@happyvertical/signatures`; this module owns
5
+ * tenant-scoped lifecycle, verified-event ingestion, Asset-backed evidence,
6
+ * idempotency, reconciliation, and versioned executed-agreement records.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ export { AgreementExecutionCollection } from './collections/AgreementExecutionCollection.js';
11
+ export { AgreementExecutionEventCollection } from './collections/AgreementExecutionEventCollection.js';
12
+ export { ExecutedAgreementCollection } from './collections/ExecutedAgreementCollection.js';
13
+ export { AgreementExecution } from './models/AgreementExecution.js';
14
+ export { AgreementExecutionEvent } from './models/AgreementExecutionEvent.js';
15
+ export { ExecutedAgreement } from './models/ExecutedAgreement.js';
16
+ export { type AdoptAgreementProviderRequestInput, type AgreementExecutionOperationInput, AgreementExecutionService, type AgreementExecutionServiceDeps, type CancelAgreementExecutionInput, type ExtendAgreementExecutionInput, } from './services/AgreementExecutionService.js';
17
+ export * from './types.js';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agreements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAC7F,OAAO,EAAE,iCAAiC,EAAE,MAAM,oDAAoD,CAAC;AACvG,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,gCAAgC,EACrC,yBAAyB,EACzB,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,GACnC,MAAM,yCAAyC,CAAC;AACjD,cAAc,YAAY,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { SmrtObject } from '@happyvertical/smrt-core';
2
+ import { AgreementExecutionOptions, AgreementExecutionStatus, AgreementSignerIntent } from '../types.js';
3
+ export declare class AgreementExecution extends SmrtObject {
4
+ tenantId: string;
5
+ provider: string;
6
+ /** Non-secret provider account/region reference used for operations. */
7
+ providerAccountRef: string;
8
+ /** SDK/SMRT secret-store reference only; never a credential value. */
9
+ credentialRef: string;
10
+ idempotencyKey: string;
11
+ sourceKind: string;
12
+ sourceId: string;
13
+ sourceVersion: number;
14
+ sourceAssetId: string;
15
+ sourceSha256: string;
16
+ sourceSizeBytes: number;
17
+ requestIntentSha256: string;
18
+ title: string;
19
+ signerIntent: string;
20
+ providerRequestId: string;
21
+ /** Unique tenant/provider/request binding fence; derived, never a secret. */
22
+ providerRequestKey: string | null;
23
+ status: AgreementExecutionStatus;
24
+ expiresAt: Date | null;
25
+ cancellationReason: string;
26
+ lastProviderEventAt: Date | null;
27
+ lastReconciledAt: Date | null;
28
+ completedAt: Date | null;
29
+ effectiveFrom: Date | null;
30
+ effectiveTo: Date | null;
31
+ /**
32
+ * Opaque prior-evidence provenance copied into the immutable result.
33
+ * The authoritative relationship is on ExecutedAgreement; making this
34
+ * mutable orchestration hint a foreign key would create a registry cycle.
35
+ */
36
+ supersedesExecutedAgreementId: string;
37
+ signedDocumentAssetId: string;
38
+ signedDocumentSha256: string;
39
+ signedDocumentSizeBytes: number;
40
+ signedDocumentMediaType: string;
41
+ signedDocumentFilename: string;
42
+ auditTrailAssetId: string;
43
+ auditTrailSha256: string;
44
+ auditTrailSizeBytes: number;
45
+ auditTrailMediaType: string;
46
+ auditTrailFilename: string;
47
+ attemptCount: number;
48
+ /** Operation id holding the current provider-create lease. */
49
+ createLeaseId: string;
50
+ /** A crashed create attempt stops fencing recovery after this instant. */
51
+ createLeaseExpiresAt: Date | null;
52
+ lastError: string;
53
+ metadata: string;
54
+ constructor(options?: AgreementExecutionOptions);
55
+ initialize(): Promise<this>;
56
+ save(): Promise<this>;
57
+ getSignerIntent(): AgreementSignerIntent[];
58
+ private captureIdentity;
59
+ private serializeIntent;
60
+ private serializeSignedDocumentEvidence;
61
+ private serializeAuditTrailEvidence;
62
+ private assertBoundValueUnchanged;
63
+ private syncProviderRequestKey;
64
+ }
65
+ export default AgreementExecution;
66
+ //# sourceMappingURL=AgreementExecution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgreementExecution.d.ts","sourceRoot":"","sources":["../../../src/agreements/models/AgreementExecution.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,OAAO,EAGL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAgBrB,qBAOa,kBAAmB,SAAQ,UAAU;IAEhD,QAAQ,EAAE,MAAM,CAAM;IAGtB,QAAQ,EAAE,MAAM,CAAM;IAEtB,wEAAwE;IACxE,kBAAkB,EAAE,MAAM,CAAM;IAEhC,sEAAsE;IACtE,aAAa,EAAE,MAAM,CAAM;IAG3B,cAAc,EAAE,MAAM,CAAM;IAG5B,UAAU,EAAE,MAAM,CAAM;IAGxB,QA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Q,EAAE,MAAM,CAAQ;gBAEZ,OAAO,GAAE,yBAA8B;IAkFpC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAc3B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqCpC,eAAe,IAAI,qBAAqB,EAAE;IAS1C,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,+BAA+B;IAWvC,OAAO,CAAC,2BAA2B;IAWnC,OAAO,CAAC,yBAAyB;IAYjC,OAAO,CAAC,sBAAsB;CAkB/B;AAED,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { SmrtObject } from '@happyvertical/smrt-core';
2
+ import { AgreementExecutionEventOptions, AgreementExecutionStatus } from '../types.js';
3
+ export declare class AgreementExecutionEvent extends SmrtObject {
4
+ tenantId: string;
5
+ executionId: string;
6
+ provider: string;
7
+ providerEventId: string;
8
+ eventOrigin: string;
9
+ operationId: string;
10
+ dedupeKey: string;
11
+ orderingKey: string;
12
+ eventType: string;
13
+ status: AgreementExecutionStatus;
14
+ occurredAt: Date;
15
+ receivedAt: Date;
16
+ payloadSha256: string;
17
+ signerEvidence: string;
18
+ payload: string;
19
+ constructor(options?: AgreementExecutionEventOptions);
20
+ initialize(): Promise<this>;
21
+ save(): Promise<this>;
22
+ private serializeState;
23
+ }
24
+ export default AgreementExecutionEvent;
25
+ //# sourceMappingURL=AgreementExecutionEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgreementExecutionEvent.d.ts","sourceRoot":"","sources":["../../../src/agreements/models/AgreementExecutionEvent.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,OAAO,EAAqB,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE/E,OAAO,KAAK,EACV,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAKrB,qBAOa,uBAAwB,SAAQ,UAAU;IAErD,QAAQ,EAAE,MAAM,CAAM;IAGtB,WAAW,EAAE,MAAM,CAAM;IAEzB,QAAQ,EAAE,MAAM,CAAM;IACtB,eAAe,EAAE,MAAM,CAAM;IAC7B,WAAW,EAAE,MAAM,CAAsB;IACzC,WAAW,EAAE,MAAM,CAAM;IAGzB,SAAS,EAAE,MAAM,CAAM;IAEvB,WAAW,EAAE,MAAM,CAAM;IACzB,SAAS,EAAE,MAAM,CAAM;IACvB,MAAM,EAAE,wBAAwB,CAAc;IAC9C,UAAU,EAAE,IAAI,CAAc;IAC9B,UAAU,EAAE,IAAI,CAAc;IAC9B,aAAa,EAAE,MAAM,CAAM;IAC3B,cAAc,EAAE,MAAM,CAAQ;IAC9B,OAAO,EAAE,MAAM,CAAQ;gBAEX,OAAO,GAAE,8BAAmC;IA4BzC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ3B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAapC,OAAO,CAAC,cAAc;CAmBvB;AAED,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { SmrtObject } from '@happyvertical/smrt-core';
2
+ import { ExecutedAgreementOptions } from '../types.js';
3
+ export declare class ExecutedAgreement extends SmrtObject {
4
+ tenantId: string;
5
+ executionId: string;
6
+ sourceKind: string;
7
+ sourceId: string;
8
+ sourceVersion: number;
9
+ sourceAssetId: string;
10
+ sourceSha256: string;
11
+ sourceSizeBytes: number;
12
+ signedDocumentAssetId: string;
13
+ signedDocumentSha256: string;
14
+ signedDocumentSizeBytes: number;
15
+ signedDocumentMediaType: string;
16
+ signedDocumentFilename: string;
17
+ auditTrailAssetId: string;
18
+ auditTrailSha256: string;
19
+ auditTrailSizeBytes: number;
20
+ auditTrailMediaType: string;
21
+ auditTrailFilename: string;
22
+ signerEvidence: string;
23
+ acceptedAt: Date;
24
+ effectiveFrom: Date | null;
25
+ effectiveTo: Date | null;
26
+ supersedesExecutedAgreementId: string;
27
+ metadata: string;
28
+ constructor(options?: ExecutedAgreementOptions);
29
+ initialize(): Promise<this>;
30
+ isEffectiveAt(at: Date): boolean;
31
+ save(): Promise<this>;
32
+ private serializeState;
33
+ }
34
+ export default ExecutedAgreement;
35
+ //# sourceMappingURL=ExecutedAgreement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExecutedAgreement.d.ts","sourceRoot":"","sources":["../../../src/agreements/models/ExecutedAgreement.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAIL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAK5D,qBAOa,iBAAkB,SAAQ,UAAU;IAE/C,QAAQ,EAAE,MAAM,CAAM;IAGtB,WAAW,EAAE,MAAM,CAAM;IAGzB,UAAU,EAAE,MAAM,CAAM;IAGxB,QAAQ,EAAE,MAAM,CAAM;IAEtB,aAAa,EAAE,MAAM,CAAK;IAG1B,aAAa,EAAE,MAAM,CAAM;IAE3B,YAAY,EAAE,MAAM,CAAM;IAC1B,eAAe,EAAE,MAAM,CAAK;IAG5B,qBAAqB,EAAE,MAAM,CAAM;IAEnC,oBAAoB,EAAE,MAAM,CAAM;IAClC,uBAAuB,EAAE,MAAM,CAAK;IACpC,uBAAuB,EAAE,MAAM,CAAM;IACrC,sBAAsB,EAAE,MAAM,CAAM;IAGpC,iBAAiB,EAAE,MAAM,CAAM;IAE/B,gBAAgB,EAAE,MAAM,CAAM;IAC9B,mBAAmB,EAAE,MAAM,CAAK;IAChC,mBAAmB,EAAE,MAAM,CAAM;IACjC,kBAAkB,EAAE,MAAM,CAAM;IAChC,cAAc,EAAE,MAAM,CAAQ;IAC9B,UAAU,EAAE,IAAI,CAAc;IAC9B,aAAa,EAAE,IAAI,GAAG,IAAI,CAAQ;IAClC,WAAW,EAAE,IAAI,GAAG,IAAI,CAAQ;IAGhC,6BAA6B,EAAE,MAAM,CAAM;IAE3C,QAAQ,EAAE,MAAM,CAAQ;gBAEZ,OAAO,GAAE,wBAA6B;IAiDnC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAU1C,aAAa,CAAC,EAAE,EAAE,IAAI,GAAG,OAAO;IAOjB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAapC,OAAO,CAAC,cAAc;CA4BvB;AAED,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { SignatureProvider } from '@happyvertical/signatures';
2
+ import { AssetRuntimeLike } from '@happyvertical/smrt-assets';
3
+ import { AgreementExecutionCollection } from '../collections/AgreementExecutionCollection.js';
4
+ import { AgreementExecutionEventCollection } from '../collections/AgreementExecutionEventCollection.js';
5
+ import { ExecutedAgreementCollection } from '../collections/ExecutedAgreementCollection.js';
6
+ import { AgreementExecutionResult, AgreementWebhookIngestionResult, CreateAgreementExecutionInput, IngestAgreementWebhookInput } from '../types.js';
7
+ export interface AgreementExecutionServiceDeps {
8
+ provider: SignatureProvider;
9
+ assets: AssetRuntimeLike;
10
+ executions: AgreementExecutionCollection;
11
+ events: AgreementExecutionEventCollection;
12
+ executedAgreements: ExecutedAgreementCollection;
13
+ now?: () => Date;
14
+ createLeaseDurationMs?: number;
15
+ }
16
+ export interface AdoptAgreementProviderRequestInput {
17
+ tenantId: string;
18
+ executionId: string;
19
+ providerRequestId: string;
20
+ signal?: AbortSignal;
21
+ }
22
+ export interface AgreementExecutionOperationInput {
23
+ tenantId: string;
24
+ executionId: string;
25
+ signal?: AbortSignal;
26
+ }
27
+ export interface CancelAgreementExecutionInput extends AgreementExecutionOperationInput {
28
+ reason: string;
29
+ }
30
+ export interface ExtendAgreementExecutionInput extends AgreementExecutionOperationInput {
31
+ expiresAt: Date | string;
32
+ warnPrior?: boolean;
33
+ }
34
+ export declare class AgreementExecutionService {
35
+ private readonly deps;
36
+ private readonly now;
37
+ private readonly createLeaseDurationMs;
38
+ constructor(deps: AgreementExecutionServiceDeps);
39
+ createExecution(input: CreateAgreementExecutionInput): Promise<AgreementExecutionResult>;
40
+ private sendProviderRequest;
41
+ private resumeOrReplayCreate;
42
+ /**
43
+ * Bind an operator-reconciled provider request after an uncertain create.
44
+ * This is the safe recovery path for providers without atomic idempotency.
45
+ */
46
+ adoptProviderRequest(input: AdoptAgreementProviderRequestInput): Promise<AgreementExecutionResult>;
47
+ reconcile(input: AgreementExecutionOperationInput): Promise<AgreementExecutionResult>;
48
+ cancel(input: CancelAgreementExecutionInput): Promise<AgreementExecutionResult>;
49
+ extendExpiry(input: ExtendAgreementExecutionInput): Promise<AgreementExecutionResult>;
50
+ ingestWebhook(input: IngestAgreementWebhookInput): Promise<AgreementWebhookIngestionResult>;
51
+ private finalizeExecution;
52
+ private ensureEvidenceArtifact;
53
+ private retrieveAndStoreArtifact;
54
+ private getStoredArtifactMetadata;
55
+ private requireStoredArtifactMetadata;
56
+ private removeStoredAsset;
57
+ private ensureExecutedAgreementAssociations;
58
+ private applyProviderState;
59
+ private persistLifecycleState;
60
+ private assertProviderRequest;
61
+ private assertArtifact;
62
+ private assertProviderCapabilities;
63
+ private assertSameIntent;
64
+ private assertCreateInput;
65
+ private requireExecution;
66
+ private requireProviderRequestId;
67
+ private assertProviderRequestAvailable;
68
+ private bindProviderRequest;
69
+ private canSafelyRetryCreate;
70
+ private isAbandonedCreate;
71
+ private isCreateLeaseActive;
72
+ private newCreateLeaseExpiry;
73
+ private failOwnedCreateAttempt;
74
+ private ensureAssetAssociation;
75
+ private beginAuditedOperation;
76
+ private completeAuditedOperation;
77
+ private failAuditedOperation;
78
+ private recordOperationAudit;
79
+ private assertNonTerminalOperation;
80
+ private result;
81
+ private assertTenant;
82
+ private assertTenantValue;
83
+ }
84
+ export default AgreementExecutionService;
85
+ //# sourceMappingURL=AgreementExecutionService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgreementExecutionService.d.ts","sourceRoot":"","sources":["../../../src/agreements/services/AgreementExecutionService.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAGjF,OAAO,KAAK,EAGV,iBAAiB,EAGlB,MAAM,2BAA2B,CAA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C,iBAAiB;CAW1B;AA6LD,eAAe,yBAAyB,CAAC"}
@@ -0,0 +1,140 @@
1
+ import { SignatureAuthenticationMethod, SignatureDocument, SignatureSigner, SignatureSignerInput } from '@happyvertical/signatures';
2
+ import { SmrtObjectOptions } from '@happyvertical/smrt-core';
3
+ export declare const AGREEMENT_EXECUTION_STATUSES: readonly ["prepared", "sent", "delivered", "viewed", "partially_signed", "completed", "declined", "cancelled", "expired", "failed"];
4
+ export type AgreementExecutionStatus = (typeof AGREEMENT_EXECUTION_STATUSES)[number];
5
+ export interface AgreementSignerIntent {
6
+ name: string;
7
+ email: string;
8
+ role?: string;
9
+ order?: number;
10
+ authenticationMethod: SignatureAuthenticationMethod;
11
+ }
12
+ export interface AgreementExecutionOptions extends SmrtObjectOptions {
13
+ tenantId?: string;
14
+ provider?: string;
15
+ providerAccountRef?: string;
16
+ credentialRef?: string;
17
+ idempotencyKey?: string;
18
+ sourceKind?: string;
19
+ sourceId?: string;
20
+ sourceVersion?: number;
21
+ sourceAssetId?: string;
22
+ sourceSha256?: string;
23
+ sourceSizeBytes?: number;
24
+ requestIntentSha256?: string;
25
+ title?: string;
26
+ signerIntent?: string;
27
+ providerRequestId?: string;
28
+ providerRequestKey?: string | null;
29
+ status?: AgreementExecutionStatus;
30
+ expiresAt?: Date | string | number | null;
31
+ cancellationReason?: string;
32
+ lastProviderEventAt?: Date | string | number | null;
33
+ lastReconciledAt?: Date | string | number | null;
34
+ completedAt?: Date | string | number | null;
35
+ effectiveFrom?: Date | string | number | null;
36
+ effectiveTo?: Date | string | number | null;
37
+ supersedesExecutedAgreementId?: string;
38
+ signedDocumentAssetId?: string;
39
+ signedDocumentSha256?: string;
40
+ signedDocumentSizeBytes?: number;
41
+ signedDocumentMediaType?: string;
42
+ signedDocumentFilename?: string;
43
+ auditTrailAssetId?: string;
44
+ auditTrailSha256?: string;
45
+ auditTrailSizeBytes?: number;
46
+ auditTrailMediaType?: string;
47
+ auditTrailFilename?: string;
48
+ attemptCount?: number;
49
+ createLeaseId?: string;
50
+ createLeaseExpiresAt?: Date | string | number | null;
51
+ lastError?: string;
52
+ metadata?: string;
53
+ }
54
+ export interface AgreementExecutionEventOptions extends SmrtObjectOptions {
55
+ tenantId?: string;
56
+ executionId?: string;
57
+ provider?: string;
58
+ providerEventId?: string;
59
+ eventOrigin?: string;
60
+ operationId?: string;
61
+ dedupeKey?: string;
62
+ orderingKey?: string;
63
+ eventType?: string;
64
+ status?: AgreementExecutionStatus;
65
+ occurredAt?: Date | string | number;
66
+ receivedAt?: Date | string | number;
67
+ payloadSha256?: string;
68
+ signerEvidence?: string;
69
+ payload?: string;
70
+ }
71
+ export type VerifiedAgreementExecutionEventOptions = AgreementExecutionEventOptions & Required<Pick<AgreementExecutionEventOptions, 'dedupeKey' | 'occurredAt' | 'receivedAt'>>;
72
+ export interface ExecutedAgreementOptions extends SmrtObjectOptions {
73
+ tenantId?: string;
74
+ executionId?: string;
75
+ sourceKind?: string;
76
+ sourceId?: string;
77
+ sourceVersion?: number;
78
+ sourceAssetId?: string;
79
+ sourceSha256?: string;
80
+ sourceSizeBytes?: number;
81
+ signedDocumentAssetId?: string;
82
+ signedDocumentSha256?: string;
83
+ signedDocumentSizeBytes?: number;
84
+ signedDocumentMediaType?: string;
85
+ signedDocumentFilename?: string;
86
+ auditTrailAssetId?: string;
87
+ auditTrailSha256?: string;
88
+ auditTrailSizeBytes?: number;
89
+ auditTrailMediaType?: string;
90
+ auditTrailFilename?: string;
91
+ signerEvidence?: string;
92
+ acceptedAt?: Date | string | number;
93
+ effectiveFrom?: Date | string | number | null;
94
+ effectiveTo?: Date | string | number | null;
95
+ supersedesExecutedAgreementId?: string;
96
+ metadata?: string;
97
+ }
98
+ export interface CreateAgreementExecutionInput {
99
+ tenantId: string;
100
+ idempotencyKey: string;
101
+ sourceKind: string;
102
+ sourceId: string;
103
+ sourceVersion: number;
104
+ title: string;
105
+ document: SignatureDocument;
106
+ signers: readonly SignatureSignerInput[];
107
+ message?: string;
108
+ signingOrder?: boolean;
109
+ expiresInDays?: number;
110
+ providerAccountRef?: string;
111
+ /** Secret-store reference only. Credential values must stay in the provider. */
112
+ credentialRef?: string;
113
+ effectiveFrom?: Date | string | number | null;
114
+ effectiveTo?: Date | string | number | null;
115
+ supersedesExecutedAgreementId?: string;
116
+ metadata?: Readonly<Record<string, string>>;
117
+ signal?: AbortSignal;
118
+ }
119
+ export interface IngestAgreementWebhookInput {
120
+ tenantId: string;
121
+ payload: string;
122
+ signature: string;
123
+ }
124
+ export interface AgreementExecutionResult {
125
+ executionId: string;
126
+ /** Absent only while another idempotent create caller owns the remote attempt. */
127
+ providerRequestId?: string;
128
+ status: AgreementExecutionStatus;
129
+ replayed: boolean;
130
+ }
131
+ export interface AgreementWebhookIngestionResult {
132
+ executionId: string;
133
+ eventId: string;
134
+ replayed: boolean;
135
+ executedAgreementId?: string;
136
+ }
137
+ export declare function sanitizeSignerIntent(signers: readonly SignatureSignerInput[]): AgreementSignerIntent[];
138
+ export declare function sanitizeSignerEvidence(signers: readonly SignatureSigner[]): SignatureSigner[];
139
+ export declare function coerceAgreementDate(value: unknown): Date | null;
140
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agreements/types.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,OAAO,KAAK,EACV,6BAA6B,EAC7B,iBAAiB,EAEjB,eAAe,EACf,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,eAAO,MAAM,4BAA4B,qIAWa,CAAC;AAEvD,MAAM,MAAM,wBAAwB,GAClC,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CA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