@verentis/sdk 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 +146 -0
- package/dist/index.cjs +1122 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1112 -0
- package/dist/index.d.ts +1112 -0
- package/dist/index.js +1104 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1112 @@
|
|
|
1
|
+
interface VerentisMessage {
|
|
2
|
+
type: `verentis:${string}`;
|
|
3
|
+
version: 1;
|
|
4
|
+
requestId?: string;
|
|
5
|
+
}
|
|
6
|
+
interface VerentisInitMessage extends VerentisMessage {
|
|
7
|
+
type: 'verentis:init';
|
|
8
|
+
context: AppContext;
|
|
9
|
+
token: TokenInfo;
|
|
10
|
+
}
|
|
11
|
+
interface VerentisTokenRefreshedMessage extends VerentisMessage {
|
|
12
|
+
type: 'verentis:token:refreshed';
|
|
13
|
+
requestId: string;
|
|
14
|
+
token: TokenInfo;
|
|
15
|
+
}
|
|
16
|
+
interface VerentisFileChangedMessage extends VerentisMessage {
|
|
17
|
+
type: 'verentis:file:changed';
|
|
18
|
+
path: string;
|
|
19
|
+
fileVersion?: string;
|
|
20
|
+
}
|
|
21
|
+
interface VerentisThemeMessage extends VerentisMessage {
|
|
22
|
+
type: 'verentis:theme';
|
|
23
|
+
colorScheme: 'light' | 'dark';
|
|
24
|
+
variables?: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
interface VerentisReadyMessage extends VerentisMessage {
|
|
27
|
+
type: 'verentis:ready';
|
|
28
|
+
capabilities?: string[];
|
|
29
|
+
}
|
|
30
|
+
interface VerentisTokenRefreshMessage extends VerentisMessage {
|
|
31
|
+
type: 'verentis:token:refresh';
|
|
32
|
+
requestId: string;
|
|
33
|
+
}
|
|
34
|
+
interface VerentisNavigateMessage extends VerentisMessage {
|
|
35
|
+
type: 'verentis:navigate';
|
|
36
|
+
/** Target of the navigation: a workspace file path or an absolute http(s) URL. */
|
|
37
|
+
path: string;
|
|
38
|
+
/** When true, the host opens the target in a new browser tab instead of the current one. */
|
|
39
|
+
newTab?: boolean;
|
|
40
|
+
}
|
|
41
|
+
interface VerentisResizeMessage extends VerentisMessage {
|
|
42
|
+
type: 'verentis:resize';
|
|
43
|
+
height: number;
|
|
44
|
+
}
|
|
45
|
+
interface VerentisTitleMessage extends VerentisMessage {
|
|
46
|
+
type: 'verentis:title';
|
|
47
|
+
title: string;
|
|
48
|
+
}
|
|
49
|
+
interface VerentisDirtyMessage extends VerentisMessage {
|
|
50
|
+
type: 'verentis:dirty';
|
|
51
|
+
isDirty: boolean;
|
|
52
|
+
}
|
|
53
|
+
type HostToAppMessage = VerentisInitMessage | VerentisTokenRefreshedMessage | VerentisFileChangedMessage | VerentisThemeMessage;
|
|
54
|
+
type AppToHostMessage = VerentisReadyMessage | VerentisTokenRefreshMessage | VerentisNavigateMessage | VerentisResizeMessage | VerentisTitleMessage | VerentisDirtyMessage;
|
|
55
|
+
type AppSurface = 'file' | 'workspace';
|
|
56
|
+
interface AppContextBase {
|
|
57
|
+
workspace: WorkspaceInfo;
|
|
58
|
+
entryPoint?: EntryPointInfo;
|
|
59
|
+
apiUrl: string;
|
|
60
|
+
}
|
|
61
|
+
/** Context for an application opened against a workspace file. */
|
|
62
|
+
interface FileAppContext extends AppContextBase {
|
|
63
|
+
surface: 'file';
|
|
64
|
+
file: FileInfo;
|
|
65
|
+
}
|
|
66
|
+
/** Context for an application opened as a standalone workspace experience. */
|
|
67
|
+
interface WorkspaceAppContext extends AppContextBase {
|
|
68
|
+
surface: 'workspace';
|
|
69
|
+
file?: never;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Legacy file-hosted contexts did not include a surface discriminator. They
|
|
73
|
+
* remain accepted and are treated as `file` surfaces by the SDK.
|
|
74
|
+
*/
|
|
75
|
+
interface LegacyFileAppContext extends AppContextBase {
|
|
76
|
+
surface?: undefined;
|
|
77
|
+
file: FileInfo;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Application context supplied by the workspace host.
|
|
81
|
+
*
|
|
82
|
+
* New hosts explicitly identify `file` or `workspace` surfaces. The legacy
|
|
83
|
+
* file shape without `surface` remains supported for backwards compatibility.
|
|
84
|
+
*/
|
|
85
|
+
type AppContext = FileAppContext | WorkspaceAppContext | LegacyFileAppContext;
|
|
86
|
+
interface WorkspaceInfo {
|
|
87
|
+
id: string;
|
|
88
|
+
slug: string;
|
|
89
|
+
name: string;
|
|
90
|
+
}
|
|
91
|
+
interface FileInfo {
|
|
92
|
+
path: string;
|
|
93
|
+
name: string;
|
|
94
|
+
mimeType: string;
|
|
95
|
+
size: number;
|
|
96
|
+
version?: string;
|
|
97
|
+
etag?: string;
|
|
98
|
+
}
|
|
99
|
+
interface EntryPointInfo {
|
|
100
|
+
id: string;
|
|
101
|
+
displayName: string;
|
|
102
|
+
description?: string;
|
|
103
|
+
icon?: string;
|
|
104
|
+
route: string;
|
|
105
|
+
mode: 'view' | 'edit';
|
|
106
|
+
matchedPattern: string;
|
|
107
|
+
priority: number;
|
|
108
|
+
}
|
|
109
|
+
interface TokenInfo {
|
|
110
|
+
accessToken: string;
|
|
111
|
+
expiresAt: string;
|
|
112
|
+
scopes: string[];
|
|
113
|
+
}
|
|
114
|
+
interface VerentisClientOptions {
|
|
115
|
+
/** Base URL of the Verentis API gateway (e.g. 'https://api.verentis.com') */
|
|
116
|
+
apiUrl?: string;
|
|
117
|
+
/** API version prefix (defaults to 'v1') */
|
|
118
|
+
apiVersion?: string;
|
|
119
|
+
/** Authentication configuration */
|
|
120
|
+
auth?: AuthOptions;
|
|
121
|
+
/** Workspace ID for standalone mode */
|
|
122
|
+
workspaceId?: string;
|
|
123
|
+
}
|
|
124
|
+
type AuthOptions = {
|
|
125
|
+
apiKey: string;
|
|
126
|
+
} | {
|
|
127
|
+
token: string;
|
|
128
|
+
expiresAt?: string;
|
|
129
|
+
refreshToken?: () => Promise<TokenInfo>;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Options for {@link VerentisNavigateMessage}-based navigation requests.
|
|
133
|
+
*/
|
|
134
|
+
interface NavigateOptions {
|
|
135
|
+
/**
|
|
136
|
+
* When true, the host opens the target in a new browser tab instead of
|
|
137
|
+
* navigating the current tab. Defaults to false.
|
|
138
|
+
*
|
|
139
|
+
* The target may be a workspace file path or an absolute http(s) URL.
|
|
140
|
+
* Opening an external URL requires the app to declare the
|
|
141
|
+
* `navigation:external` capability in its manifest.
|
|
142
|
+
*/
|
|
143
|
+
newTab?: boolean;
|
|
144
|
+
}
|
|
145
|
+
interface FileEntry {
|
|
146
|
+
path: string;
|
|
147
|
+
name: string;
|
|
148
|
+
size: number;
|
|
149
|
+
mimeType: string;
|
|
150
|
+
version?: string;
|
|
151
|
+
etag?: string;
|
|
152
|
+
children?: FileEntry[];
|
|
153
|
+
}
|
|
154
|
+
interface GetFileOptions {
|
|
155
|
+
branch?: string;
|
|
156
|
+
pageNo?: number;
|
|
157
|
+
pageSize?: number;
|
|
158
|
+
orderBy?: string;
|
|
159
|
+
}
|
|
160
|
+
interface WriteFileOptions {
|
|
161
|
+
content: Blob | string | ArrayBuffer;
|
|
162
|
+
contentType?: string;
|
|
163
|
+
filename?: string;
|
|
164
|
+
branch?: string;
|
|
165
|
+
}
|
|
166
|
+
interface MoveFileOptions {
|
|
167
|
+
from: string;
|
|
168
|
+
to: string;
|
|
169
|
+
branch?: string;
|
|
170
|
+
}
|
|
171
|
+
interface DeleteFileOptions {
|
|
172
|
+
path: string;
|
|
173
|
+
branch?: string;
|
|
174
|
+
}
|
|
175
|
+
type ArchiveFormat = 'zip' | 'tgz';
|
|
176
|
+
interface ReadArchiveOptions {
|
|
177
|
+
/** Archive format. Defaults to 'zip'. */
|
|
178
|
+
format?: ArchiveFormat;
|
|
179
|
+
/** Target branch. Defaults to 'main'. */
|
|
180
|
+
branch?: string;
|
|
181
|
+
}
|
|
182
|
+
interface ExtractUploadOptions {
|
|
183
|
+
/** Original filename of the archive (for format detection). */
|
|
184
|
+
filename?: string;
|
|
185
|
+
/** Target branch. Defaults to 'main'. */
|
|
186
|
+
branch?: string;
|
|
187
|
+
}
|
|
188
|
+
interface InstalledPackagePayload {
|
|
189
|
+
sourcePath: string;
|
|
190
|
+
destinationPath: string;
|
|
191
|
+
mode: string;
|
|
192
|
+
phase: number;
|
|
193
|
+
mimeType?: string | null;
|
|
194
|
+
}
|
|
195
|
+
interface InstalledPackageDescriptor {
|
|
196
|
+
packageIdentity: string;
|
|
197
|
+
publisher?: string | null;
|
|
198
|
+
name: string;
|
|
199
|
+
version: string;
|
|
200
|
+
kind: string;
|
|
201
|
+
manifestYaml: string;
|
|
202
|
+
installMode: string;
|
|
203
|
+
sealed: boolean;
|
|
204
|
+
mimeType: string;
|
|
205
|
+
payloads: InstalledPackagePayload[];
|
|
206
|
+
}
|
|
207
|
+
type InstallationMode = 'Extracted' | 'Sealed';
|
|
208
|
+
type InstallationStatus = 'Pending' | 'Installing' | 'Installed' | 'Updating' | 'Uninstalling' | 'Failed' | 'Uninstalled';
|
|
209
|
+
interface Installation {
|
|
210
|
+
id: string;
|
|
211
|
+
accountId: string;
|
|
212
|
+
workspaceId: string;
|
|
213
|
+
packageId: string;
|
|
214
|
+
packageVersionId: string;
|
|
215
|
+
packageName: string;
|
|
216
|
+
publisherName: string;
|
|
217
|
+
version: string;
|
|
218
|
+
installPath: string;
|
|
219
|
+
branch: string;
|
|
220
|
+
installMode: InstallationMode;
|
|
221
|
+
status: InstallationStatus;
|
|
222
|
+
installedBy: string;
|
|
223
|
+
errorMessage?: string | null;
|
|
224
|
+
createdAt: string;
|
|
225
|
+
updatedAt?: string | null;
|
|
226
|
+
securityFlagged: boolean;
|
|
227
|
+
securityFlagReason?: string | null;
|
|
228
|
+
isSystem: boolean;
|
|
229
|
+
systemKey?: string | null;
|
|
230
|
+
protectionReason?: string | null;
|
|
231
|
+
}
|
|
232
|
+
interface CatalogImage {
|
|
233
|
+
assetId: string;
|
|
234
|
+
url: string;
|
|
235
|
+
alt: string;
|
|
236
|
+
caption?: string | null;
|
|
237
|
+
mediaType: string;
|
|
238
|
+
}
|
|
239
|
+
interface InstallationDetail {
|
|
240
|
+
installation: Installation;
|
|
241
|
+
installedVersionStatus: string;
|
|
242
|
+
installedReadmeMarkdown?: string | null;
|
|
243
|
+
installedChangelogMarkdown?: string | null;
|
|
244
|
+
installedDisplayName?: string | null;
|
|
245
|
+
installedDescription?: string | null;
|
|
246
|
+
installedLogoUrl?: string | null;
|
|
247
|
+
installedHeroUrl?: string | null;
|
|
248
|
+
installedImages: CatalogImage[];
|
|
249
|
+
installedBadges: string[];
|
|
250
|
+
installedIsDeprecated: boolean;
|
|
251
|
+
installedDeprecationMessage?: string | null;
|
|
252
|
+
installedIsMalicious: boolean;
|
|
253
|
+
installedIsDelisted: boolean;
|
|
254
|
+
publisherId: string;
|
|
255
|
+
publisherName: string;
|
|
256
|
+
publisherDisplayName: string;
|
|
257
|
+
publisherLogoUrl?: string | null;
|
|
258
|
+
publisherIsVerified: boolean;
|
|
259
|
+
publisherBadges: string[];
|
|
260
|
+
publisherIsMalicious: boolean;
|
|
261
|
+
packageBadges: string[];
|
|
262
|
+
packageIsMalicious: boolean;
|
|
263
|
+
packageIsDeprecated: boolean;
|
|
264
|
+
packageDeprecationMessage?: string | null;
|
|
265
|
+
latestVersion?: string | null;
|
|
266
|
+
latestVersionId?: string | null;
|
|
267
|
+
updateAvailable: boolean;
|
|
268
|
+
canUpdate: boolean;
|
|
269
|
+
canRetry: boolean;
|
|
270
|
+
canDelete: boolean;
|
|
271
|
+
allowedActions: string[];
|
|
272
|
+
}
|
|
273
|
+
interface InstallationLifecycleResult {
|
|
274
|
+
installationId: string;
|
|
275
|
+
status: InstallationStatus;
|
|
276
|
+
succeeded: boolean;
|
|
277
|
+
error?: string | null;
|
|
278
|
+
}
|
|
279
|
+
interface InstallationScopedOptions {
|
|
280
|
+
workspaceId?: string;
|
|
281
|
+
}
|
|
282
|
+
interface InstallationListOptions extends InstallationScopedOptions {
|
|
283
|
+
pageNo?: number;
|
|
284
|
+
pageSize?: number;
|
|
285
|
+
orderBy?: string;
|
|
286
|
+
packageId?: string;
|
|
287
|
+
branch?: string;
|
|
288
|
+
installPath?: string;
|
|
289
|
+
status?: InstallationStatus;
|
|
290
|
+
isSystem?: boolean;
|
|
291
|
+
}
|
|
292
|
+
interface ResolveInstallationOptions extends InstallationScopedOptions {
|
|
293
|
+
branch?: string;
|
|
294
|
+
}
|
|
295
|
+
interface UpdateInstallationOptions extends InstallationScopedOptions {
|
|
296
|
+
packageVersion?: string;
|
|
297
|
+
installMode?: InstallationMode;
|
|
298
|
+
}
|
|
299
|
+
interface AuthStrategy {
|
|
300
|
+
getAuthHeader(): Promise<string | null>;
|
|
301
|
+
destroy?(): void;
|
|
302
|
+
}
|
|
303
|
+
interface MimeTypeBinding {
|
|
304
|
+
pattern: string;
|
|
305
|
+
mode: 'view' | 'edit';
|
|
306
|
+
priority: number;
|
|
307
|
+
icon?: string;
|
|
308
|
+
}
|
|
309
|
+
interface ApplicationFileType {
|
|
310
|
+
pattern: string;
|
|
311
|
+
extensions: string[];
|
|
312
|
+
priority: number;
|
|
313
|
+
icon?: string;
|
|
314
|
+
}
|
|
315
|
+
interface ApplicationManifest {
|
|
316
|
+
apiVersion: string;
|
|
317
|
+
kind: 'Application';
|
|
318
|
+
metadata: ManifestMetadata;
|
|
319
|
+
spec: ApplicationSpec;
|
|
320
|
+
}
|
|
321
|
+
interface ManifestMetadata {
|
|
322
|
+
name: string;
|
|
323
|
+
displayName?: string;
|
|
324
|
+
description?: string;
|
|
325
|
+
icon?: string;
|
|
326
|
+
version?: string;
|
|
327
|
+
author?: string;
|
|
328
|
+
labels?: Record<string, string>;
|
|
329
|
+
annotations?: Record<string, string>;
|
|
330
|
+
}
|
|
331
|
+
type InstallMode = 'seed' | 'managed';
|
|
332
|
+
interface InstallDirective {
|
|
333
|
+
/** Source path/glob relative to the package payload root. Must match at least one file. */
|
|
334
|
+
from: string;
|
|
335
|
+
/**
|
|
336
|
+
* Destination workspace-absolute VFS path. A trailing `/` denotes a directory (the source's
|
|
337
|
+
* basename / relative subpath is preserved beneath it); otherwise an exact file path.
|
|
338
|
+
*/
|
|
339
|
+
to: string;
|
|
340
|
+
/**
|
|
341
|
+
* `seed` = install once, never overwrite an existing/user-edited file (never removed on upgrade);
|
|
342
|
+
* `managed` = app-owned, created and replaced on upgrade, removed on uninstall. Default `managed`.
|
|
343
|
+
*/
|
|
344
|
+
mode?: InstallMode;
|
|
345
|
+
/** Optional explicit MIME for placed nodes; else inferred / resolved by json-schema. */
|
|
346
|
+
mime?: string;
|
|
347
|
+
/** Optional sequential install phase; omitted directives remain in the legacy single phase. */
|
|
348
|
+
phase?: number;
|
|
349
|
+
}
|
|
350
|
+
interface ApplicationLaunchConfig {
|
|
351
|
+
/**
|
|
352
|
+
* Enables standalone launch from the workspace. Defaults to `false`.
|
|
353
|
+
*
|
|
354
|
+
* When enabled, the platform requires `entryPoint` or `spec.entry` to
|
|
355
|
+
* resolve an iframe entry.
|
|
356
|
+
*/
|
|
357
|
+
enabled?: boolean;
|
|
358
|
+
/**
|
|
359
|
+
* Optional entry-point ID to use as the standalone home. When omitted, the
|
|
360
|
+
* platform falls back to `spec.entry`.
|
|
361
|
+
*/
|
|
362
|
+
entryPoint?: string;
|
|
363
|
+
/**
|
|
364
|
+
* Whether users may pin the launch surface. Defaults to `false` and does not
|
|
365
|
+
* pin it automatically.
|
|
366
|
+
*/
|
|
367
|
+
pinnable?: boolean;
|
|
368
|
+
}
|
|
369
|
+
interface ApplicationDisplayOptions {
|
|
370
|
+
fullscreen?: boolean;
|
|
371
|
+
}
|
|
372
|
+
interface ApplicationEntryPoint {
|
|
373
|
+
id: string;
|
|
374
|
+
displayName?: string;
|
|
375
|
+
description?: string;
|
|
376
|
+
icon?: string;
|
|
377
|
+
route?: string;
|
|
378
|
+
/** Optional per-entry-point iframe URL override. */
|
|
379
|
+
entry?: string;
|
|
380
|
+
/** Optional splash URL override. Relative values resolve against this entry point's iframe URL. */
|
|
381
|
+
splash?: string;
|
|
382
|
+
order?: number;
|
|
383
|
+
mimeTypes?: MimeTypeBinding[];
|
|
384
|
+
display?: ApplicationDisplayOptions;
|
|
385
|
+
}
|
|
386
|
+
interface ApplicationSpec {
|
|
387
|
+
/** Optional iframe UI surface URL. Omit for a headless / file-collection app. */
|
|
388
|
+
entry?: string;
|
|
389
|
+
/** Optional application splash URL. Relative values resolve against the selected iframe entry URL. */
|
|
390
|
+
splash?: string;
|
|
391
|
+
/** Named iframe surfaces; `launch.entryPoint` references one of these ids. */
|
|
392
|
+
entryPoints?: ApplicationEntryPoint[];
|
|
393
|
+
scope?: string;
|
|
394
|
+
mimeTypes?: MimeTypeBinding[];
|
|
395
|
+
fileTypes?: ApplicationFileType[];
|
|
396
|
+
capabilities?: string[];
|
|
397
|
+
permissions?: string[];
|
|
398
|
+
sandbox?: SandboxOptions;
|
|
399
|
+
oauth?: OAuthConfig;
|
|
400
|
+
scopes?: string[];
|
|
401
|
+
/** Declarative install map: where packaged files land in the workspace VFS. */
|
|
402
|
+
install?: InstallDirective[];
|
|
403
|
+
/** Where the app-record (manifest node) is anchored. Default `/applications/{name}`. */
|
|
404
|
+
installRoot?: string;
|
|
405
|
+
/** Default display behavior inherited by entry points. */
|
|
406
|
+
display?: ApplicationDisplayOptions;
|
|
407
|
+
/**
|
|
408
|
+
* Opt-in standalone workspace launch configuration. The platform defaults
|
|
409
|
+
* `enabled` and `pinnable` to `false` when omitted.
|
|
410
|
+
*/
|
|
411
|
+
launch?: ApplicationLaunchConfig;
|
|
412
|
+
/**
|
|
413
|
+
* Workspace settings and secrets this app requires. Declared settings are auto-registered
|
|
414
|
+
* in the workspace settings store under `{metadata.name}.{key}` and surfaced in the
|
|
415
|
+
* settings UI. Secret values never reach browser contexts.
|
|
416
|
+
*/
|
|
417
|
+
settings?: SettingDeclaration[];
|
|
418
|
+
}
|
|
419
|
+
/** Data type of a declared setting value. */
|
|
420
|
+
type SettingDeclarationType = 'string' | 'number' | 'boolean' | 'select' | 'file';
|
|
421
|
+
/**
|
|
422
|
+
* A workspace setting or secret an application/engine manifest requires. The platform
|
|
423
|
+
* auto-creates a matching setting definition (namespaced `{manifest-name}.{key}`) so
|
|
424
|
+
* workspace admins can provide the value; engines receive values at run time.
|
|
425
|
+
*/
|
|
426
|
+
interface SettingDeclaration {
|
|
427
|
+
/** Short key; stored namespaced as `{metadata.name}.{key}` in the settings store. */
|
|
428
|
+
key: string;
|
|
429
|
+
/** Optional environment variable name injected into engine runs (e.g. `MY_API_KEY`). */
|
|
430
|
+
env?: string;
|
|
431
|
+
/**
|
|
432
|
+
* Secret values are server-only: delivered to Docker engine runs, never to browser
|
|
433
|
+
* contexts (wasm runs, iframe apps). Defaults to `false`.
|
|
434
|
+
*/
|
|
435
|
+
secret?: boolean;
|
|
436
|
+
/**
|
|
437
|
+
* Required settings prompt during marketplace install and fail an execution fast when
|
|
438
|
+
* no value is configured. Defaults to `false`.
|
|
439
|
+
*/
|
|
440
|
+
required?: boolean;
|
|
441
|
+
displayName?: string;
|
|
442
|
+
description?: string;
|
|
443
|
+
/**
|
|
444
|
+
* Value input type. `file` prompts the installer to select a local file and stores its
|
|
445
|
+
* bytes as a base64 string. Defaults to `string`.
|
|
446
|
+
*/
|
|
447
|
+
type?: SettingDeclarationType;
|
|
448
|
+
/** Default value. Not allowed for secrets. */
|
|
449
|
+
default?: string | number | boolean;
|
|
450
|
+
/** Allowed values when `type` is `select`. */
|
|
451
|
+
options?: string[];
|
|
452
|
+
}
|
|
453
|
+
interface OAuthConfig {
|
|
454
|
+
clientType: string;
|
|
455
|
+
redirectUris?: string[];
|
|
456
|
+
}
|
|
457
|
+
interface SandboxOptions {
|
|
458
|
+
allowScripts?: boolean;
|
|
459
|
+
allowSameOrigin?: boolean;
|
|
460
|
+
allowPopups?: boolean;
|
|
461
|
+
allowForms?: boolean;
|
|
462
|
+
}
|
|
463
|
+
/** Lifecycle status of an execution. Mirrors the platform `ExecutionStatus` enum. */
|
|
464
|
+
type ExecutionStatus = 'Pending' | 'Queued' | 'Running' | 'Completed' | 'Failed' | 'Cancelled' | 'TimedOut' | 'AwaitingClient';
|
|
465
|
+
/** How an execution is run. Mirrors the platform `ExecutionMode` enum. */
|
|
466
|
+
type ExecutionMode = 'RequestResponse' | 'LongRunning' | 'Scheduled' | 'EventDriven';
|
|
467
|
+
/** What triggered an execution. Mirrors the platform `ExecutionTrigger` enum. */
|
|
468
|
+
type ExecutionTrigger = 'User' | 'Api' | 'Schedule' | 'Event';
|
|
469
|
+
/** The structured outcome of an execution. */
|
|
470
|
+
interface ExecutionResult {
|
|
471
|
+
exitCode: number;
|
|
472
|
+
stdout?: string | null;
|
|
473
|
+
stderr?: string | null;
|
|
474
|
+
/** Raw JSON payload the engine reported in `result.json`, as a string. */
|
|
475
|
+
data?: string | null;
|
|
476
|
+
artifacts: string[];
|
|
477
|
+
durationMs: number;
|
|
478
|
+
error?: string | null;
|
|
479
|
+
}
|
|
480
|
+
/** A single execution record. */
|
|
481
|
+
interface Execution {
|
|
482
|
+
id: string;
|
|
483
|
+
workspaceId: string;
|
|
484
|
+
engineId: string;
|
|
485
|
+
engineName: string;
|
|
486
|
+
filePath?: string | null;
|
|
487
|
+
mode: ExecutionMode;
|
|
488
|
+
trigger: ExecutionTrigger;
|
|
489
|
+
tool?: string | null;
|
|
490
|
+
status: ExecutionStatus;
|
|
491
|
+
requestedAt: string;
|
|
492
|
+
startedAt?: string | null;
|
|
493
|
+
completedAt?: string | null;
|
|
494
|
+
result?: ExecutionResult | null;
|
|
495
|
+
}
|
|
496
|
+
/** Captured stdout/stderr of an execution. */
|
|
497
|
+
interface ExecutionLogs {
|
|
498
|
+
stdout?: string | null;
|
|
499
|
+
stderr?: string | null;
|
|
500
|
+
}
|
|
501
|
+
/** Options for running a file (engine resolved by the file's type). */
|
|
502
|
+
interface RunFileOptions {
|
|
503
|
+
/** Workspace to run in. Defaults to the client's workspace. */
|
|
504
|
+
workspaceId?: string;
|
|
505
|
+
branch?: string;
|
|
506
|
+
tool?: string;
|
|
507
|
+
mode?: string;
|
|
508
|
+
arguments?: string[];
|
|
509
|
+
/** Structured parameters passed to the engine; serialized to JSON for the platform. */
|
|
510
|
+
parameters?: Record<string, unknown>;
|
|
511
|
+
}
|
|
512
|
+
/** Options for executing a specific engine (optionally against a file). */
|
|
513
|
+
interface ExecuteEngineOptions {
|
|
514
|
+
workspaceId?: string;
|
|
515
|
+
filePath?: string;
|
|
516
|
+
branch?: string;
|
|
517
|
+
tool?: string;
|
|
518
|
+
mode?: string;
|
|
519
|
+
arguments?: string[];
|
|
520
|
+
parameters?: Record<string, unknown>;
|
|
521
|
+
}
|
|
522
|
+
/** Options that only need to scope a request to a workspace. */
|
|
523
|
+
interface ExecutionScopedOptions {
|
|
524
|
+
workspaceId?: string;
|
|
525
|
+
}
|
|
526
|
+
interface ExecutionListOptions extends ExecutionScopedOptions {
|
|
527
|
+
filePath?: string;
|
|
528
|
+
engineIds?: string[];
|
|
529
|
+
filePaths?: string[];
|
|
530
|
+
status?: ExecutionStatus;
|
|
531
|
+
trigger?: ExecutionTrigger;
|
|
532
|
+
activeOnly?: boolean;
|
|
533
|
+
requestedAfter?: string;
|
|
534
|
+
requestedBefore?: string;
|
|
535
|
+
pageNo?: number;
|
|
536
|
+
pageSize?: number;
|
|
537
|
+
orderBy?: string;
|
|
538
|
+
}
|
|
539
|
+
interface PagedResult<T> {
|
|
540
|
+
totalCount: number;
|
|
541
|
+
pageCount: number;
|
|
542
|
+
pageSize: number;
|
|
543
|
+
pageNumber: number;
|
|
544
|
+
data: T[];
|
|
545
|
+
}
|
|
546
|
+
interface EngineRuntime {
|
|
547
|
+
kind: 'Docker' | 'Wasm';
|
|
548
|
+
image?: string | null;
|
|
549
|
+
pullPolicy?: string | null;
|
|
550
|
+
moduleUrl?: string | null;
|
|
551
|
+
runtimeHint?: string | null;
|
|
552
|
+
serverCompatible: boolean;
|
|
553
|
+
clientCompatible: boolean;
|
|
554
|
+
adapterUrl?: string | null;
|
|
555
|
+
}
|
|
556
|
+
interface EngineFileType {
|
|
557
|
+
pattern: string;
|
|
558
|
+
extensions: string[];
|
|
559
|
+
priority: number;
|
|
560
|
+
icon?: string;
|
|
561
|
+
}
|
|
562
|
+
interface EngineTool {
|
|
563
|
+
name: string;
|
|
564
|
+
description?: string | null;
|
|
565
|
+
inputSchema?: string | null;
|
|
566
|
+
outputSchema?: string | null;
|
|
567
|
+
}
|
|
568
|
+
interface ExecutionEngine {
|
|
569
|
+
id: string;
|
|
570
|
+
workspaceId: string;
|
|
571
|
+
name: string;
|
|
572
|
+
displayName: string;
|
|
573
|
+
description?: string | null;
|
|
574
|
+
icon?: string | null;
|
|
575
|
+
version: string;
|
|
576
|
+
author?: string | null;
|
|
577
|
+
category?: string | null;
|
|
578
|
+
tier?: string | null;
|
|
579
|
+
sourcePath: string;
|
|
580
|
+
priority: number;
|
|
581
|
+
enabled: boolean;
|
|
582
|
+
capabilities: string[];
|
|
583
|
+
permissions: string[];
|
|
584
|
+
supportedModes: string[];
|
|
585
|
+
runtimes: EngineRuntime[];
|
|
586
|
+
fileTypes: EngineFileType[];
|
|
587
|
+
tools: EngineTool[];
|
|
588
|
+
resources?: {
|
|
589
|
+
cpu?: string | null;
|
|
590
|
+
memory?: string | null;
|
|
591
|
+
timeoutSeconds: number;
|
|
592
|
+
maxConcurrent: number;
|
|
593
|
+
storage?: string | null;
|
|
594
|
+
} | null;
|
|
595
|
+
sandbox?: {
|
|
596
|
+
network: string;
|
|
597
|
+
allowedHosts: string[];
|
|
598
|
+
readOnlyRoot: boolean;
|
|
599
|
+
noNewPrivileges: boolean;
|
|
600
|
+
} | null;
|
|
601
|
+
firstParty: boolean;
|
|
602
|
+
}
|
|
603
|
+
interface ExecutionEngineListOptions extends ExecutionScopedOptions {
|
|
604
|
+
pageNo?: number;
|
|
605
|
+
pageSize?: number;
|
|
606
|
+
orderBy?: string;
|
|
607
|
+
}
|
|
608
|
+
/** Options for polling an execution to completion. */
|
|
609
|
+
interface WaitOptions extends ExecutionScopedOptions {
|
|
610
|
+
/** Poll interval in milliseconds (default 1000). */
|
|
611
|
+
intervalMs?: number;
|
|
612
|
+
/** Maximum time to wait in milliseconds before throwing. */
|
|
613
|
+
timeoutMs?: number;
|
|
614
|
+
/** Abort signal to cancel waiting. */
|
|
615
|
+
signal?: AbortSignal;
|
|
616
|
+
}
|
|
617
|
+
/** An allowed value for a `select` setting. */
|
|
618
|
+
interface SettingOption {
|
|
619
|
+
value: string;
|
|
620
|
+
label: string;
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* A single workspace setting merged from its definition and any stored value.
|
|
624
|
+
* Secret values are always `null` for browser callers; `hasValue` still reports
|
|
625
|
+
* whether a value (or default) is configured.
|
|
626
|
+
*/
|
|
627
|
+
interface SettingItem {
|
|
628
|
+
key: string;
|
|
629
|
+
group: string;
|
|
630
|
+
label: string;
|
|
631
|
+
description?: string | null;
|
|
632
|
+
dataType: string;
|
|
633
|
+
isSecret: boolean;
|
|
634
|
+
options?: SettingOption[] | null;
|
|
635
|
+
defaultValue?: unknown;
|
|
636
|
+
value?: unknown;
|
|
637
|
+
hasValue: boolean;
|
|
638
|
+
}
|
|
639
|
+
/** A labeled group of settings (e.g. one group per application). */
|
|
640
|
+
interface SettingGroup {
|
|
641
|
+
key: string;
|
|
642
|
+
label: string;
|
|
643
|
+
items: SettingItem[];
|
|
644
|
+
}
|
|
645
|
+
/** Options that scope a settings request to a workspace. */
|
|
646
|
+
interface SettingsScopedOptions {
|
|
647
|
+
workspaceId?: string;
|
|
648
|
+
}
|
|
649
|
+
/** Presence-only result. Stored secret and non-secret values are never included. */
|
|
650
|
+
interface SettingPresence {
|
|
651
|
+
key: string;
|
|
652
|
+
hasStoredValue: boolean;
|
|
653
|
+
hasEffectiveValue: boolean;
|
|
654
|
+
}
|
|
655
|
+
interface ResourceMimeTypeBinding {
|
|
656
|
+
id: string;
|
|
657
|
+
pattern: string;
|
|
658
|
+
mode: string;
|
|
659
|
+
priority: number;
|
|
660
|
+
}
|
|
661
|
+
interface ResourceRegistration {
|
|
662
|
+
id: string;
|
|
663
|
+
accountId: string;
|
|
664
|
+
workspaceId: string;
|
|
665
|
+
name: string;
|
|
666
|
+
displayName?: string | null;
|
|
667
|
+
description?: string | null;
|
|
668
|
+
icon?: string | null;
|
|
669
|
+
version?: string | null;
|
|
670
|
+
author?: string | null;
|
|
671
|
+
entryUrl?: string | null;
|
|
672
|
+
kind: string;
|
|
673
|
+
scope: string;
|
|
674
|
+
manifestPath: string;
|
|
675
|
+
manifestNodeId: string;
|
|
676
|
+
manifestHash: string;
|
|
677
|
+
branch: string;
|
|
678
|
+
spec?: string | null;
|
|
679
|
+
labels?: string | null;
|
|
680
|
+
capabilities?: string | null;
|
|
681
|
+
permissions?: string | null;
|
|
682
|
+
sandboxConfig?: string | null;
|
|
683
|
+
createdAt: string;
|
|
684
|
+
updatedAt?: string | null;
|
|
685
|
+
mimeTypeBindings: ResourceMimeTypeBinding[];
|
|
686
|
+
entryPointId?: string | null;
|
|
687
|
+
entryPointDisplayName?: string | null;
|
|
688
|
+
entryPointDescription?: string | null;
|
|
689
|
+
entryPointIcon?: string | null;
|
|
690
|
+
entryPointRoute?: string | null;
|
|
691
|
+
entryPointEntryUrl?: string | null;
|
|
692
|
+
entryPointMode?: string | null;
|
|
693
|
+
entryPointMatchedPattern?: string | null;
|
|
694
|
+
entryPointPriority?: number | null;
|
|
695
|
+
entryPointFullscreen?: boolean | null;
|
|
696
|
+
entryPointSplashUrl?: string | null;
|
|
697
|
+
launchEnabled: boolean;
|
|
698
|
+
launchEntryPointId?: string | null;
|
|
699
|
+
launchPinnable: boolean;
|
|
700
|
+
}
|
|
701
|
+
interface ResourceScopedOptions {
|
|
702
|
+
workspaceId?: string;
|
|
703
|
+
}
|
|
704
|
+
interface RequestOptions {
|
|
705
|
+
headers?: Record<string, string>;
|
|
706
|
+
body?: BodyInit | null;
|
|
707
|
+
params?: Record<string, string | number | boolean | readonly (string | number)[] | undefined>;
|
|
708
|
+
}
|
|
709
|
+
declare class ApiError extends Error {
|
|
710
|
+
readonly status: number;
|
|
711
|
+
readonly detail: string;
|
|
712
|
+
readonly title?: string | undefined;
|
|
713
|
+
constructor(status: number, detail: string, title?: string | undefined);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Provides access to the current workspace and launch context.
|
|
718
|
+
* In iframe mode, this is populated from the host's `verentis:init` message.
|
|
719
|
+
* In standalone mode, the developer provides values via options.
|
|
720
|
+
*/
|
|
721
|
+
declare class ContextModule {
|
|
722
|
+
private _workspace;
|
|
723
|
+
private _surface;
|
|
724
|
+
private _file;
|
|
725
|
+
private _entryPoint;
|
|
726
|
+
private _apiUrl;
|
|
727
|
+
/** The current workspace */
|
|
728
|
+
get workspace(): WorkspaceInfo;
|
|
729
|
+
/** The host surface that launched the app */
|
|
730
|
+
get surface(): AppSurface;
|
|
731
|
+
/** The file that triggered the app to open on a file surface */
|
|
732
|
+
get file(): FileInfo;
|
|
733
|
+
/** The API URL */
|
|
734
|
+
get apiUrl(): string;
|
|
735
|
+
/** Whether a file context is available */
|
|
736
|
+
get hasFile(): boolean;
|
|
737
|
+
/** The application entry point that matched the opened file */
|
|
738
|
+
get entryPoint(): EntryPointInfo | null;
|
|
739
|
+
/** Whether an entry point context is available */
|
|
740
|
+
get hasEntryPoint(): boolean;
|
|
741
|
+
/** Update context from the host's init message */
|
|
742
|
+
setFromAppContext(ctx: AppContext): void;
|
|
743
|
+
/** Set workspace info directly (standalone mode) */
|
|
744
|
+
setWorkspace(workspace: Partial<WorkspaceInfo> & {
|
|
745
|
+
id: string;
|
|
746
|
+
}): void;
|
|
747
|
+
/** Set API URL directly */
|
|
748
|
+
setApiUrl(url: string): void;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* HTTP client for making direct API calls to the Verentis gateway.
|
|
753
|
+
* Used in both standalone and iframe modes — the auth strategy determines
|
|
754
|
+
* how the Authorization header is obtained.
|
|
755
|
+
*/
|
|
756
|
+
declare class HttpTransport {
|
|
757
|
+
private readonly baseUrl;
|
|
758
|
+
private readonly auth;
|
|
759
|
+
private readonly apiVersion;
|
|
760
|
+
constructor(baseUrl: string, auth: AuthStrategy, apiVersion?: string);
|
|
761
|
+
request<T>(method: string, path: string, options?: RequestOptions): Promise<T>;
|
|
762
|
+
requestRaw(method: string, path: string, options?: RequestOptions): Promise<Response>;
|
|
763
|
+
private buildUrl;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/** Returns true once an execution has reached a final state. */
|
|
767
|
+
declare function isTerminalStatus(status: ExecutionStatus): boolean;
|
|
768
|
+
/**
|
|
769
|
+
* Execution operations module. Triggers engine executions against files or a specific engine,
|
|
770
|
+
* reads their status/result/logs, cancels them, and polls them to completion — all over the
|
|
771
|
+
* Verentis execution API (`/v1/executions`).
|
|
772
|
+
*/
|
|
773
|
+
declare class ExecutionsModule {
|
|
774
|
+
private readonly http;
|
|
775
|
+
private readonly workspaceId?;
|
|
776
|
+
constructor(http: HttpTransport, workspaceId?: string | undefined);
|
|
777
|
+
/**
|
|
778
|
+
* Run a file in the virtual file system. The platform resolves the appropriate engine from the
|
|
779
|
+
* file's type (e.g. a `.py` file runs on the Python engine).
|
|
780
|
+
*/
|
|
781
|
+
run(filePath: string, options?: RunFileOptions): Promise<Execution>;
|
|
782
|
+
/**
|
|
783
|
+
* Execute a specific engine by id, optionally against a file and/or with structured parameters
|
|
784
|
+
* (e.g. invoking an engine tool without a script).
|
|
785
|
+
*/
|
|
786
|
+
execute(engineId: string, options?: ExecuteEngineOptions): Promise<Execution>;
|
|
787
|
+
/** Get an execution by id. */
|
|
788
|
+
get(id: string, options?: ExecutionScopedOptions): Promise<Execution>;
|
|
789
|
+
/** List workspace executions with optional engine, file, lifecycle, and time filters. */
|
|
790
|
+
list(options?: ExecutionListOptions): Promise<PagedResult<Execution>>;
|
|
791
|
+
/** Get the captured stdout/stderr of an execution. */
|
|
792
|
+
logs(id: string, options?: ExecutionScopedOptions): Promise<ExecutionLogs>;
|
|
793
|
+
/** Cancel a pending or running execution. */
|
|
794
|
+
cancel(id: string, options?: ExecutionScopedOptions): Promise<Execution>;
|
|
795
|
+
/**
|
|
796
|
+
* Poll an execution until it reaches a terminal status. Returns immediately if it is already
|
|
797
|
+
* terminal. Throws if `timeoutMs` elapses or the supplied signal aborts.
|
|
798
|
+
*/
|
|
799
|
+
wait(id: string, options?: WaitOptions): Promise<Execution>;
|
|
800
|
+
/**
|
|
801
|
+
* Run a file and resolve once it has completed. For synchronous (request-response) executions the
|
|
802
|
+
* initial response is already terminal; otherwise it polls via {@link wait}.
|
|
803
|
+
*/
|
|
804
|
+
runAndWait(filePath: string, options?: RunFileOptions & WaitOptions): Promise<Execution>;
|
|
805
|
+
private requireWorkspaceId;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
/** Read-only access to execution engines registered in a workspace. */
|
|
809
|
+
declare class EnginesModule {
|
|
810
|
+
private readonly http;
|
|
811
|
+
private readonly workspaceId?;
|
|
812
|
+
constructor(http: HttpTransport, workspaceId?: string | undefined);
|
|
813
|
+
list(options?: ExecutionEngineListOptions): Promise<PagedResult<ExecutionEngine>>;
|
|
814
|
+
get(id: string, options?: ExecutionScopedOptions): Promise<ExecutionEngine>;
|
|
815
|
+
private requireWorkspaceId;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* File operations module. Provides read, write, list, move, and delete
|
|
820
|
+
* against the Verentis Node file API.
|
|
821
|
+
*/
|
|
822
|
+
declare class FilesModule {
|
|
823
|
+
private readonly http;
|
|
824
|
+
private readonly workspaceId?;
|
|
825
|
+
constructor(http: HttpTransport, workspaceId?: string | undefined);
|
|
826
|
+
/**
|
|
827
|
+
* Get file metadata or directory listing.
|
|
828
|
+
* For files: returns metadata (path, name, mimeType, size, etc.).
|
|
829
|
+
* For directories: returns metadata with children array populated.
|
|
830
|
+
*/
|
|
831
|
+
get(path: string, options?: GetFileOptions): Promise<FileEntry>;
|
|
832
|
+
/**
|
|
833
|
+
* Read the raw content of a file as a Blob.
|
|
834
|
+
*/
|
|
835
|
+
readContent(path: string, branch?: string): Promise<Blob>;
|
|
836
|
+
/** Read UTF-8 text content from a workspace file. */
|
|
837
|
+
readText(path: string, branch?: string): Promise<string>;
|
|
838
|
+
/** Inspect an extracted or sealed package node without exposing sealed payload content. */
|
|
839
|
+
getPackageDescriptor(path: string, branch?: string): Promise<InstalledPackageDescriptor>;
|
|
840
|
+
/**
|
|
841
|
+
* Download a file or directory as an archive (zip or tgz).
|
|
842
|
+
* Only applicable when the target has children or you want a packaged download.
|
|
843
|
+
*/
|
|
844
|
+
readArchive(path: string, options?: ReadArchiveOptions): Promise<Blob>;
|
|
845
|
+
/**
|
|
846
|
+
* Upload an archive (zip or tgz) and auto-extract its contents as individual nodes.
|
|
847
|
+
* If the archive contains a `.verentis-manifest.json`, the original metadata
|
|
848
|
+
* (display names, mime types, parent-content relationships) will be honoured.
|
|
849
|
+
*/
|
|
850
|
+
extractUpload(path: string, file: Blob, options?: ExtractUploadOptions): Promise<void>;
|
|
851
|
+
/**
|
|
852
|
+
* Upload or create a file.
|
|
853
|
+
*/
|
|
854
|
+
write(path: string, options: WriteFileOptions): Promise<void>;
|
|
855
|
+
/**
|
|
856
|
+
* Move or rename a file.
|
|
857
|
+
*/
|
|
858
|
+
move(options: MoveFileOptions): Promise<void>;
|
|
859
|
+
/**
|
|
860
|
+
* Delete a file.
|
|
861
|
+
*/
|
|
862
|
+
remove(options: DeleteFileOptions): Promise<void>;
|
|
863
|
+
private workspaceHeaders;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/** Manage Marketplace installation ledger records for the current workspace. */
|
|
867
|
+
declare class InstallationsModule {
|
|
868
|
+
private readonly http;
|
|
869
|
+
private readonly workspaceId?;
|
|
870
|
+
constructor(http: HttpTransport, workspaceId?: string | undefined);
|
|
871
|
+
list(options?: InstallationListOptions): Promise<PagedResult<Installation>>;
|
|
872
|
+
resolve(installPath: string, options?: ResolveInstallationOptions): Promise<InstallationDetail>;
|
|
873
|
+
update(id: string, options?: UpdateInstallationOptions): Promise<InstallationLifecycleResult>;
|
|
874
|
+
uninstall(id: string, options?: InstallationScopedOptions): Promise<void>;
|
|
875
|
+
private requireWorkspaceId;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/** Read-only access to workspace Resource registrations and resolved application handlers. */
|
|
879
|
+
declare class ResourcesModule {
|
|
880
|
+
private readonly http;
|
|
881
|
+
private readonly workspaceId?;
|
|
882
|
+
constructor(http: HttpTransport, workspaceId?: string | undefined);
|
|
883
|
+
list(options?: ResourceScopedOptions): Promise<ResourceRegistration[]>;
|
|
884
|
+
get(id: string, options?: ResourceScopedOptions): Promise<ResourceRegistration>;
|
|
885
|
+
private requireWorkspaceId;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Workspace settings module. Reads (and where permitted, writes) workspace-scoped settings
|
|
890
|
+
* over the Verentis settings API (`/v1/settings`).
|
|
891
|
+
*
|
|
892
|
+
* The app token must carry the matching scopes, declared in the manifest's `spec.permissions`:
|
|
893
|
+
* `fabric.setting.read` (get), `fabric.setting.read-all` (list), `fabric.setting.update` (set)
|
|
894
|
+
* and `fabric.setting.delete` (reset).
|
|
895
|
+
*
|
|
896
|
+
* Secret values are server-only: for browser callers the platform always returns `value: null`
|
|
897
|
+
* for secrets while `hasValue` reports whether one is configured. Manifest-declared settings
|
|
898
|
+
* are stored namespaced as `{manifest-name}.{key}` — see {@link SettingsModule.namespaced}.
|
|
899
|
+
*/
|
|
900
|
+
declare class SettingsModule {
|
|
901
|
+
private readonly http;
|
|
902
|
+
private readonly workspaceId?;
|
|
903
|
+
constructor(http: HttpTransport, workspaceId?: string | undefined);
|
|
904
|
+
/** List every setting group visible to the workspace (definitions merged with values). */
|
|
905
|
+
list(options?: SettingsScopedOptions): Promise<SettingGroup[]>;
|
|
906
|
+
/** Get a single setting by its full key (e.g. `graphite.api-key`). */
|
|
907
|
+
get(key: string, options?: SettingsScopedOptions): Promise<SettingItem>;
|
|
908
|
+
/** Get a setting's value by its full key, or `defaultValue` when unset. */
|
|
909
|
+
getValue<T = unknown>(key: string, defaultValue?: T, options?: SettingsScopedOptions): Promise<T | undefined>;
|
|
910
|
+
/**
|
|
911
|
+
* Check exact setting keys for retained stored values and effective defaults.
|
|
912
|
+
* This never returns value content and also finds values retained after a definition is removed.
|
|
913
|
+
*/
|
|
914
|
+
presence(keys: string[], options?: SettingsScopedOptions): Promise<SettingPresence[]>;
|
|
915
|
+
/** Upsert a setting value by its full key. Requires the `fabric.setting.update` scope. */
|
|
916
|
+
set(key: string, value: unknown, options?: SettingsScopedOptions): Promise<void>;
|
|
917
|
+
/** Delete a stored value (reverting to the definition default). Requires `fabric.setting.delete`. */
|
|
918
|
+
reset(key: string, options?: SettingsScopedOptions): Promise<void>;
|
|
919
|
+
/**
|
|
920
|
+
* A view of this module where every key is auto-prefixed with `{namespace}.` — the platform's
|
|
921
|
+
* manifest namespacing convention. An app named `graphite` declaring `key: api-key` reads it as:
|
|
922
|
+
*
|
|
923
|
+
* ```ts
|
|
924
|
+
* const settings = client.settings.namespaced('graphite')
|
|
925
|
+
* const apiKey = await settings.getValue<string>('api-key')
|
|
926
|
+
* ```
|
|
927
|
+
*/
|
|
928
|
+
namespaced(namespace: string): NamespacedSettings;
|
|
929
|
+
private scopeParams;
|
|
930
|
+
private requireWorkspaceId;
|
|
931
|
+
}
|
|
932
|
+
/** Key-prefixed settings accessor returned by {@link SettingsModule.namespaced}. */
|
|
933
|
+
interface NamespacedSettings {
|
|
934
|
+
get(key: string, options?: SettingsScopedOptions): Promise<SettingItem>;
|
|
935
|
+
getValue<T = unknown>(key: string, defaultValue?: T, options?: SettingsScopedOptions): Promise<T | undefined>;
|
|
936
|
+
set(key: string, value: unknown, options?: SettingsScopedOptions): Promise<void>;
|
|
937
|
+
reset(key: string, options?: SettingsScopedOptions): Promise<void>;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
type BridgeEventType = HostToAppMessage['type'];
|
|
941
|
+
type BridgeListener = (data: HostToAppMessage) => void;
|
|
942
|
+
/**
|
|
943
|
+
* PostMessage bridge for communication between an app (iframe) and the
|
|
944
|
+
* workspace host. Handles the initialization handshake, token lifecycle,
|
|
945
|
+
* and app-to-host events (navigate, resize, dirty, etc.).
|
|
946
|
+
*/
|
|
947
|
+
declare class Bridge {
|
|
948
|
+
private listeners;
|
|
949
|
+
private _initResolve;
|
|
950
|
+
private _initPromise;
|
|
951
|
+
private _hostOrigin;
|
|
952
|
+
private _messageHandler;
|
|
953
|
+
private _destroyed;
|
|
954
|
+
constructor();
|
|
955
|
+
/** Post `verentis:ready` to the host to start the handshake */
|
|
956
|
+
sendReady(capabilities?: string[]): void;
|
|
957
|
+
/** Wait for the host to send `verentis:init` with context and token */
|
|
958
|
+
waitForInit(): Promise<{
|
|
959
|
+
context: AppContext;
|
|
960
|
+
token: TokenInfo;
|
|
961
|
+
}>;
|
|
962
|
+
/** Get the host origin (available after init) */
|
|
963
|
+
get hostOrigin(): string | null;
|
|
964
|
+
/** Send a message to the host */
|
|
965
|
+
postToHost(message: AppToHostMessage): void;
|
|
966
|
+
/**
|
|
967
|
+
* Navigate to another location in the workspace.
|
|
968
|
+
*
|
|
969
|
+
* @param path A workspace file path (e.g. `/reports/q1.json`) or an absolute
|
|
970
|
+
* http(s) URL. External URLs require the app to declare the
|
|
971
|
+
* `navigation:external` capability in its manifest.
|
|
972
|
+
* @param options Navigation options. Set `newTab: true` to open the target in
|
|
973
|
+
* a new browser tab instead of the current one.
|
|
974
|
+
*/
|
|
975
|
+
navigate(path: string, options?: NavigateOptions): void;
|
|
976
|
+
/** Request iframe resize */
|
|
977
|
+
resize(height: number): void;
|
|
978
|
+
/** Update the title displayed by the host */
|
|
979
|
+
setTitle(title: string): void;
|
|
980
|
+
/** Signal unsaved changes to the host */
|
|
981
|
+
setDirty(isDirty: boolean): void;
|
|
982
|
+
/** Subscribe to a specific message type from the host */
|
|
983
|
+
on(type: BridgeEventType, listener: BridgeListener): () => void;
|
|
984
|
+
/** Clean up event listeners */
|
|
985
|
+
destroy(): void;
|
|
986
|
+
private handleMessage;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* The main Verentis SDK client.
|
|
991
|
+
* Provides access to file operations, workspace context, and (in iframe mode)
|
|
992
|
+
* the host communication bridge.
|
|
993
|
+
*/
|
|
994
|
+
declare class VerentisClient {
|
|
995
|
+
files: FilesModule;
|
|
996
|
+
executions: ExecutionsModule;
|
|
997
|
+
engines: EnginesModule;
|
|
998
|
+
installations: InstallationsModule;
|
|
999
|
+
resources: ResourcesModule;
|
|
1000
|
+
settings: SettingsModule;
|
|
1001
|
+
readonly context: ContextModule;
|
|
1002
|
+
readonly bridge: Bridge | null;
|
|
1003
|
+
private readonly _auth;
|
|
1004
|
+
private _http;
|
|
1005
|
+
private _ready;
|
|
1006
|
+
constructor(options?: VerentisClientOptions);
|
|
1007
|
+
/**
|
|
1008
|
+
* Returns a promise that resolves when the client is fully initialized.
|
|
1009
|
+
* In standalone mode this resolves immediately.
|
|
1010
|
+
* In iframe mode this resolves after the host sends `verentis:init`.
|
|
1011
|
+
*/
|
|
1012
|
+
whenReady(): Promise<void>;
|
|
1013
|
+
/** Clean up resources (timers, event listeners) */
|
|
1014
|
+
destroy(): void;
|
|
1015
|
+
private initFromBridge;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Tests whether a MIME type matches a pattern.
|
|
1020
|
+
* Supports wildcards: `image/*` matches `image/png`, `*/*` matches everything.
|
|
1021
|
+
* Comparison is case-insensitive and ignores parameters (e.g. `; charset=utf-8`).
|
|
1022
|
+
*/
|
|
1023
|
+
declare function matchMimeType(pattern: string, mimeType: string): boolean;
|
|
1024
|
+
/**
|
|
1025
|
+
* Finds the best matching binding for a given MIME type.
|
|
1026
|
+
* Exact matches beat wildcard matches at the same priority level.
|
|
1027
|
+
* Higher priority values are preferred.
|
|
1028
|
+
*/
|
|
1029
|
+
declare function findBestMatch(mimeType: string, bindings: MimeTypeBinding[]): MimeTypeBinding | null;
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Authenticates with a Verentis API key (`vrt_` prefix).
|
|
1033
|
+
* The backend detects the `vrt_` prefix in the Bearer token and resolves it
|
|
1034
|
+
* as an API key rather than a JWT.
|
|
1035
|
+
*/
|
|
1036
|
+
declare class ApiKeyAuth implements AuthStrategy {
|
|
1037
|
+
private readonly apiKey;
|
|
1038
|
+
constructor(apiKey: string);
|
|
1039
|
+
getAuthHeader(): Promise<string>;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Authenticates with a pre-existing bearer token.
|
|
1044
|
+
* Tracks expiry and invokes an optional refresh callback before the token expires.
|
|
1045
|
+
*/
|
|
1046
|
+
declare class TokenAuth implements AuthStrategy {
|
|
1047
|
+
private _token;
|
|
1048
|
+
private _expiresAt;
|
|
1049
|
+
private _refreshTimer;
|
|
1050
|
+
private _refreshFn?;
|
|
1051
|
+
constructor(token: string, expiresAt?: string, refreshFn?: () => Promise<TokenInfo>);
|
|
1052
|
+
getAuthHeader(): Promise<string>;
|
|
1053
|
+
/** Update the token (e.g. after a refresh) */
|
|
1054
|
+
update(info: TokenInfo): void;
|
|
1055
|
+
destroy(): void;
|
|
1056
|
+
private isExpired;
|
|
1057
|
+
private refresh;
|
|
1058
|
+
private scheduleRefresh;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* Authenticates via the PostMessage bridge in iframe mode.
|
|
1063
|
+
* The token is received from the host during initialization and refreshed
|
|
1064
|
+
* by requesting a new token from the host when nearing expiry.
|
|
1065
|
+
*/
|
|
1066
|
+
declare class BridgeAuth implements AuthStrategy {
|
|
1067
|
+
private readonly hostOrigin;
|
|
1068
|
+
private _token;
|
|
1069
|
+
private _expiresAt;
|
|
1070
|
+
private _refreshTimer;
|
|
1071
|
+
private _pendingRefresh;
|
|
1072
|
+
private _messageHandler;
|
|
1073
|
+
constructor(hostOrigin: string);
|
|
1074
|
+
/** Set the initial token received from the host's `verentis:init` message */
|
|
1075
|
+
setToken(info: TokenInfo): void;
|
|
1076
|
+
getAuthHeader(): Promise<string | null>;
|
|
1077
|
+
destroy(): void;
|
|
1078
|
+
private isExpired;
|
|
1079
|
+
private _refreshResolve;
|
|
1080
|
+
private requestRefresh;
|
|
1081
|
+
private handleMessage;
|
|
1082
|
+
private scheduleRefresh;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* Create a new Verentis SDK client.
|
|
1087
|
+
*
|
|
1088
|
+
* @example Standalone mode (local development)
|
|
1089
|
+
* ```ts
|
|
1090
|
+
* const client = createVerentisClient({
|
|
1091
|
+
* apiUrl: 'https://api.verentis.com',
|
|
1092
|
+
* auth: { apiKey: 'vrt_abc123_...' },
|
|
1093
|
+
* workspaceId: 'workspace-uuid',
|
|
1094
|
+
* })
|
|
1095
|
+
*
|
|
1096
|
+
* const file = await client.files.get('/documents/report.json')
|
|
1097
|
+
* ```
|
|
1098
|
+
*
|
|
1099
|
+
* @example iframe mode (auto-detected at runtime)
|
|
1100
|
+
* ```ts
|
|
1101
|
+
* const client = createVerentisClient()
|
|
1102
|
+
* await client.whenReady()
|
|
1103
|
+
*
|
|
1104
|
+
* const { surface, workspace } = client.context
|
|
1105
|
+
* if (surface === 'file') {
|
|
1106
|
+
* const content = await client.files.readContent(client.context.file.path)
|
|
1107
|
+
* }
|
|
1108
|
+
* ```
|
|
1109
|
+
*/
|
|
1110
|
+
declare function createVerentisClient(options?: VerentisClientOptions): VerentisClient;
|
|
1111
|
+
|
|
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 };
|