@kennra/app-sdk 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/app.d.ts +190 -0
- package/dist/app.js +448 -0
- package/dist/client.d.ts +161 -0
- package/dist/client.js +263 -0
- package/dist/hosting.d.ts +56 -0
- package/dist/hosting.js +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +31 -0
- package/dist/manifest.d.ts +495 -0
- package/dist/manifest.js +956 -0
- package/dist/operations.d.ts +8 -0
- package/dist/operations.js +9 -0
- package/dist/protocol.d.ts +851 -0
- package/dist/protocol.js +5 -0
- package/dist/signature.d.ts +61 -0
- package/dist/signature.js +108 -0
- package/dist/testing.d.ts +80 -0
- package/dist/testing.js +226 -0
- package/package.json +74 -4
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const MANIFEST_API_VERSION = "kennra.app/v1";
|
|
3
|
+
export declare const PII_LEVELS: readonly ["none", "pseudonymous", "contact_basic", "full"];
|
|
4
|
+
export type ManifestPiiLevel = (typeof PII_LEVELS)[number];
|
|
5
|
+
/**
|
|
6
|
+
* Scopes an app may request. `kennra:privacy`, workspace scopes and publishing the schema are never
|
|
7
|
+
* granted to apps; proposing schema changes (`kennra:schema:draft`) is.
|
|
8
|
+
*/
|
|
9
|
+
export declare const APP_SCOPES: readonly ["kennra:read", "kennra:party:write", "kennra:commerce:write", "kennra:interaction:write", "kennra:trait:write", "kennra:deal:write", "kennra:work:write", "kennra:consent:write", "kennra:import:backdate", "kennra:export", "kennra:segment:read", "kennra:schema:draft", "kennra:suggestions:decide", "kennra:consent:grant", "kennra:engagement:write"];
|
|
10
|
+
export type AppScope = (typeof APP_SCOPES)[number];
|
|
11
|
+
/** The scope that lets an app pass on a member's decision on a suggestion (21 November 2026). */
|
|
12
|
+
export declare const SUGGESTIONS_DECIDE_SCOPE = "kennra:suggestions:decide";
|
|
13
|
+
/** Scopes that need their own line on the consent screen and Kennra approval for listed apps. */
|
|
14
|
+
export declare const SENSITIVE_SCOPES: readonly string[];
|
|
15
|
+
/** The scope that lets an app record consent a person gave in it (decision 21 November 2026). */
|
|
16
|
+
export declare const CONSENT_GRANT_SCOPE = "kennra:consent:grant";
|
|
17
|
+
/** The scope for engagement signals (decision 21 November 2026). */
|
|
18
|
+
export declare const ENGAGEMENT_WRITE_SCOPE = "kennra:engagement:write";
|
|
19
|
+
/** Engagement signals an app can report (`recordEngagement`). */
|
|
20
|
+
export declare const ENGAGEMENT_SIGNALS: readonly ["delivered", "opened", "clicked", "bounced", "complained", "unsubscribed"];
|
|
21
|
+
/** Channels a target can ask contact points for (the address the app sends to). */
|
|
22
|
+
export declare const TARGET_CONTACT_CHANNELS: readonly ["email", "sms"];
|
|
23
|
+
/**
|
|
24
|
+
* Objects the core's lookup broker knows how to validate and serve (docs/15 §4.2).
|
|
25
|
+
* `organization.search` is a search in a public company register: the ref is
|
|
26
|
+
* `<country>:<text>` (ISO 3166-1 alpha-2 and what a person typed), e.g. `NO:fjellsport`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const LOOKUP_OBJECTS: readonly ["order.details", "subscription.details", "interaction.details", "organization.search", "organization.profile", "organization.logo"];
|
|
29
|
+
export type LookupObject = (typeof LOOKUP_OBJECTS)[number];
|
|
30
|
+
/** Kinds an app may declare it writes. */
|
|
31
|
+
export declare const WRITABLE_KINDS: readonly ["Person", "Organization", "CommerceFact", "Interaction", "Deal", "Task", "Note"];
|
|
32
|
+
/** The Kinds a deep link (`capabilities.ui.links`) can be declared on. */
|
|
33
|
+
export declare const LINK_KINDS: readonly ["Person", "Organization", "CommerceFact", "Deal", "Interaction"];
|
|
34
|
+
export type LinkKind = (typeof LINK_KINDS)[number];
|
|
35
|
+
/** A label: plain English, or per language with English as the fallback (`{ en, nb }`). */
|
|
36
|
+
declare const Label: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
37
|
+
en: z.ZodString;
|
|
38
|
+
}, z.core.$catchall<z.ZodString>>]>;
|
|
39
|
+
export type ManifestLabel = z.infer<typeof Label>;
|
|
40
|
+
/** A label in a language: the language, else English, else the plain string. */
|
|
41
|
+
export declare function localize(label: ManifestLabel | undefined, lang: string | null | undefined): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Where a setting is shown: `default` in the install form, `advanced` behind "Advanced" (collapsed),
|
|
44
|
+
* `demo` only in demo and test workspaces (recorded data, fixtures). The core rejects demo-only
|
|
45
|
+
* settings in production workspaces.
|
|
46
|
+
*/
|
|
47
|
+
export declare const SETTING_VISIBILITY: readonly ["default", "advanced", "demo"];
|
|
48
|
+
/** A run's maximum duration when its schedule declares none (docs/15 §4.7). */
|
|
49
|
+
export declare const DEFAULT_MAX_RUN_SECONDS = 600;
|
|
50
|
+
/** How long a run's lease lasts after its start or its last heartbeat. */
|
|
51
|
+
export declare const RUN_LEASE_SECONDS = 600;
|
|
52
|
+
/** What a run gets past its maximum duration to save its cursor and report, before it is abandoned. */
|
|
53
|
+
export declare const RUN_GRACE_SECONDS = 120;
|
|
54
|
+
export declare const AppManifestSchema: z.ZodObject<{
|
|
55
|
+
apiVersion: z.ZodLiteral<"kennra.app/v1">;
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
version: z.ZodString;
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
60
|
+
publisher: z.ZodObject<{
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
kind: z.ZodEnum<{
|
|
63
|
+
private: "private";
|
|
64
|
+
first_party: "first_party";
|
|
65
|
+
partner: "partner";
|
|
66
|
+
}>;
|
|
67
|
+
website: z.ZodOptional<z.ZodString>;
|
|
68
|
+
support: z.ZodOptional<z.ZodString>;
|
|
69
|
+
security: z.ZodOptional<z.ZodString>;
|
|
70
|
+
privacyPolicy: z.ZodOptional<z.ZodString>;
|
|
71
|
+
terms: z.ZodOptional<z.ZodString>;
|
|
72
|
+
dpa: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
description: z.ZodObject<{
|
|
75
|
+
en: z.ZodString;
|
|
76
|
+
}, z.core.$catchall<z.ZodString>>;
|
|
77
|
+
access: z.ZodObject<{
|
|
78
|
+
piiLevel: z.ZodEnum<{
|
|
79
|
+
full: "full";
|
|
80
|
+
none: "none";
|
|
81
|
+
pseudonymous: "pseudonymous";
|
|
82
|
+
contact_basic: "contact_basic";
|
|
83
|
+
}>;
|
|
84
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
85
|
+
scope: z.ZodString;
|
|
86
|
+
purposes: z.ZodArray<z.ZodString>;
|
|
87
|
+
why: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
88
|
+
en: z.ZodString;
|
|
89
|
+
}, z.core.$catchall<z.ZodString>>]>;
|
|
90
|
+
}, z.core.$strip>>>;
|
|
91
|
+
writes: z.ZodDefault<z.ZodObject<{
|
|
92
|
+
kinds: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
93
|
+
Person: "Person";
|
|
94
|
+
Organization: "Organization";
|
|
95
|
+
CommerceFact: "CommerceFact";
|
|
96
|
+
Interaction: "Interaction";
|
|
97
|
+
Deal: "Deal";
|
|
98
|
+
Task: "Task";
|
|
99
|
+
Note: "Note";
|
|
100
|
+
}>>>;
|
|
101
|
+
traits: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
102
|
+
externalIdentifiers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
reads: z.ZodDefault<z.ZodObject<{
|
|
105
|
+
fields: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
106
|
+
}, z.core.$strip>>;
|
|
107
|
+
actsForMembers: z.ZodDefault<z.ZodBoolean>;
|
|
108
|
+
delegation: z.ZodDefault<z.ZodBoolean>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
identifiers: z.ZodOptional<z.ZodObject<{
|
|
111
|
+
issuer: z.ZodString;
|
|
112
|
+
schemes: z.ZodArray<z.ZodObject<{
|
|
113
|
+
scheme: z.ZodString;
|
|
114
|
+
appliesTo: z.ZodArray<z.ZodEnum<{
|
|
115
|
+
person: "person";
|
|
116
|
+
organization: "organization";
|
|
117
|
+
}>>;
|
|
118
|
+
label: z.ZodObject<{
|
|
119
|
+
en: z.ZodString;
|
|
120
|
+
}, z.core.$catchall<z.ZodString>>;
|
|
121
|
+
description: z.ZodOptional<z.ZodString>;
|
|
122
|
+
strength: z.ZodDefault<z.ZodEnum<{
|
|
123
|
+
strong: "strong";
|
|
124
|
+
weak: "weak";
|
|
125
|
+
}>>;
|
|
126
|
+
normalize: z.ZodDefault<z.ZodEnum<{
|
|
127
|
+
trim: "trim";
|
|
128
|
+
trim_lower: "trim_lower";
|
|
129
|
+
digits: "digits";
|
|
130
|
+
}>>;
|
|
131
|
+
piiClass: z.ZodDefault<z.ZodEnum<{
|
|
132
|
+
none: "none";
|
|
133
|
+
contact: "contact";
|
|
134
|
+
}>>;
|
|
135
|
+
legacyTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
}, z.core.$strip>>;
|
|
138
|
+
capabilities: z.ZodDefault<z.ZodObject<{
|
|
139
|
+
ingest: z.ZodOptional<z.ZodObject<{
|
|
140
|
+
factTypes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
141
|
+
ORDER: "ORDER";
|
|
142
|
+
QUOTE: "QUOTE";
|
|
143
|
+
SUBSCRIPTION: "SUBSCRIPTION";
|
|
144
|
+
INTERACTION: "INTERACTION";
|
|
145
|
+
}>>>;
|
|
146
|
+
sourceSystem: z.ZodString;
|
|
147
|
+
urn: z.ZodOptional<z.ZodString>;
|
|
148
|
+
lanes: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
149
|
+
live: "live";
|
|
150
|
+
import: "import";
|
|
151
|
+
}>>>;
|
|
152
|
+
backfill: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
schedule: z.ZodString;
|
|
154
|
+
yearsSetting: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, z.core.$strip>>;
|
|
156
|
+
}, z.core.$strip>>;
|
|
157
|
+
lookups: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
158
|
+
object: z.ZodEnum<{
|
|
159
|
+
"order.details": "order.details";
|
|
160
|
+
"subscription.details": "subscription.details";
|
|
161
|
+
"interaction.details": "interaction.details";
|
|
162
|
+
"organization.search": "organization.search";
|
|
163
|
+
"organization.profile": "organization.profile";
|
|
164
|
+
"organization.logo": "organization.logo";
|
|
165
|
+
}>;
|
|
166
|
+
refPattern: z.ZodString;
|
|
167
|
+
url: z.ZodString;
|
|
168
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
169
|
+
cacheTtlSeconds: z.ZodDefault<z.ZodNumber>;
|
|
170
|
+
purposes: z.ZodArray<z.ZodString>;
|
|
171
|
+
delegated: z.ZodDefault<z.ZodBoolean>;
|
|
172
|
+
}, z.core.$strip>>>;
|
|
173
|
+
schedules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
174
|
+
id: z.ZodString;
|
|
175
|
+
every: z.ZodOptional<z.ZodString>;
|
|
176
|
+
cron: z.ZodOptional<z.ZodString>;
|
|
177
|
+
lane: z.ZodDefault<z.ZodEnum<{
|
|
178
|
+
live: "live";
|
|
179
|
+
import: "import";
|
|
180
|
+
}>>;
|
|
181
|
+
url: z.ZodString;
|
|
182
|
+
maxRunSeconds: z.ZodOptional<z.ZodNumber>;
|
|
183
|
+
}, z.core.$strip>>>;
|
|
184
|
+
webhooks: z.ZodOptional<z.ZodObject<{
|
|
185
|
+
url: z.ZodString;
|
|
186
|
+
events: z.ZodArray<z.ZodString>;
|
|
187
|
+
}, z.core.$strip>>;
|
|
188
|
+
segmentSync: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
url: z.ZodString;
|
|
190
|
+
batchSize: z.ZodDefault<z.ZodNumber>;
|
|
191
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
192
|
+
id: z.ZodString;
|
|
193
|
+
label: z.ZodObject<{
|
|
194
|
+
en: z.ZodString;
|
|
195
|
+
}, z.core.$catchall<z.ZodString>>;
|
|
196
|
+
description: z.ZodOptional<z.ZodObject<{
|
|
197
|
+
en: z.ZodString;
|
|
198
|
+
}, z.core.$catchall<z.ZodString>>>;
|
|
199
|
+
kinds: z.ZodArray<z.ZodEnum<{
|
|
200
|
+
person: "person";
|
|
201
|
+
organization: "organization";
|
|
202
|
+
}>>;
|
|
203
|
+
config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
204
|
+
type: z.ZodLiteral<"string">;
|
|
205
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
206
|
+
en: z.ZodString;
|
|
207
|
+
}, z.core.$catchall<z.ZodString>>]>;
|
|
208
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
209
|
+
}, z.core.$strip>>>;
|
|
210
|
+
requiredConsent: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
211
|
+
purpose: z.ZodString;
|
|
212
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
213
|
+
}, z.core.$strip>>>;
|
|
214
|
+
contactPoints: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
215
|
+
email: "email";
|
|
216
|
+
sms: "sms";
|
|
217
|
+
}>>>;
|
|
218
|
+
}, z.core.$strip>>;
|
|
219
|
+
}, z.core.$strip>>;
|
|
220
|
+
programTargets: z.ZodOptional<z.ZodObject<{
|
|
221
|
+
url: z.ZodString;
|
|
222
|
+
batchSize: z.ZodDefault<z.ZodNumber>;
|
|
223
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
224
|
+
id: z.ZodString;
|
|
225
|
+
label: z.ZodObject<{
|
|
226
|
+
en: z.ZodString;
|
|
227
|
+
}, z.core.$catchall<z.ZodString>>;
|
|
228
|
+
description: z.ZodOptional<z.ZodObject<{
|
|
229
|
+
en: z.ZodString;
|
|
230
|
+
}, z.core.$catchall<z.ZodString>>>;
|
|
231
|
+
config: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
232
|
+
type: z.ZodLiteral<"string">;
|
|
233
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
234
|
+
en: z.ZodString;
|
|
235
|
+
}, z.core.$catchall<z.ZodString>>]>;
|
|
236
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
237
|
+
}, z.core.$strip>>>;
|
|
238
|
+
requiredConsent: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
239
|
+
purpose: z.ZodString;
|
|
240
|
+
channel: z.ZodOptional<z.ZodString>;
|
|
241
|
+
}, z.core.$strip>>>;
|
|
242
|
+
contactPoints: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
243
|
+
email: "email";
|
|
244
|
+
sms: "sms";
|
|
245
|
+
}>>>;
|
|
246
|
+
}, z.core.$strip>>;
|
|
247
|
+
}, z.core.$strip>>;
|
|
248
|
+
lifecycle: z.ZodOptional<z.ZodObject<{
|
|
249
|
+
url: z.ZodString;
|
|
250
|
+
}, z.core.$strip>>;
|
|
251
|
+
connectionTest: z.ZodOptional<z.ZodObject<{
|
|
252
|
+
url: z.ZodString;
|
|
253
|
+
}, z.core.$strip>>;
|
|
254
|
+
privacy: z.ZodOptional<z.ZodObject<{
|
|
255
|
+
erasure: z.ZodDefault<z.ZodEnum<{
|
|
256
|
+
none: "none";
|
|
257
|
+
receipt: "receipt";
|
|
258
|
+
}>>;
|
|
259
|
+
storesPersonalData: z.ZodBoolean;
|
|
260
|
+
url: z.ZodOptional<z.ZodString>;
|
|
261
|
+
}, z.core.$strip>>;
|
|
262
|
+
traits: z.ZodOptional<z.ZodObject<{
|
|
263
|
+
namespace: z.ZodString;
|
|
264
|
+
definitions: z.ZodDefault<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
265
|
+
}, z.core.$strip>>;
|
|
266
|
+
userConnections: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
267
|
+
kind: z.ZodEnum<{
|
|
268
|
+
calendar: "calendar";
|
|
269
|
+
mailbox: "mailbox";
|
|
270
|
+
drive: "drive";
|
|
271
|
+
transcripts: "transcripts";
|
|
272
|
+
}>;
|
|
273
|
+
label: z.ZodObject<{
|
|
274
|
+
en: z.ZodString;
|
|
275
|
+
}, z.core.$catchall<z.ZodString>>;
|
|
276
|
+
connectUrl: z.ZodString;
|
|
277
|
+
disconnectUrl: z.ZodOptional<z.ZodString>;
|
|
278
|
+
requiresSetting: z.ZodOptional<z.ZodString>;
|
|
279
|
+
consentLabel: z.ZodOptional<z.ZodObject<{
|
|
280
|
+
en: z.ZodString;
|
|
281
|
+
}, z.core.$catchall<z.ZodString>>>;
|
|
282
|
+
}, z.core.$strip>>>;
|
|
283
|
+
setup: z.ZodOptional<z.ZodObject<{
|
|
284
|
+
url: z.ZodString;
|
|
285
|
+
label: z.ZodObject<{
|
|
286
|
+
en: z.ZodString;
|
|
287
|
+
}, z.core.$catchall<z.ZodString>>;
|
|
288
|
+
description: z.ZodOptional<z.ZodObject<{
|
|
289
|
+
en: z.ZodString;
|
|
290
|
+
}, z.core.$catchall<z.ZodString>>>;
|
|
291
|
+
help: z.ZodOptional<z.ZodObject<{
|
|
292
|
+
title: z.ZodObject<{
|
|
293
|
+
en: z.ZodString;
|
|
294
|
+
}, z.core.$catchall<z.ZodString>>;
|
|
295
|
+
body: z.ZodObject<{
|
|
296
|
+
en: z.ZodString;
|
|
297
|
+
}, z.core.$catchall<z.ZodString>>;
|
|
298
|
+
}, z.core.$strip>>;
|
|
299
|
+
connects: z.ZodOptional<z.ZodEnum<{
|
|
300
|
+
calendar: "calendar";
|
|
301
|
+
mailbox: "mailbox";
|
|
302
|
+
drive: "drive";
|
|
303
|
+
transcripts: "transcripts";
|
|
304
|
+
}>>;
|
|
305
|
+
}, z.core.$strip>>;
|
|
306
|
+
mcpClient: z.ZodOptional<z.ZodObject<{
|
|
307
|
+
clientIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
308
|
+
redirectUris: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
309
|
+
refreshTokens: z.ZodDefault<z.ZodEnum<{
|
|
310
|
+
rotate: "rotate";
|
|
311
|
+
reuse: "reuse";
|
|
312
|
+
}>>;
|
|
313
|
+
defaultTemplate: z.ZodDefault<z.ZodString>;
|
|
314
|
+
connectUrl: z.ZodOptional<z.ZodString>;
|
|
315
|
+
instructions: z.ZodOptional<z.ZodObject<{
|
|
316
|
+
en: z.ZodString;
|
|
317
|
+
}, z.core.$catchall<z.ZodString>>>;
|
|
318
|
+
}, z.core.$strip>>;
|
|
319
|
+
ui: z.ZodOptional<z.ZodObject<{
|
|
320
|
+
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
321
|
+
on: z.ZodEnum<{
|
|
322
|
+
Person: "Person";
|
|
323
|
+
Organization: "Organization";
|
|
324
|
+
CommerceFact: "CommerceFact";
|
|
325
|
+
Interaction: "Interaction";
|
|
326
|
+
Deal: "Deal";
|
|
327
|
+
}>;
|
|
328
|
+
label: z.ZodObject<{
|
|
329
|
+
en: z.ZodString;
|
|
330
|
+
}, z.core.$catchall<z.ZodString>>;
|
|
331
|
+
url: z.ZodString;
|
|
332
|
+
when: z.ZodOptional<z.ZodObject<{
|
|
333
|
+
factType: z.ZodPreprocess<z.ZodArray<z.ZodEnum<{
|
|
334
|
+
ORDER: "ORDER";
|
|
335
|
+
QUOTE: "QUOTE";
|
|
336
|
+
SUBSCRIPTION: "SUBSCRIPTION";
|
|
337
|
+
}>>, unknown>;
|
|
338
|
+
}, z.core.$strip>>;
|
|
339
|
+
}, z.core.$strip>>>;
|
|
340
|
+
domains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
341
|
+
}, z.core.$strip>>;
|
|
342
|
+
}, z.core.$strip>>;
|
|
343
|
+
settings: z.ZodOptional<z.ZodObject<{
|
|
344
|
+
schema: z.ZodObject<{
|
|
345
|
+
type: z.ZodLiteral<"object">;
|
|
346
|
+
required: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
347
|
+
properties: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
348
|
+
type: z.ZodEnum<{
|
|
349
|
+
string: "string";
|
|
350
|
+
number: "number";
|
|
351
|
+
boolean: "boolean";
|
|
352
|
+
integer: "integer";
|
|
353
|
+
}>;
|
|
354
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
355
|
+
en: z.ZodString;
|
|
356
|
+
}, z.core.$catchall<z.ZodString>>]>>;
|
|
357
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
358
|
+
en: z.ZodString;
|
|
359
|
+
}, z.core.$catchall<z.ZodString>>]>>;
|
|
360
|
+
format: z.ZodOptional<z.ZodString>;
|
|
361
|
+
default: z.ZodOptional<z.ZodUnknown>;
|
|
362
|
+
visibility: z.ZodDefault<z.ZodEnum<{
|
|
363
|
+
default: "default";
|
|
364
|
+
advanced: "advanced";
|
|
365
|
+
demo: "demo";
|
|
366
|
+
}>>;
|
|
367
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
368
|
+
}, z.core.$strip>>;
|
|
369
|
+
}, z.core.$strip>;
|
|
370
|
+
}, z.core.$strip>>;
|
|
371
|
+
dataResidency: z.ZodOptional<z.ZodObject<{
|
|
372
|
+
processing: z.ZodArray<z.ZodString>;
|
|
373
|
+
subprocessors: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
374
|
+
}, z.core.$strip>>;
|
|
375
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
376
|
+
requestsPerMinute: z.ZodOptional<z.ZodNumber>;
|
|
377
|
+
ingestPerMinute: z.ZodOptional<z.ZodNumber>;
|
|
378
|
+
lookupConcurrency: z.ZodOptional<z.ZodNumber>;
|
|
379
|
+
}, z.core.$strip>>;
|
|
380
|
+
health: z.ZodOptional<z.ZodObject<{
|
|
381
|
+
url: z.ZodString;
|
|
382
|
+
}, z.core.$strip>>;
|
|
383
|
+
}, z.core.$strip>;
|
|
384
|
+
export type AppManifest = z.infer<typeof AppManifestSchema>;
|
|
385
|
+
export type AppManifestInput = z.input<typeof AppManifestSchema>;
|
|
386
|
+
export interface ManifestProblem {
|
|
387
|
+
path: string;
|
|
388
|
+
code: string;
|
|
389
|
+
message: string;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Whether a URI may receive an authorization code: https without a fragment, or http on a loopback
|
|
393
|
+
* host (a native client, RFC 8252).
|
|
394
|
+
*/
|
|
395
|
+
export declare function isRedirectUri(raw: string): boolean;
|
|
396
|
+
/**
|
|
397
|
+
* Whether an app's redirect URI entry is a path prefix: https, ending in `/*`, with at least one
|
|
398
|
+
* path segment before it, no other `*`, no query and no fragment.
|
|
399
|
+
*/
|
|
400
|
+
export declare function isRedirectUriPattern(raw: string): boolean;
|
|
401
|
+
/** Interval in milliseconds for `every` (`15m`, `2h`, `1d`). */
|
|
402
|
+
export declare function intervalMs(every: string): number;
|
|
403
|
+
/**
|
|
404
|
+
* Purposes, scopes and manifest keys renamed on 20 November 2026 (naming rounds 4 and 5). A
|
|
405
|
+
* manifest with an old name is refused, and the problem names the current one. Nothing is read
|
|
406
|
+
* under an old name (no compatibility period before the API freeze).
|
|
407
|
+
*/
|
|
408
|
+
export declare const RENAMED: Readonly<Record<string, string>>;
|
|
409
|
+
/** ` It is called <new> now.` for a renamed name, else empty. */
|
|
410
|
+
export declare const renamedHint: (name: string) => string;
|
|
411
|
+
/**
|
|
412
|
+
* Validates a manifest (an object, or YAML/JSON text). Returns the parsed manifest with defaults,
|
|
413
|
+
* or the problems. Rules beyond the shape (docs/15 §2.3): scopes from the app list with purposes;
|
|
414
|
+
* declared writes covered by write scopes; issuer and schemes well formed; at most 10 schedules,
|
|
415
|
+
* at least 5 minutes apart; health for apps with ingest, lookups or schedules; lifecycle, privacy
|
|
416
|
+
* and data residency for listed (first-party and partner) apps; no `kennra` or `custom` namespace.
|
|
417
|
+
*/
|
|
418
|
+
export declare function validateManifest(input: unknown): {
|
|
419
|
+
ok: true;
|
|
420
|
+
manifest: AppManifest;
|
|
421
|
+
warnings: ManifestProblem[];
|
|
422
|
+
} | {
|
|
423
|
+
ok: false;
|
|
424
|
+
problems: ManifestProblem[];
|
|
425
|
+
};
|
|
426
|
+
/** Like validateManifest, but throws with every problem listed. */
|
|
427
|
+
export declare function defineManifest(input: AppManifestInput | string): AppManifest;
|
|
428
|
+
/**
|
|
429
|
+
* The app's declared hosts (docs/24 §5, `Link`): `capabilities.ui.domains` and the hosts of its
|
|
430
|
+
* `capabilities.ui.links` templates. Empty when the manifest declares none.
|
|
431
|
+
*/
|
|
432
|
+
/** Whether a boolean setting is on: the saved value, else the schema's default. */
|
|
433
|
+
export declare function settingOn(m: Pick<AppManifest, 'settings'>, settings: Record<string, unknown> | null | undefined, key: string): boolean;
|
|
434
|
+
/**
|
|
435
|
+
* The `userConnections` kinds employees can connect now: a kind with `requiresSetting` only while
|
|
436
|
+
* that setting is on.
|
|
437
|
+
*/
|
|
438
|
+
export declare function availableConnectionKinds(m: Pick<AppManifest, 'capabilities' | 'settings'>, settings: Record<string, unknown> | null | undefined): string[];
|
|
439
|
+
export declare function declaredHosts(m: Pick<AppManifest, 'capabilities'>): Set<string>;
|
|
440
|
+
/**
|
|
441
|
+
* A link an app returns, as Kennra may show it: https, without credentials, and on the app's
|
|
442
|
+
* declared hosts when the manifest declares any. Anything else is `null` (the link is dropped).
|
|
443
|
+
*/
|
|
444
|
+
export declare function appLink(raw: unknown, m: Pick<AppManifest, 'capabilities'>): string | null;
|
|
445
|
+
/**
|
|
446
|
+
* The tokens a link template may use (docs/24 §3, docs/15 §4.6), per Kind. Every value is
|
|
447
|
+
* percent-encoded into the URL, and a token without a value on a record drops the link there.
|
|
448
|
+
* - `{id}`: Kennra's id of the record (every Kind).
|
|
449
|
+
* - `{settings.<key>}`: a non-secret setting of the installation (every Kind).
|
|
450
|
+
* - `{identifier:<issuer>/<scheme>}`: the app's own external identifier for the person or company,
|
|
451
|
+
* in a scheme it declares under `identifiers` with `piiClass: none` (Person, Organization).
|
|
452
|
+
* - `{orgNumber:<country>}`: the company's organization number in that country, e.g.
|
|
453
|
+
* `{orgNumber:NO}` (Organization).
|
|
454
|
+
* - `{sourceId}`: the record's id in the app's own system, for facts and interactions the app is
|
|
455
|
+
* the source of (CommerceFact, Interaction).
|
|
456
|
+
* - `{instance}`: the source system's own space from the fact's URN, e.g. a tenant (CommerceFact).
|
|
457
|
+
*/
|
|
458
|
+
export type LinkToken = {
|
|
459
|
+
type: 'id';
|
|
460
|
+
} | {
|
|
461
|
+
type: 'setting';
|
|
462
|
+
key: string;
|
|
463
|
+
} | {
|
|
464
|
+
type: 'identifier';
|
|
465
|
+
issuer: string;
|
|
466
|
+
scheme: string;
|
|
467
|
+
} | {
|
|
468
|
+
type: 'orgNumber';
|
|
469
|
+
country: string;
|
|
470
|
+
} | {
|
|
471
|
+
type: 'sourceId';
|
|
472
|
+
} | {
|
|
473
|
+
type: 'instance';
|
|
474
|
+
};
|
|
475
|
+
/** One token of a link template (the text between braces), or null when Kennra doesn't know it. */
|
|
476
|
+
export declare function parseLinkToken(raw: string): LinkToken | null;
|
|
477
|
+
/** Every token of a template, in order; `token` is null for one Kennra doesn't know. */
|
|
478
|
+
export declare function linkTokens(url: string): {
|
|
479
|
+
raw: string;
|
|
480
|
+
token: LinkToken | null;
|
|
481
|
+
}[];
|
|
482
|
+
/**
|
|
483
|
+
* Expands a link template with the values `tokenValue` gives (percent-encoded), and returns the
|
|
484
|
+
* URL as Kennra may show it (`appLink`: https, on the app's declared hosts, on the template's own
|
|
485
|
+
* literal host). `null` when a token is unknown or has no value, or the result may not be shown.
|
|
486
|
+
*/
|
|
487
|
+
export declare function expandLink(template: string, tokenValue: (token: LinkToken) => string | null | undefined, m: Pick<AppManifest, 'capabilities'>): string | null;
|
|
488
|
+
/** The `(scope, purpose)` pairs a manifest asks for. */
|
|
489
|
+
export declare function requestedGrant(m: AppManifest): {
|
|
490
|
+
scope: string;
|
|
491
|
+
purposes: string[];
|
|
492
|
+
}[];
|
|
493
|
+
/** Whether a ref matches a glob pattern (`*` matches anything except nothing). */
|
|
494
|
+
export declare function refMatches(pattern: string, ref: string): boolean;
|
|
495
|
+
export {};
|