@pacspace-io/sdk 0.9.0 → 0.15.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.
- package/README.md +53 -132
- package/dist/blinding-file.d.ts +13 -0
- package/dist/blinding-file.d.ts.map +1 -0
- package/dist/blinding-guard.d.ts +7 -0
- package/dist/blinding-guard.d.ts.map +1 -0
- package/dist/blinding.d.ts +32 -0
- package/dist/blinding.d.ts.map +1 -0
- package/dist/client.d.ts +28 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/fingerprint.d.ts +26 -5
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/index.d.ts +35 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7366 -186
- package/dist/index.js.map +7 -1
- package/dist/inputs.txt +132 -0
- package/dist/records-crypto-libraries.json +42 -0
- package/dist/records-crypto-types/proof/hiding-commitment-v1.d.ts +19 -0
- package/dist/records-crypto-types/proof/jcs.d.ts +4 -0
- package/dist/records-crypto-types/proof/layout-document-v1.d.ts +72 -0
- package/dist/records-crypto-types/proof/ledger-head-v1.d.ts +22 -0
- package/dist/records-crypto-types/proof/merkle-v2.d.ts +5 -0
- package/dist/records-crypto-types/proof/payload-ref-v1.d.ts +17 -0
- package/dist/records-crypto-types/proof/seal-input.d.ts +2 -0
- package/dist/records-crypto-types/proof/semantic-receipt-v2.d.ts +89 -0
- package/dist/records-crypto-types/proof/semantic-receipt-v3.d.ts +20 -0
- package/dist/records-crypto-types/proof/slot-encoding-v1.d.ts +169 -0
- package/dist/records-crypto-types/records/flag-threads-v1.d.ts +53 -0
- package/dist/records-crypto-types/records/labels.d.ts +37 -0
- package/dist/records-crypto-types/records/reader-crypto-v1.d.ts +198 -0
- package/dist/records-crypto-types/records/reader-link-v1.d.ts +164 -0
- package/dist/records-crypto-types/records/shared-record-ack-v2.d.ts +72 -0
- package/dist/records-crypto-types/records/signed-acknowledgment-v1.d.ts +38 -0
- package/dist/records-crypto-types/records/signed-acknowledgment-v2.d.ts +12 -0
- package/dist/records-crypto-types/records/trail-index-v1.d.ts +89 -0
- package/dist/records-crypto-types/records/trail-rule.d.ts +54 -0
- package/dist/records-crypto-types/records-crypto/asymmetric/ack-flag-notes-v1.d.ts +57 -0
- package/dist/records-crypto-types/records-crypto/asymmetric/flag-notes-v1.d.ts +55 -0
- package/dist/records-crypto-types/records-crypto/asymmetric/index.d.ts +4 -0
- package/dist/records-crypto-types/records-crypto/asymmetric/reader-wraps-v1.d.ts +83 -0
- package/dist/records-crypto-types/records-crypto/asymmetric/records-asymmetric-v1.d.ts +201 -0
- package/dist/records-crypto-types/records-crypto/base64url.d.ts +3 -0
- package/dist/records-crypto-types/records-crypto/blinding-file.d.ts +16 -0
- package/dist/records-crypto-types/records-crypto/blinding-value.d.ts +10 -0
- package/dist/records-crypto-types/records-crypto/bundle-entry.d.ts +2 -0
- package/dist/records-crypto-types/records-crypto/disclosure-envelope-v1.d.ts +42 -0
- package/dist/records-crypto-types/records-crypto/held-file.d.ts +17 -0
- package/dist/records-crypto-types/records-crypto/hmac-node.d.ts +8 -0
- package/dist/records-crypto-types/records-crypto/hmac-web.d.ts +8 -0
- package/dist/records-crypto-types/records-crypto/index.d.ts +13 -0
- package/dist/records-crypto-types/records-crypto/platform-crypto.d.ts +9 -0
- package/dist/records-crypto-types/records-crypto/record-disclosure-v1.d.ts +171 -0
- package/dist/records-crypto-types/records-crypto/record-hash-v2.d.ts +49 -0
- package/dist/records-crypto-types/records-crypto/record-hash-v3.d.ts +36 -0
- package/dist/records-crypto-types/records-crypto/records-encryption-v1.d.ts +185 -0
- package/dist/records-crypto-types/records-crypto/wrap-shapes-v1.d.ts +23 -0
- package/dist/records-crypto.d.ts +1 -0
- package/dist/records-crypto.js +16105 -0
- package/dist/records-crypto.js.map +7 -0
- package/dist/records-encryption/base64url.d.ts +5 -0
- package/dist/records-encryption/base64url.d.ts.map +1 -0
- package/dist/records-encryption/encrypted-records.d.ts +338 -0
- package/dist/records-encryption/encrypted-records.d.ts.map +1 -0
- package/dist/records-encryption/index.d.ts +14 -0
- package/dist/records-encryption/index.d.ts.map +1 -0
- package/dist/records-encryption/keys.d.ts +40 -0
- package/dist/records-encryption/keys.d.ts.map +1 -0
- package/dist/records-encryption/loader.d.ts +15 -0
- package/dist/records-encryption/loader.d.ts.map +1 -0
- package/dist/records-encryption/pin-store-file.d.ts +8 -0
- package/dist/records-encryption/pin-store-file.d.ts.map +1 -0
- package/dist/records-encryption/pin-store.d.ts +17 -0
- package/dist/records-encryption/pin-store.d.ts.map +1 -0
- package/dist/records-encryption/transport.d.ts +23 -0
- package/dist/records-encryption/transport.d.ts.map +1 -0
- package/dist/records-encryption/words.d.ts +40 -0
- package/dist/records-encryption/words.d.ts.map +1 -0
- package/dist/records-encryption/workspace-secret.d.ts +9 -0
- package/dist/records-encryption/workspace-secret.d.ts.map +1 -0
- package/dist/resources/records.d.ts +112 -2
- package/dist/resources/records.d.ts.map +1 -1
- package/dist/types/common.d.ts +0 -8
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/config.d.ts +7 -5
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/records-encryption.d.ts +136 -0
- package/dist/types/records-encryption.d.ts.map +1 -0
- package/dist/types/records.d.ts +171 -20
- package/dist/types/records.d.ts.map +1 -1
- package/dist/types/verify.d.ts +84 -0
- package/dist/types/verify.d.ts.map +1 -0
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.d.ts.map +1 -1
- package/dist/webhooks/index.js +229 -5
- package/dist/webhooks/index.js.map +7 -1
- package/dist/webhooks/types.d.ts +15 -7
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workspace-secret-file.d.ts +18 -0
- package/dist/workspace-secret-file.d.ts.map +1 -0
- package/package.json +16 -13
- package/dist/client.js +0 -553
- package/dist/client.js.map +0 -1
- package/dist/errors/index.js +0 -223
- package/dist/errors/index.js.map +0 -1
- package/dist/fingerprint.js +0 -132
- package/dist/fingerprint.js.map +0 -1
- package/dist/resources/balance.d.ts +0 -384
- package/dist/resources/balance.d.ts.map +0 -1
- package/dist/resources/balance.js +0 -1120
- package/dist/resources/balance.js.map +0 -1
- package/dist/resources/customers.d.ts +0 -33
- package/dist/resources/customers.d.ts.map +0 -1
- package/dist/resources/customers.js +0 -26
- package/dist/resources/customers.js.map +0 -1
- package/dist/resources/internal/batch-transport.d.ts +0 -65
- package/dist/resources/internal/batch-transport.d.ts.map +0 -1
- package/dist/resources/internal/batch-transport.js +0 -42
- package/dist/resources/internal/batch-transport.js.map +0 -1
- package/dist/resources/receipts.d.ts +0 -46
- package/dist/resources/receipts.d.ts.map +0 -1
- package/dist/resources/receipts.js +0 -133
- package/dist/resources/receipts.js.map +0 -1
- package/dist/resources/records.js +0 -232
- package/dist/resources/records.js.map +0 -1
- package/dist/resources/submission.d.ts +0 -79
- package/dist/resources/submission.d.ts.map +0 -1
- package/dist/resources/submission.js +0 -398
- package/dist/resources/submission.js.map +0 -1
- package/dist/types/balance.d.ts +0 -966
- package/dist/types/balance.d.ts.map +0 -1
- package/dist/types/balance.js +0 -3
- package/dist/types/balance.js.map +0 -1
- package/dist/types/common.js +0 -3
- package/dist/types/common.js.map +0 -1
- package/dist/types/config.js +0 -3
- package/dist/types/config.js.map +0 -1
- package/dist/types/records.js +0 -5
- package/dist/types/records.js.map +0 -1
- package/dist/types/submission.d.ts +0 -125
- package/dist/types/submission.d.ts.map +0 -1
- package/dist/types/submission.js +0 -3
- package/dist/types/submission.js.map +0 -1
- package/dist/utils/polling.d.ts +0 -32
- package/dist/utils/polling.d.ts.map +0 -1
- package/dist/utils/polling.js +0 -52
- package/dist/utils/polling.js.map +0 -1
- package/dist/utils/retry.js +0 -21
- package/dist/utils/retry.js.map +0 -1
- package/dist/webhooks/types.js +0 -3
- package/dist/webhooks/types.js.map +0 -1
- package/dist/webhooks/verify.js +0 -191
- package/dist/webhooks/verify.js.map +0 -1
package/dist/types/balance.d.ts
DELETED
|
@@ -1,966 +0,0 @@
|
|
|
1
|
-
import type { RecordStatus, CheckpointType } from './common';
|
|
2
|
-
import type { RequestOptions } from './config';
|
|
3
|
-
/**
|
|
4
|
-
* Options for `balance.emit()`.
|
|
5
|
-
*/
|
|
6
|
-
export type AdjustsRef = {
|
|
7
|
-
referenceId: string;
|
|
8
|
-
} | {
|
|
9
|
-
recordId: string;
|
|
10
|
-
};
|
|
11
|
-
export interface EmitOptions extends RequestOptions {
|
|
12
|
-
/** Your internal reference ID for correlation. */
|
|
13
|
-
referenceId?: string;
|
|
14
|
-
/** Arbitrary key-value metadata to store with the delta. */
|
|
15
|
-
metadata?: Record<string, unknown>;
|
|
16
|
-
/**
|
|
17
|
-
* The committed entry this delta adjusts (E1d). Either the original's
|
|
18
|
-
* `referenceId` or its `recordId`. Omitted on an ordinary emit.
|
|
19
|
-
*/
|
|
20
|
-
adjusts?: AdjustsRef;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Options for `balance.emitAndWait()`.
|
|
24
|
-
*/
|
|
25
|
-
export interface EmitAndWaitOptions extends EmitOptions {
|
|
26
|
-
/**
|
|
27
|
-
* Maximum time (ms) to wait for verification before throwing.
|
|
28
|
-
* @default 60000
|
|
29
|
-
*/
|
|
30
|
-
timeout?: number;
|
|
31
|
-
/**
|
|
32
|
-
* Interval (ms) between status polls.
|
|
33
|
-
* @default 2000
|
|
34
|
-
*/
|
|
35
|
-
pollInterval?: number;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Response from `balance.emit()` — records a usage event as a verified delta.
|
|
39
|
-
*/
|
|
40
|
-
export interface EmitResponse {
|
|
41
|
-
/** Unique identifier for this recorded submission. */
|
|
42
|
-
recordId: string;
|
|
43
|
-
/** The customer account this delta belongs to. */
|
|
44
|
-
customerId: string;
|
|
45
|
-
/** The recorded adjustment amount. */
|
|
46
|
-
delta: number;
|
|
47
|
-
/** Monotonic per-customer sequence number used for gap detection. */
|
|
48
|
-
sequenceNumber?: string;
|
|
49
|
-
/** Current processing status. */
|
|
50
|
-
status: RecordStatus;
|
|
51
|
-
/**
|
|
52
|
-
* Stable opaque identifier of the receipt for this submission. Use it with
|
|
53
|
-
* `receipts.*` to retrieve the receipt document. It is not the proof root
|
|
54
|
-
* and cannot be derived from it.
|
|
55
|
-
*/
|
|
56
|
-
receiptId: string;
|
|
57
|
-
/** Root covering the items in this submission. Share it so anyone can verify. */
|
|
58
|
-
proofRoot: string;
|
|
59
|
-
/**
|
|
60
|
-
* Individual content fingerprints for each item.
|
|
61
|
-
* Same content always produces the same fingerprint.
|
|
62
|
-
* @alias contentFingerprints
|
|
63
|
-
*/
|
|
64
|
-
itemHashes: string[];
|
|
65
|
-
/** Estimated number of verified deltas this submission will produce. */
|
|
66
|
-
estimatedVerifiedDeltas: number;
|
|
67
|
-
/** Estimated credits that will be consumed upon verification. */
|
|
68
|
-
estimatedCredits: number;
|
|
69
|
-
/** ISO 8601 timestamp of when the submission was received. */
|
|
70
|
-
receivedAt: string;
|
|
71
|
-
/** Human-readable status message. */
|
|
72
|
-
message: string;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Developer-friendly alias: `proofRoot` is the proof root — the single
|
|
76
|
-
* fingerprint covering every item in a submission or derivation.
|
|
77
|
-
*/
|
|
78
|
-
export type ProofRoot = string;
|
|
79
|
-
/**
|
|
80
|
-
* Developer-friendly alias: `itemHashes` are content fingerprints — each
|
|
81
|
-
* one uniquely identifies a single item's content.
|
|
82
|
-
*/
|
|
83
|
-
export type ContentFingerprint = string;
|
|
84
|
-
/**
|
|
85
|
-
* Options for `balance.derive()` — computes the neutral, independently
|
|
86
|
-
* verifiable balance from all verified deltas.
|
|
87
|
-
*/
|
|
88
|
-
type DeriveWindowOptions = {
|
|
89
|
-
period: string;
|
|
90
|
-
timePreset?: never;
|
|
91
|
-
startDate?: never;
|
|
92
|
-
endDate?: never;
|
|
93
|
-
} | {
|
|
94
|
-
timePreset: 'current_month' | 'last_30_days' | 'last_90_days';
|
|
95
|
-
period?: never;
|
|
96
|
-
startDate?: never;
|
|
97
|
-
endDate?: never;
|
|
98
|
-
} | {
|
|
99
|
-
timePreset: 'custom';
|
|
100
|
-
startDate: string;
|
|
101
|
-
endDate: string;
|
|
102
|
-
period?: never;
|
|
103
|
-
} | {
|
|
104
|
-
period?: never;
|
|
105
|
-
timePreset?: never;
|
|
106
|
-
startDate?: never;
|
|
107
|
-
endDate?: never;
|
|
108
|
-
};
|
|
109
|
-
type DeriveScopeMode = {
|
|
110
|
-
startingCheckpoint?: never;
|
|
111
|
-
startingCheckpointType?: never;
|
|
112
|
-
} & DeriveWindowOptions;
|
|
113
|
-
type DeriveCheckpointMode = {
|
|
114
|
-
startingCheckpoint: string;
|
|
115
|
-
startingCheckpointType?: CheckpointType;
|
|
116
|
-
period?: never;
|
|
117
|
-
timePreset?: never;
|
|
118
|
-
startDate?: never;
|
|
119
|
-
endDate?: never;
|
|
120
|
-
};
|
|
121
|
-
export type DeriveOptions = RequestOptions & {
|
|
122
|
-
/**
|
|
123
|
-
* Starting balance to derive from.
|
|
124
|
-
* @default 0
|
|
125
|
-
*/
|
|
126
|
-
startingBalance?: number;
|
|
127
|
-
/** Number of deltas to return per page (1-1000). Balance is always computed from all deltas. */
|
|
128
|
-
limit?: number;
|
|
129
|
-
/** Number of deltas to skip. */
|
|
130
|
-
offset?: number;
|
|
131
|
-
} & (DeriveScopeMode | DeriveCheckpointMode);
|
|
132
|
-
export interface BalanceScopeSummary {
|
|
133
|
-
kind: 'period' | 'preset' | 'custom';
|
|
134
|
-
periodId: string | null;
|
|
135
|
-
preset: CheckpointTimePreset | null;
|
|
136
|
-
startDate: string;
|
|
137
|
-
endDateExclusive: string;
|
|
138
|
-
label: string;
|
|
139
|
-
}
|
|
140
|
-
export interface MonthlyBreakdownEntry {
|
|
141
|
-
period: string;
|
|
142
|
-
periodStart: string;
|
|
143
|
-
periodEndExclusive: string;
|
|
144
|
-
deltaCount: number;
|
|
145
|
-
netDelta: number;
|
|
146
|
-
runningBalance: number;
|
|
147
|
-
checkpoint: {
|
|
148
|
-
checkpointId: string;
|
|
149
|
-
proofRoot: string | null;
|
|
150
|
-
status: RecordStatus;
|
|
151
|
-
} | null;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* A single verified delta — a usage event that has been permanently recorded
|
|
155
|
-
* and can be independently verified by any party.
|
|
156
|
-
*/
|
|
157
|
-
export interface VerifiedDelta {
|
|
158
|
-
recordId: string;
|
|
159
|
-
/** Content fingerprint — confirms this delta's content hasn't been altered. */
|
|
160
|
-
itemHash: ContentFingerprint;
|
|
161
|
-
/** Proof root — the single fingerprint covering the group this delta belongs to. */
|
|
162
|
-
proofRoot: ProofRoot;
|
|
163
|
-
/** Stable opaque receipt identifier; not the proof root. */
|
|
164
|
-
receiptId: string;
|
|
165
|
-
/** Monotonic per-customer sequence number used for gap detection. */
|
|
166
|
-
sequenceNumber: string | null;
|
|
167
|
-
delta: number;
|
|
168
|
-
reason: string | null;
|
|
169
|
-
referenceId: string | null;
|
|
170
|
-
window: string;
|
|
171
|
-
declaredTimestamp: string | null;
|
|
172
|
-
blockTimestamp: string | null;
|
|
173
|
-
dataPurged: boolean;
|
|
174
|
-
verified: true;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Summary of deltas within a time window.
|
|
178
|
-
*/
|
|
179
|
-
export interface WindowSummary {
|
|
180
|
-
window: string;
|
|
181
|
-
deltasCount: number;
|
|
182
|
-
netDelta: number;
|
|
183
|
-
firstBlockTimestamp: string | null;
|
|
184
|
-
lastBlockTimestamp: string | null;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Response from `balance.derive()`.
|
|
188
|
-
*/
|
|
189
|
-
export interface DeriveResponse {
|
|
190
|
-
customerId: string;
|
|
191
|
-
startingBalance: number;
|
|
192
|
-
startingCheckpoint: string;
|
|
193
|
-
startingCheckpointType: CheckpointType;
|
|
194
|
-
deltasCount: number;
|
|
195
|
-
computedBalance: number;
|
|
196
|
-
latestCheckpoint: string | null;
|
|
197
|
-
latestReceiptId: string | null;
|
|
198
|
-
deltas: VerifiedDelta[];
|
|
199
|
-
windowSummaries: WindowSummary[];
|
|
200
|
-
verificationProof: {
|
|
201
|
-
proofRoot: string | null;
|
|
202
|
-
message: string;
|
|
203
|
-
};
|
|
204
|
-
scope: BalanceScopeSummary | null;
|
|
205
|
-
monthlyBreakdown?: MonthlyBreakdownEntry[];
|
|
206
|
-
cumulativeBalance?: number;
|
|
207
|
-
/** Pagination info for the deltas array. */
|
|
208
|
-
pagination: {
|
|
209
|
-
total: number;
|
|
210
|
-
limit: number;
|
|
211
|
-
offset: number;
|
|
212
|
-
};
|
|
213
|
-
/** Hint to use checkpoints for large delta counts. Only present when delta count exceeds threshold. */
|
|
214
|
-
_hint?: {
|
|
215
|
-
message: string;
|
|
216
|
-
recommendation: string;
|
|
217
|
-
docsUrl: string;
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Options for `balance.compare()`.
|
|
222
|
-
*/
|
|
223
|
-
export type CompareOptions = RequestOptions & {
|
|
224
|
-
/**
|
|
225
|
-
* Starting balance for derivation.
|
|
226
|
-
* @default 0
|
|
227
|
-
*/
|
|
228
|
-
startingBalance?: number;
|
|
229
|
-
} & (({
|
|
230
|
-
startingCheckpoint?: never;
|
|
231
|
-
startingCheckpointType?: never;
|
|
232
|
-
} & DeriveWindowOptions) | {
|
|
233
|
-
startingCheckpoint: string;
|
|
234
|
-
startingCheckpointType?: CheckpointType;
|
|
235
|
-
period?: never;
|
|
236
|
-
timePreset?: never;
|
|
237
|
-
startDate?: never;
|
|
238
|
-
endDate?: never;
|
|
239
|
-
});
|
|
240
|
-
/**
|
|
241
|
-
* Balances to compare — your view vs. their view.
|
|
242
|
-
*/
|
|
243
|
-
export interface CompareBalances {
|
|
244
|
-
/** Your calculated balance. */
|
|
245
|
-
yours: number;
|
|
246
|
-
/** Customer's claimed balance. */
|
|
247
|
-
theirs: number;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Discrepancy details when balances don't match.
|
|
251
|
-
*/
|
|
252
|
-
export interface DiscrepancyReport {
|
|
253
|
-
amount: number;
|
|
254
|
-
resolution: string;
|
|
255
|
-
divergentParty: 'yours' | 'theirs' | 'both';
|
|
256
|
-
windowsToReview: Array<{
|
|
257
|
-
window: string;
|
|
258
|
-
netDelta: number;
|
|
259
|
-
deltasCount: number;
|
|
260
|
-
timeRange: string;
|
|
261
|
-
}>;
|
|
262
|
-
recommendation: string;
|
|
263
|
-
/** Top 5 most impactful windows, sorted by absolute netDelta. */
|
|
264
|
-
relevantWindows: Array<{
|
|
265
|
-
window: string;
|
|
266
|
-
netDelta: number;
|
|
267
|
-
deltasCount: number;
|
|
268
|
-
timeRange: string;
|
|
269
|
-
}>;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Response from `balance.compare()` — surfaces the exact point of divergence
|
|
273
|
-
* between two parties' views of a balance. PacSpace doesn't decide who's
|
|
274
|
-
* right; it shows where the numbers diverge so the math resolves the dispute.
|
|
275
|
-
*/
|
|
276
|
-
export interface CompareResponse {
|
|
277
|
-
customerId: string;
|
|
278
|
-
yourBalance: number;
|
|
279
|
-
theirBalance: number;
|
|
280
|
-
neutralBalance: number;
|
|
281
|
-
matchesYours: boolean;
|
|
282
|
-
matchesTheirs: boolean;
|
|
283
|
-
deltasVerified: number;
|
|
284
|
-
discrepancyReport: DiscrepancyReport | null;
|
|
285
|
-
proof: {
|
|
286
|
-
proofRoot: string | null;
|
|
287
|
-
latestCheckpoint: string | null;
|
|
288
|
-
windowSummaries: WindowSummary[];
|
|
289
|
-
};
|
|
290
|
-
scope: BalanceScopeSummary | null;
|
|
291
|
-
monthlyBreakdown?: MonthlyBreakdownEntry[];
|
|
292
|
-
cumulativeBalance?: number;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Response from `balance.receipt()` — a proof document covering all verified
|
|
296
|
-
* activity for a period. Share with your customer or auditor; they can verify
|
|
297
|
-
* every line item independently.
|
|
298
|
-
*/
|
|
299
|
-
export interface ReceiptResponse {
|
|
300
|
-
customerId: string;
|
|
301
|
-
generatedAt: string;
|
|
302
|
-
deltasCount: number;
|
|
303
|
-
finalBalance: number;
|
|
304
|
-
/** Proof root — the single fingerprint covering all deltas in this receipt. */
|
|
305
|
-
proofRoot: ProofRoot | null;
|
|
306
|
-
receiptId: string | null;
|
|
307
|
-
latestCheckpoint: string | null;
|
|
308
|
-
deltas: VerifiedDelta[];
|
|
309
|
-
windowSummaries: WindowSummary[];
|
|
310
|
-
verification: {
|
|
311
|
-
message: string;
|
|
312
|
-
/** Content fingerprints for each delta in the receipt. */
|
|
313
|
-
itemHashes: ContentFingerprint[];
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
export interface ReceiptStatementRow {
|
|
317
|
-
rowId: string;
|
|
318
|
-
timestamp: string;
|
|
319
|
-
description: string;
|
|
320
|
-
delta: number;
|
|
321
|
-
runningBalance: number;
|
|
322
|
-
status: 'verified' | 'pending' | 'failed';
|
|
323
|
-
referenceId: string | null;
|
|
324
|
-
dataPurged: boolean;
|
|
325
|
-
}
|
|
326
|
-
export interface ReceiptDailyTotal {
|
|
327
|
-
date: string;
|
|
328
|
-
deltaCount: number;
|
|
329
|
-
netDelta: number;
|
|
330
|
-
closingBalance: number;
|
|
331
|
-
}
|
|
332
|
-
export interface ReceiptDocument {
|
|
333
|
-
schemaVersion: 'v1';
|
|
334
|
-
receiptId: string;
|
|
335
|
-
checkpointId: string | null;
|
|
336
|
-
status: 'verified' | 'pending' | 'failed';
|
|
337
|
-
locale: string;
|
|
338
|
-
timezone: string;
|
|
339
|
-
unit: 'credits';
|
|
340
|
-
customerId: string | null;
|
|
341
|
-
customerDisplayName: string | null;
|
|
342
|
-
period: {
|
|
343
|
-
label: string;
|
|
344
|
-
startDate: string;
|
|
345
|
-
endDateExclusive: string;
|
|
346
|
-
timezoneLabel: string;
|
|
347
|
-
};
|
|
348
|
-
summary: {
|
|
349
|
-
openingBalance: number;
|
|
350
|
-
netDelta: number;
|
|
351
|
-
closingBalance: number;
|
|
352
|
-
deltaCount: number;
|
|
353
|
-
};
|
|
354
|
-
statementRows: ReceiptStatementRow[];
|
|
355
|
-
dailyTotals: ReceiptDailyTotal[];
|
|
356
|
-
tenant: {
|
|
357
|
-
tenantId: string;
|
|
358
|
-
name: string;
|
|
359
|
-
disputeUrl: string | null;
|
|
360
|
-
brandingRevision: number;
|
|
361
|
-
embedOrigins: string[];
|
|
362
|
-
};
|
|
363
|
-
verification: {
|
|
364
|
-
/**
|
|
365
|
-
* Present only on authorized presentations (tenant-authenticated fetch or
|
|
366
|
-
* a chain-bearing access grant). Ordinary receipt links strip direct
|
|
367
|
-
* chain-correlation fields and carry only proofRootPrefix (ADR 0008 §5).
|
|
368
|
-
*/
|
|
369
|
-
proofRoot: string | null;
|
|
370
|
-
proofRootPrefix?: string | null;
|
|
371
|
-
verificationReference: string | null;
|
|
372
|
-
recordedAt: string;
|
|
373
|
-
dataPurged: boolean;
|
|
374
|
-
};
|
|
375
|
-
links: {
|
|
376
|
-
permalink: string;
|
|
377
|
-
pdf: string;
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
export interface ReceiptListItem {
|
|
381
|
-
receiptId: string;
|
|
382
|
-
checkpointId: string | null;
|
|
383
|
-
period: string | null;
|
|
384
|
-
status: 'verified' | 'pending' | 'failed';
|
|
385
|
-
recordedAt: string;
|
|
386
|
-
receiptUrl: string;
|
|
387
|
-
}
|
|
388
|
-
export interface ReceiptGetOptions extends RequestOptions {
|
|
389
|
-
customerDisplayName?: boolean;
|
|
390
|
-
locale?: string;
|
|
391
|
-
timezone?: string;
|
|
392
|
-
unit?: 'credits';
|
|
393
|
-
}
|
|
394
|
-
export interface ReceiptListOptions extends RequestOptions {
|
|
395
|
-
limit?: number;
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* BEARER: anyone holding the grant token may retrieve the receipt.
|
|
399
|
-
* RECIPIENT_BOUND: retrieval additionally requires presenting the recipient
|
|
400
|
-
* email the grant was issued to.
|
|
401
|
-
*/
|
|
402
|
-
export type ReceiptGrantKind = 'BEARER' | 'RECIPIENT_BOUND';
|
|
403
|
-
/**
|
|
404
|
-
* SEMANTIC: record contents only — chain-correlation fields stay stripped.
|
|
405
|
-
* CHAIN_BEARING: a self-contained receipt that also carries the proof root
|
|
406
|
-
* and chain reference for independent verification.
|
|
407
|
-
*/
|
|
408
|
-
export type ReceiptGrantScope = 'SEMANTIC' | 'CHAIN_BEARING';
|
|
409
|
-
/**
|
|
410
|
-
* Display status derived from stored state: `expired` and `exhausted` are
|
|
411
|
-
* computed from expiry and use limits; only `revoked` is an explicit action.
|
|
412
|
-
*/
|
|
413
|
-
export type ReceiptGrantStatus = 'active' | 'revoked' | 'expired' | 'exhausted';
|
|
414
|
-
export interface ReceiptAccessGrant {
|
|
415
|
-
grantId: string;
|
|
416
|
-
receiptId: string;
|
|
417
|
-
/** SHARED_RECORD entries mirror customer-link step-up and are read-only here. */
|
|
418
|
-
kind: ReceiptGrantKind | 'SHARED_RECORD';
|
|
419
|
-
scope: ReceiptGrantScope;
|
|
420
|
-
status: ReceiptGrantStatus;
|
|
421
|
-
label: string | null;
|
|
422
|
-
/** Masked recipient email (for example `a***@counterparty.com`). */
|
|
423
|
-
recipientLabel: string | null;
|
|
424
|
-
expiresAt: string | null;
|
|
425
|
-
maxUses: number | null;
|
|
426
|
-
useCount: number;
|
|
427
|
-
lastUsedAt: string | null;
|
|
428
|
-
revokedAt: string | null;
|
|
429
|
-
revokeReason: string | null;
|
|
430
|
-
createdAt: string | null;
|
|
431
|
-
/** Grants are managed here; `customer_link` entries at the Shared Record. */
|
|
432
|
-
managedBy: 'grant' | 'customer_link';
|
|
433
|
-
revocable: boolean;
|
|
434
|
-
}
|
|
435
|
-
export interface CreateReceiptGrantParams {
|
|
436
|
-
kind: ReceiptGrantKind;
|
|
437
|
-
/** Defaults to SEMANTIC. */
|
|
438
|
-
scope?: ReceiptGrantScope;
|
|
439
|
-
/** ISO timestamp. Mutually exclusive with ttlHours; expiresAt wins. */
|
|
440
|
-
expiresAt?: string;
|
|
441
|
-
ttlHours?: number;
|
|
442
|
-
maxUses?: number;
|
|
443
|
-
/** Required when kind is RECIPIENT_BOUND. */
|
|
444
|
-
recipientEmail?: string;
|
|
445
|
-
label?: string;
|
|
446
|
-
}
|
|
447
|
-
export interface CreateReceiptGrantResponse {
|
|
448
|
-
grant: ReceiptAccessGrant;
|
|
449
|
-
/** Shown once — only its hash is stored. Deliver it to the counterparty. */
|
|
450
|
-
token: string;
|
|
451
|
-
/** Receipt permalink with the grant token attached. */
|
|
452
|
-
grantUrl: string;
|
|
453
|
-
}
|
|
454
|
-
export interface CheckpointTimelinePoint {
|
|
455
|
-
checkpointId: string;
|
|
456
|
-
period: string;
|
|
457
|
-
status: string;
|
|
458
|
-
proofRoot: string | null;
|
|
459
|
-
deltaCount: number;
|
|
460
|
-
recordedAt: string;
|
|
461
|
-
}
|
|
462
|
-
export interface CheckpointTimelineGap {
|
|
463
|
-
startDate: string;
|
|
464
|
-
endDateExclusive: string;
|
|
465
|
-
daysWithoutCheckpoint: number;
|
|
466
|
-
}
|
|
467
|
-
export interface CheckpointTimelineResponse {
|
|
468
|
-
customerId: string;
|
|
469
|
-
range: {
|
|
470
|
-
startDate: string;
|
|
471
|
-
endDateExclusive: string;
|
|
472
|
-
label: string;
|
|
473
|
-
};
|
|
474
|
-
points: CheckpointTimelinePoint[];
|
|
475
|
-
gaps: CheckpointTimelineGap[];
|
|
476
|
-
summary: {
|
|
477
|
-
checkpointCount: number;
|
|
478
|
-
coveredDays: number;
|
|
479
|
-
expectedDays: number;
|
|
480
|
-
gapCount: number;
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
export interface ListCheckpointTimelineOptions extends RequestOptions {
|
|
484
|
-
monthsBack?: number;
|
|
485
|
-
startDate?: string;
|
|
486
|
-
endDate?: string;
|
|
487
|
-
}
|
|
488
|
-
export interface CheckpointDiffResponse {
|
|
489
|
-
customerId: string;
|
|
490
|
-
left: {
|
|
491
|
-
checkpointId: string;
|
|
492
|
-
status: string;
|
|
493
|
-
recordedAt: string;
|
|
494
|
-
proofRoot: string | null;
|
|
495
|
-
deltaCount: number;
|
|
496
|
-
netDelta: number;
|
|
497
|
-
};
|
|
498
|
-
right: {
|
|
499
|
-
checkpointId: string;
|
|
500
|
-
status: string;
|
|
501
|
-
recordedAt: string;
|
|
502
|
-
proofRoot: string | null;
|
|
503
|
-
deltaCount: number;
|
|
504
|
-
netDelta: number;
|
|
505
|
-
};
|
|
506
|
-
difference: {
|
|
507
|
-
deltaCountDiff: number;
|
|
508
|
-
netDeltaDiff: number;
|
|
509
|
-
addedFingerprintsCount: number;
|
|
510
|
-
removedFingerprintsCount: number;
|
|
511
|
-
addedFingerprints: string[];
|
|
512
|
-
removedFingerprints: string[];
|
|
513
|
-
};
|
|
514
|
-
dailyDivergence: Array<{
|
|
515
|
-
date: string;
|
|
516
|
-
leftNet: number;
|
|
517
|
-
rightNet: number;
|
|
518
|
-
divergence: number;
|
|
519
|
-
}>;
|
|
520
|
-
}
|
|
521
|
-
export type CheckpointTimePreset = 'current_month' | 'last_30_days' | 'last_90_days' | 'custom';
|
|
522
|
-
export type CheckpointMode = 'full_scope' | 'selected_only';
|
|
523
|
-
export interface CheckpointScopeOptions {
|
|
524
|
-
/**
|
|
525
|
-
* Backward-compatible billing period in YYYY-MM format.
|
|
526
|
-
*/
|
|
527
|
-
period?: string;
|
|
528
|
-
/**
|
|
529
|
-
* Preset scope selector.
|
|
530
|
-
*/
|
|
531
|
-
timePreset?: CheckpointTimePreset;
|
|
532
|
-
/**
|
|
533
|
-
* Custom scope start date (ISO) used when timePreset=custom.
|
|
534
|
-
*/
|
|
535
|
-
startDate?: string;
|
|
536
|
-
/**
|
|
537
|
-
* Custom scope end date (ISO) used when timePreset=custom.
|
|
538
|
-
*/
|
|
539
|
-
endDate?: string;
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* Options for `balance.checkpoint()`.
|
|
543
|
-
*/
|
|
544
|
-
export interface CheckpointOptions extends CheckpointScopeOptions, RequestOptions {
|
|
545
|
-
/**
|
|
546
|
-
* Checkpoint computation mode.
|
|
547
|
-
*/
|
|
548
|
-
mode?: CheckpointMode;
|
|
549
|
-
/**
|
|
550
|
-
* Required when mode=selected_only.
|
|
551
|
-
*/
|
|
552
|
-
fingerprints?: string[];
|
|
553
|
-
}
|
|
554
|
-
export interface CheckpointScopeSummary {
|
|
555
|
-
preset: CheckpointTimePreset;
|
|
556
|
-
startDate: string;
|
|
557
|
-
endDateExclusive: string;
|
|
558
|
-
label: string;
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Response from `balance.checkpoint()` — locks all verified activity for
|
|
562
|
-
* a billing period into a single proof. Include it on your invoice so your
|
|
563
|
-
* customer can verify every charge.
|
|
564
|
-
*/
|
|
565
|
-
export interface CheckpointResponse {
|
|
566
|
-
checkpointId: string;
|
|
567
|
-
period: string;
|
|
568
|
-
/** Proof root — the single fingerprint covering every delta in this period. */
|
|
569
|
-
proofRoot: ProofRoot;
|
|
570
|
-
scope?: CheckpointScopeSummary;
|
|
571
|
-
mode?: CheckpointMode;
|
|
572
|
-
deltaCount: number;
|
|
573
|
-
selectedFingerprintCount?: number;
|
|
574
|
-
eligibleFingerprintCount?: number;
|
|
575
|
-
selectedFingerprints?: string[];
|
|
576
|
-
fromIndex: number;
|
|
577
|
-
toIndex: number;
|
|
578
|
-
customerId: string;
|
|
579
|
-
status: RecordStatus;
|
|
580
|
-
message: string;
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* Options for `balance.listCheckpoints()`.
|
|
584
|
-
*/
|
|
585
|
-
export interface ListCheckpointsOptions extends CheckpointScopeOptions, RequestOptions {
|
|
586
|
-
/** Filter checkpoints by customer ID. */
|
|
587
|
-
customerId?: string;
|
|
588
|
-
/** Number of results per page (max 100). */
|
|
589
|
-
limit?: number;
|
|
590
|
-
/** Number of results to skip. */
|
|
591
|
-
offset?: number;
|
|
592
|
-
}
|
|
593
|
-
/** A single checkpoint in the list response. */
|
|
594
|
-
export interface CheckpointSummary {
|
|
595
|
-
checkpointId: string;
|
|
596
|
-
period: string;
|
|
597
|
-
/** Proof root for this checkpoint period. */
|
|
598
|
-
proofRoot: ProofRoot | null;
|
|
599
|
-
scope?: Partial<CheckpointScopeSummary>;
|
|
600
|
-
mode?: CheckpointMode;
|
|
601
|
-
deltaCount: number;
|
|
602
|
-
selectedFingerprintCount?: number;
|
|
603
|
-
eligibleFingerprintCount?: number;
|
|
604
|
-
customerId: string;
|
|
605
|
-
status: RecordStatus;
|
|
606
|
-
verificationReference: string | null;
|
|
607
|
-
verifiedAt: string | null;
|
|
608
|
-
receivedAt: string;
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* Response from `balance.listCheckpoints()`.
|
|
612
|
-
*/
|
|
613
|
-
export interface ListCheckpointsResponse {
|
|
614
|
-
checkpoints: CheckpointSummary[];
|
|
615
|
-
pagination: {
|
|
616
|
-
total: number;
|
|
617
|
-
limit: number;
|
|
618
|
-
offset: number;
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
/**
|
|
622
|
-
* Response from `balance.deltaStatus()` — check the processing status of
|
|
623
|
-
* a submitted delta. Once verified, the delta becomes a permanent record.
|
|
624
|
-
*/
|
|
625
|
-
export interface DeltaStatusResponse {
|
|
626
|
-
recordId: string;
|
|
627
|
-
status: RecordStatus;
|
|
628
|
-
/** Number of deltas in this record. */
|
|
629
|
-
deltaCount: number;
|
|
630
|
-
/** customerId of the first delta (convenience accessor). */
|
|
631
|
-
customerId: string | null;
|
|
632
|
-
/** delta amount of the first delta (convenience accessor). */
|
|
633
|
-
delta: number | null;
|
|
634
|
-
/** All deltas in this record. */
|
|
635
|
-
deltas: Array<{
|
|
636
|
-
customerId: string | null;
|
|
637
|
-
delta: number | null;
|
|
638
|
-
sequenceNumber: string | null;
|
|
639
|
-
}>;
|
|
640
|
-
receiptId: string | null;
|
|
641
|
-
/** Verification reference: the permanent reference recorded on infrastructure no party controls. */
|
|
642
|
-
verificationReference: string | null;
|
|
643
|
-
receivedAt: string;
|
|
644
|
-
verifiedAt: string | null;
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* Options for `balance.waitForVerified()`.
|
|
648
|
-
*/
|
|
649
|
-
export interface WaitForVerifiedOptions extends RequestOptions {
|
|
650
|
-
/**
|
|
651
|
-
* Maximum time (ms) to wait before throwing a timeout.
|
|
652
|
-
* @default 60000
|
|
653
|
-
*/
|
|
654
|
-
timeout?: number;
|
|
655
|
-
/**
|
|
656
|
-
* Poll interval in milliseconds.
|
|
657
|
-
* @default 2000
|
|
658
|
-
*/
|
|
659
|
-
pollInterval?: number;
|
|
660
|
-
}
|
|
661
|
-
/**
|
|
662
|
-
* Plan metadata returned by `balance.usage()`.
|
|
663
|
-
*/
|
|
664
|
-
export interface UsagePlanSummary {
|
|
665
|
-
tier: string;
|
|
666
|
-
monthlyAllotment: number;
|
|
667
|
-
[key: string]: unknown;
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* Usage counters returned by `balance.usage()`.
|
|
671
|
-
*/
|
|
672
|
-
export interface UsageCounters {
|
|
673
|
-
period: string;
|
|
674
|
-
bucketTouchesUsed: number;
|
|
675
|
-
overageCount: number;
|
|
676
|
-
overageChargesUsd: number | string;
|
|
677
|
-
remaining: number;
|
|
678
|
-
[key: string]: unknown;
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Response from `balance.usage()`.
|
|
682
|
-
*/
|
|
683
|
-
export interface UsageResponse {
|
|
684
|
-
plan: UsagePlanSummary;
|
|
685
|
-
usage: UsageCounters;
|
|
686
|
-
allowed: boolean;
|
|
687
|
-
reason: string | null;
|
|
688
|
-
remaining: number;
|
|
689
|
-
}
|
|
690
|
-
/** Options for `balance.gaps()` gap detection queries. */
|
|
691
|
-
export interface SequenceGapsOptions extends RequestOptions {
|
|
692
|
-
/** Optional inclusive start sequence for scanning. */
|
|
693
|
-
fromSequence?: string;
|
|
694
|
-
/** Optional inclusive end sequence for scanning. */
|
|
695
|
-
toSequence?: string;
|
|
696
|
-
/** Maximum number of missing ranges to return (max 500). */
|
|
697
|
-
limit?: number;
|
|
698
|
-
}
|
|
699
|
-
/** A missing sequence range. */
|
|
700
|
-
export interface SequenceGapRange {
|
|
701
|
-
startSequence: string;
|
|
702
|
-
endSequence: string;
|
|
703
|
-
missingCount: string;
|
|
704
|
-
}
|
|
705
|
-
/** Response from `balance.gaps()`. */
|
|
706
|
-
export interface SequenceGapsResponse {
|
|
707
|
-
customerId: string;
|
|
708
|
-
customerReference: string;
|
|
709
|
-
customerPartition: string;
|
|
710
|
-
nextSequence: string;
|
|
711
|
-
rangeStart: string;
|
|
712
|
-
rangeEnd: string;
|
|
713
|
-
gaps: SequenceGapRange[];
|
|
714
|
-
hasGaps: boolean;
|
|
715
|
-
missingRanges: number;
|
|
716
|
-
missingCountInPage: string;
|
|
717
|
-
truncated: boolean;
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* Options for `balance.listWebhookDeliveries()`.
|
|
721
|
-
*/
|
|
722
|
-
export interface ListWebhookDeliveriesOptions extends RequestOptions {
|
|
723
|
-
status?: 'pending' | 'delivered' | 'failed';
|
|
724
|
-
limit?: number;
|
|
725
|
-
offset?: number;
|
|
726
|
-
}
|
|
727
|
-
/**
|
|
728
|
-
* A single webhook delivery record.
|
|
729
|
-
*/
|
|
730
|
-
export interface WebhookDelivery {
|
|
731
|
-
eventId: string;
|
|
732
|
-
status: string;
|
|
733
|
-
attempts: number;
|
|
734
|
-
url: string | null;
|
|
735
|
-
payload: any | null;
|
|
736
|
-
deliveredAt: string | null;
|
|
737
|
-
nextAttemptAt: string | null;
|
|
738
|
-
createdAt: string;
|
|
739
|
-
dataPurged: boolean;
|
|
740
|
-
}
|
|
741
|
-
/**
|
|
742
|
-
* Response from `balance.listWebhookDeliveries()`.
|
|
743
|
-
*/
|
|
744
|
-
export interface ListWebhookDeliveriesResponse {
|
|
745
|
-
deliveries: WebhookDelivery[];
|
|
746
|
-
pagination: {
|
|
747
|
-
total: number;
|
|
748
|
-
limit: number;
|
|
749
|
-
offset: number;
|
|
750
|
-
};
|
|
751
|
-
}
|
|
752
|
-
/** A customer record summary (returned from list endpoint). */
|
|
753
|
-
export interface CustomerRecordSummary {
|
|
754
|
-
customerId: string;
|
|
755
|
-
customerReference: string;
|
|
756
|
-
totalDeltas: number;
|
|
757
|
-
firstDeltaAt: string | null;
|
|
758
|
-
lastDeltaAt: string | null;
|
|
759
|
-
}
|
|
760
|
-
/** A single activity item in the customer record detail. */
|
|
761
|
-
export interface CustomerRecordActivity {
|
|
762
|
-
amount: number;
|
|
763
|
-
reason: string | null;
|
|
764
|
-
referenceId: string | null;
|
|
765
|
-
status: string;
|
|
766
|
-
time: string;
|
|
767
|
-
}
|
|
768
|
-
/** Full customer record detail (returned from detail endpoint). */
|
|
769
|
-
export interface CustomerRecordDetail extends CustomerRecordSummary {
|
|
770
|
-
customerPartition: string;
|
|
771
|
-
computedBalance: number;
|
|
772
|
-
period?: {
|
|
773
|
-
id: string;
|
|
774
|
-
startDate: string;
|
|
775
|
-
endDateExclusive: string;
|
|
776
|
-
label: string;
|
|
777
|
-
};
|
|
778
|
-
mostRecentActivePeriod?: string | null;
|
|
779
|
-
latestCheckpoint: string | null;
|
|
780
|
-
privacyNote: string;
|
|
781
|
-
recentActivity: {
|
|
782
|
-
items: CustomerRecordActivity[];
|
|
783
|
-
pagination: {
|
|
784
|
-
total: number;
|
|
785
|
-
page: number;
|
|
786
|
-
limit: number;
|
|
787
|
-
totalPages: number;
|
|
788
|
-
};
|
|
789
|
-
};
|
|
790
|
-
}
|
|
791
|
-
/** Options for listing customer records. */
|
|
792
|
-
export interface ListCustomersOptions extends RequestOptions {
|
|
793
|
-
/** Filter by customer ID (case-insensitive). */
|
|
794
|
-
search?: string;
|
|
795
|
-
/** Results per page (max 100). */
|
|
796
|
-
limit?: number;
|
|
797
|
-
/** Page number (1-indexed). */
|
|
798
|
-
page?: number;
|
|
799
|
-
}
|
|
800
|
-
/** Options for getting customer record detail. */
|
|
801
|
-
export interface GetCustomerOptions extends RequestOptions {
|
|
802
|
-
/** Page of recent activity (1-indexed). */
|
|
803
|
-
deltaPage?: number;
|
|
804
|
-
/** Activity items per page. */
|
|
805
|
-
deltaLimit?: number;
|
|
806
|
-
/** Optional month selector in YYYY-MM format. */
|
|
807
|
-
period?: string;
|
|
808
|
-
}
|
|
809
|
-
/** Response from listing customer records. */
|
|
810
|
-
export interface ListCustomersResponse {
|
|
811
|
-
customers: CustomerRecordSummary[];
|
|
812
|
-
pagination: {
|
|
813
|
-
total: number;
|
|
814
|
-
page: number;
|
|
815
|
-
limit: number;
|
|
816
|
-
totalPages: number;
|
|
817
|
-
};
|
|
818
|
-
}
|
|
819
|
-
/** Options for generating an invoice proof. */
|
|
820
|
-
export interface InvoiceProofOptions extends RequestOptions {
|
|
821
|
-
/** Billing period in YYYY-MM format. */
|
|
822
|
-
period?: string;
|
|
823
|
-
/** Scope preset. */
|
|
824
|
-
timePreset?: CheckpointTimePreset;
|
|
825
|
-
/** Custom scope start date (ISO). */
|
|
826
|
-
startDate?: string;
|
|
827
|
-
/** Custom scope end date (ISO). */
|
|
828
|
-
endDate?: string;
|
|
829
|
-
}
|
|
830
|
-
/** A single delta included in the invoice proof. */
|
|
831
|
-
export interface InvoiceProofDelta {
|
|
832
|
-
delta: number;
|
|
833
|
-
reason: string | null;
|
|
834
|
-
referenceId: string | null;
|
|
835
|
-
status: string;
|
|
836
|
-
time: string;
|
|
837
|
-
/** Content fingerprint for this delta. */
|
|
838
|
-
itemHash: ContentFingerprint | null;
|
|
839
|
-
}
|
|
840
|
-
/** Window summary for the invoice proof period. */
|
|
841
|
-
export interface InvoiceProofWindowSummary {
|
|
842
|
-
window: string;
|
|
843
|
-
deltasCount: number;
|
|
844
|
-
netDelta: number;
|
|
845
|
-
firstDeltaAt: string | null;
|
|
846
|
-
lastDeltaAt: string | null;
|
|
847
|
-
}
|
|
848
|
-
/** Verification metadata for the invoice proof. */
|
|
849
|
-
export interface InvoiceProofVerification {
|
|
850
|
-
proofRoot: string | null;
|
|
851
|
-
totalBalance: number;
|
|
852
|
-
periodBalance: number;
|
|
853
|
-
}
|
|
854
|
-
/** Response from the invoice proof endpoint. */
|
|
855
|
-
export interface InvoiceProofResponse {
|
|
856
|
-
customerId: string;
|
|
857
|
-
period: string;
|
|
858
|
-
proofRoot: string;
|
|
859
|
-
/** Verification reference: unique identifier on the proof layer. */
|
|
860
|
-
verificationReference: string | null;
|
|
861
|
-
/** Machine verification endpoint for tools, agents, and auditors. */
|
|
862
|
-
verificationApiUrl: string | null;
|
|
863
|
-
/**
|
|
864
|
-
* @deprecated Legacy compatibility field with endpoint-specific semantics.
|
|
865
|
-
* Use `verificationApiUrl` for machine verification and `verifyUrl` for
|
|
866
|
-
* human invoice links. Retained until a future major version.
|
|
867
|
-
*/
|
|
868
|
-
verificationExplorerUrl: string | null;
|
|
869
|
-
/**
|
|
870
|
-
* Shareable verification URL. When Shared Record is enabled, this may be a
|
|
871
|
-
* persistent /c/{handle} permalink instead of a period-specific proof URL.
|
|
872
|
-
*/
|
|
873
|
-
verifyUrl: string | null;
|
|
874
|
-
/** Step-up access code for the customer Shared Record, when exposed by the API. */
|
|
875
|
-
accessHint?: string | null;
|
|
876
|
-
/** Persistent customer Shared Record URL, when exposed by the API. */
|
|
877
|
-
customerLinkUrl?: string | null;
|
|
878
|
-
/** Hostname backing the customer Shared Record URL, when exposed by the API. */
|
|
879
|
-
customerLinkHost?: string | null;
|
|
880
|
-
deltaCount: number;
|
|
881
|
-
startingBalance: number;
|
|
882
|
-
finalBalance: number;
|
|
883
|
-
windowSummary: InvoiceProofWindowSummary;
|
|
884
|
-
deltas: InvoiceProofDelta[];
|
|
885
|
-
verification: InvoiceProofVerification;
|
|
886
|
-
}
|
|
887
|
-
/**
|
|
888
|
-
* Summary of verified records.
|
|
889
|
-
*
|
|
890
|
-
* @deprecated Never returned by the verify endpoint since the move to
|
|
891
|
-
* proof-only verification (ADR 0008). Retained for compile compatibility.
|
|
892
|
-
*/
|
|
893
|
-
export interface VerifySummary {
|
|
894
|
-
recordCount: number;
|
|
895
|
-
netChange: number;
|
|
896
|
-
startingBalance: number;
|
|
897
|
-
endingBalance: number;
|
|
898
|
-
firstRecordAt: string | null;
|
|
899
|
-
lastRecordAt: string | null;
|
|
900
|
-
}
|
|
901
|
-
/**
|
|
902
|
-
* A single record in the verify response.
|
|
903
|
-
*
|
|
904
|
-
* @deprecated Never returned by the verify endpoint since the move to
|
|
905
|
-
* proof-only verification (ADR 0008). Retained for compile compatibility.
|
|
906
|
-
*/
|
|
907
|
-
export interface VerifyRecord {
|
|
908
|
-
amount: number;
|
|
909
|
-
reason: string | null;
|
|
910
|
-
referenceId: string | null;
|
|
911
|
-
status: string;
|
|
912
|
-
time: string;
|
|
913
|
-
/** Content fingerprint: recompute from the original data to confirm nothing changed. */
|
|
914
|
-
itemFingerprint: ContentFingerprint | null;
|
|
915
|
-
}
|
|
916
|
-
/** Verification metadata from the verify endpoint. */
|
|
917
|
-
export interface VerifyVerification {
|
|
918
|
-
verificationReference: string | null;
|
|
919
|
-
verificationExplorerUrl: string | null;
|
|
920
|
-
batchId: string | null;
|
|
921
|
-
note: string;
|
|
922
|
-
}
|
|
923
|
-
export type VerifySource = 'db' | 'chain' | 'both';
|
|
924
|
-
export interface VerifySourceResult {
|
|
925
|
-
source: 'db' | 'chain';
|
|
926
|
-
available: boolean;
|
|
927
|
-
verified: boolean | null;
|
|
928
|
-
reason: string;
|
|
929
|
-
checkedAt: string;
|
|
930
|
-
proofRoot: string;
|
|
931
|
-
verificationReference: string | null;
|
|
932
|
-
chainId: number | null;
|
|
933
|
-
contractAddress: string | null;
|
|
934
|
-
observedProofRoot: string | null;
|
|
935
|
-
algorithm: string;
|
|
936
|
-
cache: 'none' | 'hit' | 'write';
|
|
937
|
-
}
|
|
938
|
-
/**
|
|
939
|
-
* Response from the verify endpoint (no auth required).
|
|
940
|
-
* Anyone with the proof root can call this to independently confirm a proof
|
|
941
|
-
* exists. The response is proof-only: validity, timestamps, and chain
|
|
942
|
-
* references. Record contents are never returned (ADR 0008).
|
|
943
|
-
*/
|
|
944
|
-
export interface VerifyResponse {
|
|
945
|
-
verified: boolean;
|
|
946
|
-
processing?: boolean;
|
|
947
|
-
proofRoot: string;
|
|
948
|
-
chainId?: number;
|
|
949
|
-
contractAddress?: string | null;
|
|
950
|
-
recordedAt?: string;
|
|
951
|
-
environment?: string;
|
|
952
|
-
/** @deprecated Never returned; the verify endpoint is proof-only (ADR 0008). */
|
|
953
|
-
summary?: VerifySummary;
|
|
954
|
-
/** @deprecated Never returned; the verify endpoint is proof-only (ADR 0008). */
|
|
955
|
-
records?: VerifyRecord[];
|
|
956
|
-
verification?: VerifyVerification;
|
|
957
|
-
requestedSource?: VerifySource;
|
|
958
|
-
overallVerified?: boolean;
|
|
959
|
-
dbVerification?: VerifySourceResult;
|
|
960
|
-
chainVerification?: VerifySourceResult;
|
|
961
|
-
itemsRootAlgorithm?: string;
|
|
962
|
-
sourceConsistency?: 'consistent' | 'mismatch' | 'insufficient_data';
|
|
963
|
-
message: string;
|
|
964
|
-
}
|
|
965
|
-
export {};
|
|
966
|
-
//# sourceMappingURL=balance.d.ts.map
|