@happyvertical/smrt-sales 0.57.1 → 0.57.3
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 +70 -2
- package/agents/commissions.md +1 -1
- package/agents/referrals.md +1 -0
- package/dist/agreements/collections/AgreementCollection.d.ts +50 -0
- package/dist/agreements/collections/AgreementCollection.d.ts.map +1 -0
- package/dist/agreements/index.d.ts +2 -0
- package/dist/agreements/index.d.ts.map +1 -1
- package/dist/agreements/models/Agreement.d.ts +67 -0
- package/dist/agreements/models/Agreement.d.ts.map +1 -0
- package/dist/agreements/types.d.ts +32 -0
- package/dist/agreements/types.d.ts.map +1 -1
- package/dist/agreements.d.ts +2 -2
- package/dist/agreements.js +3 -3
- package/dist/chunks/__smrt-register__-DTUQW7wz.js +6 -0
- package/dist/chunks/__smrt-register__-DTUQW7wz.js.map +1 -0
- package/dist/chunks/{agreements-BB_tNU0U.js → agreements-jBiVmttD.js} +450 -4
- package/dist/chunks/agreements-jBiVmttD.js.map +1 -0
- package/dist/chunks/{commissions-Cs4MsxVg.js → commissions-Cip6QZ9Q.js} +350 -6
- package/dist/chunks/commissions-Cip6QZ9Q.js.map +1 -0
- package/dist/chunks/{referrals-CrFDsdq-.js → referrals-CYgrGkEo.js} +17 -3
- package/dist/chunks/{referrals-CrFDsdq-.js.map → referrals-CYgrGkEo.js.map} +1 -1
- package/dist/commissions/collections/CommissionAdjustmentOperationCollection.d.ts.map +1 -1
- package/dist/commissions/collections/CommissionPlanCollection.d.ts +5 -1
- package/dist/commissions/collections/CommissionPlanCollection.d.ts.map +1 -1
- package/dist/commissions/models/CommissionPlan.d.ts +20 -1
- package/dist/commissions/models/CommissionPlan.d.ts.map +1 -1
- package/dist/commissions/services/WaterfallCalculationService.d.ts +22 -0
- package/dist/commissions/services/WaterfallCalculationService.d.ts.map +1 -0
- package/dist/commissions/services/index.d.ts +1 -0
- package/dist/commissions/services/index.d.ts.map +1 -1
- package/dist/commissions/types.d.ts +100 -0
- package/dist/commissions/types.d.ts.map +1 -1
- package/dist/commissions.js +3 -3
- package/dist/crm.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/manifest.json +1399 -514
- package/dist/referrals/services/ReferralQualificationService.d.ts +4 -3
- package/dist/referrals/services/ReferralQualificationService.d.ts.map +1 -1
- package/dist/referrals.js +2 -2
- package/dist/smrt-knowledge.json +985 -34
- package/package.json +6 -6
- package/dist/chunks/__smrt-register__-BnG4rTI9.js +0 -6
- package/dist/chunks/__smrt-register__-BnG4rTI9.js.map +0 -1
- package/dist/chunks/agreements-BB_tNU0U.js.map +0 -1
- package/dist/chunks/commissions-Cs4MsxVg.js.map +0 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Add `svelte` when consuming the optional UI export.
|
|
|
20
20
|
|
|
21
21
|
| Entry point | Responsibility |
|
|
22
22
|
| --- | --- |
|
|
23
|
-
| `@happyvertical/smrt-sales/agreements` |
|
|
23
|
+
| `@happyvertical/smrt-sales/agreements` | Versioned commercial terms, verified e-signature execution, and immutable evidence |
|
|
24
24
|
| `@happyvertical/smrt-sales/crm` | Leads, pipelines, opportunities, activities, conversions |
|
|
25
25
|
| `@happyvertical/smrt-sales/referrals` | Referrers, links, attribution, qualification, agreements |
|
|
26
26
|
| `@happyvertical/smrt-sales/commissions` | Earners, plans, earning events, commissions, payouts |
|
|
@@ -72,6 +72,32 @@ console.log(earner.id, plan.getComponents());
|
|
|
72
72
|
All money fields use integer cents. Rates and probability-like values use
|
|
73
73
|
decimals from `0` to `1`; rounding occurs through the exported money helpers.
|
|
74
74
|
|
|
75
|
+
## Waterfall plans
|
|
76
|
+
|
|
77
|
+
Version-two plans can carry ordered `steps`, an `effectiveTo` boundary, and a
|
|
78
|
+
`remainderSink`. `calculateWaterfall()` is a pure, generic allocation service:
|
|
79
|
+
hosts register recipient resolvers, then persist the returned trace as the
|
|
80
|
+
replay evidence. Step keys must be nonempty strings; malformed persisted keys
|
|
81
|
+
are rejected before allocation or activation. Replay snapshots copy recipient
|
|
82
|
+
and sink values, including nested metadata, so later caller-input mutation
|
|
83
|
+
cannot change the returned evidence. The trace freezes the resolved recipients, input facts, and
|
|
84
|
+
application-fee offset. All amounts are integer minor units; each percentage
|
|
85
|
+
rounds half away from zero and recipients plus the sink always equal gross.
|
|
86
|
+
|
|
87
|
+
An application fee already settled at checkout is modeled only as an offset to
|
|
88
|
+
the configured recipient's payable allocation. It is never emitted as a second
|
|
89
|
+
allocation or payable. Offset matching uses the entire recipient descriptor,
|
|
90
|
+
including nested metadata; object key order does not change identity. The service
|
|
91
|
+
does not initiate a payout or transfer.
|
|
92
|
+
|
|
93
|
+
The referral qualification and commission bridge remain component-based. Both
|
|
94
|
+
qualification and explicit requalification refuse a resolved waterfall plan with
|
|
95
|
+
`unsupported_plan_engine`, before writing a snapshot or changing the referral.
|
|
96
|
+
This applies to pinned plans and latest-active plan amendments. Existing frozen
|
|
97
|
+
v1 snapshots keep governing earnings. To recover, activate and bind compatible
|
|
98
|
+
component terms, then retry qualification; use `calculateWaterfall()` directly
|
|
99
|
+
for v2 allocations. Switching a plan key's engine does not migrate referrals.
|
|
100
|
+
|
|
75
101
|
## Core model
|
|
76
102
|
|
|
77
103
|
- **Roles are separate from money.** `SalesRepresentative` and `Referrer` are
|
|
@@ -132,7 +158,26 @@ See [the CRM contract](agents/crm.md) for retry and duplicate semantics and
|
|
|
132
158
|
|
|
133
159
|
## Agreement boundary
|
|
134
160
|
|
|
135
|
-
|
|
161
|
+
`Agreement` is a counterparty-agnostic, effective-dated terms record. Parties
|
|
162
|
+
are ordered `{ kind, id }` descriptors, so consumers can use tenant, earner,
|
|
163
|
+
profile, organization, worker, or their own neutral kinds without importing a
|
|
164
|
+
consumer domain. Versions are rows: `createAmendment()` creates a draft and
|
|
165
|
+
`activateAmendment()` closes the predecessor at the successor's start. Effective
|
|
166
|
+
intervals are half-open (`[effectiveFrom, effectiveTo)`), and `activeFor()` is
|
|
167
|
+
an as-of query: it can return a superseded or terminated version that governed
|
|
168
|
+
the supplied record date, never terms inferred from today's status. Ambiguous
|
|
169
|
+
overlapping intervals fail closed. Activation rejects backdated or out-of-order
|
|
170
|
+
amendments that would overlap existing history. Ending a draft cancels it without
|
|
171
|
+
making it govern; closed intervals cannot be reopened. Party JSON is canonicalized
|
|
172
|
+
before persistence, so property order does not change an agreement's identity.
|
|
173
|
+
Tenant lookups fall back to global terms for each requested date when no tenant
|
|
174
|
+
version governs that date. A tenant must explicitly create its initial version
|
|
175
|
+
before using amendment helpers; global terms are never implicitly copied into a
|
|
176
|
+
tenant amendment. Callers that calculate money must snapshot
|
|
177
|
+
the returned version at their authoritative event; this model does not settle
|
|
178
|
+
or allocate funds.
|
|
179
|
+
|
|
180
|
+
The execution portion of the agreements module accepts the provider-neutral
|
|
136
181
|
`@happyvertical/signatures` contract plus an `AssetRuntimeLike`. Provider
|
|
137
182
|
credentials remain in the injected SDK adapter and secret store. Executed
|
|
138
183
|
agreements freeze the exact source, signed document, audit trail, hashes, and
|
|
@@ -163,3 +208,26 @@ pnpm --filter @happyvertical/smrt-sales build
|
|
|
163
208
|
|
|
164
209
|
See [`AGENTS.md`](./AGENTS.md) for lifecycle, evidence, concurrency, and payout
|
|
165
210
|
invariants.
|
|
211
|
+
|
|
212
|
+
A future amendment activated through `activateAmendment` can be withdrawn through
|
|
213
|
+
`withdrawAmendment(id)` only before its start, while it is still active. This
|
|
214
|
+
transaction cancels the never-effective successor and restores its exact persisted
|
|
215
|
+
predecessor end (including a finite end); it never infers an open-ended interval.
|
|
216
|
+
Repeated, late, or conflicting withdrawals fail without changing history. Direct
|
|
217
|
+
model termination remains for already-effective terms. Global defaults apply only
|
|
218
|
+
before a tenant lane first governs; termination, expiry, and later gaps in that
|
|
219
|
+
lane return no agreement instead of silently resuming global fees.
|
|
220
|
+
|
|
221
|
+
Restoration provenance is written exclusively by amendment activation; ordinary
|
|
222
|
+
creates and saves cannot supply or edit it. Withdrawal advances both persisted
|
|
223
|
+
revision tokens so pre-withdrawal model instances cannot overwrite the result.
|
|
224
|
+
|
|
225
|
+
Initial agreement creates use strict insertion: concurrent callers for the same
|
|
226
|
+
tenant, kind, parties and version cannot replace the winning row or its terms.
|
|
227
|
+
The losing create fails; load the existing version or create an amendment.
|
|
228
|
+
|
|
229
|
+
Concurrent `createAmendment` calls serialize version allocation within the owning
|
|
230
|
+
lane: PostgreSQL locks the oldest persisted version and re-reads the latest;
|
|
231
|
+
embedded engines use core's transaction/write queue. Each successful call keeps
|
|
232
|
+
its own terms and version. Direct `supersede()` requires a finite `effectiveTo`
|
|
233
|
+
set before the transition; saving an open-ended superseded row is rejected.
|
package/agents/commissions.md
CHANGED
|
@@ -10,7 +10,7 @@ money), and the Gotchas that apply before editing anything live in
|
|
|
10
10
|
- **CommissionPlan**: versioned calculation terms. Natural key `(tenant_id, plan_key, version)` (per-tenant keys; the adapters' null-aware upsert dedups NULL-tenant keys through the model layer, though duplicate global rows minted via raw SQL remain representable); `status` (`draft|active|superseded|retired`); `effectiveFrom`. Components are a JSON-string array (`getComponents()`): each component has `key`, `trigger` (earning-event kind or `*`), `basis` (`fixed|gross|net|margin|custom`), `rate` or `fixedAmountCents`, `recurrence` (`one_time` or `recurring` with optional `maxOccurrences`/`windowMonths`). **Immutable once active** — amendments create a new row with `version + 1`; prior versions are never rewritten. `latestActiveByKey(key, at?)` resolves the highest active version **already in effect at `at`** — a future-dated amendment can be activated ahead of time without governing earlier qualifications (same rule on `AttributionPolicyCollection`).
|
|
11
11
|
- **EarningEvent**: immutable commercial-event evidence (`conversion`, `agreement_execution`, `invoice_payment`, `collected_revenue`, `recognized_margin`, or any extensible kind). Carries `sourceKind`/`sourceId` (generic earning source), `grossAmountCents`/`netAmountCents`/`marginCents`, `currency`, `occurredAt`, and a `dedupeKey` natural key for idempotent ingestion. No update/delete surface, plus a save-time immutability guard: hydrated edits, blind id overwrites, and fresh creates onto an existing dedupe key all throw (the upsert would rotate the row id and orphan referencing Commissions) — idempotent ingestion goes through `getOrCreateByDedupeKey()`.
|
|
12
12
|
- **Commission**: one earning record per earner per plan component per event occurrence. Integer-cents amounts (`baseAmountCents`, `amountCents`), decimal `rate`, `basis`, snapshot references (`planKey`/`planVersion`, generic `termsSnapshotKind`/`termsSnapshotId`), a JSON `calculationTrace` sufficient to reproduce the amount, split support (`splitGroupId`, `shareFraction`), and a `dedupeKey` for idempotent creation. Lifecycle `pending → earned → approved → payable → paid`, enforced by a save-time transition guard with an authoritative prior-status re-read (commerce pattern).
|
|
13
|
-
- **CommissionAdjustment**: append-only corrections (`refund|credit|chargeback|dispute|correction`), signed `amountCents`, required `reason`, immutable once created. `CommissionAdjustmentService.createAdjustment()` is the tenant-required idempotent creation door: callers provide a stable operation UUID; the database creates exactly one row, exact retries return it, and changed tenant/commission/earner/kind/cents/currency/reason/operator/metadata fail with a typed replay conflict. Parent Commission plus denormalized tenant/Earner/currency and operator UUID are validated before insert. The financial row deliberately exposes no operation field. A private, required-tenant `CommissionAdjustmentOperation` table uses the globally unique operation UUID as its primary id, maps it to the adjustment UUID, and is inserted in the same transaction as the adjustment. Existing adjustment schemas and legacy direct creates remain unchanged. Earned/paid Commissions are never rewritten — adjustments append to them.
|
|
13
|
+
- **CommissionAdjustment**: append-only corrections (`refund|credit|chargeback|dispute|correction`), signed `amountCents`, required `reason`, immutable once created. `CommissionAdjustmentService.createAdjustment()` is the tenant-required idempotent creation door: callers provide a stable operation UUID; the database creates exactly one row, exact retries return it, and changed tenant/commission/earner/kind/cents/currency/reason/operator/metadata fail with a typed replay conflict. Parent Commission plus denormalized tenant/Earner/currency and operator UUID are validated before insert. The financial row deliberately exposes no operation field. A private, required-tenant `CommissionAdjustmentOperation` table uses the globally unique operation UUID as its primary id, maps it to the adjustment UUID, and is inserted in the same transaction as the adjustment. Claims tolerate either primary-key or tenant/slug/context uniqueness arbitration without aborting the transaction; only the tenant-scoped operation UUID lookup and immutable intent comparison authorize a replay. Existing adjustment schemas and legacy direct creates remain unchanged. Earned/paid Commissions are never rewritten — adjustments append to them.
|
|
14
14
|
- **Payable balance**: computed, not stored — `CommissionBalanceService` sums payable Commissions plus unsettled Adjustments per Earner/currency.
|
|
15
15
|
- **CommissionPayout**: settlement batch per Earner. `pending → approved → processing → completed | failed` (`resetFromFailed()` is the only exit from failed), plus the terminal operator decline `rejected` reachable from pending/approved (#1987 — reject through `transitionPayoutForSource`, which also RELEASES the batch's membership so the rows settle through a future batch; `reject()` on the model mutates status only). Settles rows via the collections' **conditional `claimForPayout`** (model-layer get/save/re-read — tenancy- and dialect-safe; a row owned by another batch is never re-claimed) and stores totals recomputed from the VERIFIED claimed membership; idempotent via `idempotencyKey` natural key (default `${earnerId}:${currency}:${YYYY-MM-DD}`) — a clean replay touches nothing, while a pending payout whose totals disagree with its stamped rows (interrupted claim pass) is repaired on replay (the claim pass re-checks the payout is still pending first). Each batch/repair pass also derives the payout's **single-source stamp** (`sourceKind`/`sourceId`, indexed): set when every claimed commission — and every claimed adjustment through its parent commission — shares exactly one non-empty source; empty for mixed/unknown/empty membership. `completePayout` flips member commissions to `paid` BEFORE the terminal transition, so a mid-loop failure stays retryable. Enforces `totalAmountCents = commissionTotalCents + adjustmentTotalCents` at save; retains `paymentReference`/`providerRef`; optional `invoiceId` cross-package string ref to a commerce Invoice. Generated surface is read-only on ALL doors (api/mcp/cli `list`/`get`) — writes go through `CommissionPayoutService`. `createPayoutBatch` settles the whole earner+currency by default, or a **scoped** subset: pass `sourceKind`+`sourceId` to settle just one earning source (e.g. one ad network), or `commissionIds` for an explicit set (each validated payable+unsettled+earner+currency; requires its own `idempotencyKey`) — adjustments are narrowed to the same scope, and the default idempotency key folds the source in. Scoping is how concurrent per-source batches settle safely: batches scoped to different sources (or disjoint `commissionIds`) gather **disjoint** row sets and never contend. The collection layer has no cross-row transaction, so OVERLAPPING concurrent scopes (a source batch + the earner-wide batch, intersecting id sets, or a batch replay racing a lifecycle transition of the same payout) must be serialized by the caller — `claimForPayout` still won't double-own a row, but a shared commission and its adjustment could split across the two batches.
|
|
16
16
|
- **Source-scoped payout history** (#1985): `CommissionPayoutService.getSourcePayoutHistory({ sourceKind, sourceId, limit?, offset? })` — one page of the payouts belonging to ONE earning source, newest first (`created_at DESC, id DESC`), offset contract (`nextOffset` advances by the scanned count; `null` when exhausted). Candidates come from the indexed stamp, so work is bounded by page size (a sparse source never scans the global history); each page is re-verified against actual membership in three batched queries (no per-payout N+1) — every member commission and every adjustment's parent must carry exactly the requested source and agree on earner/currency/tenant; unprovable rows (mixed-source, missing parents, memberless artifacts, released/rejected batches) are excluded fail-closed and reported in `excluded` with reasons. Adjustment-only payouts prove ownership through parent commissions and list normally. Payouts minted before the stamp existed are invisible until backfilled with `restampPayoutSource(payoutId)` (idempotent, any status).
|
package/agents/referrals.md
CHANGED
|
@@ -13,5 +13,6 @@ money), and the Gotchas that apply before editing anything live in
|
|
|
13
13
|
- **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`.
|
|
14
14
|
- **AttributionException**: conflict review queue. Conclusive policy resolves automatically; ambiguity creates an exception; overrides require a `resolutionReason` and are audited.
|
|
15
15
|
- **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.
|
|
16
|
+
- **Plan compatibility**: qualification and requalification accept only v1 component plans. A pinned or latest-active v2 waterfall plan returns `unsupported_plan_engine` before snapshot/referral writes; existing snapshots remain valid and unchanged. Bind compatible component terms and retry to recover. Engine changes under a plan key never implicitly migrate referrals.
|
|
16
17
|
- **ReferralTermSnapshot**: immutable at qualification — freezes agreement/plan/policy version refs plus the calculation inputs needed to reproduce every later earning.
|
|
17
18
|
- **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.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Collection helpers for generic versioned agreements. */
|
|
2
|
+
import { SmrtCollection } from '@happyvertical/smrt-core';
|
|
3
|
+
import { Agreement } from '../models/Agreement.js';
|
|
4
|
+
import type { AgreementParty } from '../types.js';
|
|
5
|
+
export interface AgreementAmendmentChanges {
|
|
6
|
+
terms?: Record<string, unknown>;
|
|
7
|
+
effectiveFrom?: Date | null;
|
|
8
|
+
effectiveTo?: Date | null;
|
|
9
|
+
executedAgreementId?: string | null;
|
|
10
|
+
metadata?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Versioned rows for one ordered `(kind, partyA, partyB)` relationship.
|
|
14
|
+
* Party order is intentional: a host-to-tenant agreement is distinct from a
|
|
15
|
+
* tenant-to-host agreement unless the consumer models them as the same kind.
|
|
16
|
+
*/
|
|
17
|
+
export declare class AgreementCollection extends SmrtCollection<Agreement> {
|
|
18
|
+
static readonly _itemClass: typeof Agreement;
|
|
19
|
+
findVersions(kind: string, partyA: AgreementParty, partyB: AgreementParty): Promise<Agreement[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the sole version governing `at`. This is a historical query:
|
|
22
|
+
* a superseded or terminated row can still govern before its exclusive
|
|
23
|
+
* `effectiveTo`; today's lifecycle status alone is never used to answer a
|
|
24
|
+
* record-date lookup. Drafts never govern.
|
|
25
|
+
*
|
|
26
|
+
* Generated amendments are non-overlapping because the predecessor ends at
|
|
27
|
+
* the successor's inclusive start. If imported or manually-created rows do
|
|
28
|
+
* overlap, this helper throws instead of silently selecting a version.
|
|
29
|
+
*/
|
|
30
|
+
activeFor(kind: string, partyA: AgreementParty, partyB: AgreementParty, at?: Date, tenantId?: string | null): Promise<Agreement | null>;
|
|
31
|
+
/** Creates the next unsigned/draft version without changing prior history. */
|
|
32
|
+
createAmendment(kind: string, partyA: AgreementParty, partyB: AgreementParty, changes?: AgreementAmendmentChanges): Promise<Agreement>;
|
|
33
|
+
/**
|
|
34
|
+
* Activates an amendment and closes any currently governing predecessor at
|
|
35
|
+
* the new version's start. The interval is `[from, to)`, so equal boundary
|
|
36
|
+
* timestamps do not overlap. A future-dated amendment may be activated in
|
|
37
|
+
* advance; record-date lookup still selects its predecessor until `from`.
|
|
38
|
+
*/
|
|
39
|
+
activateAmendment(id: string): Promise<Agreement>;
|
|
40
|
+
/** Withdraw a scheduled successor before it has ever governed.
|
|
41
|
+
* Restores only its persisted predecessor boundary, in the same transaction.
|
|
42
|
+
* Repeated/concurrent withdrawal refuses rather than applying recovery twice.
|
|
43
|
+
*/
|
|
44
|
+
withdrawAmendment(id: string): Promise<Agreement>;
|
|
45
|
+
private findGoverningCandidates;
|
|
46
|
+
private ambientTenantId;
|
|
47
|
+
private runTransaction;
|
|
48
|
+
}
|
|
49
|
+
export default AgreementCollection;
|
|
50
|
+
//# sourceMappingURL=AgreementCollection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgreementCollection.d.ts","sourceRoot":"","sources":["../../../src/agreements/collections/AgreementCollection.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAE3D,OAAO,EAKL,cAAc,EAEf,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAAE,SAAS,EAA2B,MAAM,wBAAwB,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAMD;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,SAAS,CAAC;IAChE,MAAM,CAAC,QAAQ,CAAC,UAAU,mBAAa;IAEjC,YAAY,CAChB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,SAAS,EAAE,CAAC;IASvB;;;;;;;;;OASG;IACG,SAAS,CACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,cAAc,EACtB,EAAE,GAAE,IAAiB,EACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GACvB,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IA2C5B,8EAA8E;IACxE,eAAe,CACnB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,SAAS,CAAC;IA2DrB;;;;;OAKG;IACG,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IA6FvD;;;OAGG;IACG,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;YAmGzC,uBAAuB;IAqCrC,OAAO,CAAC,eAAe;YAIT,cAAc;CAc7B;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
+
export { type AgreementAmendmentChanges, AgreementCollection, } from './collections/AgreementCollection.js';
|
|
10
11
|
export { AgreementExecutionCollection } from './collections/AgreementExecutionCollection.js';
|
|
11
12
|
export { AgreementExecutionEventCollection } from './collections/AgreementExecutionEventCollection.js';
|
|
12
13
|
export { ExecutedAgreementCollection } from './collections/ExecutedAgreementCollection.js';
|
|
14
|
+
export { Agreement, parseAgreementParty, serializeAgreementParty, } from './models/Agreement.js';
|
|
13
15
|
export { AgreementExecution } from './models/AgreementExecution.js';
|
|
14
16
|
export { AgreementExecutionEvent } from './models/AgreementExecutionEvent.js';
|
|
15
17
|
export { ExecutedAgreement } from './models/ExecutedAgreement.js';
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agreements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,KAAK,yBAAyB,EAC9B,mBAAmB,GACpB,MAAM,sCAAsC,CAAC;AAC9C,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,EACL,SAAS,EACT,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,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,67 @@
|
|
|
1
|
+
/** Generic versioned, effective-dated commercial terms. */
|
|
2
|
+
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
3
|
+
import { type AgreementOptions, type AgreementParty, type AgreementStatus } from '../types.js';
|
|
4
|
+
/** Validates and canonically serializes a public counterparty descriptor. */
|
|
5
|
+
export declare function serializeAgreementParty(party: AgreementParty): string;
|
|
6
|
+
/** Parses an agreement party, rejecting corrupt persisted values when active. */
|
|
7
|
+
export declare function parseAgreementParty(value: string): AgreementParty | null;
|
|
8
|
+
export declare class Agreement extends SmrtObject {
|
|
9
|
+
tenantId: string | null;
|
|
10
|
+
/** Open application-defined agreement kind, e.g. `revenue_share`. */
|
|
11
|
+
kind: string;
|
|
12
|
+
/** Canonical JSON {@link AgreementParty}; order is semantically meaningful. */
|
|
13
|
+
partyA: string;
|
|
14
|
+
/** Canonical JSON {@link AgreementParty}; order is semantically meaningful. */
|
|
15
|
+
partyB: string;
|
|
16
|
+
/** Monotonic version within tenant, kind, and ordered counterparties. */
|
|
17
|
+
version: number;
|
|
18
|
+
status: AgreementStatus;
|
|
19
|
+
/** JSON object containing consumer-defined, frozen commercial terms. */
|
|
20
|
+
terms: string;
|
|
21
|
+
/** Inclusive start of the effective interval; null means no lower bound. */
|
|
22
|
+
effectiveFrom: Date | null;
|
|
23
|
+
/**
|
|
24
|
+
* Exclusive end of the effective interval; null means no upper bound.
|
|
25
|
+
* It is the one lifecycle-derived field: `AgreementCollection.activateAmendment`
|
|
26
|
+
* closes a predecessor at the new version's start in the same transition.
|
|
27
|
+
*/
|
|
28
|
+
effectiveTo: Date | null;
|
|
29
|
+
/** Optional immutable e-sign evidence for this exact agreement version. */
|
|
30
|
+
executedAgreementId: string | null;
|
|
31
|
+
/** Activation provenance used only for withdrawing a not-yet-effective amendment. */
|
|
32
|
+
amendmentPredecessorId: string | null;
|
|
33
|
+
amendmentPredecessorEnd: Date | null;
|
|
34
|
+
metadata: string;
|
|
35
|
+
constructor(options?: AgreementOptions);
|
|
36
|
+
initialize(): Promise<this>;
|
|
37
|
+
isDraft(): boolean;
|
|
38
|
+
isActive(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Tests the half-open effective interval `[effectiveFrom, effectiveTo)`.
|
|
41
|
+
* This makes an amendment starting at `T` and its predecessor ending at
|
|
42
|
+
* `T` non-overlapping. Lifecycle status is intentionally not considered.
|
|
43
|
+
*/
|
|
44
|
+
isEffectiveAt(at: Date): boolean;
|
|
45
|
+
getPartyA(): AgreementParty | null;
|
|
46
|
+
getPartyB(): AgreementParty | null;
|
|
47
|
+
setPartyA(party: AgreementParty): void;
|
|
48
|
+
setPartyB(party: AgreementParty): void;
|
|
49
|
+
getTerms(): Record<string, unknown>;
|
|
50
|
+
setTerms(terms: Record<string, unknown>): void;
|
|
51
|
+
activate(): void;
|
|
52
|
+
supersede(): void;
|
|
53
|
+
terminate(at?: Date): void;
|
|
54
|
+
save(): Promise<this>;
|
|
55
|
+
/** @internal Complete observation of a collection-owned guarded transition. */
|
|
56
|
+
refreshAfterLifecycleTransition(): Promise<void>;
|
|
57
|
+
private assertActivationProvenanceUnchanged;
|
|
58
|
+
private assertEffectiveIntervalUnchanged;
|
|
59
|
+
private assertValidTerms;
|
|
60
|
+
private assertNaturalKeyNotTaken;
|
|
61
|
+
private resolvePriorStatus;
|
|
62
|
+
private assertStatusTransition;
|
|
63
|
+
private assertFrozenTermsUnchanged;
|
|
64
|
+
private serializeFrozenTerms;
|
|
65
|
+
}
|
|
66
|
+
export default Agreement;
|
|
67
|
+
//# sourceMappingURL=Agreement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Agreement.d.ts","sourceRoot":"","sources":["../../../src/agreements/models/Agreement.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAE3D,OAAO,EAAqB,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,eAAe,EAErB,MAAM,aAAa,CAAC;AAcrB,6EAA6E;AAC7E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAYrE;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAoBxE;AAED,qBASa,SAAU,SAAQ,UAAU;IAEvC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE/B,qEAAqE;IAErE,IAAI,EAAE,MAAM,CAAM;IAElB,+EAA+E;IAE/E,MAAM,EAAE,MAAM,CAAM;IAEpB,+EAA+E;IAE/E,MAAM,EAAE,MAAM,CAAM;IAEpB,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAK;IAEpB,MAAM,EAAE,eAAe,CAAW;IAElC,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAQ;IAErB,4EAA4E;IAC5E,aAAa,EAAE,IAAI,GAAG,IAAI,CAAQ;IAElC;;;;OAIG;IACH,WAAW,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEhC,2EAA2E;IAE3E,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE1C,qFAAqF;IAErF,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE7C,uBAAuB,EAAE,IAAI,GAAG,IAAI,CAAQ;IAE5C,QAAQ,EAAE,MAAM,CAAQ;gBAEZ,OAAO,GAAE,gBAAqB;IAwB3B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB1C,OAAO,IAAI,OAAO;IAIlB,QAAQ,IAAI,OAAO;IAInB;;;;OAIG;IACH,aAAa,CAAC,EAAE,EAAE,IAAI,GAAG,OAAO;IAOhC,SAAS,IAAI,cAAc,GAAG,IAAI;IAIlC,SAAS,IAAI,cAAc,GAAG,IAAI;IAIlC,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAItC,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAItC,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAInC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAO9C,QAAQ,IAAI,IAAI;IAUhB,SAAS,IAAI,IAAI;IAcjB,SAAS,CAAC,EAAE,GAAE,IAAiB,GAAG,IAAI;IAevB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA4BpC,+EAA+E;IACzE,+BAA+B,IAAI,OAAO,CAAC,IAAI,CAAC;YAWxC,mCAAmC;IAkBjD,OAAO,CAAC,gCAAgC;IAoBxC,OAAO,CAAC,gBAAgB;YA0BV,wBAAwB;YAkCxB,kBAAkB;IAYhC,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,0BAA0B;IASlC,OAAO,CAAC,oBAAoB;CAc7B;AAaD,eAAe,SAAS,CAAC"}
|
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
/** Provider-neutral agreement execution contracts. */
|
|
2
2
|
import type { SignatureAuthenticationMethod, SignatureDocument, SignatureSigner, SignatureSignerInput } from '@happyvertical/signatures';
|
|
3
3
|
import type { SmrtObjectOptions } from '@happyvertical/smrt-core';
|
|
4
|
+
/**
|
|
5
|
+
* A counterparty named by an application-owned kind and stable identifier.
|
|
6
|
+
*
|
|
7
|
+
* The agreements package deliberately does not import tenant, earner, profile,
|
|
8
|
+
* or application-domain models. Consumers may use `tenant`, `earner`, and
|
|
9
|
+
* `profile` kinds, or their own neutral kinds such as `organization` and
|
|
10
|
+
* `worker`. The value is stored canonically as JSON so it can be part of an
|
|
11
|
+
* agreement version's natural identity.
|
|
12
|
+
*/
|
|
13
|
+
export interface AgreementParty {
|
|
14
|
+
kind: string;
|
|
15
|
+
id: string;
|
|
16
|
+
}
|
|
17
|
+
/** Drafts activate or cancel; previously active versions supersede or terminate. */
|
|
18
|
+
export declare const AGREEMENT_STATUSES: readonly ["draft", "cancelled", "active", "superseded", "terminated"];
|
|
19
|
+
export type AgreementStatus = (typeof AGREEMENT_STATUSES)[number];
|
|
20
|
+
/** Constructor options for a generic, versioned commercial agreement. */
|
|
21
|
+
export interface AgreementOptions extends SmrtObjectOptions {
|
|
22
|
+
tenantId?: string | null;
|
|
23
|
+
kind?: string;
|
|
24
|
+
partyA?: string;
|
|
25
|
+
partyB?: string;
|
|
26
|
+
version?: number;
|
|
27
|
+
status?: AgreementStatus;
|
|
28
|
+
terms?: string;
|
|
29
|
+
effectiveFrom?: Date | string | number | null;
|
|
30
|
+
effectiveTo?: Date | string | number | null;
|
|
31
|
+
executedAgreementId?: string | null;
|
|
32
|
+
amendmentPredecessorId?: string | null;
|
|
33
|
+
amendmentPredecessorEnd?: Date | string | number | null;
|
|
34
|
+
metadata?: string;
|
|
35
|
+
}
|
|
4
36
|
export declare const AGREEMENT_EXECUTION_STATUSES: readonly ["prepared", "sent", "delivered", "viewed", "partially_signed", "completed", "declined", "cancelled", "expired", "failed"];
|
|
5
37
|
export type AgreementExecutionStatus = (typeof AGREEMENT_EXECUTION_STATUSES)[number];
|
|
6
38
|
export interface AgreementSignerIntent {
|
|
@@ -1 +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,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-sales/agreements`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* immutable executed-agreement artifacts.
|
|
4
|
+
* Generic versioned terms, provider-neutral signature orchestration, verified
|
|
5
|
+
* lifecycle evidence, and immutable executed-agreement artifacts.
|
|
6
6
|
*/
|
|
7
7
|
import './__smrt-register__.js';
|
|
8
8
|
export * from './agreements/index.js';
|
package/dist/agreements.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./chunks/__smrt-register__-
|
|
2
|
-
import { a as AgreementExecutionEvent, c as
|
|
3
|
-
export { AGREEMENT_EXECUTION_STATUSES, AgreementExecution, AgreementExecutionCollection, AgreementExecutionEvent, AgreementExecutionEventCollection, AgreementExecutionService, ExecutedAgreement, ExecutedAgreementCollection, coerceAgreementDate, sanitizeSignerEvidence, sanitizeSignerIntent };
|
|
1
|
+
import "./chunks/__smrt-register__-DTUQW7wz.js";
|
|
2
|
+
import { a as AgreementExecutionEvent, c as AgreementCollection, d as serializeAgreementParty, f as AGREEMENT_EXECUTION_STATUSES, g as sanitizeSignerIntent, h as sanitizeSignerEvidence, i as AgreementExecutionEventCollection, l as Agreement, m as coerceAgreementDate, n as ExecutedAgreementCollection, o as AgreementExecutionCollection, p as AGREEMENT_STATUSES, r as ExecutedAgreement, s as AgreementExecution, t as AgreementExecutionService, u as parseAgreementParty } from "./chunks/agreements-jBiVmttD.js";
|
|
3
|
+
export { AGREEMENT_EXECUTION_STATUSES, AGREEMENT_STATUSES, Agreement, AgreementCollection, AgreementExecution, AgreementExecutionCollection, AgreementExecutionEvent, AgreementExecutionEventCollection, AgreementExecutionService, ExecutedAgreement, ExecutedAgreementCollection, coerceAgreementDate, parseAgreementParty, sanitizeSignerEvidence, sanitizeSignerIntent, serializeAgreementParty };
|