@octap/contracts 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -6
- package/dist/analytics.d.ts +162 -0
- package/dist/assistant.d.ts +24 -0
- package/dist/campaigns.d.ts +64 -0
- package/dist/campaigns.js +5 -0
- package/dist/campaigns.js.map +1 -0
- package/dist/console.d.ts +13 -2
- package/dist/exports.d.ts +36 -0
- package/dist/exports.js +2 -0
- package/dist/exports.js.map +1 -0
- package/dist/governance.d.ts +55 -1
- package/dist/identity.d.ts +44 -17
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/licensing.d.ts +366 -0
- package/dist/licensing.js +36 -0
- package/dist/licensing.js.map +1 -0
- package/dist/loyalty.d.ts +11 -1
- package/dist/mcp-auth.d.ts +62 -1
- package/dist/mcp-tool-calls.d.ts +71 -0
- package/dist/mcp-tool-calls.js +16 -0
- package/dist/mcp-tool-calls.js.map +1 -0
- package/dist/member-insights.d.ts +73 -0
- package/dist/member-insights.js +11 -0
- package/dist/member-insights.js.map +1 -0
- package/dist/members.d.ts +8 -1
- package/dist/notifications.d.ts +234 -0
- package/dist/notifications.js +104 -0
- package/dist/notifications.js.map +1 -0
- package/dist/organization-events.d.ts +36 -2
- package/dist/organization-events.js.map +1 -1
- package/dist/organizations.d.ts +14 -4
- package/dist/platform-observability.d.ts +103 -0
- package/dist/platform-observability.js +2 -0
- package/dist/platform-observability.js.map +1 -0
- package/dist/rewards.d.ts +13 -1
- package/dist/rewards.js.map +1 -1
- package/dist/webhooks.d.ts +61 -4
- package/package.json +2 -1
package/dist/webhooks.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LicenseExpiryNoticeEventData, LicensePaymentNeedsAttentionEventData, LicensePurchasedEventData, LicenseUsageThresholdEventData } from './licensing.js';
|
|
1
2
|
import type { BudgetWarningThreshold } from './loyalty.js';
|
|
2
3
|
import type { RedeemVoucherResponse, VoucherActorRef, VoucherOwnershipStatus, VoucherPublishStatus, VoucherStatus } from './rewards.js';
|
|
3
4
|
export type WebhookEndpointStatus = 'ACTIVE' | 'DISABLED';
|
|
@@ -19,6 +20,10 @@ export interface RegisterWebhookEndpointRequest {
|
|
|
19
20
|
url: string;
|
|
20
21
|
description?: string;
|
|
21
22
|
}
|
|
23
|
+
/** `POST …/webhooks/endpoints/:id/test`: the text the test event carries, 1–500 characters. */
|
|
24
|
+
export interface SendWebhookTestEventRequest {
|
|
25
|
+
message: string;
|
|
26
|
+
}
|
|
22
27
|
export interface WebhookDeliveryDto {
|
|
23
28
|
/** This delivery (to replay it). Not the event's id: one event goes to every endpoint. */
|
|
24
29
|
id: string;
|
|
@@ -35,7 +40,7 @@ export interface WebhookDeliveryDto {
|
|
|
35
40
|
updatedAt: string;
|
|
36
41
|
}
|
|
37
42
|
/** Every event OctaP delivers; sent as `x-octap-event-type` and as the body's `type`. */
|
|
38
|
-
export type WebhookEventType = 'credits.earned' | 'credits.earn.confirmed' | 'credits.earn.failed' | 'credits.redemption.confirmed' | 'credits.reversed' | 'voucher.granted' | 'voucher.redeemed' | 'voucher.created' | 'voucher.submitted' | 'voucher.returned' | 'voucher.activated' | 'voucher.publish.failed' | 'voucher.paused' | 'voucher.archived' | 'voucher.expired' | 'voucher.member_expired' | 'budget.low' | 'webhook.test';
|
|
43
|
+
export type WebhookEventType = 'credits.earned' | 'credits.earn.confirmed' | 'credits.earn.failed' | 'credits.redemption.confirmed' | 'credits.reversed' | 'voucher.granted' | 'voucher.redeemed' | 'voucher.created' | 'voucher.submitted' | 'voucher.returned' | 'voucher.activated' | 'voucher.publish.failed' | 'voucher.paused' | 'voucher.archived' | 'voucher.expired' | 'voucher.member_expired' | 'budget.low' | 'license.usage_threshold' | 'license.expiry_notice' | 'budget.topped_up' | 'budget.top_up.failed' | 'program.provisioned' | 'program.provision.failed' | 'program.earn_rate.changed' | 'program.earn_rate.failed' | 'license.activated' | 'license.renewed' | 'license.upgraded' | 'license.payment_needs_attention' | 'webhook.test';
|
|
39
44
|
/**
|
|
40
45
|
* `credits.earned`: an earn was *accepted* and is on its way to the chain (status PENDING).
|
|
41
46
|
* `newBalance` is the confirmed balance, which does not include it yet; wait for
|
|
@@ -47,6 +52,8 @@ export interface CreditsEarnedEventData {
|
|
|
47
52
|
purchaseAmount: number;
|
|
48
53
|
estimatedPoints: number;
|
|
49
54
|
newBalance: number;
|
|
55
|
+
/** The campaign whose multiplier boosted it (OCT-340); absent for an ordinary earn. */
|
|
56
|
+
campaignId?: string;
|
|
50
57
|
}
|
|
51
58
|
/**
|
|
52
59
|
* `credits.earn.confirmed` / `credits.redemption.confirmed`: the chain confirmed the transaction.
|
|
@@ -92,13 +99,63 @@ export interface BudgetLowEventData {
|
|
|
92
99
|
remaining: number;
|
|
93
100
|
capacity: number;
|
|
94
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* How a program change the Owner requested ended without being applied:
|
|
104
|
+
* - `FAILED`: nothing reached the chain (the program or organization was not in a state to apply
|
|
105
|
+
* it). The Owner may request it again.
|
|
106
|
+
* - `UNKNOWN`: the change may have reached the chain. OctaP never retries it; an operator checks
|
|
107
|
+
* the chain and settles it, and no other change of the same kind is approved until then.
|
|
108
|
+
*/
|
|
109
|
+
export type ProgramChangeFailureOutcome = 'FAILED' | 'UNKNOWN';
|
|
110
|
+
/** `program.provisioned`: the program an approved `PROVISION_PROGRAM` request set up is live; earns can start. */
|
|
111
|
+
export interface ProgramProvisionedEventData {
|
|
112
|
+
/** The approved request; null only for a program set up before requests carried it. */
|
|
113
|
+
changeRequestId: string | null;
|
|
114
|
+
earnBps: number;
|
|
115
|
+
expiryDays: number;
|
|
116
|
+
initialBudget: number;
|
|
117
|
+
}
|
|
118
|
+
/** `program.provision.failed`: an approved `PROVISION_PROGRAM` request was not applied. */
|
|
119
|
+
export interface ProgramProvisionFailedEventData {
|
|
120
|
+
changeRequestId: string | null;
|
|
121
|
+
outcome: ProgramChangeFailureOutcome;
|
|
122
|
+
reason: string;
|
|
123
|
+
}
|
|
124
|
+
/** `program.earn_rate.changed`: an approved `UPDATE_EARN_RATE` request is live; new earns use `earnBps`. */
|
|
125
|
+
export interface ProgramEarnRateChangedEventData {
|
|
126
|
+
changeRequestId: string | null;
|
|
127
|
+
earnBps: number;
|
|
128
|
+
previousEarnBps: number | null;
|
|
129
|
+
policyVersion: number;
|
|
130
|
+
}
|
|
131
|
+
/** `program.earn_rate.failed`: an approved `UPDATE_EARN_RATE` request was not applied; the old rate stays. */
|
|
132
|
+
export interface ProgramEarnRateFailedEventData {
|
|
133
|
+
changeRequestId: string | null;
|
|
134
|
+
earnBps: number;
|
|
135
|
+
outcome: ProgramChangeFailureOutcome;
|
|
136
|
+
reason: string;
|
|
137
|
+
}
|
|
138
|
+
/** `budget.topped_up`: an approved `BUDGET_TOP_UP` request added `amount` points to the issuance budget. */
|
|
139
|
+
export interface BudgetToppedUpEventData {
|
|
140
|
+
changeRequestId: string | null;
|
|
141
|
+
amount: number;
|
|
142
|
+
}
|
|
143
|
+
/** `budget.top_up.failed`: an approved `BUDGET_TOP_UP` request was not applied. */
|
|
144
|
+
export interface BudgetTopUpFailedEventData {
|
|
145
|
+
changeRequestId: string | null;
|
|
146
|
+
amount: number;
|
|
147
|
+
outcome: ProgramChangeFailureOutcome;
|
|
148
|
+
reason: string;
|
|
149
|
+
}
|
|
95
150
|
/**
|
|
96
151
|
* `webhook.test`: sent on request from the console to one endpoint only, to check that it receives
|
|
97
|
-
* and verifies OctaP's deliveries. Signed
|
|
98
|
-
* the organization: ignore it beyond
|
|
152
|
+
* and verifies OctaP's deliveries. Signed like any other event, but tried once, never retried: the
|
|
153
|
+
* sender sends another to try again. Nothing happened in the organization: ignore it beyond
|
|
154
|
+
* acknowledging it.
|
|
99
155
|
*/
|
|
100
156
|
export interface WebhookTestEventData {
|
|
101
157
|
endpointId: string;
|
|
158
|
+
/** The text the sender typed in the console. */
|
|
102
159
|
message: string;
|
|
103
160
|
}
|
|
104
161
|
/**
|
|
@@ -209,7 +266,7 @@ interface WebhookEventOf<T extends WebhookEventType, D> {
|
|
|
209
266
|
data: D;
|
|
210
267
|
}
|
|
211
268
|
/** A delivered webhook body, discriminated on `type`. */
|
|
212
|
-
export type WebhookEvent = WebhookEventOf<'credits.earned', CreditsEarnedEventData> | WebhookEventOf<'credits.earn.confirmed', CreditsChainConfirmedEventData> | WebhookEventOf<'credits.earn.failed', CreditsEarnFailedEventData> | WebhookEventOf<'credits.redemption.confirmed', CreditsChainConfirmedEventData> | WebhookEventOf<'credits.reversed', ReversalEventData> | WebhookEventOf<'voucher.granted', VoucherGrantedEventData> | WebhookEventOf<'voucher.redeemed', VoucherRedeemedEventData> | WebhookEventOf<'voucher.created', VoucherLifecycleEventData> | WebhookEventOf<'voucher.submitted', VoucherSubmittedEventData> | WebhookEventOf<'voucher.returned', VoucherReturnedEventData> | WebhookEventOf<'voucher.activated', VoucherLifecycleEventData> | WebhookEventOf<'voucher.publish.failed', VoucherLifecycleEventData> | WebhookEventOf<'voucher.paused', VoucherLifecycleEventData> | WebhookEventOf<'voucher.archived', VoucherLifecycleEventData> | WebhookEventOf<'voucher.expired', VoucherLifecycleEventData> | WebhookEventOf<'voucher.member_expired', VoucherMemberExpiredEventData> | WebhookEventOf<'budget.low', BudgetLowEventData> | WebhookEventOf<'webhook.test', WebhookTestEventData>;
|
|
269
|
+
export type WebhookEvent = WebhookEventOf<'credits.earned', CreditsEarnedEventData> | WebhookEventOf<'credits.earn.confirmed', CreditsChainConfirmedEventData> | WebhookEventOf<'credits.earn.failed', CreditsEarnFailedEventData> | WebhookEventOf<'credits.redemption.confirmed', CreditsChainConfirmedEventData> | WebhookEventOf<'credits.reversed', ReversalEventData> | WebhookEventOf<'voucher.granted', VoucherGrantedEventData> | WebhookEventOf<'voucher.redeemed', VoucherRedeemedEventData> | WebhookEventOf<'voucher.created', VoucherLifecycleEventData> | WebhookEventOf<'voucher.submitted', VoucherSubmittedEventData> | WebhookEventOf<'voucher.returned', VoucherReturnedEventData> | WebhookEventOf<'voucher.activated', VoucherLifecycleEventData> | WebhookEventOf<'voucher.publish.failed', VoucherLifecycleEventData> | WebhookEventOf<'voucher.paused', VoucherLifecycleEventData> | WebhookEventOf<'voucher.archived', VoucherLifecycleEventData> | WebhookEventOf<'voucher.expired', VoucherLifecycleEventData> | WebhookEventOf<'voucher.member_expired', VoucherMemberExpiredEventData> | WebhookEventOf<'budget.low', BudgetLowEventData> | WebhookEventOf<'license.usage_threshold', LicenseUsageThresholdEventData> | WebhookEventOf<'license.expiry_notice', LicenseExpiryNoticeEventData> | WebhookEventOf<'budget.topped_up', BudgetToppedUpEventData> | WebhookEventOf<'budget.top_up.failed', BudgetTopUpFailedEventData> | WebhookEventOf<'program.provisioned', ProgramProvisionedEventData> | WebhookEventOf<'program.provision.failed', ProgramProvisionFailedEventData> | WebhookEventOf<'program.earn_rate.changed', ProgramEarnRateChangedEventData> | WebhookEventOf<'program.earn_rate.failed', ProgramEarnRateFailedEventData> | WebhookEventOf<'license.activated', LicensePurchasedEventData> | WebhookEventOf<'license.renewed', LicensePurchasedEventData> | WebhookEventOf<'license.upgraded', LicensePurchasedEventData> | WebhookEventOf<'license.payment_needs_attention', LicensePaymentNeedsAttentionEventData> | WebhookEventOf<'webhook.test', WebhookTestEventData>;
|
|
213
270
|
/** The `data` of each event type. */
|
|
214
271
|
export type WebhookEventData<T extends WebhookEventType> = Extract<WebhookEvent, {
|
|
215
272
|
type: T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octap/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Typed request/response contracts for the Octap Core REST API.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "tsc -p tsconfig.json",
|
|
20
|
+
"prepack": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\" && npm run build",
|
|
20
21
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {},
|