@iveri/contracts 0.99.0 → 0.101.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 +2 -0
- package/dist/api/billing/usage.type.d.ts +23 -0
- package/dist/api/conduit/conduit-usage.type.d.ts +26 -0
- package/dist/api/conduit/conduit-usage.type.js +17 -0
- package/dist/api/conduit/index.d.ts +1 -0
- package/dist/api/conduit/index.js +1 -0
- package/dist/api/hr/hr-employee.type.d.ts +2 -1
- package/dist/api/identity/auth.type.d.ts +20 -0
- package/dist/api/notification/notification.type.d.ts +7 -1
- package/dist/api/platform/platform.type.d.ts +7 -3
- package/dist/enum/user-permission.enum.d.ts +8 -0
- package/dist/enum/user-permission.enum.js +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -266,6 +266,8 @@ Conduit's outbox.
|
|
|
266
266
|
- Version `0.18.0` adds the localization entry point and the `localization:read`,
|
|
267
267
|
`localization:message:manage`, `localization:translate`, `localization:publish` and
|
|
268
268
|
`localization:render` permissions.
|
|
269
|
+
- Version `0.100.0` adds `notification:send-any`, the password-reset bodies and Conduit's usage metrics.
|
|
270
|
+
- Version `0.101.0` adds `UsageHistory`, a company's closed months of a product by metric.
|
|
269
271
|
- Widening a type is minor; narrowing it is major.
|
|
270
272
|
- Under `api/`, the contract follows the service: add the field to the service's DTO and to the
|
|
271
273
|
interface in the same release, and let `implements` prove they agree.
|
|
@@ -44,6 +44,29 @@ export interface UsageSummary {
|
|
|
44
44
|
plan: Nullable<UsagePlan>;
|
|
45
45
|
metrics: UsageMetricSummary[];
|
|
46
46
|
}
|
|
47
|
+
/** How much of one metric a company used in one month. */
|
|
48
|
+
export interface UsageMonthMetric {
|
|
49
|
+
metric: string;
|
|
50
|
+
quantity: number;
|
|
51
|
+
}
|
|
52
|
+
/** One closed calendar month in UTC, its end exclusive, with every metric of the product used in it. */
|
|
53
|
+
export interface UsageMonth {
|
|
54
|
+
periodStart: IsoDateTime;
|
|
55
|
+
periodEnd: IsoDateTime;
|
|
56
|
+
/** By metric name. Empty for a month with no usage, which is still listed. */
|
|
57
|
+
metrics: UsageMonthMetric[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* `GET /billing/usage/months?product=&months=` (a company's own) or `?tenantId=&product=&months=` (behind
|
|
61
|
+
* `billing:usage:read-any`): the months before the current one, newest first, `months` of them. **No plan and no
|
|
62
|
+
* limits**: the plan a company was on in a past month is not recorded, and today's would be read as that month's. What
|
|
63
|
+
* it was billed against is on that month's invoice.
|
|
64
|
+
*/
|
|
65
|
+
export interface UsageHistory {
|
|
66
|
+
tenantId: UUID;
|
|
67
|
+
product: IveriProduct;
|
|
68
|
+
months: UsageMonth[];
|
|
69
|
+
}
|
|
47
70
|
/** One line of an invoice, as it was when the invoice was issued. */
|
|
48
71
|
export interface UsageInvoiceLine {
|
|
49
72
|
description: string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
2
|
+
import type { UsageInvoice, UsageSummary } from '../billing/usage.type.js';
|
|
3
|
+
/**
|
|
4
|
+
* What Conduit meters for each company, as the metric names billing stores and a plan's limits name. A month is a
|
|
5
|
+
* calendar month in UTC.
|
|
6
|
+
*
|
|
7
|
+
* **Counted, never enforced.** Refusing a provider's webhook because a plan ran out loses that company's data — the
|
|
8
|
+
* provider gives up after its own retries — so whether and how an ingress gateway stops at a limit is a product
|
|
9
|
+
* decision nobody has made. Until it is, a plan's limits for these metrics are shown and nothing refuses on them.
|
|
10
|
+
*/
|
|
11
|
+
export declare enum ConduitUsageMetric {
|
|
12
|
+
/** Webhooks a provider posted to one of the company's ingress endpoints, whatever became of them. */
|
|
13
|
+
WEBHOOKS_RECEIVED = "conduit.webhooks-received",
|
|
14
|
+
/** Deliveries a destination accepted: a webhook forwarded once per destination that took it. */
|
|
15
|
+
DELIVERIES_FORWARDED = "conduit.deliveries-forwarded",
|
|
16
|
+
/** Dispatches a third-party API accepted on the company's behalf. */
|
|
17
|
+
DISPATCHES_SENT = "conduit.dispatches-sent"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* `GET /usage`: the company's month against its Conduit plan, and the invoices built from its usage. `summary` is null
|
|
21
|
+
* when billing could not be asked, which the panel says rather than showing zeroes.
|
|
22
|
+
*/
|
|
23
|
+
export interface ConduitUsage {
|
|
24
|
+
summary: Nullable<UsageSummary>;
|
|
25
|
+
invoices: UsageInvoice[];
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Conduit meters for each company, as the metric names billing stores and a plan's limits name. A month is a
|
|
3
|
+
* calendar month in UTC.
|
|
4
|
+
*
|
|
5
|
+
* **Counted, never enforced.** Refusing a provider's webhook because a plan ran out loses that company's data — the
|
|
6
|
+
* provider gives up after its own retries — so whether and how an ingress gateway stops at a limit is a product
|
|
7
|
+
* decision nobody has made. Until it is, a plan's limits for these metrics are shown and nothing refuses on them.
|
|
8
|
+
*/
|
|
9
|
+
export var ConduitUsageMetric;
|
|
10
|
+
(function (ConduitUsageMetric) {
|
|
11
|
+
/** Webhooks a provider posted to one of the company's ingress endpoints, whatever became of them. */
|
|
12
|
+
ConduitUsageMetric["WEBHOOKS_RECEIVED"] = "conduit.webhooks-received";
|
|
13
|
+
/** Deliveries a destination accepted: a webhook forwarded once per destination that took it. */
|
|
14
|
+
ConduitUsageMetric["DELIVERIES_FORWARDED"] = "conduit.deliveries-forwarded";
|
|
15
|
+
/** Dispatches a third-party API accepted on the company's behalf. */
|
|
16
|
+
ConduitUsageMetric["DISPATCHES_SENT"] = "conduit.dispatches-sent";
|
|
17
|
+
})(ConduitUsageMetric || (ConduitUsageMetric = {}));
|
|
@@ -91,7 +91,8 @@ export interface HrImportRowResult {
|
|
|
91
91
|
}
|
|
92
92
|
export interface HrInvitation {
|
|
93
93
|
userId: UUID;
|
|
94
|
-
|
|
94
|
+
/** Null when identity emailed the invitation itself, so there is nothing for HR to pass on. */
|
|
95
|
+
invitationToken: Nullable<string>;
|
|
95
96
|
invitationExpiresAt: string;
|
|
96
97
|
isEmailSent: boolean;
|
|
97
98
|
}
|
|
@@ -34,6 +34,26 @@ export interface AcceptInvitationBody {
|
|
|
34
34
|
invitationToken: string;
|
|
35
35
|
password: string;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* `POST /auth/password-reset` — ask for a reset email. Always answered with a 202 and no body, whether or not the
|
|
39
|
+
* workspace or the address exist, so the route says nothing about who has an account.
|
|
40
|
+
*/
|
|
41
|
+
export interface RequestPasswordResetBody {
|
|
42
|
+
tenantSlug: string;
|
|
43
|
+
email: string;
|
|
44
|
+
/** The language of the email. Unset falls back to the workspace's source locale. */
|
|
45
|
+
localeCode?: Nullable<string>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* `POST /auth/password-reset/confirm` — set a new password from the emailed link. The token is single-use and short
|
|
49
|
+
* lived; using it signs the person out everywhere, because every refresh token they held is revoked.
|
|
50
|
+
*/
|
|
51
|
+
export interface ConfirmPasswordResetBody {
|
|
52
|
+
/** The workspace the link names. Resolves the tenant before the token is looked up within it. */
|
|
53
|
+
tenantSlug: string;
|
|
54
|
+
resetToken: string;
|
|
55
|
+
password: string;
|
|
56
|
+
}
|
|
37
57
|
/** Returned by `POST /auth/refresh`, and nested inside {@link AuthSession}. */
|
|
38
58
|
export interface AuthTokens {
|
|
39
59
|
/** Send as `Authorization: Bearer <accessToken>`. */
|
|
@@ -101,8 +101,14 @@ export interface SubmitNotificationBody {
|
|
|
101
101
|
localeCode?: Nullable<string>;
|
|
102
102
|
};
|
|
103
103
|
variables?: Nullable<Record<string, string | number>>;
|
|
104
|
-
/** Strongly recommended. Without one, a retried submit tells somebody the same thing twice. */
|
|
104
|
+
/** Strongly recommended. Without one, a retried submit tells somebody the same thing twice. Unique per company. */
|
|
105
105
|
idempotencyKey?: Nullable<string>;
|
|
106
|
+
/**
|
|
107
|
+
* The company the notification is for, when it is not the token's own. Refused with a 403 unless the token holds
|
|
108
|
+
* `notification:send-any` and comes from Iveri's operator workspace; naming one's own company counts as naming one.
|
|
109
|
+
* The notification is stored in, rendered for and deduplicated within the company it names.
|
|
110
|
+
*/
|
|
111
|
+
tenantId?: UUID;
|
|
106
112
|
}
|
|
107
113
|
export interface SubmitNotificationResponse {
|
|
108
114
|
id: UUID;
|
|
@@ -31,12 +31,16 @@ export interface CreatePlatformTenantRequest {
|
|
|
31
31
|
ownerLastName: string;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* The new company and the owner's invitation.
|
|
35
|
-
*
|
|
34
|
+
* The new company and the owner's invitation. Identity emails the owner the link in the new company; the token comes
|
|
35
|
+
* back only when that email could not be sent, so the operator can pass the link on once, or where a local stack asks
|
|
36
|
+
* for it.
|
|
36
37
|
*/
|
|
37
38
|
export interface CreatedPlatformTenant {
|
|
38
39
|
tenant: PlatformTenant;
|
|
39
|
-
|
|
40
|
+
/** True when the invitation email was handed to the notification service. */
|
|
41
|
+
isOwnerInvitationEmailSent: boolean;
|
|
42
|
+
/** Null once the email went out, unless the deployment returns invitation tokens for its own seeding. */
|
|
43
|
+
ownerInvitationToken: Nullable<string>;
|
|
40
44
|
}
|
|
41
45
|
/** Suspend or reactivate a company. The reason is required, because it is what the next operator reads. */
|
|
42
46
|
export interface UpdatePlatformTenantStatusRequest {
|
|
@@ -342,6 +342,14 @@ export declare enum UserPermission {
|
|
|
342
342
|
* send arbitrary text from our own domain to any address it likes.
|
|
343
343
|
*/
|
|
344
344
|
NOTIFICATION_SEND = "notification:send",
|
|
345
|
+
/**
|
|
346
|
+
* Submit a notification for a company the request names in `tenantId`, rather than the token's own. A platform
|
|
347
|
+
* permission: held only by a service credential in Iveri's operator workspace, so `iveri-identity-api` can email an
|
|
348
|
+
* invitation or a password reset for whichever company the person belongs to. The notification is stored in, and
|
|
349
|
+
* rendered for, the company it names; the template rule above still holds, so the holder can no more choose the
|
|
350
|
+
* words than a holder of `notification:send` can.
|
|
351
|
+
*/
|
|
352
|
+
NOTIFICATION_SEND_ANY = "notification:send-any",
|
|
345
353
|
/**
|
|
346
354
|
* Read **your own** in-app inbox, and mark your own rows read.
|
|
347
355
|
*
|
|
@@ -399,6 +399,14 @@ export var UserPermission;
|
|
|
399
399
|
* send arbitrary text from our own domain to any address it likes.
|
|
400
400
|
*/
|
|
401
401
|
UserPermission["NOTIFICATION_SEND"] = "notification:send";
|
|
402
|
+
/**
|
|
403
|
+
* Submit a notification for a company the request names in `tenantId`, rather than the token's own. A platform
|
|
404
|
+
* permission: held only by a service credential in Iveri's operator workspace, so `iveri-identity-api` can email an
|
|
405
|
+
* invitation or a password reset for whichever company the person belongs to. The notification is stored in, and
|
|
406
|
+
* rendered for, the company it names; the template rule above still holds, so the holder can no more choose the
|
|
407
|
+
* words than a holder of `notification:send` can.
|
|
408
|
+
*/
|
|
409
|
+
UserPermission["NOTIFICATION_SEND_ANY"] = "notification:send-any";
|
|
402
410
|
/**
|
|
403
411
|
* Read **your own** in-app inbox, and mark your own rows read.
|
|
404
412
|
*
|
|
@@ -729,6 +737,7 @@ export const PLATFORM_PERMISSIONS = Object.freeze([
|
|
|
729
737
|
UserPermission.PLATFORM_BACKOFFICE_READ,
|
|
730
738
|
UserPermission.BILLING_USAGE_RECORD_ANY,
|
|
731
739
|
UserPermission.BILLING_USAGE_READ_ANY,
|
|
740
|
+
UserPermission.NOTIFICATION_SEND_ANY,
|
|
732
741
|
]);
|
|
733
742
|
/** Whether a permission acts across companies, and so may only be held in Iveri's operator workspace. */
|
|
734
743
|
export function isPlatformPermission(permission) {
|