@asturiu/v0-sdk 0.0.0-stage → 1.0.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/CHANGELOG.md +42 -0
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +82 -2
- package/contract/assertion-vectors.json +90 -0
- package/contract/schemas/branding.schema.json +46 -0
- package/contract/schemas/definitions.schema.json +376 -0
- package/contract/schemas/portal.schema.json +56 -0
- package/contract/tenant-api-routes.json +165 -0
- package/dist/branding.d.ts +131 -0
- package/dist/branding.d.ts.map +1 -0
- package/dist/branding.js +206 -0
- package/dist/branding.js.map +1 -0
- package/dist/changesets.d.ts +58 -0
- package/dist/changesets.d.ts.map +1 -0
- package/dist/changesets.js +18 -0
- package/dist/changesets.js.map +1 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +12 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/changesets.d.ts +14 -0
- package/dist/cli/changesets.d.ts.map +1 -0
- package/dist/cli/changesets.js +252 -0
- package/dist/cli/changesets.js.map +1 -0
- package/dist/cli/cli.d.ts +37 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +415 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/context.d.ts +147 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/context.js +258 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/engine.d.ts +59 -0
- package/dist/cli/engine.d.ts.map +1 -0
- package/dist/cli/engine.js +85 -0
- package/dist/cli/engine.js.map +1 -0
- package/dist/cli/feedback.d.ts +40 -0
- package/dist/cli/feedback.d.ts.map +1 -0
- package/dist/cli/feedback.js +420 -0
- package/dist/cli/feedback.js.map +1 -0
- package/dist/cli/files.d.ts +83 -0
- package/dist/cli/files.d.ts.map +1 -0
- package/dist/cli/files.js +389 -0
- package/dist/cli/files.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +8 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/overview.d.ts +6 -0
- package/dist/cli/overview.d.ts.map +1 -0
- package/dist/cli/overview.js +379 -0
- package/dist/cli/overview.js.map +1 -0
- package/dist/cli/parts.d.ts +5 -0
- package/dist/cli/parts.d.ts.map +1 -0
- package/dist/cli/parts.js +414 -0
- package/dist/cli/parts.js.map +1 -0
- package/dist/cli/sources.d.ts +37 -0
- package/dist/cli/sources.d.ts.map +1 -0
- package/dist/cli/sources.js +91 -0
- package/dist/cli/sources.js.map +1 -0
- package/dist/cli/terminal.d.ts +135 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +353 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/cli/ui-page.d.ts +8 -0
- package/dist/cli/ui-page.d.ts.map +1 -0
- package/dist/cli/ui-page.js +216 -0
- package/dist/cli/ui-page.js.map +1 -0
- package/dist/cli/ui.d.ts +54 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/ui.js +251 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/client.d.ts +88 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +165 -0
- package/dist/client.js.map +1 -0
- package/dist/contacts.d.ts +43 -0
- package/dist/contacts.d.ts.map +1 -0
- package/dist/contacts.js +46 -0
- package/dist/contacts.js.map +1 -0
- package/dist/definition-set.d.ts +731 -0
- package/dist/definition-set.d.ts.map +1 -0
- package/dist/definition-set.js +659 -0
- package/dist/definition-set.js.map +1 -0
- package/dist/definitions.d.ts +42 -0
- package/dist/definitions.d.ts.map +1 -0
- package/dist/definitions.js +154 -0
- package/dist/definitions.js.map +1 -0
- package/dist/enrolment.d.ts +9 -0
- package/dist/enrolment.d.ts.map +1 -0
- package/dist/enrolment.js +8 -0
- package/dist/enrolment.js.map +1 -0
- package/dist/fill.d.ts +73 -0
- package/dist/fill.d.ts.map +1 -0
- package/dist/fill.js +46 -0
- package/dist/fill.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/notifications.d.ts +33 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +36 -0
- package/dist/notifications.js.map +1 -0
- package/dist/oidc.d.ts +122 -0
- package/dist/oidc.d.ts.map +1 -0
- package/dist/oidc.js +150 -0
- package/dist/oidc.js.map +1 -0
- package/dist/overlay.d.ts +109 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +58 -0
- package/dist/overlay.js.map +1 -0
- package/dist/passes.d.ts +95 -0
- package/dist/passes.d.ts.map +1 -0
- package/dist/passes.js +140 -0
- package/dist/passes.js.map +1 -0
- package/dist/portal-options.d.ts +65 -0
- package/dist/portal-options.d.ts.map +1 -0
- package/dist/portal-options.js +120 -0
- package/dist/portal-options.js.map +1 -0
- package/dist/reads.d.ts +41 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +44 -0
- package/dist/reads.js.map +1 -0
- package/dist/recovery-words.d.ts +8 -0
- package/dist/recovery-words.d.ts.map +1 -0
- package/dist/recovery-words.js +136 -0
- package/dist/recovery-words.js.map +1 -0
- package/dist/recovery.d.ts +198 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +112 -0
- package/dist/recovery.js.map +1 -0
- package/dist/reveal.d.ts +35 -0
- package/dist/reveal.d.ts.map +1 -0
- package/dist/reveal.js +66 -0
- package/dist/reveal.js.map +1 -0
- package/dist/seal.d.ts +15 -0
- package/dist/seal.d.ts.map +1 -0
- package/dist/seal.js +0 -0
- package/dist/seal.js.map +1 -0
- package/dist/session.d.ts +66 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +61 -0
- package/dist/session.js.map +1 -0
- package/dist/signing-in-mark.d.ts +14 -0
- package/dist/signing-in-mark.d.ts.map +1 -0
- package/dist/signing-in-mark.js +24 -0
- package/dist/signing-in-mark.js.map +1 -0
- package/dist/signing-in.d.ts +22 -0
- package/dist/signing-in.d.ts.map +1 -0
- package/dist/signing-in.js +203 -0
- package/dist/signing-in.js.map +1 -0
- package/dist/tags.d.ts +96 -0
- package/dist/tags.d.ts.map +1 -0
- package/dist/tags.js +88 -0
- package/dist/tags.js.map +1 -0
- package/dist/tenant-subscription.d.ts +47 -0
- package/dist/tenant-subscription.d.ts.map +1 -0
- package/dist/tenant-subscription.js +7 -0
- package/dist/tenant-subscription.js.map +1 -0
- package/dist/testing/index.d.ts +125 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +320 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/theme.d.ts +237 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +504 -0
- package/dist/theme.js.map +1 -0
- package/dist/tickets.d.ts +152 -0
- package/dist/tickets.d.ts.map +1 -0
- package/dist/tickets.js +65 -0
- package/dist/tickets.js.map +1 -0
- package/dist/tiers.d.ts +168 -0
- package/dist/tiers.d.ts.map +1 -0
- package/dist/tiers.js +341 -0
- package/dist/tiers.js.map +1 -0
- package/dist/types.d.ts +885 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/dist/urlid.d.ts +50 -0
- package/dist/urlid.d.ts.map +1 -0
- package/dist/urlid.js +78 -0
- package/dist/urlid.js.map +1 -0
- package/dist/version.d.ts +15 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +15 -0
- package/dist/version.js.map +1 -0
- package/make/asturiu.mk +43 -0
- package/package.json +63 -4
- package/src/branding.ts +221 -0
- package/src/changesets.ts +61 -0
- package/src/cli/bin.ts +12 -0
- package/src/cli/changesets.ts +233 -0
- package/src/cli/cli.ts +425 -0
- package/src/cli/context.ts +299 -0
- package/src/cli/engine.ts +112 -0
- package/src/cli/feedback.ts +406 -0
- package/src/cli/files.ts +371 -0
- package/src/cli/index.ts +7 -0
- package/src/cli/overview.ts +343 -0
- package/src/cli/parts.ts +371 -0
- package/src/cli/sources.ts +111 -0
- package/src/cli/terminal.ts +384 -0
- package/src/cli/ui-page.ts +215 -0
- package/src/cli/ui.ts +266 -0
- package/src/client.ts +202 -0
- package/src/contacts.ts +61 -0
- package/src/definition-set.ts +965 -0
- package/src/definitions.ts +156 -0
- package/src/enrolment.ts +10 -0
- package/src/fill.ts +83 -0
- package/src/index.ts +38 -0
- package/src/notifications.ts +55 -0
- package/src/oidc.ts +199 -0
- package/src/overlay.ts +137 -0
- package/src/passes.ts +168 -0
- package/src/portal-options.ts +125 -0
- package/src/reads.ts +71 -0
- package/src/recovery-words.ts +137 -0
- package/src/recovery.ts +269 -0
- package/src/reveal.ts +72 -0
- package/src/seal.ts +0 -0
- package/src/session.ts +93 -0
- package/src/signing-in-mark.ts +23 -0
- package/src/signing-in.ts +213 -0
- package/src/tags.ts +146 -0
- package/src/tenant-subscription.ts +44 -0
- package/src/testing/index.ts +337 -0
- package/src/theme.ts +628 -0
- package/src/tickets.ts +195 -0
- package/src/tiers.ts +397 -0
- package/src/types.ts +847 -0
- package/src/urlid.ts +77 -0
- package/src/version.ts +15 -0
- package/templates/asturiu/branding.json +4 -0
- package/templates/asturiu/definitions.json +23 -0
- package/templates/asturiu/portal.json +16 -0
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Definition sets and Tenant keys (ADR-029, ADR-030) — the part a Tenant's own
|
|
3
|
+
* application server uses. A Tenant keeps its whole Definition set as one file;
|
|
4
|
+
* when its application starts, `applyDefinitions` sends it through the Tenant
|
|
5
|
+
* API, signed with a Tenant key whose private half never leaves the Tenant.
|
|
6
|
+
*
|
|
7
|
+
* Dependency-free and Web Crypto only, like the rest of the kit; the signing
|
|
8
|
+
* functions refuse to run in a browser, so a key bundled by mistake fails
|
|
9
|
+
* instead of working.
|
|
10
|
+
*/
|
|
11
|
+
import type { TenantSubscriptionView } from "./tenant-subscription.js";
|
|
12
|
+
import type { FieldValueType } from "./types.js";
|
|
13
|
+
import type { CustomerEntitlements, TenantTierSet, TierRules } from "./tiers.js";
|
|
14
|
+
import type { RevealLevel } from "./reveal.js";
|
|
15
|
+
import type { FillMode, LocatorRule } from "./fill.js";
|
|
16
|
+
import type { RepositoryBranding, RepositoryPortal, TenantSource } from "./branding.js";
|
|
17
|
+
import type { PortalPage, PortalSwitch } from "./portal-options.js";
|
|
18
|
+
import type { ChangesetStatus, FeedbackReport, TenantChangeset } from "./changesets.js";
|
|
19
|
+
import type { AnnouncementItem, AnyStatus, Priority, TicketSummary, TicketView } from "./tickets.js";
|
|
20
|
+
import { type TagColour, type TagEffect, type TagRule, type TagSelector, type TagView, type TagVisibility } from "./tags.js";
|
|
21
|
+
/** A field's rules in a Definition set: a FieldDefinition without its `name`, which is the key it stands under. */
|
|
22
|
+
export interface SetFieldSpec {
|
|
23
|
+
label?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
value_type: FieldValueType;
|
|
26
|
+
validation?: {
|
|
27
|
+
pattern?: string;
|
|
28
|
+
min?: number;
|
|
29
|
+
max?: number;
|
|
30
|
+
min_length?: number;
|
|
31
|
+
max_length?: number;
|
|
32
|
+
enum?: (string | number | boolean)[];
|
|
33
|
+
};
|
|
34
|
+
secret?: boolean;
|
|
35
|
+
reveal?: RevealLevel;
|
|
36
|
+
searchable?: boolean;
|
|
37
|
+
immutable?: boolean;
|
|
38
|
+
locked?: boolean;
|
|
39
|
+
/** ADR-046: the modes a Field may use, the first preselected. Absent: `value`, `internal`, `external`. */
|
|
40
|
+
filled_by?: FillMode[];
|
|
41
|
+
/** Resource type tokens an internal reference may point at (`fld`, `ent`, `wlt`, `att`, …). Absent: any. */
|
|
42
|
+
targets?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* Definitions of this set a target must be of. A bare key is an Entry type, as in `accepts`; a Wallet type or a
|
|
45
|
+
* field is named by its address (`wallet:<key>`, `field:<entry>.<key>`, `field:shared.<key>`). Each restricts
|
|
46
|
+
* targets of its own kind. Absent: any.
|
|
47
|
+
*/
|
|
48
|
+
target_definitions?: string[];
|
|
49
|
+
locator?: LocatorRule;
|
|
50
|
+
}
|
|
51
|
+
/** What belongs to the reference, wherever the field is declared. `fill_in` only with `required`. */
|
|
52
|
+
export interface SetFieldReference {
|
|
53
|
+
required?: boolean;
|
|
54
|
+
order?: number;
|
|
55
|
+
fill_in?: unknown;
|
|
56
|
+
}
|
|
57
|
+
/** A field owned by its Entry type (address `<entry>.<key>`), or one of the shared fields (`{ use: "<key>" }`, optionally narrowing its modes here). */
|
|
58
|
+
export type SetEntryField = (SetFieldSpec & SetFieldReference) | ({
|
|
59
|
+
use: string;
|
|
60
|
+
filled_by?: FillMode[];
|
|
61
|
+
} & SetFieldReference);
|
|
62
|
+
export interface SetEntry {
|
|
63
|
+
label?: string;
|
|
64
|
+
description?: string;
|
|
65
|
+
kind?: "file" | "folder";
|
|
66
|
+
nestable?: boolean;
|
|
67
|
+
/** Folders only: Entry type keys. */
|
|
68
|
+
contains?: string[];
|
|
69
|
+
customizable?: boolean;
|
|
70
|
+
value_types?: FieldValueType[];
|
|
71
|
+
secret_reveal_min?: RevealLevel;
|
|
72
|
+
/** The modes a custom field on this type may allow (ADR-046). Absent: all three. */
|
|
73
|
+
custom_filled_by?: FillMode[];
|
|
74
|
+
fields: Record<string, SetEntryField>;
|
|
75
|
+
}
|
|
76
|
+
export interface SetWallet {
|
|
77
|
+
label?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
/**
|
|
80
|
+
* The Entry types this Wallet type owns, by key; it accepts each of them and
|
|
81
|
+
* no other Wallet type may. An Entry type key is unique across the set.
|
|
82
|
+
*/
|
|
83
|
+
entries?: Record<string, SetEntry>;
|
|
84
|
+
/** Entry types from `shared_entries` this Wallet type accepts, by key. */
|
|
85
|
+
accepts?: string[];
|
|
86
|
+
nestable?: boolean;
|
|
87
|
+
immutable?: boolean;
|
|
88
|
+
metering?: "storage" | "events";
|
|
89
|
+
event_retention_days?: number;
|
|
90
|
+
default_policy?: Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Every Definition of one Tenant, as one document (ADR-029, ADR-031): Wallet
|
|
94
|
+
* types with the Entry types they own, Entry types with the fields they own,
|
|
95
|
+
* and what is shared on purpose — fields used by several Entry types
|
|
96
|
+
* (`shared_fields`, through `use`) and Entry types accepted by several Wallet
|
|
97
|
+
* types or by none (`shared_entries`, through `accepts`). Keys are permanent;
|
|
98
|
+
* labels are what people see. The tree is only how the set is written: an
|
|
99
|
+
* Entry type is one EntryDefinition, addressed `entry:<key>` wherever it is
|
|
100
|
+
* declared.
|
|
101
|
+
*/
|
|
102
|
+
export interface DefinitionSet {
|
|
103
|
+
shared_fields?: Record<string, SetFieldSpec>;
|
|
104
|
+
shared_entries?: Record<string, SetEntry>;
|
|
105
|
+
wallets: Record<string, SetWallet>;
|
|
106
|
+
/** `expose:<address>` for each change that makes values more visible. Not part of the set's hash. */
|
|
107
|
+
acknowledge?: string[];
|
|
108
|
+
}
|
|
109
|
+
/** One Entry type of a set with the Wallet type that owns it, or `null` for a shared one. */
|
|
110
|
+
export interface SetEntryOf extends SetEntry {
|
|
111
|
+
wallet: string | null;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Every Entry type of a set by its key, wherever it is declared. When a key is
|
|
115
|
+
* declared twice the first one wins here (shared, then Wallet types in order);
|
|
116
|
+
* the Engine refuses such a set.
|
|
117
|
+
*/
|
|
118
|
+
export declare function entryTypesOf(set: Pick<DefinitionSet, "wallets" | "shared_entries">): Record<string, SetEntryOf>;
|
|
119
|
+
/** The Entry type keys a Wallet type accepts: those it owns, then the shared ones it names in `accepts`. */
|
|
120
|
+
export declare function acceptedBy(wallet: SetWallet): string[];
|
|
121
|
+
/** A set in the format of changeset 003: Entry types at the top level, Wallet types naming them in `accepts`. */
|
|
122
|
+
export interface FlatDefinitionSet {
|
|
123
|
+
shared_fields?: Record<string, SetFieldSpec>;
|
|
124
|
+
entries: Record<string, SetEntry>;
|
|
125
|
+
wallets: Record<string, Omit<SetWallet, "entries" | "accepts"> & {
|
|
126
|
+
accepts: string[];
|
|
127
|
+
}>;
|
|
128
|
+
acknowledge?: string[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A set with Entry types at the top level, as the tree — the same rule as for
|
|
132
|
+
* fields: an Entry type accepted by exactly one Wallet type moves under it;
|
|
133
|
+
* one accepted by several Wallet types, or by none, goes to `shared_entries`
|
|
134
|
+
* and the Wallet types that accept it name it in `accepts`. The Definitions
|
|
135
|
+
* the set describes do not change.
|
|
136
|
+
*/
|
|
137
|
+
export declare function nestDefinitionSet(flat: FlatDefinitionSet): DefinitionSet;
|
|
138
|
+
/** The effect of one change, as a plan reports it (ADR-029, decision 5). */
|
|
139
|
+
export type PlanEffect = "repins" | "creates" | "tightens" | "stays_pinned" | "may_stay_pinned" | "retires_values" | "withdraws" | "exposes";
|
|
140
|
+
export interface PlanChange {
|
|
141
|
+
/** `wallet:<key>`, `entry:<key>`, `field:<entry>.<key>` or `field:shared.<key>`. */
|
|
142
|
+
address: string;
|
|
143
|
+
kind: "wallet" | "entry" | "field";
|
|
144
|
+
/** What changed, in a word: `registered`, `label`, `value_type`, `validation_tighter`, `field_added_required`, … */
|
|
145
|
+
change: string;
|
|
146
|
+
effect: PlanEffect;
|
|
147
|
+
safe: boolean;
|
|
148
|
+
/** Resources on this Definition per version, counted from their pins — never from their content. */
|
|
149
|
+
in_use?: {
|
|
150
|
+
version: number;
|
|
151
|
+
count: number;
|
|
152
|
+
}[];
|
|
153
|
+
detail?: Record<string, unknown>;
|
|
154
|
+
}
|
|
155
|
+
export interface PlanRefusal {
|
|
156
|
+
address?: string;
|
|
157
|
+
reason: string;
|
|
158
|
+
}
|
|
159
|
+
export interface DefinitionPlan {
|
|
160
|
+
plan_id: string;
|
|
161
|
+
based_on: number;
|
|
162
|
+
hash: string;
|
|
163
|
+
changes: PlanChange[];
|
|
164
|
+
refused: PlanRefusal[];
|
|
165
|
+
/** What the set still says in an older form, read as its current form (e.g. a reference value type, ADR-046). Nothing to approve. */
|
|
166
|
+
warnings?: PlanRefusal[];
|
|
167
|
+
/** Every change is safe: a submission may apply it at once under `auto_apply: safe`. */
|
|
168
|
+
safe: boolean;
|
|
169
|
+
/** Nothing would be published. */
|
|
170
|
+
empty: boolean;
|
|
171
|
+
expires_at: string;
|
|
172
|
+
/** The revision a revert plan brings back (ADR-049). */
|
|
173
|
+
reverts?: number;
|
|
174
|
+
}
|
|
175
|
+
export type DefinitionSubmitStatus = "unchanged" | "applied" | "waiting" | "refused";
|
|
176
|
+
export interface DefinitionSubmitResult {
|
|
177
|
+
status: DefinitionSubmitStatus;
|
|
178
|
+
hash: string;
|
|
179
|
+
/** The revision now live: the new one when `applied`, the current one otherwise. */
|
|
180
|
+
revision: number;
|
|
181
|
+
plan_id?: string;
|
|
182
|
+
summary?: {
|
|
183
|
+
changes: number;
|
|
184
|
+
unsafe: number;
|
|
185
|
+
};
|
|
186
|
+
changes?: PlanChange[];
|
|
187
|
+
reasons?: PlanRefusal[];
|
|
188
|
+
/** What the set still says in an older form, read as its current form (ADR-046). */
|
|
189
|
+
warnings?: PlanRefusal[];
|
|
190
|
+
/** Where a tenant administrator approves a waiting plan. */
|
|
191
|
+
approve_url?: string;
|
|
192
|
+
/** The set waits because an administrator reverted it, in this revision (ADR-049). */
|
|
193
|
+
reverted_in?: number;
|
|
194
|
+
}
|
|
195
|
+
export interface DefinitionStatus {
|
|
196
|
+
revision: number;
|
|
197
|
+
hash: string | null;
|
|
198
|
+
source: "admin_ui" | "repository";
|
|
199
|
+
auto_apply: "safe" | "none";
|
|
200
|
+
waiting: {
|
|
201
|
+
plan_id: string;
|
|
202
|
+
hash: string;
|
|
203
|
+
created_at: string;
|
|
204
|
+
}[];
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* JSON with object keys sorted and `undefined` dropped: the same bytes for the
|
|
208
|
+
* same value wherever it is computed, so the kit and the Engine agree on a hash.
|
|
209
|
+
*/
|
|
210
|
+
export declare function canonicalJson(value: unknown): string;
|
|
211
|
+
/** The set without `acknowledge`, canonical: what its hash covers. */
|
|
212
|
+
export declare function definitionSetHashInput(set: DefinitionSet | Record<string, unknown>): string;
|
|
213
|
+
/** SHA-256 hex of the set's canonical form, as the Engine reports it (`hash`). */
|
|
214
|
+
export declare function definitionSetHash(set: DefinitionSet | Record<string, unknown>): Promise<string>;
|
|
215
|
+
/**
|
|
216
|
+
* The Tenant API's routes (ADR-030, decision 5; ADR-038; ADR-039; ADR-057;
|
|
217
|
+
* ADR-058; ADR-059): the only paths it forwards, and the scope each needs. A
|
|
218
|
+
* route whose scope is `null` is reached by any live key of the Tenant.
|
|
219
|
+
*/
|
|
220
|
+
export declare const TENANT_API_ROUTES: readonly {
|
|
221
|
+
method: string;
|
|
222
|
+
path: string;
|
|
223
|
+
scope: TenantKeyScope | null;
|
|
224
|
+
}[];
|
|
225
|
+
export type TenantKeyScope = "definitions" | "branding" | "portal" | "tiers" | "entitlements" | "tags" | "tickets";
|
|
226
|
+
export declare const TENANT_KEY_SCOPES: readonly TenantKeyScope[];
|
|
227
|
+
/** What a Tenant keeps in its repository (ADR-038, decision 4): one key may carry any of these together. */
|
|
228
|
+
export declare const REPOSITORY_SCOPES: readonly TenantKeyScope[];
|
|
229
|
+
/** Why a key cannot carry these scopes, or null: at least one known scope, none twice, and `entitlements` only on its own (the billing backend keeps its own key). */
|
|
230
|
+
export declare function tenantKeyScopesProblem(scopes: readonly string[]): string | null;
|
|
231
|
+
/** A key's scopes from its stored or listed form: `scopes`, or `scope` as one scope or several separated by spaces (keys from before ADR-038). */
|
|
232
|
+
export declare function tenantKeyScopesOf(record: {
|
|
233
|
+
scopes?: unknown;
|
|
234
|
+
scope?: unknown;
|
|
235
|
+
}): TenantKeyScope[];
|
|
236
|
+
export type TenantApiRoute = (typeof TENANT_API_ROUTES)[number];
|
|
237
|
+
/** Whether a key with these scopes reaches a route: it carries the route's scope, or the route names none. */
|
|
238
|
+
export declare function keyReachesRoute(scopes: readonly string[], route: Pick<TenantApiRoute, "scope">): boolean;
|
|
239
|
+
/** The route a Tenant API request names, with its parameters, or null when the Tenant API has no such route. */
|
|
240
|
+
export declare function matchTenantApiRoute(method: string, path: string): {
|
|
241
|
+
route: TenantApiRoute;
|
|
242
|
+
params: Record<string, string>;
|
|
243
|
+
} | null;
|
|
244
|
+
/** A route pattern's parameters, or null when the path does not fit: shared with the Engine, which matches its forwards the same way. */
|
|
245
|
+
export declare function matchRoutePattern(pattern: string, path: string): Record<string, string> | null;
|
|
246
|
+
/** A route pattern with its parameters filled in, each encoded. */
|
|
247
|
+
export declare function fillRoutePattern(pattern: string, params: Record<string, string>): string;
|
|
248
|
+
export declare const TENANT_KEY_PREFIX = "atk";
|
|
249
|
+
export declare const TENANT_ASSERTION_AUDIENCE = "asturiu-tenant-api";
|
|
250
|
+
/** Longest an assertion may live, and the most a key may live (ADR-030). */
|
|
251
|
+
export declare const TENANT_ASSERTION_MAX_SECONDS = 60;
|
|
252
|
+
export declare const TENANT_KEY_MAX_DAYS = 180;
|
|
253
|
+
export interface TenantKeyParts {
|
|
254
|
+
slug: string;
|
|
255
|
+
kid: string;
|
|
256
|
+
/** PKCS#8 private key, base64url. */
|
|
257
|
+
pkcs8: string;
|
|
258
|
+
}
|
|
259
|
+
/** `atk.<slug>.<key id>.<private key>` — the one environment variable a Tenant's server holds. */
|
|
260
|
+
export declare function parseTenantKey(value: string): TenantKeyParts;
|
|
261
|
+
export declare function formatTenantKey(parts: TenantKeyParts): string;
|
|
262
|
+
/**
|
|
263
|
+
* A new Ed25519 key pair, made where this runs (the administrator's browser in
|
|
264
|
+
* the Admin UI): the private half as PKCS#8 for the Tenant to keep, the public
|
|
265
|
+
* half as the raw 32 bytes for Asturiu to store. Both base64url.
|
|
266
|
+
*/
|
|
267
|
+
export declare function generateTenantKeyPair(): Promise<{
|
|
268
|
+
privatePkcs8: string;
|
|
269
|
+
publicRaw: string;
|
|
270
|
+
}>;
|
|
271
|
+
/**
|
|
272
|
+
* The signed assertion for one request (ADR-030, decision 3): valid for one
|
|
273
|
+
* minute, for this method, path and body, once. The key itself is never sent.
|
|
274
|
+
*/
|
|
275
|
+
export declare function signTenantAssertion(opts: {
|
|
276
|
+
key: string;
|
|
277
|
+
method: string;
|
|
278
|
+
path: string;
|
|
279
|
+
body?: string | Uint8Array;
|
|
280
|
+
now?: number;
|
|
281
|
+
}): Promise<string>;
|
|
282
|
+
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
283
|
+
type Logger = {
|
|
284
|
+
info: (msg: string, detail?: Record<string, unknown>) => void;
|
|
285
|
+
warn: (msg: string, detail?: Record<string, unknown>) => void;
|
|
286
|
+
error: (msg: string, detail?: Record<string, unknown>) => void;
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* What every Tenant API call throws when the Engine answers with an error
|
|
290
|
+
* (ADR-074 §2): `status` tells a route this Engine lacks (`404`) from a
|
|
291
|
+
* refusal (`401`, `403`, `409`, `422`). `type` and `detail` are the
|
|
292
|
+
* problem document's. A network failure is not one: `fetch` throws its own.
|
|
293
|
+
*/
|
|
294
|
+
export declare class TenantApiError extends Error {
|
|
295
|
+
readonly status: number;
|
|
296
|
+
readonly type: string | null;
|
|
297
|
+
readonly detail: string | null;
|
|
298
|
+
/** The whole problem document, with `issues` when the Engine names them. */
|
|
299
|
+
readonly problem: Record<string, unknown> | null;
|
|
300
|
+
constructor(status: number, problem: unknown);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Send the application's Definition set when it starts (ADR-029, the
|
|
304
|
+
* repository flow). Never throws and never blocks start-up: the outcome is
|
|
305
|
+
* logged — applied, unchanged, waiting for a tenant administrator, or refused
|
|
306
|
+
* with the reasons — and returned.
|
|
307
|
+
*/
|
|
308
|
+
export declare function applyDefinitions(opts: {
|
|
309
|
+
set: DefinitionSet | string;
|
|
310
|
+
key: string;
|
|
311
|
+
baseUrl: string;
|
|
312
|
+
fetch?: FetchLike;
|
|
313
|
+
log?: Logger;
|
|
314
|
+
}): Promise<DefinitionSubmitResult | {
|
|
315
|
+
status: "error";
|
|
316
|
+
message: string;
|
|
317
|
+
}>;
|
|
318
|
+
/** What `PUT /tenant/v0/branding` and `PUT /tenant/v0/portal` answer (ADR-038). `kept`, on the portal's answer: redirected pages the body named, left as an administrator set them (ADR-039). */
|
|
319
|
+
export interface TenantRepositoryResult {
|
|
320
|
+
status: "unchanged" | "applied";
|
|
321
|
+
kept?: PortalPage[];
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Send the branding the repository keeps when the application starts
|
|
325
|
+
* (ADR-038): the theme, `primary_color` and the images, inline
|
|
326
|
+
* (`inlineImage(bytes, type)`) — everything the Admin UI's Branding tab sets
|
|
327
|
+
* except addresses. The whole desired state of those keys: one left out is
|
|
328
|
+
* cleared, so send the whole theme. A string is read as JSON (a
|
|
329
|
+
* `branding.json` kept in the repository, as the Admin UI exports it).
|
|
330
|
+
* Applies at once; never throws, never blocks start-up.
|
|
331
|
+
*/
|
|
332
|
+
export declare function applyBranding(opts: {
|
|
333
|
+
branding: RepositoryBranding | string;
|
|
334
|
+
key: string;
|
|
335
|
+
baseUrl: string;
|
|
336
|
+
fetch?: FetchLike;
|
|
337
|
+
log?: Logger;
|
|
338
|
+
}): Promise<TenantRepositoryResult | {
|
|
339
|
+
status: "error";
|
|
340
|
+
message: string;
|
|
341
|
+
problems?: unknown;
|
|
342
|
+
}>;
|
|
343
|
+
/**
|
|
344
|
+
* Send the portal options the repository keeps when the application starts
|
|
345
|
+
* (ADR-038, ADR-039): the switches and which pages show. A switch left out is
|
|
346
|
+
* on, a page left out is in the portal; a page an administrator moved to the
|
|
347
|
+
* application keeps its redirect and comes back in `kept`. Like `applyBranding`.
|
|
348
|
+
*/
|
|
349
|
+
export declare function applyPortal(opts: {
|
|
350
|
+
portal: RepositoryPortal | string;
|
|
351
|
+
key: string;
|
|
352
|
+
baseUrl: string;
|
|
353
|
+
fetch?: FetchLike;
|
|
354
|
+
log?: Logger;
|
|
355
|
+
}): Promise<TenantRepositoryResult | {
|
|
356
|
+
status: "error";
|
|
357
|
+
message: string;
|
|
358
|
+
problems?: unknown;
|
|
359
|
+
}>;
|
|
360
|
+
/** The block a repository keeps (ADR-061 §10): the tiers, `default_tier` and `tier_rules`. */
|
|
361
|
+
export type RepositoryTiers = Pick<TenantTierSet, "tiers" | "default_tier"> & {
|
|
362
|
+
tier_rules?: Partial<Omit<TierRules, "changed_at">>;
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* Send the tiers the repository keeps when the application starts (ADR-061
|
|
366
|
+
* §10). Run it after `applyDefinitions`, as tiers name Wallet types by key.
|
|
367
|
+
* Like `applyBranding`, it never blocks start-up.
|
|
368
|
+
*/
|
|
369
|
+
export declare function applyTiers(opts: {
|
|
370
|
+
tiers: RepositoryTiers | string;
|
|
371
|
+
key: string;
|
|
372
|
+
baseUrl: string;
|
|
373
|
+
fetch?: FetchLike;
|
|
374
|
+
log?: Logger;
|
|
375
|
+
}): Promise<TenantRepositoryResult | {
|
|
376
|
+
status: "error";
|
|
377
|
+
message: string;
|
|
378
|
+
problems?: unknown;
|
|
379
|
+
}>;
|
|
380
|
+
/** What `GET /tenant/v0/tiers` answers: who edits the tab, and the block a `PUT` would send back unchanged. */
|
|
381
|
+
export interface RepositoryTiersState extends RepositoryTiers {
|
|
382
|
+
source: TenantSource;
|
|
383
|
+
}
|
|
384
|
+
/** The tiers as stored, in the shape `applyTiers` takes. Like `readBranding`. */
|
|
385
|
+
export declare function readTiers(opts: {
|
|
386
|
+
key: string;
|
|
387
|
+
baseUrl: string;
|
|
388
|
+
fetch?: FetchLike;
|
|
389
|
+
}): Promise<RepositoryTiersState>;
|
|
390
|
+
/** What one Customer may do now, for a server-side check or a background job (ADR-061 §9), with a key of scope `entitlements`. */
|
|
391
|
+
export declare function readEntitlements(opts: {
|
|
392
|
+
customer: string;
|
|
393
|
+
key: string;
|
|
394
|
+
baseUrl: string;
|
|
395
|
+
fetch?: FetchLike;
|
|
396
|
+
}): Promise<CustomerEntitlements>;
|
|
397
|
+
/** What `GET /tenant/v0/branding` answers (ADR-039): who edits the tab, and the branding a `PUT` would send back unchanged. */
|
|
398
|
+
export interface RepositoryBrandingState {
|
|
399
|
+
source: TenantSource;
|
|
400
|
+
branding: RepositoryBranding;
|
|
401
|
+
}
|
|
402
|
+
/** What `GET /tenant/v0/portal` answers (ADR-039): who edits the tab, the options a `PUT` would send back unchanged, and the pages an administrator moved to the Tenant's application. */
|
|
403
|
+
export interface RepositoryPortalState {
|
|
404
|
+
source: TenantSource;
|
|
405
|
+
portal: Record<PortalSwitch, boolean> & {
|
|
406
|
+
pages: RepositoryPortal["pages"];
|
|
407
|
+
};
|
|
408
|
+
redirected: PortalPage[];
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* The branding as stored, in the shape `applyBranding` takes: to take the
|
|
412
|
+
* look designed in the Admin UI into the repository before the tab is handed
|
|
413
|
+
* over, or to compare. Readable whatever the tab's source. Throws on an error.
|
|
414
|
+
*/
|
|
415
|
+
export declare function readBranding(opts: {
|
|
416
|
+
key: string;
|
|
417
|
+
baseUrl: string;
|
|
418
|
+
fetch?: FetchLike;
|
|
419
|
+
}): Promise<RepositoryBrandingState>;
|
|
420
|
+
/** The portal options as stored, in the shape `applyPortal` takes. Like `readBranding`. */
|
|
421
|
+
export declare function readPortal(opts: {
|
|
422
|
+
key: string;
|
|
423
|
+
baseUrl: string;
|
|
424
|
+
fetch?: FetchLike;
|
|
425
|
+
}): Promise<RepositoryPortalState>;
|
|
426
|
+
/** Report a Customer's tier (ADR-023, ADR-061), signed with a key of scope `entitlements`. */
|
|
427
|
+
export declare function reportEntitlement(opts: {
|
|
428
|
+
customer: string;
|
|
429
|
+
tier: string;
|
|
430
|
+
status?: "active" | "past_due" | "canceled";
|
|
431
|
+
period_end?: string | null;
|
|
432
|
+
members?: string[];
|
|
433
|
+
key: string;
|
|
434
|
+
baseUrl: string;
|
|
435
|
+
idempotencyKey?: string;
|
|
436
|
+
fetch?: FetchLike;
|
|
437
|
+
}): Promise<{
|
|
438
|
+
customer: string;
|
|
439
|
+
tier: string;
|
|
440
|
+
billing: Record<string, unknown>;
|
|
441
|
+
}>;
|
|
442
|
+
/** The Tenant's own tier and use (ADR-064 §11), for its server or its agent. Read-only: paying stays with people. */
|
|
443
|
+
export declare function readTenantSubscription(opts: {
|
|
444
|
+
key: string;
|
|
445
|
+
baseUrl: string;
|
|
446
|
+
fetch?: FetchLike;
|
|
447
|
+
}): Promise<TenantSubscriptionView>;
|
|
448
|
+
/** The current revision and hash, and what waits for approval. */
|
|
449
|
+
export declare function definitionStatus(opts: {
|
|
450
|
+
key: string;
|
|
451
|
+
baseUrl: string;
|
|
452
|
+
fetch?: FetchLike;
|
|
453
|
+
}): Promise<DefinitionStatus>;
|
|
454
|
+
/** What `GET /tenant/v0/engine` answers. `sdk` (ADR-074 §4): the SDK version the Engine was built with, and the oldest it still serves without a break. */
|
|
455
|
+
export interface EngineInfo {
|
|
456
|
+
version: string;
|
|
457
|
+
released_at: string | null;
|
|
458
|
+
latest_changeset: number;
|
|
459
|
+
site: {
|
|
460
|
+
docs: string | null;
|
|
461
|
+
changesets: string | null;
|
|
462
|
+
};
|
|
463
|
+
/** Absent on an Engine from before ADR-074. */
|
|
464
|
+
sdk?: {
|
|
465
|
+
built_with: string;
|
|
466
|
+
minimum: string;
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
/** The Engine's version, its latest changeset, the Engine site's addresses and the SDK versions it serves. Any live key of the Tenant. */
|
|
470
|
+
export declare function readEngine(opts: {
|
|
471
|
+
key: string;
|
|
472
|
+
baseUrl: string;
|
|
473
|
+
fetch?: FetchLike;
|
|
474
|
+
}): Promise<EngineInfo>;
|
|
475
|
+
/** Every changeset after `since`, each with this Tenant's ticket and status when it has one. */
|
|
476
|
+
export declare function readChangesets(opts: {
|
|
477
|
+
key: string;
|
|
478
|
+
baseUrl: string;
|
|
479
|
+
since?: number;
|
|
480
|
+
fetch?: FetchLike;
|
|
481
|
+
}): Promise<{
|
|
482
|
+
latest: number;
|
|
483
|
+
changesets: TenantChangeset[];
|
|
484
|
+
}>;
|
|
485
|
+
/** Where this Tenant stands with a changeset: `in_progress` while applying it, `resolved` with the SDK version installed, `canceled` with the reason. A note becomes a post. */
|
|
486
|
+
export declare function setChangesetStatus(opts: {
|
|
487
|
+
key: string;
|
|
488
|
+
baseUrl: string;
|
|
489
|
+
number: number;
|
|
490
|
+
status: Exclude<ChangesetStatus, "new">;
|
|
491
|
+
applied_version?: string;
|
|
492
|
+
reason?: string;
|
|
493
|
+
note?: string;
|
|
494
|
+
fetch?: FetchLike;
|
|
495
|
+
}): Promise<TenantChangeset>;
|
|
496
|
+
/** Report what the Engine cannot do, or does otherwise than documented. The same report sent twice is one ticket: the key is the body's hash. */
|
|
497
|
+
export declare function sendFeedback(opts: {
|
|
498
|
+
key: string;
|
|
499
|
+
baseUrl: string;
|
|
500
|
+
report: FeedbackReport;
|
|
501
|
+
fetch?: FetchLike;
|
|
502
|
+
}): Promise<{
|
|
503
|
+
id: string;
|
|
504
|
+
received_at: string;
|
|
505
|
+
}>;
|
|
506
|
+
/** The Tenant's feedback tickets that changed after the cursor, with the replies it may read; keep `next` for the next call. */
|
|
507
|
+
export declare function readFeedback(opts: {
|
|
508
|
+
key: string;
|
|
509
|
+
baseUrl: string;
|
|
510
|
+
since?: string;
|
|
511
|
+
fetch?: FetchLike;
|
|
512
|
+
}): Promise<{
|
|
513
|
+
items: TicketView[];
|
|
514
|
+
next: string | null;
|
|
515
|
+
}>;
|
|
516
|
+
/** Answer on one of the Tenant's feedback tickets. */
|
|
517
|
+
export declare function replyToFeedback(opts: {
|
|
518
|
+
key: string;
|
|
519
|
+
baseUrl: string;
|
|
520
|
+
id: string;
|
|
521
|
+
body: string;
|
|
522
|
+
fetch?: FetchLike;
|
|
523
|
+
}): Promise<TicketView>;
|
|
524
|
+
/** What `GET /tenant/v0/key` answers: the calling key's own record. Never another key, never key material. */
|
|
525
|
+
export interface TenantKeyRecord {
|
|
526
|
+
id: string;
|
|
527
|
+
name: string;
|
|
528
|
+
/** The Tenant's slug. */
|
|
529
|
+
tenant: string;
|
|
530
|
+
scopes: TenantKeyScope[];
|
|
531
|
+
created_at: string;
|
|
532
|
+
expires_at: string;
|
|
533
|
+
}
|
|
534
|
+
/** The calling key's own record: which Tenant it is for, what it reaches and when it expires. Any live key. */
|
|
535
|
+
export declare function readKey(opts: {
|
|
536
|
+
key: string;
|
|
537
|
+
baseUrl: string;
|
|
538
|
+
fetch?: FetchLike;
|
|
539
|
+
}): Promise<TenantKeyRecord>;
|
|
540
|
+
/** The Tenant's tags (ADR-057), with a key of scope `tags`. */
|
|
541
|
+
export declare function readTags(opts: {
|
|
542
|
+
key: string;
|
|
543
|
+
baseUrl: string;
|
|
544
|
+
fetch?: FetchLike;
|
|
545
|
+
}): Promise<TagView[]>;
|
|
546
|
+
/** What `setTag` may set on a tag. A part left out keeps its value; a new tag starts as `staff`, `slate`, with no rules and no effects. */
|
|
547
|
+
export interface TagChange {
|
|
548
|
+
visibility?: TagVisibility;
|
|
549
|
+
description?: string;
|
|
550
|
+
colour?: TagColour;
|
|
551
|
+
rules?: TagRule[];
|
|
552
|
+
effects?: TagEffect[];
|
|
553
|
+
}
|
|
554
|
+
/** Create the tag or change it, by name, so a server keeps its tags in step. `created` says which happened. */
|
|
555
|
+
export declare function setTag(opts: {
|
|
556
|
+
name: string;
|
|
557
|
+
change?: TagChange;
|
|
558
|
+
key: string;
|
|
559
|
+
baseUrl: string;
|
|
560
|
+
fetch?: FetchLike;
|
|
561
|
+
}): Promise<TagView & {
|
|
562
|
+
created: boolean;
|
|
563
|
+
}>;
|
|
564
|
+
/** Put a tag on one of the Tenant's Customers. `added` is false when the Customer had it already. */
|
|
565
|
+
export declare function tagCustomer(opts: {
|
|
566
|
+
customer: string;
|
|
567
|
+
tag: string;
|
|
568
|
+
key: string;
|
|
569
|
+
baseUrl: string;
|
|
570
|
+
fetch?: FetchLike;
|
|
571
|
+
}): Promise<{
|
|
572
|
+
customer: string;
|
|
573
|
+
tag: string;
|
|
574
|
+
added: boolean;
|
|
575
|
+
}>;
|
|
576
|
+
/** Take a tag off one of the Tenant's Customers. `removed` is false when the Customer did not have it. */
|
|
577
|
+
export declare function untagCustomer(opts: {
|
|
578
|
+
customer: string;
|
|
579
|
+
tag: string;
|
|
580
|
+
key: string;
|
|
581
|
+
baseUrl: string;
|
|
582
|
+
fetch?: FetchLike;
|
|
583
|
+
}): Promise<{
|
|
584
|
+
customer: string;
|
|
585
|
+
tag: string;
|
|
586
|
+
removed: boolean;
|
|
587
|
+
}>;
|
|
588
|
+
/** Which tickets `listTickets` answers with. Every part is optional; none lists the open and recent ones. */
|
|
589
|
+
export interface TicketFilter {
|
|
590
|
+
status?: string;
|
|
591
|
+
/** A primary type (`issue`, `request`, `feedback`) or a secondary one. */
|
|
592
|
+
type?: string;
|
|
593
|
+
archived?: boolean;
|
|
594
|
+
unread?: boolean;
|
|
595
|
+
tags?: TagSelector;
|
|
596
|
+
limit?: number;
|
|
597
|
+
}
|
|
598
|
+
/** The tickets the Tenant's servers are a party of (ADR-058 §10), with a key of scope `tickets`. */
|
|
599
|
+
export declare function listTickets(opts: {
|
|
600
|
+
filter?: TicketFilter;
|
|
601
|
+
key: string;
|
|
602
|
+
baseUrl: string;
|
|
603
|
+
fetch?: FetchLike;
|
|
604
|
+
}): Promise<TicketSummary[]>;
|
|
605
|
+
/** One ticket with its posts. Reading it marks it read for the Tenant's servers. */
|
|
606
|
+
export declare function readTicket(opts: {
|
|
607
|
+
id: string;
|
|
608
|
+
key: string;
|
|
609
|
+
baseUrl: string;
|
|
610
|
+
fetch?: FetchLike;
|
|
611
|
+
}): Promise<TicketView>;
|
|
612
|
+
/** A new ticket: to the platform (`to: "platform"`, `type` one of `TENANT_PLATFORM_TYPES`) or to one of the Tenant's Customers (`to: <cst>`). */
|
|
613
|
+
export interface OpenTicket {
|
|
614
|
+
to: string;
|
|
615
|
+
type?: string;
|
|
616
|
+
subject: string;
|
|
617
|
+
body: string;
|
|
618
|
+
priority?: Priority;
|
|
619
|
+
refs?: string[];
|
|
620
|
+
/** The Customer's name as the Tenant's own pages show it, kept for the lists. */
|
|
621
|
+
to_name?: string;
|
|
622
|
+
}
|
|
623
|
+
export declare function openTicket(opts: {
|
|
624
|
+
ticket: OpenTicket;
|
|
625
|
+
key: string;
|
|
626
|
+
baseUrl: string;
|
|
627
|
+
fetch?: FetchLike;
|
|
628
|
+
}): Promise<TicketView>;
|
|
629
|
+
/** A reply on a ticket. `visibility: "side"` keeps it to the Tenant's own side. */
|
|
630
|
+
export declare function postToTicket(opts: {
|
|
631
|
+
id: string;
|
|
632
|
+
body: string;
|
|
633
|
+
visibility?: "all" | "side";
|
|
634
|
+
refs?: string[];
|
|
635
|
+
key: string;
|
|
636
|
+
baseUrl: string;
|
|
637
|
+
fetch?: FetchLike;
|
|
638
|
+
}): Promise<TicketView>;
|
|
639
|
+
/** One change to a ticket or an announcement: its status, its priority or archiving it. */
|
|
640
|
+
export interface TicketChange {
|
|
641
|
+
status?: AnyStatus;
|
|
642
|
+
hold_until?: string | null;
|
|
643
|
+
priority?: Priority;
|
|
644
|
+
archived?: boolean;
|
|
645
|
+
audience?: TagSelector | null;
|
|
646
|
+
announcement?: AnnouncementOptions;
|
|
647
|
+
}
|
|
648
|
+
export declare function updateTicket(opts: {
|
|
649
|
+
id: string;
|
|
650
|
+
change: TicketChange;
|
|
651
|
+
key: string;
|
|
652
|
+
baseUrl: string;
|
|
653
|
+
fetch?: FetchLike;
|
|
654
|
+
}): Promise<TicketView>;
|
|
655
|
+
/** An announcement's own settings (ADR-058 §8): texts per language, when it shows and how. */
|
|
656
|
+
export interface AnnouncementOptions {
|
|
657
|
+
languages?: Record<string, {
|
|
658
|
+
subject: string;
|
|
659
|
+
body: string;
|
|
660
|
+
}>;
|
|
661
|
+
default_language?: string;
|
|
662
|
+
publish_at?: string | null;
|
|
663
|
+
expires_at?: string | null;
|
|
664
|
+
pinned?: boolean;
|
|
665
|
+
severity?: "info" | "warning";
|
|
666
|
+
replies?: boolean;
|
|
667
|
+
}
|
|
668
|
+
/** The Tenant's announcements to its Customers, with every status, and the platform's announcements to the Tenant, read only. */
|
|
669
|
+
export declare function listAnnouncements(opts: {
|
|
670
|
+
lang?: string;
|
|
671
|
+
key: string;
|
|
672
|
+
baseUrl: string;
|
|
673
|
+
fetch?: FetchLike;
|
|
674
|
+
}): Promise<{
|
|
675
|
+
items: TicketSummary[];
|
|
676
|
+
platform: AnnouncementItem[];
|
|
677
|
+
}>;
|
|
678
|
+
export declare function readAnnouncement(opts: {
|
|
679
|
+
id: string;
|
|
680
|
+
key: string;
|
|
681
|
+
baseUrl: string;
|
|
682
|
+
fetch?: FetchLike;
|
|
683
|
+
}): Promise<TicketView>;
|
|
684
|
+
/** A new announcement to the Tenant's Customers: its text, its audience of tags (everyone without one) and its own settings. */
|
|
685
|
+
export interface NewAnnouncement {
|
|
686
|
+
subject: string;
|
|
687
|
+
body?: string;
|
|
688
|
+
type?: string;
|
|
689
|
+
priority?: Priority;
|
|
690
|
+
audience?: TagSelector;
|
|
691
|
+
announcement?: AnnouncementOptions;
|
|
692
|
+
}
|
|
693
|
+
/** Start an announcement to the Tenant's Customers, to everyone or to an audience of tags. It starts as a draft; `publishAnnouncement` sends it, or `announcement.publish_at` schedules it. */
|
|
694
|
+
export declare function draftAnnouncement(opts: {
|
|
695
|
+
announcement: NewAnnouncement;
|
|
696
|
+
key: string;
|
|
697
|
+
baseUrl: string;
|
|
698
|
+
fetch?: FetchLike;
|
|
699
|
+
}): Promise<TicketView>;
|
|
700
|
+
/** Publish a draft announcement now: its status becomes `published`. */
|
|
701
|
+
export declare function publishAnnouncement(opts: {
|
|
702
|
+
id: string;
|
|
703
|
+
key: string;
|
|
704
|
+
baseUrl: string;
|
|
705
|
+
fetch?: FetchLike;
|
|
706
|
+
}): Promise<TicketView>;
|
|
707
|
+
export declare function updateAnnouncement(opts: {
|
|
708
|
+
id: string;
|
|
709
|
+
change: TicketChange;
|
|
710
|
+
key: string;
|
|
711
|
+
baseUrl: string;
|
|
712
|
+
fetch?: FetchLike;
|
|
713
|
+
}): Promise<TicketView>;
|
|
714
|
+
/** Take a published announcement down: its status becomes `withdrawn`. */
|
|
715
|
+
export declare function withdrawAnnouncement(opts: {
|
|
716
|
+
id: string;
|
|
717
|
+
key: string;
|
|
718
|
+
baseUrl: string;
|
|
719
|
+
fetch?: FetchLike;
|
|
720
|
+
}): Promise<TicketView>;
|
|
721
|
+
/** Delete an announcement that is still a draft; a published one is withdrawn instead. */
|
|
722
|
+
export declare function deleteAnnouncementDraft(opts: {
|
|
723
|
+
id: string;
|
|
724
|
+
key: string;
|
|
725
|
+
baseUrl: string;
|
|
726
|
+
fetch?: FetchLike;
|
|
727
|
+
}): Promise<void>;
|
|
728
|
+
export declare function b64url(bytes: Uint8Array): string;
|
|
729
|
+
export declare function fromB64url(value: string): Uint8Array;
|
|
730
|
+
export {};
|
|
731
|
+
//# sourceMappingURL=definition-set.d.ts.map
|