@kennra/app-sdk 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/addresses.d.ts +12 -0
- package/dist/addresses.js +105 -0
- package/dist/admin-links.d.ts +17 -0
- package/dist/admin-links.js +22 -0
- package/dist/app.d.ts +1 -1
- package/dist/app.js +1 -1
- package/dist/capture-backfill.d.ts +95 -0
- package/dist/capture-backfill.js +198 -0
- package/dist/capture.d.ts +110 -0
- package/dist/capture.js +321 -0
- package/dist/client.d.ts +14 -3
- package/dist/client.js +41 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/manifest.d.ts +127 -4
- package/dist/manifest.js +152 -11
- package/dist/protocol.d.ts +334 -24
- package/dist/signature.d.ts +8 -0
- package/package.json +17 -1
package/dist/protocol.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type Lane = 'live' | 'import';
|
|
|
7
7
|
export interface TokenRequest {
|
|
8
8
|
/**
|
|
9
9
|
* `client_credentials`: the installation acts as itself. Token exchange (RFC 8693): the app acts
|
|
10
|
-
* for the
|
|
10
|
+
* for the member whose Kennra token is `subject_token` (manifest `access.actsForMembers`), or,
|
|
11
11
|
* for a private app with delegation, for the member named in `requested_subject`.
|
|
12
12
|
*/
|
|
13
13
|
grant_type: 'client_credentials' | 'urn:ietf:params:oauth:grant-type:token-exchange';
|
|
@@ -50,7 +50,7 @@ export interface InstallationInfo {
|
|
|
50
50
|
status: 'active' | 'paused' | 'suspended' | 'uninstalled';
|
|
51
51
|
settings: Record<string, unknown>;
|
|
52
52
|
/**
|
|
53
|
-
* The app's secrets (e.g. an API key,
|
|
53
|
+
* The app's secrets (e.g. an API key, members' refresh tokens). Only when asked for
|
|
54
54
|
* (`GET /apps/installation?include=secrets`); empty otherwise.
|
|
55
55
|
*/
|
|
56
56
|
secrets: Record<string, string>;
|
|
@@ -113,10 +113,18 @@ export type IngestItem = {
|
|
|
113
113
|
familyName?: string;
|
|
114
114
|
legalName?: string;
|
|
115
115
|
createIfMissing?: boolean;
|
|
116
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* A person who is a contact at a company (role, default `user`): the company with this
|
|
118
|
+
* identifier, or the company that has this business domain (e.g. the part after `@` of
|
|
119
|
+
* the person's address). Consumer mail domains and unknown domains attach nothing; no
|
|
120
|
+
* company is created.
|
|
121
|
+
*/
|
|
117
122
|
memberOf?: {
|
|
118
123
|
identifier: IdentifierInput;
|
|
119
124
|
role?: string;
|
|
125
|
+
} | {
|
|
126
|
+
domain: string;
|
|
127
|
+
role?: string;
|
|
120
128
|
};
|
|
121
129
|
};
|
|
122
130
|
} | {
|
|
@@ -191,7 +199,49 @@ export type ConsentChangeInput = PersonRef & {
|
|
|
191
199
|
occurredAt: string;
|
|
192
200
|
/** For `granted`: the notice the person accepted (`notice:<name>@v<n>`); default `notice:app-<appId>@v1`. */
|
|
193
201
|
noticeRef?: string;
|
|
202
|
+
/**
|
|
203
|
+
* A change from before Kennra knew the person (decision 21 November 2026, docs/15 §4.10): a
|
|
204
|
+
* list moved from another sending tool. `occurredAt` may then be older than 30 days.
|
|
205
|
+
* - a historical `granted` needs `kennra:consent:import` for the purpose (else `SCOPE_REQUIRED`)
|
|
206
|
+
* and `evidence` (else `EVIDENCE_REQUIRED`), and is refused when Kennra has a newer
|
|
207
|
+
* withdrawal for the purpose and channel (`NEWER_WITHDRAWAL_WINS`);
|
|
208
|
+
* - a historical `withdrawn` or `suppressed` only narrows, so it needs no more than
|
|
209
|
+
* `kennra:consent:write`.
|
|
210
|
+
* Idempotent per person, purpose, channel and `externalRef` (send the provider's own record id).
|
|
211
|
+
*/
|
|
212
|
+
historical?: boolean;
|
|
213
|
+
/** The proof of a historical opt-in. Required for a historical `granted`. */
|
|
214
|
+
evidence?: ConsentEvidence;
|
|
194
215
|
};
|
|
216
|
+
/**
|
|
217
|
+
* The proof of an opt-in that happened in another tool (decision 21 November 2026). `provider` and
|
|
218
|
+
* at least one of `ipAddress`, `source` / `form` / `url`, `confirmedAt` or `providerRecordId`.
|
|
219
|
+
* `occurredAt` on the change is the opt-in time (for double opt-in, the confirmation). Kennra keeps
|
|
220
|
+
* the evidence with the consent event: IP addresses encrypted with the person's key (gone when
|
|
221
|
+
* the person is erased), a URL without its query string, and returns it in a data subject export.
|
|
222
|
+
*/
|
|
223
|
+
export interface ConsentEvidence {
|
|
224
|
+
/** The tool the opt-in happened in, as a display name (e.g. the sending tool's name). */
|
|
225
|
+
provider: string;
|
|
226
|
+
/** The provider's own id of the subscriber or opt-in record. */
|
|
227
|
+
providerRecordId?: string;
|
|
228
|
+
/** The IP address the opt-in came from. */
|
|
229
|
+
ipAddress?: string;
|
|
230
|
+
/** How the person signed up in the provider (e.g. `form`, `api`, `import`, `checkout`). */
|
|
231
|
+
source?: string;
|
|
232
|
+
/** The name of the signup form. */
|
|
233
|
+
form?: string;
|
|
234
|
+
/** The page the signup form was on (stored without query string or fragment). */
|
|
235
|
+
url?: string;
|
|
236
|
+
/** When the person submitted the signup (before a double opt-in confirmation). */
|
|
237
|
+
signupAt?: string;
|
|
238
|
+
/** The IP address of the signup, when it differs from the opt-in. */
|
|
239
|
+
signupIpAddress?: string;
|
|
240
|
+
/** When the person confirmed a double opt-in. */
|
|
241
|
+
confirmedAt?: string;
|
|
242
|
+
/** The text or version of the consent the person accepted in the provider, if known. */
|
|
243
|
+
consentText?: string;
|
|
244
|
+
}
|
|
195
245
|
/** One of `ENGAGEMENT_SIGNALS` (manifest.ts). */
|
|
196
246
|
export type EngagementSignal = 'delivered' | 'opened' | 'clicked' | 'bounced' | 'complained' | 'unsubscribed';
|
|
197
247
|
/**
|
|
@@ -215,13 +265,13 @@ export type EngagementSignalInput = PersonRef & {
|
|
|
215
265
|
};
|
|
216
266
|
/**
|
|
217
267
|
* A captured meeting or message in source-neutral form. The core decides what is stored
|
|
218
|
-
* (docs/15 §9.3): the
|
|
268
|
+
* (docs/15 §9.3): the member must have connected, private and internal items are skipped,
|
|
219
269
|
* only items with known external people or companies are kept, the text is summarized and dropped.
|
|
220
270
|
*/
|
|
221
271
|
export interface CaptureInput {
|
|
222
|
-
/** The
|
|
272
|
+
/** The member whose calendar or mailbox it came from (their Kennra user id). */
|
|
223
273
|
userId: string;
|
|
224
|
-
/** The
|
|
274
|
+
/** The member's connection in this installation (as reported with reportUserConnection). */
|
|
225
275
|
connectionKey: string;
|
|
226
276
|
sourceRef: string;
|
|
227
277
|
sourceVersion: number;
|
|
@@ -255,9 +305,18 @@ export interface CaptureInput {
|
|
|
255
305
|
* The source's own id of the message or event, the same in every mailbox or calendar that has a
|
|
256
306
|
* copy (an email's RFC 822 `Message-ID`, a calendar event's iCalendar UID). Metadata, never
|
|
257
307
|
* content. The core summarizes one message once: a copy with the same id and text reuses the
|
|
258
|
-
* summary and costs no AI credit.
|
|
308
|
+
* summary and costs no AI credit. For a meeting it is also stored as the meeting's calendar
|
|
309
|
+
* identity: a meeting-notes source finds the meeting by it (`MeetingNotesCapture.match`).
|
|
259
310
|
*/
|
|
260
311
|
contentId?: string;
|
|
312
|
+
/**
|
|
313
|
+
* Captured by a meeting-notes or recording source because no calendar had the meeting (needs
|
|
314
|
+
* `contentId` to merge). A later capture of the same meeting from a calendar (same member,
|
|
315
|
+
* `contentId` and start within 30 minutes) takes the interaction over, notes included, instead
|
|
316
|
+
* of making a second one; a provisional capture of a meeting a calendar already has is
|
|
317
|
+
* `duplicate`.
|
|
318
|
+
*/
|
|
319
|
+
provisional?: boolean;
|
|
261
320
|
}
|
|
262
321
|
/** One spoken turn of a meeting transcript, as the source recorded it. */
|
|
263
322
|
export interface TranscriptTurn {
|
|
@@ -269,25 +328,72 @@ export interface TranscriptTurn {
|
|
|
269
328
|
startsAt?: string;
|
|
270
329
|
}
|
|
271
330
|
/**
|
|
272
|
-
*
|
|
273
|
-
* captured with
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
|
|
279
|
-
|
|
331
|
+
* How a meeting-notes source finds the meeting when it does not know the `sourceRef` it was
|
|
332
|
+
* captured with (another app's calendar captured it). The core looks only at the member's own
|
|
333
|
+
* meetings: first by calendar identity (`contentIds`, as a calendar capture sends `contentId`)
|
|
334
|
+
* starting within 30 minutes of `startsAt`, then, for meetings captured without one, by a start
|
|
335
|
+
* within 30 minutes and at least one of `attendeeEmails` among the meeting's known people. Two
|
|
336
|
+
* candidates are `ambiguous` and skipped; none is `no_match`.
|
|
337
|
+
*/
|
|
338
|
+
export interface MeetingMatch {
|
|
339
|
+
/** The meeting's calendar identity in the forms the source knows (`ical:<uid>`), at most 5. */
|
|
340
|
+
contentIds?: string[];
|
|
341
|
+
startsAt: string;
|
|
342
|
+
/** The attendees' emails (both sides), at most 200. */
|
|
343
|
+
attendeeEmails?: string[];
|
|
344
|
+
}
|
|
345
|
+
/** A next step in a source's own meeting notes. */
|
|
346
|
+
export interface ProviderNextStep {
|
|
347
|
+
text: string;
|
|
348
|
+
/** Whose step: `us`, `customer` or `unknown`. Ignored when `ownerEmail` is given. */
|
|
349
|
+
owner?: 'us' | 'customer' | 'unknown';
|
|
350
|
+
/**
|
|
351
|
+
* The email of the person the source assigned the step to: the core decides the side (ours when
|
|
352
|
+
* it is a member's address or on the workspace's own domains, else the customer's).
|
|
353
|
+
*/
|
|
354
|
+
ownerEmail?: string;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* The source's own meeting notes (`MeetingNotesCapture.notes`): the core writes them as they are,
|
|
358
|
+
* masked and capped, instead of summarizing a transcript. No AI credit is used, and no transcript
|
|
359
|
+
* reaches Kennra.
|
|
360
|
+
*/
|
|
361
|
+
export interface ProviderMeetingNotes {
|
|
362
|
+
/** At most 2,000 characters are kept. */
|
|
363
|
+
summary: string;
|
|
364
|
+
/** At most 10, 300 characters each. */
|
|
365
|
+
decisions?: string[];
|
|
366
|
+
/** At most 20 are read, 300 characters each; our side's (at most 5) become task suggestions. */
|
|
367
|
+
nextSteps?: ProviderNextStep[];
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* `captureMeetingNotes`: the notes of a meeting that ended, for a meeting Kennra captured. The app
|
|
371
|
+
* names the meeting with `interactionSourceRef` (when it captured it itself) or `match` (when
|
|
372
|
+
* another app's calendar did). The core decides: the member must have connected their transcripts
|
|
373
|
+
* (`userId` + `connectionKey`), the meeting must be a captured, not cancelled interaction they own,
|
|
374
|
+
* and its title must have none of the workspace's opt-out keywords. With `turns`, it summarizes the
|
|
375
|
+
* transcript with its own LLM gateway (one AI credit); with `notes`, it takes the source's own
|
|
376
|
+
* summary and next steps (no credit). Either way it writes one note marked aiGenerated on the
|
|
377
|
+
* interaction and its companies, people and deals, and suggests a task per next step on our side
|
|
378
|
+
* (never accepted on its own). One note per meeting: the first source wins, later ones are
|
|
379
|
+
* `unchanged`. The transcript is never stored; `transcriptUrl` (a link to it in the source) is.
|
|
280
380
|
*/
|
|
281
381
|
export interface MeetingNotesCapture {
|
|
282
382
|
userId: string;
|
|
283
|
-
/** The
|
|
383
|
+
/** The member's transcripts connection in this installation (reportUserConnection). */
|
|
284
384
|
connectionKey: string;
|
|
285
|
-
/** The `sourceRef` the meeting was captured with (`captureInteraction`). */
|
|
286
|
-
interactionSourceRef
|
|
385
|
+
/** The `sourceRef` the meeting was captured with (`captureInteraction`). Or give `match`. */
|
|
386
|
+
interactionSourceRef?: string;
|
|
387
|
+
/** Finds the meeting another app captured. Used when `interactionSourceRef` is absent. */
|
|
388
|
+
match?: MeetingMatch;
|
|
287
389
|
/** The source's own id of this recording or transcript (idempotency and the source trail). */
|
|
288
390
|
sourceRef: string;
|
|
391
|
+
/** The meeting's title in the source: checked for opt-out keywords too. */
|
|
392
|
+
title?: string;
|
|
289
393
|
/** The turns, in order. Summarized and dropped, never stored. At most 2,000 turns. */
|
|
290
|
-
turns
|
|
394
|
+
turns?: TranscriptTurn[];
|
|
395
|
+
/** The source's own notes instead of turns (no AI credit). */
|
|
396
|
+
notes?: ProviderMeetingNotes;
|
|
291
397
|
/** Where people with access read the transcript in the source. Stored and shown as a link. */
|
|
292
398
|
transcriptUrl?: string;
|
|
293
399
|
/** The transcript's language (BCP 47), when the source says. */
|
|
@@ -380,8 +486,15 @@ export interface CaptureBackfillRequest {
|
|
|
380
486
|
*/
|
|
381
487
|
export interface CaptureBackfillReport {
|
|
382
488
|
backfillId: string;
|
|
383
|
-
|
|
489
|
+
/**
|
|
490
|
+
* `running`: the app is working on it. `partial`: the app did what it could for now and the rest
|
|
491
|
+
* waits for the provider (say which in `waiting`); it goes on by itself on later runs, so Kennra
|
|
492
|
+
* keeps serving the request. `done` and `failed` are final.
|
|
493
|
+
*/
|
|
494
|
+
status: 'running' | 'partial' | 'done' | 'failed';
|
|
384
495
|
counters?: Record<string, number>;
|
|
496
|
+
/** What is still waiting for the provider (a rate limit): meetings, emails or both. */
|
|
497
|
+
waiting?: ('meetings' | 'emails')[];
|
|
385
498
|
/** How far back the app looks (ISO time). */
|
|
386
499
|
since?: string;
|
|
387
500
|
error?: string;
|
|
@@ -420,6 +533,13 @@ export interface UserConnectionReport {
|
|
|
420
533
|
status: 'connected' | 'revoked' | 'error';
|
|
421
534
|
shareLevel?: 'private' | 'metadata' | 'summary' | 'full';
|
|
422
535
|
error?: string;
|
|
536
|
+
/**
|
|
537
|
+
* The member's profile photo at the provider (for example the `picture` claim of the ID token
|
|
538
|
+
* the connection already returned; never a new scope for it). https on a host in the app's
|
|
539
|
+
* `capabilities.ui.domains`: Kennra fetches it once with the image proxy's rules, keeps a scaled
|
|
540
|
+
* copy and shows it as the member's avatar. Ignored unless `status` is `connected`.
|
|
541
|
+
*/
|
|
542
|
+
photoUrl?: string;
|
|
423
543
|
}
|
|
424
544
|
/**
|
|
425
545
|
* `POST /apps/installation/setup`: the app finished its own setup flow (`capabilities.setup`)
|
|
@@ -438,7 +558,7 @@ export interface SetupReport {
|
|
|
438
558
|
settings?: Record<string, unknown>;
|
|
439
559
|
}
|
|
440
560
|
/**
|
|
441
|
-
*
|
|
561
|
+
* A member disconnected in Kennra (`userConnections[].disconnectUrl`): revoke the token at the
|
|
442
562
|
* provider and delete it. The core has already stopped capture for the connection.
|
|
443
563
|
*/
|
|
444
564
|
export interface DisconnectRequest {
|
|
@@ -448,7 +568,7 @@ export interface DisconnectRequest {
|
|
|
448
568
|
userId: string;
|
|
449
569
|
connectionKey: string;
|
|
450
570
|
kind: string;
|
|
451
|
-
/** Why: the
|
|
571
|
+
/** Why: the member disconnected (default), or the app is being uninstalled (revoke everything). */
|
|
452
572
|
reason?: 'user' | 'app_uninstalled';
|
|
453
573
|
}
|
|
454
574
|
export interface LifecycleEvent {
|
|
@@ -482,7 +602,7 @@ export interface LookupRequest {
|
|
|
482
602
|
type: string;
|
|
483
603
|
pseudonym: string;
|
|
484
604
|
};
|
|
485
|
-
/** Delegated lookups: the
|
|
605
|
+
/** Delegated lookups: the member's connection the app answers with. */
|
|
486
606
|
onBehalfOf?: {
|
|
487
607
|
userId: string;
|
|
488
608
|
connectionKey: string;
|
|
@@ -717,12 +837,112 @@ export interface SubscriptionDetails {
|
|
|
717
837
|
/** The contract in the app's own UI ("Open in <app>"): https, on the manifest's declared hosts. */
|
|
718
838
|
url?: string | null;
|
|
719
839
|
}
|
|
840
|
+
/**
|
|
841
|
+
* `invoice.details` (decision 21 November 2026): what an accounting app answers about an invoice
|
|
842
|
+
* now. Nothing of it is stored. `pdfUrl` is a short-lived link the app serves itself (https on the
|
|
843
|
+
* manifest's declared hosts); `url` is the invoice in the app's own UI, when there is one.
|
|
844
|
+
*/
|
|
845
|
+
export interface InvoiceDetails {
|
|
846
|
+
lines: {
|
|
847
|
+
description: string | null;
|
|
848
|
+
sku: string | null;
|
|
849
|
+
quantity: number | null;
|
|
850
|
+
unitPrice: Money | null;
|
|
851
|
+
/** Percent, e.g. 25. */
|
|
852
|
+
vatRate?: number | null;
|
|
853
|
+
net: Money | null;
|
|
854
|
+
}[];
|
|
855
|
+
payments: {
|
|
856
|
+
date: string;
|
|
857
|
+
amount: Money;
|
|
858
|
+
method: string | null;
|
|
859
|
+
}[];
|
|
860
|
+
reminders: {
|
|
861
|
+
date: string;
|
|
862
|
+
kind: 'soft_reminder' | 'reminder' | 'notice_of_debt_collection' | 'debt_collection' | 'other';
|
|
863
|
+
fee?: Money | null;
|
|
864
|
+
}[];
|
|
865
|
+
/** The payment reference (KID in Norway), when the invoice has one. */
|
|
866
|
+
kid?: string | null;
|
|
867
|
+
pdfUrl?: string | null;
|
|
868
|
+
url?: string | null;
|
|
869
|
+
}
|
|
870
|
+
/**
|
|
871
|
+
* `interaction.details`: what the source shows of a captured meeting or email now, read with the
|
|
872
|
+
* owner's own connection (delegated) and never stored. For an email, `description` is the body as
|
|
873
|
+
* plain text; Kennra renders it as text, never as HTML.
|
|
874
|
+
*/
|
|
720
875
|
export interface InteractionDetails {
|
|
876
|
+
/** A meeting's description or agenda; an email's body as plain text. */
|
|
721
877
|
description: string | null;
|
|
722
878
|
location: string | null;
|
|
723
879
|
conferenceUrl: string | null;
|
|
880
|
+
/** Deprecated: use `url`. */
|
|
724
881
|
htmlLink: string | null;
|
|
725
882
|
attendeeCount: number;
|
|
883
|
+
/** The meeting or message in the app's own UI ("Open in <app>"): https, on the manifest's declared hosts. */
|
|
884
|
+
url?: string | null;
|
|
885
|
+
/** An email's attachments: names and sizes only, never their content. */
|
|
886
|
+
attachments?: {
|
|
887
|
+
name: string;
|
|
888
|
+
size: number | null;
|
|
889
|
+
mimeType: string | null;
|
|
890
|
+
}[];
|
|
891
|
+
/** A meeting's attendees as the calendar has them now, with their responses. */
|
|
892
|
+
attendees?: {
|
|
893
|
+
name: string | null;
|
|
894
|
+
email: string | null;
|
|
895
|
+
responseStatus: 'accepted' | 'declined' | 'tentative' | 'needsAction' | null;
|
|
896
|
+
organizer?: boolean;
|
|
897
|
+
}[];
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* `document.details` (docs/15 §4.13): a document in the app's file store, live. `url` opens it in
|
|
901
|
+
* the app (https on the app's `ui.domains`); `thumbnailUrl` is an image Kennra shows through its
|
|
902
|
+
* media proxy (https on `ui.domains`) or a `data:image/…` URL; `downloadUrl` like `url`.
|
|
903
|
+
*/
|
|
904
|
+
export interface DocumentDetails {
|
|
905
|
+
title: string;
|
|
906
|
+
mimeType?: string | null;
|
|
907
|
+
sizeBytes?: number | null;
|
|
908
|
+
modifiedAt?: string | null;
|
|
909
|
+
owner?: string | null;
|
|
910
|
+
url?: string | null;
|
|
911
|
+
thumbnailUrl?: string | null;
|
|
912
|
+
downloadUrl?: string | null;
|
|
913
|
+
}
|
|
914
|
+
/** One file a member picked, as the app links it (`POST /apps/documents/link`). */
|
|
915
|
+
export interface PickedDocument {
|
|
916
|
+
/** The file's id in the app (stable). */
|
|
917
|
+
externalId: string;
|
|
918
|
+
title: string;
|
|
919
|
+
/** The ref the app's `document.details` lookup answers. */
|
|
920
|
+
lookupRef?: string;
|
|
921
|
+
url?: string;
|
|
922
|
+
mimeType?: string;
|
|
923
|
+
sizeBytes?: number;
|
|
924
|
+
modifiedAt?: string;
|
|
925
|
+
owner?: string;
|
|
926
|
+
kind?: 'contract' | 'proposal' | 'other';
|
|
927
|
+
/** The member's connection in the app the file was picked with (delegated lookups use it). */
|
|
928
|
+
connectionKey?: string;
|
|
929
|
+
/** The document's text, in transit only: Kennra reads suggested contract terms and drops it. */
|
|
930
|
+
transientText?: string;
|
|
931
|
+
}
|
|
932
|
+
/** `POST /apps/documents/link`: what a member picked on the app's picker page (signed ticket). */
|
|
933
|
+
export interface DocumentLinkRequest {
|
|
934
|
+
ticket: string;
|
|
935
|
+
documents: PickedDocument[];
|
|
936
|
+
}
|
|
937
|
+
export interface DocumentLinkResult {
|
|
938
|
+
documents: {
|
|
939
|
+
externalId: string;
|
|
940
|
+
documentId: string | null;
|
|
941
|
+
ok: boolean;
|
|
942
|
+
error?: string;
|
|
943
|
+
}[];
|
|
944
|
+
/** Where to send the member back in Kennra (the record), when the ticket named it. */
|
|
945
|
+
returnTo?: string;
|
|
726
946
|
}
|
|
727
947
|
/**
|
|
728
948
|
* `organization.search`: companies in a public register that match what a person typed (a name
|
|
@@ -749,6 +969,65 @@ export interface OrganizationSearchHit {
|
|
|
749
969
|
/** `active`, or why the company no longer trades normally. */
|
|
750
970
|
status: 'active' | 'bankrupt' | 'liquidation' | 'deleted';
|
|
751
971
|
}
|
|
972
|
+
/**
|
|
973
|
+
* A filter value of a field's scope: one value or several (any of them matches). The keys are the
|
|
974
|
+
* filters the object type declares (`capabilities.objects[].scope`), e.g. `{ folder: '/machines' }`.
|
|
975
|
+
*/
|
|
976
|
+
export type ExternalObjectScope = Record<string, string | string[]>;
|
|
977
|
+
/**
|
|
978
|
+
* `object.search` (the picker of an `external` field): `LookupRequest.query` is
|
|
979
|
+
* `{ type, text, scope, limit }` and `ref` is `<type>:<text>` with the scope, for the cache. The
|
|
980
|
+
* answer is at most `limit` (≤ 20) objects inside the scope, best match first. An empty `text`
|
|
981
|
+
* asks for the first objects in the scope.
|
|
982
|
+
*/
|
|
983
|
+
export interface ExternalObjectSearchQuery {
|
|
984
|
+
type: string;
|
|
985
|
+
text: string;
|
|
986
|
+
scope: ExternalObjectScope;
|
|
987
|
+
limit: number;
|
|
988
|
+
}
|
|
989
|
+
export interface ExternalObjectSearchResult {
|
|
990
|
+
results: ExternalObject[];
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* `object.resolve` (live data, writes and refresh): `query` is `{ type, ids }` (at most 50 ids)
|
|
994
|
+
* and `ref` is `<type>:<ids, sorted, comma separated>`. The answer has the objects that exist; an
|
|
995
|
+
* id that is not in `objects` no longer exists at the source (Kennra shows "no longer exists" and
|
|
996
|
+
* keeps the value).
|
|
997
|
+
*/
|
|
998
|
+
export interface ExternalObjectResolveQuery {
|
|
999
|
+
type: string;
|
|
1000
|
+
ids: string[];
|
|
1001
|
+
}
|
|
1002
|
+
export interface ExternalObjectResolveResult {
|
|
1003
|
+
objects: ExternalObject[];
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* An object in the app's system: the envelope every object has (`id`, `title`, and optionally
|
|
1007
|
+
* `subtitle`, `imageUrl`, `url`), the typed fields its type declares (`fields`, others are
|
|
1008
|
+
* dropped), and for live answers the objects it is made of (`related`, e.g. a product's variants).
|
|
1009
|
+
* `url` must be https on the app's declared hosts; `imageUrl` too, or a `data:image/…` URL: Kennra
|
|
1010
|
+
* never hands it to a browser as is, it serves a signed short-lived link through its media proxy.
|
|
1011
|
+
* Keep the data minimal: product data, never personal data.
|
|
1012
|
+
*/
|
|
1013
|
+
export interface ExternalObject {
|
|
1014
|
+
id: string;
|
|
1015
|
+
title: string;
|
|
1016
|
+
subtitle?: string | null;
|
|
1017
|
+
imageUrl?: string | null;
|
|
1018
|
+
url?: string | null;
|
|
1019
|
+
fields?: Record<string, unknown>;
|
|
1020
|
+
related?: {
|
|
1021
|
+
type: string;
|
|
1022
|
+
items: ExternalObjectRef[];
|
|
1023
|
+
} | null;
|
|
1024
|
+
}
|
|
1025
|
+
export interface ExternalObjectRef {
|
|
1026
|
+
id: string;
|
|
1027
|
+
title: string;
|
|
1028
|
+
subtitle?: string | null;
|
|
1029
|
+
imageUrl?: string | null;
|
|
1030
|
+
}
|
|
752
1031
|
export interface MirroredFactLine {
|
|
753
1032
|
productRef?: string;
|
|
754
1033
|
sku?: string;
|
|
@@ -765,7 +1044,7 @@ export interface MirroredFactLine {
|
|
|
765
1044
|
}
|
|
766
1045
|
export interface MirroredFactSnapshot {
|
|
767
1046
|
contract: string;
|
|
768
|
-
factType: 'order' | 'quote' | 'subscription';
|
|
1047
|
+
factType: 'order' | 'quote' | 'subscription' | 'invoice';
|
|
769
1048
|
/** Must equal the app's `capabilities.ingest.sourceSystem`. */
|
|
770
1049
|
sourceSystem: string;
|
|
771
1050
|
sourceTenant: string;
|
|
@@ -816,7 +1095,38 @@ export interface MirroredFactSnapshot {
|
|
|
816
1095
|
startsAt?: string;
|
|
817
1096
|
renewAt?: string;
|
|
818
1097
|
activeUntil?: string;
|
|
1098
|
+
/**
|
|
1099
|
+
* When a cancelled contract stopped (valid time), from the best source the app has. Leave it
|
|
1100
|
+
* out when the source gives no date: Kennra then ends the contract at its last evidence of
|
|
1101
|
+
* payment, never at the time it read it.
|
|
1102
|
+
*/
|
|
819
1103
|
cancelledAt?: string;
|
|
1104
|
+
/**
|
|
1105
|
+
* How `cancelledAt` is known: `exact` (the source's cancellation date or event),
|
|
1106
|
+
* `activeUntil` (the end of the paid period), `lastRenewal` (last renewal order + one period),
|
|
1107
|
+
* `updatedAt` (the contract's last change), `unknown` (no date). Only the first two are not
|
|
1108
|
+
* estimates.
|
|
1109
|
+
*/
|
|
1110
|
+
endDateSource?: 'exact' | 'activeUntil' | 'lastRenewal' | 'updatedAt' | 'unknown';
|
|
1111
|
+
};
|
|
1112
|
+
/**
|
|
1113
|
+
* Invoices and credit notes (factType `invoice`, decision 21 November 2026). `status` is one of
|
|
1114
|
+
* draft, sent, paid, partially_paid, overdue, credited, cancelled; amounts go in `amounts`
|
|
1115
|
+
* (negative for a credit note).
|
|
1116
|
+
*/
|
|
1117
|
+
invoice?: {
|
|
1118
|
+
number: string;
|
|
1119
|
+
kind?: 'invoice' | 'credit_note';
|
|
1120
|
+
/** ISO dates (YYYY-MM-DD). */
|
|
1121
|
+
issueDate: string;
|
|
1122
|
+
dueDate?: string;
|
|
1123
|
+
/** Still to be paid, minor units of `amounts.currency`. */
|
|
1124
|
+
outstandingMinor: number;
|
|
1125
|
+
remindersSent?: number;
|
|
1126
|
+
lastReminderAt?: string;
|
|
1127
|
+
paidAt?: string;
|
|
1128
|
+
/** A credit note: the ref of the invoice it credits. */
|
|
1129
|
+
creditedInvoiceRef?: string;
|
|
820
1130
|
};
|
|
821
1131
|
}
|
|
822
1132
|
/** Kennra asks an app to erase a person (docs/16 §6.2). Signed like every call to the app. */
|
package/dist/signature.d.ts
CHANGED
|
@@ -41,6 +41,14 @@ export interface ConnectTicket {
|
|
|
41
41
|
returnTo?: string;
|
|
42
42
|
/** Setup only: also connect the admin's own account of this kind (they opted in). */
|
|
43
43
|
connect?: string;
|
|
44
|
+
/**
|
|
45
|
+
* `document_pick` tickets (docs/15 §4.13): the record the member links documents to, and the
|
|
46
|
+
* purpose they work under. The app passes the ticket back with what was picked.
|
|
47
|
+
*/
|
|
48
|
+
entityId?: string;
|
|
49
|
+
purpose?: string;
|
|
50
|
+
/** The member's connection key in the app for documents, when Kennra knows one (e.g. `drive:<address>`). */
|
|
51
|
+
connectionKey?: string;
|
|
44
52
|
/** Unique ticket id: apps accept a ticket once (single use, review M5). Added when signing. */
|
|
45
53
|
jti?: string;
|
|
46
54
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kennra/app-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Build Kennra apps: manifest types and validation, installation tokens, ingest helpers, signed lookups, schedules and webhooks, and a test harness. Web-standard Request/Response.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kennra",
|
|
@@ -65,6 +65,22 @@
|
|
|
65
65
|
"types": "./dist/hosting.d.ts",
|
|
66
66
|
"default": "./dist/hosting.js"
|
|
67
67
|
},
|
|
68
|
+
"./addresses": {
|
|
69
|
+
"types": "./dist/addresses.d.ts",
|
|
70
|
+
"default": "./dist/addresses.js"
|
|
71
|
+
},
|
|
72
|
+
"./admin-links": {
|
|
73
|
+
"types": "./dist/admin-links.d.ts",
|
|
74
|
+
"default": "./dist/admin-links.js"
|
|
75
|
+
},
|
|
76
|
+
"./capture": {
|
|
77
|
+
"types": "./dist/capture.d.ts",
|
|
78
|
+
"default": "./dist/capture.js"
|
|
79
|
+
},
|
|
80
|
+
"./capture-backfill": {
|
|
81
|
+
"types": "./dist/capture-backfill.d.ts",
|
|
82
|
+
"default": "./dist/capture-backfill.js"
|
|
83
|
+
},
|
|
68
84
|
"./package.json": "./package.json"
|
|
69
85
|
},
|
|
70
86
|
"files": [
|