@octap/contracts 0.2.0 → 0.2.1
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 +42 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
# @octap/contracts
|
|
2
|
+
|
|
3
|
+
TypeScript types for the Octap Core REST API: every request and response body, the webhook events,
|
|
4
|
+
and the status values. `@octap/sdk`, `@octap/browser-sdk`, `@octap/mcp` and `@octap/verify` all use
|
|
5
|
+
them, and so does Core itself.
|
|
6
|
+
|
|
7
|
+
It is types only: nothing here runs, and nothing validates a value at runtime.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @octap/contracts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import type { WebhookEvent } from '@octap/contracts';
|
|
15
|
+
|
|
16
|
+
function onEvent(event: WebhookEvent) {
|
|
17
|
+
if (event.type === 'credits.earn.confirmed') {
|
|
18
|
+
// event.data is CreditsChainConfirmedEventData
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
You don't need this package if you use `@octap/sdk`: it re-exports the types its methods take and
|
|
24
|
+
return. Install it on its own for code that only handles the data, such as a webhook receiver in
|
|
25
|
+
another service or a typed frontend.
|
|
26
|
+
|
|
27
|
+
## What's in it
|
|
28
|
+
|
|
29
|
+
| Area | Examples |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| Points | `EarnPointsRequest`, `CreditBalanceSnapshot`, `LoyaltyTransactionDto`, `ReservePosRedemptionResponse` |
|
|
32
|
+
| Vouchers | `VoucherDto`, `VoucherStatus`, `VoucherOwnershipDto`, `VoucherOwnershipStatus`, `ClaimVoucherResponse` |
|
|
33
|
+
| Voucher batches and refunds | `VoucherBatchDto`, `VoucherBatchItem`, `VoucherRefundPolicyDto` |
|
|
34
|
+
| Webhooks | `WebhookEvent` (discriminated on `type`), `WebhookEventType`, `WebhookEventData<T>` |
|
|
35
|
+
| Members and identity | `VerifyCustomerResponse`, `MemberProfile` |
|
|
36
|
+
| Evidence, audit and analytics | `EvidenceBundle`, `AuditLogEntry`, `ProgramAnalyticsSummary` |
|
|
37
|
+
|
|
38
|
+
Each type's JSDoc says what its fields mean. The same comments describe the fields in Core's OpenAPI
|
|
39
|
+
document.
|
|
40
|
+
|
|
41
|
+
This package is not the on-chain Move contracts: those are in `contracts/` in the
|
|
42
|
+
[octap-core repository](https://github.com/OctaPointees/octap-core).
|