@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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Verentis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # @verentis/sdk
2
+
3
+ Verentis SDK — file system access, app framework, and developer tools for building Verentis applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @verentis/sdk
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### Standalone mode (local development)
14
+
15
+ ```ts
16
+ import { createVerentisClient } from '@verentis/sdk'
17
+
18
+ const client = createVerentisClient({
19
+ apiUrl: 'https://api.verentis.com',
20
+ auth: { apiKey: 'vrt_abc123_...' },
21
+ workspaceId: 'workspace-uuid',
22
+ })
23
+
24
+ const file = await client.files.get('/documents/report.json')
25
+ ```
26
+
27
+ ### Running executions
28
+
29
+ Run a file in the virtual file system — the platform resolves the right engine from the file type
30
+ (e.g. a `.py` file runs on the Python engine), waits for it, and returns the result:
31
+
32
+ ```ts
33
+ import { createVerentisClient } from '@verentis/sdk'
34
+
35
+ const client = createVerentisClient({
36
+ apiUrl: 'https://api.verentis.com',
37
+ auth: { token: '...' },
38
+ workspaceId: 'workspace-uuid',
39
+ })
40
+
41
+ // Run a script and await the result (request-response engines return immediately).
42
+ const execution = await client.executions.runAndWait('/scripts/report.py', {
43
+ arguments: ['--verbose'],
44
+ parameters: { month: '2025-01' },
45
+ })
46
+
47
+ console.log(execution.status) // 'Completed'
48
+ console.log(execution.result?.stdout) // engine stdout
49
+
50
+ // Or trigger and inspect explicitly.
51
+ const started = await client.executions.run('/scripts/report.py')
52
+ const current = await client.executions.get(started.id)
53
+ const logs = await client.executions.logs(started.id)
54
+ await client.executions.cancel(started.id)
55
+ ```
56
+
57
+
58
+ ### iframe mode (inside Verentis workspace)
59
+
60
+ ```ts
61
+ import { createVerentisClient } from '@verentis/sdk'
62
+
63
+ const client = createVerentisClient()
64
+ await client.whenReady()
65
+
66
+ const { surface, workspace } = client.context
67
+
68
+ if (surface === 'file') {
69
+ const content = await client.files.readContent(client.context.file.path)
70
+ } else {
71
+ // A manifest-enabled spec.launch surface has workspace context but no file.
72
+ renderWorkspaceHome(workspace)
73
+ }
74
+ ```
75
+
76
+ `spec.launch` is still iframe mode: the host sends `surface: 'workspace'`, the selected
77
+ `entryPoint`, and no `file`. This is distinct from SDK standalone mode, where you pass `apiUrl`,
78
+ credentials and `workspaceId` yourself.
79
+
80
+ ## API Overview
81
+
82
+ | Export | Description |
83
+ | --- | --- |
84
+ | `createVerentisClient(options?)` | Factory function — creates a configured `VerentisClient` |
85
+ | `VerentisClient` | Main client class with `files`, `executions`, `settings`, `context`, and `bridge` |
86
+ | `FilesModule` | File operations — get, read, write, move, delete, archive |
87
+ | `ExecutionsModule` | Execution operations — run, execute, get, logs, cancel, wait |
88
+ | `SettingsModule` | Workspace settings — list, get, getValue, set, reset, namespaced |
89
+ | `ContextModule` | Workspace and launch-surface context (populated after init) |
90
+ | `Bridge` | PostMessage transport for iframe ↔ host communication |
91
+ | `HttpTransport` | HTTP client for API requests |
92
+ | `ApiKeyAuth` | Auth strategy using API keys |
93
+ | `TokenAuth` | Auth strategy using bearer tokens |
94
+ | `BridgeAuth` | Auth strategy that receives tokens via the bridge |
95
+ | `matchMimeType` / `findBestMatch` | MIME type matching utilities |
96
+
97
+ ### Workspace settings
98
+
99
+ Apps whose manifest declares `spec.settings[]` get workspace setting definitions auto-registered
100
+ (namespaced `{manifest-name}.{key}`). Read them with the settings module — the app token needs the
101
+ `fabric.setting.read` / `fabric.setting.read-all` permissions from `spec.permissions`:
102
+
103
+ ```ts
104
+ const settings = client.settings.namespaced('my-app')
105
+ const region = await settings.getValue<string>('region', 'eu')
106
+ ```
107
+
108
+ Secret values never reach the browser: secrets read as `value: null` with `hasValue` reporting
109
+ whether one is configured. Engines receive secrets server-side at execution time instead.
110
+
111
+ See [docs/api-reference.md](docs/api-reference.md) for full API documentation.
112
+
113
+ ## Development
114
+
115
+ ```bash
116
+ # Install dependencies
117
+ npm install
118
+
119
+ # Build the package
120
+ npm run build
121
+
122
+ # Run tests
123
+ npm test
124
+
125
+ # Watch mode (rebuild on changes)
126
+ npm run dev
127
+
128
+ # Type checking
129
+ npm run typecheck
130
+ ```
131
+
132
+ ## Versioning
133
+
134
+ This project uses [GitVersion](https://gitversion.net/) for automatic semantic versioning:
135
+
136
+ - Commits to `main` produce clean versions (e.g., `0.1.1`, `0.1.2`)
137
+ - Feature branches produce pre-release versions (e.g., `0.2.0-my-feature.1`)
138
+ - Use commit message tags to control version bumps:
139
+ - `+semver: breaking` or `+semver: major` — major bump
140
+ - `+semver: feature` or `+semver: minor` — minor bump
141
+ - `+semver: fix` or `+semver: patch` — patch bump (default)
142
+ - `+semver: none` or `+semver: skip` — no bump
143
+
144
+ ## License
145
+
146
+ UNLICENSED — proprietary software.