@octap/contracts 0.2.1 → 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/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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which members (OCT-376), for a program's Owner and Business Developers, so a question such as "who
|
|
3
|
+
* earned the most this month?" is one read instead of a walk through the ledger:
|
|
4
|
+
* `GET /v1/console/organizations/{organizationId}/analytics/top-members` and `…/member-segments`.
|
|
5
|
+
* `MemberSegments` (`…/analytics/members`) counts members by activity; these name them.
|
|
6
|
+
*
|
|
7
|
+
* Every figure means what it means in `ProgramAnalyticsSummary`: CONFIRMED transactions only, in
|
|
8
|
+
* `[from, to)`, the last 30 days by default and at most 366 days.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=member-insights.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member-insights.js","sourceRoot":"","sources":["../src/member-insights.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/dist/members.d.ts
CHANGED
|
@@ -6,10 +6,17 @@ export interface MemberDirectoryQuery {
|
|
|
6
6
|
status?: 'ACTIVE' | 'BLOCKED';
|
|
7
7
|
externalMemberId?: string;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* `GET …/members/{memberId}/transactions`: `limit` 1–100 (default 25), `cursor` from the last page,
|
|
11
|
+
* and an optional `from`/`to` window.
|
|
12
|
+
*/
|
|
10
13
|
export interface MemberTransactionQuery {
|
|
11
14
|
limit?: number;
|
|
12
15
|
cursor?: string;
|
|
16
|
+
/** Only transactions created at or after this moment. ISO 8601 date-time with an offset or Z. */
|
|
17
|
+
from?: string;
|
|
18
|
+
/** Only transactions created before this moment (excluded), after `from`. ISO 8601 date-time with an offset or Z. */
|
|
19
|
+
to?: string;
|
|
13
20
|
}
|
|
14
21
|
export interface MemberProfile {
|
|
15
22
|
id: string;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import type { GovernanceRequestType } from './governance.js';
|
|
2
|
+
import type { LicenseState, LicenseTier, PaymentTransferStatus } from './licensing.js';
|
|
3
|
+
import type { OrganizationEventData, OrganizationEventType } from './organization-events.js';
|
|
4
|
+
/**
|
|
5
|
+
* In-app notifications (OCT-30), for the business console and the platform portal. Two layers that
|
|
6
|
+
* never mix:
|
|
7
|
+
*
|
|
8
|
+
* - **Feed**: organization events (the outbox) that need a person, newest first, with an unread count
|
|
9
|
+
* kept by a per-user read mark. Reading clears the count and nothing else.
|
|
10
|
+
* - **Open items**: things still waiting for someone (a voucher to approve, a license to renew, a
|
|
11
|
+
* transfer to settle), read live from their own records. One leaves the list only when it is
|
|
12
|
+
* resolved, never because it was read.
|
|
13
|
+
*/
|
|
14
|
+
/** How urgent a notification is, most urgent first. */
|
|
15
|
+
export type NotificationSeverity = 'ACTION' | 'WARNING' | 'INFO';
|
|
16
|
+
export declare const NOTIFICATION_SEVERITIES: readonly NotificationSeverity[];
|
|
17
|
+
/**
|
|
18
|
+
* Who in the organization a console notification is for. `OWNER`: the Owner only, for what only an
|
|
19
|
+
* Owner can resolve (billing, budget, program terms). `MEMBER`: the Owner and Business Developers.
|
|
20
|
+
*/
|
|
21
|
+
export type NotificationAudience = 'OWNER' | 'MEMBER';
|
|
22
|
+
/** What an open item is waiting for. Add a kind to `OpenItemCountsByKind` too. */
|
|
23
|
+
export type OpenItemKind = 'voucherApproval' | 'voucherPublishFailed' | 'licenseRenewal' | 'paymentUnderpaid' | 'organizationApplication' | 'changeRequest' | 'paymentTransfer';
|
|
24
|
+
/** How long a grouped notification's bucket lasts, aligned to the clock (14:00, 14:15, …). */
|
|
25
|
+
export declare const NOTIFICATION_GROUP_WINDOW_MINUTES = 15;
|
|
26
|
+
/** Whether and how an event type notifies. */
|
|
27
|
+
export interface NotificationRule<T extends OrganizationEventType> {
|
|
28
|
+
/** In the organization's console. */
|
|
29
|
+
console?: {
|
|
30
|
+
audience: NotificationAudience;
|
|
31
|
+
severity: (data: OrganizationEventData<T>) => NotificationSeverity;
|
|
32
|
+
};
|
|
33
|
+
/** In the platform portal. `null` from `severity`: this one does not notify the platform. */
|
|
34
|
+
platform?: {
|
|
35
|
+
severity: (data: OrganizationEventData<T>) => NotificationSeverity | null;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Events of this type with the same value of this payload field, in the same
|
|
39
|
+
* `NOTIFICATION_GROUP_WINDOW_MINUTES` bucket, show as one notification with a count. Each event is
|
|
40
|
+
* still recorded on its own; grouping happens only when the feed is read.
|
|
41
|
+
*/
|
|
42
|
+
groupBy?: string;
|
|
43
|
+
/** Open items this event may have changed: a client refetches them when it arrives. */
|
|
44
|
+
resolves?: readonly OpenItemKind[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Every organization event type's rule, or `null` when it never notifies: a routine success the
|
|
48
|
+
* person who caused it already knows about. Typed over every `OrganizationEventType`, so a new event
|
|
49
|
+
* type does not compile until it says whether it notifies.
|
|
50
|
+
*/
|
|
51
|
+
export declare const NOTIFICATION_RULES: {
|
|
52
|
+
[T in OrganizationEventType]: NotificationRule<T> | null;
|
|
53
|
+
};
|
|
54
|
+
/** The rule for `type`, or `null` for a type this build does not know or that never notifies. */
|
|
55
|
+
export declare function notificationRuleOf(type: string): NotificationRule<OrganizationEventType> | null;
|
|
56
|
+
/**
|
|
57
|
+
* One notification in a feed: one event, or a group of events of the same kind in one bucket (see
|
|
58
|
+
* `NotificationRule.groupBy`). `id` and `data` are the latest event's; `sequence` is its sequence and
|
|
59
|
+
* the feed's cursor. A group whose newest event is past the read mark is unread again.
|
|
60
|
+
*/
|
|
61
|
+
export interface Notification {
|
|
62
|
+
id: string;
|
|
63
|
+
sequence: number;
|
|
64
|
+
type: OrganizationEventType;
|
|
65
|
+
severity: NotificationSeverity;
|
|
66
|
+
organizationId: string;
|
|
67
|
+
/** How many events it stands for: 1, or more for a group. */
|
|
68
|
+
count: number;
|
|
69
|
+
/** When its first and latest events happened. */
|
|
70
|
+
firstAt: string;
|
|
71
|
+
lastAt: string;
|
|
72
|
+
/** The latest event's payload, as its webhook carries it (`OrganizationEventData`). */
|
|
73
|
+
data: Record<string, unknown>;
|
|
74
|
+
unread: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface NotificationPage {
|
|
77
|
+
items: Notification[];
|
|
78
|
+
/**
|
|
79
|
+
* Pass as `beforeSequence` for the next, older page; `null` once there is no more. A page can
|
|
80
|
+
* hold fewer than `limit` items and still have a next one.
|
|
81
|
+
*/
|
|
82
|
+
nextBeforeSequence: number | null;
|
|
83
|
+
/**
|
|
84
|
+
* In the main view: whether there are notifications from before the user's first look at this
|
|
85
|
+
* feed, shown only when asked for with `earlier` (a "show earlier" control). Always `false` in
|
|
86
|
+
* the `earlier` view.
|
|
87
|
+
*/
|
|
88
|
+
hasEarlier: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* `GET …/notifications`. `limit` 1–100, default 30. The main view starts at the user's first look at
|
|
92
|
+
* the feed: a newcomer does not see what happened before they arrived. `earlier: true` reads those
|
|
93
|
+
* older notifications instead, newest first, with the same paging.
|
|
94
|
+
*/
|
|
95
|
+
export interface NotificationListQuery {
|
|
96
|
+
beforeSequence?: number;
|
|
97
|
+
limit?: number;
|
|
98
|
+
earlier?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/** `GET /v1/platform/notifications`: also narrowed to one organization, or to one severity. */
|
|
101
|
+
export interface PlatformNotificationListQuery extends NotificationListQuery {
|
|
102
|
+
organizationId?: string;
|
|
103
|
+
severity?: NotificationSeverity;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* `POST …/notifications/read`: marks everything up to `upToSequence` (the newest `sequence` the
|
|
107
|
+
* client has shown) read. The mark only moves forward.
|
|
108
|
+
*/
|
|
109
|
+
export interface MarkNotificationsReadInput {
|
|
110
|
+
upToSequence: number;
|
|
111
|
+
}
|
|
112
|
+
export interface NotificationReadMark {
|
|
113
|
+
lastReadSequence: number;
|
|
114
|
+
}
|
|
115
|
+
/** An open item, by what it is waiting for. Every one is waiting for an action, so it has no severity. */
|
|
116
|
+
export type OpenItem = {
|
|
117
|
+
kind: 'voucherApproval';
|
|
118
|
+
/** The approval request. */
|
|
119
|
+
id: string;
|
|
120
|
+
organizationId: string;
|
|
121
|
+
createdAt: string;
|
|
122
|
+
voucherId: string;
|
|
123
|
+
voucherCode: string;
|
|
124
|
+
voucherTitle: string;
|
|
125
|
+
} | {
|
|
126
|
+
kind: 'voucherPublishFailed';
|
|
127
|
+
/** The voucher. */
|
|
128
|
+
id: string;
|
|
129
|
+
organizationId: string;
|
|
130
|
+
createdAt: string;
|
|
131
|
+
voucherCode: string;
|
|
132
|
+
voucherTitle: string;
|
|
133
|
+
} | {
|
|
134
|
+
kind: 'licenseRenewal';
|
|
135
|
+
/** The license. */
|
|
136
|
+
id: string;
|
|
137
|
+
organizationId: string;
|
|
138
|
+
createdAt: string;
|
|
139
|
+
state: Exclude<LicenseState, 'ACTIVE'>;
|
|
140
|
+
tier: LicenseTier;
|
|
141
|
+
planName: string;
|
|
142
|
+
endsAt: string;
|
|
143
|
+
graceEndsAt: string;
|
|
144
|
+
} | {
|
|
145
|
+
kind: 'paymentUnderpaid';
|
|
146
|
+
/** The order. */
|
|
147
|
+
id: string;
|
|
148
|
+
organizationId: string;
|
|
149
|
+
createdAt: string;
|
|
150
|
+
paymentCode: string;
|
|
151
|
+
expectedVnd: number;
|
|
152
|
+
/** What the short transfers for it added up to so far. */
|
|
153
|
+
receivedVnd: number;
|
|
154
|
+
orderExpiresAt: string;
|
|
155
|
+
} | {
|
|
156
|
+
kind: 'organizationApplication';
|
|
157
|
+
/** The change request. */
|
|
158
|
+
id: string;
|
|
159
|
+
organizationId: string;
|
|
160
|
+
createdAt: string;
|
|
161
|
+
organizationName: string;
|
|
162
|
+
} | {
|
|
163
|
+
kind: 'changeRequest';
|
|
164
|
+
/** The change request. */
|
|
165
|
+
id: string;
|
|
166
|
+
organizationId: string;
|
|
167
|
+
createdAt: string;
|
|
168
|
+
requestType: GovernanceRequestType;
|
|
169
|
+
} | {
|
|
170
|
+
kind: 'paymentTransfer';
|
|
171
|
+
/** The transfer. */
|
|
172
|
+
id: string;
|
|
173
|
+
/** `null`: the transfer named no organization (no code, or an unknown one). */
|
|
174
|
+
organizationId: string | null;
|
|
175
|
+
createdAt: string;
|
|
176
|
+
status: Extract<PaymentTransferStatus, 'UNMATCHED' | 'MATCHED'>;
|
|
177
|
+
reason: string | null;
|
|
178
|
+
amountVnd: number;
|
|
179
|
+
/** For a MATCHED transfer: what was paid above the order and not yet sent back. */
|
|
180
|
+
owedRefundVnd: number;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* How many open items of each kind; a kind with none is left out. Spelled out rather than
|
|
184
|
+
* `Partial<Record<OpenItemKind, number>>`, whose generated schema name would carry a file path.
|
|
185
|
+
*/
|
|
186
|
+
export interface OpenItemCountsByKind {
|
|
187
|
+
voucherApproval?: number;
|
|
188
|
+
voucherPublishFailed?: number;
|
|
189
|
+
licenseRenewal?: number;
|
|
190
|
+
paymentUnderpaid?: number;
|
|
191
|
+
organizationApplication?: number;
|
|
192
|
+
changeRequest?: number;
|
|
193
|
+
paymentTransfer?: number;
|
|
194
|
+
}
|
|
195
|
+
export interface OpenItemCounts {
|
|
196
|
+
total: number;
|
|
197
|
+
byKind: OpenItemCountsByKind;
|
|
198
|
+
}
|
|
199
|
+
/** `GET /v1/console/organizations/:id/notifications/summary`. */
|
|
200
|
+
export interface NotificationSummary {
|
|
201
|
+
/** Unread notifications, counted up to `NOTIFICATION_UNREAD_CAP` (show "99+" past it). */
|
|
202
|
+
unread: number;
|
|
203
|
+
openItems: OpenItemCounts;
|
|
204
|
+
lastReadSequence: number;
|
|
205
|
+
}
|
|
206
|
+
/** The unread count stops counting here. */
|
|
207
|
+
export declare const NOTIFICATION_UNREAD_CAP = 100;
|
|
208
|
+
/** `GET …/notifications/open-items` in the console: oldest first. */
|
|
209
|
+
export interface OpenItemList {
|
|
210
|
+
items: OpenItem[];
|
|
211
|
+
}
|
|
212
|
+
/** One organization's share of the platform's open items. `organizationId` null: no organization. */
|
|
213
|
+
export interface PlatformOpenItemGroup {
|
|
214
|
+
organizationId: string | null;
|
|
215
|
+
organizationName: string | null;
|
|
216
|
+
items: OpenItem[];
|
|
217
|
+
}
|
|
218
|
+
/** `GET /v1/platform/notifications/open-items`: grouped by organization, the busiest first. */
|
|
219
|
+
export interface PlatformOpenItemList {
|
|
220
|
+
groups: PlatformOpenItemGroup[];
|
|
221
|
+
}
|
|
222
|
+
/** `GET /v1/platform/notifications/open-items`: `organizationId` narrows it to one organization. */
|
|
223
|
+
export interface PlatformOpenItemQuery {
|
|
224
|
+
organizationId?: string;
|
|
225
|
+
}
|
|
226
|
+
/** `GET /v1/platform/notifications/summary`, polled by the portal. */
|
|
227
|
+
export interface PlatformNotificationSummary extends NotificationSummary {
|
|
228
|
+
/** Organizations with open items, the busiest first (at most 20). */
|
|
229
|
+
organizations: {
|
|
230
|
+
organizationId: string | null;
|
|
231
|
+
organizationName: string | null;
|
|
232
|
+
openItems: number;
|
|
233
|
+
}[];
|
|
234
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export const NOTIFICATION_SEVERITIES = ['ACTION', 'WARNING', 'INFO'];
|
|
2
|
+
/** How long a grouped notification's bucket lasts, aligned to the clock (14:00, 14:15, …). */
|
|
3
|
+
export const NOTIFICATION_GROUP_WINDOW_MINUTES = 15;
|
|
4
|
+
const always = (severity) => () => severity;
|
|
5
|
+
/**
|
|
6
|
+
* Every organization event type's rule, or `null` when it never notifies: a routine success the
|
|
7
|
+
* person who caused it already knows about. Typed over every `OrganizationEventType`, so a new event
|
|
8
|
+
* type does not compile until it says whether it notifies.
|
|
9
|
+
*/
|
|
10
|
+
export const NOTIFICATION_RULES = {
|
|
11
|
+
'credits.earned': null,
|
|
12
|
+
'credits.earn.confirmed': null,
|
|
13
|
+
'credits.earn.failed': {
|
|
14
|
+
console: { audience: 'MEMBER', severity: always('WARNING') },
|
|
15
|
+
groupBy: 'failureCode',
|
|
16
|
+
},
|
|
17
|
+
'credits.redemption.confirmed': null,
|
|
18
|
+
'credits.reversed': null,
|
|
19
|
+
'voucher.granted': null,
|
|
20
|
+
'voucher.redeemed': null,
|
|
21
|
+
'voucher.created': null,
|
|
22
|
+
'voucher.submitted': {
|
|
23
|
+
console: { audience: 'OWNER', severity: always('ACTION') },
|
|
24
|
+
resolves: ['voucherApproval'],
|
|
25
|
+
},
|
|
26
|
+
'voucher.returned': {
|
|
27
|
+
console: { audience: 'MEMBER', severity: always('ACTION') },
|
|
28
|
+
resolves: ['voucherApproval'],
|
|
29
|
+
},
|
|
30
|
+
'voucher.activated': {
|
|
31
|
+
console: { audience: 'MEMBER', severity: always('INFO') },
|
|
32
|
+
resolves: ['voucherApproval', 'voucherPublishFailed'],
|
|
33
|
+
},
|
|
34
|
+
'voucher.publish.failed': {
|
|
35
|
+
console: { audience: 'MEMBER', severity: always('ACTION') },
|
|
36
|
+
platform: { severity: always('WARNING') },
|
|
37
|
+
resolves: ['voucherPublishFailed'],
|
|
38
|
+
},
|
|
39
|
+
'voucher.paused': null,
|
|
40
|
+
'voucher.archived': { resolves: ['voucherPublishFailed'] },
|
|
41
|
+
'voucher.expired': { console: { audience: 'MEMBER', severity: always('INFO') } },
|
|
42
|
+
'voucher.member_expired': null,
|
|
43
|
+
'budget.low': { console: { audience: 'OWNER', severity: always('WARNING') } },
|
|
44
|
+
'license.usage_threshold': { console: { audience: 'OWNER', severity: always('WARNING') } },
|
|
45
|
+
'license.expiry_notice': {
|
|
46
|
+
console: {
|
|
47
|
+
audience: 'OWNER',
|
|
48
|
+
severity: (data) => (data.stage === 'GRACE' || data.stage === 'EXPIRED' ? 'ACTION' : 'WARNING'),
|
|
49
|
+
},
|
|
50
|
+
platform: { severity: (data) => (data.stage === 'GRACE' || data.stage === 'EXPIRED' ? 'WARNING' : null) },
|
|
51
|
+
resolves: ['licenseRenewal'],
|
|
52
|
+
},
|
|
53
|
+
'budget.topped_up': { console: { audience: 'OWNER', severity: always('INFO') } },
|
|
54
|
+
'budget.top_up.failed': {
|
|
55
|
+
console: { audience: 'OWNER', severity: always('WARNING') },
|
|
56
|
+
platform: { severity: always('WARNING') },
|
|
57
|
+
},
|
|
58
|
+
'program.provisioned': {
|
|
59
|
+
console: { audience: 'OWNER', severity: always('INFO') },
|
|
60
|
+
platform: { severity: always('INFO') },
|
|
61
|
+
},
|
|
62
|
+
'program.provision.failed': {
|
|
63
|
+
console: { audience: 'OWNER', severity: always('WARNING') },
|
|
64
|
+
platform: { severity: always('WARNING') },
|
|
65
|
+
},
|
|
66
|
+
'program.earn_rate.changed': { console: { audience: 'OWNER', severity: always('INFO') } },
|
|
67
|
+
'program.earn_rate.failed': {
|
|
68
|
+
console: { audience: 'OWNER', severity: always('WARNING') },
|
|
69
|
+
platform: { severity: always('WARNING') },
|
|
70
|
+
},
|
|
71
|
+
'license.activated': {
|
|
72
|
+
console: { audience: 'OWNER', severity: always('INFO') },
|
|
73
|
+
platform: { severity: always('INFO') },
|
|
74
|
+
resolves: ['licenseRenewal', 'paymentUnderpaid'],
|
|
75
|
+
},
|
|
76
|
+
'license.renewed': {
|
|
77
|
+
console: { audience: 'OWNER', severity: always('INFO') },
|
|
78
|
+
platform: { severity: always('INFO') },
|
|
79
|
+
resolves: ['licenseRenewal', 'paymentUnderpaid'],
|
|
80
|
+
},
|
|
81
|
+
'license.upgraded': {
|
|
82
|
+
console: { audience: 'OWNER', severity: always('INFO') },
|
|
83
|
+
platform: { severity: always('INFO') },
|
|
84
|
+
resolves: ['licenseRenewal', 'paymentUnderpaid'],
|
|
85
|
+
},
|
|
86
|
+
'license.payment_needs_attention': {
|
|
87
|
+
// Short: the Owner can send the rest. Otherwise OctaP settles it (refund), so it is for information.
|
|
88
|
+
console: { audience: 'OWNER', severity: (data) => (data.reason === 'UNDERPAID' ? 'ACTION' : 'WARNING') },
|
|
89
|
+
platform: { severity: always('WARNING') },
|
|
90
|
+
resolves: ['paymentUnderpaid'],
|
|
91
|
+
},
|
|
92
|
+
'webhook.test': null,
|
|
93
|
+
'organization.change_request.decided': {
|
|
94
|
+
console: { audience: 'OWNER', severity: (data) => (data.outcome === 'REJECTED' ? 'WARNING' : 'INFO') },
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
/** The rule for `type`, or `null` for a type this build does not know or that never notifies. */
|
|
98
|
+
export function notificationRuleOf(type) {
|
|
99
|
+
const rule = NOTIFICATION_RULES[type];
|
|
100
|
+
return rule ?? null;
|
|
101
|
+
}
|
|
102
|
+
/** The unread count stops counting here. */
|
|
103
|
+
export const NOTIFICATION_UNREAD_CAP = 100;
|
|
104
|
+
//# sourceMappingURL=notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,MAAM,uBAAuB,GAAoC,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAoBtG,8FAA8F;AAC9F,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAkBpD,MAAM,MAAM,GAAG,CAAC,QAA8B,EAAE,EAAE,CAAC,GAAyB,EAAE,CAAC,QAAQ,CAAC;AAExF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAiE;IAC9F,gBAAgB,EAAE,IAAI;IACtB,wBAAwB,EAAE,IAAI;IAC9B,qBAAqB,EAAE;QACrB,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE;QAC5D,OAAO,EAAE,aAAa;KACvB;IACD,8BAA8B,EAAE,IAAI;IACpC,kBAAkB,EAAE,IAAI;IACxB,iBAAiB,EAAE,IAAI;IACvB,kBAAkB,EAAE,IAAI;IACxB,iBAAiB,EAAE,IAAI;IACvB,mBAAmB,EAAE;QACnB,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE;QAC1D,QAAQ,EAAE,CAAC,iBAAiB,CAAC;KAC9B;IACD,kBAAkB,EAAE;QAClB,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE;QAC3D,QAAQ,EAAE,CA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,CAAC;AAEF,iGAAiG;AACjG,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,MAAM,IAAI,GAAI,kBAAiG,CAAC,IAAI,CAAC,CAAC;IACtH,OAAO,IAAI,IAAI,IAAI,CAAC;AACtB,CAAC;AAyKD,4CAA4C;AAC5C,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC"}
|
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GovernanceRequestType } from './governance.js';
|
|
2
|
+
import type { WebhookEventData, WebhookEventType } from './webhooks.js';
|
|
3
|
+
/**
|
|
4
|
+
* Organization events that are never delivered as webhooks (OCT-30): they reach the console stream and
|
|
5
|
+
* in-app notifications only. One becomes a webhook by moving it into `WebhookEventType`.
|
|
6
|
+
*/
|
|
7
|
+
export type InternalEventType = 'organization.change_request.decided';
|
|
8
|
+
/**
|
|
9
|
+
* `organization.change_request.decided`: a System Admin approved or rejected one of the organization's
|
|
10
|
+
* change requests. An approved program change is still on its way: its `program.*` or `budget.*`
|
|
11
|
+
* result follows. Not sent for an organization application (`CREATE_ORGANIZATION`).
|
|
12
|
+
*/
|
|
13
|
+
export interface ChangeRequestDecidedEventData {
|
|
14
|
+
changeRequestId: string;
|
|
15
|
+
requestType: GovernanceRequestType;
|
|
16
|
+
outcome: 'APPROVED' | 'REJECTED';
|
|
17
|
+
/** The System Admin's reason; always given for a rejection. */
|
|
18
|
+
reason: string | null;
|
|
19
|
+
}
|
|
20
|
+
interface InternalEventDataOf {
|
|
21
|
+
'organization.change_request.decided': ChangeRequestDecidedEventData;
|
|
22
|
+
}
|
|
23
|
+
/** Every type recorded in an organization's event log: webhook events and internal ones. */
|
|
24
|
+
export type OrganizationEventType = WebhookEventType | InternalEventType;
|
|
25
|
+
/** The payload of each organization event type. */
|
|
26
|
+
export type OrganizationEventData<T extends OrganizationEventType> = T extends WebhookEventType ? WebhookEventData<T> : T extends InternalEventType ? InternalEventDataOf[T] : never;
|
|
2
27
|
/**
|
|
3
28
|
* What changed, so a console screen knows what to refetch. Only ids: the stream never carries the
|
|
4
29
|
* data itself, which is read through the REST routes and their access checks.
|
|
@@ -18,9 +43,16 @@ export type OrganizationEventSubject = {
|
|
|
18
43
|
memberId: string;
|
|
19
44
|
} | {
|
|
20
45
|
kind: 'issuanceBudget';
|
|
46
|
+
} | {
|
|
47
|
+
kind: 'license';
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'program';
|
|
21
50
|
} | {
|
|
22
51
|
kind: 'webhookEndpoint';
|
|
23
52
|
id: string;
|
|
53
|
+
} | {
|
|
54
|
+
kind: 'changeRequest';
|
|
55
|
+
id: string;
|
|
24
56
|
};
|
|
25
57
|
/**
|
|
26
58
|
* One message of the console event stream (`GET /v1/console/organizations/:id/events`, OCT-326):
|
|
@@ -31,7 +63,8 @@ export interface OrganizationStreamEvent {
|
|
|
31
63
|
id: string;
|
|
32
64
|
/** Orders the organization's events; sent as the SSE `id`, so a reconnect resumes after it. */
|
|
33
65
|
sequence: number;
|
|
34
|
-
type
|
|
66
|
+
/** A webhook event type, or an internal one (`InternalEventType`) that no webhook carries. */
|
|
67
|
+
type: OrganizationEventType;
|
|
35
68
|
subject: OrganizationEventSubject;
|
|
36
69
|
occurredAt: string;
|
|
37
70
|
}
|
|
@@ -50,3 +83,4 @@ export declare const ORGANIZATION_STREAM_CONTROL: {
|
|
|
50
83
|
readonly accessRevoked: "stream.access_revoked";
|
|
51
84
|
};
|
|
52
85
|
export type OrganizationStreamControl = (typeof ORGANIZATION_STREAM_CONTROL)[keyof typeof ORGANIZATION_STREAM_CONTROL];
|
|
86
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization-events.js","sourceRoot":"","sources":["../src/organization-events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"organization-events.js","sourceRoot":"","sources":["../src/organization-events.ts"],"names":[],"mappings":"AAiEA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,KAAK,EAAE,cAAc;IACrB,YAAY,EAAE,sBAAsB;IACpC,aAAa,EAAE,uBAAuB;CAC9B,CAAC"}
|
package/dist/organizations.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type { OrganizationApplicationInput } from './console.js';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* An organization's loyalty program terms, as approved through `PROVISION_PROGRAM` and later
|
|
4
|
+
* `UPDATE_EARN_RATE` requests. `status` is `PROVISIONING` while the chain calls run, then `ACTIVE`.
|
|
5
|
+
*/
|
|
6
|
+
export interface ProgramTerms {
|
|
7
|
+
status: string;
|
|
8
|
+
/** Points per 10,000 units of purchase. */
|
|
3
9
|
earnBps: number;
|
|
10
|
+
/** How long earned points last. Set once, at provisioning; never changes. */
|
|
4
11
|
expiryDays: number;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
/** The issuance budget set at provisioning, before any top-up (see the budget read for the live figure). */
|
|
13
|
+
initialBudget: number;
|
|
14
|
+
/** 1 at provisioning; each applied earn-rate change adds one. */
|
|
15
|
+
policyVersion: number;
|
|
8
16
|
}
|
|
9
17
|
export interface OrganizationProvisioningStatus {
|
|
10
18
|
operationId: string;
|
|
@@ -24,6 +32,8 @@ export interface PlatformOrganization {
|
|
|
24
32
|
logoUrl: string | null;
|
|
25
33
|
programStatus: string | null;
|
|
26
34
|
programControlId: string | null;
|
|
35
|
+
/** The program's current terms; null before a `PROVISION_PROGRAM` request is approved and run. */
|
|
36
|
+
program: ProgramTerms | null;
|
|
27
37
|
createdAt: string;
|
|
28
38
|
provisioning: OrganizationProvisioningStatus | null;
|
|
29
39
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { ProgramAnalyticsQuery, ProgramAnalyticsSummary } from './analytics.js';
|
|
2
|
+
import type { RequestLogCredentialRef, RequestLogTailQuery, RequestLogDetail, RequestLogEntry, RequestLogErrorGroup, RequestLogFilters, RequestLogListQuery, RequestLogStats, RequestLogSummary, RequestLogTimeseriesQuery } from './request-logs.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a System Admin reads about the platform (OCT-352), under `/v1/platform`. Figures across
|
|
5
|
+
* organizations are for the platform only: no console route ever shows one merchant another's data.
|
|
6
|
+
* A System Admin's read of one organization's audit log or request log is recorded in that
|
|
7
|
+
* organization's own audit log (`platform.audit_log.read`, `platform.request_log.read`).
|
|
8
|
+
*/
|
|
9
|
+
/** `GET /v1/platform/analytics/summary`: the console summary's figures, summed over every organization. */
|
|
10
|
+
export interface PlatformAnalyticsSummary extends ProgramAnalyticsSummary {
|
|
11
|
+
/** Organizations currently ACTIVE. */
|
|
12
|
+
activeOrganizations: number;
|
|
13
|
+
}
|
|
14
|
+
export type PlatformOrganizationAnalyticsSort = 'earned' | 'redeemed' | 'activeMembers' | 'enrolledMembers' | 'name';
|
|
15
|
+
/** `GET /v1/platform/analytics/organizations`: one row per organization, paged. */
|
|
16
|
+
export interface PlatformOrganizationAnalyticsQuery extends ProgramAnalyticsQuery {
|
|
17
|
+
/** From 1. */
|
|
18
|
+
page?: number;
|
|
19
|
+
/** 1–100, default 25. */
|
|
20
|
+
limit?: number;
|
|
21
|
+
/** Default `earned`. Figures sort largest first, `name` A to Z. */
|
|
22
|
+
sort?: PlatformOrganizationAnalyticsSort;
|
|
23
|
+
}
|
|
24
|
+
/** One organization's figures in the window. An organization with no activity shows zeros. */
|
|
25
|
+
export interface PlatformOrganizationAnalytics {
|
|
26
|
+
organizationId: string;
|
|
27
|
+
name: string;
|
|
28
|
+
slug: string;
|
|
29
|
+
status: string;
|
|
30
|
+
/** CONFIRMED earns in the window. */
|
|
31
|
+
earned: number;
|
|
32
|
+
/** CONFIRMED redemptions in the window. */
|
|
33
|
+
redeemed: number;
|
|
34
|
+
/** Distinct members with a CONFIRMED earn or redeem in the window. */
|
|
35
|
+
activeMembers: number;
|
|
36
|
+
/** Everyone ever enrolled, regardless of the window. */
|
|
37
|
+
enrolledMembers: number;
|
|
38
|
+
}
|
|
39
|
+
export interface PlatformOrganizationAnalyticsPage {
|
|
40
|
+
from: string;
|
|
41
|
+
to: string;
|
|
42
|
+
items: PlatformOrganizationAnalytics[];
|
|
43
|
+
page: number;
|
|
44
|
+
limit: number;
|
|
45
|
+
/** Organizations listed: every approved one (ACTIVE, SUSPENDED or ARCHIVED), never a pending or rejected application. */
|
|
46
|
+
total: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Request-log filters across organizations. With `organizationId`, or a `credentialId` (a key
|
|
50
|
+
* belongs to one organization), the read covers that organization only and is recorded in its
|
|
51
|
+
* audit log.
|
|
52
|
+
*/
|
|
53
|
+
export interface PlatformRequestLogFilters extends RequestLogFilters {
|
|
54
|
+
/** @format uuid */
|
|
55
|
+
organizationId?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface PlatformRequestLogListQuery extends RequestLogListQuery {
|
|
58
|
+
/** @format uuid */
|
|
59
|
+
organizationId?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface PlatformRequestLogTimeseriesQuery extends RequestLogTimeseriesQuery {
|
|
62
|
+
/** @format uuid */
|
|
63
|
+
organizationId?: string;
|
|
64
|
+
}
|
|
65
|
+
/** The organization a logged call belongs to. */
|
|
66
|
+
export interface PlatformOrganizationRef {
|
|
67
|
+
organizationId: string;
|
|
68
|
+
organizationName: string;
|
|
69
|
+
}
|
|
70
|
+
export type PlatformRequestLogEntry = RequestLogEntry & PlatformOrganizationRef;
|
|
71
|
+
export interface PlatformRequestLogPage {
|
|
72
|
+
items: PlatformRequestLogEntry[];
|
|
73
|
+
page: number;
|
|
74
|
+
limit: number;
|
|
75
|
+
total: number;
|
|
76
|
+
}
|
|
77
|
+
export type PlatformRequestLogDetail = RequestLogDetail & PlatformOrganizationRef;
|
|
78
|
+
/**
|
|
79
|
+
* `GET /v1/platform/request-logs/tail`: the console's live tail across organizations, or one with
|
|
80
|
+
* `organizationId` (or a key's). Narrowed, it is recorded in that organization's audit log once,
|
|
81
|
+
* when the tail opens (the call without a cursor), not on every poll.
|
|
82
|
+
*/
|
|
83
|
+
export interface PlatformRequestLogTailQuery extends RequestLogTailQuery {
|
|
84
|
+
/** @format uuid */
|
|
85
|
+
organizationId?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface PlatformRequestLogTail {
|
|
88
|
+
items: PlatformRequestLogEntry[];
|
|
89
|
+
/** Opaque. Pass it back on the next poll, with the same filters. */
|
|
90
|
+
cursor: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The console summary, plus the 20 busiest organizations (empty when narrowed to one). Each key names
|
|
94
|
+
* its organization; across organizations only the 20 busiest keys are listed.
|
|
95
|
+
*/
|
|
96
|
+
export interface PlatformRequestLogSummary extends Omit<RequestLogSummary, 'byCredential'> {
|
|
97
|
+
byCredential: (RequestLogStats & {
|
|
98
|
+
credential: RequestLogCredentialRef;
|
|
99
|
+
} & PlatformOrganizationRef)[];
|
|
100
|
+
byOrganization: (RequestLogStats & PlatformOrganizationRef)[];
|
|
101
|
+
}
|
|
102
|
+
/** Failed calls grouped by organization, endpoint, status and error code. */
|
|
103
|
+
export type PlatformRequestLogErrorGroup = RequestLogErrorGroup & PlatformOrganizationRef;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-observability.js","sourceRoot":"","sources":["../src/platform-observability.ts"],"names":[],"mappings":""}
|
package/dist/rewards.d.ts
CHANGED
|
@@ -128,8 +128,13 @@ export interface CreateVoucherRequest {
|
|
|
128
128
|
validForDays?: number | null;
|
|
129
129
|
metadata?: Record<string, unknown>;
|
|
130
130
|
status?: 'DRAFT' | 'ACTIVE' | 'PAUSED';
|
|
131
|
+
/**
|
|
132
|
+
* The campaign it belongs to (OCT-340): one of this organization's that is not ENDED or ARCHIVED.
|
|
133
|
+
* Set only on create; it never changes afterwards.
|
|
134
|
+
*/
|
|
135
|
+
campaignId?: string;
|
|
131
136
|
}
|
|
132
|
-
export type UpdateVoucherRequest = Partial<CreateVoucherRequest
|
|
137
|
+
export type UpdateVoucherRequest = Partial<Omit<CreateVoucherRequest, 'campaignId'>>;
|
|
133
138
|
export interface VoucherDto {
|
|
134
139
|
id: string;
|
|
135
140
|
organizationId: string;
|
|
@@ -159,6 +164,8 @@ export interface VoucherDto {
|
|
|
159
164
|
approval?: VoucherApprovalDto | null;
|
|
160
165
|
/** The batch it was created or last imported in (`createVoucherBatch`), `null` if created on its own. */
|
|
161
166
|
batchId?: string | null;
|
|
167
|
+
/** The campaign it belongs to (OCT-340), `null` if none. */
|
|
168
|
+
campaignId?: string | null;
|
|
162
169
|
/** Who created it (or last replaced it by importing its code again); `null` if not recorded. */
|
|
163
170
|
createdBy: VoucherActorRef;
|
|
164
171
|
/**
|
|
@@ -276,6 +283,11 @@ export interface CreateVoucherBatchRequest {
|
|
|
276
283
|
items: VoucherBatchItem[];
|
|
277
284
|
/** Run every check and report each item's result, but write nothing. */
|
|
278
285
|
dryRun?: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* A campaign (OCT-340), not ENDED or ARCHIVED, that every voucher this batch creates (or brings back
|
|
288
|
+
* from ARCHIVED) joins. A voucher the batch leaves as it is keeps its own campaign.
|
|
289
|
+
*/
|
|
290
|
+
campaignId?: string;
|
|
279
291
|
}
|
|
280
292
|
/** Machine-readable reason an item was not written. */
|
|
281
293
|
export type VoucherBatchItemErrorCode =
|
package/dist/rewards.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewards.js","sourceRoot":"","sources":["../src/rewards.ts"],"names":[],"mappings":"AA4DA;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7D,mFAAmF;AACnF,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAyC;IAC5E,OAAO,CAAC,OAAO,CAAC,YAAY,IA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