@octap/contracts 0.3.0 → 0.3.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/CHANGELOG.md +15 -0
- package/dist/announcements.d.ts +58 -0
- package/dist/announcements.js +12 -0
- package/dist/announcements.js.map +1 -0
- package/dist/exports.d.ts +54 -0
- package/dist/exports.js +9 -1
- package/dist/exports.js.map +1 -1
- package/dist/governance.d.ts +14 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/licensing.d.ts +145 -0
- package/dist/licensing.js +1 -0
- package/dist/licensing.js.map +1 -1
- package/dist/loyalty.d.ts +8 -0
- package/dist/notifications.js +13 -1
- package/dist/notifications.js.map +1 -1
- package/dist/organization-events.d.ts +21 -1
- package/dist/organization-events.js.map +1 -1
- package/dist/organization-slugs.d.ts +84 -0
- package/dist/organization-slugs.js +115 -0
- package/dist/organization-slugs.js.map +1 -0
- package/dist/organizations.d.ts +6 -1
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
Additive only: no type was removed or narrowed, so `^0.3.0` consumers pick it up as is.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Program budget cap: `ProgramTerms.budgetCap`; `IssuanceBudgetDto.budgetCap` and `topUpHeadroom`;
|
|
10
|
+
`GovernanceRequestType` gains `PROGRAM_CAP_CHANGE` (`{ budgetCap }`); `PROVISION_PROGRAM` accepts
|
|
11
|
+
an optional `budgetCap`. A `BUDGET_TOP_UP` within the cap is approved without review.
|
|
12
|
+
- System Admin license overview types (OCT-346).
|
|
13
|
+
- Platform announcements (OCT-396).
|
|
14
|
+
- Organization slug rules and availability check (OCT-367).
|
|
15
|
+
- Background CSV export types (OCT-402).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform announcements (OCT-396): a System Admin tells organizations something themselves, such as
|
|
3
|
+
* planned maintenance or new prices. Each one reaches every active member of the organizations it was
|
|
4
|
+
* sent to as a `platform.announcement` notification (in-app only, never a webhook). A sent
|
|
5
|
+
* announcement is never edited or deleted: a correction is a new one.
|
|
6
|
+
*/
|
|
7
|
+
/** How urgent an announcement is. */
|
|
8
|
+
export type AnnouncementSeverity = 'INFO' | 'WARNING';
|
|
9
|
+
export declare const ANNOUNCEMENT_SEVERITIES: readonly AnnouncementSeverity[];
|
|
10
|
+
export declare const ANNOUNCEMENT_TITLE_MAX = 120;
|
|
11
|
+
export declare const ANNOUNCEMENT_BODY_MAX = 1000;
|
|
12
|
+
/** Organizations one announcement may name; to reach more, send it to all. */
|
|
13
|
+
export declare const ANNOUNCEMENT_TARGETS_MAX = 500;
|
|
14
|
+
/**
|
|
15
|
+
* `POST /v1/platform/announcements`. Exactly one target: `organizationIds` (one or more) or
|
|
16
|
+
* `allOrganizations: true`, which means every organization that is active when it's sent.
|
|
17
|
+
*/
|
|
18
|
+
export interface CreateAnnouncementInput {
|
|
19
|
+
/** 1–120 characters. */
|
|
20
|
+
title: string;
|
|
21
|
+
/** At most 1000 characters. */
|
|
22
|
+
body?: string | null;
|
|
23
|
+
/** An https URL. */
|
|
24
|
+
link?: string | null;
|
|
25
|
+
/** Default `INFO`. */
|
|
26
|
+
severity?: AnnouncementSeverity;
|
|
27
|
+
organizationIds?: string[];
|
|
28
|
+
allOrganizations?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** A sent announcement, as the platform's list shows it. */
|
|
31
|
+
export interface Announcement {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
body: string | null;
|
|
35
|
+
link: string | null;
|
|
36
|
+
severity: AnnouncementSeverity;
|
|
37
|
+
/** Whether it went to every active organization. */
|
|
38
|
+
allOrganizations: boolean;
|
|
39
|
+
/** How many organizations it reached. */
|
|
40
|
+
targetCount: number;
|
|
41
|
+
/** The System Admin who sent it. */
|
|
42
|
+
sentBy: {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string | null;
|
|
45
|
+
};
|
|
46
|
+
sentAt: string;
|
|
47
|
+
}
|
|
48
|
+
/** `GET /v1/platform/announcements`: newest first. `limit` 1–100, default 30. */
|
|
49
|
+
export interface AnnouncementListQuery {
|
|
50
|
+
/** The `nextCursor` of the previous page. */
|
|
51
|
+
cursor?: string;
|
|
52
|
+
limit?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface AnnouncementPage {
|
|
55
|
+
items: Announcement[];
|
|
56
|
+
/** Pass as `cursor` for the next, older page; `null` once there is no more. */
|
|
57
|
+
nextCursor: string | null;
|
|
58
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform announcements (OCT-396): a System Admin tells organizations something themselves, such as
|
|
3
|
+
* planned maintenance or new prices. Each one reaches every active member of the organizations it was
|
|
4
|
+
* sent to as a `platform.announcement` notification (in-app only, never a webhook). A sent
|
|
5
|
+
* announcement is never edited or deleted: a correction is a new one.
|
|
6
|
+
*/
|
|
7
|
+
export const ANNOUNCEMENT_SEVERITIES = ['INFO', 'WARNING'];
|
|
8
|
+
export const ANNOUNCEMENT_TITLE_MAX = 120;
|
|
9
|
+
export const ANNOUNCEMENT_BODY_MAX = 1000;
|
|
10
|
+
/** Organizations one announcement may name; to reach more, send it to all. */
|
|
11
|
+
export const ANNOUNCEMENT_TARGETS_MAX = 500;
|
|
12
|
+
//# sourceMappingURL=announcements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"announcements.js","sourceRoot":"","sources":["../src/announcements.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,CAAC,MAAM,uBAAuB,GAAoC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAE5F,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAC1C,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAC1C,8EAA8E;AAC9E,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC"}
|
package/dist/exports.d.ts
CHANGED
|
@@ -34,3 +34,57 @@ export interface ExportLink {
|
|
|
34
34
|
/** Rows the file holds, counted when the link was made. */
|
|
35
35
|
rows: number;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* A file over the streaming limit (100,000 rows) is refused with a 400 whose `error` is this code; send
|
|
39
|
+
* the same request as a background export job instead (`POST …/export-jobs`, OCT-402).
|
|
40
|
+
*/
|
|
41
|
+
export declare const EXPORT_TOO_LARGE = "EXPORT_TOO_LARGE";
|
|
42
|
+
/** The most rows a background export job may hold. */
|
|
43
|
+
export declare const EXPORT_JOB_MAX_ROWS = 2000000;
|
|
44
|
+
/** How long a finished job's file is kept, in hours; afterwards the job is `EXPIRED`. */
|
|
45
|
+
export declare const EXPORT_JOB_RETENTION_HOURS = 24;
|
|
46
|
+
/**
|
|
47
|
+
* `QUEUED` until a worker picks it up, `RUNNING` while it writes the file, then `READY` (download it
|
|
48
|
+
* until `expiresAt`), `FAILED` (`error` says why; nothing is kept) or `EXPIRED` (the file is gone).
|
|
49
|
+
*/
|
|
50
|
+
export type ExportJobStatus = 'QUEUED' | 'RUNNING' | 'READY' | 'FAILED' | 'EXPIRED';
|
|
51
|
+
/** `POST /v1/console/organizations/{organizationId}/export-jobs`: the same body as an export link. */
|
|
52
|
+
export type ExportJobInput = ExportLinkInput;
|
|
53
|
+
/** A background export (OCT-402): a file over the streaming limit, kept for a day once written. */
|
|
54
|
+
export interface ExportJob {
|
|
55
|
+
id: string;
|
|
56
|
+
dataset: ExportDataset;
|
|
57
|
+
/** The filters it was asked with, checked: `from` and `to` filled in. */
|
|
58
|
+
filters: Record<string, string>;
|
|
59
|
+
status: ExportJobStatus;
|
|
60
|
+
/** Rows counted when it was asked for; the exact count once `READY`. */
|
|
61
|
+
rows: number;
|
|
62
|
+
/** Bytes, once `READY`. */
|
|
63
|
+
sizeBytes: number | null;
|
|
64
|
+
/** SHA-256 of the file, hex, once `READY`. */
|
|
65
|
+
sha256: string | null;
|
|
66
|
+
/** The download file name, e.g. `octap-transactions-2026-12-02.csv`. */
|
|
67
|
+
filename: string;
|
|
68
|
+
/** Why it failed, when `FAILED`. */
|
|
69
|
+
error: string | null;
|
|
70
|
+
requestedBy: {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string | null;
|
|
73
|
+
} | null;
|
|
74
|
+
createdAt: string;
|
|
75
|
+
finishedAt: string | null;
|
|
76
|
+
/** When the file is deleted, once `READY`. */
|
|
77
|
+
expiresAt: string | null;
|
|
78
|
+
}
|
|
79
|
+
export interface ExportJobPage {
|
|
80
|
+
items: ExportJob[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A one-time link to a `READY` job's file, for 5 minutes, for the MCP assistant: opening it checks the
|
|
84
|
+
* user's access again and redirects to the file. Never a storage URL.
|
|
85
|
+
*/
|
|
86
|
+
export interface ExportJobLink {
|
|
87
|
+
jobId: string;
|
|
88
|
+
url: string;
|
|
89
|
+
expiresAt: string;
|
|
90
|
+
}
|
package/dist/exports.js
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A file over the streaming limit (100,000 rows) is refused with a 400 whose `error` is this code; send
|
|
3
|
+
* the same request as a background export job instead (`POST …/export-jobs`, OCT-402).
|
|
4
|
+
*/
|
|
5
|
+
export const EXPORT_TOO_LARGE = 'EXPORT_TOO_LARGE';
|
|
6
|
+
/** The most rows a background export job may hold. */
|
|
7
|
+
export const EXPORT_JOB_MAX_ROWS = 2_000_000;
|
|
8
|
+
/** How long a finished job's file is kept, in hours; afterwards the job is `EXPIRED`. */
|
|
9
|
+
export const EXPORT_JOB_RETENTION_HOURS = 24;
|
|
2
10
|
//# sourceMappingURL=exports.js.map
|
package/dist/exports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAwCA;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,sDAAsD;AACtD,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAC7C,yFAAyF;AACzF,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC"}
|
package/dist/governance.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OrganizationIdentityInput, OrganizationType } from './console.js';
|
|
2
|
-
export type GovernanceRequestType = 'UPDATE_PROFILE' | 'TRANSFER_OWNERSHIP' | 'DEACTIVATE' | 'BUDGET_TOP_UP' | 'SUSPEND' | 'REINSTATE' | 'UPDATE_IDENTITY' | 'UPDATE_EARN_RATE' | 'PROVISION_PROGRAM';
|
|
2
|
+
export type GovernanceRequestType = 'UPDATE_PROFILE' | 'TRANSFER_OWNERSHIP' | 'DEACTIVATE' | 'BUDGET_TOP_UP' | 'SUSPEND' | 'REINSTATE' | 'UPDATE_IDENTITY' | 'UPDATE_EARN_RATE' | 'PROVISION_PROGRAM' | 'PROGRAM_CAP_CHANGE';
|
|
3
3
|
/**
|
|
4
4
|
* `UPDATE_IDENTITY` replaces an organization's legal details once a System Admin approves it. Send
|
|
5
5
|
* at least one field; `organizationType` only classifies an organization that has none yet. The
|
|
@@ -14,12 +14,19 @@ export interface GovernanceProposal {
|
|
|
14
14
|
/**
|
|
15
15
|
* The program terms are the merchant's to choose and are proposed by the organization's Owner
|
|
16
16
|
* only; a System Admin approves or rejects them with a reason, and never proposes them:
|
|
17
|
-
* - `PROVISION_PROGRAM`: `{ earnBps, expiryDays, totalBudget }` sets up the
|
|
18
|
-
* program. `earnBps` 0–10000 (points per 10,000 units of purchase),
|
|
19
|
-
* long earned points last; never changes afterwards), `totalBudget` a
|
|
20
|
-
* points it may issue
|
|
21
|
-
*
|
|
17
|
+
* - `PROVISION_PROGRAM`: `{ earnBps, expiryDays, totalBudget, budgetCap? }` sets up the
|
|
18
|
+
* organization's loyalty program. `earnBps` 0–10000 (points per 10,000 units of purchase),
|
|
19
|
+
* `expiryDays` 1–3650 (how long earned points last; never changes afterwards), `totalBudget` a
|
|
20
|
+
* positive whole number of points it may issue, `budgetCap` the most it may ever be funded with,
|
|
21
|
+
* top-ups included: at least `totalBudget`, which it defaults to.
|
|
22
|
+
* - `BUDGET_TOP_UP`: `{ amount }`, a positive whole number of points. The budget only grows. Needs
|
|
23
|
+
* no review: it is created `APPROVED` and applied at once when it fits within `budgetCap`, and
|
|
24
|
+
* refused with 409 otherwise (raise the cap first). One runs at a time: while the last is still
|
|
25
|
+
* being applied, or ended UNKNOWN, another is a 409. A repeat sent after the first has finished
|
|
26
|
+
* is a new top-up, still bounded by `budgetCap`.
|
|
22
27
|
* - `UPDATE_EARN_RATE`: `{ earnBps }`, 0–10000, which replaces the base earn rate once approved.
|
|
28
|
+
* - `PROGRAM_CAP_CHANGE`: `{ budgetCap }`, a positive whole number of points, up or down, but never
|
|
29
|
+
* below what the program is already funded with. Applies on approval, with no chain call.
|
|
23
30
|
*/
|
|
24
31
|
payload: {
|
|
25
32
|
name?: string;
|
|
@@ -28,6 +35,7 @@ export interface GovernanceProposal {
|
|
|
28
35
|
earnBps?: number;
|
|
29
36
|
expiryDays?: number;
|
|
30
37
|
totalBudget?: number;
|
|
38
|
+
budgetCap?: number;
|
|
31
39
|
} & IdentityChangePayload;
|
|
32
40
|
}
|
|
33
41
|
export interface GovernanceRequest {
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './console.js';
|
|
|
10
10
|
export * from './members.js';
|
|
11
11
|
export * from './governance.js';
|
|
12
12
|
export * from './organizations.js';
|
|
13
|
+
export * from './organization-slugs.js';
|
|
13
14
|
export * from './mcp-auth.js';
|
|
14
15
|
export * from './mcp-tool-calls.js';
|
|
15
16
|
export * from './assistant.js';
|
|
@@ -22,3 +23,4 @@ export * from './exports.js';
|
|
|
22
23
|
export * from './member-insights.js';
|
|
23
24
|
export * from './platform-observability.js';
|
|
24
25
|
export * from './notifications.js';
|
|
26
|
+
export * from './announcements.js';
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export * from './console.js';
|
|
|
10
10
|
export * from './members.js';
|
|
11
11
|
export * from './governance.js';
|
|
12
12
|
export * from './organizations.js';
|
|
13
|
+
export * from './organization-slugs.js';
|
|
13
14
|
export * from './mcp-auth.js';
|
|
14
15
|
export * from './mcp-tool-calls.js';
|
|
15
16
|
export * from './assistant.js';
|
|
@@ -22,4 +23,5 @@ export * from './exports.js';
|
|
|
22
23
|
export * from './member-insights.js';
|
|
23
24
|
export * from './platform-observability.js';
|
|
24
25
|
export * from './notifications.js';
|
|
26
|
+
export * from './announcements.js';
|
|
25
27
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
package/dist/licensing.d.ts
CHANGED
|
@@ -93,6 +93,132 @@ export interface OrganizationLicenseDto {
|
|
|
93
93
|
license: LicenseDto | null;
|
|
94
94
|
usage: LicenseUsage | null;
|
|
95
95
|
}
|
|
96
|
+
/** One license month's counted transactions, from `license_usage`. */
|
|
97
|
+
export interface LicenseHistoryMonth {
|
|
98
|
+
periodStart: string;
|
|
99
|
+
periodEnd: string;
|
|
100
|
+
/** Accepted, less the ones that failed after: the same count the limit uses. */
|
|
101
|
+
transactions: number;
|
|
102
|
+
/** When the 80% and 100% warnings went out that month, if they did. */
|
|
103
|
+
warned80At: string | null;
|
|
104
|
+
warned100At: string | null;
|
|
105
|
+
/** Requests refused with 402 that month (OCT-346). */
|
|
106
|
+
refused: LicenseRefusalCounts;
|
|
107
|
+
lastRefusedAt: string | null;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Requests refused with 402 in one license month (OCT-346), by what they stopped. A missing feature
|
|
111
|
+
* isn't a used-up quota and isn't counted.
|
|
112
|
+
*/
|
|
113
|
+
export interface LicenseRefusalCounts {
|
|
114
|
+
/** Transactions turned away: earns, POS redeems or paid claims at 110% of the limit, or past an expired license's grace. */
|
|
115
|
+
transactions: number;
|
|
116
|
+
/** One more member, API key or team member refused at 100% of its limit. */
|
|
117
|
+
resources: number;
|
|
118
|
+
}
|
|
119
|
+
/** One license an organization had, newest first, with the months it counted transactions in. */
|
|
120
|
+
export interface LicenseHistoryEntry {
|
|
121
|
+
id: string;
|
|
122
|
+
planId: string;
|
|
123
|
+
tier: LicenseTier;
|
|
124
|
+
planName: string;
|
|
125
|
+
source: LicenseSource;
|
|
126
|
+
entitlements: LicenseEntitlements;
|
|
127
|
+
startsAt: string;
|
|
128
|
+
endsAt: string;
|
|
129
|
+
state: LicenseState;
|
|
130
|
+
/** The license that replaced this one on an upgrade; it stopped counting then. */
|
|
131
|
+
replacedByLicenseId: string | null;
|
|
132
|
+
/**
|
|
133
|
+
* Newest first. A month appears once a transaction was counted or a request refused in it, so a
|
|
134
|
+
* quiet month has none.
|
|
135
|
+
* Members, API keys and team members are counted live, so they have no history.
|
|
136
|
+
*/
|
|
137
|
+
months: LicenseHistoryMonth[];
|
|
138
|
+
}
|
|
139
|
+
/** `GET /v1/platform/organizations/:organizationId/license/history` (OCT-346). */
|
|
140
|
+
export interface OrganizationLicenseHistoryDto {
|
|
141
|
+
organizationId: string;
|
|
142
|
+
licenses: LicenseHistoryEntry[];
|
|
143
|
+
}
|
|
144
|
+
/** A license's state for the System Admin's list; `NONE` is an organization that never had one. */
|
|
145
|
+
export type PlatformLicenseState = LicenseState | 'NONE';
|
|
146
|
+
export declare const PLATFORM_LICENSE_STATES: readonly PlatformLicenseState[];
|
|
147
|
+
/**
|
|
148
|
+
* One limit's use. `percent` is `floor(used × 100 / allowed)`: rounded down, so 80 is reached exactly
|
|
149
|
+
* when the 80% warning goes out. Transactions can reach 110 (a month may go 10% over); the others
|
|
150
|
+
* stop at 100. `allowed` and `percent` are `null` for no limit, or for an organization without a
|
|
151
|
+
* license (it is never limited).
|
|
152
|
+
*/
|
|
153
|
+
export interface LicenseLimitUsage {
|
|
154
|
+
used: number;
|
|
155
|
+
allowed: number | null;
|
|
156
|
+
percent: number | null;
|
|
157
|
+
}
|
|
158
|
+
/** The license in force, as `GET /v1/platform/licenses` shows it: `LicenseDto` without the entitlements. */
|
|
159
|
+
export interface PlatformLicenseSummary {
|
|
160
|
+
id: string;
|
|
161
|
+
planId: string;
|
|
162
|
+
tier: LicenseTier;
|
|
163
|
+
planName: string;
|
|
164
|
+
source: LicenseSource;
|
|
165
|
+
startsAt: string;
|
|
166
|
+
endsAt: string;
|
|
167
|
+
graceEndsAt: string;
|
|
168
|
+
/** Whole days until `endsAt`, 0 once it has passed. */
|
|
169
|
+
daysLeft: number;
|
|
170
|
+
}
|
|
171
|
+
/** Each limit's use, by limit. */
|
|
172
|
+
export interface PlatformLicenseUsage {
|
|
173
|
+
transactionsMonthly: LicenseLimitUsage;
|
|
174
|
+
members: LicenseLimitUsage;
|
|
175
|
+
apiKeys: LicenseLimitUsage;
|
|
176
|
+
teamMembers: LicenseLimitUsage;
|
|
177
|
+
}
|
|
178
|
+
/** One organization in `GET /v1/platform/licenses` (OCT-346). */
|
|
179
|
+
export interface PlatformLicenseListItem {
|
|
180
|
+
organizationId: string;
|
|
181
|
+
organizationName: string;
|
|
182
|
+
/** The license in force, or `null` when the organization never had one. */
|
|
183
|
+
license: PlatformLicenseSummary | null;
|
|
184
|
+
state: PlatformLicenseState;
|
|
185
|
+
/** The license month `usage.transactionsMonthly` counts; `null` without a license. */
|
|
186
|
+
periodStart: string | null;
|
|
187
|
+
periodEnd: string | null;
|
|
188
|
+
/**
|
|
189
|
+
* Transactions are this license month's counted ones: accepted, less those that failed after.
|
|
190
|
+
* Members, API keys and team members are counted as they stand.
|
|
191
|
+
*/
|
|
192
|
+
usage: PlatformLicenseUsage;
|
|
193
|
+
/** The highest `percent` of the four limits; `null` when none has one. */
|
|
194
|
+
usagePercent: number | null;
|
|
195
|
+
/**
|
|
196
|
+
* Requests refused with 402 in this license month, by what they stopped. An expired license keeps
|
|
197
|
+
* counting on its last month.
|
|
198
|
+
*/
|
|
199
|
+
refusedThisMonth: LicenseRefusalCounts;
|
|
200
|
+
}
|
|
201
|
+
/** `GET /v1/platform/licenses`. Archived organizations are left out. */
|
|
202
|
+
export interface PlatformLicenseListQuery {
|
|
203
|
+
state?: PlatformLicenseState;
|
|
204
|
+
tier?: LicenseTier;
|
|
205
|
+
/** ACTIVE licenses that end within this many days (`daysLeft` at most this). */
|
|
206
|
+
expiresWithinDays?: number;
|
|
207
|
+
/** At least one limit at or above this percentage. */
|
|
208
|
+
minUsagePercent?: number;
|
|
209
|
+
/** `daysLeft` (soonest end first, the default) or `usage` (highest `usagePercent` first). */
|
|
210
|
+
sort?: 'daysLeft' | 'usage';
|
|
211
|
+
/** 1 to 100, 50 by default. */
|
|
212
|
+
limit?: number;
|
|
213
|
+
offset?: number;
|
|
214
|
+
}
|
|
215
|
+
export interface PlatformLicensePage {
|
|
216
|
+
items: PlatformLicenseListItem[];
|
|
217
|
+
/** Organizations matching the filters, across all pages. */
|
|
218
|
+
total: number;
|
|
219
|
+
limit: number;
|
|
220
|
+
offset: number;
|
|
221
|
+
}
|
|
96
222
|
/** `POST /v1/platform/license-plans`. */
|
|
97
223
|
export interface CreateLicensePlanRequest {
|
|
98
224
|
tier: LicenseTier;
|
|
@@ -156,6 +282,25 @@ export interface LicenseUsageThresholdEventData {
|
|
|
156
282
|
periodStart: string;
|
|
157
283
|
periodEnd: string;
|
|
158
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* `license.limit_refused` (internal, OCT-346): the first transaction of a license month refused with
|
|
287
|
+
* 402, at 110% of the limit (`LICENSE_LIMIT_REACHED`) or past an expired license's grace
|
|
288
|
+
* (`LICENSE_EXPIRED`): the business is turning customers away. Later ones that month only add to
|
|
289
|
+
* `license_usage.refused_transactions`, so the feed isn't flooded. A refused member, API key or team
|
|
290
|
+
* member is only counted (`refused_resources`): whoever tried got the 402 in the console already.
|
|
291
|
+
*/
|
|
292
|
+
export interface LicenseLimitRefusedEventData {
|
|
293
|
+
licenseId: string;
|
|
294
|
+
tier: LicenseTier;
|
|
295
|
+
planName: string;
|
|
296
|
+
code: 'LICENSE_LIMIT_REACHED' | 'LICENSE_EXPIRED';
|
|
297
|
+
/** `transactionsMonthly` when it was full; `null` for an expired license. */
|
|
298
|
+
limit: 'transactionsMonthly' | null;
|
|
299
|
+
used: number | null;
|
|
300
|
+
allowed: number | null;
|
|
301
|
+
periodStart: string;
|
|
302
|
+
periodEnd: string;
|
|
303
|
+
}
|
|
159
304
|
/** Days before `endsAt` that send a reminder, latest first. */
|
|
160
305
|
export declare const LICENSE_EXPIRY_REMINDER_DAYS: readonly [30, 7, 1];
|
|
161
306
|
/**
|
package/dist/licensing.js
CHANGED
|
@@ -20,6 +20,7 @@ export const LICENSE_LIMIT_KEYS = [
|
|
|
20
20
|
];
|
|
21
21
|
/** After `endsAt`, new transactions keep working for this many days, then the license is EXPIRED. */
|
|
22
22
|
export const LICENSE_GRACE_DAYS = 7;
|
|
23
|
+
export const PLATFORM_LICENSE_STATES = ['ACTIVE', 'GRACE', 'EXPIRED', 'NONE'];
|
|
23
24
|
/**
|
|
24
25
|
* New transactions are refused once a license month's count reaches this share of
|
|
25
26
|
* `transactionsMonthly`: the 10% above the limit gives the partner time to upgrade or renew.
|
package/dist/licensing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"licensing.js","sourceRoot":"","sources":["../src/licensing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,MAAM,CAAC,MAAM,aAAa,GAA2B,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAOlG,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IACzD,iBAAiB;IACjB,kBAAkB;IAClB,UAAU;IACV,KAAK;IACL,WAAW;IACX,SAAS;CACV,CAAC;AAaF,MAAM,CAAC,MAAM,kBAAkB,GAAqC;IAClE,qBAAqB;IACrB,SAAS;IACT,SAAS;IACT,aAAa;CACd,CAAC;AAQF,qGAAqG;AACrG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"licensing.js","sourceRoot":"","sources":["../src/licensing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,MAAM,CAAC,MAAM,aAAa,GAA2B,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;AAOlG,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IACzD,iBAAiB;IACjB,kBAAkB;IAClB,UAAU;IACV,KAAK;IACL,WAAW;IACX,SAAS;CACV,CAAC;AAaF,MAAM,CAAC,MAAM,kBAAkB,GAAqC;IAClE,qBAAqB;IACrB,SAAS;IACT,SAAS;IACT,aAAa;CACd,CAAC;AAQF,qGAAqG;AACrG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AA6HpC,MAAM,CAAC,MAAM,uBAAuB,GAAoC,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAoI/G;;;GAGG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,GAAG,CAAC;AAI1D,MAAM,CAAC,MAAM,wBAAwB,GAAqC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;AAiCpF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAU,CAAC;AAOhE,MAAM,CAAC,MAAM,qBAAqB,GAAkC,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AAoCxH,qCAAqC;AACrC,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C,kGAAkG;AAClG,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAAC"}
|
package/dist/loyalty.d.ts
CHANGED
|
@@ -161,6 +161,14 @@ export interface IssuanceBudgetDto {
|
|
|
161
161
|
initialBudget: number;
|
|
162
162
|
/** `initialBudget` plus every applied top-up. */
|
|
163
163
|
capacity: number;
|
|
164
|
+
/** The most the program may ever be funded with, top-ups included (see `ProgramTerms.budgetCap`). */
|
|
165
|
+
budgetCap: number;
|
|
166
|
+
/**
|
|
167
|
+
* How many points a top-up may add right now without review: `budgetCap` minus `initialBudget` and
|
|
168
|
+
* every top-up not known to have failed (queued and unsettled ones count). A larger top-up is
|
|
169
|
+
* refused until a `PROGRAM_CAP_CHANGE` raises the cap.
|
|
170
|
+
*/
|
|
171
|
+
topUpHeadroom: number;
|
|
164
172
|
/** 80 or 95 once the fullest shard has used that percentage of its share, otherwise null. */
|
|
165
173
|
warningThreshold: BudgetWarningThreshold | null;
|
|
166
174
|
/** A shard never borrows from another, so an earn can fail while the total is above zero. */
|
package/dist/notifications.js
CHANGED
|
@@ -41,7 +41,11 @@ export const NOTIFICATION_RULES = {
|
|
|
41
41
|
'voucher.expired': { console: { audience: 'MEMBER', severity: always('INFO') } },
|
|
42
42
|
'voucher.member_expired': null,
|
|
43
43
|
'budget.low': { console: { audience: 'OWNER', severity: always('WARNING') } },
|
|
44
|
-
'license.usage_threshold': {
|
|
44
|
+
'license.usage_threshold': {
|
|
45
|
+
console: { audience: 'OWNER', severity: always('WARNING') },
|
|
46
|
+
// The System Admin hears of 100% only: 80% is the Owner's early warning.
|
|
47
|
+
platform: { severity: (data) => (data.threshold === 100 ? 'WARNING' : null) },
|
|
48
|
+
},
|
|
45
49
|
'license.expiry_notice': {
|
|
46
50
|
console: {
|
|
47
51
|
audience: 'OWNER',
|
|
@@ -93,6 +97,14 @@ export const NOTIFICATION_RULES = {
|
|
|
93
97
|
'organization.change_request.decided': {
|
|
94
98
|
console: { audience: 'OWNER', severity: (data) => (data.outcome === 'REJECTED' ? 'WARNING' : 'INFO') },
|
|
95
99
|
},
|
|
100
|
+
// A System Admin's announcement (OCT-396): for every member, as urgent as the admin marked it.
|
|
101
|
+
'platform.announcement': { console: { audience: 'MEMBER', severity: (data) => data.severity } },
|
|
102
|
+
// The first transaction of a license month refused (OCT-346): the business is turning customers away.
|
|
103
|
+
'license.limit_refused': {
|
|
104
|
+
console: { audience: 'OWNER', severity: always('ACTION') },
|
|
105
|
+
platform: { severity: always('WARNING') },
|
|
106
|
+
resolves: ['licenseRenewal'],
|
|
107
|
+
},
|
|
96
108
|
};
|
|
97
109
|
/** The rule for `type`, or `null` for a type this build does not know or that never notifies. */
|
|
98
110
|
export function notificationRuleOf(type) {
|
|
@@ -1 +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;QA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;IAC/F,uBAAuB,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE;IAC/F,sGAAsG;IACtG,uBAAuB,EAAE;QACvB,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE;QAC1D,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE;QACzC,QAAQ,EAAE,CAAC,gBAAgB,CAAC;KAC7B;CACF,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,10 +1,12 @@
|
|
|
1
|
+
import type { AnnouncementSeverity } from './announcements.js';
|
|
1
2
|
import type { GovernanceRequestType } from './governance.js';
|
|
3
|
+
import type { LicenseLimitRefusedEventData } from './licensing.js';
|
|
2
4
|
import type { WebhookEventData, WebhookEventType } from './webhooks.js';
|
|
3
5
|
/**
|
|
4
6
|
* Organization events that are never delivered as webhooks (OCT-30): they reach the console stream and
|
|
5
7
|
* in-app notifications only. One becomes a webhook by moving it into `WebhookEventType`.
|
|
6
8
|
*/
|
|
7
|
-
export type InternalEventType = 'organization.change_request.decided';
|
|
9
|
+
export type InternalEventType = 'organization.change_request.decided' | 'license.limit_refused' | 'platform.announcement';
|
|
8
10
|
/**
|
|
9
11
|
* `organization.change_request.decided`: a System Admin approved or rejected one of the organization's
|
|
10
12
|
* change requests. An approved program change is still on its way: its `program.*` or `budget.*`
|
|
@@ -17,8 +19,23 @@ export interface ChangeRequestDecidedEventData {
|
|
|
17
19
|
/** The System Admin's reason; always given for a rejection. */
|
|
18
20
|
reason: string | null;
|
|
19
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* `platform.announcement`: a System Admin posted an announcement to the organization (OCT-396), such as
|
|
24
|
+
* planned maintenance or new prices. One event per organization it was sent to, with the same
|
|
25
|
+
* `announcementId`. Every active member sees it.
|
|
26
|
+
*/
|
|
27
|
+
export interface PlatformAnnouncementEventData {
|
|
28
|
+
announcementId: string;
|
|
29
|
+
title: string;
|
|
30
|
+
body: string | null;
|
|
31
|
+
/** An https link for more, or `null`. */
|
|
32
|
+
link: string | null;
|
|
33
|
+
severity: AnnouncementSeverity;
|
|
34
|
+
}
|
|
20
35
|
interface InternalEventDataOf {
|
|
21
36
|
'organization.change_request.decided': ChangeRequestDecidedEventData;
|
|
37
|
+
'license.limit_refused': LicenseLimitRefusedEventData;
|
|
38
|
+
'platform.announcement': PlatformAnnouncementEventData;
|
|
22
39
|
}
|
|
23
40
|
/** Every type recorded in an organization's event log: webhook events and internal ones. */
|
|
24
41
|
export type OrganizationEventType = WebhookEventType | InternalEventType;
|
|
@@ -53,6 +70,9 @@ export type OrganizationEventSubject = {
|
|
|
53
70
|
} | {
|
|
54
71
|
kind: 'changeRequest';
|
|
55
72
|
id: string;
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'announcement';
|
|
75
|
+
id: string;
|
|
56
76
|
};
|
|
57
77
|
/**
|
|
58
78
|
* One message of the console event stream (`GET /v1/console/organizations/:id/events`, OCT-326):
|
|
@@ -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":"AAqFA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,KAAK,EAAE,cAAc;IACrB,YAAY,EAAE,sBAAsB;IACpC,aAAa,EAAE,uBAAuB;CAC9B,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization slugs (OCT-367): an organization's address (`/orgs/:slug` today, a subdomain later).
|
|
3
|
+
* One set of rules for the application, the public resolve route, the availability check and a
|
|
4
|
+
* rename, so a slug that passes one passes all.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SLUG_MIN_LENGTH = 3;
|
|
7
|
+
export declare const SLUG_MAX_LENGTH = 48;
|
|
8
|
+
/** How long a renamed organization's old slug keeps redirecting, and stays taken. */
|
|
9
|
+
export declare const SLUG_REDIRECT_DAYS = 90;
|
|
10
|
+
/**
|
|
11
|
+
* Names Core or the web route, or might: never an organization's slug. One list, so a new route
|
|
12
|
+
* name is reserved everywhere at once.
|
|
13
|
+
*/
|
|
14
|
+
export declare const RESERVED_SLUGS: readonly string[];
|
|
15
|
+
export type SlugProblem = 'INVALID' | 'RESERVED';
|
|
16
|
+
/** Trimmed and lowercased: `' My-Shop '` is `my-shop`. */
|
|
17
|
+
export declare const normalizeSlug: (value: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* What's wrong with an already normalized slug, or `null`. Valid: 3–48 characters of `a-z`, `0-9`
|
|
20
|
+
* and single hyphens, not starting or ending with a hyphen, and not reserved.
|
|
21
|
+
*/
|
|
22
|
+
export declare function slugProblem(slug: string): SlugProblem | null;
|
|
23
|
+
/** Explains a problem to the person choosing a slug. */
|
|
24
|
+
export declare function slugProblemMessage(problem: SlugProblem): string;
|
|
25
|
+
/**
|
|
26
|
+
* The plain slug a business name suggests: diacritics stripped (`đ` becomes `d`, which Unicode
|
|
27
|
+
* doesn't decompose), anything else that isn't a letter or digit turned into single hyphens, cut to
|
|
28
|
+
* fit. `Cà Phê Sữa Đá` gives `ca-phe-sua-da`. `null` when nothing usable is left.
|
|
29
|
+
*/
|
|
30
|
+
export declare function slugFromName(name: string): string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Slugs to offer for a business name, best first: the plain one, then variants with a short
|
|
33
|
+
* suffix, each valid and short enough. The caller keeps the available ones.
|
|
34
|
+
*/
|
|
35
|
+
export declare function slugCandidates(name: string, suffixes: readonly string[]): string[];
|
|
36
|
+
/** `GET /v1/console/organization-slugs/check?slug=&name=`. */
|
|
37
|
+
export interface OrganizationSlugCheckQuery {
|
|
38
|
+
/** The slug to check; normalized first. */
|
|
39
|
+
slug?: string;
|
|
40
|
+
/** A business name to suggest slugs from. */
|
|
41
|
+
name?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface OrganizationSlugCheck {
|
|
44
|
+
/** The normalized slug checked, or `null` when only `name` was given. */
|
|
45
|
+
slug: string | null;
|
|
46
|
+
available: boolean;
|
|
47
|
+
/** Why it isn't available, or `null` when it is (or nothing was checked). */
|
|
48
|
+
reason: 'TAKEN' | 'RESERVED' | 'INVALID' | null;
|
|
49
|
+
/** Up to 3 available slugs from `name`, best first. Empty without `name`. */
|
|
50
|
+
suggestions: string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* `GET /v1/organizations/resolve/:slug`. A slug an organization was renamed away from in the last
|
|
54
|
+
* `SLUG_REDIRECT_DAYS` days resolves too, with `redirectTo`: its current slug.
|
|
55
|
+
*/
|
|
56
|
+
export interface ResolvedOrganization {
|
|
57
|
+
organizationId: string;
|
|
58
|
+
name: string;
|
|
59
|
+
/** The organization's current slug. */
|
|
60
|
+
slug: string;
|
|
61
|
+
/** Set when the slug asked for is an old one: send the visitor here. */
|
|
62
|
+
redirectTo?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* How often an organization may change its slug: at most `SLUG_CHANGES_PER_WINDOW` changes in
|
|
66
|
+
* `SLUG_CHANGE_WINDOW_DAYS` days. Each change keeps the old slug taken for `SLUG_REDIRECT_DAYS` days,
|
|
67
|
+
* so without a limit one organization could hold many slugs; a few changes still allow fixing a typo.
|
|
68
|
+
*/
|
|
69
|
+
export declare const SLUG_CHANGES_PER_WINDOW = 3;
|
|
70
|
+
export declare const SLUG_CHANGE_WINDOW_DAYS = 30;
|
|
71
|
+
/**
|
|
72
|
+
* `PUT /v1/console/organizations/:organizationId/slug`: the Owner changes the slug, applied at once
|
|
73
|
+
* with no review. Normalized and checked like an application's.
|
|
74
|
+
*/
|
|
75
|
+
export interface ChangeOrganizationSlugInput {
|
|
76
|
+
slug: string;
|
|
77
|
+
}
|
|
78
|
+
export interface OrganizationSlugChange {
|
|
79
|
+
/** The new, normalized slug. */
|
|
80
|
+
slug: string;
|
|
81
|
+
/** The old slug, which redirects to the new one until `redirectUntil`. */
|
|
82
|
+
previousSlug: string;
|
|
83
|
+
redirectUntil: string;
|
|
84
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Organization slugs (OCT-367): an organization's address (`/orgs/:slug` today, a subdomain later).
|
|
3
|
+
* One set of rules for the application, the public resolve route, the availability check and a
|
|
4
|
+
* rename, so a slug that passes one passes all.
|
|
5
|
+
*/
|
|
6
|
+
export const SLUG_MIN_LENGTH = 3;
|
|
7
|
+
export const SLUG_MAX_LENGTH = 48;
|
|
8
|
+
/** How long a renamed organization's old slug keeps redirecting, and stays taken. */
|
|
9
|
+
export const SLUG_REDIRECT_DAYS = 90;
|
|
10
|
+
/**
|
|
11
|
+
* Names Core or the web route, or might: never an organization's slug. One list, so a new route
|
|
12
|
+
* name is reserved everywhere at once.
|
|
13
|
+
*/
|
|
14
|
+
export const RESERVED_SLUGS = [
|
|
15
|
+
'about',
|
|
16
|
+
'account',
|
|
17
|
+
'admin',
|
|
18
|
+
'api',
|
|
19
|
+
'app',
|
|
20
|
+
'assets',
|
|
21
|
+
'auth',
|
|
22
|
+
'billing',
|
|
23
|
+
'blog',
|
|
24
|
+
'callback',
|
|
25
|
+
'console',
|
|
26
|
+
'dashboard',
|
|
27
|
+
'dev',
|
|
28
|
+
'developer',
|
|
29
|
+
'developers',
|
|
30
|
+
'docs',
|
|
31
|
+
'help',
|
|
32
|
+
'login',
|
|
33
|
+
'logout',
|
|
34
|
+
'mail',
|
|
35
|
+
'mcp',
|
|
36
|
+
'merchant',
|
|
37
|
+
'new',
|
|
38
|
+
'oauth',
|
|
39
|
+
'octap',
|
|
40
|
+
'onboarding',
|
|
41
|
+
'org',
|
|
42
|
+
'organizations',
|
|
43
|
+
'orgs',
|
|
44
|
+
'partner',
|
|
45
|
+
'partners',
|
|
46
|
+
'platform',
|
|
47
|
+
'pricing',
|
|
48
|
+
'root',
|
|
49
|
+
'settings',
|
|
50
|
+
'signin',
|
|
51
|
+
'signup',
|
|
52
|
+
'staging',
|
|
53
|
+
'static',
|
|
54
|
+
'status',
|
|
55
|
+
'support',
|
|
56
|
+
'system',
|
|
57
|
+
'test',
|
|
58
|
+
'v1',
|
|
59
|
+
'www',
|
|
60
|
+
];
|
|
61
|
+
/** Trimmed and lowercased: `' My-Shop '` is `my-shop`. */
|
|
62
|
+
export const normalizeSlug = (value) => value.trim().toLowerCase();
|
|
63
|
+
/**
|
|
64
|
+
* What's wrong with an already normalized slug, or `null`. Valid: 3–48 characters of `a-z`, `0-9`
|
|
65
|
+
* and single hyphens, not starting or ending with a hyphen, and not reserved.
|
|
66
|
+
*/
|
|
67
|
+
export function slugProblem(slug) {
|
|
68
|
+
if (slug.length < SLUG_MIN_LENGTH || slug.length > SLUG_MAX_LENGTH || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(slug))
|
|
69
|
+
return 'INVALID';
|
|
70
|
+
return RESERVED_SLUGS.includes(slug) ? 'RESERVED' : null;
|
|
71
|
+
}
|
|
72
|
+
/** Explains a problem to the person choosing a slug. */
|
|
73
|
+
export function slugProblemMessage(problem) {
|
|
74
|
+
return problem === 'RESERVED'
|
|
75
|
+
? 'That address is reserved by OctaP; choose another'
|
|
76
|
+
: `Use ${SLUG_MIN_LENGTH}–${SLUG_MAX_LENGTH} lowercase letters, numbers or single hyphens, not starting or ending with a hyphen`;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The plain slug a business name suggests: diacritics stripped (`đ` becomes `d`, which Unicode
|
|
80
|
+
* doesn't decompose), anything else that isn't a letter or digit turned into single hyphens, cut to
|
|
81
|
+
* fit. `Cà Phê Sữa Đá` gives `ca-phe-sua-da`. `null` when nothing usable is left.
|
|
82
|
+
*/
|
|
83
|
+
export function slugFromName(name) {
|
|
84
|
+
const plain = name
|
|
85
|
+
.replace(/[đĐ]/g, 'd')
|
|
86
|
+
.normalize('NFD')
|
|
87
|
+
.replace(/\p{Diacritic}/gu, '')
|
|
88
|
+
.toLowerCase()
|
|
89
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
90
|
+
.replace(/^-+|-+$/g, '');
|
|
91
|
+
const cut = plain.slice(0, SLUG_MAX_LENGTH).replace(/-+$/, '');
|
|
92
|
+
return cut.length >= SLUG_MIN_LENGTH ? cut : null;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Slugs to offer for a business name, best first: the plain one, then variants with a short
|
|
96
|
+
* suffix, each valid and short enough. The caller keeps the available ones.
|
|
97
|
+
*/
|
|
98
|
+
export function slugCandidates(name, suffixes) {
|
|
99
|
+
const base = slugFromName(name);
|
|
100
|
+
if (!base)
|
|
101
|
+
return [];
|
|
102
|
+
const variants = suffixes.map((suffix) => {
|
|
103
|
+
const room = SLUG_MAX_LENGTH - suffix.length - 1;
|
|
104
|
+
return `${base.slice(0, room).replace(/-+$/, '')}-${suffix}`;
|
|
105
|
+
});
|
|
106
|
+
return [base, ...variants].filter((slug, i, all) => slugProblem(slug) === null && all.indexOf(slug) === i);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* How often an organization may change its slug: at most `SLUG_CHANGES_PER_WINDOW` changes in
|
|
110
|
+
* `SLUG_CHANGE_WINDOW_DAYS` days. Each change keeps the old slug taken for `SLUG_REDIRECT_DAYS` days,
|
|
111
|
+
* so without a limit one organization could hold many slugs; a few changes still allow fixing a typo.
|
|
112
|
+
*/
|
|
113
|
+
export const SLUG_CHANGES_PER_WINDOW = 3;
|
|
114
|
+
export const SLUG_CHANGE_WINDOW_DAYS = 30;
|
|
115
|
+
//# sourceMappingURL=organization-slugs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization-slugs.js","sourceRoot":"","sources":["../src/organization-slugs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,qFAAqF;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC/C,OAAO;IACP,SAAS;IACT,OAAO;IACP,KAAK;IACL,KAAK;IACL,QAAQ;IACR,MAAM;IACN,SAAS;IACT,MAAM;IACN,UAAU;IACV,SAAS;IACT,WAAW;IACX,KAAK;IACL,WAAW;IACX,YAAY;IACZ,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,KAAK;IACL,UAAU;IACV,KAAK;IACL,OAAO;IACP,OAAO;IACP,YAAY;IACZ,KAAK;IACL,eAAe;IACf,MAAM;IACN,SAAS;IACT,UAAU;IACV,UAAU;IACV,SAAS;IACT,MAAM;IACN,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,MAAM;IACN,IAAI;IACJ,KAAK;CACN,CAAC;AAIF,0DAA0D;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAE3E;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,IAAI,IAAI,CAAC,MAAM,GAAG,eAAe,IAAI,IAAI,CAAC,MAAM,GAAG,eAAe,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC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E,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC;IAC/D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7G,CAAC;AAiCD;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC"}
|
package/dist/organizations.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { OrganizationApplicationInput } from './console.js';
|
|
2
2
|
/**
|
|
3
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`.
|
|
4
|
+
* `UPDATE_EARN_RATE` and `PROGRAM_CAP_CHANGE` requests. `status` is `PROVISIONING` while the chain calls run, then `ACTIVE`.
|
|
5
5
|
*/
|
|
6
6
|
export interface ProgramTerms {
|
|
7
7
|
status: string;
|
|
@@ -11,6 +11,11 @@ export interface ProgramTerms {
|
|
|
11
11
|
expiryDays: number;
|
|
12
12
|
/** The issuance budget set at provisioning, before any top-up (see the budget read for the live figure). */
|
|
13
13
|
initialBudget: number;
|
|
14
|
+
/**
|
|
15
|
+
* The most the program may ever be funded with, top-ups included. Top-ups up to it apply without
|
|
16
|
+
* review; raising or lowering it is a `PROGRAM_CAP_CHANGE` request a System Admin decides.
|
|
17
|
+
*/
|
|
18
|
+
budgetCap: number;
|
|
14
19
|
/** 1 at provisioning; each applied earn-rate change adds one. */
|
|
15
20
|
policyVersion: number;
|
|
16
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octap/contracts",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Typed request/response contracts for the Octap Core REST API.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"dependencies": {},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist",
|
|
26
|
-
"README.md"
|
|
26
|
+
"README.md",
|
|
27
|
+
"CHANGELOG.md"
|
|
27
28
|
],
|
|
28
29
|
"publishConfig": {
|
|
29
30
|
"access": "public"
|