@verentis/sdk 0.1.0 → 0.2.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/dist/index.d.cts CHANGED
@@ -1,18 +1,131 @@
1
+ interface HeaderAction {
2
+ id: string;
3
+ label: string;
4
+ icon?: string;
5
+ variant?: 'default' | 'outline' | 'destructive';
6
+ /** Empty for client-only actions; otherwise a subset of the delegated token scopes. */
7
+ scopes: string[];
8
+ enabled?: boolean;
9
+ visible?: boolean;
10
+ busy?: boolean;
11
+ disabledReason?: string;
12
+ /** Clipboard actions return text for the host to copy during its user gesture. */
13
+ kind?: 'clipboard';
14
+ }
15
+ interface HeaderActionResult {
16
+ clipboardText?: string;
17
+ navigate?: {
18
+ path: string;
19
+ newTab?: boolean;
20
+ };
21
+ }
22
+ interface HeaderActionRegistration {
23
+ update(action: HeaderAction): void;
24
+ dispose(): void;
25
+ }
26
+ type HeaderActionHandler = () => void | HeaderActionResult | Promise<void | HeaderActionResult>;
27
+ declare function isHeaderAction(value: unknown): value is HeaderAction;
28
+
1
29
  interface VerentisMessage {
2
30
  type: `verentis:${string}`;
3
31
  version: 1;
4
32
  requestId?: string;
5
33
  }
34
+
6
35
  interface VerentisInitMessage extends VerentisMessage {
7
36
  type: 'verentis:init';
8
37
  context: AppContext;
9
38
  token: TokenInfo;
39
+ sessionId?: string;
40
+ }
41
+ interface VerentisActionsSetMessage extends VerentisMessage {
42
+ type: 'verentis:actions:set';
43
+ sessionId: string;
44
+ actions: HeaderAction[];
45
+ }
46
+ interface VerentisActionInvokeMessage extends VerentisMessage {
47
+ type: 'verentis:action:invoke';
48
+ sessionId: string;
49
+ requestId: string;
50
+ actionId: string;
51
+ }
52
+ interface VerentisActionResultMessage extends VerentisMessage {
53
+ type: 'verentis:action:result';
54
+ sessionId: string;
55
+ requestId: string;
56
+ actionId: string;
57
+ result?: HeaderActionResult;
58
+ error?: string;
10
59
  }
11
60
  interface VerentisTokenRefreshedMessage extends VerentisMessage {
12
61
  type: 'verentis:token:refreshed';
13
62
  requestId: string;
14
63
  token: TokenInfo;
15
64
  }
65
+ /** Single-use credential for the installation's independently registered backend. */
66
+ interface AppBackendCredential {
67
+ delegationId: string;
68
+ backendClientId: string;
69
+ launchCredential: string;
70
+ expiresAt: string;
71
+ }
72
+ interface VerentisBackendCredentialRequest extends VerentisMessage {
73
+ type: 'verentis:backend:request';
74
+ requestId: string;
75
+ sessionId: string;
76
+ }
77
+ interface VerentisBackendCredentialResponse extends VerentisMessage {
78
+ type: 'verentis:backend:response';
79
+ requestId: string;
80
+ sessionId: string;
81
+ credential?: AppBackendCredential;
82
+ error?: string;
83
+ }
84
+ /** Nonsecret active-document metadata. CODE already holds its own scoped credential. */
85
+ interface WopiContinuation {
86
+ sessionId: string;
87
+ workspaceId: string;
88
+ branch: string;
89
+ nodeId: string;
90
+ accessTokenTtl: number;
91
+ fileId: string;
92
+ format: string;
93
+ readOnly: boolean;
94
+ name: string;
95
+ }
96
+ /** Initial document-scoped collaboration authority, never a platform OAuth credential. */
97
+ interface WopiLaunch extends WopiContinuation {
98
+ action: string;
99
+ accessToken: string;
100
+ editorOrigin: string;
101
+ wopiSource: string;
102
+ }
103
+ interface WopiSaveCheckpoint {
104
+ generation: number;
105
+ correlation: string;
106
+ revision?: string | null;
107
+ }
108
+ interface WopiSaveStatus {
109
+ state: string;
110
+ revision: string;
111
+ readOnly: boolean;
112
+ receipt: WopiSaveCheckpoint | null;
113
+ continuationAvailable?: boolean;
114
+ }
115
+ interface VerentisWopiRequest extends VerentisMessage {
116
+ type: 'verentis:wopi:request';
117
+ requestId: string;
118
+ sessionId: string;
119
+ operation: 'launch' | 'status' | 'save' | 'close' | 'continue';
120
+ generation?: number;
121
+ }
122
+ interface VerentisWopiResponse extends VerentisMessage {
123
+ type: 'verentis:wopi:response';
124
+ requestId: string;
125
+ sessionId: string;
126
+ result?: WopiLaunch | WopiContinuation | WopiSaveCheckpoint | WopiSaveStatus | null;
127
+ error?: string;
128
+ }
16
129
  interface VerentisFileChangedMessage extends VerentisMessage {
17
130
  type: 'verentis:file:changed';
18
131
  path: string;
@@ -50,13 +163,25 @@ interface VerentisDirtyMessage extends VerentisMessage {
50
163
  type: 'verentis:dirty';
51
164
  isDirty: boolean;
52
165
  }
53
- type HostToAppMessage = VerentisInitMessage | VerentisTokenRefreshedMessage | VerentisFileChangedMessage | VerentisThemeMessage;
54
- type AppToHostMessage = VerentisReadyMessage | VerentisTokenRefreshMessage | VerentisNavigateMessage | VerentisResizeMessage | VerentisTitleMessage | VerentisDirtyMessage;
166
+ type HostToAppMessage = VerentisInitMessage | VerentisActionInvokeMessage | VerentisTokenRefreshedMessage | VerentisFileChangedMessage | VerentisThemeMessage | VerentisBackendCredentialResponse | VerentisWopiResponse;
167
+ type AppToHostMessage = VerentisReadyMessage | VerentisActionsSetMessage | VerentisActionResultMessage | VerentisTokenRefreshMessage | VerentisNavigateMessage | VerentisResizeMessage | VerentisTitleMessage | VerentisDirtyMessage | VerentisBackendCredentialRequest | VerentisWopiRequest;
55
168
  type AppSurface = 'file' | 'workspace';
56
169
  interface AppContextBase {
170
+ application?: AppApplicationContext;
57
171
  workspace: WorkspaceInfo;
58
172
  entryPoint?: EntryPointInfo;
59
173
  apiUrl: string;
174
+ installation?: {
175
+ id: string;
176
+ backendClientId?: string;
177
+ authorizationGeneration?: string;
178
+ wopiEnabled?: boolean;
179
+ };
180
+ }
181
+ interface AppApplicationContext {
182
+ manifestPath: string;
183
+ manifestNodeId: string;
184
+ branch: string;
60
185
  }
61
186
  /** Context for an application opened against a workspace file. */
62
187
  interface FileAppContext extends AppContextBase {
@@ -89,6 +214,8 @@ interface WorkspaceInfo {
89
214
  name: string;
90
215
  }
91
216
  interface FileInfo {
217
+ nodeId?: string;
218
+ branch?: string;
92
219
  path: string;
93
220
  name: string;
94
221
  mimeType: string;
@@ -150,6 +277,33 @@ interface FileEntry {
150
277
  version?: string;
151
278
  etag?: string;
152
279
  children?: FileEntry[];
280
+ /** Stable node identity, when supplied by the path metadata API. */
281
+ nodeId?: string;
282
+ }
283
+ interface NodeFileMetadata {
284
+ nodeId: string;
285
+ path: string;
286
+ name: string;
287
+ mimeType: string;
288
+ size?: number | null;
289
+ /** Unquoted opaque content revision; distinct from a path delete head stamp. */
290
+ etag: string;
291
+ version: string;
292
+ children?: PagedResult<FileEntry>;
293
+ }
294
+ interface NodeFileOptions {
295
+ branch: string;
296
+ }
297
+ interface NodeFileContent {
298
+ content: Blob;
299
+ /** Strong quoted ETag returned by the node-content API. */
300
+ revision: string;
301
+ }
302
+ interface WriteNodeFileOptions extends NodeFileOptions {
303
+ content: Blob | string | ArrayBuffer;
304
+ /** Strong quoted revision, or the unquoted etag returned by getNode. */
305
+ revision: string;
306
+ idempotencyKey: string;
153
307
  }
154
308
  interface GetFileOptions {
155
309
  branch?: string;
@@ -171,6 +325,10 @@ interface MoveFileOptions {
171
325
  interface DeleteFileOptions {
172
326
  path: string;
173
327
  branch?: string;
328
+ /** Path-binding head stamp, not a node-content revision. */
329
+ headStamp?: string;
330
+ idempotencyKey?: string;
331
+ mode?: 'shallow' | 'deep';
174
332
  }
175
333
  type ArchiveFormat = 'zip' | 'tgz';
176
334
  interface ReadArchiveOptions {
@@ -205,6 +363,64 @@ interface InstalledPackageDescriptor {
205
363
  payloads: InstalledPackagePayload[];
206
364
  }
207
365
  type InstallationMode = 'Extracted' | 'Sealed';
366
+ /** Required dependencies use immutable exact SemVer pins; optional packages are never implicit installs. */
367
+ interface PackageDependency {
368
+ package: string;
369
+ version: string;
370
+ installPath?: string | null;
371
+ optional?: boolean;
372
+ }
373
+ interface InstallationGraphPackage {
374
+ packageId: string;
375
+ packageVersionId: string;
376
+ publisherId: string;
377
+ identity: string;
378
+ publisher: string;
379
+ version: string;
380
+ treeDigest: string;
381
+ artifactFingerprint: string;
382
+ manifestYaml: string;
383
+ verifiedSigningKeyKid?: string | null;
384
+ branch: string;
385
+ installPath: string;
386
+ installMode: InstallationMode;
387
+ reuseInstallationId?: string | null;
388
+ /** Only a previously Failed exact target can be recovered, after a fresh explicit preview. */
389
+ retryInstallationId?: string | null;
390
+ permissions: string[];
391
+ dependencies: PackageDependency[];
392
+ /** Conservative destination reservations, including external install-map/seed roots. */
393
+ installPaths: string[];
394
+ }
395
+ interface InstallationGraphPreview {
396
+ operationId: string;
397
+ workspaceId: string;
398
+ expiresAt: string;
399
+ fingerprint: string;
400
+ /** Topological installation order: required dependencies before their dependents. */
401
+ packages: InstallationGraphPackage[];
402
+ }
403
+ type InstallationGraphOutcomeStatus = 'Pending' | 'Installing' | 'Reused' | 'Installed' | 'InstalledWithError' | 'Failed' | 'NotAttempted';
404
+ interface InstallationGraphResult {
405
+ operationId: string;
406
+ status: 'Preview' | 'Accepted' | 'Completed' | 'Rejected' | 'Failed';
407
+ succeeded: boolean;
408
+ /** The exact durable preview baseline, also available after a lost preview/install response. */
409
+ packages: InstallationGraphPackage[];
410
+ outcomes: {
411
+ identity: string;
412
+ status: InstallationGraphOutcomeStatus;
413
+ installationId?: string | null;
414
+ error?: string | null;
415
+ }[];
416
+ error?: string | null;
417
+ }
418
+ interface PreviewInstallationOptions extends InstallationScopedOptions {
419
+ packageVersion?: string;
420
+ installPath?: string;
421
+ branch?: string;
422
+ installMode?: InstallationMode;
423
+ }
208
424
  type InstallationStatus = 'Pending' | 'Installing' | 'Installed' | 'Updating' | 'Uninstalling' | 'Failed' | 'Uninstalled';
209
425
  interface Installation {
210
426
  id: string;
@@ -384,6 +600,9 @@ interface ApplicationEntryPoint {
384
600
  display?: ApplicationDisplayOptions;
385
601
  }
386
602
  interface ApplicationSpec {
603
+ dependencies?: PackageDependency[];
604
+ /** Publisher-qualified required engine dependency for script-bearing packages. */
605
+ engine?: string;
387
606
  /** Optional iframe UI surface URL. Omit for a headless / file-collection app. */
388
607
  entry?: string;
389
608
  /** Optional application splash URL. Relative values resolve against the selected iframe entry URL. */
@@ -710,7 +929,8 @@ declare class ApiError extends Error {
710
929
  readonly status: number;
711
930
  readonly detail: string;
712
931
  readonly title?: string | undefined;
713
- constructor(status: number, detail: string, title?: string | undefined);
932
+ readonly code?: string | undefined;
933
+ constructor(status: number, detail: string, title?: string | undefined, code?: string | undefined);
714
934
  }
715
935
 
716
936
  /**
@@ -724,6 +944,8 @@ declare class ContextModule {
724
944
  private _file;
725
945
  private _entryPoint;
726
946
  private _apiUrl;
947
+ private _application;
948
+ private _installation;
727
949
  /** The current workspace */
728
950
  get workspace(): WorkspaceInfo;
729
951
  /** The host surface that launched the app */
@@ -738,6 +960,8 @@ declare class ContextModule {
738
960
  get entryPoint(): EntryPointInfo | null;
739
961
  /** Whether an entry point context is available */
740
962
  get hasEntryPoint(): boolean;
963
+ get application(): AppApplicationContext | null;
964
+ get installation(): AppContext['installation'] | null;
741
965
  /** Update context from the host's init message */
742
966
  setFromAppContext(ctx: AppContext): void;
743
967
  /** Set workspace info directly (standalone mode) */
@@ -760,6 +984,7 @@ declare class HttpTransport {
760
984
  constructor(baseUrl: string, auth: AuthStrategy, apiVersion?: string);
761
985
  request<T>(method: string, path: string, options?: RequestOptions): Promise<T>;
762
986
  requestRaw(method: string, path: string, options?: RequestOptions): Promise<Response>;
987
+ ensureSuccess(response: Response): Promise<void>;
763
988
  private buildUrl;
764
989
  }
765
990
 
@@ -829,6 +1054,12 @@ declare class FilesModule {
829
1054
  * For directories: returns metadata with children array populated.
830
1055
  */
831
1056
  get(path: string, options?: GetFileOptions): Promise<FileEntry>;
1057
+ /** Read metadata by stable node identity on an explicit branch. */
1058
+ getNode(nodeId: string, options: NodeFileOptions): Promise<NodeFileMetadata>;
1059
+ /** Read bytes and their matching content revision in the same response. */
1060
+ readNodeContent(nodeId: string, options: NodeFileOptions): Promise<NodeFileContent>;
1061
+ /** Replace existing node bytes conditionally; never creates or changes path/MIME. */
1062
+ writeNodeContent(nodeId: string, options: WriteNodeFileOptions): Promise<NodeFileMetadata>;
832
1063
  /**
833
1064
  * Read the raw content of a file as a Blob.
834
1065
  */
@@ -868,6 +1099,14 @@ declare class InstallationsModule {
868
1099
  private readonly http;
869
1100
  private readonly workspaceId?;
870
1101
  constructor(http: HttpTransport, workspaceId?: string | undefined);
1102
+ /** Resolve canonical publisher/package identity, never the installation's runtime display name. */
1103
+ resolvePackageId(identity: string, options?: InstallationScopedOptions): Promise<string>;
1104
+ /** Resolves the complete required graph without installing anything or granting capabilities. */
1105
+ preview(packageId: string, options?: PreviewInstallationOptions): Promise<InstallationGraphPreview>;
1106
+ /** Explicit, single-use consent to a displayed preview. Never automatically retries accepted installs. */
1107
+ install(preview: InstallationGraphPreview, consent: true): Promise<InstallationGraphResult>;
1108
+ /** Inspect durable outcomes after a failure or lost response instead of resubmitting consent. */
1109
+ graphResult(operationId: string, options?: InstallationScopedOptions): Promise<InstallationGraphResult>;
871
1110
  list(options?: InstallationListOptions): Promise<PagedResult<Installation>>;
872
1111
  resolve(installPath: string, options?: ResolveInstallationOptions): Promise<InstallationDetail>;
873
1112
  update(id: string, options?: UpdateInstallationOptions): Promise<InstallationLifecycleResult>;
@@ -937,6 +1176,259 @@ interface NamespacedSettings {
937
1176
  reset(key: string, options?: SettingsScopedOptions): Promise<void>;
938
1177
  }
939
1178
 
1179
+ interface EmailScopedOptions {
1180
+ workspaceId?: string;
1181
+ branch?: 'main';
1182
+ }
1183
+ interface EmailHistoryOptions extends EmailScopedOptions {
1184
+ recordId?: string;
1185
+ installationId?: string;
1186
+ }
1187
+ interface EmailPurpose {
1188
+ name: string;
1189
+ templateId: string;
1190
+ maximumRecipients: number;
1191
+ maximumAttachmentBytes: number;
1192
+ allowsOpenTracking: boolean;
1193
+ allowsClickTracking: boolean;
1194
+ senderRequirement: 'workspace-owned' | 'managed-or-workspace';
1195
+ }
1196
+ interface EmailSenderGrant {
1197
+ purpose: string;
1198
+ senderId: string;
1199
+ senderIdentityDigest?: string;
1200
+ }
1201
+ interface EmailConsentPreview {
1202
+ installationId: string;
1203
+ workspaceId: string;
1204
+ accountId: string;
1205
+ packageId: string;
1206
+ packageVersionId: string;
1207
+ publisherId: string;
1208
+ publisherName: string;
1209
+ version: string;
1210
+ treeDigest: string;
1211
+ signingKeyId: string;
1212
+ installPath: string;
1213
+ branch: string;
1214
+ candidateDigest: string;
1215
+ declaration: {
1216
+ purposes: EmailPurpose[];
1217
+ maximumMessagesPerHour: number;
1218
+ permissions: string[];
1219
+ scopes: string[];
1220
+ manifestDigest: string;
1221
+ };
1222
+ }
1223
+ interface EmailConsent {
1224
+ installationId: string;
1225
+ candidateDigest: string;
1226
+ enabled: boolean;
1227
+ allowOpenTracking: boolean;
1228
+ allowClickTracking: boolean;
1229
+ approvedBy: string;
1230
+ updatedAt: string;
1231
+ senderGrants: EmailSenderGrant[] | null;
1232
+ }
1233
+ interface EmailConsentOptions {
1234
+ senderGrants: EmailSenderGrant[];
1235
+ allowOpenTracking?: boolean;
1236
+ allowClickTracking?: boolean;
1237
+ }
1238
+ interface EmailSenderIdentity {
1239
+ id: string;
1240
+ mode: 'managed' | 'custom';
1241
+ displayName: string;
1242
+ address: string;
1243
+ }
1244
+ interface EmailArtifactOutcome {
1245
+ artifactId: string;
1246
+ sha256: string;
1247
+ byteLength: number;
1248
+ fileName: string;
1249
+ }
1250
+ interface EmailDispatchOptions extends EmailScopedOptions {
1251
+ installationId: string;
1252
+ recordId: string;
1253
+ purpose: string;
1254
+ templateId: string;
1255
+ senderId: string;
1256
+ recipients: string[];
1257
+ artifactIds: string[];
1258
+ idempotencyKey: string;
1259
+ replyTo?: string;
1260
+ }
1261
+ interface EmailDispatchOutcome {
1262
+ id: string;
1263
+ status: 'accepted' | 'delivered' | 'failed' | 'unknown';
1264
+ createdAt: string;
1265
+ failureCode?: string | null;
1266
+ recordId: string;
1267
+ installationId: string;
1268
+ branch: 'main';
1269
+ purpose: string;
1270
+ templateId: string;
1271
+ events: EmailDeliveryEvidence[];
1272
+ }
1273
+ interface EmailDeliveryEvidence {
1274
+ type: 'processed' | 'deferred' | 'delivered' | 'failed' | 'complaint' | 'unsubscribe' | 'open' | 'click';
1275
+ occurredAt: string;
1276
+ }
1277
+
1278
+ /** Signed-package transactional email. Dispatch never accepts HTML, From or a browser invoice snapshot. */
1279
+ declare class EmailModule {
1280
+ private readonly http;
1281
+ private readonly workspaceId?;
1282
+ constructor(http: HttpTransport, workspaceId?: string | undefined);
1283
+ preview(installationId: string, options?: EmailScopedOptions): Promise<EmailConsentPreview>;
1284
+ consents(options?: EmailScopedOptions): Promise<EmailConsent[]>;
1285
+ /** Approve exactly the reviewed signed candidate; tracking stays off unless explicitly opted in. */
1286
+ consent(preview: EmailConsentPreview, approval: true, options: EmailConsentOptions): Promise<EmailConsent>;
1287
+ revoke(consent: EmailConsent, options?: EmailScopedOptions): Promise<EmailConsent>;
1288
+ senders(options?: EmailScopedOptions): Promise<EmailSenderIdentity[]>;
1289
+ invoicePdf(recordId: string, installationId: string, options?: EmailScopedOptions): Promise<EmailArtifactOutcome>;
1290
+ /** Authenticated immutable bytes; no public URL. The caller owns any local object URL it creates. */
1291
+ artifactContent(artifactId: string, options?: EmailScopedOptions): Promise<Blob>;
1292
+ /** A stable key binds this exact request. After a lost response inspect status; never automatically resend. */
1293
+ dispatch(options: EmailDispatchOptions): Promise<EmailDispatchOutcome>;
1294
+ outcome(id: string, options?: EmailScopedOptions): Promise<EmailDispatchOutcome>;
1295
+ history(options?: EmailHistoryOptions): Promise<EmailDispatchOutcome[]>;
1296
+ status(id: string, options?: EmailScopedOptions): Promise<EmailDispatchOutcome>;
1297
+ private workspace;
1298
+ private mainBranch;
1299
+ }
1300
+
1301
+ type BusinessOperation = 'save-record' | 'archive-record' | 'delete-record' | 'restore-record' | 'close-period' | 'issue-invoice' | 'credit-invoice' | 'post-payment' | 'reverse-payment' | 'post-journal' | 'reverse-journal' | 'post-expense' | 'reverse-expense';
1302
+ interface BusinessParameters {
1303
+ periodId?: string;
1304
+ receivableAccountId?: string;
1305
+ incomeAccountId?: string;
1306
+ taxAccountId?: string;
1307
+ date?: string;
1308
+ reason?: string;
1309
+ }
1310
+ interface BusinessCommand {
1311
+ operation: BusinessOperation;
1312
+ idempotencyKey: string;
1313
+ /** Omit only when creating; the server derives a stable ID from this operation key. */
1314
+ recordId?: string;
1315
+ /** Canonical kind, e.g. crm/company. Required for metadata-free creation. */
1316
+ kind?: string;
1317
+ expectedCatalogueRevision?: string;
1318
+ /** Exact strong, quoted canonical revision; omit only for a new record. */
1319
+ expectedRevision?: string;
1320
+ record?: Record<string, unknown>;
1321
+ parameters?: BusinessParameters;
1322
+ }
1323
+ interface BusinessSnapshot {
1324
+ id: string;
1325
+ kind: string;
1326
+ json: string;
1327
+ revision: string;
1328
+ }
1329
+ interface BusinessContext {
1330
+ workspaceId: string;
1331
+ branch: string;
1332
+ catalogueRevision: string | null;
1333
+ settings: BusinessSnapshot[];
1334
+ }
1335
+ interface BusinessCommitResult {
1336
+ operationId: string;
1337
+ committedAt: string;
1338
+ records: BusinessSnapshot[];
1339
+ }
1340
+ interface BusinessOutcomeRequest {
1341
+ operation: BusinessOperation;
1342
+ idempotencyKey: string;
1343
+ requestHash?: string;
1344
+ command?: BusinessCommand;
1345
+ }
1346
+ type BusinessReportName = 'trial-balance' | 'general-ledger' | 'profit-and-loss' | 'balance-sheet' | 'receivables';
1347
+ interface BusinessReportLine {
1348
+ accountId: string;
1349
+ code: string;
1350
+ name: string;
1351
+ accountType: 'asset' | 'liability' | 'equity' | 'income' | 'expense';
1352
+ debitMinor: string;
1353
+ creditMinor: string;
1354
+ balanceMinor: string;
1355
+ }
1356
+ interface BusinessReport {
1357
+ report: BusinessReportName;
1358
+ from: string | null;
1359
+ to: string | null;
1360
+ lines: BusinessReportLine[];
1361
+ entries: BusinessLedgerEntry[];
1362
+ /** Coherent catalogue revision and overdue evaluation date for receivables. */
1363
+ revision?: string;
1364
+ asOf?: string;
1365
+ currency?: string;
1366
+ minorDigits?: number;
1367
+ receivables?: BusinessReceivable[];
1368
+ totals?: BusinessReceivableTotals;
1369
+ }
1370
+ interface BusinessReceivable {
1371
+ invoiceId: string;
1372
+ revision: string;
1373
+ invoiceNumber: string;
1374
+ issueDate: string;
1375
+ dueDate: string;
1376
+ currency: string;
1377
+ minorDigits: number;
1378
+ customer: Record<string, unknown>;
1379
+ customerReference?: Record<string, unknown>;
1380
+ grossAmountMinor: string;
1381
+ creditedAmountMinor: string;
1382
+ paidAmountMinor: string;
1383
+ outstandingAmountMinor: string;
1384
+ overdueAmountMinor: string;
1385
+ isOverdue: boolean;
1386
+ daysOverdue: number;
1387
+ }
1388
+ interface BusinessReceivableTotals {
1389
+ grossAmountMinor: string;
1390
+ creditedAmountMinor: string;
1391
+ paidAmountMinor: string;
1392
+ outstandingAmountMinor: string;
1393
+ overdueAmountMinor: string;
1394
+ }
1395
+ interface BusinessLedgerEntry {
1396
+ journalId: string;
1397
+ date: string;
1398
+ description: string;
1399
+ accountId: string;
1400
+ direction: 'debit' | 'credit';
1401
+ amountMinor: string;
1402
+ runningBalanceMinor: string;
1403
+ }
1404
+
1405
+ /**
1406
+ * Trusted workspace business records, independent of app scripts or generic file writes.
1407
+ * Never automatically retries a command: resolve a lost response with outcome() or
1408
+ * resubmit the exact same command/key to obtain the original durable result.
1409
+ */
1410
+ declare class BusinessModule {
1411
+ private readonly http;
1412
+ private readonly branch;
1413
+ constructor(http: HttpTransport, branch?: string);
1414
+ withBranch(branch: string): BusinessModule;
1415
+ context(): Promise<BusinessContext>;
1416
+ command(command: BusinessCommand): Promise<BusinessCommitResult>;
1417
+ read(id: string): Promise<BusinessSnapshot | null>;
1418
+ list(kind?: string): Promise<BusinessSnapshot[]>;
1419
+ /** null means unresolved, not success; do not invent a new operation key. */
1420
+ outcome(request: BusinessOutcomeRequest): Promise<BusinessCommitResult | null>;
1421
+ /** Recover using the exact original command, without reproducing server fingerprint encoding. */
1422
+ outcomeFor(command: BusinessCommand): Promise<BusinessCommitResult | null>;
1423
+ report(report: BusinessReportName, range?: {
1424
+ from?: string;
1425
+ to?: string;
1426
+ }): Promise<BusinessReport>;
1427
+ /** Retained historical expense receipt bytes, even after the original native file is removed. */
1428
+ receipt(nodeId: string, revision: string): Promise<Blob>;
1429
+ private headers;
1430
+ }
1431
+
940
1432
  type BridgeEventType = HostToAppMessage['type'];
941
1433
  type BridgeListener = (data: HostToAppMessage) => void;
942
1434
  /**
@@ -945,13 +1437,21 @@ type BridgeListener = (data: HostToAppMessage) => void;
945
1437
  * and app-to-host events (navigate, resize, dirty, etc.).
946
1438
  */
947
1439
  declare class Bridge {
1440
+ private readonly expectedHostOrigin?;
948
1441
  private listeners;
949
1442
  private _initResolve;
1443
+ private _initReject;
1444
+ private _initTimer;
950
1445
  private _initPromise;
951
1446
  private _hostOrigin;
952
1447
  private _messageHandler;
953
1448
  private _destroyed;
954
- constructor();
1449
+ private sessionId;
1450
+ private actions;
1451
+ private requests;
1452
+ private backendRequests;
1453
+ private wopiRequests;
1454
+ constructor(expectedHostOrigin?: string | undefined);
955
1455
  /** Post `verentis:ready` to the host to start the handshake */
956
1456
  sendReady(capabilities?: string[]): void;
957
1457
  /** Wait for the host to send `verentis:init` with context and token */
@@ -979,6 +1479,19 @@ declare class Bridge {
979
1479
  setTitle(title: string): void;
980
1480
  /** Signal unsaved changes to the host */
981
1481
  setDirty(isDirty: boolean): void;
1482
+ /** The host, not the app, selects the installation, file, branch and permission ceiling. */
1483
+ requestBackendCredential(): Promise<AppBackendCredential>;
1484
+ /** The trusted parent selects the approved installation, document and action. */
1485
+ requestWopiLaunch(): Promise<WopiLaunch>;
1486
+ /** Recover only the target selected by a completed server-owned derived operation. */
1487
+ requestWopiContinuation(): Promise<WopiContinuation>;
1488
+ getWopiStatus(): Promise<WopiSaveStatus>;
1489
+ requestWopiSave(generation: number): Promise<WopiSaveCheckpoint>;
1490
+ closeWopiSession(): Promise<void>;
1491
+ private requestWopi;
1492
+ registerAction(descriptor: HeaderAction, handler: HeaderActionHandler): HeaderActionRegistration;
1493
+ private publishActions;
1494
+ private invokeAction;
982
1495
  /** Subscribe to a specific message type from the host */
983
1496
  on(type: BridgeEventType, listener: BridgeListener): () => void;
984
1497
  /** Clean up event listeners */
@@ -998,6 +1511,8 @@ declare class VerentisClient {
998
1511
  installations: InstallationsModule;
999
1512
  resources: ResourcesModule;
1000
1513
  settings: SettingsModule;
1514
+ email: EmailModule;
1515
+ business: BusinessModule;
1001
1516
  readonly context: ContextModule;
1002
1517
  readonly bridge: Bridge | null;
1003
1518
  private readonly _auth;
@@ -1064,13 +1579,18 @@ declare class TokenAuth implements AuthStrategy {
1064
1579
  * by requesting a new token from the host when nearing expiry.
1065
1580
  */
1066
1581
  declare class BridgeAuth implements AuthStrategy {
1067
- private readonly hostOrigin;
1582
+ private hostOrigin;
1068
1583
  private _token;
1069
1584
  private _expiresAt;
1070
1585
  private _refreshTimer;
1071
1586
  private _pendingRefresh;
1072
1587
  private _messageHandler;
1588
+ private _requestId;
1589
+ private _refreshReject;
1590
+ private _requestTimer;
1591
+ private _destroyed;
1073
1592
  constructor(hostOrigin: string);
1593
+ setHostOrigin(origin: string): void;
1074
1594
  /** Set the initial token received from the host's `verentis:init` message */
1075
1595
  setToken(info: TokenInfo): void;
1076
1596
  getAuthHeader(): Promise<string | null>;
@@ -1080,6 +1600,7 @@ declare class BridgeAuth implements AuthStrategy {
1080
1600
  private requestRefresh;
1081
1601
  private handleMessage;
1082
1602
  private scheduleRefresh;
1603
+ private failRefresh;
1083
1604
  }
1084
1605
 
1085
1606
  /**
@@ -1109,4 +1630,4 @@ declare class BridgeAuth implements AuthStrategy {
1109
1630
  */
1110
1631
  declare function createVerentisClient(options?: VerentisClientOptions): VerentisClient;
1111
1632
 
1112
- export { ApiError, ApiKeyAuth, type AppContext, type AppSurface, type AppToHostMessage, type ApplicationDisplayOptions, type ApplicationEntryPoint, type ApplicationFileType, type ApplicationLaunchConfig, type ApplicationManifest, type ApplicationSpec, type ArchiveFormat, type AuthOptions, type AuthStrategy, Bridge, BridgeAuth, type CatalogImage, ContextModule, type DeleteFileOptions, type EngineFileType, type EngineRuntime, type EngineTool, EnginesModule, type EntryPointInfo, type ExecuteEngineOptions, type Execution, type ExecutionEngine, type ExecutionEngineListOptions, type ExecutionListOptions, type ExecutionLogs, type ExecutionMode, type ExecutionResult, type ExecutionScopedOptions, type ExecutionStatus, type ExecutionTrigger, ExecutionsModule, type ExtractUploadOptions, type FileAppContext, type FileEntry, type FileInfo, FilesModule, type GetFileOptions, type HostToAppMessage, HttpTransport, type Installation, type InstallationDetail, type InstallationLifecycleResult, type InstallationListOptions, type InstallationMode, type InstallationScopedOptions, type InstallationStatus, InstallationsModule, type InstalledPackageDescriptor, type InstalledPackagePayload, type ManifestMetadata, type MimeTypeBinding, type MoveFileOptions, type NamespacedSettings, type NavigateOptions, type OAuthConfig, type PagedResult, type ReadArchiveOptions, type RequestOptions, type ResolveInstallationOptions, type ResourceMimeTypeBinding, type ResourceRegistration, type ResourceScopedOptions, ResourcesModule, type RunFileOptions, type SandboxOptions, type SettingDeclaration, type SettingDeclarationType, type SettingGroup, type SettingItem, type SettingOption, type SettingPresence, SettingsModule, type SettingsScopedOptions, TokenAuth, type TokenInfo, type UpdateInstallationOptions, VerentisClient, type VerentisClientOptions, type VerentisDirtyMessage, type VerentisFileChangedMessage, type VerentisInitMessage, type VerentisMessage, type VerentisNavigateMessage, type VerentisReadyMessage, type VerentisResizeMessage, type VerentisThemeMessage, type VerentisTitleMessage, type VerentisTokenRefreshMessage, type VerentisTokenRefreshedMessage, type WaitOptions, type WorkspaceAppContext, type WorkspaceInfo, type WriteFileOptions, createVerentisClient, findBestMatch, isTerminalStatus, matchMimeType };
1633
+ export { ApiError, ApiKeyAuth, type AppApplicationContext, type AppBackendCredential, type AppContext, type AppSurface, type AppToHostMessage, type ApplicationDisplayOptions, type ApplicationEntryPoint, type ApplicationFileType, type ApplicationLaunchConfig, type ApplicationManifest, type ApplicationSpec, type ArchiveFormat, type AuthOptions, type AuthStrategy, Bridge, BridgeAuth, type BusinessCommand, type BusinessCommitResult, type BusinessContext, type BusinessLedgerEntry, BusinessModule, type BusinessOperation, type BusinessOutcomeRequest, type BusinessParameters, type BusinessReceivable, type BusinessReceivableTotals, type BusinessReport, type BusinessReportLine, type BusinessReportName, type BusinessSnapshot, type CatalogImage, ContextModule, type DeleteFileOptions, type EmailArtifactOutcome, type EmailConsent, type EmailConsentOptions, type EmailConsentPreview, type EmailDeliveryEvidence, type EmailDispatchOptions, type EmailDispatchOutcome, type EmailHistoryOptions, EmailModule, type EmailPurpose, type EmailScopedOptions, type EmailSenderGrant, type EmailSenderIdentity, type EngineFileType, type EngineRuntime, type EngineTool, EnginesModule, type EntryPointInfo, type ExecuteEngineOptions, type Execution, type ExecutionEngine, type ExecutionEngineListOptions, type ExecutionListOptions, type ExecutionLogs, type ExecutionMode, type ExecutionResult, type ExecutionScopedOptions, type ExecutionStatus, type ExecutionTrigger, ExecutionsModule, type ExtractUploadOptions, type FileAppContext, type FileEntry, type FileInfo, FilesModule, type GetFileOptions, type HeaderAction, type HeaderActionHandler, type HeaderActionRegistration, type HeaderActionResult, type HostToAppMessage, HttpTransport, type Installation, type InstallationDetail, type InstallationGraphOutcomeStatus, type InstallationGraphPackage, type InstallationGraphPreview, type InstallationGraphResult, type InstallationLifecycleResult, type InstallationListOptions, type InstallationMode, type InstallationScopedOptions, type InstallationStatus, InstallationsModule, type InstalledPackageDescriptor, type InstalledPackagePayload, type ManifestMetadata, type MimeTypeBinding, type MoveFileOptions, type NamespacedSettings, type NavigateOptions, type NodeFileContent, type NodeFileMetadata, type NodeFileOptions, type OAuthConfig, type PackageDependency, type PagedResult, type PreviewInstallationOptions, type ReadArchiveOptions, type RequestOptions, type ResolveInstallationOptions, type ResourceMimeTypeBinding, type ResourceRegistration, type ResourceScopedOptions, ResourcesModule, type RunFileOptions, type SandboxOptions, type SettingDeclaration, type SettingDeclarationType, type SettingGroup, type SettingItem, type SettingOption, type SettingPresence, SettingsModule, type SettingsScopedOptions, TokenAuth, type TokenInfo, type UpdateInstallationOptions, type VerentisActionInvokeMessage, type VerentisActionResultMessage, type VerentisActionsSetMessage, type VerentisBackendCredentialRequest, type VerentisBackendCredentialResponse, VerentisClient, type VerentisClientOptions, type VerentisDirtyMessage, type VerentisFileChangedMessage, type VerentisInitMessage, type VerentisMessage, type VerentisNavigateMessage, type VerentisReadyMessage, type VerentisResizeMessage, type VerentisThemeMessage, type VerentisTitleMessage, type VerentisTokenRefreshMessage, type VerentisTokenRefreshedMessage, type VerentisWopiRequest, type VerentisWopiResponse, type WaitOptions, type WopiContinuation, type WopiLaunch, type WopiSaveCheckpoint, type WopiSaveStatus, type WorkspaceAppContext, type WorkspaceInfo, type WriteFileOptions, type WriteNodeFileOptions, createVerentisClient, findBestMatch, isHeaderAction, isTerminalStatus, matchMimeType };